From a5fa9016ec13728d63bf1dc5b1e74553a1891e82 Mon Sep 17 00:00:00 2001 From: liningrui Date: Tue, 27 Jun 2017 10:22:10 +0800 Subject: [PATCH 001/217] HugeGraph-341: First commit hugegraph-common code Change-Id: Icc8f9121d56679b266459125afc33180d8b568bf --- .gitignore | 20 ++ BCLOUD | 1 + build.sh | 29 ++ pom.xml | 132 ++++++++ .../baidu/hugegraph/config/ConfigOption.java | 128 ++++++++ .../baidu/hugegraph/config/ConfigSpace.java | 42 +++ .../hugegraph/config/ConfigVerifier.java | 74 +++++ .../baidu/hugegraph/config/HugeConfig.java | 112 +++++++ .../baidu/hugegraph/config/OptionHolder.java | 42 +++ .../hugegraph/exception/ConfigException.java | 14 + .../com/baidu/hugegraph/perf/PerfUtil.java | 304 ++++++++++++++++++ .../com/baidu/hugegraph/perf/Stopwatch.java | 110 +++++++ .../hugegraph/type/ExtendableIterator.java | 47 +++ .../java/com/baidu/hugegraph/type/Split.java | 44 +++ .../com/baidu/hugegraph/util/CheckSocket.java | 55 ++++ .../baidu/hugegraph/util/CollectionUtil.java | 14 + src/main/java/com/baidu/hugegraph/util/E.java | 53 +++ .../com/baidu/hugegraph/util/HashUtil.java | 21 ++ .../baidu/hugegraph/util/LongEncoding.java | 63 ++++ .../com/baidu/hugegraph/util/NumericUtil.java | 143 ++++++++ .../baidu/hugegraph/util/ReflectionUtil.java | 79 +++++ .../com/baidu/hugegraph/util/TimeUtil.java | 28 ++ .../com/baidu/hugegraph/util/TriFunction.java | 5 + src/main/resources/log4j.properties | 24 ++ 24 files changed, 1584 insertions(+) create mode 100644 .gitignore create mode 100644 BCLOUD create mode 100644 build.sh create mode 100644 pom.xml create mode 100644 src/main/java/com/baidu/hugegraph/config/ConfigOption.java create mode 100644 src/main/java/com/baidu/hugegraph/config/ConfigSpace.java create mode 100644 src/main/java/com/baidu/hugegraph/config/ConfigVerifier.java create mode 100644 src/main/java/com/baidu/hugegraph/config/HugeConfig.java create mode 100644 src/main/java/com/baidu/hugegraph/config/OptionHolder.java create mode 100644 src/main/java/com/baidu/hugegraph/exception/ConfigException.java create mode 100644 src/main/java/com/baidu/hugegraph/perf/PerfUtil.java create mode 100644 src/main/java/com/baidu/hugegraph/perf/Stopwatch.java create mode 100644 src/main/java/com/baidu/hugegraph/type/ExtendableIterator.java create mode 100644 src/main/java/com/baidu/hugegraph/type/Split.java create mode 100644 src/main/java/com/baidu/hugegraph/util/CheckSocket.java create mode 100644 src/main/java/com/baidu/hugegraph/util/CollectionUtil.java create mode 100644 src/main/java/com/baidu/hugegraph/util/E.java create mode 100644 src/main/java/com/baidu/hugegraph/util/HashUtil.java create mode 100644 src/main/java/com/baidu/hugegraph/util/LongEncoding.java create mode 100644 src/main/java/com/baidu/hugegraph/util/NumericUtil.java create mode 100644 src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java create mode 100644 src/main/java/com/baidu/hugegraph/util/TimeUtil.java create mode 100644 src/main/java/com/baidu/hugegraph/util/TriFunction.java create mode 100644 src/main/resources/log4j.properties diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..d851342aac --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +.DS_Store +*.iml +*.iws +*.orig +*.rej +**/.keep +*.sdf +*.suo +*.vcxproj.user +*.swp +*.log +*.pyc +.idea +.svn +.classpath +.project +.settings +target +gen-java +build diff --git a/BCLOUD b/BCLOUD new file mode 100644 index 0000000000..bca03abdbe --- /dev/null +++ b/BCLOUD @@ -0,0 +1 @@ +BUILD_SUBMITTER -x -e CENTOS6U3 -m baidu/xbu-data/hugegraph-common -c "cd baidu/xbu-data/hugegraph-common && sh build.sh" -u ./ \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100644 index 0000000000..ae4a68cfa8 --- /dev/null +++ b/build.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +HUGEGRAPH_COMMON_RELEASE_PATH="${PWD}/output/" + +export MAVEN_HOME="/home/scmtools/buildkit/maven/apache-maven-3.3.9/" +export JAVA_HOME="/home/scmtools/buildkit/java/jdk1.8.0_25/" +export PATH="$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH" + +mvn clean package -DskipTests + +if [ -d $HUGEGRAPH_COMMON_RELEASE_PATH ]; then + echo "$HUGEGRAPH_COMMON_RELEASE_PATH is already exists." + exit 1 +fi + +mkdir -p $HUGEGRAPH_COMMON_RELEASE_PATH || echo "Failed to create directory: $HUGEGRAPH_COMMON_RELEASE_PATH" + +cp target/*.jar $HUGEGRAPH_COMMON_RELEASE_PATH +if [ $? -ne 0 ]; then + echo "Move jar to $HUGEGRAPH_COMMON_RELEASE_PATH failed." +else + echo "Build Succeed!" +fi + +echo "Deploy to baidu maven repository..." + +mvn deploy -DskipTests + +exit $? \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000000..c4b96f62b5 --- /dev/null +++ b/pom.xml @@ -0,0 +1,132 @@ + + + 4.0.0 + + com.baidu.hugegraph + hugegraph-common + 0.1.0-SNAPSHOT + + + ${project.basedir}/.. + hugegraph-bin + 1.8 + 1.8 + 1.7.5 + 1.2.17 + 1.10 + 2.1.1 + 3.2.2 + 20030203.000550 + 20041127.091804 + 19.0 + 1.0 + 3.0.1 + 3.21.0-GA + + + + + + log4j + log4j + ${log4j.version} + + + org.slf4j + slf4j-log4j12 + ${slf4j.version} + + + + + org.glassfish + javax.json + ${javax.json.version} + + + commons-configuration + commons-configuration + 1.10 + + + org.apache.commons + commons-configuration2 + ${commons.configuration2.version} + + + + commons-io + commons-io + ${commons.io.version} + + + commons-collections + commons-collections + ${commons.collections.version} + + + commons-codec + commons-codec + ${commons.codec.version} + + + com.google.guava + guava + ${guava.version} + + + + com.google.code.findbugs + jsr305 + ${jsr305.version} + + + + + org.javassist + javassist + ${javassist.version} + + + + + + + maven-compiler-plugin + 3.1 + + ${compiler.source} + ${compiler.target} + + 500 + + + -Xlint:unchecked + + + + + + maven-clean-plugin + 3.0.0 + + + + ${top.level.dir} + + *.tar.gz + + false + + + ${final.name} + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java new file mode 100644 index 0000000000..c1a634adda --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java @@ -0,0 +1,128 @@ +package com.baidu.hugegraph.config; + +import java.util.Set; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.base.Joiner; +import com.google.common.base.Preconditions; +import com.google.common.base.Predicate; +import com.google.common.collect.ImmutableSet; + +/** + * Created by liningrui on 2017/3/23. + */ +public class ConfigOption { + + private static final Logger logger = LoggerFactory.getLogger(ConfigOption.class); + + private static final Set> ACCEPTED_DATATYPES; + private static final String ACCEPTED_DATATYPES_STRING; + + static { + ACCEPTED_DATATYPES = ImmutableSet.of( + Boolean.class, + Short.class, + Integer.class, + Byte.class, + Long.class, + Float.class, + Double.class, + String.class, + String[].class + ); + + // StandardSerializer ss = new StandardSerializer(); + // for (Class c : ACCEPTED_DATATYPES) { + // if (!ss.validDataType(c)) { + // String msg = String.format("%s datatype %s is not accepted by %s", + // ConfigOption.class.getSimpleName(), c, StandardSerializer.class.getSimpleName()); + // log.error(msg); + // throw new IllegalStateException(msg); + // } + // } + + ACCEPTED_DATATYPES_STRING = Joiner.on(", ").join(ACCEPTED_DATATYPES); + } + + private final String name; + private final String desc; + private final Boolean rewritable; + private final Class dataType; + private T value; + private final Predicate verifyFunc; + + public ConfigOption(String name, T value, Boolean rewritable, String desc, Predicate verifyFunc) { + this(name, (Class) value.getClass(), value, rewritable, desc, verifyFunc); + } + + public ConfigOption(String name, Class dataType, T value, Boolean rewritable, String desc, + Predicate verifyFunc) { + Preconditions.checkNotNull(name); + Preconditions.checkNotNull(dataType); + Preconditions.checkNotNull(rewritable); + + if (!ACCEPTED_DATATYPES.contains(dataType)) { + String msg = String.format("Datatype %s is not one of %s", dataType, ACCEPTED_DATATYPES_STRING); + logger.error(msg); + throw new IllegalArgumentException(msg); + } + + this.name = name; + this.dataType = dataType; + this.value = value; + this.rewritable = rewritable; + this.desc = desc; + this.verifyFunc = verifyFunc; + + if (this.verifyFunc != null) { + verify(this.value); + } + } + + public String name() { + return name; + } + + public Class dataType() { + return dataType; + } + + /** + * @return + */ + public T value() { + return value; + } + + /** + * @param value + */ + public void value(T value) { + verify(value); + Preconditions.checkArgument(rewritable); + this.value = value; + } + + public T verify(Object input) { + Preconditions.checkNotNull(input); + Preconditions.checkArgument(dataType.isInstance(input), + "Invalid class for configuration value [%s]. Expected [%s] but given [%s]", this.toString(), dataType, + input.getClass()); + T result = (T) input; + Preconditions.checkArgument(verifyFunc.apply(result), "Invalid configuration value for [%s]: %s", + this.toString(), input); + return result; + } + + // public static final E getEnumValue(String str, Class enumClass) { + // str = str.trim(); + // if (StringUtils.isBlank(str)) return null; + // for (E e : enumClass.getEnumConstants()) { + // if (e.toString().equalsIgnoreCase(str)) return e; + // } + // throw new IllegalArgumentException("Invalid enum string provided for ["+enumClass+"]: " + str); + // } + +} diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigSpace.java b/src/main/java/com/baidu/hugegraph/config/ConfigSpace.java new file mode 100644 index 0000000000..8af61a3243 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/config/ConfigSpace.java @@ -0,0 +1,42 @@ +package com.baidu.hugegraph.config; + +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.base.Preconditions; +import com.google.common.collect.Maps; + +/** + * Created by liningrui on 2017/3/27. + */ +public class ConfigSpace { + + private static final Logger logger = LoggerFactory.getLogger(ConfigSpace.class); + + private static final Map options = Maps.newHashMap(); + + public static void register(OptionHolder holder) { + options.putAll(holder.options()); + logger.debug("Registered " + holder.getClass().getSimpleName()); + } + + public static void register(ConfigOption element) { + Preconditions.checkNotNull(element); + Preconditions.checkArgument(!options.containsKey(element.name()), + "An same config option has already been added to this " + + "namespace: %s", element.name()); + options.put(element.name(), element); + } + + public static Boolean containKey(String key) { + Preconditions.checkNotNull(key); + return options.containsKey(key); + } + + public static ConfigOption get(String key) { + Preconditions.checkNotNull(key); + return options.get(key); + } +} diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigVerifier.java b/src/main/java/com/baidu/hugegraph/config/ConfigVerifier.java new file mode 100644 index 0000000000..c422fbfcba --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/config/ConfigVerifier.java @@ -0,0 +1,74 @@ +package com.baidu.hugegraph.config; + +import java.lang.reflect.Array; +import java.util.Collection; + +import javax.annotation.Nullable; + +import org.apache.commons.lang3.StringUtils; + +import com.google.common.base.Predicate; + +/** + * Created by liningrui on 2017/3/23. + */ +public class ConfigVerifier { + + public static final Predicate disallowEmpty(Class clazz) { + return new Predicate() { + @Override + public boolean apply(@Nullable O o) { + if (o == null) { + return false; + } + if (o instanceof String) { + return StringUtils.isNotBlank((String) o); + } + if (o.getClass().isArray() && (Array.getLength(o) == 0 || Array.get(o, 0) == null)) { + return false; + } + if (o instanceof Collection && (((Collection) o).isEmpty() + || ((Collection) o).iterator().next() == null)) { + return false; + } + return true; + } + }; + } + + public static final Predicate positiveInt() { + return new Predicate() { + @Override + public boolean apply(@Nullable Integer num) { + return num != null && num > 0; + } + }; + } + + public static final Predicate nonNegativeInt() { + return new Predicate() { + @Override + public boolean apply(@Nullable Integer num) { + return num != null && num >= 0; + } + }; + } + + public static final Predicate positiveLong() { + return new Predicate() { + @Override + public boolean apply(@Nullable Long num) { + return num != null && num > 0; + } + }; + } + + public static final Predicate rangeInt(int min, int max) { + return new Predicate() { + @Override + public boolean apply(@Nullable Integer num) { + return num != null && num >= min && num <= max; + } + }; + } +} diff --git a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java new file mode 100644 index 0000000000..3b75d04e76 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2017 Baidu, Inc. All Rights Reserved. + */ + +package com.baidu.hugegraph.config; + +import java.io.File; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.lang.reflect.Method; +import java.util.Iterator; + +import org.apache.commons.configuration.AbstractFileConfiguration; +import org.apache.commons.configuration.Configuration; +import org.apache.commons.configuration.ConfigurationException; +import org.apache.commons.configuration.PropertiesConfiguration; +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.baidu.hugegraph.exception.ConfigException; +import com.baidu.hugegraph.util.E; + +public class HugeConfig extends PropertiesConfiguration { + + private static final Logger logger = LoggerFactory.getLogger(HugeConfig.class); + + public HugeConfig(Configuration config) { + if (config == null) { + throw new ConfigException("Config object is null."); + } + if (config instanceof AbstractFileConfiguration) { + File file = ((AbstractFileConfiguration) config).getFile(); + if (file != null) { + this.setFile(file); + } + } + + Iterator keys = config.getKeys(); + while (keys.hasNext()) { + String key = keys.next(); + this.setProperty(key.replace("..", "."), config.getProperty(key)); + } + + updateDefaultConfiguration(); + } + + public HugeConfig(String configFile) throws ConfigurationException { + super(loadConfigFile(configFile)); + updateDefaultConfiguration(); + } + + public HugeConfig(InputStream is) throws ConfigurationException { + this.load(new InputStreamReader(is)); + updateDefaultConfiguration(); + } + + private static File loadConfigFile(String fileName) { + E.checkArgument(StringUtils.isNotEmpty(fileName), + "Can't load config file: %s", fileName); + File file = new File(fileName); + E.checkArgument(file.exists() && file.isFile() && file.canRead(), + "Need to specify a readable config file, " + + "but was given: %s", file.toString()); + return file; + } + + public void updateDefaultConfiguration() { + try { + Iterator keys = this.getKeys(); + while (keys.hasNext()) { + String key = keys.next(); + if (!ConfigSpace.containKey(key)) { + logger.warn("A redundant config option is set:" + key); + continue; + } + ConfigOption option = ConfigSpace.get(key); + Class dataType = option.dataType(); + String getMethod = "get" + dataType.getSimpleName(); + Method method = this.getClass() + .getMethod(getMethod, String.class, dataType); + option.value(method.invoke(this, key, option.value())); + } + } catch (Exception e) { + logger.error(e.getMessage()); + throw new ConfigException(e.getMessage()); + } + } + + /** + * @param option + * @param + * + * @return + */ + public T get(ConfigOption option) { + return option.value(); + } + + @Override + public void addProperty(String key, Object value) { + if (value instanceof String) { + String val = (String) value; + if (val.startsWith("[") && val.endsWith("]")) { + val = val.substring(1, val.length() - 1); + } + value = val; + } + super.addProperty(key, value); + } + +} diff --git a/src/main/java/com/baidu/hugegraph/config/OptionHolder.java b/src/main/java/com/baidu/hugegraph/config/OptionHolder.java new file mode 100644 index 0000000000..ce72f71789 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/config/OptionHolder.java @@ -0,0 +1,42 @@ +package com.baidu.hugegraph.config; + +import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.baidu.hugegraph.exception.ConfigException; + +/** + * Created by liningrui on 2017/5/25. + */ +public class OptionHolder { + + private static final Logger logger = LoggerFactory.getLogger(HugeConfig.class); + + protected Map options; + + public OptionHolder() { + this.options = new HashMap<>(); + } + + protected void registerOptions() { + Field[] fields = this.getClass().getFields(); + for (Field field : fields) { + try { + ConfigOption option = (ConfigOption)field.get(this); + this.options.put(option.name(), option); + } catch (Exception e) { + String msg = String.format("Failed to regiser option : %s", field); + logger.error(msg, e); + throw new ConfigException(msg, e); + } + } + } + + public Map options() { + return options; + } +} diff --git a/src/main/java/com/baidu/hugegraph/exception/ConfigException.java b/src/main/java/com/baidu/hugegraph/exception/ConfigException.java new file mode 100644 index 0000000000..e1914112c0 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/exception/ConfigException.java @@ -0,0 +1,14 @@ +package com.baidu.hugegraph.exception; + +public class ConfigException extends RuntimeException { + + private static final long serialVersionUID = -8711375282196157058L; + + public ConfigException(String message) { + super(message); + } + + public ConfigException(String msg, Throwable cause) { + super(msg, cause); + } +} diff --git a/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java b/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java new file mode 100644 index 0000000000..846bd09769 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java @@ -0,0 +1,304 @@ +package com.baidu.hugegraph.perf; + +import java.io.IOException; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.security.InvalidParameterException; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Stack; +import java.util.function.BiConsumer; +import java.util.stream.Stream; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.baidu.hugegraph.util.ReflectionUtil; +import com.baidu.hugegraph.util.TriFunction; +import com.google.common.reflect.ClassPath.ClassInfo; + +import javassist.CannotCompileException; +import javassist.ClassPool; +import javassist.CtClass; +import javassist.CtMethod; +import javassist.NotFoundException; + +public class PerfUtil { + + private static final Logger logger = LoggerFactory.getLogger(PerfUtil.class); + private static ThreadLocal instance = new ThreadLocal<>(); + + private Map stopwatches; + private Stack callStack; + + private PerfUtil() { + this.stopwatches = new HashMap<>(); + this.callStack = new Stack(); + } + + public static PerfUtil instance() { + PerfUtil p = instance.get(); + if (p == null) { + p = new PerfUtil(); + instance.set(p); + } + return p; + } + + private static long now() { + return System.nanoTime(); + } + + public boolean start(String name) { + String parent = this.callStack.empty() ? "" : this.callStack.peek(); + Stopwatch item = this.stopwatches.get(Stopwatch.id(parent, name)); + if (item == null) { + item = new Stopwatch(name, parent); + this.stopwatches.put(item.id(), item); + } + this.callStack.push(item.id()); + item.startTime(now()); + + return true; // just for assert + } + + public boolean end(String name) { + String current = this.callStack.pop(); + assert current.endsWith(name); + + String parent = this.callStack.empty() ? "" : this.callStack.peek(); + Stopwatch item = this.stopwatches.get(Stopwatch.id(parent, name)); + if (item == null) { + throw new InvalidParameterException(name); + } + item.endTime(now()); + + return true; + } + + public void profilePackage(String... packages) throws + NotFoundException, CannotCompileException, + ClassNotFoundException, IOException { + Set loadedClasses = new LinkedHashSet<>(); + + Iterator classes = ReflectionUtil.classes(packages); + while (classes.hasNext()) { + String cls = classes.next().getName(); + // super class first + for (String s : ReflectionUtil.superClasses(cls)) { + if (!loadedClasses.contains(s)) { + profileClass(s); + loadedClasses.add(s); + } + } + // self class + if (!loadedClasses.contains(cls)) { + profileClass(cls); + loadedClasses.add(cls); + } + } + } + + public void profileClass(String... classes) throws + NotFoundException, CannotCompileException, ClassNotFoundException { + ClassPool classPool = ClassPool.getDefault(); + + for (String cls : classes) { + CtClass ctClass = classPool.get(cls); + List methods = ReflectionUtil.getMethodsAnnotatedWith( + ctClass, Watched.class, false); + for (CtMethod method : methods) { + profile(method); + } + + // load class and make it effective + if (!methods.isEmpty()) { + ctClass.toClass(); + } + } + } + + private void profile(CtMethod ctMethod) + throws CannotCompileException, ClassNotFoundException { + final String START = + "com.baidu.hugegraph.perf.PerfUtil.instance().start(\"%s\");"; + final String END = + "com.baidu.hugegraph.perf.PerfUtil.instance().end(\"%s\");"; + + Watched annotation = (Watched) ctMethod.getAnnotation(Watched.class); + + String name = annotation.value(); + if (name.isEmpty()) { + name = ctMethod.getName(); + } + if (!annotation.prefix().isEmpty()) { + name = annotation.prefix() + "." + name; + } + + ctMethod.insertBefore(String.format(START, name)); + ctMethod.insertAfter(String.format(END, name), true); // asFinally true + + logger.debug("Profiled for: '{}' [{}]", name, ctMethod.getLongName()); + } + + @Override + public String toString() { + return this.stopwatches.toString(); + } + + public String toJson() { + StringBuilder sb = new StringBuilder(8 + this.stopwatches.size() * 96); + sb.append('{'); + for (Map.Entry w : this.stopwatches.entrySet()) { + sb.append('"'); + sb.append(w.getKey()); + sb.append('"'); + + sb.append(':'); + + sb.append(w.getValue().toJson()); + + sb.append(','); + } + if (!this.stopwatches.isEmpty()) { + sb.deleteCharAt(sb.length() - 1); + } + sb.append('}'); + return sb.toString(); + } + + // TODO: move toECharts() method out of this class + public String toECharts() { + + TriFunction, String> formatLevel = ( + totalDepth, depth, items) -> { + float factor = 100.0f / (totalDepth + 1); + float showFactor = 1 + (totalDepth - depth) / (float) depth; + + float radiusFrom = depth * factor; + float radiusTo = depth * factor + factor; + if (depth == 1) { + radiusFrom = 0; + } + + StringBuilder sb = new StringBuilder(8 + items.size() * 128); + sb.append('{'); + sb.append("name: 'Total Cost',"); + sb.append("type: 'pie',"); + sb.append(String.format("radius: ['%s%%', '%s%%'],", + radiusFrom, radiusTo)); + sb.append(String.format( + "label: {normal: {position: 'inner', formatter:" + + "function(params) {" + + " if (params.percent > %s) return params.data.name;" + + " else return '';" + + "}}},", showFactor)); + sb.append("data: ["); + + items.sort((i, j) -> i.id().compareTo(j.id())); + for (Stopwatch w : items) { + sb.append('{'); + + sb.append("value:"); + sb.append(w.totalCost() / 1000000.0); + sb.append(','); + + sb.append("min:"); + sb.append(w.minCost()); + sb.append(','); + + sb.append("max:"); + sb.append(w.maxCost()); + sb.append(','); + + sb.append("id:'"); + sb.append(w.id()); + sb.append("',"); + + sb.append("name:'"); + sb.append(w.name()); + sb.append("',"); + + sb.append("times:"); + sb.append(w.times()); + + sb.append('}'); + sb.append(','); + } + if (!items.isEmpty()) { + sb.deleteCharAt(sb.length() - 1); + } + sb.append("]}"); + return sb.toString(); + }; + + BiConsumer, List> fillOther = ( + itemsOfI, parents) -> { + for (Stopwatch parent : parents) { + Stream children = itemsOfI.stream().filter(c -> { + return c.parent().equals(parent.id()); + }); + long sum = children.mapToLong(c -> c.totalCost()).sum(); + if (sum < parent.totalCost()) { + Stopwatch other = new Stopwatch("~", parent.id()); + other.totalCost(parent.totalCost() - sum); + itemsOfI.add(other); + } + } + }; + + Map items = this.stopwatches; + Map> levelItems = new HashMap<>(); + int maxDepth = 1; + for (Map.Entry e : items.entrySet()) { + int depth = e.getKey().split("/").length; + levelItems.putIfAbsent(depth, new LinkedList<>()); + levelItems.get(depth).add(e.getValue().copy()); + if (depth > maxDepth) { + maxDepth = depth; + } + } + + StringBuilder sb = new StringBuilder(8 + items.size() * 128); + sb.append("{"); + sb.append("tooltip: {trigger: 'item', " + + "formatter: function(params) {" + + " return params.data.name + ' ' + params.percent + '%
'" + + " + 'cost: ' + params.data.value + ' (ms)
'" + + " + 'min: ' + params.data.min + ' (ns)
'" + + " + 'max: ' + params.data.max + ' (ns)
'" + + " + 'times: ' + params.data.times + '
'" + + " + params.data.id + '
';" + + "}"); + sb.append("},"); + sb.append("series: ["); + for (int i = 1; levelItems.containsKey(i); i++) { + List itemsOfI = levelItems.get(i); + if (i > 1) { + fillOther.accept(itemsOfI, levelItems.get(i - 1)); + } + sb.append(formatLevel.apply(maxDepth, i, itemsOfI)); + sb.append(','); + } + if (!items.isEmpty()) { + sb.deleteCharAt(sb.length() - 1); + } + sb.append("]}"); + + return sb.toString(); + } + + @Retention(RetentionPolicy.RUNTIME) + @Target(ElementType.METHOD) + public static @interface Watched { + public String value() default ""; + public String prefix() default ""; + } +} diff --git a/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java b/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java new file mode 100644 index 0000000000..da6d451d2d --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java @@ -0,0 +1,110 @@ +package com.baidu.hugegraph.perf; + +public class Stopwatch implements Cloneable { + private long lastStartTime = -1; + + private long totalCost = 0; + private long minCost = 0; + private long maxCost = 0; + + private long times = 0; + + private String name; + private String parent; + + public Stopwatch(String name, String parent) { + this.name = name; + this.parent = parent; + } + + public String id() { + return id(this.parent, this.name); + } + + public static String id(String parent, String name) { + if (parent == null || parent.isEmpty()) { + return name; + } + return parent + "/" + name; + } + + public String name() { + return this.name; + } + + public String parent() { + return this.parent; + } + + public void startTime(long time) { + assert this.lastStartTime == -1; + this.lastStartTime = time; + this.times++; + } + + public void endTime(long time) { + assert time >= this.lastStartTime && this.lastStartTime != -1; + long cost = time - this.lastStartTime; + this.totalCost += cost; + this.lastStartTime = -1; + this.updateMinMax(cost); + } + + protected void updateMinMax(long cost) { + if (this.minCost > cost || this.minCost == 0) { + this.minCost = cost; + } + if (this.maxCost < cost) { + this.maxCost = cost; + } + } + + protected void totalCost(long totalCost) { + this.totalCost = totalCost; + } + + public long totalCost() { + return this.totalCost; + } + + public long minCost() { + return this.minCost; + } + + public long maxCost() { + return this.maxCost; + } + + public long times() { + return this.times; + } + + public Stopwatch copy() { + try { + return (Stopwatch) super.clone(); + } catch (CloneNotSupportedException e) { + throw new RuntimeException(e); + } + } + + @Override + public String toString() { + return String.format( + "{totalCost:%sms, minCost:%sns, maxCost:%sns, times:%s}", + this.totalCost / 1000000.0, + this.minCost, this.maxCost, + this.times); + } + + public String toJson() { + return String.format("{\"totalCost\":%s, " + + "\"minCost\":%s, \"maxCost\":%s, \"times\":%s, " + + "\"name\":\"%s\", \"parent\":\"%s\"}", + this.totalCost, + this.minCost, + this.maxCost, + this.times, + this.name, + this.parent); + } +} diff --git a/src/main/java/com/baidu/hugegraph/type/ExtendableIterator.java b/src/main/java/com/baidu/hugegraph/type/ExtendableIterator.java new file mode 100644 index 0000000000..7a1b54bdfa --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/type/ExtendableIterator.java @@ -0,0 +1,47 @@ +package com.baidu.hugegraph.type; + +import java.util.Deque; +import java.util.Iterator; +import java.util.concurrent.ConcurrentLinkedDeque; + +public class ExtendableIterator implements Iterator { + + private Deque> itors; + + public ExtendableIterator() { + this.itors = new ConcurrentLinkedDeque>(); + } + + public ExtendableIterator(Iterator itor) { + this(); + this.extend(itor); + } + + public ExtendableIterator(Iterator itor1, Iterator itor2) { + this(); + this.extend(itor1); + this.extend(itor2); + } + + @Override + public boolean hasNext() { + // this is true since we never hold empty iterators + return !this.itors.isEmpty() && this.itors.peekLast().hasNext(); + } + + @Override + public T next() { + T next = this.itors.peekFirst().next(); + if (!this.itors.peekFirst().hasNext()) { + this.itors.removeFirst(); + } + return next; + } + + public ExtendableIterator extend(Iterator itor) { + if (itor != null && itor.hasNext()) { + this.itors.addLast(itor); + } + return this; + } +} diff --git a/src/main/java/com/baidu/hugegraph/type/Split.java b/src/main/java/com/baidu/hugegraph/type/Split.java new file mode 100644 index 0000000000..d92614253d --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/type/Split.java @@ -0,0 +1,44 @@ +package com.baidu.hugegraph.type; + +public class Split { + + private String start; // token range start + private String end; // token range end + private long length; // partitions count in this range + + public Split(String start, String end, long length) { + this.start = start; + this.end = end; + this.length = length; + } + + public String start() { + return this.start; + } + + public void start(String start) { + this.start = start; + } + + public String end() { + return this.end; + } + + public void end(String end) { + this.end = end; + } + + public long length() { + return this.length; + } + + public void length(long length) { + this.length = length; + } + + @Override + public String toString() { + return String.format("Split{start=%s, end=%s, length=%s}", + this.start, this.end, this.length); + } +} \ No newline at end of file diff --git a/src/main/java/com/baidu/hugegraph/util/CheckSocket.java b/src/main/java/com/baidu/hugegraph/util/CheckSocket.java new file mode 100644 index 0000000000..8b7893185c --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/util/CheckSocket.java @@ -0,0 +1,55 @@ +// Copyright 2017 JanusGraph Authors +// +// Licensed 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 com.baidu.hugegraph.util; + +import java.net.InetAddress; +import java.net.Socket; + +/* + * This doesn't really belong here. It's only used in the zipfile + * distribution to check whether Gremlin Server or ES are listening on + * their respective TCP ports. But it's so tiny that I don't want + * to reorganize the repo to accommodate it (yet). + * + * Many widely available *NIX programs do this task better (e.g. + * netcat, telnet, nmap, socat, ... we could even use netstat since + * we're interested only in the status of local ports). But we want + * to keep the JanusGraph distribution self-contained insofar as is + * reasonable. + */ +public class CheckSocket { + + public static final int E_USAGE = 1; + public static final int E_FAILED = 2; + public static final String MSG_USAGE = + "Usage: " + CheckSocket.class.getSimpleName() + " hostname port"; + + public static void main(String args[]) { + if (2 != args.length) { + System.err.println(MSG_USAGE); + System.exit(E_USAGE); + } + try { + Socket s = new Socket( + InetAddress.getByName(args[0]), + Integer.valueOf(args[1]).intValue()); + s.close(); + System.exit(0); + } catch (Throwable t) { + System.err.println(t.toString()); + System.exit(E_FAILED); + } + } +} diff --git a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java new file mode 100644 index 0000000000..e35ad460f3 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java @@ -0,0 +1,14 @@ +package com.baidu.hugegraph.util; + +import java.util.Collection; + +/** + * Created by liningrui on 2017/3/30. + */ +public class CollectionUtil { + + @SuppressWarnings({ "unchecked", "rawtypes" }) + public static boolean containsAll(Collection a, Collection b) { + return a.containsAll(b); + } +} diff --git a/src/main/java/com/baidu/hugegraph/util/E.java b/src/main/java/com/baidu/hugegraph/util/E.java new file mode 100644 index 0000000000..cefe26a958 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/util/E.java @@ -0,0 +1,53 @@ +package com.baidu.hugegraph.util; + +import java.util.Collection; + +import javax.annotation.Nullable; + +import com.google.common.base.Preconditions; + +/** + * Created by liningrui on 2017/5/26. + */ +public class E { + + public static void checkNotNull(Object object, String elem) { + Preconditions.checkNotNull(object, "The '%s' can't be null", elem); + } + + public static void checkNotNull(Object object, String elem, String owner) { + Preconditions.checkNotNull(object, "The '%s' of '%s' can't be null", + elem, owner); + } + + public static void checkNotEmpty(Collection collection, String elem) { + Preconditions.checkArgument(!collection.isEmpty(), + "The '%s' can't be empty", elem); + } + + public static void checkNotEmpty(Collection collection, + String elem, + String owner) { + Preconditions.checkArgument(!collection.isEmpty(), + "The '%s' of '%s' can't be empty", + elem, owner); + } + + public static void checkArgument(boolean expression, + @Nullable String message, + @Nullable Object... args) { + Preconditions.checkArgument(expression, message, args); + } + + public static void checkArgumentNotNull(Object object, + @Nullable String message, + @Nullable Object... args) { + Preconditions.checkArgument(object != null, message, args); + } + + public static void checkState(boolean expression, + @Nullable String message, + @Nullable Object... args) { + Preconditions.checkState(expression, message, args); + } +} diff --git a/src/main/java/com/baidu/hugegraph/util/HashUtil.java b/src/main/java/com/baidu/hugegraph/util/HashUtil.java new file mode 100644 index 0000000000..4ee1acdb30 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/util/HashUtil.java @@ -0,0 +1,21 @@ +package com.baidu.hugegraph.util; + +import java.nio.charset.Charset; + +import com.google.common.hash.Hashing; + +/** + * Created by jishilei on 2017/3/26. + */ +public class HashUtil { + + public static byte[] hash(byte[] bytes) { + return Hashing.murmur3_32().hashBytes(bytes).asBytes(); + } + + public static String hash(String value) { + final Charset charset = Charset.forName("UTF-8"); + return Hashing.murmur3_32().hashString(value, charset).toString(); + } + +} diff --git a/src/main/java/com/baidu/hugegraph/util/LongEncoding.java b/src/main/java/com/baidu/hugegraph/util/LongEncoding.java new file mode 100644 index 0000000000..214256b491 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/util/LongEncoding.java @@ -0,0 +1,63 @@ +/* + * 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 com.baidu.hugegraph.util; + +import com.google.common.base.Preconditions; + +/** + * Utility class for encoding longs in strings based on: + * {@linktourl http://stackoverflow.com/questions/2938482/encode-decode-a-long-to-a-string-using-a-fixed-set-of-letters-in-java} + * + */ +public class LongEncoding { + + private static final String BASE_SYMBOLS = "0123456789abcdefghijklmnopqrstuvwxyz"; + + public static long decode(String s) { + return decode(s, BASE_SYMBOLS); + } + + public static String encode(long num) { + return encode(num, BASE_SYMBOLS); + } + + public static long decode(String s, String symbols) { + final int B = symbols.length(); + long num = 0; + for (char ch : s.toCharArray()) { + num *= B; + int pos = symbols.indexOf(ch); + if (pos < 0) + throw new NumberFormatException("Symbol set does not match string"); + num += pos; + } + return num; + } + + public static String encode(long num, String symbols) { + Preconditions.checkArgument(num >= 0, "Expected non-negative number: " + num); + final int B = symbols.length(); + StringBuilder sb = new StringBuilder(); + while (num != 0) { + sb.append(symbols.charAt((int) (num % B))); + num /= B; + } + return sb.reverse().toString(); + } + +} diff --git a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java new file mode 100644 index 0000000000..3cd99e75b2 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java @@ -0,0 +1,143 @@ +/* + * 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 com.baidu.hugegraph.util; + +import java.math.BigDecimal; +import java.nio.ByteBuffer; +import java.util.Date; + +/** + * This file is copied verbatim from Apache Lucene NumericUtils.java Only the + * double/float to sortable long/int conversions are retained. + */ +public final class NumericUtil { + + private NumericUtil() { + } // no instance! + + /** + * Converts a double value to a sortable signed + * long. The value is converted by getting their IEEE 754 + * floating-point "double format" bit layout and then some bits + * are swapped, to be able to compare the result as long. By this the + * precision is not reduced, but the value can easily used as a long. The + * sort order (including {@link Double#NaN}) is defined by + * {@link Double#compareTo}; {@code NaN} is greater than positive infinity. + * + * @see #sortableLongToDouble + */ + public static long doubleToSortableLong(double val) { + return sortableDoubleBits(Double.doubleToLongBits(val)); + } + + /** + * Converts a sortable long back to a double. + * + * @see #doubleToSortableLong + */ + public static double sortableLongToDouble(long val) { + return Double.longBitsToDouble(sortableDoubleBits(val)); + } + + /** + * Converts a float value to a sortable signed + * int. The value is converted by getting their IEEE 754 + * floating-point "float format" bit layout and then some bits are + * swapped, to be able to compare the result as int. By this the precision + * is not reduced, but the value can easily used as an int. The sort order + * (including {@link Float#NaN}) is defined by {@link Float#compareTo}; + * {@code NaN} is greater than positive infinity. + * + * @see #sortableIntToFloat + */ + public static int floatToSortableInt(float val) { + return sortableFloatBits(Float.floatToIntBits(val)); + } + + /** + * Converts a sortable int back to a float. + * + * @see #floatToSortableInt + */ + public static float sortableIntToFloat(int val) { + return Float.intBitsToFloat(sortableFloatBits(val)); + } + + /** + * Converts IEEE 754 representation of a double to sortable order (or back + * to the original) + */ + public static long sortableDoubleBits(long bits) { + return bits ^ (bits >> 63) & 0x7fffffffffffffffL; + } + + /** + * Converts IEEE 754 representation of a float to sortable order (or back to + * the original) + */ + public static int sortableFloatBits(int bits) { + return bits ^ (bits >> 31) & 0x7fffffff; + } + + /*************************************************************************/ + + public static byte[] longToBytes(long value) { + ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES); + buffer.putLong(value); + return buffer.array(); + } + + public static long bytesToLong(byte[] bytes) { + ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES); + buffer.put(bytes); + buffer.flip(); + return buffer.getLong(); + } + + /*************************************************************************/ + + public static boolean isNumber(Object value) { + if (value == null) { + return false; + } + return isNumber(value.getClass()); + } + + public static boolean isNumber(Class type) { + if (type.getSuperclass() != null + && type.getSuperclass().equals(Number.class)) { + return true; + } + return false; + } + + /*************************************************************************/ + + public static Object convert2Number(Object value) { + if (!isNumber(value) && value != null) { + if (value instanceof Date) { + value = ((Date) value).getTime(); + } + // TODO: add some more types to convert + + value = new BigDecimal(value.toString()); + } + return value; + } + +} diff --git a/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java b/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java new file mode 100644 index 0000000000..40d5e6a331 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java @@ -0,0 +1,79 @@ +package com.baidu.hugegraph.util; + +import java.io.IOException; +import java.lang.annotation.Annotation; +import java.lang.reflect.Method; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +import com.baidu.hugegraph.type.ExtendableIterator; +import com.google.common.collect.Lists; +import com.google.common.reflect.ClassPath; +import com.google.common.reflect.ClassPath.ClassInfo; + +import javassist.ClassPool; +import javassist.CtClass; +import javassist.CtMethod; +import javassist.NotFoundException; + +public class ReflectionUtil { + + public static List getMethodsAnnotatedWith( + Class type, + Class annotation, + boolean withSuperClass) { + final List methods = new LinkedList<>(); + Class klass = type; + do { + for (Method method : klass.getDeclaredMethods()) { + if (method.isAnnotationPresent(annotation)) { + methods.add(method); + } + } + klass = klass.getSuperclass(); + } while (klass != Object.class && withSuperClass); + return methods; + } + + public static List getMethodsAnnotatedWith( + CtClass type, + Class annotation, + boolean withSuperClass) throws NotFoundException { + final List methods = new LinkedList<>(); + + CtClass klass = type; + do { + for (CtMethod method : klass.getDeclaredMethods()) { + if (method.hasAnnotation(annotation)) { + methods.add(method); + } + } + klass = klass.getSuperclass(); + } while (klass != null && withSuperClass); + return methods; + } + + public static Iterator classes(String... packages) + throws IOException { + ClassPath path = ClassPath.from(ReflectionUtil.class.getClassLoader()); + ExtendableIterator results = new ExtendableIterator<>(); + for (String p : packages) { + results.extend(path.getTopLevelClassesRecursive(p).iterator()); + } + return results; + } + + public static List superClasses(String clazz) + throws NotFoundException { + CtClass klass = ClassPool.getDefault().get(clazz); + klass = klass.getSuperclass(); + + List results = new LinkedList<>(); + while (klass != null) { + results.add(klass.getName()); + klass = klass.getSuperclass(); + } + return Lists.reverse(results); + } +} diff --git a/src/main/java/com/baidu/hugegraph/util/TimeUtil.java b/src/main/java/com/baidu/hugegraph/util/TimeUtil.java new file mode 100644 index 0000000000..29ce4f12fe --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/util/TimeUtil.java @@ -0,0 +1,28 @@ +package com.baidu.hugegraph.util; + +import java.util.Date; + +public class TimeUtil { + + public static long twepoch = 1288834974657L; + + public static long timeGen() { + return System.currentTimeMillis() - twepoch; + } + + public static long timeGen(Date date) { + return date.getTime() - twepoch; + } + + public static long timeGen(long time) { + return time - twepoch; + } + + public static long tilNextMillis(long lastTimestamp) { + long timestamp = timeGen(); + while (timestamp <= lastTimestamp) { + timestamp = timeGen(); + } + return timestamp; + } +} diff --git a/src/main/java/com/baidu/hugegraph/util/TriFunction.java b/src/main/java/com/baidu/hugegraph/util/TriFunction.java new file mode 100644 index 0000000000..919c2c811e --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/util/TriFunction.java @@ -0,0 +1,5 @@ +package com.baidu.hugegraph.util; + +public interface TriFunction { + public String apply(T1 v1, T2 v2, T3 v3); +} diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties new file mode 100644 index 0000000000..3e9f7e1550 --- /dev/null +++ b/src/main/resources/log4j.properties @@ -0,0 +1,24 @@ +log4j.rootLogger=INFO, console, file + +log4j.logger.org.apache.cassandra=INFO +log4j.logger.org.apache.hadoop=INFO +log4j.logger.com.datastax.driver=WARN +log4j.logger.io.netty=INFO +log4j.logger.org.apache.commons=INFO +log4j.logger.com.baidu.hugegraph=INFO + +# Console Logger. +log4j.appender.console=org.apache.log4j.ConsoleAppender +log4j.appender.console.Threshold=DEBUG +log4j.appender.console.layout=org.apache.log4j.PatternLayout +log4j.appender.console.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss} %-5r\ + [%t] [%-5p] %c %x - %m%n + +# File Logger +log4j.appender.file=org.apache.log4j.DailyRollingFileAppender +log4j.appender.file.File=logs/hugegraph-common.log +log4j.appender.file.Threshold=INFO +log4j.appender.file.DatePattern='-'yyyy-MM-dd'.log' +log4j.appender.file.layout=org.apache.log4j.PatternLayout +log4j.appender.file.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss} %-5r\ + [%t] [%-5p] %c %x - %m%n From 5f305526d7dc39dbed60ead3570cd0c73d62097c Mon Sep 17 00:00:00 2001 From: liningrui Date: Tue, 27 Jun 2017 10:50:11 +0800 Subject: [PATCH 002/217] HugeGraph-344: add distributionManagement to deploy baidu maven repository Change-Id: I198cd1e8a7d34a85d08b93261f33f07bb29335c9 --- pom.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pom.xml b/pom.xml index c4b96f62b5..72c81497b1 100644 --- a/pom.xml +++ b/pom.xml @@ -8,6 +8,13 @@ hugegraph-common 0.1.0-SNAPSHOT + + + Baidu_Local_Snapshots + http://maven.scm.baidu.com:8081/nexus/content/repositories/Baidu_Local_Snapshots + + + ${project.basedir}/.. hugegraph-bin From 3e5f626d118e168776cd48fe774b940c01d4164a Mon Sep 17 00:00:00 2001 From: liningrui Date: Wed, 28 Jun 2017 11:49:28 +0800 Subject: [PATCH 003/217] HugeGraph-351: code format and clean up some warnings Change-Id: I16d328738ead94efcad9d82bb8f27be2c4ca84a9 --- .../baidu/hugegraph/config/ConfigOption.java | 78 +++++++------------ .../baidu/hugegraph/config/HugeConfig.java | 31 ++++---- ...ConfigVerifier.java => OptionChecker.java} | 9 ++- .../baidu/hugegraph/config/OptionHolder.java | 2 +- .../{ConfigSpace.java => OptionSpace.java} | 15 ++-- 5 files changed, 53 insertions(+), 82 deletions(-) rename src/main/java/com/baidu/hugegraph/config/{ConfigVerifier.java => OptionChecker.java} (91%) rename src/main/java/com/baidu/hugegraph/config/{ConfigSpace.java => OptionSpace.java} (66%) diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java index c1a634adda..240c7651e3 100644 --- a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java +++ b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java @@ -5,6 +5,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.baidu.hugegraph.util.E; import com.google.common.base.Joiner; import com.google.common.base.Preconditions; import com.google.common.base.Predicate; @@ -33,16 +34,6 @@ public class ConfigOption { String[].class ); - // StandardSerializer ss = new StandardSerializer(); - // for (Class c : ACCEPTED_DATATYPES) { - // if (!ss.validDataType(c)) { - // String msg = String.format("%s datatype %s is not accepted by %s", - // ConfigOption.class.getSimpleName(), c, StandardSerializer.class.getSimpleName()); - // log.error(msg); - // throw new IllegalStateException(msg); - // } - // } - ACCEPTED_DATATYPES_STRING = Joiner.on(", ").join(ACCEPTED_DATATYPES); } @@ -51,20 +42,18 @@ public class ConfigOption { private final Boolean rewritable; private final Class dataType; private T value; - private final Predicate verifyFunc; - - public ConfigOption(String name, T value, Boolean rewritable, String desc, Predicate verifyFunc) { - this(name, (Class) value.getClass(), value, rewritable, desc, verifyFunc); - } + private final Predicate checkFunc; - public ConfigOption(String name, Class dataType, T value, Boolean rewritable, String desc, - Predicate verifyFunc) { + private ConfigOption(String name, Class dataType, T value, Boolean + rewritable, String desc, Predicate checkFunc) { Preconditions.checkNotNull(name); Preconditions.checkNotNull(dataType); Preconditions.checkNotNull(rewritable); if (!ACCEPTED_DATATYPES.contains(dataType)) { - String msg = String.format("Datatype %s is not one of %s", dataType, ACCEPTED_DATATYPES_STRING); + String msg = String.format("Input datatype: '%s' doesn't belong " + + "to acceptable type set: [%s]", + dataType, ACCEPTED_DATATYPES_STRING); logger.error(msg); throw new IllegalArgumentException(msg); } @@ -74,55 +63,44 @@ public ConfigOption(String name, Class dataType, T value, Boolean rewritable, this.value = value; this.rewritable = rewritable; this.desc = desc; - this.verifyFunc = verifyFunc; + this.checkFunc = checkFunc; - if (this.verifyFunc != null) { - verify(this.value); + if (this.checkFunc != null) { + check(this.value); } } public String name() { - return name; + return this.name; } public Class dataType() { - return dataType; + return this.dataType; + } + + public String desc() { + return this.desc; } - /** - * @return - */ public T value() { - return value; + return this.value; } - /** - * @param value - */ public void value(T value) { - verify(value); - Preconditions.checkArgument(rewritable); + check(value); + E.checkArgument(this.rewritable, "Not allowed to modify option: '%s' " + + "which is unrewritable", this.name); this.value = value; } - public T verify(Object input) { - Preconditions.checkNotNull(input); - Preconditions.checkArgument(dataType.isInstance(input), - "Invalid class for configuration value [%s]. Expected [%s] but given [%s]", this.toString(), dataType, - input.getClass()); - T result = (T) input; - Preconditions.checkArgument(verifyFunc.apply(result), "Invalid configuration value for [%s]: %s", - this.toString(), input); - return result; + private void check(Object value) { + E.checkNotNull(value, "value", this.name); + E.checkArgument(this.dataType.isInstance(value), + "Invalid class for option '%s'. Expected '%s' but given '%s'", + this.name, this.dataType, value.getClass()); + T result = (T) value; + E.checkArgument(this.checkFunc.apply(result), + "Invalid option value for [%s]: %s", this.name, value); } - // public static final E getEnumValue(String str, Class enumClass) { - // str = str.trim(); - // if (StringUtils.isBlank(str)) return null; - // for (E e : enumClass.getEnumConstants()) { - // if (e.toString().equalsIgnoreCase(str)) return e; - // } - // throw new IllegalArgumentException("Invalid enum string provided for ["+enumClass+"]: " + str); - // } - } diff --git a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java index 3b75d04e76..c874889bf8 100644 --- a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java +++ b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java @@ -14,7 +14,6 @@ import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.PropertiesConfiguration; -import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -27,7 +26,7 @@ public class HugeConfig extends PropertiesConfiguration { public HugeConfig(Configuration config) { if (config == null) { - throw new ConfigException("Config object is null."); + throw new ConfigException("Passed config object is null"); } if (config instanceof AbstractFileConfiguration) { File file = ((AbstractFileConfiguration) config).getFile(); @@ -42,39 +41,41 @@ public HugeConfig(Configuration config) { this.setProperty(key.replace("..", "."), config.getProperty(key)); } - updateDefaultConfiguration(); + updateDefaultOption(); } public HugeConfig(String configFile) throws ConfigurationException { super(loadConfigFile(configFile)); - updateDefaultConfiguration(); + updateDefaultOption(); } public HugeConfig(InputStream is) throws ConfigurationException { + E.checkNotNull(is, "config input stream"); this.load(new InputStreamReader(is)); - updateDefaultConfiguration(); + updateDefaultOption(); } private static File loadConfigFile(String fileName) { - E.checkArgument(StringUtils.isNotEmpty(fileName), - "Can't load config file: %s", fileName); + E.checkNotNull(fileName, "config file"); + E.checkArgument(!fileName.isEmpty(), "The config file can't be empty"); + File file = new File(fileName); E.checkArgument(file.exists() && file.isFile() && file.canRead(), "Need to specify a readable config file, " + - "but was given: %s", file.toString()); + "but got: %s", file.toString()); return file; } - public void updateDefaultConfiguration() { + public void updateDefaultOption() { try { Iterator keys = this.getKeys(); while (keys.hasNext()) { String key = keys.next(); - if (!ConfigSpace.containKey(key)) { - logger.warn("A redundant config option is set:" + key); + if (!OptionSpace.containKey(key)) { + logger.warn("The option: '%s' is redundant", key); continue; } - ConfigOption option = ConfigSpace.get(key); + ConfigOption option = OptionSpace.get(key); Class dataType = option.dataType(); String getMethod = "get" + dataType.getSimpleName(); Method method = this.getClass() @@ -87,12 +88,6 @@ public void updateDefaultConfiguration() { } } - /** - * @param option - * @param - * - * @return - */ public T get(ConfigOption option) { return option.value(); } diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigVerifier.java b/src/main/java/com/baidu/hugegraph/config/OptionChecker.java similarity index 91% rename from src/main/java/com/baidu/hugegraph/config/ConfigVerifier.java rename to src/main/java/com/baidu/hugegraph/config/OptionChecker.java index c422fbfcba..7c76aa910a 100644 --- a/src/main/java/com/baidu/hugegraph/config/ConfigVerifier.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionChecker.java @@ -12,7 +12,7 @@ /** * Created by liningrui on 2017/3/23. */ -public class ConfigVerifier { +public class OptionChecker { public static final Predicate disallowEmpty(Class clazz) { return new Predicate() { @@ -24,11 +24,12 @@ public boolean apply(@Nullable O o) { if (o instanceof String) { return StringUtils.isNotBlank((String) o); } - if (o.getClass().isArray() && (Array.getLength(o) == 0 || Array.get(o, 0) == null)) { + if (o.getClass().isArray() && (Array.getLength(o) == 0 || + Array.get(o, 0) == null)) { return false; } - if (o instanceof Collection && (((Collection) o).isEmpty() - || ((Collection) o).iterator().next() == null)) { + if (o instanceof Collection && (((Collection) o).isEmpty() || + ((Collection) o).iterator().next() == null)) { return false; } return true; diff --git a/src/main/java/com/baidu/hugegraph/config/OptionHolder.java b/src/main/java/com/baidu/hugegraph/config/OptionHolder.java index ce72f71789..00d1b74019 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionHolder.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionHolder.java @@ -26,7 +26,7 @@ protected void registerOptions() { Field[] fields = this.getClass().getFields(); for (Field field : fields) { try { - ConfigOption option = (ConfigOption)field.get(this); + ConfigOption option = (ConfigOption) field.get(this); this.options.put(option.name(), option); } catch (Exception e) { String msg = String.format("Failed to regiser option : %s", field); diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigSpace.java b/src/main/java/com/baidu/hugegraph/config/OptionSpace.java similarity index 66% rename from src/main/java/com/baidu/hugegraph/config/ConfigSpace.java rename to src/main/java/com/baidu/hugegraph/config/OptionSpace.java index 8af61a3243..7512aa3505 100644 --- a/src/main/java/com/baidu/hugegraph/config/ConfigSpace.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionSpace.java @@ -5,15 +5,15 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.base.Preconditions; +import com.baidu.hugegraph.util.E; import com.google.common.collect.Maps; /** * Created by liningrui on 2017/3/27. */ -public class ConfigSpace { +public class OptionSpace { - private static final Logger logger = LoggerFactory.getLogger(ConfigSpace.class); + private static final Logger logger = LoggerFactory.getLogger(OptionSpace.class); private static final Map options = Maps.newHashMap(); @@ -23,20 +23,17 @@ public static void register(OptionHolder holder) { } public static void register(ConfigOption element) { - Preconditions.checkNotNull(element); - Preconditions.checkArgument(!options.containsKey(element.name()), - "An same config option has already been added to this " + - "namespace: %s", element.name()); + E.checkArgument(!options.containsKey(element.name()), + "The option: '%s' has already been registered", + element.name()); options.put(element.name(), element); } public static Boolean containKey(String key) { - Preconditions.checkNotNull(key); return options.containsKey(key); } public static ConfigOption get(String key) { - Preconditions.checkNotNull(key); return options.get(key); } } From db55e237a54d82ba410a1c5fb99f1a96d5545a6c Mon Sep 17 00:00:00 2001 From: liningrui Date: Wed, 28 Jun 2017 12:21:21 +0800 Subject: [PATCH 004/217] HugeGraph-351: fixed bug that CoreOption constructor has been removed Change-Id: I04cc0107aec90440ee2ae8c5c6add8a7c787f4f4 --- .../java/com/baidu/hugegraph/config/ConfigOption.java | 9 +++++++-- src/main/java/com/baidu/hugegraph/config/HugeConfig.java | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java index 240c7651e3..32e239984c 100644 --- a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java +++ b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java @@ -44,7 +44,12 @@ public class ConfigOption { private T value; private final Predicate checkFunc; - private ConfigOption(String name, Class dataType, T value, Boolean + public ConfigOption(String name, T value, Boolean rewritable, String desc, + Predicate verifyFunc) { + this(name, (Class) value.getClass(), value, rewritable, desc, verifyFunc); + } + + public ConfigOption(String name, Class dataType, T value, Boolean rewritable, String desc, Predicate checkFunc) { Preconditions.checkNotNull(name); Preconditions.checkNotNull(dataType); @@ -93,7 +98,7 @@ public void value(T value) { this.value = value; } - private void check(Object value) { + public void check(Object value) { E.checkNotNull(value, "value", this.name); E.checkArgument(this.dataType.isInstance(value), "Invalid class for option '%s'. Expected '%s' but given '%s'", diff --git a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java index c874889bf8..494fbb3868 100644 --- a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java +++ b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java @@ -72,7 +72,7 @@ public void updateDefaultOption() { while (keys.hasNext()) { String key = keys.next(); if (!OptionSpace.containKey(key)) { - logger.warn("The option: '%s' is redundant", key); + logger.warn("The option: '{}' is redundant", key); continue; } ConfigOption option = OptionSpace.get(key); From cccef5d575d1e55e4029b475c0e283334b62ca64 Mon Sep 17 00:00:00 2001 From: liningrui Date: Wed, 28 Jun 2017 16:35:06 +0800 Subject: [PATCH 005/217] HugeGraph-357: modify return type of TriFunction Change-Id: I8cfd2dce48e2901af4773ea0c8d867edd6d21562 --- src/main/java/com/baidu/hugegraph/util/TriFunction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/baidu/hugegraph/util/TriFunction.java b/src/main/java/com/baidu/hugegraph/util/TriFunction.java index 919c2c811e..19723fcc70 100644 --- a/src/main/java/com/baidu/hugegraph/util/TriFunction.java +++ b/src/main/java/com/baidu/hugegraph/util/TriFunction.java @@ -1,5 +1,5 @@ package com.baidu.hugegraph.util; public interface TriFunction { - public String apply(T1 v1, T2 v2, T3 v3); + public R apply(T1 v1, T2 v2, T3 v3); } From 5603b9c6a33bae6351287f64d545e22769740a68 Mon Sep 17 00:00:00 2001 From: liningrui Date: Thu, 29 Jun 2017 15:26:54 +0800 Subject: [PATCH 006/217] HugeGraph-326: add slf4j-api that has been mistakenly deleted Change-Id: I7fd0d4ee3b6957878ed2850dd389dd78f42de71e --- pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pom.xml b/pom.xml index 72c81497b1..3c30d0e15e 100644 --- a/pom.xml +++ b/pom.xml @@ -40,6 +40,11 @@ log4j ${log4j.version} + + org.slf4j + slf4j-api + ${slf4j.version} + org.slf4j slf4j-log4j12 From 7bdf878dd40bbfe6370e5bf39daa474c7f246453 Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Mon, 10 Jul 2017 13:32:26 +0800 Subject: [PATCH 007/217] HugeGraph-407: add KeyLock class Change-Id: I655bdf4da20e0c6b6d7796958485ab066f0020f1 --- .../baidu/hugegraph/concurrent/KeyLock.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java diff --git a/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java b/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java new file mode 100644 index 0000000000..77d51183de --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java @@ -0,0 +1,26 @@ +package com.baidu.hugegraph.concurrent; + +import java.util.concurrent.locks.Lock; + +import com.google.common.util.concurrent.Striped; + +public class KeyLock { + + private Striped locks; + + public KeyLock() { + this(Runtime.getRuntime().availableProcessors() * 4); + } + + public KeyLock(int size) { + this.locks = Striped.lock(size); + } + + public final void lock(Object key) { + this.locks.get(key).lock(); + } + + public final void unlock(Object key) { + this.locks.get(key).unlock(); + } +} From 36959044a1175d510f2babb92edd469737b18f80 Mon Sep 17 00:00:00 2001 From: liningrui Date: Tue, 11 Jul 2017 15:31:03 +0800 Subject: [PATCH 008/217] HugeGraph-410: fixed code style of hugegraph-common Change-Id: I8e123a315e483ed66658ce93c3eaffa61d94cfb3 --- .../baidu/hugegraph/config/ConfigOption.java | 32 +++++++----- .../baidu/hugegraph/config/HugeConfig.java | 6 +-- .../baidu/hugegraph/config/OptionHolder.java | 6 ++- .../baidu/hugegraph/config/OptionSpace.java | 3 +- .../com/baidu/hugegraph/perf/PerfUtil.java | 24 +++++---- .../com/baidu/hugegraph/perf/Stopwatch.java | 6 +-- .../java/com/baidu/hugegraph/type/Shard.java | 52 +++++++++++++++++++ .../java/com/baidu/hugegraph/type/Split.java | 44 ---------------- .../com/baidu/hugegraph/util/CheckSocket.java | 5 +- 9 files changed, 97 insertions(+), 81 deletions(-) create mode 100644 src/main/java/com/baidu/hugegraph/type/Shard.java delete mode 100644 src/main/java/com/baidu/hugegraph/type/Split.java diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java index 32e239984c..a9dccb149d 100644 --- a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java +++ b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java @@ -16,7 +16,8 @@ */ public class ConfigOption { - private static final Logger logger = LoggerFactory.getLogger(ConfigOption.class); + private static final Logger logger = + LoggerFactory.getLogger(ConfigOption.class); private static final Set> ACCEPTED_DATATYPES; private static final String ACCEPTED_DATATYPES_STRING; @@ -45,20 +46,20 @@ public class ConfigOption { private final Predicate checkFunc; public ConfigOption(String name, T value, Boolean rewritable, String desc, - Predicate verifyFunc) { - this(name, (Class) value.getClass(), value, rewritable, desc, verifyFunc); + Predicate func) { + this(name, (Class) value.getClass(), value, rewritable, desc, func); } - public ConfigOption(String name, Class dataType, T value, Boolean - rewritable, String desc, Predicate checkFunc) { + public ConfigOption(String name, Class dataType, T value, + Boolean rewritable, String desc, Predicate func) { Preconditions.checkNotNull(name); Preconditions.checkNotNull(dataType); Preconditions.checkNotNull(rewritable); if (!ACCEPTED_DATATYPES.contains(dataType)) { - String msg = String.format("Input datatype: '%s' doesn't belong " - + "to acceptable type set: [%s]", - dataType, ACCEPTED_DATATYPES_STRING); + String msg = String.format("Input datatype: '%s' doesn't belong " + + "to acceptable type set: [%s]", + dataType, ACCEPTED_DATATYPES_STRING); logger.error(msg); throw new IllegalArgumentException(msg); } @@ -68,7 +69,7 @@ public ConfigOption(String name, Class dataType, T value, Boolean this.value = value; this.rewritable = rewritable; this.desc = desc; - this.checkFunc = checkFunc; + this.checkFunc = func; if (this.checkFunc != null) { check(this.value); @@ -93,19 +94,22 @@ public T value() { public void value(T value) { check(value); - E.checkArgument(this.rewritable, "Not allowed to modify option: '%s' " - + "which is unrewritable", this.name); + E.checkArgument(this.rewritable, + "Not allowed to modify option: '%s' which " + + "is unrewritable", this.name); this.value = value; } public void check(Object value) { E.checkNotNull(value, "value", this.name); E.checkArgument(this.dataType.isInstance(value), - "Invalid class for option '%s'. Expected '%s' but given '%s'", - this.name, this.dataType, value.getClass()); + "Invalid class for option '%s'. Expected '%s' but " + + "given '%s'", this.name, this.dataType, + value.getClass()); T result = (T) value; E.checkArgument(this.checkFunc.apply(result), - "Invalid option value for [%s]: %s", this.name, value); + "Invalid option value for [%s]: %s", + this.name, value); } } diff --git a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java index 494fbb3868..6e16fd23d8 100644 --- a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java +++ b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java @@ -61,8 +61,8 @@ private static File loadConfigFile(String fileName) { File file = new File(fileName); E.checkArgument(file.exists() && file.isFile() && file.canRead(), - "Need to specify a readable config file, " + - "but got: %s", file.toString()); + "Need to specify a readable config file, " + + "but got: %s", file.toString()); return file; } @@ -79,7 +79,7 @@ public void updateDefaultOption() { Class dataType = option.dataType(); String getMethod = "get" + dataType.getSimpleName(); Method method = this.getClass() - .getMethod(getMethod, String.class, dataType); + .getMethod(getMethod, String.class, dataType); option.value(method.invoke(this, key, option.value())); } } catch (Exception e) { diff --git a/src/main/java/com/baidu/hugegraph/config/OptionHolder.java b/src/main/java/com/baidu/hugegraph/config/OptionHolder.java index 00d1b74019..100f25acf9 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionHolder.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionHolder.java @@ -14,7 +14,8 @@ */ public class OptionHolder { - private static final Logger logger = LoggerFactory.getLogger(HugeConfig.class); + private static final Logger logger = + LoggerFactory.getLogger(HugeConfig.class); protected Map options; @@ -29,7 +30,8 @@ protected void registerOptions() { ConfigOption option = (ConfigOption) field.get(this); this.options.put(option.name(), option); } catch (Exception e) { - String msg = String.format("Failed to regiser option : %s", field); + String msg = String.format( + "Failed to regiser option : %s", field); logger.error(msg, e); throw new ConfigException(msg, e); } diff --git a/src/main/java/com/baidu/hugegraph/config/OptionSpace.java b/src/main/java/com/baidu/hugegraph/config/OptionSpace.java index 7512aa3505..7e75c2a3c8 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionSpace.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionSpace.java @@ -13,7 +13,8 @@ */ public class OptionSpace { - private static final Logger logger = LoggerFactory.getLogger(OptionSpace.class); + private static final Logger logger = + LoggerFactory.getLogger(OptionSpace.class); private static final Map options = Maps.newHashMap(); diff --git a/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java b/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java index 846bd09769..d24f4f30a6 100644 --- a/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java +++ b/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java @@ -32,7 +32,8 @@ public class PerfUtil { - private static final Logger logger = LoggerFactory.getLogger(PerfUtil.class); + private static final Logger logger = + LoggerFactory.getLogger(PerfUtil.class); private static ThreadLocal instance = new ThreadLocal<>(); private Map stopwatches; @@ -40,7 +41,7 @@ public class PerfUtil { private PerfUtil() { this.stopwatches = new HashMap<>(); - this.callStack = new Stack(); + this.callStack = new Stack<>(); } public static PerfUtil instance() { @@ -143,7 +144,8 @@ private void profile(CtMethod ctMethod) } ctMethod.insertBefore(String.format(START, name)); - ctMethod.insertAfter(String.format(END, name), true); // asFinally true + // Insert as a finally-statement + ctMethod.insertAfter(String.format(END, name), true); logger.debug("Profiled for: '{}' [{}]", name, ctMethod.getLongName()); } @@ -193,13 +195,13 @@ public String toECharts() { sb.append("name: 'Total Cost',"); sb.append("type: 'pie',"); sb.append(String.format("radius: ['%s%%', '%s%%'],", - radiusFrom, radiusTo)); + radiusFrom, radiusTo)); sb.append(String.format( - "label: {normal: {position: 'inner', formatter:" - + "function(params) {" - + " if (params.percent > %s) return params.data.name;" - + " else return '';" - + "}}},", showFactor)); + "label: {normal: {position: 'inner', formatter:" + + "function(params) {" + + " if (params.percent > %s) return params.data.name;" + + " else return '';" + + "}}},", showFactor)); sb.append("data: ["); items.sort((i, j) -> i.id().compareTo(j.id())); @@ -239,8 +241,8 @@ public String toECharts() { return sb.toString(); }; - BiConsumer, List> fillOther = ( - itemsOfI, parents) -> { + BiConsumer, List> fillOther = + (itemsOfI, parents) -> { for (Stopwatch parent : parents) { Stream children = itemsOfI.stream().filter(c -> { return c.parent().equals(parent.id()); diff --git a/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java b/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java index da6d451d2d..6de5253178 100644 --- a/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java +++ b/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java @@ -97,9 +97,9 @@ public String toString() { } public String toJson() { - return String.format("{\"totalCost\":%s, " - + "\"minCost\":%s, \"maxCost\":%s, \"times\":%s, " - + "\"name\":\"%s\", \"parent\":\"%s\"}", + return String.format("{\"totalCost\":%s, " + + "\"minCost\":%s, \"maxCost\":%s, \"times\":%s, " + + "\"name\":\"%s\", \"parent\":\"%s\"}", this.totalCost, this.minCost, this.maxCost, diff --git a/src/main/java/com/baidu/hugegraph/type/Shard.java b/src/main/java/com/baidu/hugegraph/type/Shard.java new file mode 100644 index 0000000000..65d2c63791 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/type/Shard.java @@ -0,0 +1,52 @@ +package com.baidu.hugegraph.type; + +/** + * Shard is used for backend storage (like cassandra, hbase) scanning + * operations. Each shard represents a range of tokens for a node. + * Reading data from a given shard does not cross multiple nodes. + */ +public class Shard { + + // token range start + private String start; + // token range end + private String end; + // partitions count in this range + private long length; + + public Shard(String start, String end, long length) { + this.start = start; + this.end = end; + this.length = length; + } + + public String start() { + return this.start; + } + + public void start(String start) { + this.start = start; + } + + public String end() { + return this.end; + } + + public void end(String end) { + this.end = end; + } + + public long length() { + return this.length; + } + + public void length(long length) { + this.length = length; + } + + @Override + public String toString() { + return String.format("Shard{start=%s, end=%s, length=%s}", + this.start, this.end, this.length); + } +} \ No newline at end of file diff --git a/src/main/java/com/baidu/hugegraph/type/Split.java b/src/main/java/com/baidu/hugegraph/type/Split.java deleted file mode 100644 index d92614253d..0000000000 --- a/src/main/java/com/baidu/hugegraph/type/Split.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.baidu.hugegraph.type; - -public class Split { - - private String start; // token range start - private String end; // token range end - private long length; // partitions count in this range - - public Split(String start, String end, long length) { - this.start = start; - this.end = end; - this.length = length; - } - - public String start() { - return this.start; - } - - public void start(String start) { - this.start = start; - } - - public String end() { - return this.end; - } - - public void end(String end) { - this.end = end; - } - - public long length() { - return this.length; - } - - public void length(long length) { - this.length = length; - } - - @Override - public String toString() { - return String.format("Split{start=%s, end=%s, length=%s}", - this.start, this.end, this.length); - } -} \ No newline at end of file diff --git a/src/main/java/com/baidu/hugegraph/util/CheckSocket.java b/src/main/java/com/baidu/hugegraph/util/CheckSocket.java index 8b7893185c..3f104f83d3 100644 --- a/src/main/java/com/baidu/hugegraph/util/CheckSocket.java +++ b/src/main/java/com/baidu/hugegraph/util/CheckSocket.java @@ -42,9 +42,8 @@ public static void main(String args[]) { System.exit(E_USAGE); } try { - Socket s = new Socket( - InetAddress.getByName(args[0]), - Integer.valueOf(args[1]).intValue()); + Socket s = new Socket(InetAddress.getByName(args[0]), + Integer.valueOf(args[1]).intValue()); s.close(); System.exit(0); } catch (Throwable t) { From d592690cf7d00a494092686e1a97c074bbb5abc2 Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Thu, 13 Jul 2017 18:02:55 +0800 Subject: [PATCH 009/217] HugeGraph-254: improve utils class perf with final(inline) Change-Id: I625be2f4691a7821dbf3107d0f28ce079d46dfee --- src/main/java/com/baidu/hugegraph/util/CheckSocket.java | 2 +- src/main/java/com/baidu/hugegraph/util/CollectionUtil.java | 2 +- src/main/java/com/baidu/hugegraph/util/E.java | 5 +++-- src/main/java/com/baidu/hugegraph/util/HashUtil.java | 2 +- src/main/java/com/baidu/hugegraph/util/LongEncoding.java | 2 +- src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java | 2 +- src/main/java/com/baidu/hugegraph/util/TimeUtil.java | 2 +- 7 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/baidu/hugegraph/util/CheckSocket.java b/src/main/java/com/baidu/hugegraph/util/CheckSocket.java index 3f104f83d3..3cece67dbf 100644 --- a/src/main/java/com/baidu/hugegraph/util/CheckSocket.java +++ b/src/main/java/com/baidu/hugegraph/util/CheckSocket.java @@ -29,7 +29,7 @@ * to keep the JanusGraph distribution self-contained insofar as is * reasonable. */ -public class CheckSocket { +public final class CheckSocket { public static final int E_USAGE = 1; public static final int E_FAILED = 2; diff --git a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java index e35ad460f3..7d83051fd1 100644 --- a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java @@ -5,7 +5,7 @@ /** * Created by liningrui on 2017/3/30. */ -public class CollectionUtil { +public final class CollectionUtil { @SuppressWarnings({ "unchecked", "rawtypes" }) public static boolean containsAll(Collection a, Collection b) { diff --git a/src/main/java/com/baidu/hugegraph/util/E.java b/src/main/java/com/baidu/hugegraph/util/E.java index cefe26a958..b627036b3a 100644 --- a/src/main/java/com/baidu/hugegraph/util/E.java +++ b/src/main/java/com/baidu/hugegraph/util/E.java @@ -9,14 +9,15 @@ /** * Created by liningrui on 2017/5/26. */ -public class E { +public final class E { public static void checkNotNull(Object object, String elem) { Preconditions.checkNotNull(object, "The '%s' can't be null", elem); } public static void checkNotNull(Object object, String elem, String owner) { - Preconditions.checkNotNull(object, "The '%s' of '%s' can't be null", + Preconditions.checkNotNull(object, + "The '%s' of '%s' can't be null", elem, owner); } diff --git a/src/main/java/com/baidu/hugegraph/util/HashUtil.java b/src/main/java/com/baidu/hugegraph/util/HashUtil.java index 4ee1acdb30..293678cd1f 100644 --- a/src/main/java/com/baidu/hugegraph/util/HashUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/HashUtil.java @@ -7,7 +7,7 @@ /** * Created by jishilei on 2017/3/26. */ -public class HashUtil { +public final class HashUtil { public static byte[] hash(byte[] bytes) { return Hashing.murmur3_32().hashBytes(bytes).asBytes(); diff --git a/src/main/java/com/baidu/hugegraph/util/LongEncoding.java b/src/main/java/com/baidu/hugegraph/util/LongEncoding.java index 214256b491..817cfbc0eb 100644 --- a/src/main/java/com/baidu/hugegraph/util/LongEncoding.java +++ b/src/main/java/com/baidu/hugegraph/util/LongEncoding.java @@ -24,7 +24,7 @@ * {@linktourl http://stackoverflow.com/questions/2938482/encode-decode-a-long-to-a-string-using-a-fixed-set-of-letters-in-java} * */ -public class LongEncoding { +public final class LongEncoding { private static final String BASE_SYMBOLS = "0123456789abcdefghijklmnopqrstuvwxyz"; diff --git a/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java b/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java index 40d5e6a331..7fcdd7dbbe 100644 --- a/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java @@ -17,7 +17,7 @@ import javassist.CtMethod; import javassist.NotFoundException; -public class ReflectionUtil { +public final class ReflectionUtil { public static List getMethodsAnnotatedWith( Class type, diff --git a/src/main/java/com/baidu/hugegraph/util/TimeUtil.java b/src/main/java/com/baidu/hugegraph/util/TimeUtil.java index 29ce4f12fe..1b76b28c0b 100644 --- a/src/main/java/com/baidu/hugegraph/util/TimeUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/TimeUtil.java @@ -2,7 +2,7 @@ import java.util.Date; -public class TimeUtil { +public final class TimeUtil { public static long twepoch = 1288834974657L; From ec2599db9ad90a5379189926d633d2a21b167a08 Mon Sep 17 00:00:00 2001 From: zhangyi51 Date: Fri, 14 Jul 2017 10:53:49 +0800 Subject: [PATCH 010/217] HugeGraph-369 Add lockManager for mutual exclusion of thread in long time operation. Change-Id: I155e2b6bb6fffe88e4965c85d8ff68f9c49d04be --- .../hugegraph/concurrent/LockManager.java | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 src/main/java/com/baidu/hugegraph/concurrent/LockManager.java diff --git a/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java b/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java new file mode 100644 index 0000000000..545ebae8d0 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java @@ -0,0 +1,75 @@ +package com.baidu.hugegraph.concurrent; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicReference; + +/** + * Created by zhangyi51 on 17/7/13. + */ +public class LockManager { + + private static final LockManager INSTANCE = new LockManager(); + + public static LockManager instance() { + return INSTANCE; + } + + private Map locksMap; + + private LockManager() { + locksMap = new ConcurrentHashMap<>(); + } + + public boolean exists(String lockName) { + return locksMap.containsKey(lockName); + } + + public Lock create(String lockName) { + if (locksMap.containsKey(lockName)) { + throw new RuntimeException(String.format( + "Lock '%s' exists!", lockName)); + } + Lock lock = new Lock(lockName); + + locksMap.put(lockName, lock); + return lock; + } + + public Lock get(String lockName) { + return locksMap.get(lockName); + } + + public class Lock { + + private String name; + private AtomicReference sign; + + public Lock(String name) { + this.name = name; + sign = new AtomicReference<>(); + } + + public boolean lock() { + Thread current = Thread.currentThread(); + return sign.compareAndSet(null, current); + } + + public void unlock() { + Thread current = Thread.currentThread(); + if (!sign.compareAndSet(current, null)) { + throw new RuntimeException(String.format("Thread '%s' try to " + + "unlock '%s' which is held by other thread now.", + current.getName(), this.name)); + } + } + + public String name() { + return this.name; + } + + public void name(String name) { + this.name = name; + } + } +} From e88f54a21eab06fd04ac29d97d979f69d796e949 Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Wed, 19 Jul 2017 10:52:44 +0800 Subject: [PATCH 011/217] HugeGraph-462: add event manager Change-Id: I471a115fca5c84f8f25c7026fe834be305ab39b6 --- .../java/com/baidu/hugegraph/event/Event.java | 51 ++++++++ .../com/baidu/hugegraph/event/EventHub.java | 115 ++++++++++++++++++ .../baidu/hugegraph/event/EventListener.java | 10 ++ .../com/baidu/hugegraph/perf/PerfUtil.java | 2 +- .../hugegraph/{util => type}/TriFunction.java | 2 +- 5 files changed, 178 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/baidu/hugegraph/event/Event.java create mode 100644 src/main/java/com/baidu/hugegraph/event/EventHub.java create mode 100644 src/main/java/com/baidu/hugegraph/event/EventListener.java rename src/main/java/com/baidu/hugegraph/{util => type}/TriFunction.java (72%) diff --git a/src/main/java/com/baidu/hugegraph/event/Event.java b/src/main/java/com/baidu/hugegraph/event/Event.java new file mode 100644 index 0000000000..2fba771927 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/event/Event.java @@ -0,0 +1,51 @@ +package com.baidu.hugegraph.event; + +import java.util.Arrays; +import java.util.Collections; + +import com.baidu.hugegraph.util.E; + +public class Event extends java.util.EventObject { + + private static final long serialVersionUID = 1625973849208342813L; + + private String name; + private Object[] args; + + public Event(Object source, String event) { + this(source, event, Collections.emptyList().toArray()); + } + + public Event(Object source, String event, Object... args) { + super(source); + this.name = event; + this.args = args; + } + + public String name() { + return this.name; + } + + public Object[] args() { + return this.args; + } + + public void checkArgs(Class... classes) throws IllegalArgumentException { + E.checkArgument(this.args.length == classes.length, + "The args count of event '%s' should be %s(actual %s)", + this.name, classes.length, this.args.length); + int i = 0; + for (Class c : classes) { + Object arg = this.args[i++]; + E.checkArgument(c.isAssignableFrom(arg.getClass()), + "The arg '%s'(%s) can't match %s", + arg, arg.getClass(), c); + } + } + + @Override + public String toString() { + return String.format("Event{name='%s', args=%s}", + this.name, Arrays.asList(this.args)); + } +} diff --git a/src/main/java/com/baidu/hugegraph/event/EventHub.java b/src/main/java/com/baidu/hugegraph/event/EventHub.java new file mode 100644 index 0000000000..91ccab5d6f --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/event/EventHub.java @@ -0,0 +1,115 @@ +package com.baidu.hugegraph.event; + +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +import javax.annotation.Nullable; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.baidu.hugegraph.type.ExtendableIterator; +import com.baidu.hugegraph.util.E; + +public class EventHub { + + public static final String ANY_EVENT = "*"; + + private static final Logger logger = + LoggerFactory.getLogger(EventHub.class); + + private String name; + private Map> listeners; + private ExecutorService executor; + + public EventHub() { + this("hub"); + } + + public EventHub(String name) { + this.name = name; + this.listeners = new ConcurrentHashMap<>(); + this.executor = Executors.newFixedThreadPool(1); + } + + public String name() { + return this.name; + } + + public boolean containsListener(String event) { + return this.listeners.containsKey(event); + } + + public List listeners(String event) { + return Collections.unmodifiableList(this.listeners.get(event)); + } + + public void listen(String event, EventListener listener) { + E.checkNotNull(event, "event"); + E.checkNotNull(listener, "event listener"); + + List ls = this.listeners.get(event); + if (ls == null) { + ls = new LinkedList<>(); + this.listeners.put(event, ls); + } + ls.add(listener); + } + + public List unlisten(String event) { + return Collections.unmodifiableList(this.listeners.remove(event)); + } + + public boolean unlisten(String event, EventListener listener) { + List ls = this.listeners.get(event); + if (ls == null) { + return false; + } + return ls.remove(listener); + } + + public void notify(String event, @Nullable Object... args) { + ExtendableIterator all = new ExtendableIterator<>(); + + List ls = this.listeners.get(event); + if (ls != null && !ls.isEmpty()) { + all.extend(ls.iterator()); + } + List lsAny = this.listeners.get(ANY_EVENT); + if (lsAny != null && !lsAny.isEmpty()) { + all.extend(lsAny.iterator()); + } + + if (!all.hasNext()) { + return; + } + + Event ev = new Event(this, event, args); + this.executor.submit(() -> { + // Notify all listeners, and ignore the results + while (all.hasNext()) { + try { + all.next().event(ev); + } catch (Throwable e) { + logger.warn("Failed to handle event: {}", ev, e); + } + } + }); + } + + public Object call(String event, @Nullable Object... args) { + List ls = this.listeners.get(event); + if (ls == null) { + throw new RuntimeException("Not found listener for: " + event); + } else if (ls.size() != 1) { + throw new RuntimeException("Too many listeners for: " + event); + } + EventListener listener = ls.get(0); + return listener.event(new Event(this, event, args)); + } +} diff --git a/src/main/java/com/baidu/hugegraph/event/EventListener.java b/src/main/java/com/baidu/hugegraph/event/EventListener.java new file mode 100644 index 0000000000..38b2a3adfd --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/event/EventListener.java @@ -0,0 +1,10 @@ +package com.baidu.hugegraph.event; + +public interface EventListener extends java.util.EventListener { + /** + * The event callback + * @param event object + * @return event result + */ + public Object event(Event event); +} diff --git a/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java b/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java index d24f4f30a6..ee280e952a 100644 --- a/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java +++ b/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java @@ -20,8 +20,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.baidu.hugegraph.type.TriFunction; import com.baidu.hugegraph.util.ReflectionUtil; -import com.baidu.hugegraph.util.TriFunction; import com.google.common.reflect.ClassPath.ClassInfo; import javassist.CannotCompileException; diff --git a/src/main/java/com/baidu/hugegraph/util/TriFunction.java b/src/main/java/com/baidu/hugegraph/type/TriFunction.java similarity index 72% rename from src/main/java/com/baidu/hugegraph/util/TriFunction.java rename to src/main/java/com/baidu/hugegraph/type/TriFunction.java index 19723fcc70..1bf121c9ff 100644 --- a/src/main/java/com/baidu/hugegraph/util/TriFunction.java +++ b/src/main/java/com/baidu/hugegraph/type/TriFunction.java @@ -1,4 +1,4 @@ -package com.baidu.hugegraph.util; +package com.baidu.hugegraph.type; public interface TriFunction { public R apply(T1 v1, T2 v2, T3 v3); From 9cc9cad29a3720fe7e39c7992ef88a36ac67d6e8 Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Thu, 20 Jul 2017 14:55:44 +0800 Subject: [PATCH 012/217] HugeGraph-476: add destroy() method Change-Id: I745465ef6f3942f1e6774bacc1e59a1e5a0b200e --- .../com/baidu/hugegraph/event/EventHub.java | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/baidu/hugegraph/event/EventHub.java b/src/main/java/com/baidu/hugegraph/event/EventHub.java index 91ccab5d6f..666f36f445 100644 --- a/src/main/java/com/baidu/hugegraph/event/EventHub.java +++ b/src/main/java/com/baidu/hugegraph/event/EventHub.java @@ -7,6 +7,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; import javax.annotation.Nullable; @@ -22,10 +23,11 @@ public class EventHub { private static final Logger logger = LoggerFactory.getLogger(EventHub.class); + // Event executor + private static ExecutorService executor = null; private String name; private Map> listeners; - private ExecutorService executor; public EventHub() { this("hub"); @@ -34,7 +36,26 @@ public EventHub() { public EventHub(String name) { this.name = name; this.listeners = new ConcurrentHashMap<>(); - this.executor = Executors.newFixedThreadPool(1); + EventHub.init(1); + } + + public static synchronized void init(int poolSize) { + if (executor != null) { + return; + } + executor = Executors.newFixedThreadPool(poolSize); + } + + public static synchronized boolean destroy(long timeout) + throws InterruptedException { + executor.shutdown(); + return executor.awaitTermination(timeout, TimeUnit.SECONDS); + } + + private static ExecutorService executor() { + ExecutorService e = executor; + E.checkState(e != null, "The event executor has been destroyed"); + return e; } public String name() { @@ -90,7 +111,7 @@ public void notify(String event, @Nullable Object... args) { } Event ev = new Event(this, event, args); - this.executor.submit(() -> { + executor().submit(() -> { // Notify all listeners, and ignore the results while (all.hasNext()) { try { From 9a1417f3dc4eb860f55c549a5759c4a5a5ae4161 Mon Sep 17 00:00:00 2001 From: zhangyi51 Date: Fri, 14 Jul 2017 10:53:49 +0800 Subject: [PATCH 013/217] HugeGraph-487 Add lockManager for mutual exclusion of thread in long time operation. Change-Id: I155e2b6bb6fffe88e4985c85d8ff68f9c49d04be --- .../com/baidu/hugegraph/concurrent/Lock.java | 40 +++++++++++ .../baidu/hugegraph/concurrent/LockGroup.java | 71 +++++++++++++++++++ .../hugegraph/concurrent/LockManager.java | 66 ++++++----------- 3 files changed, 134 insertions(+), 43 deletions(-) create mode 100644 src/main/java/com/baidu/hugegraph/concurrent/Lock.java create mode 100644 src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java diff --git a/src/main/java/com/baidu/hugegraph/concurrent/Lock.java b/src/main/java/com/baidu/hugegraph/concurrent/Lock.java new file mode 100644 index 0000000000..0fc93dcfcd --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/concurrent/Lock.java @@ -0,0 +1,40 @@ +package com.baidu.hugegraph.concurrent; + +import java.util.concurrent.atomic.AtomicReference; + +/** + * Created by zhangyi51 on 17/7/20. + */ +public class Lock { + + private String name; + private AtomicReference sign; + + public Lock(String name) { + this.name = name; + this.sign = new AtomicReference<>(); + } + + public boolean lock() { + Thread current = Thread.currentThread(); + return this.sign.compareAndSet(null, current); + } + + public void unlock() { + Thread current = Thread.currentThread(); + if (!this.sign.compareAndSet(current, null)) { + throw new RuntimeException(String.format( + "Thread '%s' try to unlock '%s' " + + "which is held by other thread now.", + current.getName(), this.name)); + } + } + + public String name() { + return this.name; + } + + public void name(String name) { + this.name = name; + } +} diff --git a/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java b/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java new file mode 100644 index 0000000000..910178a1e2 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java @@ -0,0 +1,71 @@ +package com.baidu.hugegraph.concurrent; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * Created by zhangyi51 on 17/7/20. + */ +public class LockGroup { + + private static final Logger logger = + LoggerFactory.getLogger(Lock.class); + + private String name; + private Map locksMap; + + public LockGroup(String lockGroup) { + this.name = lockGroup; + this.locksMap = new ConcurrentHashMap(); + } + + public boolean lock(String lockName) { + if (!this.locksMap.containsKey(lockName)) { + this.locksMap.putIfAbsent(lockName, new Lock(lockName)); + } + return this.locksMap.get(lockName).lock(); + } + + public boolean lock(String lockName, int retries) { + // The interval between retries is exponential growth(2^i) + if (retries < 0 || retries > 10) { + throw new RuntimeException("Lock retry times should in [0, 10]"); + } + if (!this.locksMap.containsKey(lockName)) { + this.locksMap.putIfAbsent(lockName, new Lock(lockName)); + } + for (int i = 0;; i++) { + if (this.locksMap.get(lockName).lock()) { + return true; + } else if (i >= retries) { + break; + } + try { + Thread.sleep(1000 * (1L << i)); + } catch (InterruptedException ignored) { + logger.info("Thread sleep is interrupted."); + } + } + return false; + } + + public void unlock(String lockName) { + if (!this.locksMap.containsKey(lockName)) { + throw new RuntimeException(String.format( + "There is no lock '%s' in LockGroup '%s'", + lockName, this.name)); + } + this.locksMap.get(lockName).unlock(); + } + + public String name() { + return this.name; + } + + public void name(String name) { + this.name = name; + } +} diff --git a/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java b/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java index 545ebae8d0..e7a08aead3 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java @@ -2,7 +2,7 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.atomic.AtomicReference; + /** * Created by zhangyi51 on 17/7/13. @@ -15,61 +15,41 @@ public static LockManager instance() { return INSTANCE; } - private Map locksMap; + private Map lockGroupMap; private LockManager() { - locksMap = new ConcurrentHashMap<>(); + this.lockGroupMap = new ConcurrentHashMap<>(); } - public boolean exists(String lockName) { - return locksMap.containsKey(lockName); + public boolean exists(String lockGroup) { + return this.lockGroupMap.containsKey(lockGroup); } - public Lock create(String lockName) { - if (locksMap.containsKey(lockName)) { + public LockGroup create(String lockGroup) { + if (this.lockGroupMap.containsKey(lockGroup)) { throw new RuntimeException(String.format( - "Lock '%s' exists!", lockName)); + "LockGroup '%s' already exists!", lockGroup)); } - Lock lock = new Lock(lockName); - - locksMap.put(lockName, lock); - return lock; - } + LockGroup lockgroup = new LockGroup(lockGroup); - public Lock get(String lockName) { - return locksMap.get(lockName); + this.lockGroupMap.put(lockGroup, lockgroup); + return lockgroup; } - public class Lock { - - private String name; - private AtomicReference sign; - - public Lock(String name) { - this.name = name; - sign = new AtomicReference<>(); - } - - public boolean lock() { - Thread current = Thread.currentThread(); - return sign.compareAndSet(null, current); - } - - public void unlock() { - Thread current = Thread.currentThread(); - if (!sign.compareAndSet(current, null)) { - throw new RuntimeException(String.format("Thread '%s' try to " + - "unlock '%s' which is held by other thread now.", - current.getName(), this.name)); - } - } - - public String name() { - return this.name; + public LockGroup get(String lockGroup) { + if (!exists(lockGroup)) { + throw new RuntimeException(String.format( + "Not exist LockGroup '%s'", lockGroup)); } + return this.lockGroupMap.get(lockGroup); + } - public void name(String name) { - this.name = name; + public void destroy(String lockGroup) { + if (this.exists(lockGroup)) { + this.lockGroupMap.remove(lockGroup); + } else { + throw new RuntimeException(String.format( + "Not exist LockGroup '%s'", lockGroup)); } } } From 171e723f506e1eacc6c62e763bb19bafc4ac960b Mon Sep 17 00:00:00 2001 From: Liu Jie Date: Fri, 21 Jul 2017 16:51:42 +0800 Subject: [PATCH 014/217] HugeGraph-494: refine logic of lock() menthod Change-Id: Ic5298b36ecf68f3a2b87b35bd793953e6505a9ae Signed-off-by: Liu Jie --- .../baidu/hugegraph/concurrent/LockGroup.java | 57 +++++++++++++------ 1 file changed, 40 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java b/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java index 910178a1e2..e3414c8228 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java @@ -1,3 +1,22 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.concurrent; import org.slf4j.Logger; @@ -6,9 +25,6 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -/** - * Created by zhangyi51 on 17/7/20. - */ public class LockGroup { private static final Logger logger = @@ -31,31 +47,38 @@ public boolean lock(String lockName) { public boolean lock(String lockName, int retries) { // The interval between retries is exponential growth(2^i) - if (retries < 0 || retries > 10) { - throw new RuntimeException("Lock retry times should in [0, 10]"); + if (retries < 1 || retries > 10) { + throw new IllegalArgumentException(String.format( + "Locking retry times should be between 1 and 10, but got %d", + retries)); } + if (!this.locksMap.containsKey(lockName)) { this.locksMap.putIfAbsent(lockName, new Lock(lockName)); } - for (int i = 0;; i++) { - if (this.locksMap.get(lockName).lock()) { - return true; - } else if (i >= retries) { - break; - } - try { + + boolean isLocked = false; + try { + int i = 0; + do { + if (this.locksMap.get(lockName).lock()) { + isLocked = true; + break; + } + Thread.sleep(1000 * (1L << i)); - } catch (InterruptedException ignored) { - logger.info("Thread sleep is interrupted."); - } + } while (++i < retries); + } catch (InterruptedException ignored) { + logger.info("Thread sleep is interrupted."); } - return false; + + return isLocked; } public void unlock(String lockName) { if (!this.locksMap.containsKey(lockName)) { throw new RuntimeException(String.format( - "There is no lock '%s' in LockGroup '%s'", + "There is no lock '%s' found in LockGroup '%s'", lockName, this.name)); } this.locksMap.get(lockName).unlock(); From 9778a8b4b3093fa9e8fd2bf35c820317b3bf84f7 Mon Sep 17 00:00:00 2001 From: Liu Jie Date: Fri, 21 Jul 2017 19:11:18 +0800 Subject: [PATCH 015/217] HugeGrap-499: fix english grammer in lock Change-Id: I36c123eb7dfb101f99a176fcd9b2ee1f0f0211d7 Signed-off-by: Liu Jie --- .../com/baidu/hugegraph/concurrent/Lock.java | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/baidu/hugegraph/concurrent/Lock.java b/src/main/java/com/baidu/hugegraph/concurrent/Lock.java index 0fc93dcfcd..2cf366129f 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/Lock.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/Lock.java @@ -1,10 +1,26 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.concurrent; import java.util.concurrent.atomic.AtomicReference; -/** - * Created by zhangyi51 on 17/7/20. - */ public class Lock { private String name; @@ -24,8 +40,8 @@ public void unlock() { Thread current = Thread.currentThread(); if (!this.sign.compareAndSet(current, null)) { throw new RuntimeException(String.format( - "Thread '%s' try to unlock '%s' " + - "which is held by other thread now.", + "Thread '%s' trying to unlock '%s' " + + "which is held by other threads now.", current.getName(), this.name)); } } From d3960c1da43800e10e1d96df1365e38481f6e55f Mon Sep 17 00:00:00 2001 From: Liu Jie Date: Fri, 21 Jul 2017 21:11:25 +0800 Subject: [PATCH 016/217] Always define long variable endwith 'L' indicator. Change-Id: I5f4d4d5c823ea4e14a135b59fb2384299686b4d5 Signed-off-by: Liu Jie --- .../com/baidu/hugegraph/perf/Stopwatch.java | 30 +++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java b/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java index 6de5253178..13216dbe99 100644 --- a/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java +++ b/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java @@ -1,13 +1,32 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.perf; public class Stopwatch implements Cloneable { - private long lastStartTime = -1; + private long lastStartTime = -1L; - private long totalCost = 0; - private long minCost = 0; - private long maxCost = 0; + private long totalCost = 0L; + private long minCost = 0L; + private long maxCost = 0L; - private long times = 0; + private long times = 0L; private String name; private String parent; @@ -44,6 +63,7 @@ public void startTime(long time) { public void endTime(long time) { assert time >= this.lastStartTime && this.lastStartTime != -1; + long cost = time - this.lastStartTime; this.totalCost += cost; this.lastStartTime = -1; From 315000a600a21580da53b6206b11cc9e38bb7ded Mon Sep 17 00:00:00 2001 From: Liu Jie Date: Mon, 24 Jul 2017 13:12:48 +0800 Subject: [PATCH 017/217] HugeGraph-503: using bit shift whenever, if not affect the code readability. Change-Id: Ib36dc135241f77c99d39d458ee144dbe888c541b Signed-off-by: Liu Jie --- .../baidu/hugegraph/concurrent/KeyLock.java | 21 +++++++++++++- .../com/baidu/hugegraph/event/EventHub.java | 29 +++++++++++++++---- 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java b/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java index 77d51183de..dd4be060bc 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java @@ -1,3 +1,22 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.concurrent; import java.util.concurrent.locks.Lock; @@ -9,7 +28,7 @@ public class KeyLock { private Striped locks; public KeyLock() { - this(Runtime.getRuntime().availableProcessors() * 4); + this(Runtime.getRuntime().availableProcessors() << 2); } public KeyLock(int size) { diff --git a/src/main/java/com/baidu/hugegraph/event/EventHub.java b/src/main/java/com/baidu/hugegraph/event/EventHub.java index 666f36f445..31b7a85a85 100644 --- a/src/main/java/com/baidu/hugegraph/event/EventHub.java +++ b/src/main/java/com/baidu/hugegraph/event/EventHub.java @@ -1,3 +1,22 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.event; import java.util.Collections; @@ -19,11 +38,11 @@ public class EventHub { - public static final String ANY_EVENT = "*"; - private static final Logger logger = - LoggerFactory.getLogger(EventHub.class); + LoggerFactory.getLogger(EventHub.class); + // Event executor + public static final String ANY_EVENT = "*"; private static ExecutorService executor = null; private String name; @@ -116,8 +135,8 @@ public void notify(String event, @Nullable Object... args) { while (all.hasNext()) { try { all.next().event(ev); - } catch (Throwable e) { - logger.warn("Failed to handle event: {}", ev, e); + } catch (Throwable ignored) { + logger.warn("Failed to handle event: {}", ev, ignored); } } }); From 0c580690cc57cc394362ca3bff2c680761f80ceb Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Mon, 24 Jul 2017 11:52:33 +0800 Subject: [PATCH 018/217] HugeGraph-501: fix EventHub ConcurrentModificationException Change-Id: Idedff1ca762cd56f171152174bdbfb0bef4b8d4f --- src/main/java/com/baidu/hugegraph/event/EventHub.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/baidu/hugegraph/event/EventHub.java b/src/main/java/com/baidu/hugegraph/event/EventHub.java index 31b7a85a85..0187cef85f 100644 --- a/src/main/java/com/baidu/hugegraph/event/EventHub.java +++ b/src/main/java/com/baidu/hugegraph/event/EventHub.java @@ -20,10 +20,10 @@ package com.baidu.hugegraph.event; import java.util.Collections; -import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; @@ -93,11 +93,11 @@ public void listen(String event, EventListener listener) { E.checkNotNull(event, "event"); E.checkNotNull(listener, "event listener"); - List ls = this.listeners.get(event); - if (ls == null) { - ls = new LinkedList<>(); - this.listeners.put(event, ls); + if (!this.listeners.containsKey(event)) { + this.listeners.putIfAbsent(event, new CopyOnWriteArrayList<>()); } + List ls = this.listeners.get(event); + assert ls != null : this.listeners; ls.add(listener); } From 5252a7e481a33b1f6b83fed71f5dbc7bffbeb236 Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Mon, 24 Jul 2017 18:45:28 +0800 Subject: [PATCH 019/217] HugeGraph-410: improve code style Change-Id: Idce80465ea4cbe92ac836bbc8d293e77ad7c7c5c --- .../baidu/hugegraph/concurrent/KeyLock.java | 1 + .../hugegraph/concurrent/LockManager.java | 19 +++++++++++ .../hugegraph/config/ConfigException.java | 33 +++++++++++++++++++ .../baidu/hugegraph/config/ConfigOption.java | 19 +++++++++++ .../baidu/hugegraph/config/HugeConfig.java | 18 ++++++++-- .../baidu/hugegraph/config/OptionChecker.java | 19 +++++++++++ .../baidu/hugegraph/config/OptionHolder.java | 23 +++++++++++-- .../baidu/hugegraph/config/OptionSpace.java | 19 +++++++++++ .../java/com/baidu/hugegraph/event/Event.java | 19 +++++++++++ .../com/baidu/hugegraph/event/EventHub.java | 3 +- .../baidu/hugegraph/event/EventListener.java | 19 +++++++++++ .../hugegraph/exception/ConfigException.java | 14 -------- .../com/baidu/hugegraph/perf/PerfUtil.java | 19 +++++++++++ .../com/baidu/hugegraph/perf/Stopwatch.java | 14 ++++---- .../hugegraph/type/ExtendableIterator.java | 19 +++++++++++ .../java/com/baidu/hugegraph/type/Shard.java | 19 +++++++++++ .../com/baidu/hugegraph/type/TriFunction.java | 19 +++++++++++ .../baidu/hugegraph/util/CollectionUtil.java | 19 +++++++++++ src/main/java/com/baidu/hugegraph/util/E.java | 19 +++++++++++ .../com/baidu/hugegraph/util/HashUtil.java | 19 +++++++++++ .../baidu/hugegraph/util/ReflectionUtil.java | 19 +++++++++++ .../com/baidu/hugegraph/util/TimeUtil.java | 19 +++++++++++ 22 files changed, 365 insertions(+), 26 deletions(-) create mode 100644 src/main/java/com/baidu/hugegraph/config/ConfigException.java delete mode 100644 src/main/java/com/baidu/hugegraph/exception/ConfigException.java diff --git a/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java b/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java index dd4be060bc..00a3be4c89 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java @@ -28,6 +28,7 @@ public class KeyLock { private Striped locks; public KeyLock() { + // The default size is availableProcessors() * 4 this(Runtime.getRuntime().availableProcessors() << 2); } diff --git a/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java b/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java index e7a08aead3..7f6eb4957b 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java @@ -1,3 +1,22 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.concurrent; import java.util.Map; diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigException.java b/src/main/java/com/baidu/hugegraph/config/ConfigException.java new file mode 100644 index 0000000000..b8a7d367ab --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/config/ConfigException.java @@ -0,0 +1,33 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.config; + +public class ConfigException extends RuntimeException { + + private static final long serialVersionUID = -8711375282196157058L; + + public ConfigException(String message) { + super(message); + } + + public ConfigException(String msg, Throwable cause) { + super(msg, cause); + } +} diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java index a9dccb149d..fa21225a9a 100644 --- a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java +++ b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java @@ -1,3 +1,22 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.config; import java.util.Set; diff --git a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java index 6e16fd23d8..faef62e5ca 100644 --- a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java +++ b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java @@ -1,5 +1,20 @@ /* - * Copyright (C) 2017 Baidu, Inc. All Rights Reserved. + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.config; @@ -17,7 +32,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.baidu.hugegraph.exception.ConfigException; import com.baidu.hugegraph.util.E; public class HugeConfig extends PropertiesConfiguration { diff --git a/src/main/java/com/baidu/hugegraph/config/OptionChecker.java b/src/main/java/com/baidu/hugegraph/config/OptionChecker.java index 7c76aa910a..71d4016ea7 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionChecker.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionChecker.java @@ -1,3 +1,22 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.config; import java.lang.reflect.Array; diff --git a/src/main/java/com/baidu/hugegraph/config/OptionHolder.java b/src/main/java/com/baidu/hugegraph/config/OptionHolder.java index 100f25acf9..6b30a11e69 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionHolder.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionHolder.java @@ -1,3 +1,22 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.config; import java.lang.reflect.Field; @@ -7,8 +26,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.baidu.hugegraph.exception.ConfigException; - /** * Created by liningrui on 2017/5/25. */ @@ -39,6 +56,6 @@ protected void registerOptions() { } public Map options() { - return options; + return this.options; } } diff --git a/src/main/java/com/baidu/hugegraph/config/OptionSpace.java b/src/main/java/com/baidu/hugegraph/config/OptionSpace.java index 7e75c2a3c8..3d47e67cfa 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionSpace.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionSpace.java @@ -1,3 +1,22 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.config; import java.util.Map; diff --git a/src/main/java/com/baidu/hugegraph/event/Event.java b/src/main/java/com/baidu/hugegraph/event/Event.java index 2fba771927..53b58cfae3 100644 --- a/src/main/java/com/baidu/hugegraph/event/Event.java +++ b/src/main/java/com/baidu/hugegraph/event/Event.java @@ -1,3 +1,22 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.event; import java.util.Arrays; diff --git a/src/main/java/com/baidu/hugegraph/event/EventHub.java b/src/main/java/com/baidu/hugegraph/event/EventHub.java index 0187cef85f..b584127a62 100644 --- a/src/main/java/com/baidu/hugegraph/event/EventHub.java +++ b/src/main/java/com/baidu/hugegraph/event/EventHub.java @@ -41,8 +41,9 @@ public class EventHub { private static final Logger logger = LoggerFactory.getLogger(EventHub.class); - // Event executor public static final String ANY_EVENT = "*"; + + // Event executor private static ExecutorService executor = null; private String name; diff --git a/src/main/java/com/baidu/hugegraph/event/EventListener.java b/src/main/java/com/baidu/hugegraph/event/EventListener.java index 38b2a3adfd..7e5144f852 100644 --- a/src/main/java/com/baidu/hugegraph/event/EventListener.java +++ b/src/main/java/com/baidu/hugegraph/event/EventListener.java @@ -1,3 +1,22 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.event; public interface EventListener extends java.util.EventListener { diff --git a/src/main/java/com/baidu/hugegraph/exception/ConfigException.java b/src/main/java/com/baidu/hugegraph/exception/ConfigException.java deleted file mode 100644 index e1914112c0..0000000000 --- a/src/main/java/com/baidu/hugegraph/exception/ConfigException.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baidu.hugegraph.exception; - -public class ConfigException extends RuntimeException { - - private static final long serialVersionUID = -8711375282196157058L; - - public ConfigException(String message) { - super(message); - } - - public ConfigException(String msg, Throwable cause) { - super(msg, cause); - } -} diff --git a/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java b/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java index ee280e952a..ce7d50bd12 100644 --- a/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java +++ b/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java @@ -1,3 +1,22 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.perf; import java.io.IOException; diff --git a/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java b/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java index 13216dbe99..f543d752ff 100644 --- a/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java +++ b/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java @@ -20,6 +20,7 @@ package com.baidu.hugegraph.perf; public class Stopwatch implements Cloneable { + private long lastStartTime = -1L; private long totalCost = 0L; @@ -37,7 +38,7 @@ public Stopwatch(String name, String parent) { } public String id() { - return id(this.parent, this.name); + return Stopwatch.id(this.parent, this.name); } public static String id(String parent, String name) { @@ -56,22 +57,23 @@ public String parent() { } public void startTime(long time) { - assert this.lastStartTime == -1; + assert this.lastStartTime == -1L; + this.lastStartTime = time; this.times++; } public void endTime(long time) { - assert time >= this.lastStartTime && this.lastStartTime != -1; + assert time >= this.lastStartTime && this.lastStartTime != -1L; long cost = time - this.lastStartTime; this.totalCost += cost; - this.lastStartTime = -1; + this.lastStartTime = -1L; this.updateMinMax(cost); } protected void updateMinMax(long cost) { - if (this.minCost > cost || this.minCost == 0) { + if (this.minCost > cost || this.minCost == 0L) { this.minCost = cost; } if (this.maxCost < cost) { @@ -111,7 +113,7 @@ public Stopwatch copy() { public String toString() { return String.format( "{totalCost:%sms, minCost:%sns, maxCost:%sns, times:%s}", - this.totalCost / 1000000.0, + this.totalCost / 1000000.0F, this.minCost, this.maxCost, this.times); } diff --git a/src/main/java/com/baidu/hugegraph/type/ExtendableIterator.java b/src/main/java/com/baidu/hugegraph/type/ExtendableIterator.java index 7a1b54bdfa..cbc3d81d84 100644 --- a/src/main/java/com/baidu/hugegraph/type/ExtendableIterator.java +++ b/src/main/java/com/baidu/hugegraph/type/ExtendableIterator.java @@ -1,3 +1,22 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.type; import java.util.Deque; diff --git a/src/main/java/com/baidu/hugegraph/type/Shard.java b/src/main/java/com/baidu/hugegraph/type/Shard.java index 65d2c63791..462dfa64d2 100644 --- a/src/main/java/com/baidu/hugegraph/type/Shard.java +++ b/src/main/java/com/baidu/hugegraph/type/Shard.java @@ -1,3 +1,22 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.type; /** diff --git a/src/main/java/com/baidu/hugegraph/type/TriFunction.java b/src/main/java/com/baidu/hugegraph/type/TriFunction.java index 1bf121c9ff..bb469440c2 100644 --- a/src/main/java/com/baidu/hugegraph/type/TriFunction.java +++ b/src/main/java/com/baidu/hugegraph/type/TriFunction.java @@ -1,3 +1,22 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.type; public interface TriFunction { diff --git a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java index 7d83051fd1..687e87718a 100644 --- a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java @@ -1,3 +1,22 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.util; import java.util.Collection; diff --git a/src/main/java/com/baidu/hugegraph/util/E.java b/src/main/java/com/baidu/hugegraph/util/E.java index b627036b3a..9ced5a754b 100644 --- a/src/main/java/com/baidu/hugegraph/util/E.java +++ b/src/main/java/com/baidu/hugegraph/util/E.java @@ -1,3 +1,22 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.util; import java.util.Collection; diff --git a/src/main/java/com/baidu/hugegraph/util/HashUtil.java b/src/main/java/com/baidu/hugegraph/util/HashUtil.java index 293678cd1f..b2b1d32bdf 100644 --- a/src/main/java/com/baidu/hugegraph/util/HashUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/HashUtil.java @@ -1,3 +1,22 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.util; import java.nio.charset.Charset; diff --git a/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java b/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java index 7fcdd7dbbe..50883e0f6c 100644 --- a/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java @@ -1,3 +1,22 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.util; import java.io.IOException; diff --git a/src/main/java/com/baidu/hugegraph/util/TimeUtil.java b/src/main/java/com/baidu/hugegraph/util/TimeUtil.java index 1b76b28c0b..8ea7feea51 100644 --- a/src/main/java/com/baidu/hugegraph/util/TimeUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/TimeUtil.java @@ -1,3 +1,22 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.util; import java.util.Date; From 9faea022964731975df201266cc8535a3da71955 Mon Sep 17 00:00:00 2001 From: zhangyi51 Date: Mon, 24 Jul 2017 17:57:16 +0800 Subject: [PATCH 020/217] hugegraph-499 trivial grammar change. Change-Id: Ice29a709b9a5b5d7f2f7838d79541f63cf00a0c5 --- .../baidu/hugegraph/concurrent/LockGroup.java | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java b/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java index e3414c8228..e2a3f682cd 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java @@ -46,10 +46,11 @@ public boolean lock(String lockName) { } public boolean lock(String lockName, int retries) { - // The interval between retries is exponential growth(2^i) - if (retries < 1 || retries > 10) { + // The interval between retries is exponential growth, most wait + // interval is 2^(retries-1)s. If retries=0, don't retry. + if (retries < 0 || retries > 10) { throw new IllegalArgumentException(String.format( - "Locking retry times should be between 1 and 10, but got %d", + "Locking retry times should be between 0 and 10, but got %d", retries)); } @@ -59,19 +60,13 @@ public boolean lock(String lockName, int retries) { boolean isLocked = false; try { - int i = 0; - do { - if (this.locksMap.get(lockName).lock()) { - isLocked = true; - break; - } - + for (int i = 0; !(isLocked = this.locksMap.get(lockName).lock()) && + i < retries; i++) { Thread.sleep(1000 * (1L << i)); - } while (++i < retries); + } } catch (InterruptedException ignored) { logger.info("Thread sleep is interrupted."); } - return isLocked; } From e05d13098a209f8c56239e1363961a0f2b62a304 Mon Sep 17 00:00:00 2001 From: liningrui Date: Fri, 21 Jul 2017 11:08:43 +0800 Subject: [PATCH 021/217] HugeGraph-482: upgrade log4j to log4j2 Change-Id: If0bfaf91c45eac055e3f851b7f1dd5647d58d175 --- pom.xml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index 3c30d0e15e..bbd2b227ca 100644 --- a/pom.xml +++ b/pom.xml @@ -20,8 +20,7 @@ hugegraph-bin 1.8 1.8 - 1.7.5 - 1.2.17 + 2.8.2 1.10 2.1.1 3.2.2 @@ -36,19 +35,19 @@ - log4j - log4j - ${log4j.version} + org.apache.logging.log4j + log4j-api + ${log4j2.version} - org.slf4j - slf4j-api - ${slf4j.version} + org.apache.logging.log4j + log4j-core + ${log4j2.version} - org.slf4j - slf4j-log4j12 - ${slf4j.version} + org.apache.logging.log4j + log4j-slf4j-impl + ${log4j2.version} From 6052985c15597b14dcfeb8fa9db30fdf01bc8406 Mon Sep 17 00:00:00 2001 From: zhangyi51 Date: Thu, 27 Jul 2017 18:24:17 +0800 Subject: [PATCH 022/217] hugegraph-502 add read write lock support Change-Id: Ic339f5d81c9f475ee11ada38167fe42169c10971 --- .../concurrent/{Lock.java => AtomicLock.java} | 32 +++++++++++-- .../baidu/hugegraph/concurrent/LockGroup.java | 46 ++++++------------- .../hugegraph/concurrent/LockManager.java | 37 +++++++-------- 3 files changed, 60 insertions(+), 55 deletions(-) rename src/main/java/com/baidu/hugegraph/concurrent/{Lock.java => AtomicLock.java} (63%) diff --git a/src/main/java/com/baidu/hugegraph/concurrent/Lock.java b/src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java similarity index 63% rename from src/main/java/com/baidu/hugegraph/concurrent/Lock.java rename to src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java index 2cf366129f..056e5ab36f 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/Lock.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java @@ -19,19 +19,25 @@ package com.baidu.hugegraph.concurrent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.util.concurrent.atomic.AtomicReference; -public class Lock { +public class AtomicLock { + + private static final Logger logger = + LoggerFactory.getLogger(LockManager.class); private String name; private AtomicReference sign; - public Lock(String name) { + public AtomicLock(String name) { this.name = name; this.sign = new AtomicReference<>(); } - public boolean lock() { + public boolean tryLock() { Thread current = Thread.currentThread(); return this.sign.compareAndSet(null, current); } @@ -46,6 +52,26 @@ public void unlock() { } } + public boolean lock(int retries) { + // The interval between retries is exponential growth, most wait + // interval is 2^(retries-1)s. If retries=0, don't retry. + if (retries < 0 || retries > 10) { + throw new IllegalArgumentException(String.format( + "Locking retry times should be between 0 and 10, but got %d", + retries)); + } + + boolean isLocked = false; + try { + for (int i = 0; !(isLocked = this.tryLock()) && i < retries; i++) { + Thread.sleep(1000 * (1L << i)); + } + } catch (InterruptedException ignored) { + logger.info("Thread sleep is interrupted."); + } + return isLocked; + } + public String name() { return this.name; } diff --git a/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java b/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java index e2a3f682cd..c915343a16 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java @@ -24,59 +24,43 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; public class LockGroup { private static final Logger logger = - LoggerFactory.getLogger(Lock.class); + LoggerFactory.getLogger(LockManager.class); private String name; - private Map locksMap; + private Map locksMap; public LockGroup(String lockGroup) { this.name = lockGroup; this.locksMap = new ConcurrentHashMap(); } - public boolean lock(String lockName) { + public Lock lock(String lockName) { if (!this.locksMap.containsKey(lockName)) { - this.locksMap.putIfAbsent(lockName, new Lock(lockName)); + this.locksMap.putIfAbsent(lockName, new ReentrantLock()); } - return this.locksMap.get(lockName).lock(); + return (Lock) this.locksMap.get(lockName); } - public boolean lock(String lockName, int retries) { - // The interval between retries is exponential growth, most wait - // interval is 2^(retries-1)s. If retries=0, don't retry. - if (retries < 0 || retries > 10) { - throw new IllegalArgumentException(String.format( - "Locking retry times should be between 0 and 10, but got %d", - retries)); - } - + public AtomicLock atomicLock(String lockName) { if (!this.locksMap.containsKey(lockName)) { - this.locksMap.putIfAbsent(lockName, new Lock(lockName)); - } - - boolean isLocked = false; - try { - for (int i = 0; !(isLocked = this.locksMap.get(lockName).lock()) && - i < retries; i++) { - Thread.sleep(1000 * (1L << i)); - } - } catch (InterruptedException ignored) { - logger.info("Thread sleep is interrupted."); + this.locksMap.putIfAbsent(lockName, new AtomicLock(lockName)); } - return isLocked; + return (AtomicLock) this.locksMap.get(lockName); } - public void unlock(String lockName) { + public ReadWriteLock readWriteLock(String lockName) { if (!this.locksMap.containsKey(lockName)) { - throw new RuntimeException(String.format( - "There is no lock '%s' found in LockGroup '%s'", - lockName, this.name)); + this.locksMap.putIfAbsent(lockName, new ReentrantReadWriteLock()); } - this.locksMap.get(lockName).unlock(); + return (ReadWriteLock) this.locksMap.get(lockName); } public String name() { diff --git a/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java b/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java index 7f6eb4957b..24e9d6b895 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java @@ -22,10 +22,6 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; - -/** - * Created by zhangyi51 on 17/7/13. - */ public class LockManager { private static final LockManager INSTANCE = new LockManager(); @@ -40,35 +36,34 @@ private LockManager() { this.lockGroupMap = new ConcurrentHashMap<>(); } - public boolean exists(String lockGroup) { - return this.lockGroupMap.containsKey(lockGroup); + public boolean exists(String group) { + return this.lockGroupMap.containsKey(group); } - public LockGroup create(String lockGroup) { - if (this.lockGroupMap.containsKey(lockGroup)) { + public LockGroup create(String group) { + if (this.lockGroupMap.containsKey(group)) { throw new RuntimeException(String.format( - "LockGroup '%s' already exists!", lockGroup)); + "LockGroup '%s' already exists!", group)); } - LockGroup lockgroup = new LockGroup(lockGroup); - - this.lockGroupMap.put(lockGroup, lockgroup); - return lockgroup; + LockGroup lockGroup = new LockGroup(group); + this.lockGroupMap.putIfAbsent(group, lockGroup); + return lockGroup; } - public LockGroup get(String lockGroup) { - if (!exists(lockGroup)) { + public LockGroup get(String group) { + if (!exists(group)) { throw new RuntimeException(String.format( - "Not exist LockGroup '%s'", lockGroup)); + "Not exist LockGroup '%s'", group)); } - return this.lockGroupMap.get(lockGroup); + return this.lockGroupMap.get(group); } - public void destroy(String lockGroup) { - if (this.exists(lockGroup)) { - this.lockGroupMap.remove(lockGroup); + public void destroy(String group) { + if (this.exists(group)) { + this.lockGroupMap.remove(group); } else { throw new RuntimeException(String.format( - "Not exist LockGroup '%s'", lockGroup)); + "Not exist LockGroup '%s'", group)); } } } From b76e0eaeabe8063d94248298fab89c37f69e5f5a Mon Sep 17 00:00:00 2001 From: liningrui Date: Fri, 28 Jul 2017 16:36:18 +0800 Subject: [PATCH 023/217] HugeGraph-527: add customized implemention version to manifest.mf Change-Id: I569d82397408fb255d8ad9653e8b561ba1a60c1e --- pom.xml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pom.xml b/pom.xml index bbd2b227ca..2c2b449ca4 100644 --- a/pom.xml +++ b/pom.xml @@ -137,6 +137,26 @@ + + + org.apache.maven.plugins + maven-jar-plugin + + + true + + false + + true + + + + 0.1.0.1 + + + + + From dfd3190392efe568ef9c13a2c0802c62dcb61e8f Mon Sep 17 00:00:00 2001 From: liningrui Date: Mon, 31 Jul 2017 15:14:53 +0800 Subject: [PATCH 024/217] HugeGraph-527: First add the version to the common module. Change-Id: I2fd816ba13978d3d4cf2cb7a9724fe2d5f29a010 --- pom.xml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 2c2b449ca4..6c9ee107ef 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 0.1.0-SNAPSHOT + 1.1.0-SNAPSHOT @@ -145,13 +145,16 @@ true - false + + false - true + + true - 0.1.0.1 + + 1.1.0.0 From dec8fe9a84e3f64db87675551c284d29bf4cb5b2 Mon Sep 17 00:00:00 2001 From: Liu Jie Date: Mon, 31 Jul 2017 15:52:01 +0800 Subject: [PATCH 025/217] HugeGraph-531: Fix typo at OptionHolder class Change-Id: I19ea584802edd469d503b9fb57f630bf0c660487 Signed-off-by: Liu Jie --- src/main/java/com/baidu/hugegraph/config/OptionHolder.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/com/baidu/hugegraph/config/OptionHolder.java b/src/main/java/com/baidu/hugegraph/config/OptionHolder.java index 6b30a11e69..360500d1c8 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionHolder.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionHolder.java @@ -26,9 +26,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -/** - * Created by liningrui on 2017/5/25. - */ public class OptionHolder { private static final Logger logger = @@ -48,7 +45,7 @@ protected void registerOptions() { this.options.put(option.name(), option); } catch (Exception e) { String msg = String.format( - "Failed to regiser option : %s", field); + "Failed to register option : %s", field); logger.error(msg, e); throw new ConfigException(msg, e); } From f33c09385dc42e3ae79225caadfd7159a2030eb5 Mon Sep 17 00:00:00 2001 From: Liu Jie Date: Mon, 31 Jul 2017 16:18:02 +0800 Subject: [PATCH 026/217] HugeGraph-532: Rewrite checksocket class Change-Id: Iadae3837c2e9e0fddadbebbee097000c281e267c Signed-off-by: Liu Jie --- .../java/com/baidu/hugegraph/util/CheckSocket.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/baidu/hugegraph/util/CheckSocket.java b/src/main/java/com/baidu/hugegraph/util/CheckSocket.java index 3cece67dbf..17aded4ae9 100644 --- a/src/main/java/com/baidu/hugegraph/util/CheckSocket.java +++ b/src/main/java/com/baidu/hugegraph/util/CheckSocket.java @@ -31,23 +31,23 @@ */ public final class CheckSocket { - public static final int E_USAGE = 1; - public static final int E_FAILED = 2; - public static final String MSG_USAGE = + private static final int E_USAGE = 1; + private static final int E_FAILED = 2; + private static final String MSG_USAGE = "Usage: " + CheckSocket.class.getSimpleName() + " hostname port"; public static void main(String args[]) { - if (2 != args.length) { + if (args.length != 2) { System.err.println(MSG_USAGE); System.exit(E_USAGE); } try { Socket s = new Socket(InetAddress.getByName(args[0]), - Integer.valueOf(args[1]).intValue()); + Integer.parseInt(args[1])); s.close(); System.exit(0); - } catch (Throwable t) { - System.err.println(t.toString()); + } catch (Throwable ignored) { + System.err.println(ignored.toString()); System.exit(E_FAILED); } } From 5cda854e8d192b384fc945107ce6273a0dbdc11c Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Fri, 28 Jul 2017 19:58:21 +0800 Subject: [PATCH 027/217] HugeGraph-525: add vertion check util Change-Id: I57305dd209416620758b5bf183e791f8734af711 --- .../com/baidu/hugegraph/util/VersionUtil.java | 158 ++++++++++++++++++ .../hugegraph/version/CommonVersion.java | 27 +++ 2 files changed, 185 insertions(+) create mode 100644 src/main/java/com/baidu/hugegraph/util/VersionUtil.java create mode 100644 src/main/java/com/baidu/hugegraph/version/CommonVersion.java diff --git a/src/main/java/com/baidu/hugegraph/util/VersionUtil.java b/src/main/java/com/baidu/hugegraph/util/VersionUtil.java new file mode 100644 index 0000000000..494ce4fc34 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/util/VersionUtil.java @@ -0,0 +1,158 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.util; + +import java.io.IOException; +import java.net.URL; +import java.util.jar.Attributes; +import java.util.jar.Manifest; + +public final class VersionUtil { + + /** + * Compare if a version is inside a range: begin <= version < end + */ + public static boolean match(Version version, String begin, String end) { + E.checkArgumentNotNull(version, "The version to match is null"); + return version.compareTo(new Version(begin)) >= 0 && + version.compareTo(new Version(end)) < 0; + } + + /** + * Check whether a component version is matched expected range, + * throw an exception if it's not matched. + */ + public static void check(Version version, String begin, String end, + String component) { + E.checkState(VersionUtil.match(version, begin, end), + "The version %s of '%s' is not in [%s, %s)", + version, component, begin, end); + } + + /** + * Get implementation version from manifest in jar + */ + public static String getImplementationVersion(Class clazz) { + /* + * We don't use Package.getImplementationVersion() due to + * a duplicate package would override the origin package info. + * https://stackoverflow.com/questions/1272648/reading-my-own-jars-manifest + */ + String className = clazz.getSimpleName() + ".class"; + String classPath = clazz.getResource(className).toString(); + if (!classPath.startsWith("jar:file:")) { + // Class not from JAR + return null; + } + // Get manifest + int offset = classPath.lastIndexOf("!"); + assert offset > 0; + String manifestPath = classPath.substring(0, offset + 1) + + "/META-INF/MANIFEST.MF"; + Manifest manifest = null; + try { + manifest = new Manifest(new URL(manifestPath).openStream()); + } catch (IOException ignored) { + return null; + } + return manifest.getMainAttributes() + .getValue(Attributes.Name.IMPLEMENTATION_VERSION); + } + + /** + * class Version for compare + * https://stackoverflow.com/questions/198431/how-do-you-compare-two-version-strings-in-java + */ + public static class Version implements Comparable { + + public static Version of(Class clazz) { + return Version.of(clazz, null); + } + + public static Version of(Class clazz, String defaultValue) { + String v = getImplementationVersion(clazz); + if (v == null) { + v = defaultValue; + } + return v == null ? null : new Version(v); + } + + public static Version of(String version) { + return new Version(version); + } + + /************************** Version define **************************/ + + private String version; + + public Version(String version) { + E.checkArgumentNotNull(version, "The version is null"); + E.checkArgument(version.matches("[0-9]+(\\.[0-9]+)*"), + "Invalid version format: %s", version); + this.version = version; + } + + public final String get() { + return this.version; + } + + @Override + public int compareTo(Version that) { + if (that == null) { + return 1; + } + String[] thisParts = this.get().split("\\."); + String[] thatParts = that.get().split("\\."); + int length = Math.max(thisParts.length, thatParts.length); + for (int i = 0; i < length; i++) { + int thisPart = i < thisParts.length ? + Integer.parseInt(thisParts[i]) : 0; + int thatPart = i < thatParts.length ? + Integer.parseInt(thatParts[i]) : 0; + if (thisPart < thatPart) { + return -1; + } + if (thisPart > thatPart) { + return 1; + } + } + return 0; + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (this.getClass() != that.getClass()) { + return false; + } + return this.compareTo((Version) that) == 0; + } + + @Override + public String toString() { + return this.version; + } + } +} diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java new file mode 100644 index 0000000000..969d87de9e --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -0,0 +1,27 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.version; + +import com.baidu.hugegraph.util.VersionUtil.Version; + +public class CommonVersion { + + public static final Version VERSION = Version.of(CommonVersion.class); +} From a200deab56e426e1d071d3d2e821503ef5d67c32 Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Tue, 1 Aug 2017 18:20:11 +0800 Subject: [PATCH 028/217] HugeGraph-131: clean up some warnings in LockGroup Change-Id: I55a359b799119c04ea0e89d013f1c034453c2ba4 --- pom.xml | 2 +- .../baidu/hugegraph/concurrent/LockGroup.java | 16 +++------------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/pom.xml b/pom.xml index 6c9ee107ef..48d46a8ac1 100644 --- a/pom.xml +++ b/pom.xml @@ -154,7 +154,7 @@ - 1.1.0.0 + 1.1.0.1 diff --git a/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java b/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java index c915343a16..b743d1f81d 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java @@ -19,9 +19,6 @@ package com.baidu.hugegraph.concurrent; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.locks.Lock; @@ -31,15 +28,12 @@ public class LockGroup { - private static final Logger logger = - LoggerFactory.getLogger(LockManager.class); - - private String name; - private Map locksMap; + private final String name; + private final Map locksMap; public LockGroup(String lockGroup) { this.name = lockGroup; - this.locksMap = new ConcurrentHashMap(); + this.locksMap = new ConcurrentHashMap<>(); } public Lock lock(String lockName) { @@ -66,8 +60,4 @@ public ReadWriteLock readWriteLock(String lockName) { public String name() { return this.name; } - - public void name(String name) { - this.name = name; - } } From 8bdac2c758ca16681073ed5ffda8fd03f469c3fb Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Wed, 2 Aug 2017 11:58:59 +0800 Subject: [PATCH 029/217] HugeGraph-525: add the const NAME of component hugegraph-common into CommonVersion Change-Id: I5bcd766bb3435de98833759efcba5d3fa0650499 --- pom.xml | 2 +- src/main/java/com/baidu/hugegraph/version/CommonVersion.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 48d46a8ac1..33fbfd95fc 100644 --- a/pom.xml +++ b/pom.xml @@ -154,7 +154,7 @@ - 1.1.0.1 + 1.1.0.2 diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 969d87de9e..deb96e0401 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -23,5 +23,7 @@ public class CommonVersion { + public static final String NAME = "hugegraph-common"; + public static final Version VERSION = Version.of(CommonVersion.class); } From f6cdc8a3ca494797facc1e187ec949d6941443c2 Mon Sep 17 00:00:00 2001 From: Liu Jie Date: Wed, 2 Aug 2017 17:23:22 +0800 Subject: [PATCH 030/217] HugeGraph-547: replace tilNextMillis by tillNextMills as the later is more meaningfull Change-Id: I4505c1335bfc6eeb03658597f6f6ae5e994a2cf2 Signed-off-by: Liu Jie --- pom.xml | 6 +++--- src/main/java/com/baidu/hugegraph/util/TimeUtil.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 33fbfd95fc..924aa3611e 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.1.0-SNAPSHOT + 1.2.0-SNAPSHOT @@ -154,7 +154,7 @@ - 1.1.0.2 + 1.2.0.0 @@ -163,4 +163,4 @@ - \ No newline at end of file + diff --git a/src/main/java/com/baidu/hugegraph/util/TimeUtil.java b/src/main/java/com/baidu/hugegraph/util/TimeUtil.java index 8ea7feea51..f6be5533d7 100644 --- a/src/main/java/com/baidu/hugegraph/util/TimeUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/TimeUtil.java @@ -37,7 +37,7 @@ public static long timeGen(long time) { return time - twepoch; } - public static long tilNextMillis(long lastTimestamp) { + public static long tillNextMillis(long lastTimestamp) { long timestamp = timeGen(); while (timestamp <= lastTimestamp) { timestamp = timeGen(); From 705c27b9860ac8965ded35c61596fcc21f88362e Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Tue, 8 Aug 2017 14:53:16 +0800 Subject: [PATCH 031/217] HugeGraph-555: add lockAll() for KeyLock Change-Id: Iac0a396077658b82b67547e3eea5793d54fa01fd --- pom.xml | 4 +- .../baidu/hugegraph/concurrent/KeyLock.java | 92 ++++++++++++++++++- 2 files changed, 92 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 924aa3611e..375ba028d1 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.2.0-SNAPSHOT + 1.3.0-SNAPSHOT @@ -154,7 +154,7 @@ - 1.2.0.0 + 1.3.0.0 diff --git a/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java b/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java index 00a3be4c89..6171e15e15 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java @@ -19,10 +19,17 @@ package com.baidu.hugegraph.concurrent; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import java.util.concurrent.locks.Lock; +import com.google.common.collect.ImmutableList; import com.google.common.util.concurrent.Striped; +/** + * KeyLock provide an interface of segment lock + */ public class KeyLock { private Striped locks; @@ -36,11 +43,92 @@ public KeyLock(int size) { this.locks = Striped.lock(size); } - public final void lock(Object key) { - this.locks.get(key).lock(); + private int indexOf(Lock lock) { + for (int i = 0; i < this.locks.size(); i++) { + if (this.locks.getAt(i) == lock) { + return i; + } + } + return -1; + } + + /** + * Lock an object + * @param key The object to lock + * @return The lock(locked) of passed key + */ + public final Lock lock(Object key) { + Lock lock = this.locks.get(key); + lock.lock(); + return lock; } + /** + * Unlock an object + * @param key The object to unlock + */ public final void unlock(Object key) { this.locks.get(key).unlock(); } + + /** + * Lock a list of object with sorted order + * @param keys The objects to lock + * @return The locks(locked) of keys + */ + public final List lockAll(Object... keys) { + List locks = new ArrayList<>(keys.length); + for (Object key : keys) { + Lock lock = this.locks.get(key); + locks.add(lock); + } + Collections.sort(locks, (a, b) -> { + int diff = a.hashCode() - b.hashCode(); + if (diff == 0 && a != b) { + diff = this.indexOf(a) - this.indexOf(b); + assert diff != 0; + } + return diff; + }); + for (int i = 0; i < locks.size(); i++) { + locks.get(i).lock(); + } + return Collections.unmodifiableList(locks); + } + + /** + * Lock two objects with sorted order + * NOTE: This is to optimize the performance of lockAll(keys) + */ + public List lockAll(Object key1, Object key2) { + Lock lock1 = this.locks.get(key1); + Lock lock2 = this.locks.get(key2); + + int diff = lock1.hashCode() - lock2.hashCode(); + if (diff == 0 && lock1 != lock2) { + diff = this.indexOf(lock1) - this.indexOf(lock2); + assert diff != 0; + } + + List locks = diff > 0 ? + ImmutableList.of(lock2, lock1) : + ImmutableList.of(lock1, lock2); + + for (int i = 0; i < locks.size(); i++) { + locks.get(i).lock(); + } + + return locks; + } + + /** + * Unlock a list of object + * @param locks The locks to unlock + */ + public final void unlockAll(List locks) { + for (int i = locks.size(); i > 0; i--) { + assert this.indexOf(locks.get(i - 1)) != -1; + locks.get(i - 1).unlock(); + } + } } From 504069e17fa31c61b08cba5bbde1759a2e84a3b4 Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Wed, 16 Aug 2017 16:37:33 +0800 Subject: [PATCH 032/217] HugeGraph-623: rename LoggerFactory.getLogger() to Log.logger() Change-Id: If9c03e3588334207870d710eba63f8bbf983e14e --- .../hugegraph/concurrent/AtomicLock.java | 14 +++--- .../baidu/hugegraph/config/ConfigOption.java | 43 +++++++++---------- .../baidu/hugegraph/config/HugeConfig.java | 31 +++++++------ .../baidu/hugegraph/config/OptionChecker.java | 9 +--- .../baidu/hugegraph/config/OptionHolder.java | 25 ++++++----- .../baidu/hugegraph/config/OptionSpace.java | 25 +++++------ .../com/baidu/hugegraph/event/EventHub.java | 7 ++- .../com/baidu/hugegraph/perf/PerfUtil.java | 7 ++- .../java/com/baidu/hugegraph/util/Log.java | 15 +++++++ 9 files changed, 92 insertions(+), 84 deletions(-) create mode 100644 src/main/java/com/baidu/hugegraph/util/Log.java diff --git a/src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java b/src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java index 056e5ab36f..58a72cb9cd 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java @@ -19,15 +19,15 @@ package com.baidu.hugegraph.concurrent; +import java.util.concurrent.atomic.AtomicReference; + import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import java.util.concurrent.atomic.AtomicReference; +import com.baidu.hugegraph.util.Log; public class AtomicLock { - private static final Logger logger = - LoggerFactory.getLogger(LockManager.class); + private static final Logger LOG = Log.logger(LockManager.class); private String name; private AtomicReference sign; @@ -57,8 +57,8 @@ public boolean lock(int retries) { // interval is 2^(retries-1)s. If retries=0, don't retry. if (retries < 0 || retries > 10) { throw new IllegalArgumentException(String.format( - "Locking retry times should be between 0 and 10, but got %d", - retries)); + "Locking retry times should be in [0, 10], but got %d", + retries)); } boolean isLocked = false; @@ -67,7 +67,7 @@ public boolean lock(int retries) { Thread.sleep(1000 * (1L << i)); } } catch (InterruptedException ignored) { - logger.info("Thread sleep is interrupted."); + LOG.info("Thread sleep is interrupted."); } return isLocked; } diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java index fa21225a9a..e2977a5fb8 100644 --- a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java +++ b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java @@ -22,27 +22,23 @@ import java.util.Set; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import com.baidu.hugegraph.util.E; +import com.baidu.hugegraph.util.Log; import com.google.common.base.Joiner; import com.google.common.base.Preconditions; import com.google.common.base.Predicate; import com.google.common.collect.ImmutableSet; -/** - * Created by liningrui on 2017/3/23. - */ public class ConfigOption { - private static final Logger logger = - LoggerFactory.getLogger(ConfigOption.class); + private static final Logger LOG = Log.logger(ConfigOption.class); - private static final Set> ACCEPTED_DATATYPES; - private static final String ACCEPTED_DATATYPES_STRING; + private static final Set> ACCEPTED_DATA_TYPES; + private static final String ACCEPTED_DATA_TYPES_STRING; static { - ACCEPTED_DATATYPES = ImmutableSet.of( + ACCEPTED_DATA_TYPES = ImmutableSet.of( Boolean.class, Short.class, Integer.class, @@ -54,7 +50,7 @@ public class ConfigOption { String[].class ); - ACCEPTED_DATATYPES_STRING = Joiner.on(", ").join(ACCEPTED_DATATYPES); + ACCEPTED_DATA_TYPES_STRING = Joiner.on(", ").join(ACCEPTED_DATA_TYPES); } private final String name; @@ -64,8 +60,9 @@ public class ConfigOption { private T value; private final Predicate checkFunc; - public ConfigOption(String name, T value, Boolean rewritable, String desc, - Predicate func) { + @SuppressWarnings("unchecked") + public ConfigOption(String name, T value, Boolean rewritable, + String desc, Predicate func) { this(name, (Class) value.getClass(), value, rewritable, desc, func); } @@ -75,11 +72,11 @@ public ConfigOption(String name, Class dataType, T value, Preconditions.checkNotNull(dataType); Preconditions.checkNotNull(rewritable); - if (!ACCEPTED_DATATYPES.contains(dataType)) { - String msg = String.format("Input datatype: '%s' doesn't belong " + + if (!ACCEPTED_DATA_TYPES.contains(dataType)) { + String msg = String.format("Input data type '%s' doesn't belong " + "to acceptable type set: [%s]", - dataType, ACCEPTED_DATATYPES_STRING); - logger.error(msg); + dataType, ACCEPTED_DATA_TYPES_STRING); + LOG.error(msg); throw new IllegalArgumentException(msg); } @@ -114,21 +111,21 @@ public T value() { public void value(T value) { check(value); E.checkArgument(this.rewritable, - "Not allowed to modify option: '%s' which " + - "is unrewritable", this.name); + "Not allowed to modify option '%s' " + + "which can't be rewritable", this.name); this.value = value; } public void check(Object value) { E.checkNotNull(value, "value", this.name); E.checkArgument(this.dataType.isInstance(value), - "Invalid class for option '%s'. Expected '%s' but " + - "given '%s'", this.name, this.dataType, - value.getClass()); + "Invalid class for option '%s', " + + "expected '%s' but given '%s'", + this.name, this.dataType, value.getClass()); + @SuppressWarnings("unchecked") T result = (T) value; E.checkArgument(this.checkFunc.apply(result), - "Invalid option value for [%s]: %s", + "Invalid option value for '%s': %s", this.name, value); } - } diff --git a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java index faef62e5ca..a1bc10dbcd 100644 --- a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java +++ b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java @@ -30,17 +30,17 @@ import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.PropertiesConfiguration; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import com.baidu.hugegraph.util.E; +import com.baidu.hugegraph.util.Log; public class HugeConfig extends PropertiesConfiguration { - private static final Logger logger = LoggerFactory.getLogger(HugeConfig.class); + private static final Logger LOG = Log.logger(HugeConfig.class); public HugeConfig(Configuration config) { if (config == null) { - throw new ConfigException("Passed config object is null"); + throw new ConfigException("The config object is null"); } if (config instanceof AbstractFileConfiguration) { File file = ((AbstractFileConfiguration) config).getFile(); @@ -71,34 +71,38 @@ public HugeConfig(InputStream is) throws ConfigurationException { private static File loadConfigFile(String fileName) { E.checkNotNull(fileName, "config file"); - E.checkArgument(!fileName.isEmpty(), "The config file can't be empty"); + E.checkArgument(!fileName.isEmpty(), + "The config file can't be empty"); File file = new File(fileName); E.checkArgument(file.exists() && file.isFile() && file.canRead(), - "Need to specify a readable config file, " + - "but got: %s", file.toString()); + "Need to specify a readable config file, but got: %s", + file.toString()); return file; } + @SuppressWarnings({ "unchecked", "rawtypes" }) public void updateDefaultOption() { try { Iterator keys = this.getKeys(); while (keys.hasNext()) { String key = keys.next(); + if (!OptionSpace.containKey(key)) { - logger.warn("The option: '{}' is redundant", key); + LOG.warn("The option '{}' is redundant", key); continue; } ConfigOption option = OptionSpace.get(key); - Class dataType = option.dataType(); - String getMethod = "get" + dataType.getSimpleName(); - Method method = this.getClass() - .getMethod(getMethod, String.class, dataType); + Class dataType = option.dataType(); + String methodGetter = "get" + dataType.getSimpleName(); + Method method = this.getClass().getMethod(methodGetter, + String.class, + dataType); option.value(method.invoke(this, key, option.value())); } } catch (Exception e) { - logger.error(e.getMessage()); - throw new ConfigException(e.getMessage()); + LOG.error("Failed to update options value: {}", e.getMessage()); + throw new ConfigException("Failed to update options value"); } } @@ -117,5 +121,4 @@ public void addProperty(String key, Object value) { } super.addProperty(key, value); } - } diff --git a/src/main/java/com/baidu/hugegraph/config/OptionChecker.java b/src/main/java/com/baidu/hugegraph/config/OptionChecker.java index 71d4016ea7..68021fb3d5 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionChecker.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionChecker.java @@ -28,9 +28,6 @@ import com.google.common.base.Predicate; -/** - * Created by liningrui on 2017/3/23. - */ public class OptionChecker { public static final Predicate disallowEmpty(Class clazz) { @@ -43,12 +40,10 @@ public boolean apply(@Nullable O o) { if (o instanceof String) { return StringUtils.isNotBlank((String) o); } - if (o.getClass().isArray() && (Array.getLength(o) == 0 || - Array.get(o, 0) == null)) { + if (o.getClass().isArray() && (Array.getLength(o) == 0)) { return false; } - if (o instanceof Collection && (((Collection) o).isEmpty() || - ((Collection) o).iterator().next() == null)) { + if (o instanceof Collection && ((Collection) o).isEmpty()) { return false; } return true; diff --git a/src/main/java/com/baidu/hugegraph/config/OptionHolder.java b/src/main/java/com/baidu/hugegraph/config/OptionHolder.java index 360500d1c8..8fd186b6c2 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionHolder.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionHolder.java @@ -20,39 +20,38 @@ package com.baidu.hugegraph.config; import java.lang.reflect.Field; +import java.util.Collections; import java.util.HashMap; import java.util.Map; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; + +import com.baidu.hugegraph.util.Log; public class OptionHolder { - private static final Logger logger = - LoggerFactory.getLogger(HugeConfig.class); + private static final Logger LOG = Log.logger(HugeConfig.class); - protected Map options; + protected Map> options; public OptionHolder() { this.options = new HashMap<>(); } protected void registerOptions() { - Field[] fields = this.getClass().getFields(); - for (Field field : fields) { + for (Field field : this.getClass().getFields()) { try { - ConfigOption option = (ConfigOption) field.get(this); + ConfigOption option = (ConfigOption) field.get(this); this.options.put(option.name(), option); } catch (Exception e) { - String msg = String.format( - "Failed to register option : %s", field); - logger.error(msg, e); - throw new ConfigException(msg, e); + LOG.error("Failed to register option: {}", field, e); + throw new ConfigException(String.format( + "Failed to register option: %s", field)); } } } - public Map options() { - return this.options; + public Map> options() { + return Collections.unmodifiableMap(this.options); } } diff --git a/src/main/java/com/baidu/hugegraph/config/OptionSpace.java b/src/main/java/com/baidu/hugegraph/config/OptionSpace.java index 3d47e67cfa..560abbea33 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionSpace.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionSpace.java @@ -20,32 +20,33 @@ package com.baidu.hugegraph.config; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import com.baidu.hugegraph.util.E; -import com.google.common.collect.Maps; +import com.baidu.hugegraph.util.Log; -/** - * Created by liningrui on 2017/3/27. - */ -public class OptionSpace { +public final class OptionSpace { + + private static final Logger LOG = Log.logger(OptionSpace.class); - private static final Logger logger = - LoggerFactory.getLogger(OptionSpace.class); + private static final Map> options; - private static final Map options = Maps.newHashMap(); + static { + options = new ConcurrentHashMap<>(); + } public static void register(OptionHolder holder) { options.putAll(holder.options()); - logger.debug("Registered " + holder.getClass().getSimpleName()); + LOG.debug("Registered options for OptionHolder: {}", + holder.getClass().getSimpleName()); } public static void register(ConfigOption element) { E.checkArgument(!options.containsKey(element.name()), - "The option: '%s' has already been registered", - element.name()); + "The option '%s' has already been registered", + element.name()); options.put(element.name(), element); } diff --git a/src/main/java/com/baidu/hugegraph/event/EventHub.java b/src/main/java/com/baidu/hugegraph/event/EventHub.java index b584127a62..3793a5ae84 100644 --- a/src/main/java/com/baidu/hugegraph/event/EventHub.java +++ b/src/main/java/com/baidu/hugegraph/event/EventHub.java @@ -31,15 +31,14 @@ import javax.annotation.Nullable; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import com.baidu.hugegraph.type.ExtendableIterator; import com.baidu.hugegraph.util.E; +import com.baidu.hugegraph.util.Log; public class EventHub { - private static final Logger logger = - LoggerFactory.getLogger(EventHub.class); + private static final Logger LOG = Log.logger(EventHub.class); public static final String ANY_EVENT = "*"; @@ -137,7 +136,7 @@ public void notify(String event, @Nullable Object... args) { try { all.next().event(ev); } catch (Throwable ignored) { - logger.warn("Failed to handle event: {}", ev, ignored); + LOG.warn("Failed to handle event: {}", ev, ignored); } } }); diff --git a/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java b/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java index ce7d50bd12..5f85f5740d 100644 --- a/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java +++ b/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java @@ -37,9 +37,9 @@ import java.util.stream.Stream; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import com.baidu.hugegraph.type.TriFunction; +import com.baidu.hugegraph.util.Log; import com.baidu.hugegraph.util.ReflectionUtil; import com.google.common.reflect.ClassPath.ClassInfo; @@ -51,8 +51,7 @@ public class PerfUtil { - private static final Logger logger = - LoggerFactory.getLogger(PerfUtil.class); + private static final Logger LOG = Log.logger(PerfUtil.class); private static ThreadLocal instance = new ThreadLocal<>(); private Map stopwatches; @@ -166,7 +165,7 @@ private void profile(CtMethod ctMethod) // Insert as a finally-statement ctMethod.insertAfter(String.format(END, name), true); - logger.debug("Profiled for: '{}' [{}]", name, ctMethod.getLongName()); + LOG.debug("Profiled for: '{}' [{}]", name, ctMethod.getLongName()); } @Override diff --git a/src/main/java/com/baidu/hugegraph/util/Log.java b/src/main/java/com/baidu/hugegraph/util/Log.java new file mode 100644 index 0000000000..299f5316ed --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/util/Log.java @@ -0,0 +1,15 @@ +package com.baidu.hugegraph.util; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public final class Log { + + public static Logger logger(String name) { + return LoggerFactory.getLogger(name); + } + + public static Logger logger(Class clazz) { + return LoggerFactory.getLogger(clazz); + } +} From c24069ee26393ceea0c0b51d5a93045c6d90850c Mon Sep 17 00:00:00 2001 From: liningrui Date: Wed, 16 Aug 2017 18:31:55 +0800 Subject: [PATCH 033/217] HugeGraph-625: fixed bug that there is a line length of more than 80 characters in the license information for hugegraph-common Change-Id: Ic7cecaa7535f149060701fa16ff8e80f06cf363a --- src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java | 5 ++--- src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java | 5 ++--- src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java | 5 ++--- .../java/com/baidu/hugegraph/concurrent/LockManager.java | 5 ++--- .../java/com/baidu/hugegraph/config/ConfigException.java | 5 ++--- src/main/java/com/baidu/hugegraph/config/ConfigOption.java | 5 ++--- src/main/java/com/baidu/hugegraph/config/HugeConfig.java | 5 ++--- src/main/java/com/baidu/hugegraph/config/OptionChecker.java | 5 ++--- src/main/java/com/baidu/hugegraph/config/OptionHolder.java | 5 ++--- src/main/java/com/baidu/hugegraph/config/OptionSpace.java | 5 ++--- src/main/java/com/baidu/hugegraph/event/Event.java | 5 ++--- src/main/java/com/baidu/hugegraph/event/EventHub.java | 5 ++--- src/main/java/com/baidu/hugegraph/event/EventListener.java | 5 ++--- src/main/java/com/baidu/hugegraph/perf/PerfUtil.java | 5 ++--- src/main/java/com/baidu/hugegraph/perf/Stopwatch.java | 5 ++--- .../java/com/baidu/hugegraph/type/ExtendableIterator.java | 5 ++--- src/main/java/com/baidu/hugegraph/type/Shard.java | 5 ++--- src/main/java/com/baidu/hugegraph/type/TriFunction.java | 5 ++--- src/main/java/com/baidu/hugegraph/util/CollectionUtil.java | 5 ++--- src/main/java/com/baidu/hugegraph/util/E.java | 5 ++--- src/main/java/com/baidu/hugegraph/util/HashUtil.java | 5 ++--- src/main/java/com/baidu/hugegraph/util/LongEncoding.java | 1 - src/main/java/com/baidu/hugegraph/util/NumericUtil.java | 5 ++--- src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java | 5 ++--- src/main/java/com/baidu/hugegraph/util/TimeUtil.java | 5 ++--- 25 files changed, 48 insertions(+), 73 deletions(-) diff --git a/src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java b/src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java index 58a72cb9cd..74ee7461de 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java @@ -13,10 +13,9 @@ * 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. + * License for the specific language governing permissions and limitations + * under the License. */ - package com.baidu.hugegraph.concurrent; import java.util.concurrent.atomic.AtomicReference; diff --git a/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java b/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java index 6171e15e15..ab5a5740a4 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java @@ -13,10 +13,9 @@ * 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. + * License for the specific language governing permissions and limitations + * under the License. */ - package com.baidu.hugegraph.concurrent; import java.util.ArrayList; diff --git a/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java b/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java index b743d1f81d..5ed4dd6e78 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java @@ -13,10 +13,9 @@ * 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. + * License for the specific language governing permissions and limitations + * under the License. */ - package com.baidu.hugegraph.concurrent; import java.util.Map; diff --git a/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java b/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java index 24e9d6b895..651314bb99 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java @@ -13,10 +13,9 @@ * 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. + * License for the specific language governing permissions and limitations + * under the License. */ - package com.baidu.hugegraph.concurrent; import java.util.Map; diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigException.java b/src/main/java/com/baidu/hugegraph/config/ConfigException.java index b8a7d367ab..6bcbe03db2 100644 --- a/src/main/java/com/baidu/hugegraph/config/ConfigException.java +++ b/src/main/java/com/baidu/hugegraph/config/ConfigException.java @@ -13,10 +13,9 @@ * 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. + * License for the specific language governing permissions and limitations + * under the License. */ - package com.baidu.hugegraph.config; public class ConfigException extends RuntimeException { diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java index e2977a5fb8..7342acd70a 100644 --- a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java +++ b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java @@ -13,10 +13,9 @@ * 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. + * License for the specific language governing permissions and limitations + * under the License. */ - package com.baidu.hugegraph.config; import java.util.Set; diff --git a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java index a1bc10dbcd..77d7ff925c 100644 --- a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java +++ b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java @@ -13,10 +13,9 @@ * 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. + * License for the specific language governing permissions and limitations + * under the License. */ - package com.baidu.hugegraph.config; import java.io.File; diff --git a/src/main/java/com/baidu/hugegraph/config/OptionChecker.java b/src/main/java/com/baidu/hugegraph/config/OptionChecker.java index 68021fb3d5..5c3f912aa0 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionChecker.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionChecker.java @@ -13,10 +13,9 @@ * 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. + * License for the specific language governing permissions and limitations + * under the License. */ - package com.baidu.hugegraph.config; import java.lang.reflect.Array; diff --git a/src/main/java/com/baidu/hugegraph/config/OptionHolder.java b/src/main/java/com/baidu/hugegraph/config/OptionHolder.java index 8fd186b6c2..b6218cd6fa 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionHolder.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionHolder.java @@ -13,10 +13,9 @@ * 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. + * License for the specific language governing permissions and limitations + * under the License. */ - package com.baidu.hugegraph.config; import java.lang.reflect.Field; diff --git a/src/main/java/com/baidu/hugegraph/config/OptionSpace.java b/src/main/java/com/baidu/hugegraph/config/OptionSpace.java index 560abbea33..18e92e3404 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionSpace.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionSpace.java @@ -13,10 +13,9 @@ * 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. + * License for the specific language governing permissions and limitations + * under the License. */ - package com.baidu.hugegraph.config; import java.util.Map; diff --git a/src/main/java/com/baidu/hugegraph/event/Event.java b/src/main/java/com/baidu/hugegraph/event/Event.java index 53b58cfae3..9754798b4b 100644 --- a/src/main/java/com/baidu/hugegraph/event/Event.java +++ b/src/main/java/com/baidu/hugegraph/event/Event.java @@ -13,10 +13,9 @@ * 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. + * License for the specific language governing permissions and limitations + * under the License. */ - package com.baidu.hugegraph.event; import java.util.Arrays; diff --git a/src/main/java/com/baidu/hugegraph/event/EventHub.java b/src/main/java/com/baidu/hugegraph/event/EventHub.java index 3793a5ae84..697ba1d1ca 100644 --- a/src/main/java/com/baidu/hugegraph/event/EventHub.java +++ b/src/main/java/com/baidu/hugegraph/event/EventHub.java @@ -13,10 +13,9 @@ * 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. + * License for the specific language governing permissions and limitations + * under the License. */ - package com.baidu.hugegraph.event; import java.util.Collections; diff --git a/src/main/java/com/baidu/hugegraph/event/EventListener.java b/src/main/java/com/baidu/hugegraph/event/EventListener.java index 7e5144f852..eae57ce2e2 100644 --- a/src/main/java/com/baidu/hugegraph/event/EventListener.java +++ b/src/main/java/com/baidu/hugegraph/event/EventListener.java @@ -13,10 +13,9 @@ * 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. + * License for the specific language governing permissions and limitations + * under the License. */ - package com.baidu.hugegraph.event; public interface EventListener extends java.util.EventListener { diff --git a/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java b/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java index 5f85f5740d..9ca6fdd29e 100644 --- a/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java +++ b/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java @@ -13,10 +13,9 @@ * 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. + * License for the specific language governing permissions and limitations + * under the License. */ - package com.baidu.hugegraph.perf; import java.io.IOException; diff --git a/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java b/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java index f543d752ff..f30c288cce 100644 --- a/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java +++ b/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java @@ -13,10 +13,9 @@ * 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. + * License for the specific language governing permissions and limitations + * under the License. */ - package com.baidu.hugegraph.perf; public class Stopwatch implements Cloneable { diff --git a/src/main/java/com/baidu/hugegraph/type/ExtendableIterator.java b/src/main/java/com/baidu/hugegraph/type/ExtendableIterator.java index cbc3d81d84..31529ce86d 100644 --- a/src/main/java/com/baidu/hugegraph/type/ExtendableIterator.java +++ b/src/main/java/com/baidu/hugegraph/type/ExtendableIterator.java @@ -13,10 +13,9 @@ * 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. + * License for the specific language governing permissions and limitations + * under the License. */ - package com.baidu.hugegraph.type; import java.util.Deque; diff --git a/src/main/java/com/baidu/hugegraph/type/Shard.java b/src/main/java/com/baidu/hugegraph/type/Shard.java index 462dfa64d2..b7ed350c66 100644 --- a/src/main/java/com/baidu/hugegraph/type/Shard.java +++ b/src/main/java/com/baidu/hugegraph/type/Shard.java @@ -13,10 +13,9 @@ * 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. + * License for the specific language governing permissions and limitations + * under the License. */ - package com.baidu.hugegraph.type; /** diff --git a/src/main/java/com/baidu/hugegraph/type/TriFunction.java b/src/main/java/com/baidu/hugegraph/type/TriFunction.java index bb469440c2..d118c9cd11 100644 --- a/src/main/java/com/baidu/hugegraph/type/TriFunction.java +++ b/src/main/java/com/baidu/hugegraph/type/TriFunction.java @@ -13,10 +13,9 @@ * 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. + * License for the specific language governing permissions and limitations + * under the License. */ - package com.baidu.hugegraph.type; public interface TriFunction { diff --git a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java index 687e87718a..2bd4adb6ff 100644 --- a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java @@ -13,10 +13,9 @@ * 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. + * License for the specific language governing permissions and limitations + * under the License. */ - package com.baidu.hugegraph.util; import java.util.Collection; diff --git a/src/main/java/com/baidu/hugegraph/util/E.java b/src/main/java/com/baidu/hugegraph/util/E.java index 9ced5a754b..60a78fe760 100644 --- a/src/main/java/com/baidu/hugegraph/util/E.java +++ b/src/main/java/com/baidu/hugegraph/util/E.java @@ -13,10 +13,9 @@ * 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. + * License for the specific language governing permissions and limitations + * under the License. */ - package com.baidu.hugegraph.util; import java.util.Collection; diff --git a/src/main/java/com/baidu/hugegraph/util/HashUtil.java b/src/main/java/com/baidu/hugegraph/util/HashUtil.java index b2b1d32bdf..56f7e55e36 100644 --- a/src/main/java/com/baidu/hugegraph/util/HashUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/HashUtil.java @@ -13,10 +13,9 @@ * 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. + * License for the specific language governing permissions and limitations + * under the License. */ - package com.baidu.hugegraph.util; import java.nio.charset.Charset; diff --git a/src/main/java/com/baidu/hugegraph/util/LongEncoding.java b/src/main/java/com/baidu/hugegraph/util/LongEncoding.java index 817cfbc0eb..4631ef3b9c 100644 --- a/src/main/java/com/baidu/hugegraph/util/LongEncoding.java +++ b/src/main/java/com/baidu/hugegraph/util/LongEncoding.java @@ -14,7 +14,6 @@ * License for the specific language governing permissions and limitations * under the License. */ - package com.baidu.hugegraph.util; import com.google.common.base.Preconditions; diff --git a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java index 3cd99e75b2..0b02e0d04f 100644 --- a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java @@ -11,10 +11,9 @@ * 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. + * License for the specific language governing permissions and limitations + * under the License. */ - package com.baidu.hugegraph.util; import java.math.BigDecimal; diff --git a/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java b/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java index 50883e0f6c..b65ea786dd 100644 --- a/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java @@ -13,10 +13,9 @@ * 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. + * License for the specific language governing permissions and limitations + * under the License. */ - package com.baidu.hugegraph.util; import java.io.IOException; diff --git a/src/main/java/com/baidu/hugegraph/util/TimeUtil.java b/src/main/java/com/baidu/hugegraph/util/TimeUtil.java index f6be5533d7..49ccdac74c 100644 --- a/src/main/java/com/baidu/hugegraph/util/TimeUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/TimeUtil.java @@ -13,10 +13,9 @@ * 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. + * License for the specific language governing permissions and limitations + * under the License. */ - package com.baidu.hugegraph.util; import java.util.Date; From b4a6cc9ab4a5326c19171be6c670e09375cfdc63 Mon Sep 17 00:00:00 2001 From: liningrui Date: Wed, 16 Aug 2017 18:54:06 +0800 Subject: [PATCH 034/217] HugeGraph-596: fixed bug that hugegraph-common deploy before merge Change-Id: Ia52ab72006bd8a2ba58254fbf4266f1555ebb8cd --- build.sh | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/build.sh b/build.sh index ae4a68cfa8..2beda8cbd1 100644 --- a/build.sh +++ b/build.sh @@ -6,24 +6,4 @@ export MAVEN_HOME="/home/scmtools/buildkit/maven/apache-maven-3.3.9/" export JAVA_HOME="/home/scmtools/buildkit/java/jdk1.8.0_25/" export PATH="$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH" -mvn clean package -DskipTests - -if [ -d $HUGEGRAPH_COMMON_RELEASE_PATH ]; then - echo "$HUGEGRAPH_COMMON_RELEASE_PATH is already exists." - exit 1 -fi - -mkdir -p $HUGEGRAPH_COMMON_RELEASE_PATH || echo "Failed to create directory: $HUGEGRAPH_COMMON_RELEASE_PATH" - -cp target/*.jar $HUGEGRAPH_COMMON_RELEASE_PATH -if [ $? -ne 0 ]; then - echo "Move jar to $HUGEGRAPH_COMMON_RELEASE_PATH failed." -else - echo "Build Succeed!" -fi - -echo "Deploy to baidu maven repository..." - -mvn deploy -DskipTests - -exit $? \ No newline at end of file +mvn clean compile From ca0a9832a69ba6414020812b4ebfcd802c26e42f Mon Sep 17 00:00:00 2001 From: liningrui Date: Thu, 17 Aug 2017 10:11:31 +0800 Subject: [PATCH 035/217] HugeGraph-596: Passed env varibale from BCLOUD to agile module for hugegraph-common module Change-Id: Id3b89cccd310625826ca8fc2502133146221b138 --- BCLOUD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BCLOUD b/BCLOUD index bca03abdbe..2b0d256133 100644 --- a/BCLOUD +++ b/BCLOUD @@ -1 +1 @@ -BUILD_SUBMITTER -x -e CENTOS6U3 -m baidu/xbu-data/hugegraph-common -c "cd baidu/xbu-data/hugegraph-common && sh build.sh" -u ./ \ No newline at end of file +BUILD_SUBMITTER -x -e CENTOS6U3 -m baidu/xbu-data/hugegraph-common -c "export MAVEN_HOME=/home/scmtools/buildkit/maven/apache-maven-3.3.9/ && export JAVA_HOME=/home/scmtools/buildkit/java/jdk1.8.0_25/ && export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH && cd baidu/xbu-data/hugegraph-common && sh build.sh" -u ./ \ No newline at end of file From 281aab85f272008931e0209b474567335bf9d2c7 Mon Sep 17 00:00:00 2001 From: liningrui Date: Thu, 17 Aug 2017 16:07:46 +0800 Subject: [PATCH 036/217] HugeGraph-645: Add space line between license and package for hugegraph-common Change-Id: I92a66e429382695b0f2a5742fb16299faace1616 --- .../hugegraph/concurrent/AtomicLock.java | 1 + .../baidu/hugegraph/concurrent/KeyLock.java | 1 + .../baidu/hugegraph/concurrent/LockGroup.java | 1 + .../hugegraph/concurrent/LockManager.java | 1 + .../hugegraph/config/ConfigException.java | 1 + .../baidu/hugegraph/config/ConfigOption.java | 1 + .../baidu/hugegraph/config/HugeConfig.java | 1 + .../baidu/hugegraph/config/OptionChecker.java | 1 + .../baidu/hugegraph/config/OptionHolder.java | 1 + .../baidu/hugegraph/config/OptionSpace.java | 1 + .../java/com/baidu/hugegraph/event/Event.java | 1 + .../com/baidu/hugegraph/event/EventHub.java | 1 + .../baidu/hugegraph/event/EventListener.java | 1 + .../com/baidu/hugegraph/perf/PerfUtil.java | 1 + .../com/baidu/hugegraph/perf/Stopwatch.java | 1 + .../hugegraph/type/ExtendableIterator.java | 1 + .../java/com/baidu/hugegraph/type/Shard.java | 1 + .../com/baidu/hugegraph/type/TriFunction.java | 1 + .../baidu/hugegraph/util/CollectionUtil.java | 1 + src/main/java/com/baidu/hugegraph/util/E.java | 1 + .../com/baidu/hugegraph/util/HashUtil.java | 1 + .../java/com/baidu/hugegraph/util/Log.java | 19 +++++++++++++++++++ .../baidu/hugegraph/util/LongEncoding.java | 1 + .../com/baidu/hugegraph/util/NumericUtil.java | 1 + .../baidu/hugegraph/util/ReflectionUtil.java | 1 + .../com/baidu/hugegraph/util/TimeUtil.java | 1 + 26 files changed, 44 insertions(+) diff --git a/src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java b/src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java index 74ee7461de..a2377f8003 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java @@ -16,6 +16,7 @@ * License for the specific language governing permissions and limitations * under the License. */ + package com.baidu.hugegraph.concurrent; import java.util.concurrent.atomic.AtomicReference; diff --git a/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java b/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java index ab5a5740a4..1ed31cb34e 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java @@ -16,6 +16,7 @@ * License for the specific language governing permissions and limitations * under the License. */ + package com.baidu.hugegraph.concurrent; import java.util.ArrayList; diff --git a/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java b/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java index 5ed4dd6e78..b5172fe944 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java @@ -16,6 +16,7 @@ * License for the specific language governing permissions and limitations * under the License. */ + package com.baidu.hugegraph.concurrent; import java.util.Map; diff --git a/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java b/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java index 651314bb99..670bd2d20f 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java @@ -16,6 +16,7 @@ * License for the specific language governing permissions and limitations * under the License. */ + package com.baidu.hugegraph.concurrent; import java.util.Map; diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigException.java b/src/main/java/com/baidu/hugegraph/config/ConfigException.java index 6bcbe03db2..9c58359daa 100644 --- a/src/main/java/com/baidu/hugegraph/config/ConfigException.java +++ b/src/main/java/com/baidu/hugegraph/config/ConfigException.java @@ -16,6 +16,7 @@ * License for the specific language governing permissions and limitations * under the License. */ + package com.baidu.hugegraph.config; public class ConfigException extends RuntimeException { diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java index 7342acd70a..1d8be85888 100644 --- a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java +++ b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java @@ -16,6 +16,7 @@ * License for the specific language governing permissions and limitations * under the License. */ + package com.baidu.hugegraph.config; import java.util.Set; diff --git a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java index 77d7ff925c..7e6d1fce64 100644 --- a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java +++ b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java @@ -16,6 +16,7 @@ * License for the specific language governing permissions and limitations * under the License. */ + package com.baidu.hugegraph.config; import java.io.File; diff --git a/src/main/java/com/baidu/hugegraph/config/OptionChecker.java b/src/main/java/com/baidu/hugegraph/config/OptionChecker.java index 5c3f912aa0..44c51a3fee 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionChecker.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionChecker.java @@ -16,6 +16,7 @@ * License for the specific language governing permissions and limitations * under the License. */ + package com.baidu.hugegraph.config; import java.lang.reflect.Array; diff --git a/src/main/java/com/baidu/hugegraph/config/OptionHolder.java b/src/main/java/com/baidu/hugegraph/config/OptionHolder.java index b6218cd6fa..e853ed80b2 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionHolder.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionHolder.java @@ -16,6 +16,7 @@ * License for the specific language governing permissions and limitations * under the License. */ + package com.baidu.hugegraph.config; import java.lang.reflect.Field; diff --git a/src/main/java/com/baidu/hugegraph/config/OptionSpace.java b/src/main/java/com/baidu/hugegraph/config/OptionSpace.java index 18e92e3404..ed3587fca3 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionSpace.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionSpace.java @@ -16,6 +16,7 @@ * License for the specific language governing permissions and limitations * under the License. */ + package com.baidu.hugegraph.config; import java.util.Map; diff --git a/src/main/java/com/baidu/hugegraph/event/Event.java b/src/main/java/com/baidu/hugegraph/event/Event.java index 9754798b4b..4df6cdf652 100644 --- a/src/main/java/com/baidu/hugegraph/event/Event.java +++ b/src/main/java/com/baidu/hugegraph/event/Event.java @@ -16,6 +16,7 @@ * License for the specific language governing permissions and limitations * under the License. */ + package com.baidu.hugegraph.event; import java.util.Arrays; diff --git a/src/main/java/com/baidu/hugegraph/event/EventHub.java b/src/main/java/com/baidu/hugegraph/event/EventHub.java index 697ba1d1ca..41c460684f 100644 --- a/src/main/java/com/baidu/hugegraph/event/EventHub.java +++ b/src/main/java/com/baidu/hugegraph/event/EventHub.java @@ -16,6 +16,7 @@ * License for the specific language governing permissions and limitations * under the License. */ + package com.baidu.hugegraph.event; import java.util.Collections; diff --git a/src/main/java/com/baidu/hugegraph/event/EventListener.java b/src/main/java/com/baidu/hugegraph/event/EventListener.java index eae57ce2e2..71148b24ac 100644 --- a/src/main/java/com/baidu/hugegraph/event/EventListener.java +++ b/src/main/java/com/baidu/hugegraph/event/EventListener.java @@ -16,6 +16,7 @@ * License for the specific language governing permissions and limitations * under the License. */ + package com.baidu.hugegraph.event; public interface EventListener extends java.util.EventListener { diff --git a/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java b/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java index 9ca6fdd29e..2b6c13ac58 100644 --- a/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java +++ b/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java @@ -16,6 +16,7 @@ * License for the specific language governing permissions and limitations * under the License. */ + package com.baidu.hugegraph.perf; import java.io.IOException; diff --git a/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java b/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java index f30c288cce..500e1e8186 100644 --- a/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java +++ b/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java @@ -16,6 +16,7 @@ * License for the specific language governing permissions and limitations * under the License. */ + package com.baidu.hugegraph.perf; public class Stopwatch implements Cloneable { diff --git a/src/main/java/com/baidu/hugegraph/type/ExtendableIterator.java b/src/main/java/com/baidu/hugegraph/type/ExtendableIterator.java index 31529ce86d..5966d9db1d 100644 --- a/src/main/java/com/baidu/hugegraph/type/ExtendableIterator.java +++ b/src/main/java/com/baidu/hugegraph/type/ExtendableIterator.java @@ -16,6 +16,7 @@ * License for the specific language governing permissions and limitations * under the License. */ + package com.baidu.hugegraph.type; import java.util.Deque; diff --git a/src/main/java/com/baidu/hugegraph/type/Shard.java b/src/main/java/com/baidu/hugegraph/type/Shard.java index b7ed350c66..406550c4a1 100644 --- a/src/main/java/com/baidu/hugegraph/type/Shard.java +++ b/src/main/java/com/baidu/hugegraph/type/Shard.java @@ -16,6 +16,7 @@ * License for the specific language governing permissions and limitations * under the License. */ + package com.baidu.hugegraph.type; /** diff --git a/src/main/java/com/baidu/hugegraph/type/TriFunction.java b/src/main/java/com/baidu/hugegraph/type/TriFunction.java index d118c9cd11..58a345455d 100644 --- a/src/main/java/com/baidu/hugegraph/type/TriFunction.java +++ b/src/main/java/com/baidu/hugegraph/type/TriFunction.java @@ -16,6 +16,7 @@ * License for the specific language governing permissions and limitations * under the License. */ + package com.baidu.hugegraph.type; public interface TriFunction { diff --git a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java index 2bd4adb6ff..9e983d1494 100644 --- a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java @@ -16,6 +16,7 @@ * License for the specific language governing permissions and limitations * under the License. */ + package com.baidu.hugegraph.util; import java.util.Collection; diff --git a/src/main/java/com/baidu/hugegraph/util/E.java b/src/main/java/com/baidu/hugegraph/util/E.java index 60a78fe760..727b7fd493 100644 --- a/src/main/java/com/baidu/hugegraph/util/E.java +++ b/src/main/java/com/baidu/hugegraph/util/E.java @@ -16,6 +16,7 @@ * License for the specific language governing permissions and limitations * under the License. */ + package com.baidu.hugegraph.util; import java.util.Collection; diff --git a/src/main/java/com/baidu/hugegraph/util/HashUtil.java b/src/main/java/com/baidu/hugegraph/util/HashUtil.java index 56f7e55e36..bdb29f5528 100644 --- a/src/main/java/com/baidu/hugegraph/util/HashUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/HashUtil.java @@ -16,6 +16,7 @@ * License for the specific language governing permissions and limitations * under the License. */ + package com.baidu.hugegraph.util; import java.nio.charset.Charset; diff --git a/src/main/java/com/baidu/hugegraph/util/Log.java b/src/main/java/com/baidu/hugegraph/util/Log.java index 299f5316ed..6507cf0188 100644 --- a/src/main/java/com/baidu/hugegraph/util/Log.java +++ b/src/main/java/com/baidu/hugegraph/util/Log.java @@ -1,3 +1,22 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.util; import org.slf4j.Logger; diff --git a/src/main/java/com/baidu/hugegraph/util/LongEncoding.java b/src/main/java/com/baidu/hugegraph/util/LongEncoding.java index 4631ef3b9c..817cfbc0eb 100644 --- a/src/main/java/com/baidu/hugegraph/util/LongEncoding.java +++ b/src/main/java/com/baidu/hugegraph/util/LongEncoding.java @@ -14,6 +14,7 @@ * License for the specific language governing permissions and limitations * under the License. */ + package com.baidu.hugegraph.util; import com.google.common.base.Preconditions; diff --git a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java index 0b02e0d04f..378d41567c 100644 --- a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java @@ -14,6 +14,7 @@ * License for the specific language governing permissions and limitations * under the License. */ + package com.baidu.hugegraph.util; import java.math.BigDecimal; diff --git a/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java b/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java index b65ea786dd..27ff6a8ed7 100644 --- a/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java @@ -16,6 +16,7 @@ * License for the specific language governing permissions and limitations * under the License. */ + package com.baidu.hugegraph.util; import java.io.IOException; diff --git a/src/main/java/com/baidu/hugegraph/util/TimeUtil.java b/src/main/java/com/baidu/hugegraph/util/TimeUtil.java index 49ccdac74c..aacd1fa468 100644 --- a/src/main/java/com/baidu/hugegraph/util/TimeUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/TimeUtil.java @@ -16,6 +16,7 @@ * License for the specific language governing permissions and limitations * under the License. */ + package com.baidu.hugegraph.util; import java.util.Date; From 4d6c421358788fc04c69a8f58ff1f53ce8563e61 Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Fri, 25 Aug 2017 11:12:42 +0800 Subject: [PATCH 037/217] HugeGraph-726: add toList(array) method into class CollectionUtil Change-Id: Ia8a06f002e66f11935986284f587563ebc0c2257 --- pom.xml | 4 ++-- .../com/baidu/hugegraph/util/CheckSocket.java | 2 +- .../baidu/hugegraph/util/CollectionUtil.java | 21 ++++++++++++++++--- src/main/java/com/baidu/hugegraph/util/E.java | 3 --- .../com/baidu/hugegraph/util/HashUtil.java | 3 --- 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index 375ba028d1..795d0001a1 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT @@ -154,7 +154,7 @@ - 1.3.0.0 + 1.3.1.0 diff --git a/src/main/java/com/baidu/hugegraph/util/CheckSocket.java b/src/main/java/com/baidu/hugegraph/util/CheckSocket.java index 17aded4ae9..961c42a8a2 100644 --- a/src/main/java/com/baidu/hugegraph/util/CheckSocket.java +++ b/src/main/java/com/baidu/hugegraph/util/CheckSocket.java @@ -34,7 +34,7 @@ public final class CheckSocket { private static final int E_USAGE = 1; private static final int E_FAILED = 2; private static final String MSG_USAGE = - "Usage: " + CheckSocket.class.getSimpleName() + " hostname port"; + "Usage: " + CheckSocket.class.getSimpleName() + " hostname port"; public static void main(String args[]) { if (args.length != 2) { diff --git a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java index 9e983d1494..331d29cda0 100644 --- a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java @@ -19,15 +19,30 @@ package com.baidu.hugegraph.util; +import java.lang.reflect.Array; +import java.util.ArrayList; import java.util.Collection; +import java.util.List; -/** - * Created by liningrui on 2017/3/30. - */ public final class CollectionUtil { @SuppressWarnings({ "unchecked", "rawtypes" }) public static boolean containsAll(Collection a, Collection b) { return a.containsAll(b); } + + @SuppressWarnings("unchecked") + public static List toList(Object array) { + E.checkNotNull(array, "array"); + E.checkArgument(array.getClass().isArray(), + "The parameter of toList() must be an array: '%s'", + array.getClass().getSimpleName()); + + int length = Array.getLength(array); + List list = new ArrayList<>(length); + for (int i = 0; i < length; i++) { + list.add((T) Array.get(array, i)); + } + return list; + } } diff --git a/src/main/java/com/baidu/hugegraph/util/E.java b/src/main/java/com/baidu/hugegraph/util/E.java index 727b7fd493..340b7bc7a1 100644 --- a/src/main/java/com/baidu/hugegraph/util/E.java +++ b/src/main/java/com/baidu/hugegraph/util/E.java @@ -25,9 +25,6 @@ import com.google.common.base.Preconditions; -/** - * Created by liningrui on 2017/5/26. - */ public final class E { public static void checkNotNull(Object object, String elem) { diff --git a/src/main/java/com/baidu/hugegraph/util/HashUtil.java b/src/main/java/com/baidu/hugegraph/util/HashUtil.java index bdb29f5528..3a39eb3d4b 100644 --- a/src/main/java/com/baidu/hugegraph/util/HashUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/HashUtil.java @@ -23,9 +23,6 @@ import com.google.common.hash.Hashing; -/** - * Created by jishilei on 2017/3/26. - */ public final class HashUtil { public static byte[] hash(byte[] bytes) { From 12c53cc17b6c0e0738d2d9a7d874746b366d5744 Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Fri, 25 Aug 2017 11:24:58 +0800 Subject: [PATCH 038/217] fix EventHub bugs: HugeGraph-732 and HugeGraph-733 Change-Id: I9395193680b986e543a0af3c08ce434b2b0e329c --- pom.xml | 2 +- .../com/baidu/hugegraph/event/EventHub.java | 29 +++++++++++++++---- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 795d0001a1..0a31e36f73 100644 --- a/pom.xml +++ b/pom.xml @@ -154,7 +154,7 @@ - 1.3.1.0 + 1.3.1.1 diff --git a/src/main/java/com/baidu/hugegraph/event/EventHub.java b/src/main/java/com/baidu/hugegraph/event/EventHub.java index 41c460684f..23fae07005 100644 --- a/src/main/java/com/baidu/hugegraph/event/EventHub.java +++ b/src/main/java/com/baidu/hugegraph/event/EventHub.java @@ -35,6 +35,7 @@ import com.baidu.hugegraph.type.ExtendableIterator; import com.baidu.hugegraph.util.E; import com.baidu.hugegraph.util.Log; +import com.google.common.collect.ImmutableList; public class EventHub { @@ -42,6 +43,8 @@ public class EventHub { public static final String ANY_EVENT = "*"; + private static final List EMPTY = ImmutableList.of(); + // Event executor private static ExecutorService executor = null; @@ -53,6 +56,8 @@ public EventHub() { } public EventHub(String name) { + LOG.debug("Create new EventHub: {}", name); + this.name = name; this.listeners = new ConcurrentHashMap<>(); EventHub.init(1); @@ -62,11 +67,13 @@ public static synchronized void init(int poolSize) { if (executor != null) { return; } + LOG.debug("Init pool(size {}) for EventHub", poolSize); executor = Executors.newFixedThreadPool(poolSize); } public static synchronized boolean destroy(long timeout) throws InterruptedException { + LOG.debug("Destroy pool for EventHub"); executor.shutdown(); return executor.awaitTermination(timeout, TimeUnit.SECONDS); } @@ -82,11 +89,13 @@ public String name() { } public boolean containsListener(String event) { - return this.listeners.containsKey(event); + List ls = this.listeners.get(event); + return ls != null && ls.size() > 0; } public List listeners(String event) { - return Collections.unmodifiableList(this.listeners.get(event)); + List ls = this.listeners.get(event); + return ls == null ? EMPTY : Collections.unmodifiableList(ls); } public void listen(String event, EventListener listener) { @@ -102,15 +111,21 @@ public void listen(String event, EventListener listener) { } public List unlisten(String event) { - return Collections.unmodifiableList(this.listeners.remove(event)); + List ls = this.listeners.remove(event); + return ls == null ? EMPTY : Collections.unmodifiableList(ls); } - public boolean unlisten(String event, EventListener listener) { + public int unlisten(String event, EventListener listener) { List ls = this.listeners.get(event); if (ls == null) { - return false; + return 0; } - return ls.remove(listener); + + int count = 0; + while (ls.remove(listener)) { + count++; + } + return count; } public void notify(String event, @Nullable Object... args) { @@ -130,6 +145,8 @@ public void notify(String event, @Nullable Object... args) { } Event ev = new Event(this, event, args); + + // The submit will catch params: `all`(Listeners) and `ev`(Event) executor().submit(() -> { // Notify all listeners, and ignore the results while (all.hasNext()) { From 5195740642a25b3702c45d01851d31349dbbffc2 Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Fri, 1 Sep 2017 17:44:03 +0800 Subject: [PATCH 039/217] HugeGraph-762: add isSimpleType() method to class ReflectionUtil Change-Id: I7372c982dda9241d3d7d7b688d37d0403268e173 --- pom.xml | 4 ++-- .../java/com/baidu/hugegraph/util/ReflectionUtil.java | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 0a31e36f73..d4b43777e5 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.3.1-SNAPSHOT + 1.3.2-SNAPSHOT @@ -154,7 +154,7 @@ - 1.3.1.1 + 1.3.2.0 diff --git a/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java b/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java index 27ff6a8ed7..0bbb08f901 100644 --- a/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java @@ -38,6 +38,16 @@ public final class ReflectionUtil { + public static boolean isSimpleType(Class type) { + if (type.isPrimitive() || + type.equals(String.class) || + type.equals(Boolean.class) || + NumericUtil.isNumber(type)) { + return true; + } + return false; + } + public static List getMethodsAnnotatedWith( Class type, Class annotation, From 5e003a7f2f7310f92db9405a1c2308d594cfc401 Mon Sep 17 00:00:00 2001 From: liningrui Date: Tue, 31 Oct 2017 16:44:57 +0800 Subject: [PATCH 040/217] HugeGraph-830: Catch IOException if create new socket connection failed. Note that, we should try to avoid catch Throwable since it not only catch all exceptions but also catch errors. Change-Id: I72ae39058d737b1bbbeb70f4f05737fe95ed4ffc --- src/main/java/com/baidu/hugegraph/util/CheckSocket.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/baidu/hugegraph/util/CheckSocket.java b/src/main/java/com/baidu/hugegraph/util/CheckSocket.java index 961c42a8a2..9a6066586d 100644 --- a/src/main/java/com/baidu/hugegraph/util/CheckSocket.java +++ b/src/main/java/com/baidu/hugegraph/util/CheckSocket.java @@ -14,6 +14,7 @@ package com.baidu.hugegraph.util; +import java.io.IOException; import java.net.InetAddress; import java.net.Socket; @@ -46,7 +47,7 @@ public static void main(String args[]) { Integer.parseInt(args[1])); s.close(); System.exit(0); - } catch (Throwable ignored) { + } catch (IOException ignored) { System.err.println(ignored.toString()); System.exit(E_FAILED); } From d8d4b3eba5e43cf233c55081322d6640799c93c3 Mon Sep 17 00:00:00 2001 From: zhangyi51 Date: Mon, 6 Nov 2017 17:33:29 +0800 Subject: [PATCH 041/217] hugegraph-911 add prefixOf method into CollectionUtil Change-Id: Ia917fc5ec5492547dee6b0477d9c3f947cddb71f --- pom.xml | 4 ++-- .../baidu/hugegraph/util/CollectionUtil.java | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index d4b43777e5..e3d89360f7 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.3.2-SNAPSHOT + 1.3.3-SNAPSHOT @@ -154,7 +154,7 @@ - 1.3.2.0 + 1.3.3.0 diff --git a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java index 331d29cda0..6f1a5a2baf 100644 --- a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java @@ -45,4 +45,25 @@ public static List toList(Object array) { } return list; } + + public static boolean prefixOf(List prefix, List all) { + E.checkNotNull(prefix, "prefix"); + E.checkNotNull(all, "all"); + + if (prefix.size() > all.size()) { + return false; + } + + for (int i = 0; i < prefix.size(); i++) { + String first = prefix.get(i); + String second = all.get(i); + if (first == second) { + continue; + } + if (first == null || !first.equals(second)) { + return false; + } + } + return true; + } } From 094f8bb56beb81b7f30395a34021a12fe279bb81 Mon Sep 17 00:00:00 2001 From: liningrui Date: Mon, 13 Nov 2017 17:17:45 +0800 Subject: [PATCH 042/217] HugeGraph-935: Add a method 'allUnique' Change-Id: Iebbcb8acb90844e82ae8e70b559a600543aaf6d8 --- pom.xml | 4 ++-- src/main/java/com/baidu/hugegraph/config/ConfigOption.java | 1 + src/main/java/com/baidu/hugegraph/config/HugeConfig.java | 3 ++- src/main/java/com/baidu/hugegraph/util/CollectionUtil.java | 5 +++++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index e3d89360f7..2274675e53 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.3.3-SNAPSHOT + 1.3.4-SNAPSHOT @@ -154,7 +154,7 @@ - 1.3.3.0 + 1.3.4.0 diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java index 1d8be85888..377dfdcf8a 100644 --- a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java +++ b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java @@ -55,6 +55,7 @@ public class ConfigOption { private final String name; private final String desc; + // Not allowed to modify option whose `rewritable` is false private final Boolean rewritable; private final Class dataType; private T value; diff --git a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java index 7e6d1fce64..f3b146682f 100644 --- a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java +++ b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java @@ -89,7 +89,8 @@ public void updateDefaultOption() { String key = keys.next(); if (!OptionSpace.containKey(key)) { - LOG.warn("The option '{}' is redundant", key); + LOG.warn("The config option '{}' is redundant, " + + "please ensure it has been registered", key); continue; } ConfigOption option = OptionSpace.get(key); diff --git a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java index 6f1a5a2baf..9aa46466b6 100644 --- a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java @@ -22,6 +22,7 @@ import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Collection; +import java.util.HashSet; import java.util.List; public final class CollectionUtil { @@ -66,4 +67,8 @@ public static boolean prefixOf(List prefix, List all) { } return true; } + + public static boolean allUnique(Collection collection){ + return collection.stream().allMatch(new HashSet<>()::add); + } } From b01f3a35df9e61ab9a389701e2b4880d3cdd9a4f Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Thu, 7 Dec 2017 21:59:29 +0800 Subject: [PATCH 043/217] HugeGraph-975: support conversion: number <==> bytes Change-Id: I8da23ab89f0e3eda99ec744904dd7ef06571a8e2 --- pom.xml | 2 +- .../baidu/hugegraph/util/LongEncoding.java | 11 ++- .../com/baidu/hugegraph/util/NumericUtil.java | 76 +++++++++++++++---- .../com/baidu/hugegraph/util/TimeUtil.java | 9 ++- 4 files changed, 71 insertions(+), 27 deletions(-) diff --git a/pom.xml b/pom.xml index 2274675e53..75d26bad30 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.3.4-SNAPSHOT + 1.3.5-SNAPSHOT diff --git a/src/main/java/com/baidu/hugegraph/util/LongEncoding.java b/src/main/java/com/baidu/hugegraph/util/LongEncoding.java index 817cfbc0eb..04dd4ab6d5 100644 --- a/src/main/java/com/baidu/hugegraph/util/LongEncoding.java +++ b/src/main/java/com/baidu/hugegraph/util/LongEncoding.java @@ -17,8 +17,6 @@ package com.baidu.hugegraph.util; -import com.google.common.base.Preconditions; - /** * Utility class for encoding longs in strings based on: * {@linktourl http://stackoverflow.com/questions/2938482/encode-decode-a-long-to-a-string-using-a-fixed-set-of-letters-in-java} @@ -26,7 +24,8 @@ */ public final class LongEncoding { - private static final String BASE_SYMBOLS = "0123456789abcdefghijklmnopqrstuvwxyz"; + private static final String BASE_SYMBOLS = + "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-~"; public static long decode(String s) { return decode(s, BASE_SYMBOLS); @@ -43,14 +42,15 @@ public static long decode(String s, String symbols) { num *= B; int pos = symbols.indexOf(ch); if (pos < 0) - throw new NumberFormatException("Symbol set does not match string"); + throw new NumberFormatException( + "Symbol set does not match string"); num += pos; } return num; } public static String encode(long num, String symbols) { - Preconditions.checkArgument(num >= 0, "Expected non-negative number: " + num); + E.checkArgument(num >= 0, "Expected non-negative number: %s", num); final int B = symbols.length(); StringBuilder sb = new StringBuilder(); while (num != 0) { @@ -59,5 +59,4 @@ public static String encode(long num, String symbols) { } return sb.reverse().toString(); } - } diff --git a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java index 378d41567c..cb6789e9db 100644 --- a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java @@ -28,7 +28,7 @@ public final class NumericUtil { private NumericUtil() { - } // no instance! + } /** * Converts a double value to a sortable signed @@ -96,6 +96,46 @@ public static int sortableFloatBits(int bits) { /*************************************************************************/ + public static byte[] numberToSortableBytes(Number number) { + if (number instanceof Long) { + return longToBytes(number.longValue()); + } else if (number instanceof Double) { + return longToBytes(doubleToSortableLong(number.doubleValue())); + } else if (number instanceof Float) { + return intToBytes(floatToSortableInt(number.floatValue())); + } else if (number instanceof Integer || number instanceof Short) { + return intToBytes(number.intValue()); + } else if (number instanceof Byte) { + return new byte[]{number.byteValue()} ; + } + + // TODO: support other number types + return null; + } + + public static Number sortableBytesToNumber(byte[] bytes, Class clazz) { + assert NumericUtil.isNumber(clazz); + + if (clazz == Long.class) { + return bytesToLong(bytes); + } else if (clazz == Double.class) { + return sortableLongToDouble(bytesToLong(bytes)); + } else if (clazz == Float.class) { + return sortableIntToFloat(bytesToInt(bytes)); + } else if (clazz == Integer.class) { + return bytesToInt(bytes); + } else if (clazz == Short.class) { + return (short) bytesToInt(bytes); + } else if (clazz == Byte.class) { + return bytes[0]; + } + + // TODO: support other number types + return null; + } + + /*************************************************************************/ + public static byte[] longToBytes(long value) { ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES); buffer.putLong(value); @@ -103,10 +143,19 @@ public static byte[] longToBytes(long value) { } public static long bytesToLong(byte[] bytes) { - ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES); - buffer.put(bytes); - buffer.flip(); - return buffer.getLong(); + assert bytes.length == Long.BYTES; + return ByteBuffer.wrap(bytes).getLong(); + } + + public static byte[] intToBytes(int value) { + ByteBuffer buffer = ByteBuffer.allocate(Integer.BYTES); + buffer.putInt(value); + return buffer.array(); + } + + public static int bytesToInt(byte[] bytes) { + assert bytes.length == Integer.BYTES; + return ByteBuffer.wrap(bytes).getInt(); } /*************************************************************************/ @@ -118,26 +167,21 @@ public static boolean isNumber(Object value) { return isNumber(value.getClass()); } - public static boolean isNumber(Class type) { - if (type.getSuperclass() != null - && type.getSuperclass().equals(Number.class)) { - return true; - } - return false; + public static boolean isNumber(Class clazz) { + return Number.class.isAssignableFrom(clazz); } /*************************************************************************/ - public static Object convert2Number(Object value) { + public static Object convertToNumber(Object value) { if (!isNumber(value) && value != null) { if (value instanceof Date) { value = ((Date) value).getTime(); + } else { + // TODO: add some more types to convert + value = new BigDecimal(value.toString()); } - // TODO: add some more types to convert - - value = new BigDecimal(value.toString()); } return value; } - } diff --git a/src/main/java/com/baidu/hugegraph/util/TimeUtil.java b/src/main/java/com/baidu/hugegraph/util/TimeUtil.java index aacd1fa468..4845adc1ed 100644 --- a/src/main/java/com/baidu/hugegraph/util/TimeUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/TimeUtil.java @@ -23,18 +23,19 @@ public final class TimeUtil { - public static long twepoch = 1288834974657L; + @SuppressWarnings("deprecation") + public static long BASE_TIME = new Date(2017 - 1900, 10, 28).getTime(); public static long timeGen() { - return System.currentTimeMillis() - twepoch; + return System.currentTimeMillis() - BASE_TIME; } public static long timeGen(Date date) { - return date.getTime() - twepoch; + return date.getTime() - BASE_TIME; } public static long timeGen(long time) { - return time - twepoch; + return time - BASE_TIME; } public static long tillNextMillis(long lastTimestamp) { From 3d3da162de0e70c7fa79a1383b06cc2d3165844a Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Mon, 11 Dec 2017 17:35:51 +0800 Subject: [PATCH 044/217] HugeGraph-978: add prefixWith() for bytes Change-Id: I17a493ef0097f9208f4cfa3aad8bbd159283f4bb --- pom.xml | 2 +- .../java/com/baidu/hugegraph/util/Bytes.java | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/baidu/hugegraph/util/Bytes.java diff --git a/pom.xml b/pom.xml index 75d26bad30..8d5b1231e5 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.3.5-SNAPSHOT + 1.3.6-SNAPSHOT diff --git a/src/main/java/com/baidu/hugegraph/util/Bytes.java b/src/main/java/com/baidu/hugegraph/util/Bytes.java new file mode 100644 index 0000000000..75f8dbb50e --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/util/Bytes.java @@ -0,0 +1,38 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.util; + +/** + * TODO: extends com.google.common.primitives.Bytes + */ +public final class Bytes { + + public static boolean prefixWith(byte[] bytes, byte[] prefix) { + if (bytes.length < prefix.length) { + return false; + } + for (int i = 0; i < prefix.length; i++) { + if (bytes[i] != prefix[i]) { + return false; + } + } + return true; + } +} From 1804fa7ee1893d71deb163fcf9451006c905e5bb Mon Sep 17 00:00:00 2001 From: liningrui Date: Wed, 13 Dec 2017 14:50:03 +0800 Subject: [PATCH 045/217] HugeGraph-984: Fixed bug that multi graphs has same name config option will be overrided Change-Id: Ia35570b52e00407de7e29e6e38aaf55a88f72c7a --- pom.xml | 2 +- .../hugegraph/config/ConfigException.java | 12 ++- .../hugegraph/config/ConfigListOption.java | 76 ++++++++++++++ .../baidu/hugegraph/config/ConfigOption.java | 99 ++++++++++++------- .../baidu/hugegraph/config/HugeConfig.java | 79 ++++++++------- .../baidu/hugegraph/config/OptionChecker.java | 6 +- 6 files changed, 192 insertions(+), 82 deletions(-) create mode 100644 src/main/java/com/baidu/hugegraph/config/ConfigListOption.java diff --git a/pom.xml b/pom.xml index 8d5b1231e5..88455a1b11 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.3.6-SNAPSHOT + 1.3.7-SNAPSHOT diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigException.java b/src/main/java/com/baidu/hugegraph/config/ConfigException.java index 9c58359daa..aab2efb394 100644 --- a/src/main/java/com/baidu/hugegraph/config/ConfigException.java +++ b/src/main/java/com/baidu/hugegraph/config/ConfigException.java @@ -27,7 +27,15 @@ public ConfigException(String message) { super(message); } - public ConfigException(String msg, Throwable cause) { - super(msg, cause); + public ConfigException(String message, Throwable cause) { + super(message, cause); + } + + public ConfigException(String message, Object... args) { + super(String.format(message, args)); + } + + public ConfigException(String message, Throwable cause, Object... args) { + super(String.format(message, args), cause); } } diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java b/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java new file mode 100644 index 0000000000..ff3a6f287c --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java @@ -0,0 +1,76 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.config; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.baidu.hugegraph.util.E; +import com.google.common.base.Predicate; + +public class ConfigListOption extends ConfigOption> { + + private final Class elemClass; + + @SuppressWarnings("unchecked") + public ConfigListOption(String name, String desc, + Predicate> func, T value) { + this(name, false, desc, func, (Class) value.getClass(), value); + } + + @SuppressWarnings("unchecked") + public ConfigListOption(String name, boolean required, String desc, + Predicate> func, Class clazz, + T... values) { + this(name, required, desc, func, clazz, Arrays.asList(values)); + } + + @SuppressWarnings("unchecked") + public ConfigListOption(String name, boolean required, String desc, + Predicate> func, Class clazz, + List values) { + super(name, required, desc, func, + (Class>) values.getClass(), values); + E.checkArgumentNotNull(clazz, "Element class can't be null"); + this.elemClass = clazz; + } + + @Override + @SuppressWarnings("unchecked") + public List convert(Object value) { + // If target data type is List, parse it as a list + String str = (String) value; + if (str.startsWith("[") && str.endsWith("]")) { + str = str.substring(1, str.length() - 1); + } else { + throw new ConfigException( + "The list type config option expected " + + "to be wrapped in [], actual '%s'", str); + } + + String[] parts = str.split(","); + List results = new ArrayList<>(parts.length); + for (String part : parts) { + results.add((T) super.convert(part.trim(), this.elemClass)); + } + return results; + } +} diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java index 377dfdcf8a..9241418d30 100644 --- a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java +++ b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java @@ -19,14 +19,16 @@ package com.baidu.hugegraph.config; +import java.lang.reflect.Method; +import java.util.List; import java.util.Set; +import org.apache.commons.configuration.PropertyConverter; import org.slf4j.Logger; import com.baidu.hugegraph.util.E; import com.baidu.hugegraph.util.Log; import com.google.common.base.Joiner; -import com.google.common.base.Preconditions; import com.google.common.base.Predicate; import com.google.common.collect.ImmutableSet; @@ -47,7 +49,8 @@ public class ConfigOption { Float.class, Double.class, String.class, - String[].class + String[].class, + List.class ); ACCEPTED_DATA_TYPES_STRING = Joiner.on(", ").join(ACCEPTED_DATA_TYPES); @@ -55,44 +58,47 @@ public class ConfigOption { private final String name; private final String desc; - // Not allowed to modify option whose `rewritable` is false - private final Boolean rewritable; + private final boolean required; private final Class dataType; - private T value; + private final T defaultValue; private final Predicate checkFunc; @SuppressWarnings("unchecked") - public ConfigOption(String name, T value, Boolean rewritable, - String desc, Predicate func) { - this(name, (Class) value.getClass(), value, rewritable, desc, func); + public ConfigOption(String name, String desc, Predicate func, T value) { + this(name, false, desc, func, (Class) value.getClass(), value); } - public ConfigOption(String name, Class dataType, T value, - Boolean rewritable, String desc, Predicate func) { - Preconditions.checkNotNull(name); - Preconditions.checkNotNull(dataType); - Preconditions.checkNotNull(rewritable); - - if (!ACCEPTED_DATA_TYPES.contains(dataType)) { - String msg = String.format("Input data type '%s' doesn't belong " + - "to acceptable type set: [%s]", - dataType, ACCEPTED_DATA_TYPES_STRING); - LOG.error(msg); - throw new IllegalArgumentException(msg); - } + @SuppressWarnings("unchecked") + public ConfigOption(String name, boolean required, String desc, + Predicate func, Class type, T value) { + E.checkNotNull(name, "name"); + E.checkNotNull(type, "dataType"); this.name = name; - this.dataType = dataType; - this.value = value; - this.rewritable = rewritable; + this.dataType = (Class) this.checkAndAssignDataType(type); + this.defaultValue = value; + this.required = required; this.desc = desc; this.checkFunc = func; if (this.checkFunc != null) { - check(this.value); + check(this.defaultValue); } } + private Class checkAndAssignDataType(Class dataType) { + for (Class clazz : ACCEPTED_DATA_TYPES) { + if (clazz.isAssignableFrom(dataType)) { + return clazz; + } + } + + String msg = String.format("Input data type '%s' doesn't belong " + + "to acceptable type set: [%s]", + dataType, ACCEPTED_DATA_TYPES_STRING); + throw new IllegalArgumentException(msg); + } + public String name() { return this.name; } @@ -105,24 +111,45 @@ public String desc() { return this.desc; } - public T value() { - return this.value; + public boolean required() { + return this.required; + } + + public T defaultValue() { + return this.defaultValue; + } + + @SuppressWarnings("unchecked") + public T convert(Object value) { + return (T) this.convert(value, this.dataType); } - public void value(T value) { - check(value); - E.checkArgument(this.rewritable, - "Not allowed to modify option '%s' " + - "which can't be rewritable", this.name); - this.value = value; + public Object convert(Object value, Class dataType) { + if (dataType.equals(String.class)) { + return value; + } + + // Use PropertyConverter method `toXXX` convert value + String methodTo = "to" + dataType.getSimpleName(); + try { + Method method = PropertyConverter.class.getMethod( + methodTo, Object.class); + return method.invoke(null, value); + } catch (ReflectiveOperationException e) { + LOG.error("Invalid type of value '{}' for option '{}'", + value, this.name, e); + throw new ConfigException( + "Invalid type of value '%s' for option '%s', " + + "expect '%s' type", + value, this.name, dataType.getSimpleName()); + } } public void check(Object value) { E.checkNotNull(value, "value", this.name); E.checkArgument(this.dataType.isInstance(value), - "Invalid class for option '%s', " + - "expected '%s' but given '%s'", - this.name, this.dataType, value.getClass()); + "Invalid type of value '%s' for option '%s'", + value, this.name); @SuppressWarnings("unchecked") T result = (T) value; E.checkArgument(this.checkFunc.apply(result), diff --git a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java index f3b146682f..9020e47827 100644 --- a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java +++ b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java @@ -22,8 +22,8 @@ import java.io.File; import java.io.InputStream; import java.io.InputStreamReader; -import java.lang.reflect.Method; import java.util.Iterator; +import java.util.List; import org.apache.commons.configuration.AbstractFileConfiguration; import org.apache.commons.configuration.Configuration; @@ -52,21 +52,23 @@ public HugeConfig(Configuration config) { Iterator keys = config.getKeys(); while (keys.hasNext()) { String key = keys.next(); - this.setProperty(key.replace("..", "."), config.getProperty(key)); + if (key.contains("..")) { + key = key.replace("..", "."); + } + this.addProperty(key, config.getProperty(key)); } - - updateDefaultOption(); + this.checkRequiredOptions(); } public HugeConfig(String configFile) throws ConfigurationException { super(loadConfigFile(configFile)); - updateDefaultOption(); + this.checkRequiredOptions(); } public HugeConfig(InputStream is) throws ConfigurationException { E.checkNotNull(is, "config input stream"); this.load(new InputStreamReader(is)); - updateDefaultOption(); + this.checkRequiredOptions(); } private static File loadConfigFile(String fileName) { @@ -81,45 +83,42 @@ private static File loadConfigFile(String fileName) { return file; } - @SuppressWarnings({ "unchecked", "rawtypes" }) - public void updateDefaultOption() { - try { - Iterator keys = this.getKeys(); - while (keys.hasNext()) { - String key = keys.next(); - - if (!OptionSpace.containKey(key)) { - LOG.warn("The config option '{}' is redundant, " + - "please ensure it has been registered", key); - continue; - } - ConfigOption option = OptionSpace.get(key); - Class dataType = option.dataType(); - String methodGetter = "get" + dataType.getSimpleName(); - Method method = this.getClass().getMethod(methodGetter, - String.class, - dataType); - option.value(method.invoke(this, key, option.value())); - } - } catch (Exception e) { - LOG.error("Failed to update options value: {}", e.getMessage()); - throw new ConfigException("Failed to update options value"); - } - } - + @SuppressWarnings("unchecked") public T get(ConfigOption option) { - return option.value(); + Object value = this.getProperty(option.name()); + return value != null ? (T) value : option.defaultValue(); } @Override public void addProperty(String key, Object value) { - if (value instanceof String) { - String val = (String) value; - if (val.startsWith("[") && val.endsWith("]")) { - val = val.substring(1, val.length() - 1); - } - value = val; + if (!OptionSpace.containKey(key)) { + LOG.warn("The config option '{}' is redundant, " + + "please ensure it has been registered", key); + } else { + // The input value is String(parsed by PropertiesConfiguration) + value = this.validateOption(key, value); } - super.addProperty(key, value); + super.addPropertyDirect(key, value); + } + + private Object validateOption(String key, Object value) { + assert value instanceof String; + + ConfigOption option = OptionSpace.get(key); + Class dataType = option.dataType(); + + if (List.class.isAssignableFrom(dataType)) { + E.checkState(option instanceof ConfigListOption, + "List option must be registered with " + + "class ConfigListOption"); + } + + value = option.convert(value); + option.check(value); + return value; + } + + private void checkRequiredOptions() { + // TODO: Check required options must be contained in this map } } diff --git a/src/main/java/com/baidu/hugegraph/config/OptionChecker.java b/src/main/java/com/baidu/hugegraph/config/OptionChecker.java index 44c51a3fee..d4b754c9b6 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionChecker.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionChecker.java @@ -20,7 +20,6 @@ package com.baidu.hugegraph.config; import java.lang.reflect.Array; -import java.util.Collection; import javax.annotation.Nullable; @@ -30,7 +29,7 @@ public class OptionChecker { - public static final Predicate disallowEmpty(Class clazz) { + public static final Predicate disallowEmpty() { return new Predicate() { @Override public boolean apply(@Nullable O o) { @@ -43,7 +42,8 @@ public boolean apply(@Nullable O o) { if (o.getClass().isArray() && (Array.getLength(o) == 0)) { return false; } - if (o instanceof Collection && ((Collection) o).isEmpty()) { + if (o instanceof Iterable && + !((Iterable) o).iterator().hasNext()) { return false; } return true; From 65032356e9df32cb1db0bcf7ab7ee9d8db06ff32 Mon Sep 17 00:00:00 2001 From: liningrui Date: Fri, 15 Dec 2017 16:22:03 +0800 Subject: [PATCH 046/217] HugeGraph-986: Let prefixOf support generic type Change-Id: I7f02d3c3556ae6ae9f63888af7f33fe52e505862 --- pom.xml | 2 +- src/main/java/com/baidu/hugegraph/util/CollectionUtil.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 88455a1b11..6dd9134625 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.3.7-SNAPSHOT + 1.3.8-SNAPSHOT diff --git a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java index 9aa46466b6..09d9f0a865 100644 --- a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java @@ -47,7 +47,7 @@ public static List toList(Object array) { return list; } - public static boolean prefixOf(List prefix, List all) { + public static boolean prefixOf(List prefix, List all) { E.checkNotNull(prefix, "prefix"); E.checkNotNull(all, "all"); @@ -56,8 +56,8 @@ public static boolean prefixOf(List prefix, List all) { } for (int i = 0; i < prefix.size(); i++) { - String first = prefix.get(i); - String second = all.get(i); + T first = prefix.get(i); + T second = all.get(i); if (first == second) { continue; } From 7789bc87d80363764d583da88ec710eb9aadedaa Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Tue, 19 Dec 2017 19:13:11 +0800 Subject: [PATCH 047/217] HugeGraph-989: add toHex()/fromHex() to class Bytes Change-Id: I3ef03ea58cdf2fe379e1dbf5b3e0877b4c379745 --- BCLOUD | 2 +- pom.xml | 4 ++-- src/main/java/com/baidu/hugegraph/util/Bytes.java | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/BCLOUD b/BCLOUD index 2b0d256133..343a7d7728 100644 --- a/BCLOUD +++ b/BCLOUD @@ -1 +1 @@ -BUILD_SUBMITTER -x -e CENTOS6U3 -m baidu/xbu-data/hugegraph-common -c "export MAVEN_HOME=/home/scmtools/buildkit/maven/apache-maven-3.3.9/ && export JAVA_HOME=/home/scmtools/buildkit/java/jdk1.8.0_25/ && export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH && cd baidu/xbu-data/hugegraph-common && sh build.sh" -u ./ \ No newline at end of file +BUILD_SUBMITTER -x -e CENTOS6U3 -m baidu/xbu-data/hugegraph-common -c "export MAVEN_HOME=/home/scmtools/buildkit/maven/apache-maven-3.3.9/ && export JAVA_HOME=/home/scmtools/buildkit/java/jdk1.8.0_25/ && export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH && cd baidu/xbu-data/hugegraph-common && sh build.sh && mkdir output && cp BCLOUD ./output/" -u ./ \ No newline at end of file diff --git a/pom.xml b/pom.xml index 6dd9134625..03174f7603 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.3.8-SNAPSHOT + 1.3.9-SNAPSHOT @@ -154,7 +154,7 @@ - 1.3.4.0 + 1.3.9.0 diff --git a/src/main/java/com/baidu/hugegraph/util/Bytes.java b/src/main/java/com/baidu/hugegraph/util/Bytes.java index 75f8dbb50e..e2b7e82047 100644 --- a/src/main/java/com/baidu/hugegraph/util/Bytes.java +++ b/src/main/java/com/baidu/hugegraph/util/Bytes.java @@ -19,6 +19,9 @@ package com.baidu.hugegraph.util; +import org.apache.commons.codec.DecoderException; +import org.apache.commons.codec.binary.Hex; + /** * TODO: extends com.google.common.primitives.Bytes */ @@ -35,4 +38,16 @@ public static boolean prefixWith(byte[] bytes, byte[] prefix) { } return true; } + + public static String toHex(byte[] bytes) { + return new String(Hex.encodeHex(bytes)); + } + + public static byte[] fromHex(String hex) { + try { + return Hex.decodeHex(hex.toCharArray()); + } catch (DecoderException e) { + throw new RuntimeException("Failed to decode hex: " + hex, e); + } + } } From 8a44989e32959c0a8b607c3a5524d4279e0e3381 Mon Sep 17 00:00:00 2001 From: liningrui Date: Tue, 19 Dec 2017 20:19:32 +0800 Subject: [PATCH 048/217] HugeGraph-990: Fixed bug that compile error when building project Change-Id: I398165b3b022e55290781b366e2d008f516dfb46 --- BCLOUD | 2 +- build.sh | 8 +++----- pom.xml | 2 ++ 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/BCLOUD b/BCLOUD index 343a7d7728..df3f342be8 100644 --- a/BCLOUD +++ b/BCLOUD @@ -1 +1 @@ -BUILD_SUBMITTER -x -e CENTOS6U3 -m baidu/xbu-data/hugegraph-common -c "export MAVEN_HOME=/home/scmtools/buildkit/maven/apache-maven-3.3.9/ && export JAVA_HOME=/home/scmtools/buildkit/java/jdk1.8.0_25/ && export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH && cd baidu/xbu-data/hugegraph-common && sh build.sh && mkdir output && cp BCLOUD ./output/" -u ./ \ No newline at end of file +BUILD_SUBMITTER -x -u ./ -e CENTOS6U3 -m baidu/xbu-data/hugegraph-common -c "export MAVEN_HOME=/home/scmtools/buildkit/maven/apache-maven-3.3.9/ && export JAVA_HOME=/home/scmtools/buildkit/java/jdk1.8.0_25/ && export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH && cd baidu/xbu-data/hugegraph-common && mkdir output && sh build.sh" -o output \ No newline at end of file diff --git a/build.sh b/build.sh index 2beda8cbd1..feefefa659 100644 --- a/build.sh +++ b/build.sh @@ -1,9 +1,7 @@ #!/usr/bin/env bash -HUGEGRAPH_COMMON_RELEASE_PATH="${PWD}/output/" - -export MAVEN_HOME="/home/scmtools/buildkit/maven/apache-maven-3.3.9/" -export JAVA_HOME="/home/scmtools/buildkit/java/jdk1.8.0_25/" -export PATH="$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH" +export MAVEN_HOME=/home/scmtools/buildkit/maven/apache-maven-3.3.9/ +export JAVA_HOME=/home/scmtools/buildkit/java/jdk1.8.0_25/ +export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH mvn clean compile diff --git a/pom.xml b/pom.xml index 03174f7603..8e464fe099 100644 --- a/pom.xml +++ b/pom.xml @@ -16,6 +16,7 @@ + UTF-8 ${project.basedir}/.. hugegraph-bin 1.8 @@ -141,6 +142,7 @@ org.apache.maven.plugins maven-jar-plugin + 2.6 true From 24ff82017495227dc8d04fbeb82ca500900930d4 Mon Sep 17 00:00:00 2001 From: liningrui Date: Fri, 22 Dec 2017 14:38:15 +0800 Subject: [PATCH 049/217] HugeGraph-994: Fixed bug that some key has more than one value will throw an assert exception Change-Id: I72301a594afe311a6d744514fb8791ec6d6fc954 --- src/main/java/com/baidu/hugegraph/config/HugeConfig.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java index 9020e47827..211c54945e 100644 --- a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java +++ b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java @@ -102,7 +102,8 @@ public void addProperty(String key, Object value) { } private Object validateOption(String key, Object value) { - assert value instanceof String; + E.checkArgument(value instanceof String, + "Invalid value for key '%s'", key); ConfigOption option = OptionSpace.get(key); Class dataType = option.dataType(); From fe8b51d072bac967514bf8b357cf40181b9cf793 Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Thu, 7 Dec 2017 21:59:29 +0800 Subject: [PATCH 050/217] HugeGraph-976: add filter-iterator Change-Id: I8291be7576b0fd1536cc5425c09e26dfda5c4ff0 --- pom.xml | 2 +- .../com/baidu/hugegraph/event/EventHub.java | 2 +- .../ExtendableIterator.java | 4 +- .../hugegraph/iterator/FilterIterator.java | 48 +++++++++++++ .../iterator/FlatMapperFilterIterator.java | 52 ++++++++++++++ .../iterator/FlatMapperIterator.java | 71 +++++++++++++++++++ .../hugegraph/iterator/IterableIterator.java | 52 ++++++++++++++ .../hugegraph/iterator/MapperIterator.java | 48 +++++++++++++ .../hugegraph/iterator/WrappedIterator.java | 55 ++++++++++++++ .../baidu/hugegraph/util/ReflectionUtil.java | 2 +- 10 files changed, 331 insertions(+), 5 deletions(-) rename src/main/java/com/baidu/hugegraph/{type => iterator}/ExtendableIterator.java (95%) create mode 100644 src/main/java/com/baidu/hugegraph/iterator/FilterIterator.java create mode 100644 src/main/java/com/baidu/hugegraph/iterator/FlatMapperFilterIterator.java create mode 100644 src/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java create mode 100644 src/main/java/com/baidu/hugegraph/iterator/IterableIterator.java create mode 100644 src/main/java/com/baidu/hugegraph/iterator/MapperIterator.java create mode 100644 src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java diff --git a/pom.xml b/pom.xml index 8e464fe099..eb871e12d2 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.3.9-SNAPSHOT + 1.3.10-SNAPSHOT diff --git a/src/main/java/com/baidu/hugegraph/event/EventHub.java b/src/main/java/com/baidu/hugegraph/event/EventHub.java index 23fae07005..a11e2abc78 100644 --- a/src/main/java/com/baidu/hugegraph/event/EventHub.java +++ b/src/main/java/com/baidu/hugegraph/event/EventHub.java @@ -32,7 +32,7 @@ import org.slf4j.Logger; -import com.baidu.hugegraph.type.ExtendableIterator; +import com.baidu.hugegraph.iterator.ExtendableIterator; import com.baidu.hugegraph.util.E; import com.baidu.hugegraph.util.Log; import com.google.common.collect.ImmutableList; diff --git a/src/main/java/com/baidu/hugegraph/type/ExtendableIterator.java b/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java similarity index 95% rename from src/main/java/com/baidu/hugegraph/type/ExtendableIterator.java rename to src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java index 5966d9db1d..ec7d913ba0 100644 --- a/src/main/java/com/baidu/hugegraph/type/ExtendableIterator.java +++ b/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.type; +package com.baidu.hugegraph.iterator; import java.util.Deque; import java.util.Iterator; @@ -25,7 +25,7 @@ public class ExtendableIterator implements Iterator { - private Deque> itors; + private final Deque> itors; public ExtendableIterator() { this.itors = new ConcurrentLinkedDeque>(); diff --git a/src/main/java/com/baidu/hugegraph/iterator/FilterIterator.java b/src/main/java/com/baidu/hugegraph/iterator/FilterIterator.java new file mode 100644 index 0000000000..841840b08f --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/iterator/FilterIterator.java @@ -0,0 +1,48 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.iterator; + +import java.util.Iterator; +import java.util.function.Function; + +public class FilterIterator extends WrappedIterator { + + private final Iterator originIterator; + private final Function filterCallback; + + public FilterIterator(Iterator origin, Function filter) { + this.originIterator = origin; + this.filterCallback = filter; + } + + @Override + protected final boolean fetch() { + while (this.originIterator.hasNext()) { + T next = this.originIterator.next(); + // Do filter + if (next != null && this.filterCallback.apply(next)) { + assert this.current == null; + this.current = next; + return true; + } + } + return false; + } +} diff --git a/src/main/java/com/baidu/hugegraph/iterator/FlatMapperFilterIterator.java b/src/main/java/com/baidu/hugegraph/iterator/FlatMapperFilterIterator.java new file mode 100644 index 0000000000..98b974c34a --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/iterator/FlatMapperFilterIterator.java @@ -0,0 +1,52 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.iterator; + +import java.util.Iterator; +import java.util.function.Function; + +import com.baidu.hugegraph.util.E; + +public class FlatMapperFilterIterator extends FlatMapperIterator { + + private final Function filterCallback; + + public FlatMapperFilterIterator(Iterator origin, + Function> mapper, + Function filter) { + super(origin, mapper); + this.filterCallback = filter; + } + + @Override + protected final boolean fetchMapped() { + E.checkNotNull(this.results, "mapper results"); + while (this.results.hasNext()) { + R result = this.results.next(); + if (result != null && this.filterCallback.apply(result)) { + assert this.current == null; + this.current = result; + return true; + } + } + this.results = null; + return false; + } +} diff --git a/src/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java b/src/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java new file mode 100644 index 0000000000..a630c481f7 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java @@ -0,0 +1,71 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.iterator; + +import java.util.Iterator; +import java.util.function.Function; + +import com.baidu.hugegraph.util.E; + +public class FlatMapperIterator extends WrappedIterator { + + private final Iterator originIterator; + private final Function> mapperCallback; + + protected Iterator results; + + public FlatMapperIterator(Iterator origin, + Function> mapper) { + this.originIterator = origin; + this.mapperCallback = mapper; + this.results = null; + } + + @Override + protected final boolean fetch() { + if (this.results != null && this.fetchMapped()) { + return true; + } + + while (this.originIterator.hasNext()) { + T next = this.originIterator.next(); + assert this.results == null; + this.results = this.mapperCallback.apply(next); + if (this.results != null && this.fetchMapped()) { + return true; + } + } + return false; + } + + protected boolean fetchMapped() { + E.checkNotNull(this.results, "mapper results"); + while (this.results.hasNext()) { + R result = this.results.next(); + if (result != null) { + assert this.current == null; + this.current = result; + return true; + } + } + this.results = null; + return false; + } +} diff --git a/src/main/java/com/baidu/hugegraph/iterator/IterableIterator.java b/src/main/java/com/baidu/hugegraph/iterator/IterableIterator.java new file mode 100644 index 0000000000..eb2a966377 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/iterator/IterableIterator.java @@ -0,0 +1,52 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.iterator; + +import java.util.Iterator; + +public class IterableIterator implements Iterator { + + private final Iterable iterable; + private final Iterator iterator; + + public IterableIterator(Iterable iterable) { + this.iterable = iterable; + this.iterator = iterable.iterator(); + } + + @Override + public boolean hasNext() { + return this.iterator.hasNext(); + } + + @Override + public T next() { + return this.iterator.next(); + } + + @Override + public void remove() { + this.iterator.remove(); + } + + public Iterable iterable() { + return iterable; + } +} diff --git a/src/main/java/com/baidu/hugegraph/iterator/MapperIterator.java b/src/main/java/com/baidu/hugegraph/iterator/MapperIterator.java new file mode 100644 index 0000000000..bd22db053c --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/iterator/MapperIterator.java @@ -0,0 +1,48 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.iterator; + +import java.util.Iterator; +import java.util.function.Function; + +public class MapperIterator extends WrappedIterator { + + private final Iterator originIterator; + private final Function mapperCallback; + + public MapperIterator(Iterator origin, Function mapper) { + this.originIterator = origin; + this.mapperCallback = mapper; + } + + @Override + protected final boolean fetch() { + while (this.originIterator.hasNext()) { + T next = this.originIterator.next(); + R result = this.mapperCallback.apply(next); + if (result != null) { + assert this.current == null; + this.current = result; + return true; + } + } + return false; + } +} diff --git a/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java b/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java new file mode 100644 index 0000000000..f4887f1d88 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java @@ -0,0 +1,55 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.iterator; + +import java.util.Iterator; +import java.util.NoSuchElementException; + +public abstract class WrappedIterator implements Iterator { + + protected R current; + + public WrappedIterator() { + this.current = null; + } + + @Override + public boolean hasNext() { + if (this.current != null) { + return true; + } + return this.fetch(); + } + + @Override + public R next() { + if (this.current == null) { + this.fetch(); + } + if (this.current == null) { + throw new NoSuchElementException(); + } + R current = this.current; + this.current = null; + return current; + } + + protected abstract boolean fetch(); +} diff --git a/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java b/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java index 0bbb08f901..e5aa3ec7ba 100644 --- a/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java @@ -26,7 +26,7 @@ import java.util.LinkedList; import java.util.List; -import com.baidu.hugegraph.type.ExtendableIterator; +import com.baidu.hugegraph.iterator.ExtendableIterator; import com.google.common.collect.Lists; import com.google.common.reflect.ClassPath; import com.google.common.reflect.ClassPath.ClassInfo; From 9f994b33de7bfa31872ba2cf9b583df00539e458 Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Wed, 27 Dec 2017 11:35:11 +0800 Subject: [PATCH 051/217] HugeGraph-1000: allow non-check of config options Change-Id: Ida0a2d88818f0ca53e9ddf886cff88e7ceb52ed8 --- pom.xml | 4 ++-- .../baidu/hugegraph/config/ConfigOption.java | 20 +++++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index eb871e12d2..c80f06c8ae 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.3.10-SNAPSHOT + 1.3.11-SNAPSHOT @@ -156,7 +156,7 @@ - 1.3.9.0 + 1.3.11.0 diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java index 9241418d30..2bc993fe79 100644 --- a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java +++ b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java @@ -63,6 +63,10 @@ public class ConfigOption { private final T defaultValue; private final Predicate checkFunc; + public ConfigOption(String name, String desc, T value) { + this(name, desc, null, value); + } + @SuppressWarnings("unchecked") public ConfigOption(String name, String desc, Predicate func, T value) { this(name, false, desc, func, (Class) value.getClass(), value); @@ -81,9 +85,7 @@ public ConfigOption(String name, boolean required, String desc, this.desc = desc; this.checkFunc = func; - if (this.checkFunc != null) { - check(this.defaultValue); - } + this.check(this.defaultValue); } private Class checkAndAssignDataType(Class dataType) { @@ -150,10 +152,12 @@ public void check(Object value) { E.checkArgument(this.dataType.isInstance(value), "Invalid type of value '%s' for option '%s'", value, this.name); - @SuppressWarnings("unchecked") - T result = (T) value; - E.checkArgument(this.checkFunc.apply(result), - "Invalid option value for '%s': %s", - this.name, value); + if (this.checkFunc != null) { + @SuppressWarnings("unchecked") + T result = (T) value; + E.checkArgument(this.checkFunc.apply(result), + "Invalid option value for '%s': %s", + this.name, value); + } } } From 8219a10e74f063e2fb0e8bb96e52910776a3bae0 Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Thu, 18 Jan 2018 15:36:24 +0800 Subject: [PATCH 052/217] HugeGraph-1075: add allowValues() to OptionChecker Change-Id: I7752b039c3d8332550e4daf9852bdf7f7610d161 --- pom.xml | 4 +- .../baidu/hugegraph/config/OptionChecker.java | 55 +++++++++++++------ .../java/com/baidu/hugegraph/util/Bytes.java | 11 ++++ 3 files changed, 50 insertions(+), 20 deletions(-) diff --git a/pom.xml b/pom.xml index c80f06c8ae..875b870bfa 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.3.11-SNAPSHOT + 1.3.12-SNAPSHOT @@ -156,7 +156,7 @@ - 1.3.11.0 + 1.3.12.0 diff --git a/src/main/java/com/baidu/hugegraph/config/OptionChecker.java b/src/main/java/com/baidu/hugegraph/config/OptionChecker.java index d4b754c9b6..ff70581a8d 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionChecker.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionChecker.java @@ -20,6 +20,7 @@ package com.baidu.hugegraph.config; import java.lang.reflect.Array; +import java.util.Arrays; import javax.annotation.Nullable; @@ -27,9 +28,9 @@ import com.google.common.base.Predicate; -public class OptionChecker { +public final class OptionChecker { - public static final Predicate disallowEmpty() { + public static Predicate disallowEmpty() { return new Predicate() { @Override public boolean apply(@Nullable O o) { @@ -51,38 +52,56 @@ public boolean apply(@Nullable O o) { }; } - public static final Predicate positiveInt() { - return new Predicate() { + @SuppressWarnings("unchecked") + public static Predicate allowValues(O... values) { + return new Predicate() { @Override - public boolean apply(@Nullable Integer num) { - return num != null && num > 0; + public boolean apply(@Nullable O o) { + return o != null && Arrays.asList(values).contains(o); } }; } - public static final Predicate nonNegativeInt() { - return new Predicate() { + public static Predicate positiveInt() { + return new Predicate() { @Override - public boolean apply(@Nullable Integer num) { - return num != null && num >= 0; + public boolean apply(@Nullable N number) { + return number != null && number.longValue() > 0; } }; } - public static final Predicate positiveLong() { - return new Predicate() { + public static Predicate nonNegativeInt() { + return new Predicate() { @Override - public boolean apply(@Nullable Long num) { - return num != null && num > 0; + public boolean apply(@Nullable N number) { + return number != null && number.longValue() >= 0; } }; } - public static final Predicate rangeInt(int min, int max) { - return new Predicate() { + public static Predicate rangeInt(N min, N max) { + return new Predicate() { @Override - public boolean apply(@Nullable Integer num) { - return num != null && num >= min && num <= max; + public boolean apply(@Nullable N number) { + if (number == null) { + return false; + } + long value = number.longValue(); + return value >= min.longValue() && value <= max.longValue(); + } + }; + } + + public static Predicate rangeDouble(N min, N max) { + return new Predicate() { + @Override + public boolean apply(@Nullable N number) { + if (number == null) { + return false; + } + double value = number.doubleValue(); + return value >= min.doubleValue() && value <= max.doubleValue(); } }; } diff --git a/src/main/java/com/baidu/hugegraph/util/Bytes.java b/src/main/java/com/baidu/hugegraph/util/Bytes.java index e2b7e82047..92cf221bd0 100644 --- a/src/main/java/com/baidu/hugegraph/util/Bytes.java +++ b/src/main/java/com/baidu/hugegraph/util/Bytes.java @@ -19,6 +19,8 @@ package com.baidu.hugegraph.util; +import java.util.Arrays; + import org.apache.commons.codec.DecoderException; import org.apache.commons.codec.binary.Hex; @@ -27,6 +29,11 @@ */ public final class Bytes { + public static final long BASE = 1024L; + public static final long KB = BASE; + public static final long MB = KB * BASE; + public static final long GB = MB * BASE; + public static boolean prefixWith(byte[] bytes, byte[] prefix) { if (bytes.length < prefix.length) { return false; @@ -39,6 +46,10 @@ public static boolean prefixWith(byte[] bytes, byte[] prefix) { return true; } + public static boolean equals(byte[] bytes1, byte[] bytes2) { + return Arrays.equals(bytes1, bytes2); + } + public static String toHex(byte[] bytes) { return new String(Hex.encodeHex(bytes)); } From 2ae8e1571be7ef5c665d43c571ad0b2ca6d9a826 Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Thu, 1 Feb 2018 17:07:17 +0800 Subject: [PATCH 053/217] HugeGraph-1097: fix missing check for duplicated options Change-Id: I542998a0024d83706b0d8c485b4ec8ef40fd310f --- pom.xml | 2 +- .../baidu/hugegraph/config/HugeConfig.java | 31 ++++++++----------- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/pom.xml b/pom.xml index 875b870bfa..c26d316433 100644 --- a/pom.xml +++ b/pom.xml @@ -156,7 +156,7 @@ - 1.3.12.0 + 1.3.12.1 diff --git a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java index 211c54945e..4634cdbc3f 100644 --- a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java +++ b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java @@ -20,8 +20,6 @@ package com.baidu.hugegraph.config; import java.io.File; -import java.io.InputStream; -import java.io.InputStreamReader; import java.util.Iterator; import java.util.List; @@ -61,26 +59,23 @@ public HugeConfig(Configuration config) { } public HugeConfig(String configFile) throws ConfigurationException { - super(loadConfigFile(configFile)); - this.checkRequiredOptions(); + this(loadConfigFile(configFile)); } - public HugeConfig(InputStream is) throws ConfigurationException { - E.checkNotNull(is, "config input stream"); - this.load(new InputStreamReader(is)); - this.checkRequiredOptions(); - } + private static PropertiesConfiguration loadConfigFile(String path) { + E.checkNotNull(path, "config path"); + E.checkArgument(!path.isEmpty(), + "The config path can't be empty"); - private static File loadConfigFile(String fileName) { - E.checkNotNull(fileName, "config file"); - E.checkArgument(!fileName.isEmpty(), - "The config file can't be empty"); - - File file = new File(fileName); + File file = new File(path); E.checkArgument(file.exists() && file.isFile() && file.canRead(), - "Need to specify a readable config file, but got: %s", + "Need to specify a readable config, but got: %s", file.toString()); - return file; + try { + return new PropertiesConfiguration(file); + } catch (ConfigurationException e) { + throw new ConfigException("Unable to load config: %s", e, path); + } } @SuppressWarnings("unchecked") @@ -103,7 +98,7 @@ public void addProperty(String key, Object value) { private Object validateOption(String key, Object value) { E.checkArgument(value instanceof String, - "Invalid value for key '%s'", key); + "Invalid value for key '%s': %s", key, value); ConfigOption option = OptionSpace.get(key); Class dataType = option.dataType(); From 749a2d9d1fc715fa57b9857c89c37e5bb79dc2ad Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Fri, 2 Feb 2018 17:30:02 +0800 Subject: [PATCH 054/217] HugeGraph-1097: fix check error when HugeConfig(Configuration config) with list options Change-Id: I7a3d0c6a017513368717bed4b32f4501bc2a9049 --- pom.xml | 4 ++-- src/main/java/com/baidu/hugegraph/config/HugeConfig.java | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index c26d316433..af26cc83f0 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.3.12-SNAPSHOT + 1.3.13-SNAPSHOT @@ -156,7 +156,7 @@ - 1.3.12.1 + 1.3.13.0 diff --git a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java index 4634cdbc3f..ec5be0d07e 100644 --- a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java +++ b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java @@ -58,7 +58,7 @@ public HugeConfig(Configuration config) { this.checkRequiredOptions(); } - public HugeConfig(String configFile) throws ConfigurationException { + public HugeConfig(String configFile) { this(loadConfigFile(configFile)); } @@ -71,11 +71,15 @@ private static PropertiesConfiguration loadConfigFile(String path) { E.checkArgument(file.exists() && file.isFile() && file.canRead(), "Need to specify a readable config, but got: %s", file.toString()); + + PropertiesConfiguration config = new PropertiesConfiguration(); + config.setDelimiterParsingDisabled(true); try { - return new PropertiesConfiguration(file); + config.load(file); } catch (ConfigurationException e) { throw new ConfigException("Unable to load config: %s", e, path); } + return config; } @SuppressWarnings("unchecked") From fde9c72a0fc3f567272438e976de7271c71f27f1 Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Tue, 6 Feb 2018 19:59:00 +0800 Subject: [PATCH 055/217] HugeGraph-1110: let iterators implement AutoCloseable and Metadatable Change-Id: I5c5f0fe6cafd0dfdc33404613a071927332c6211 --- pom.xml | 4 +- .../iterator/ExtendableIterator.java | 55 ++++++++++++++++--- .../hugegraph/iterator/FilterIterator.java | 5 ++ .../iterator/FlatMapperIterator.java | 5 ++ .../hugegraph/iterator/MapperIterator.java | 5 ++ .../baidu/hugegraph/iterator/Metadatable.java | 25 +++++++++ .../hugegraph/iterator/WrappedIterator.java | 22 +++++++- .../java/com/baidu/hugegraph/util/Bytes.java | 10 ++++ 8 files changed, 121 insertions(+), 10 deletions(-) create mode 100644 src/main/java/com/baidu/hugegraph/iterator/Metadatable.java diff --git a/pom.xml b/pom.xml index af26cc83f0..ba974e441f 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.3.13-SNAPSHOT + 1.3.14-SNAPSHOT @@ -156,7 +156,7 @@ - 1.3.13.0 + 1.3.14.0 diff --git a/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java b/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java index ec7d913ba0..9f381fa5a3 100644 --- a/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java +++ b/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java @@ -19,16 +19,22 @@ package com.baidu.hugegraph.iterator; +import java.util.ArrayList; import java.util.Deque; import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; import java.util.concurrent.ConcurrentLinkedDeque; -public class ExtendableIterator implements Iterator { +public class ExtendableIterator + implements Iterator, AutoCloseable, Metadatable { private final Deque> itors; + private final List> removedItors; public ExtendableIterator() { this.itors = new ConcurrentLinkedDeque>(); + this.removedItors = new ArrayList<>(); } public ExtendableIterator(Iterator itor) { @@ -44,17 +50,29 @@ public ExtendableIterator(Iterator itor1, Iterator itor2) { @Override public boolean hasNext() { - // this is true since we never hold empty iterators - return !this.itors.isEmpty() && this.itors.peekLast().hasNext(); + if (this.itors.isEmpty()) { + return false; + } + + Iterator first = null; + while ((first = this.itors.peekFirst()) != null && !first.hasNext()) { + if (first == this.itors.peekLast() && this.itors.size() == 1) { + // The last one + return false; + } + this.removedItors.add(this.itors.removeFirst()); + } + + assert first != null && first.hasNext(); + return true; } @Override public T next() { - T next = this.itors.peekFirst().next(); - if (!this.itors.peekFirst().hasNext()) { - this.itors.removeFirst(); + if (this.itors.isEmpty()) { + throw new NoSuchElementException(); } - return next; + return this.itors.peekFirst().next(); } public ExtendableIterator extend(Iterator itor) { @@ -63,4 +81,27 @@ public ExtendableIterator extend(Iterator itor) { } return this; } + + @Override + public void close() throws Exception { + for (Iterator itor : this.removedItors) { + if (itor instanceof AutoCloseable) { + ((AutoCloseable) itor).close(); + } + } + for (Iterator itor : this.itors) { + if (itor instanceof AutoCloseable) { + ((AutoCloseable) itor).close(); + } + } + } + + @Override + public Object metadata(String meta, Object... args) { + Iterator iterator = this.itors.peekLast(); + if (iterator instanceof Metadatable) { + return ((Metadatable) iterator).metadata(meta, args); + } + throw new IllegalStateException("Original iterator is not Metadatable"); + } } diff --git a/src/main/java/com/baidu/hugegraph/iterator/FilterIterator.java b/src/main/java/com/baidu/hugegraph/iterator/FilterIterator.java index 841840b08f..e3247ffcb0 100644 --- a/src/main/java/com/baidu/hugegraph/iterator/FilterIterator.java +++ b/src/main/java/com/baidu/hugegraph/iterator/FilterIterator.java @@ -32,6 +32,11 @@ public FilterIterator(Iterator origin, Function filter) { this.filterCallback = filter; } + @Override + protected Iterator originIterator() { + return this.originIterator; + } + @Override protected final boolean fetch() { while (this.originIterator.hasNext()) { diff --git a/src/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java b/src/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java index a630c481f7..2d5175619d 100644 --- a/src/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java +++ b/src/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java @@ -38,6 +38,11 @@ public FlatMapperIterator(Iterator origin, this.results = null; } + @Override + protected Iterator originIterator() { + return this.originIterator; + } + @Override protected final boolean fetch() { if (this.results != null && this.fetchMapped()) { diff --git a/src/main/java/com/baidu/hugegraph/iterator/MapperIterator.java b/src/main/java/com/baidu/hugegraph/iterator/MapperIterator.java index bd22db053c..9c3eca00e1 100644 --- a/src/main/java/com/baidu/hugegraph/iterator/MapperIterator.java +++ b/src/main/java/com/baidu/hugegraph/iterator/MapperIterator.java @@ -32,6 +32,11 @@ public MapperIterator(Iterator origin, Function mapper) { this.mapperCallback = mapper; } + @Override + protected Iterator originIterator() { + return this.originIterator; + } + @Override protected final boolean fetch() { while (this.originIterator.hasNext()) { diff --git a/src/main/java/com/baidu/hugegraph/iterator/Metadatable.java b/src/main/java/com/baidu/hugegraph/iterator/Metadatable.java new file mode 100644 index 0000000000..4b6d2071c8 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/iterator/Metadatable.java @@ -0,0 +1,25 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.iterator; + +public interface Metadatable { + + public Object metadata(String meta, Object... args); +} diff --git a/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java b/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java index f4887f1d88..8d559c2e0a 100644 --- a/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java +++ b/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java @@ -22,7 +22,8 @@ import java.util.Iterator; import java.util.NoSuchElementException; -public abstract class WrappedIterator implements Iterator { +public abstract class WrappedIterator + implements Iterator, AutoCloseable, Metadatable { protected R current; @@ -51,5 +52,24 @@ public R next() { return current; } + @Override + public void close() throws Exception { + Iterator iterator = this.originIterator(); + if (iterator instanceof AutoCloseable) { + ((AutoCloseable) iterator).close(); + } + } + + @Override + public Object metadata(String meta, Object... args) { + Iterator iterator = this.originIterator(); + if (iterator instanceof Metadatable) { + return ((Metadatable) iterator).metadata(meta, args); + } + throw new IllegalStateException("Original iterator is not Metadatable"); + } + + protected abstract Iterator originIterator(); + protected abstract boolean fetch(); } diff --git a/src/main/java/com/baidu/hugegraph/util/Bytes.java b/src/main/java/com/baidu/hugegraph/util/Bytes.java index 92cf221bd0..8a2a72ef08 100644 --- a/src/main/java/com/baidu/hugegraph/util/Bytes.java +++ b/src/main/java/com/baidu/hugegraph/util/Bytes.java @@ -20,10 +20,13 @@ package com.baidu.hugegraph.util; import java.util.Arrays; +import java.util.Comparator; import org.apache.commons.codec.DecoderException; import org.apache.commons.codec.binary.Hex; +import com.google.common.primitives.UnsignedBytes; + /** * TODO: extends com.google.common.primitives.Bytes */ @@ -34,6 +37,13 @@ public final class Bytes { public static final long MB = KB * BASE; public static final long GB = MB * BASE; + private static final Comparator CMP = + UnsignedBytes.lexicographicalComparator(); + + public static int compare(byte[] bytes1, byte[] bytes2) { + return CMP.compare(bytes1, bytes2); + } + public static boolean prefixWith(byte[] bytes, byte[] prefix) { if (bytes.length < prefix.length) { return false; From 8d8333980c29636b0f5ac77d41a560b3b0f51d01 Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Fri, 2 Mar 2018 20:01:25 +0800 Subject: [PATCH 056/217] HugeGraph-1158: awllow empty Iterator add to ExtendableIterator Change-Id: Ieabd7a243105c6875fe9adbcebb466daa73ff427 --- .../java/com/baidu/hugegraph/iterator/ExtendableIterator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java b/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java index 9f381fa5a3..8fe11e5a48 100644 --- a/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java +++ b/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java @@ -76,7 +76,7 @@ public T next() { } public ExtendableIterator extend(Iterator itor) { - if (itor != null && itor.hasNext()) { + if (itor != null) { this.itors.addLast(itor); } return this; From 154e03054ec8d396897e8d832814d03356e00b93 Mon Sep 17 00:00:00 2001 From: liningrui Date: Thu, 22 Mar 2018 13:55:15 +0800 Subject: [PATCH 057/217] HugeGraph-1171: Modify the way for config options registration Change-Id: I99a7dec4ac72ee5afa5ed9945fd27a9f536b57cd --- pom.xml | 4 +- .../baidu/hugegraph/config/OptionSpace.java | 55 ++++++++++++++----- 2 files changed, 44 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index ba974e441f..940378cdee 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.3.14-SNAPSHOT + 1.3.15-SNAPSHOT @@ -156,7 +156,7 @@ - 1.3.14.0 + 1.3.15.0 diff --git a/src/main/java/com/baidu/hugegraph/config/OptionSpace.java b/src/main/java/com/baidu/hugegraph/config/OptionSpace.java index ed3587fca3..d413701d82 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionSpace.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionSpace.java @@ -19,37 +19,66 @@ package com.baidu.hugegraph.config; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - +import com.baidu.hugegraph.util.Log; import org.slf4j.Logger; -import com.baidu.hugegraph.util.E; -import com.baidu.hugegraph.util.Log; +import java.lang.reflect.Method; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public final class OptionSpace { private static final Logger LOG = Log.logger(OptionSpace.class); + private static final Map> holders; private static final Map> options; static { + holders = new ConcurrentHashMap<>(); options = new ConcurrentHashMap<>(); } - public static void register(OptionHolder holder) { + @SuppressWarnings({ "rawtypes", "unchecked" }) + public static void register(String module, String holder) { + ClassLoader classLoader = OptionSpace.class.getClassLoader(); + Class clazz; + try { + clazz = classLoader.loadClass(holder); + } catch (Exception e) { + throw new ConfigException( + "Failed to load class of option holder '%s'", e, holder); + } + + // Check subclass + if (!OptionHolder.class.isAssignableFrom(clazz)) { + throw new ConfigException( + "Class '%s' is not a subclass of OptionHolder", holder); + } + + OptionHolder instance; + try { + Method method = clazz.getMethod("instance"); + instance = (OptionHolder) method.invoke(null); + } catch (Exception e) { + throw new ConfigException( + "Failed to instantiate option holder '%s'", e, holder); + } + + register(module, instance); + } + + public static void register(String module, OptionHolder holder) { + // Check exists + if (holders.containsKey(module)) { + LOG.warn("Already registered option holder: {} ({})", + module, holders.get(module)); + } + holders.put(module, holder.getClass()); options.putAll(holder.options()); LOG.debug("Registered options for OptionHolder: {}", holder.getClass().getSimpleName()); } - public static void register(ConfigOption element) { - E.checkArgument(!options.containsKey(element.name()), - "The option '%s' has already been registered", - element.name()); - options.put(element.name(), element); - } - public static Boolean containKey(String key) { return options.containsKey(key); } From cb33bbd436ee0fa98323fa174e9ed0e21edf9167 Mon Sep 17 00:00:00 2001 From: liningrui Date: Fri, 23 Mar 2018 17:05:15 +0800 Subject: [PATCH 058/217] HugeGraph-1174: Let config reload if some options contains comma Change-Id: I1e6dd2124aa9f9c3d1a52160b58cbad90cd0c941 --- pom.xml | 4 +- .../baidu/hugegraph/config/HugeConfig.java | 47 ++++++++++++++----- 2 files changed, 37 insertions(+), 14 deletions(-) diff --git a/pom.xml b/pom.xml index 940378cdee..56bf2a04ac 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.3.15-SNAPSHOT + 1.3.16-SNAPSHOT @@ -156,7 +156,7 @@ - 1.3.15.0 + 1.3.16.0 diff --git a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java index ec5be0d07e..7a4e6029df 100644 --- a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java +++ b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java @@ -19,18 +19,17 @@ package com.baidu.hugegraph.config; -import java.io.File; -import java.util.Iterator; -import java.util.List; - +import com.baidu.hugegraph.util.E; +import com.baidu.hugegraph.util.Log; import org.apache.commons.configuration.AbstractFileConfiguration; import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.PropertiesConfiguration; import org.slf4j.Logger; -import com.baidu.hugegraph.util.E; -import com.baidu.hugegraph.util.Log; +import java.io.File; +import java.util.Iterator; +import java.util.List; public class HugeConfig extends PropertiesConfiguration { @@ -40,12 +39,8 @@ public HugeConfig(Configuration config) { if (config == null) { throw new ConfigException("The config object is null"); } - if (config instanceof AbstractFileConfiguration) { - File file = ((AbstractFileConfiguration) config).getFile(); - if (file != null) { - this.setFile(file); - } - } + + this.reloadIfNeed(config); Iterator keys = config.getKeys(); while (keys.hasNext()) { @@ -62,6 +57,34 @@ public HugeConfig(String configFile) { this(loadConfigFile(configFile)); } + private void reloadIfNeed(Configuration config) { + if (config instanceof AbstractFileConfiguration) { + AbstractFileConfiguration fileConfig = + (AbstractFileConfiguration) config; + + File file = fileConfig.getFile(); + if (file != null) { + // May need to use the original file + this.setFile(file); + } + + if (!fileConfig.isDelimiterParsingDisabled()) { + /* + * PropertiesConfiguration will parse the containing comma + * config options into list directly, but we want to do + * this work by ourselves, so reload it and parse into `String` + */ + fileConfig.setDelimiterParsingDisabled(true); + try { + fileConfig.refresh(); + } catch (ConfigurationException e) { + throw new ConfigException("Unable to load config file: %s", + e, file); + } + } + } + } + private static PropertiesConfiguration loadConfigFile(String path) { E.checkNotNull(path, "config path"); E.checkArgument(!path.isEmpty(), From 12c65918b3a0556c78981be6a05fba195b01e58d Mon Sep 17 00:00:00 2001 From: liningrui Date: Wed, 28 Mar 2018 13:09:19 +0800 Subject: [PATCH 059/217] HugeGraph-1183: Add common RestClient for server and client Change-Id: Iec3c1d11bb57b913f5837af42050bb5b8b8c3705 --- pom.xml | 17 +- .../baidu/hugegraph/config/OptionSpace.java | 1 - .../baidu/hugegraph/rest/ClientException.java | 37 +++ .../com/baidu/hugegraph/rest/RestClient.java | 229 ++++++++++++++++++ .../com/baidu/hugegraph/rest/RestResult.java | 104 ++++++++ .../hugegraph/rest/SerializeException.java | 37 +++ 6 files changed, 422 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/baidu/hugegraph/rest/ClientException.java create mode 100644 src/main/java/com/baidu/hugegraph/rest/RestClient.java create mode 100644 src/main/java/com/baidu/hugegraph/rest/RestResult.java create mode 100644 src/main/java/com/baidu/hugegraph/rest/SerializeException.java diff --git a/pom.xml b/pom.xml index 56bf2a04ac..ac0076d83a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.3.16-SNAPSHOT + 1.4.0-SNAPSHOT @@ -31,6 +31,7 @@ 1.0 3.0.1 3.21.0-GA + 2.25.1 @@ -101,6 +102,18 @@ javassist ${javassist.version} + + + org.glassfish.jersey.core + jersey-client + ${jersey.version} + + + org.glassfish.jersey.media + jersey-media-json-jackson + ${jersey.version} + + @@ -156,7 +169,7 @@ - 1.3.16.0 + 1.4.0.0 diff --git a/src/main/java/com/baidu/hugegraph/config/OptionSpace.java b/src/main/java/com/baidu/hugegraph/config/OptionSpace.java index d413701d82..4c0947ff3e 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionSpace.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionSpace.java @@ -38,7 +38,6 @@ public final class OptionSpace { options = new ConcurrentHashMap<>(); } - @SuppressWarnings({ "rawtypes", "unchecked" }) public static void register(String module, String holder) { ClassLoader classLoader = OptionSpace.class.getClassLoader(); Class clazz; diff --git a/src/main/java/com/baidu/hugegraph/rest/ClientException.java b/src/main/java/com/baidu/hugegraph/rest/ClientException.java new file mode 100644 index 0000000000..d5fd2075d6 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/rest/ClientException.java @@ -0,0 +1,37 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.rest; + +public class ClientException extends RuntimeException { + + private static final long serialVersionUID = 814572040103754705L; + + public ClientException(String message, Throwable cause) { + super(message, cause); + } + + public ClientException(String message, Object... args) { + super(String.format(message, args)); + } + + public ClientException(String message, Throwable cause, Object... args) { + super(String.format(message, args), cause); + } +} diff --git a/src/main/java/com/baidu/hugegraph/rest/RestClient.java b/src/main/java/com/baidu/hugegraph/rest/RestClient.java new file mode 100644 index 0000000000..e485ccd58f --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/rest/RestClient.java @@ -0,0 +1,229 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.rest; + +import com.google.common.collect.ImmutableMap; +import org.glassfish.jersey.client.ClientConfig; +import org.glassfish.jersey.client.ClientProperties; +import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; +import org.glassfish.jersey.internal.util.collection.Ref; +import org.glassfish.jersey.internal.util.collection.Refs; +import org.glassfish.jersey.message.GZipEncoder; +import org.glassfish.jersey.uri.UriComponent; + +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.Invocation; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Variant; +import java.util.Collection; +import java.util.Map; +import java.util.concurrent.Callable; + +public abstract class RestClient { + + private Client client; + private WebTarget target; + + public RestClient(String url, int timeout) { + this(url, buildConfig(timeout)); + } + + public RestClient(String url, String user, String password, int timeout) { + this(url, buildConfigWithBasicAuth(user, password, timeout)); + } + + public RestClient(String url, ClientConfig config) { + this.client = ClientBuilder.newClient(config); + this.client.register(GZipEncoder.class); + this.target = this.client.target(url); + } + + private Response request(Callable method) { + try { + return method.call(); + } catch (Exception e) { + throw new ClientException("Failed to do request", e); + } + } + + public RestResult post(String path, Object object) { + return this.post(path, object, null); + } + + public RestResult post(String path, Object object, + MultivaluedMap headers) { + return this.post(path, object, headers, null); + } + + public RestResult post(String path, Object object, + MultivaluedMap headers, + Map params) { + WebTarget target = this.target; + if (params != null && !params.isEmpty()) { + for (Map.Entry param : params.entrySet()) { + target = target.queryParam(param.getKey(), param.getValue()); + } + } + + Ref builder = Refs.of(target.path(path).request()); + + String encoding = null; + if (headers != null && !headers.isEmpty()) { + // Add headers + builder.set(builder.get().headers(headers)); + encoding = (String) headers.getFirst("Content-Encoding"); + } + + /* + * We should specify the encoding of the entity object manually, + * because Entity.json() method will reset "content encoding = + * null" that has been set up by headers before. + */ + Ref> entity = Refs.of(null); + if (encoding == null) { + entity.set(Entity.json(object)); + } else { + Variant variant = new Variant(MediaType.APPLICATION_JSON_TYPE, + (String) null, encoding); + entity.set(Entity.entity(object, variant)); + } + + Response response = this.request(() -> { + return builder.get().post(entity.get()); + }); + // If check status failed, throw client exception. + checkStatus(response, Response.Status.CREATED, Response.Status.OK); + return new RestResult(response); + } + + public RestResult put(String path, String id, Object object) { + return this.put(path, id, object, ImmutableMap.of()); + } + + public RestResult put(String path, String id, Object object, + Map params) { + Ref target = Refs.of(this.target); + if (params != null && !params.isEmpty()) { + for (String key : params.keySet()) { + target.set(target.get().queryParam(key, params.get(key))); + } + } + + Response response = this.request(() -> { + return target.get().path(path).path(encode(id)).request() + .put(Entity.json(object)); + }); + // If check status failed, throw client exception. + checkStatus(response, Response.Status.OK); + return new RestResult(response); + } + + public RestResult get(String path) { + Response response = this.request(() -> { + return this.target.path(path).request().get(); + }); + checkStatus(response, Response.Status.OK); + return new RestResult(response); + } + + public RestResult get(String path, Map params) { + Ref target = Refs.of(this.target); + for (String key : params.keySet()) { + Object value = params.get(key); + if (value instanceof Collection) { + for (Object i : (Collection) value) { + target.set(target.get().queryParam(key, i)); + } + } else { + target.set(target.get().queryParam(key, value)); + } + } + Response response = this.request(() -> { + return target.get().path(path).request().get(); + }); + checkStatus(response, Response.Status.OK); + return new RestResult(response); + } + + public RestResult get(String path, String id) { + Response response = this.request(() -> { + return this.target.path(path).path(encode(id)).request().get(); + }); + checkStatus(response, Response.Status.OK); + return new RestResult(response); + } + + public RestResult delete(String path, Map params) { + Ref target = Refs.of(this.target); + for (String key : params.keySet()) { + target.set(target.get().queryParam(key, params.get(key))); + } + Response response = this.request(() -> { + return target.get().path(path).request().delete(); + }); + checkStatus(response, Response.Status.NO_CONTENT); + return new RestResult(response); + } + + public RestResult delete(String path, String id) { + Response response = this.request(() -> { + return this.target.path(path).path(encode(id)).request().delete(); + }); + checkStatus(response, Response.Status.NO_CONTENT); + return new RestResult(response); + } + + public void close() { + this.client.close(); + } + + private static String encode(String raw) { + return UriComponent.encode(raw, UriComponent.Type.PATH_SEGMENT); + } + + private static ClientConfig buildConfigWithBasicAuth(String username, + String password, + int timeout) { + ClientConfig config = buildConfig(timeout); + + config.register(HttpAuthenticationFeature + .basicBuilder() + .nonPreemptive() + .credentials(username, password) + .build()); + + return config; + } + + private static ClientConfig buildConfig(int timeout) { + ClientConfig config = new ClientConfig(); + config.property(ClientProperties.CONNECT_TIMEOUT, timeout); + config.property(ClientProperties.READ_TIMEOUT, timeout); + return config; + } + + protected abstract void checkStatus(Response response, + Response.Status... statuses); +} diff --git a/src/main/java/com/baidu/hugegraph/rest/RestResult.java b/src/main/java/com/baidu/hugegraph/rest/RestResult.java new file mode 100644 index 0000000000..2b6a48e666 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/rest/RestResult.java @@ -0,0 +1,104 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.rest; + +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.Module; +import com.fasterxml.jackson.databind.ObjectMapper; + +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; +import java.io.IOException; +import java.util.List; + +public class RestResult { + + private static final ObjectMapper mapper = new ObjectMapper(); + + private int status; + private MultivaluedMap headers; + private String content; + + public RestResult(Response response) { + this.status = response.getStatus(); + this.headers = response.getHeaders(); + this.content = response.readEntity(String.class); + } + + public int status() { + return this.status; + } + + public MultivaluedMap headers() { + return this.headers; + } + + public String content() { + return this.content; + } + + public T readObject(Class clazz) { + try { + return mapper.readValue(this.content, clazz); + } catch (Exception e) { + throw new SerializeException( + "Failed to deserialize: %s", this.content, e); + } + } + + public List readList(String key, Class clazz) { + try { + JsonNode root = mapper.readTree(this.content); + JsonNode element = root.get(key); + if (element == null) { + throw new SerializeException( + "Can't find value of the key: %s in json.", key); + } + JavaType type = mapper.getTypeFactory() + .constructParametricType(List.class, clazz); + return mapper.readValue(element.toString(), type); + } catch (IOException e) { + throw new SerializeException( + "Failed to deserialize %s", this.content, e); + } + } + + public List readList(Class clazz) { + try { + JavaType type = mapper.getTypeFactory() + .constructParametricType(List.class, clazz); + return mapper.readValue(this.content, type); + } catch (IOException e) { + throw new SerializeException( + "Failed to deserialize %s", this.content, e); + } + } + + @Override + public String toString() { + return String.format("{status=%s, headers=%s, content=%s}", + this.status, this.headers, this.content); + } + + public static void registerModule(Module module) { + mapper.registerModule(module); + } +} diff --git a/src/main/java/com/baidu/hugegraph/rest/SerializeException.java b/src/main/java/com/baidu/hugegraph/rest/SerializeException.java new file mode 100644 index 0000000000..65bfa95bf4 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/rest/SerializeException.java @@ -0,0 +1,37 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.rest; + +public class SerializeException extends ClientException { + + private static final long serialVersionUID = -4622753445618619311L; + + public SerializeException(String message, Throwable e) { + super(message, e); + } + + public SerializeException(String message, Object... args) { + super(message, args); + } + + public SerializeException(String message, Throwable e, Object... args) { + super(message, e, args); + } +} From 56a60dca537372ca733637691b88b5efa009c41b Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Thu, 29 Mar 2018 19:51:05 +0800 Subject: [PATCH 060/217] HugeGraph-1190: add OptionSpace.keys() method Change-Id: If43dbfce1926fea95ca99c63b0d5c5531bcd639c --- pom.xml | 2 +- src/main/java/com/baidu/hugegraph/config/OptionSpace.java | 5 +++++ src/main/java/com/baidu/hugegraph/event/EventHub.java | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ac0076d83a..4a0539e25e 100644 --- a/pom.xml +++ b/pom.xml @@ -169,7 +169,7 @@ - 1.4.0.0 + 1.4.0.1 diff --git a/src/main/java/com/baidu/hugegraph/config/OptionSpace.java b/src/main/java/com/baidu/hugegraph/config/OptionSpace.java index 4c0947ff3e..38c1a8dc24 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionSpace.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionSpace.java @@ -24,6 +24,7 @@ import java.lang.reflect.Method; import java.util.Map; +import java.util.Set; import java.util.concurrent.ConcurrentHashMap; public final class OptionSpace { @@ -78,6 +79,10 @@ public static void register(String module, OptionHolder holder) { holder.getClass().getSimpleName()); } + public static Set keys() { + return options.keySet(); + } + public static Boolean containKey(String key) { return options.containsKey(key); } diff --git a/src/main/java/com/baidu/hugegraph/event/EventHub.java b/src/main/java/com/baidu/hugegraph/event/EventHub.java index a11e2abc78..b2a92ab884 100644 --- a/src/main/java/com/baidu/hugegraph/event/EventHub.java +++ b/src/main/java/com/baidu/hugegraph/event/EventHub.java @@ -129,6 +129,7 @@ public int unlisten(String event, EventListener listener) { } public void notify(String event, @Nullable Object... args) { + @SuppressWarnings("resource") ExtendableIterator all = new ExtendableIterator<>(); List ls = this.listeners.get(event); From 1bf8d9e4c04a6c482a22d8e321caa66784046bd8 Mon Sep 17 00:00:00 2001 From: Liu Jie Date: Thu, 29 Mar 2018 19:58:24 +0800 Subject: [PATCH 061/217] HugeGraph-1191: rewrite exception handling mechanism at register method Change-Id: I041f1792f2a4806e73d2ebb93a2b019d9ad73b0b --- .../baidu/hugegraph/config/OptionSpace.java | 36 ++++++++++++++----- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/baidu/hugegraph/config/OptionSpace.java b/src/main/java/com/baidu/hugegraph/config/OptionSpace.java index 38c1a8dc24..632f37e5de 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionSpace.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionSpace.java @@ -19,20 +19,23 @@ package com.baidu.hugegraph.config; -import com.baidu.hugegraph.util.Log; -import org.slf4j.Logger; - +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import org.slf4j.Logger; + +import com.baidu.hugegraph.util.Log; + public final class OptionSpace { private static final Logger LOG = Log.logger(OptionSpace.class); private static final Map> holders; private static final Map> options; + private static final String INSTANCE_METHOD = "instance"; static { holders = new ConcurrentHashMap<>(); @@ -44,7 +47,7 @@ public static void register(String module, String holder) { Class clazz; try { clazz = classLoader.loadClass(holder); - } catch (Exception e) { + } catch (ClassNotFoundException e) { throw new ConfigException( "Failed to load class of option holder '%s'", e, holder); } @@ -55,13 +58,28 @@ public static void register(String module, String holder) { "Class '%s' is not a subclass of OptionHolder", holder); } - OptionHolder instance; + OptionHolder instance = null; + Exception exception = null; try { - Method method = clazz.getMethod("instance"); + Method method = clazz.getMethod(INSTANCE_METHOD); instance = (OptionHolder) method.invoke(null); - } catch (Exception e) { - throw new ConfigException( - "Failed to instantiate option holder '%s'", e, holder); + } catch (NoSuchMethodException e) { + LOG.warn("Class {} does not has static method {}.", + holder, INSTANCE_METHOD); + exception = e; + } catch (InvocationTargetException e) { + LOG.warn("Can't call static method {} from class {}.", + INSTANCE_METHOD, holder); + exception = e; + } catch (IllegalAccessException e) { + LOG.warn("Illegal access while calling method {} from class {}.", + INSTANCE_METHOD, holder); + exception = e; + } + + if (exception != null) { + throw new ConfigException("Failed to instantiate option holder: %s", + exception, holder); } register(module, instance); From 5183fb054aa0f089ae953a412d6133515e13af77 Mon Sep 17 00:00:00 2001 From: liningrui Date: Sun, 8 Apr 2018 14:07:09 +0800 Subject: [PATCH 062/217] HugeGraph-1208: Move compareNumber() from core to common module Change-Id: I426651f98c7645ccdfc20f04310769eacb6d442a --- pom.xml | 4 +-- .../com/baidu/hugegraph/util/NumericUtil.java | 30 +++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 4a0539e25e..6ab9d4fb13 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT @@ -169,7 +169,7 @@ - 1.4.0.1 + 1.4.1.0 diff --git a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java index cb6789e9db..8356bb1f3d 100644 --- a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java @@ -20,6 +20,7 @@ import java.math.BigDecimal; import java.nio.ByteBuffer; import java.util.Date; +import java.util.function.Function; /** * This file is copied verbatim from Apache Lucene NumericUtils.java Only the @@ -184,4 +185,33 @@ public static Object convertToNumber(Object value) { } return value; } + + /** + * Compare object with a number, the object should be a number, + * or it can be converted to a BigDecimal + * @param first might be number or string + * @param second must be number + */ + @SuppressWarnings("unchecked") + public static int compareNumber(Object first, Number second) { + if (first instanceof Number && first instanceof Comparable && + first.getClass().equals(second.getClass())) { + return ((Comparable) first).compareTo(second); + } + + Function toBig = (number) -> { + try { + return new BigDecimal(number.toString()); + } catch (NumberFormatException e) { + throw new IllegalArgumentException(String.format( + "Can't compare between %s and %s, " + + "they must be numbers", first, second)); + } + }; + + BigDecimal n1 = toBig.apply(first); + BigDecimal n2 = toBig.apply(second); + + return n1.compareTo(n2); + } } From 887a4d5a9a8a9050fb21e570bfcbd6fe446e66b9 Mon Sep 17 00:00:00 2001 From: Liu Jie Date: Fri, 30 Mar 2018 15:12:18 +0800 Subject: [PATCH 063/217] HugeGraph-1196: Fix grammer at exits method Change-Id: Iad9cc2b819684140a0a4509dd6c3331b4dcf86b8 --- src/main/java/com/baidu/hugegraph/concurrent/LockManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java b/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java index 670bd2d20f..d41bc931d2 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java @@ -53,7 +53,7 @@ public LockGroup create(String group) { public LockGroup get(String group) { if (!exists(group)) { throw new RuntimeException(String.format( - "Not exist LockGroup '%s'", group)); + "LockGroup '%s' does not exists", group)); } return this.lockGroupMap.get(group); } @@ -63,7 +63,7 @@ public void destroy(String group) { this.lockGroupMap.remove(group); } else { throw new RuntimeException(String.format( - "Not exist LockGroup '%s'", group)); + "LockGroup '%s' does not exists", group)); } } } From c2db8f55d6250ed2dae8fce62873701f667e9c5f Mon Sep 17 00:00:00 2001 From: liningrui Date: Tue, 10 Apr 2018 18:13:51 +0800 Subject: [PATCH 064/217] HugeGraph-81: Fixed bug that message and cause placed error Change-Id: Ic408f158cd814edcd5edffc21bc09ba347da9a8f --- src/main/java/com/baidu/hugegraph/config/OptionHolder.java | 4 ++-- src/main/java/com/baidu/hugegraph/rest/RestResult.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/baidu/hugegraph/config/OptionHolder.java b/src/main/java/com/baidu/hugegraph/config/OptionHolder.java index e853ed80b2..10aa1532c0 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionHolder.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionHolder.java @@ -45,8 +45,8 @@ protected void registerOptions() { this.options.put(option.name(), option); } catch (Exception e) { LOG.error("Failed to register option: {}", field, e); - throw new ConfigException(String.format( - "Failed to register option: %s", field)); + throw new ConfigException( + "Failed to register option: %s", field); } } } diff --git a/src/main/java/com/baidu/hugegraph/rest/RestResult.java b/src/main/java/com/baidu/hugegraph/rest/RestResult.java index 2b6a48e666..b37d90d540 100644 --- a/src/main/java/com/baidu/hugegraph/rest/RestResult.java +++ b/src/main/java/com/baidu/hugegraph/rest/RestResult.java @@ -60,7 +60,7 @@ public T readObject(Class clazz) { return mapper.readValue(this.content, clazz); } catch (Exception e) { throw new SerializeException( - "Failed to deserialize: %s", this.content, e); + "Failed to deserialize: %s", e, this.content); } } @@ -77,7 +77,7 @@ public List readList(String key, Class clazz) { return mapper.readValue(element.toString(), type); } catch (IOException e) { throw new SerializeException( - "Failed to deserialize %s", this.content, e); + "Failed to deserialize %s", e, this.content); } } @@ -88,7 +88,7 @@ public List readList(Class clazz) { return mapper.readValue(this.content, type); } catch (IOException e) { throw new SerializeException( - "Failed to deserialize %s", this.content, e); + "Failed to deserialize %s", e, this.content); } } From aa222c4893528578d659c4e6c0d8ef80a25536f3 Mon Sep 17 00:00:00 2001 From: liningrui Date: Mon, 16 Apr 2018 11:47:13 +0800 Subject: [PATCH 065/217] HugeGraph-1229: add README.md for project hugegraph-common Change-Id: Ic1d328b03a1d7eb91d76af615d4146d3f175ef79 --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000000..dc77091aef --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +# hugegraph-common + +hugegraph-common is a tool module for [HugeGraph]() and its peripheral components. +hugegraph-common encapsulates locks, configurations, events, iterators, rest and some +numeric or collection util classes to simplify the development of HugeGraph and +its components. + +## Components + +- Lock, atomic lock, key lock, lock group and lock manger +- Config, register and load config option with security check +- Event, listening and notification, do something asynchronously +- Iterator, some iterators with extra functions,map, filter, extend etc. +- Rest, RESTful client implemented on Jersey, POST, PUT, GET and DELETE +- Util, Numeric and Collection utils, log and exception utils etc. + +## Licence +The same as HugeGraph, hugegraph-client is also licensed under Apache 2.0 License. From d6d92e4896d6561e7806aa068abae77b94a04014 Mon Sep 17 00:00:00 2001 From: liningrui Date: Tue, 17 Apr 2018 19:48:37 +0800 Subject: [PATCH 066/217] HugeGraph-1229: add README.md for project hugegraph-common Change-Id: Ic881b001c08e47e1fa6ead49ca064ecefd215691 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dc77091aef..db855b52dd 100644 --- a/README.md +++ b/README.md @@ -15,4 +15,4 @@ its components. - Util, Numeric and Collection utils, log and exception utils etc. ## Licence -The same as HugeGraph, hugegraph-client is also licensed under Apache 2.0 License. +The same as HugeGraph, hugegraph-common is also licensed under Apache 2.0 License. From 9346717bde96c31e3f4da819a8b3366366fdcd91 Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Wed, 18 Apr 2018 19:26:51 +0800 Subject: [PATCH 067/217] HugeGraph-1236: add getMap() to HugeConfig Change-Id: I46d3ea398246e771936a3f4c75adbcdd31d7ad98 --- pom.xml | 4 +-- .../baidu/hugegraph/config/HugeConfig.java | 26 +++++++++++++++---- .../com/baidu/hugegraph/rest/RestClient.java | 26 ++++++++++--------- .../com/baidu/hugegraph/rest/RestResult.java | 11 ++++---- 4 files changed, 43 insertions(+), 24 deletions(-) diff --git a/pom.xml b/pom.xml index 6ab9d4fb13..17d5d772fc 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT @@ -169,7 +169,7 @@ - 1.4.1.0 + 1.4.2.0 diff --git a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java index 7a4e6029df..d389026962 100644 --- a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java +++ b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java @@ -19,17 +19,20 @@ package com.baidu.hugegraph.config; -import com.baidu.hugegraph.util.E; -import com.baidu.hugegraph.util.Log; +import java.io.File; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + import org.apache.commons.configuration.AbstractFileConfiguration; import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.PropertiesConfiguration; import org.slf4j.Logger; -import java.io.File; -import java.util.Iterator; -import java.util.List; +import com.baidu.hugegraph.util.E; +import com.baidu.hugegraph.util.Log; public class HugeConfig extends PropertiesConfiguration { @@ -111,6 +114,19 @@ public T get(ConfigOption option) { return value != null ? (T) value : option.defaultValue(); } + public Map getMap(ConfigListOption option) { + List values = this.get(option); + Map result = new HashMap<>(); + for (String value : values) { + String[] pair = value.split(":", 2); + E.checkState(pair.length == 2, + "Invalid option format for '%s': %s(expect KEY:VALUE)", + option.name(), value); + result.put(pair[0].trim(), pair[1].trim()); + } + return result; + } + @Override public void addProperty(String key, Object value) { if (!OptionSpace.containKey(key)) { diff --git a/src/main/java/com/baidu/hugegraph/rest/RestClient.java b/src/main/java/com/baidu/hugegraph/rest/RestClient.java index e485ccd58f..b5a8a89048 100644 --- a/src/main/java/com/baidu/hugegraph/rest/RestClient.java +++ b/src/main/java/com/baidu/hugegraph/rest/RestClient.java @@ -19,14 +19,9 @@ package com.baidu.hugegraph.rest; -import com.google.common.collect.ImmutableMap; -import org.glassfish.jersey.client.ClientConfig; -import org.glassfish.jersey.client.ClientProperties; -import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; -import org.glassfish.jersey.internal.util.collection.Ref; -import org.glassfish.jersey.internal.util.collection.Refs; -import org.glassfish.jersey.message.GZipEncoder; -import org.glassfish.jersey.uri.UriComponent; +import java.util.Collection; +import java.util.Map; +import java.util.concurrent.Callable; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; @@ -37,9 +32,16 @@ import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; import javax.ws.rs.core.Variant; -import java.util.Collection; -import java.util.Map; -import java.util.concurrent.Callable; + +import org.glassfish.jersey.client.ClientConfig; +import org.glassfish.jersey.client.ClientProperties; +import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; +import org.glassfish.jersey.internal.util.collection.Ref; +import org.glassfish.jersey.internal.util.collection.Refs; +import org.glassfish.jersey.message.GZipEncoder; +import org.glassfish.jersey.uri.UriComponent; + +import com.google.common.collect.ImmutableMap; public abstract class RestClient { @@ -153,7 +155,7 @@ public RestResult get(String path, Map params) { for (String key : params.keySet()) { Object value = params.get(key); if (value instanceof Collection) { - for (Object i : (Collection) value) { + for (Object i : (Collection) value) { target.set(target.get().queryParam(key, i)); } } else { diff --git a/src/main/java/com/baidu/hugegraph/rest/RestResult.java b/src/main/java/com/baidu/hugegraph/rest/RestResult.java index b37d90d540..3be29b8cae 100644 --- a/src/main/java/com/baidu/hugegraph/rest/RestResult.java +++ b/src/main/java/com/baidu/hugegraph/rest/RestResult.java @@ -19,16 +19,17 @@ package com.baidu.hugegraph.rest; +import java.io.IOException; +import java.util.List; + +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; + import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.Module; import com.fasterxml.jackson.databind.ObjectMapper; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; -import java.io.IOException; -import java.util.List; - public class RestResult { private static final ObjectMapper mapper = new ObjectMapper(); From 140cf845b55d4d1db19c313b45f51e0a0231617c Mon Sep 17 00:00:00 2001 From: zhangyi51 Date: Thu, 19 Apr 2018 16:51:20 +0800 Subject: [PATCH 068/217] hugegraph-1234 add subset util Change-Id: I1f7a0f5b989191459ae3409d1aeaeaefe2c10c92 --- pom.xml | 4 ++-- .../baidu/hugegraph/util/CollectionUtil.java | 22 ++++++++++++++----- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 17d5d772fc..b91ab3e75f 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.4.2-SNAPSHOT + 1.4.3-SNAPSHOT @@ -169,7 +169,7 @@ - 1.4.2.0 + 1.4.3.0 diff --git a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java index 09d9f0a865..558cfb0d45 100644 --- a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java @@ -23,15 +23,12 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.List; +import java.util.Set; public final class CollectionUtil { - @SuppressWarnings({ "unchecked", "rawtypes" }) - public static boolean containsAll(Collection a, Collection b) { - return a.containsAll(b); - } - @SuppressWarnings("unchecked") public static List toList(Object array) { E.checkNotNull(array, "array"); @@ -71,4 +68,19 @@ public static boolean prefixOf(List prefix, List all) { public static boolean allUnique(Collection collection){ return collection.stream().allMatch(new HashSet<>()::add); } + + /** + * Get sub-set of a set. + * @param original original set + * @param from index of start position + * @param to index of end position(exclude), but -1 means the last element + * @return sub-set of original set [from,to) + */ + public static Set subSet(Set original, int from, int to) { + List list = new ArrayList<>(original); + if (to == -1) { + to = original.size(); + } + return new LinkedHashSet<>(list.subList(from, to)); + } } From 544b94c919155a3a49ca3ce5dfb7c2cbca2e8a57 Mon Sep 17 00:00:00 2001 From: liningrui Date: Fri, 27 Apr 2018 15:02:25 +0800 Subject: [PATCH 069/217] HugeGraph-1257: Let jersey client use preemptive credentials Change-Id: Ica97e912e905c0c7ee1353e603651794408564d1 --- .../com/baidu/hugegraph/rest/RestClient.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/baidu/hugegraph/rest/RestClient.java b/src/main/java/com/baidu/hugegraph/rest/RestClient.java index b5a8a89048..6d30c55711 100644 --- a/src/main/java/com/baidu/hugegraph/rest/RestClient.java +++ b/src/main/java/com/baidu/hugegraph/rest/RestClient.java @@ -209,13 +209,16 @@ private static ClientConfig buildConfigWithBasicAuth(String username, String password, int timeout) { ClientConfig config = buildConfig(timeout); - - config.register(HttpAuthenticationFeature - .basicBuilder() - .nonPreemptive() - .credentials(username, password) - .build()); - + /* + * NOTE: don't use non-preemptive mode + * In non-preemptive mode the authentication information is added + * only when server refuses the request with 401 status code and + * then the request is repeated. + * Non-preemptive has negative impact on the performance. The advantage + * is that it does not send credentials when they are not needed. + * https://jersey.github.io/documentation/latest/client.html#d0e5461 + */ + config.register(HttpAuthenticationFeature.basic(username, password)); return config; } From daa967d74d3a5ff9599595ee59f154b3f053a3f5 Mon Sep 17 00:00:00 2001 From: liningrui Date: Fri, 8 Jun 2018 11:37:12 +0800 Subject: [PATCH 070/217] HugeGraph-1301: Move SafeDateFormat class to hugegraph-common module Change-Id: I8bc07f5b01b400d48393a1dc744c1de2853e392f --- pom.xml | 4 +- .../baidu/hugegraph/date/SafeDateFormat.java | 67 +++++++++++++++++++ 2 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/baidu/hugegraph/date/SafeDateFormat.java diff --git a/pom.xml b/pom.xml index b91ab3e75f..e3a096892d 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.4.3-SNAPSHOT + 1.4.4-SNAPSHOT @@ -169,7 +169,7 @@ - 1.4.3.0 + 1.4.4.0 diff --git a/src/main/java/com/baidu/hugegraph/date/SafeDateFormat.java b/src/main/java/com/baidu/hugegraph/date/SafeDateFormat.java new file mode 100644 index 0000000000..9994aba146 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/date/SafeDateFormat.java @@ -0,0 +1,67 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.date; + +import java.text.DateFormat; +import java.text.FieldPosition; +import java.text.ParsePosition; +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * SafeDateFormat is a thread safe DateFormat + * NOTE: DateFormat is not thread safe, need synchronized manually. + * http://blog.jrwang.me/2016/java-simpledateformat-multithread-threadlocal + */ +public class SafeDateFormat extends DateFormat { + + private static final long serialVersionUID = -4838048315029312489L; + + private final ThreadLocal formatter; + + public SafeDateFormat(String template) { + this.formatter = ThreadLocal.withInitial(() -> { + return new SimpleDateFormat(template); + }); + this.setCalendar(this.formatter.get().getCalendar()); + this.setNumberFormat(this.formatter.get().getNumberFormat()); + } + + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, + FieldPosition fieldPosition) { + return this.formatter.get().format(date, toAppendTo, fieldPosition); + } + + @Override + public Date parse(String source, ParsePosition pos) { + return this.formatter.get().parse(source, pos); + } + + @Override + public Object clone() { + // No need to clone due to itself is thread safe + return this; + } + + public Object toPattern() { + return this.formatter.get().toPattern(); + } +} From 8c76d5b0cf22b74197e5a61f7a8701ef1ebb5750 Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Wed, 13 Jun 2018 15:59:22 +0800 Subject: [PATCH 071/217] HugeGraph-1309: add remove() support to WrappedIterator Change-Id: Iec68a94fed485852af8d1c838630a108794aac99 --- .../hugegraph/iterator/ExtendableIterator.java | 18 ++++++++++-------- .../hugegraph/iterator/WrappedIterator.java | 10 ++++++++++ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java b/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java index 8fe11e5a48..5f5e7536dd 100644 --- a/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java +++ b/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java @@ -26,8 +26,9 @@ import java.util.NoSuchElementException; import java.util.concurrent.ConcurrentLinkedDeque; -public class ExtendableIterator - implements Iterator, AutoCloseable, Metadatable { +import org.apache.commons.lang.NotImplementedException; + +public class ExtendableIterator extends WrappedIterator { private final Deque> itors; private final List> removedItors; @@ -97,11 +98,12 @@ public void close() throws Exception { } @Override - public Object metadata(String meta, Object... args) { - Iterator iterator = this.itors.peekLast(); - if (iterator instanceof Metadatable) { - return ((Metadatable) iterator).metadata(meta, args); - } - throw new IllegalStateException("Original iterator is not Metadatable"); + protected Iterator originIterator() { + return this.itors.peekLast(); + } + + @Override + protected boolean fetch() { + throw new NotImplementedException("ExtendableIterator.fetch()"); } } diff --git a/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java b/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java index 8d559c2e0a..acf7a42316 100644 --- a/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java +++ b/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java @@ -22,6 +22,8 @@ import java.util.Iterator; import java.util.NoSuchElementException; +import com.baidu.hugegraph.util.E; + public abstract class WrappedIterator implements Iterator, AutoCloseable, Metadatable { @@ -52,6 +54,14 @@ public R next() { return current; } + @Override + public void remove() { + Iterator iterator = this.originIterator(); + E.checkState(iterator != null, + "The origin iterator can't be null for removing"); + iterator.remove(); + } + @Override public void close() throws Exception { Iterator iterator = this.originIterator(); From 4aae65cd4d4fd6a84d9b45df1398435d641ea463 Mon Sep 17 00:00:00 2001 From: liningrui Date: Wed, 20 Jun 2018 17:06:55 +0800 Subject: [PATCH 072/217] HugeGraph-81: Small optimization of package structure Change-Id: I84109719a0064ea0d53c26843fbe435b84655912 --- pom.xml | 4 +- .../hugegraph/{type => func}/TriFunction.java | 2 +- .../com/baidu/hugegraph/perf/PerfUtil.java | 2 +- .../java/com/baidu/hugegraph/type/Shard.java | 71 ------------------- .../hugegraph/util/InsertionOrderUtil.java | 54 ++++++++++++++ 5 files changed, 58 insertions(+), 75 deletions(-) rename src/main/java/com/baidu/hugegraph/{type => func}/TriFunction.java (96%) delete mode 100644 src/main/java/com/baidu/hugegraph/type/Shard.java create mode 100644 src/main/java/com/baidu/hugegraph/util/InsertionOrderUtil.java diff --git a/pom.xml b/pom.xml index e3a096892d..ce3ed06513 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.4.4-SNAPSHOT + 1.4.5-SNAPSHOT @@ -169,7 +169,7 @@ - 1.4.4.0 + 1.4.5.0 diff --git a/src/main/java/com/baidu/hugegraph/type/TriFunction.java b/src/main/java/com/baidu/hugegraph/func/TriFunction.java similarity index 96% rename from src/main/java/com/baidu/hugegraph/type/TriFunction.java rename to src/main/java/com/baidu/hugegraph/func/TriFunction.java index 58a345455d..555a0ee467 100644 --- a/src/main/java/com/baidu/hugegraph/type/TriFunction.java +++ b/src/main/java/com/baidu/hugegraph/func/TriFunction.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.type; +package com.baidu.hugegraph.func; public interface TriFunction { public R apply(T1 v1, T2 v2, T3 v3); diff --git a/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java b/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java index 2b6c13ac58..7335e984ef 100644 --- a/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java +++ b/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java @@ -38,7 +38,7 @@ import org.slf4j.Logger; -import com.baidu.hugegraph.type.TriFunction; +import com.baidu.hugegraph.func.TriFunction; import com.baidu.hugegraph.util.Log; import com.baidu.hugegraph.util.ReflectionUtil; import com.google.common.reflect.ClassPath.ClassInfo; diff --git a/src/main/java/com/baidu/hugegraph/type/Shard.java b/src/main/java/com/baidu/hugegraph/type/Shard.java deleted file mode 100644 index 406550c4a1..0000000000 --- a/src/main/java/com/baidu/hugegraph/type/Shard.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2017 HugeGraph Authors - * - * 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 com.baidu.hugegraph.type; - -/** - * Shard is used for backend storage (like cassandra, hbase) scanning - * operations. Each shard represents a range of tokens for a node. - * Reading data from a given shard does not cross multiple nodes. - */ -public class Shard { - - // token range start - private String start; - // token range end - private String end; - // partitions count in this range - private long length; - - public Shard(String start, String end, long length) { - this.start = start; - this.end = end; - this.length = length; - } - - public String start() { - return this.start; - } - - public void start(String start) { - this.start = start; - } - - public String end() { - return this.end; - } - - public void end(String end) { - this.end = end; - } - - public long length() { - return this.length; - } - - public void length(long length) { - this.length = length; - } - - @Override - public String toString() { - return String.format("Shard{start=%s, end=%s, length=%s}", - this.start, this.end, this.length); - } -} \ No newline at end of file diff --git a/src/main/java/com/baidu/hugegraph/util/InsertionOrderUtil.java b/src/main/java/com/baidu/hugegraph/util/InsertionOrderUtil.java new file mode 100644 index 0000000000..3f235a485e --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/util/InsertionOrderUtil.java @@ -0,0 +1,54 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.util; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public final class InsertionOrderUtil { + + public static Map newMap() { + return new LinkedHashMap<>(); + } + + public static Map newMap(Map origin) { + return new LinkedHashMap<>(origin); + } + + public static Set newSet() { + return new LinkedHashSet<>(); + } + + public static Set newSet(Set origin) { + return new LinkedHashSet<>(origin); + } + + public static List newList() { + return new ArrayList<>(); + } + + public static List newList(List origin) { + return new ArrayList<>(origin); + } +} From 92ad62a9fbaad7f194255bf1ffff96bceb3b1de3 Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Thu, 28 Jun 2018 16:20:54 +0800 Subject: [PATCH 073/217] HugeGraph-1330: add support for 128bits hash Change-Id: I51b46d3a88e472757e4ca45e73e7d6011150ef2f --- pom.xml | 4 ++-- .../java/com/baidu/hugegraph/util/HashUtil.java | 13 +++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index ce3ed06513..bb88bc5745 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.4.5-SNAPSHOT + 1.4.6-SNAPSHOT @@ -169,7 +169,7 @@ - 1.4.5.0 + 1.4.6.0 diff --git a/src/main/java/com/baidu/hugegraph/util/HashUtil.java b/src/main/java/com/baidu/hugegraph/util/HashUtil.java index 3a39eb3d4b..b2091bee9c 100644 --- a/src/main/java/com/baidu/hugegraph/util/HashUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/HashUtil.java @@ -21,17 +21,26 @@ import java.nio.charset.Charset; +import com.google.common.base.Charsets; import com.google.common.hash.Hashing; public final class HashUtil { + private static final Charset CHARSET = Charsets.UTF_8; + public static byte[] hash(byte[] bytes) { return Hashing.murmur3_32().hashBytes(bytes).asBytes(); } public static String hash(String value) { - final Charset charset = Charset.forName("UTF-8"); - return Hashing.murmur3_32().hashString(value, charset).toString(); + return Hashing.murmur3_32().hashString(value, CHARSET).toString(); + } + + public static byte[] hash128(byte[] bytes) { + return Hashing.murmur3_128().hashBytes(bytes).asBytes(); } + public static String hash128(String value) { + return Hashing.murmur3_128().hashString(value, CHARSET).toString(); + } } From 50c77380561c64ad02acad152bd3f3d15388b385 Mon Sep 17 00:00:00 2001 From: liningrui Date: Thu, 28 Jun 2018 21:25:06 +0800 Subject: [PATCH 074/217] HugeGraph-1312: Add config to deploy to sonatype maven respority Change-Id: I981ecc2486b8091b6c1b039d79da9c05ee3aaa14 --- pom.xml | 116 +++++++++++++----- .../baidu/hugegraph/concurrent/KeyLock.java | 3 + .../baidu/hugegraph/util/CollectionUtil.java | 3 +- .../baidu/hugegraph/util/LongEncoding.java | 3 +- .../com/baidu/hugegraph/util/NumericUtil.java | 28 +++-- .../com/baidu/hugegraph/util/VersionUtil.java | 12 +- 6 files changed, 118 insertions(+), 47 deletions(-) diff --git a/pom.xml b/pom.xml index bb88bc5745..fa6f2b1a0f 100644 --- a/pom.xml +++ b/pom.xml @@ -6,19 +6,54 @@ com.baidu.hugegraph hugegraph-common - 1.4.6-SNAPSHOT + 1.4.6 - - - Baidu_Local_Snapshots - http://maven.scm.baidu.com:8081/nexus/content/repositories/Baidu_Local_Snapshots - - + hugegraph-common + https://github.com/hugegraph/hugegraph-common + + hugegraph-common is a tool module for HugeGraph and its peripheral components. + hugegraph-common encapsulates locks, configurations, events, iterators, rest and some + numeric or collection util classes to simplify the development of HugeGraph and its components. + + + + org.sonatype.oss + oss-parent + 7 + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + https://github.com/hugegraph/hugegraph-common + https://github.com/hugegraph/hugegraph-common + https://github.com/hugegraph/hugegraph-common + + + + + lizhangmei + lizhangmei@baidu.com + + + zhoney + zhangyi89817@126.com + + + liningrui + liningrui@vip.qq.com + + UTF-8 ${project.basedir}/.. - hugegraph-bin 1.8 1.8 2.8.2 @@ -61,14 +96,13 @@ commons-configuration commons-configuration - 1.10 + ${commons.configuration.version} org.apache.commons commons-configuration2 ${commons.configuration2.version} - commons-io commons-io @@ -113,7 +147,6 @@ jersey-media-json-jackson ${jersey.version} - @@ -133,25 +166,6 @@ - - maven-clean-plugin - 3.0.0 - - - - ${top.level.dir} - - *.tar.gz - - false - - - ${final.name} - - - - - org.apache.maven.plugins maven-jar-plugin @@ -175,7 +189,47 @@ + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9.1 + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + - diff --git a/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java b/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java index 1ed31cb34e..42e1329863 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java @@ -99,6 +99,9 @@ public final List lockAll(Object... keys) { /** * Lock two objects with sorted order * NOTE: This is to optimize the performance of lockAll(keys) + * @param key1 The first object + * @param key2 The second object + * @return locks for the two objects */ public List lockAll(Object key1, Object key2) { Lock lock1 = this.locks.get(key1); diff --git a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java index 558cfb0d45..9fa728566f 100644 --- a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java @@ -74,7 +74,8 @@ public static boolean allUnique(Collection collection){ * @param original original set * @param from index of start position * @param to index of end position(exclude), but -1 means the last element - * @return sub-set of original set [from,to) + * @param element type of set + * @return sub-set of original set [from, to) */ public static Set subSet(Set original, int from, int to) { List list = new ArrayList<>(original); diff --git a/src/main/java/com/baidu/hugegraph/util/LongEncoding.java b/src/main/java/com/baidu/hugegraph/util/LongEncoding.java index 04dd4ab6d5..e0d5c07d89 100644 --- a/src/main/java/com/baidu/hugegraph/util/LongEncoding.java +++ b/src/main/java/com/baidu/hugegraph/util/LongEncoding.java @@ -19,8 +19,7 @@ /** * Utility class for encoding longs in strings based on: - * {@linktourl http://stackoverflow.com/questions/2938482/encode-decode-a-long-to-a-string-using-a-fixed-set-of-letters-in-java} - * + * @see encode decode long to string */ public final class LongEncoding { diff --git a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java index 8356bb1f3d..9edfbdaff2 100644 --- a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java @@ -39,7 +39,8 @@ private NumericUtil() { * precision is not reduced, but the value can easily used as a long. The * sort order (including {@link Double#NaN}) is defined by * {@link Double#compareTo}; {@code NaN} is greater than positive infinity. - * + * @param val input double value + * @return output sortable long value * @see #sortableLongToDouble */ public static long doubleToSortableLong(double val) { @@ -48,7 +49,8 @@ public static long doubleToSortableLong(double val) { /** * Converts a sortable long back to a double. - * + * @param val input double value + * @return output sortable long value * @see #doubleToSortableLong */ public static double sortableLongToDouble(long val) { @@ -63,7 +65,8 @@ public static double sortableLongToDouble(long val) { * is not reduced, but the value can easily used as an int. The sort order * (including {@link Float#NaN}) is defined by {@link Float#compareTo}; * {@code NaN} is greater than positive infinity. - * + * @param val input float value + * @return output sortable int value * @see #sortableIntToFloat */ public static int floatToSortableInt(float val) { @@ -72,7 +75,8 @@ public static int floatToSortableInt(float val) { /** * Converts a sortable int back to a float. - * + * @param val input int value + * @return output sortable float value * @see #floatToSortableInt */ public static float sortableIntToFloat(int val) { @@ -82,6 +86,8 @@ public static float sortableIntToFloat(int val) { /** * Converts IEEE 754 representation of a double to sortable order (or back * to the original) + * @param bits The long format of a double value + * @return The sortable long value */ public static long sortableDoubleBits(long bits) { return bits ^ (bits >> 63) & 0x7fffffffffffffffL; @@ -90,13 +96,13 @@ public static long sortableDoubleBits(long bits) { /** * Converts IEEE 754 representation of a float to sortable order (or back to * the original) + * @param bits The int format of an float value + * @return The sortable int value */ public static int sortableFloatBits(int bits) { return bits ^ (bits >> 31) & 0x7fffffff; } - /*************************************************************************/ - public static byte[] numberToSortableBytes(Number number) { if (number instanceof Long) { return longToBytes(number.longValue()); @@ -135,8 +141,6 @@ public static Number sortableBytesToNumber(byte[] bytes, Class clazz) { return null; } - /*************************************************************************/ - public static byte[] longToBytes(long value) { ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES); buffer.putLong(value); @@ -159,8 +163,6 @@ public static int bytesToInt(byte[] bytes) { return ByteBuffer.wrap(bytes).getInt(); } - /*************************************************************************/ - public static boolean isNumber(Object value) { if (value == null) { return false; @@ -172,8 +174,6 @@ public static boolean isNumber(Class clazz) { return Number.class.isAssignableFrom(clazz); } - /*************************************************************************/ - public static Object convertToNumber(Object value) { if (!isNumber(value) && value != null) { if (value instanceof Date) { @@ -191,6 +191,10 @@ public static Object convertToNumber(Object value) { * or it can be converted to a BigDecimal * @param first might be number or string * @param second must be number + * @return the value 0 if first is numerically equal to second; + * a value less than 0 if first is numerically less than + * second; and a value greater than 0 if first is + * numerically greater than second. */ @SuppressWarnings("unchecked") public static int compareNumber(Object first, Number second) { diff --git a/src/main/java/com/baidu/hugegraph/util/VersionUtil.java b/src/main/java/com/baidu/hugegraph/util/VersionUtil.java index 494ce4fc34..a6fd43ffae 100644 --- a/src/main/java/com/baidu/hugegraph/util/VersionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/VersionUtil.java @@ -27,7 +27,11 @@ public final class VersionUtil { /** - * Compare if a version is inside a range: begin <= version < end + * Compare if a version is inside a range [begin, end) + * @param version The version to be compared + * @param begin The lower bound of the range + * @param end The upper bound of the range + * @return true if belong to the range, otherwise false */ public static boolean match(Version version, String begin, String end) { E.checkArgumentNotNull(version, "The version to match is null"); @@ -38,6 +42,10 @@ public static boolean match(Version version, String begin, String end) { /** * Check whether a component version is matched expected range, * throw an exception if it's not matched. + * @param version The version to be checked + * @param begin The lower bound of the range + * @param end The upper bound of the range + * @param component The owner component of version */ public static void check(Version version, String begin, String end, String component) { @@ -48,6 +56,8 @@ public static void check(Version version, String begin, String end, /** * Get implementation version from manifest in jar + * @param clazz The class to be load from jar package + * @return The implementation version */ public static String getImplementationVersion(Class clazz) { /* From eed956d93119993d22e7a7856859f110e86f1bed Mon Sep 17 00:00:00 2001 From: zhangyi51 Date: Tue, 3 Jul 2018 16:37:31 +0800 Subject: [PATCH 075/217] hugegraph-81 add github link to README Change-Id: I16f47975372a5cb88b3890407a6e9d5fd79e19f9 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index db855b52dd..ab64c6dedd 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # hugegraph-common -hugegraph-common is a tool module for [HugeGraph]() and its peripheral components. +hugegraph-common is a tool module for [HugeGraph](https://github.com/hugegraph/hugegraph) and its peripheral components. hugegraph-common encapsulates locks, configurations, events, iterators, rest and some numeric or collection util classes to simplify the development of HugeGraph and its components. From 9db431015a6f6e68b2b6ce2c5e6d5d8ee8b06d51 Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Thu, 5 Jul 2018 21:48:07 +0800 Subject: [PATCH 076/217] HugeGraph-1336: move common tests from hugegraph-test to hugegraph-common Change-Id: Id6698c6fa83a0a9338e6dba02180bd8ce0e73c4d --- README.md | 2 +- build.sh | 3 +- pom.xml | 105 ++-- .../iterator/ExtendableIterator.java | 63 ++- .../hugegraph/iterator/FilterIterator.java | 2 +- .../iterator/FlatMapperFilterIterator.java | 2 +- .../iterator/FlatMapperIterator.java | 2 +- .../hugegraph/iterator/MapperIterator.java | 2 +- .../hugegraph/iterator/WrappedIterator.java | 25 +- .../com/baidu/hugegraph/testutil/Assert.java | 59 ++ .../baidu/hugegraph/testutil/Whitebox.java | 73 +++ .../com/baidu/hugegraph/util/NumericUtil.java | 15 +- .../baidu/hugegraph/unit/BaseUnitTest.java | 64 +++ .../baidu/hugegraph/unit/UnitTestSuite.java | 50 ++ .../hugegraph/unit/event/EventHubTest.java | 524 ++++++++++++++++++ .../unit/iterator/ExtendableIteratorTest.java | 234 ++++++++ .../unit/iterator/FilterIteratorTest.java | 169 ++++++ .../FlatMapperFilterIteratorTest.java | 187 +++++++ .../unit/iterator/FlatMapperIteratorTest.java | 181 ++++++ .../unit/iterator/MapperIteratorTest.java | 167 ++++++ .../baidu/hugegraph/unit/util/BytesTest.java | 127 +++++ .../hugegraph/unit/util/HashUtilTest.java | 71 +++ .../hugegraph/unit/util/VersionUtilTest.java | 105 ++++ 23 files changed, 2133 insertions(+), 99 deletions(-) create mode 100644 src/main/java/com/baidu/hugegraph/testutil/Assert.java create mode 100644 src/main/java/com/baidu/hugegraph/testutil/Whitebox.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/event/EventHubTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/iterator/ExtendableIteratorTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/iterator/FilterIteratorTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperIteratorTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/iterator/MapperIteratorTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/util/BytesTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/util/HashUtilTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java diff --git a/README.md b/README.md index ab64c6dedd..eaeac5efdb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # hugegraph-common -hugegraph-common is a tool module for [HugeGraph](https://github.com/hugegraph/hugegraph) and its peripheral components. +hugegraph-common is a common module for [HugeGraph](https://github.com/hugegraph/hugegraph) and its peripheral components. hugegraph-common encapsulates locks, configurations, events, iterators, rest and some numeric or collection util classes to simplify the development of HugeGraph and its components. diff --git a/build.sh b/build.sh index feefefa659..e6479e3f43 100644 --- a/build.sh +++ b/build.sh @@ -4,4 +4,5 @@ export MAVEN_HOME=/home/scmtools/buildkit/maven/apache-maven-3.3.9/ export JAVA_HOME=/home/scmtools/buildkit/java/jdk1.8.0_25/ export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH -mvn clean compile +mvn clean test -Dtest=UnitTestSuite + diff --git a/pom.xml b/pom.xml index fa6f2b1a0f..11c1fcbff0 100644 --- a/pom.xml +++ b/pom.xml @@ -6,12 +6,12 @@ com.baidu.hugegraph hugegraph-common - 1.4.6 + 1.4.7 hugegraph-common https://github.com/hugegraph/hugegraph-common - hugegraph-common is a tool module for HugeGraph and its peripheral components. + hugegraph-common is a common module for HugeGraph and its peripheral components. hugegraph-common encapsulates locks, configurations, events, iterators, rest and some numeric or collection util classes to simplify the development of HugeGraph and its components. @@ -67,9 +67,17 @@ 3.0.1 3.21.0-GA 2.25.1 + 4.12 + + + junit + junit + ${junit.version} + + org.apache.logging.log4j @@ -183,53 +191,62 @@ - 1.4.6.0 + 1.4.7.0 - - - org.apache.maven.plugins - maven-source-plugin - 2.2.1 - - - attach-sources - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.9.1 - - - attach-javadocs - - jar - - - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.5 - - - sign-artifacts - verify - - sign - - - - + + + + release + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9.1 + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + + + diff --git a/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java b/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java index 5f5e7536dd..0854847adc 100644 --- a/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java +++ b/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java @@ -23,19 +23,21 @@ import java.util.Deque; import java.util.Iterator; import java.util.List; -import java.util.NoSuchElementException; import java.util.concurrent.ConcurrentLinkedDeque; -import org.apache.commons.lang.NotImplementedException; +import com.baidu.hugegraph.util.E; public class ExtendableIterator extends WrappedIterator { private final Deque> itors; private final List> removedItors; + private Iterator currentIterator; + public ExtendableIterator() { - this.itors = new ConcurrentLinkedDeque>(); + this.itors = new ConcurrentLinkedDeque<>(); this.removedItors = new ArrayList<>(); + this.currentIterator = null; } public ExtendableIterator(Iterator itor) { @@ -49,34 +51,9 @@ public ExtendableIterator(Iterator itor1, Iterator itor2) { this.extend(itor2); } - @Override - public boolean hasNext() { - if (this.itors.isEmpty()) { - return false; - } - - Iterator first = null; - while ((first = this.itors.peekFirst()) != null && !first.hasNext()) { - if (first == this.itors.peekLast() && this.itors.size() == 1) { - // The last one - return false; - } - this.removedItors.add(this.itors.removeFirst()); - } - - assert first != null && first.hasNext(); - return true; - } - - @Override - public T next() { - if (this.itors.isEmpty()) { - throw new NoSuchElementException(); - } - return this.itors.peekFirst().next(); - } - public ExtendableIterator extend(Iterator itor) { + E.checkState(this.currentIterator == null, + "Can't extend iterator after iterating"); if (itor != null) { this.itors.addLast(itor); } @@ -99,11 +76,33 @@ public void close() throws Exception { @Override protected Iterator originIterator() { - return this.itors.peekLast(); + return this.currentIterator; } @Override protected boolean fetch() { - throw new NotImplementedException("ExtendableIterator.fetch()"); + assert this.current == none(); + if (this.itors.isEmpty()) { + return false; + } + + if (this.currentIterator != null && this.currentIterator.hasNext()) { + this.current = this.currentIterator.next(); + return true; + } + + Iterator first = null; + while ((first = this.itors.peekFirst()) != null && !first.hasNext()) { + if (first == this.itors.peekLast() && this.itors.size() == 1) { + // The last one + return false; + } + this.removedItors.add(this.itors.removeFirst()); + } + + assert first != null && first.hasNext(); + this.currentIterator = first; + this.current = this.currentIterator.next(); + return true; } } diff --git a/src/main/java/com/baidu/hugegraph/iterator/FilterIterator.java b/src/main/java/com/baidu/hugegraph/iterator/FilterIterator.java index e3247ffcb0..1dfc3abe78 100644 --- a/src/main/java/com/baidu/hugegraph/iterator/FilterIterator.java +++ b/src/main/java/com/baidu/hugegraph/iterator/FilterIterator.java @@ -43,7 +43,7 @@ protected final boolean fetch() { T next = this.originIterator.next(); // Do filter if (next != null && this.filterCallback.apply(next)) { - assert this.current == null; + assert this.current == none(); this.current = next; return true; } diff --git a/src/main/java/com/baidu/hugegraph/iterator/FlatMapperFilterIterator.java b/src/main/java/com/baidu/hugegraph/iterator/FlatMapperFilterIterator.java index 98b974c34a..6046dd25a0 100644 --- a/src/main/java/com/baidu/hugegraph/iterator/FlatMapperFilterIterator.java +++ b/src/main/java/com/baidu/hugegraph/iterator/FlatMapperFilterIterator.java @@ -41,7 +41,7 @@ protected final boolean fetchMapped() { while (this.results.hasNext()) { R result = this.results.next(); if (result != null && this.filterCallback.apply(result)) { - assert this.current == null; + assert this.current == none(); this.current = result; return true; } diff --git a/src/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java b/src/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java index 2d5175619d..9d50d79c5b 100644 --- a/src/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java +++ b/src/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java @@ -65,7 +65,7 @@ protected boolean fetchMapped() { while (this.results.hasNext()) { R result = this.results.next(); if (result != null) { - assert this.current == null; + assert this.current == none(); this.current = result; return true; } diff --git a/src/main/java/com/baidu/hugegraph/iterator/MapperIterator.java b/src/main/java/com/baidu/hugegraph/iterator/MapperIterator.java index 9c3eca00e1..f9930f5128 100644 --- a/src/main/java/com/baidu/hugegraph/iterator/MapperIterator.java +++ b/src/main/java/com/baidu/hugegraph/iterator/MapperIterator.java @@ -43,7 +43,7 @@ protected final boolean fetch() { T next = this.originIterator.next(); R result = this.mapperCallback.apply(next); if (result != null) { - assert this.current == null; + assert this.current == none(); this.current = result; return true; } diff --git a/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java b/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java index acf7a42316..30cf0725e2 100644 --- a/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java +++ b/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java @@ -22,20 +22,20 @@ import java.util.Iterator; import java.util.NoSuchElementException; -import com.baidu.hugegraph.util.E; - public abstract class WrappedIterator implements Iterator, AutoCloseable, Metadatable { + private static final Object NONE = new Object(); + protected R current; public WrappedIterator() { - this.current = null; + this.current = none(); } @Override public boolean hasNext() { - if (this.current != null) { + if (this.current != none()) { return true; } return this.fetch(); @@ -43,22 +43,24 @@ public boolean hasNext() { @Override public R next() { - if (this.current == null) { + if (this.current == none()) { this.fetch(); } - if (this.current == null) { + if (this.current == none()) { throw new NoSuchElementException(); } R current = this.current; - this.current = null; + this.current = none(); return current; } @Override public void remove() { Iterator iterator = this.originIterator(); - E.checkState(iterator != null, - "The origin iterator can't be null for removing"); + if (iterator == null) { + throw new NoSuchElementException( + "The origin iterator can't be null for removing"); + } iterator.remove(); } @@ -79,6 +81,11 @@ public Object metadata(String meta, Object... args) { throw new IllegalStateException("Original iterator is not Metadatable"); } + @SuppressWarnings("unchecked") + protected static final R none() { + return (R) NONE; + } + protected abstract Iterator originIterator(); protected abstract boolean fetch(); diff --git a/src/main/java/com/baidu/hugegraph/testutil/Assert.java b/src/main/java/com/baidu/hugegraph/testutil/Assert.java new file mode 100644 index 0000000000..c1d5c94fba --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/testutil/Assert.java @@ -0,0 +1,59 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.testutil; + +import java.util.function.Consumer; + +public class Assert extends org.junit.Assert { + + @FunctionalInterface + public interface ThrowableRunnable { + void run() throws Throwable; + } + + public static void assertThrows(Class throwable, + ThrowableRunnable runnable) { + assertThrows(throwable, runnable, e -> { + System.err.println(e); + }); + } + + public static void assertThrows(Class throwable, + ThrowableRunnable runnable, + Consumer exceptionConsumer) { + boolean fail = false; + try { + runnable.run(); + fail = true; + } catch (Throwable e) { + exceptionConsumer.accept(e); + if (!throwable.isInstance(e)) { + Assert.fail(String.format( + "Bad exception type %s(expect %s)", + e.getClass(), throwable)); + } + } + if (fail) { + Assert.fail(String.format( + "No exception was thrown(expect %s)", + throwable)); + } + } +} diff --git a/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java b/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java new file mode 100644 index 0000000000..1b90a5d014 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java @@ -0,0 +1,73 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.testutil; + +import java.lang.reflect.Field; + +public class Whitebox { + + public static void setInternalState(Object target, String fieldName, + Object value) { + try { + Field field = target.getClass().getDeclaredField(fieldName); + field.setAccessible(true); + field.set(target, value); + } catch (Exception e) { + Assert.fail(String.format("Can't change value of '%s' against " + + "target '%s'", fieldName, target)); + } + } + + public static Object getInternalState(Object target, String field) { + Class c = target.getClass(); + try { + Field f = getFieldFromHierarchy(c, field); + f.setAccessible(true); + return f.get(target); + } catch (Exception e) { + throw new RuntimeException( + "Unable to set internal state on a private field. " + + "Please report to mockito mailing list.", e); + } + } + + private static Field getFieldFromHierarchy(Class clazz, String field) { + Field f = getField(clazz, field); + while (f == null && clazz != Object.class) { + clazz = clazz.getSuperclass(); + f = getField(clazz, field); + } + if (f == null) { + throw new RuntimeException(String.format( + "You want to set value to field '%s' on class '%s' " + + "but this field is not declared in the class!", + field, clazz.getSimpleName())); + } + return f; + } + + private static Field getField(Class clazz, String field) { + try { + return clazz.getDeclaredField(field); + } catch (NoSuchFieldException e) { + return null; + } + } +} diff --git a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java index 9edfbdaff2..16127c8d2f 100644 --- a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java @@ -23,8 +23,8 @@ import java.util.function.Function; /** - * This file is copied verbatim from Apache Lucene NumericUtils.java Only the - * double/float to sortable long/int conversions are retained. + * This file is copied verbatim from Apache Lucene NumericUtils.java + * Only the double/float to sortable long/int conversions are retained. */ public final class NumericUtil { @@ -189,12 +189,11 @@ public static Object convertToNumber(Object value) { /** * Compare object with a number, the object should be a number, * or it can be converted to a BigDecimal - * @param first might be number or string - * @param second must be number - * @return the value 0 if first is numerically equal to second; - * a value less than 0 if first is numerically less than - * second; and a value greater than 0 if first is - * numerically greater than second. + * @param first might be number or string + * @param second must be number + * @return 0 if first is numerically equal to second; + * a negative int if first is numerically less than second; + * a positive int if first is numerically greater than second. */ @SuppressWarnings("unchecked") public static int compareNumber(Object first, Number second) { diff --git a/src/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java b/src/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java new file mode 100644 index 0000000000..707b619197 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java @@ -0,0 +1,64 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +import org.junit.AfterClass; +import org.junit.BeforeClass; + +import com.baidu.hugegraph.util.TimeUtil; + +public class BaseUnitTest { + + @BeforeClass + public static void init() { + // pass + } + + @AfterClass + public static void clear() throws Exception { + // pass + } + + protected static final void runWithThreads(int threads, Runnable task) { + ExecutorService executor = Executors.newFixedThreadPool(threads); + List> futures = new ArrayList<>(); + for (int i = 0; i < threads; i++) { + futures.add(executor.submit(task)); + } + for (Future future : futures) { + try { + future.get(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + } + } + + protected static final void waitTillNext(long seconds) { + TimeUtil.tillNextMillis(TimeUtil.timeGen() + seconds * 1000); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java new file mode 100644 index 0000000000..e567b31e6f --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -0,0 +1,50 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +import com.baidu.hugegraph.unit.event.EventHubTest; +import com.baidu.hugegraph.unit.iterator.ExtendableIteratorTest; +import com.baidu.hugegraph.unit.iterator.FilterIteratorTest; +import com.baidu.hugegraph.unit.iterator.FlatMapperFilterIteratorTest; +import com.baidu.hugegraph.unit.iterator.FlatMapperIteratorTest; +import com.baidu.hugegraph.unit.iterator.MapperIteratorTest; +import com.baidu.hugegraph.unit.util.BytesTest; +import com.baidu.hugegraph.unit.util.HashUtilTest; +import com.baidu.hugegraph.unit.util.VersionUtilTest; + +@RunWith(Suite.class) +@Suite.SuiteClasses({ + EventHubTest.class, + + ExtendableIteratorTest.class, + FilterIteratorTest.class, + MapperIteratorTest.class, + FlatMapperIteratorTest.class, + FlatMapperFilterIteratorTest.class, + + BytesTest.class, + HashUtilTest.class, + VersionUtilTest.class +}) +public class UnitTestSuite { +} diff --git a/src/test/java/com/baidu/hugegraph/unit/event/EventHubTest.java b/src/test/java/com/baidu/hugegraph/unit/event/EventHubTest.java new file mode 100644 index 0000000000..b9f9188e83 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/event/EventHubTest.java @@ -0,0 +1,524 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.event; + +import java.util.concurrent.atomic.AtomicInteger; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.baidu.hugegraph.event.Event; +import com.baidu.hugegraph.event.EventHub; +import com.baidu.hugegraph.event.EventListener; +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; +import com.google.common.collect.ImmutableList; + +public class EventHubTest extends BaseUnitTest { + + private static final int THREADS_NUM = 8; + + private EventHub eventHub = null; + + @BeforeClass + public static void init() { + EventHub.init(THREADS_NUM); + } + + @AfterClass + public static void clear() throws InterruptedException { + EventHub.destroy(30); + } + + @Before + public void setup() { + this.eventHub = new EventHub("test"); + Assert.assertEquals("test", this.eventHub.name()); + } + + @After + public void teardown() { + this.eventHub = null; + } + + private void wait100ms() { + try { + Thread.sleep(100); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + } + + @Test + public void testEventGetListenerNonResult() { + Assert.assertFalse(this.eventHub.containsListener("not-exist")); + Assert.assertEquals(0, this.eventHub.listeners("not-exist").size()); + } + + @Test + public void testEventAddListener() { + final String event = "event-test"; + + EventListener listener = new EventListener() { + @Override + public Object event(Event arg0) { + return null; + } + }; + + this.eventHub.listen(event, listener); + + Assert.assertTrue(this.eventHub.containsListener(event)); + Assert.assertEquals(1, this.eventHub.listeners(event).size()); + Assert.assertEquals(listener, this.eventHub.listeners(event).get(0)); + } + + @Test + public void testEventAddListenerTwice() { + final String event = "event-test"; + + EventListener listener = new EventListener() { + @Override + public Object event(Event arg0) { + return null; + } + }; + + this.eventHub.listen(event, listener); + this.eventHub.listen(event, listener); + + Assert.assertTrue(this.eventHub.containsListener(event)); + Assert.assertEquals(2, this.eventHub.listeners(event).size()); + Assert.assertEquals(listener, this.eventHub.listeners(event).get(0)); + Assert.assertEquals(listener, this.eventHub.listeners(event).get(1)); + } + + @Test + public void testEventRemoveListener() { + final String event = "event-test"; + + EventListener listener = new EventListener() { + @Override + public Object event(Event arg0) { + return null; + } + }; + + this.eventHub.listen(event, listener); + + Assert.assertTrue(this.eventHub.containsListener(event)); + Assert.assertEquals(1, this.eventHub.listeners(event).size()); + Assert.assertEquals(listener, this.eventHub.listeners(event).get(0)); + + Assert.assertEquals(1, this.eventHub.unlisten(event, listener)); + + Assert.assertFalse(this.eventHub.containsListener(event)); + Assert.assertEquals(0, this.eventHub.listeners(event).size()); + } + + @Test + public void testEventRemoveListenerButNonResult() { + final String event = "event-test"; + + EventListener listener = new EventListener() { + @Override + public Object event(Event arg0) { + return null; + } + }; + + this.eventHub.listen(event, listener); + + Assert.assertTrue(this.eventHub.containsListener(event)); + Assert.assertEquals(1, this.eventHub.listeners(event).size()); + Assert.assertEquals(listener, this.eventHub.listeners(event).get(0)); + + Assert.assertEquals(0, this.eventHub.unlisten(event, null)); + Assert.assertEquals(0, this.eventHub.unlisten("event-fake", listener)); + + Assert.assertTrue(this.eventHub.containsListener(event)); + Assert.assertEquals(1, this.eventHub.listeners(event).size()); + Assert.assertEquals(listener, this.eventHub.listeners(event).get(0)); + } + + @Test + public void testEventRemoveListenerOfOneInTwo() { + final String event1 = "event-test1"; + final String event2 = "event-test2"; + + EventListener listener = new EventListener() { + @Override + public Object event(Event arg0) { + return null; + } + }; + + this.eventHub.listen(event1, listener); + this.eventHub.listen(event2, listener); + + Assert.assertTrue(this.eventHub.containsListener(event1)); + Assert.assertEquals(1, this.eventHub.listeners(event1).size()); + Assert.assertEquals(listener, this.eventHub.listeners(event1).get(0)); + + Assert.assertTrue(this.eventHub.containsListener(event2)); + Assert.assertEquals(1, this.eventHub.listeners(event2).size()); + Assert.assertEquals(listener, this.eventHub.listeners(event2).get(0)); + + Assert.assertEquals(1, this.eventHub.unlisten(event1, listener)); + + Assert.assertFalse(this.eventHub.containsListener(event1)); + Assert.assertFalse(this.eventHub.containsListener(event1)); + Assert.assertEquals(0, this.eventHub.listeners(event1).size()); + + Assert.assertTrue(this.eventHub.containsListener(event2)); + Assert.assertEquals(1, this.eventHub.listeners(event2).size()); + Assert.assertEquals(listener, this.eventHub.listeners(event2).get(0)); + } + + @Test + public void testEventRemoveListenerByEvent() { + final String event = "event-test"; + + EventListener listener1 = new EventListener() { + @Override + public Object event(Event arg0) { + return null; + } + }; + + EventListener listener2 = new EventListener() { + @Override + public Object event(Event arg0) { + return null; + } + }; + + this.eventHub.listen(event, listener1); + this.eventHub.listen(event, listener2); + + Assert.assertTrue(this.eventHub.containsListener(event)); + Assert.assertEquals(2, this.eventHub.listeners(event).size()); + Assert.assertEquals(listener1, this.eventHub.listeners(event).get(0)); + Assert.assertEquals(listener2, this.eventHub.listeners(event).get(1)); + + Assert.assertEquals(2, this.eventHub.unlisten(event).size()); + + Assert.assertFalse(this.eventHub.containsListener(event)); + Assert.assertEquals(0, this.eventHub.listeners(event).size()); + } + + @Test + public void testEventRemoveListenerByEventButNonResult() { + final String event = "event-test"; + + EventListener listener1 = new EventListener() { + @Override + public Object event(Event arg0) { + return null; + } + }; + + EventListener listener2 = new EventListener() { + @Override + public Object event(Event arg0) { + return null; + } + }; + + this.eventHub.listen(event, listener1); + this.eventHub.listen(event, listener2); + + Assert.assertTrue(this.eventHub.containsListener(event)); + Assert.assertEquals(2, this.eventHub.listeners(event).size()); + Assert.assertEquals(listener1, this.eventHub.listeners(event).get(0)); + Assert.assertEquals(listener2, this.eventHub.listeners(event).get(1)); + + Assert.assertEquals(0, this.eventHub.unlisten("event-fake").size()); + + Assert.assertEquals(2, this.eventHub.listeners(event).size()); + } + + @Test + public void testEventRemoveListenerByEventOf2SameListener() { + final String event = "event-test"; + + EventListener listener = new EventListener() { + @Override + public Object event(Event arg0) { + return null; + } + }; + + this.eventHub.listen(event, listener); + this.eventHub.listen(event, listener); + + Assert.assertTrue(this.eventHub.containsListener(event)); + Assert.assertEquals(2, this.eventHub.listeners(event).size()); + Assert.assertEquals(listener, this.eventHub.listeners(event).get(0)); + + Assert.assertEquals(2, this.eventHub.unlisten(event, listener)); + + Assert.assertFalse(this.eventHub.containsListener(event)); + Assert.assertEquals(0, this.eventHub.listeners(event).size()); + } + + @Test + public void testEventCallWithoutArg() { + final String call = "event-call"; + + this.eventHub.listen(call, event -> { + Assert.assertEquals(call, event.name()); + Assert.assertEquals(0, event.args().length); + return "fake-event-result"; + }); + + Assert.assertEquals("fake-event-result", this.eventHub.call(call)); + } + + @Test + public void testEventCallWithArg1() { + final String call = "event-call"; + + this.eventHub.listen(call, event -> { + Assert.assertEquals(call, event.name()); + + event.checkArgs(Float.class); + + Object[] args = event.args(); + Assert.assertEquals(1, args.length); + Assert.assertEquals(3.14f, args[0]); + + return "fake-event-result"; + }); + + Assert.assertEquals("fake-event-result", + this.eventHub.call(call, 3.14f)); + } + + @Test + public void testEventCallWithArg2() { + final String call = "event-call"; + + this.eventHub.listen(call, event -> { + Assert.assertEquals(call, event.name()); + + event.checkArgs(String.class, Integer.class); + + Object[] args = event.args(); + Assert.assertEquals(2, args.length); + Assert.assertEquals("fake-arg0", args[0]); + Assert.assertEquals(123, args[1]); + + return "fake-event-result"; + }); + + Assert.assertEquals("fake-event-result", + this.eventHub.call(call, "fake-arg0", 123)); + } + + @Test + public void testEventCallWithArg2ButArgNotMatched() { + final String call = "event-call"; + + this.eventHub.listen(call, event -> { + Assert.assertEquals(call, event.name()); + + event.checkArgs(String.class, Integer.class); + + Object[] args = event.args(); + Assert.assertEquals(2, args.length); + Assert.assertEquals("fake-arg0", args[0]); + Assert.assertEquals(123, args[1]); + + return "fake-event-result"; + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + this.eventHub.call(call, "fake-arg0"); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + this.eventHub.call(call, "fake-arg0", 123, "456"); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + this.eventHub.call(call, 123, "fake-arg0"); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + this.eventHub.call(call, "fake-arg0", 123f); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + this.eventHub.call(call, "fake-arg0", "123"); + }); + } + + @Test + public void testEventNotify() { + final String notify = "event-notify"; + AtomicInteger count = new AtomicInteger(); + + this.eventHub.listen(notify, event -> { + Assert.assertEquals(notify, event.name()); + Assert.assertEquals(0, event.args().length); + count.incrementAndGet(); + return true; + }); + + this.eventHub.notify(notify); + + // Maybe should improve + this.wait100ms(); + + Assert.assertEquals(1, count.get()); + } + + @Test + public void testEventNotifyAny() { + AtomicInteger count = new AtomicInteger(); + + this.eventHub.listen(EventHub.ANY_EVENT, event -> { + Assert.assertTrue(ImmutableList.of("event1", "event2") + .contains(event.name())); + Assert.assertEquals(0, event.args().length); + count.incrementAndGet(); + return true; + }); + + this.eventHub.notify("event1"); + this.eventHub.notify("event2"); + + // Maybe should improve + this.wait100ms(); + + Assert.assertEquals(2, count.get()); + } + + @Test + public void testEventNotifyWithArg2() { + final String notify = "event-notify"; + AtomicInteger count = new AtomicInteger(); + + this.eventHub.listen(notify, event -> { + Assert.assertEquals(notify, event.name()); + + event.checkArgs(String.class, Integer.class); + + Object[] args = event.args(); + Assert.assertEquals("fake-arg0", args[0]); + Assert.assertEquals(123, args[1]); + + count.incrementAndGet(); + return true; + }); + + this.eventHub.notify(notify, "fake-arg0", 123); + + // Maybe should improve + this.wait100ms(); + + Assert.assertEquals(1, count.get()); + } + + @Test + public void testEventNotifyWithMultiThreads() throws InterruptedException { + final String notify = "event-notify"; + + EventListener listener1 = new EventListener() { + @Override + public Object event(Event event) { + Assert.assertEquals(notify, event.name()); + event.checkArgs(Integer.class); + return null; + } + }; + + EventListener listener2 = new EventListener() { + @Override + public Object event(Event event) { + Assert.assertEquals(notify, event.name()); + + event.checkArgs(Integer.class); + int i = (int) event.args()[0]; + if (i % 100000 == 0) { + System.out.println("On event '" + notify + "': " + i); + } + return null; + } + }; + + Thread listenerUpdateThread = new Thread(() -> { + // This will cost about 10s + for (int i = 0; i < 100; i++) { + this.eventHub.listen(notify, listener1); + if (!this.eventHub.listeners(notify).contains(listener2)) { + this.eventHub.listen(notify, listener2); + } + + this.wait100ms(); + + if (i % 10 == 0) { + this.eventHub.unlisten(notify); + } else { + this.eventHub.unlisten(notify, listener1); + } + } + }); + listenerUpdateThread.start(); + + runWithThreads(THREADS_NUM, () -> { + // This will cost about 10s ~ 20s + for (int i = 0; i < 10000 * 100; i++) { + this.eventHub.notify(notify, i); + Thread.yield(); + } + }); + + listenerUpdateThread.join(); + } + + @Test + public void testEventCallWithMultiThreads() { + final String call = "event-call"; + + EventListener listener = new EventListener() { + @Override + public Object event(Event event) { + Assert.assertEquals(call, event.name()); + + event.checkArgs(Integer.class); + int i = (int) event.args()[0]; + return i; + } + }; + + this.eventHub.listen(call, listener); + + runWithThreads(THREADS_NUM, () -> { + for (int i = 0; i < 10000 * 1000; i++) { + Assert.assertEquals(i, this.eventHub.call(call, i)); + } + }); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/ExtendableIteratorTest.java b/src/test/java/com/baidu/hugegraph/unit/iterator/ExtendableIteratorTest.java new file mode 100644 index 0000000000..2a4cf2d7aa --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/iterator/ExtendableIteratorTest.java @@ -0,0 +1,234 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.iterator; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; + +import org.junit.Test; + +import com.baidu.hugegraph.iterator.ExtendableIterator; +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; +import com.google.common.collect.ImmutableList; + +@SuppressWarnings("resource") +public class ExtendableIteratorTest extends BaseUnitTest { + + private static final List DATA1 = ImmutableList.of(1); + private static final List DATA2 = ImmutableList.of(2, 3); + private static final List DATA3 = ImmutableList.of(4, 5, 6); + + @Test + public void testConcatTwoIterators() { + Iterator results = new ExtendableIterator<>(DATA1.iterator(), + DATA2.iterator()); + + List actual = new ArrayList<>(); + while (results.hasNext()) { + actual.add(results.next()); + } + + Assert.assertEquals(3, actual.size()); + Assert.assertEquals(ImmutableList.of(1, 2, 3), actual); + } + + @Test + public void testExtendIterators() { + ExtendableIterator results = new ExtendableIterator<>(); + results.extend(DATA1.iterator()) + .extend(DATA2.iterator()) + .extend(DATA3.iterator()); + + List actual = new ArrayList<>(); + while (results.hasNext()) { + actual.add(results.next()); + } + + Assert.assertEquals(6, actual.size()); + Assert.assertEquals(ImmutableList.of(1, 2, 3, 4, 5, 6), actual); + } + + @Test + public void testHasNext() { + Iterator results = new ExtendableIterator<>(DATA1.iterator()); + Assert.assertTrue(results.hasNext()); + Assert.assertTrue(results.hasNext()); + } + + @Test + public void testExtendAfterHasNext() { + ExtendableIterator results = new ExtendableIterator<>( + DATA1.iterator()); + Assert.assertTrue(results.hasNext()); + Assert.assertThrows(IllegalStateException.class, () -> { + results.extend(DATA2.iterator()); + }); + } + + @Test + public void testNext() { + Iterator results = new ExtendableIterator<>(DATA1.iterator()); + Assert.assertEquals(1, (int) results.next()); + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + } + + @Test + public void testNextWithMultiTimes() { + Iterator results = new ExtendableIterator<>(DATA1.iterator(), + DATA2.iterator()); + Assert.assertEquals(1, (int) results.next()); + Assert.assertEquals(2, (int) results.next()); + Assert.assertEquals(3, (int) results.next()); + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + } + + @Test + public void testHasNextAndNext() { + Iterator results = new ExtendableIterator<>(DATA1.iterator()); + Assert.assertTrue(results.hasNext()); + Assert.assertTrue(results.hasNext()); + Assert.assertEquals(1, (int) results.next()); + Assert.assertFalse(results.hasNext()); + Assert.assertFalse(results.hasNext()); + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + } + + @Test + public void testRemove() { + List list1 = new ArrayList<>(DATA1); + List list3 = new ArrayList<>(DATA3); + Iterator results = new ExtendableIterator<>( + list1.iterator(), list3.iterator()); + + Assert.assertEquals(ImmutableList.of(1), list1); + Assert.assertEquals(ImmutableList.of(4, 5, 6), list3); + + results.next(); + results.remove(); + + results.next(); + results.next(); + results.remove(); + + Assert.assertEquals(0, list1.size()); + Assert.assertEquals(ImmutableList.of(4, 6), list3); + } + + @Test + public void testRemoveWithoutResult() { + Iterator results = new ExtendableIterator<>(); + Assert.assertThrows(NoSuchElementException.class, () -> { + results.remove(); + }); + + List list = new ArrayList<>(); + Iterator results2 = new ExtendableIterator<>(list.iterator()); + Assert.assertThrows(NoSuchElementException.class, () -> { + results2.remove(); + }); + } + + @Test + public void testClose() throws Exception { + CloseableItor c1 = new CloseableItor<>(DATA1.iterator()); + CloseableItor c2 = new CloseableItor<>(DATA2.iterator()); + CloseableItor c3 = new CloseableItor<>(DATA3.iterator()); + + ExtendableIterator results = new ExtendableIterator<>(); + results.extend(c1).extend(c2).extend(c3); + + Assert.assertFalse(c1.closed()); + Assert.assertFalse(c2.closed()); + Assert.assertFalse(c3.closed()); + + results.close(); + + Assert.assertTrue(c1.closed()); + Assert.assertTrue(c2.closed()); + Assert.assertTrue(c3.closed()); + } + + @Test + public void testCloseAfterNext() throws Exception { + CloseableItor c1 = new CloseableItor<>(DATA1.iterator()); + CloseableItor c2 = new CloseableItor<>(DATA2.iterator()); + CloseableItor c3 = new CloseableItor<>(DATA3.iterator()); + + ExtendableIterator results = new ExtendableIterator<>(); + results.extend(c1).extend(c2).extend(c3); + + Assert.assertFalse(c1.closed()); + Assert.assertFalse(c2.closed()); + Assert.assertFalse(c3.closed()); + + while (results.hasNext()) { + results.next(); + } + + Assert.assertFalse(c1.closed()); + Assert.assertFalse(c2.closed()); + Assert.assertFalse(c3.closed()); + + results.close(); + + Assert.assertTrue(c1.closed()); + Assert.assertTrue(c2.closed()); + Assert.assertTrue(c3.closed()); + } + + protected static class CloseableItor implements Iterator, + AutoCloseable { + + private final Iterator itor; + private boolean closed = false; + + public CloseableItor(Iterator itor) { + this.itor = itor; + } + + @Override + public boolean hasNext() { + return this.itor.hasNext(); + } + + @Override + public V next() { + return this.itor.next(); + } + + @Override + public void close() throws Exception { + this.closed = true; + } + + public boolean closed() { + return this.closed; + } + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/FilterIteratorTest.java b/src/test/java/com/baidu/hugegraph/unit/iterator/FilterIteratorTest.java new file mode 100644 index 0000000000..4f3ec6cbd1 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/iterator/FilterIteratorTest.java @@ -0,0 +1,169 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.iterator; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Function; + +import org.junit.Test; + +import com.baidu.hugegraph.iterator.FilterIterator; +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; +import com.baidu.hugegraph.unit.iterator.ExtendableIteratorTest.CloseableItor; +import com.google.common.collect.ImmutableList; + +@SuppressWarnings("resource") +public class FilterIteratorTest extends BaseUnitTest { + + private static final List DATA = ImmutableList.of(1, 2, 3, 4); + + @Test + public void testFilter() { + + AtomicInteger valuesCount = new AtomicInteger(0); + + Iterator values = DATA.iterator(); + + Function filter = value -> { + valuesCount.incrementAndGet(); + return (value % 2 == 0); + }; + + Iterator results = new FilterIterator<>(values, filter); + + List actual = new ArrayList<>(); + while (results.hasNext()) { + actual.add(results.next()); + } + + Assert.assertEquals(4, valuesCount.get()); + Assert.assertEquals(ImmutableList.of(2, 4), actual); + } + + @Test + public void testHasNext() { + Iterator vals = DATA.iterator(); + + Iterator results = new FilterIterator<>(vals, val -> true); + Assert.assertTrue(results.hasNext()); + } + + @Test + public void testHasNextWithMultiTimesWithoutAnyResult() { + Iterator vals = DATA.iterator(); + + Iterator results = new FilterIterator<>(vals, val -> false); + Assert.assertFalse(results.hasNext()); + Assert.assertFalse(results.hasNext()); + } + + @Test + public void testHasNextAndNextWithMultiTimes() { + Iterator vals = DATA.iterator(); + + Iterator results = new FilterIterator<>(vals, val -> true); + + for (int i = 0; i < 5; i++) { + Assert.assertTrue(results.hasNext()); + } + + for (int i = 0; i < 4; i++) { + results.next(); + } + + Assert.assertFalse(results.hasNext()); + Assert.assertFalse(results.hasNext()); + + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + } + + @Test + public void testNext() { + Iterator vals = DATA.iterator(); + + Iterator results = new FilterIterator<>(vals, val -> true); + // Call next() without testNext() + results.next(); + } + + @Test + public void testNextWithMultiTimes() { + Iterator vals = DATA.iterator(); + + Iterator results = new FilterIterator<>(vals, val -> true); + for (int i = 0; i < 4; i++) { + results.next(); + } + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + } + + @Test + public void testNextWithMultiTimesWithoutAnyResult() { + Iterator vals = DATA.iterator(); + + Iterator results = new FilterIterator<>(vals, val -> false); + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + } + + @Test + public void testRemove() { + List list = new ArrayList<>(DATA); + + Iterator results = new FilterIterator<>(list.iterator(), + val -> true); + + Assert.assertEquals(ImmutableList.of(1, 2, 3, 4), list); + + results.next(); + results.next(); + results.remove(); + + Assert.assertEquals(ImmutableList.of(1, 3, 4), list); + } + + @Test + public void testClose() throws Exception { + CloseableItor vals = new CloseableItor<>(DATA.iterator()); + + FilterIterator results = new FilterIterator<>(vals, + val -> true); + + Assert.assertFalse(vals.closed()); + results.close(); + Assert.assertTrue(vals.closed()); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java b/src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java new file mode 100644 index 0000000000..bc69bf55ed --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java @@ -0,0 +1,187 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.iterator; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Function; + +import org.junit.Test; + +import com.baidu.hugegraph.iterator.FlatMapperFilterIterator; +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; +import com.baidu.hugegraph.unit.iterator.ExtendableIteratorTest.CloseableItor; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; + +@SuppressWarnings("resource") +public class FlatMapperFilterIteratorTest extends BaseUnitTest { + + private static final Map> DATA = ImmutableMap.of( + "first", ImmutableList.of(11), + "second", ImmutableList.of(21, 22), + "third", ImmutableList.of(31, 32, 33), + "forth", ImmutableList.of(41, 42, 43, 44) + ); + + @Test + public void testMapperFilter() { + + AtomicInteger keysCount = new AtomicInteger(0); + AtomicInteger valuesCount = new AtomicInteger(0); + + Iterator keys = DATA.keySet().iterator(); + + Function> mapper = key -> { + keysCount.incrementAndGet(); + + return DATA.get(key).iterator(); + }; + + Function filter = value -> { + valuesCount.incrementAndGet(); + + double f = value / 11F; + return (f == (int) f); + }; + + Iterator results = new FlatMapperFilterIterator<>(keys, + mapper, + filter); + + List actual = new ArrayList<>(); + while (results.hasNext()) { + actual.add(results.next()); + } + + Assert.assertEquals(4, keysCount.get()); + Assert.assertEquals(10, valuesCount.get()); + Assert.assertEquals(ImmutableList.of(11, 22, 33, 44), actual); + } + + @Test + public void testHasNext() { + Iterator keys = DATA.keySet().iterator(); + + Iterator results = new FlatMapperFilterIterator<>(keys, + key -> DATA.get(key).iterator(), + val -> true); + Assert.assertTrue(results.hasNext()); + + Iterator results2 = new FlatMapperFilterIterator<>(keys, + key -> DATA.get(key).iterator(), + val -> false); + Assert.assertFalse(results2.hasNext()); + Assert.assertThrows(NoSuchElementException.class, () -> { + results2.next(); + }); + } + + @Test + public void testHasNextWithMultiTimes() { + Iterator keys = DATA.keySet().iterator(); + + Iterator results = new FlatMapperFilterIterator<>(keys, + key -> DATA.get(key).iterator(), + val -> true); + for (int i = 0; i < 12; i++) { + Assert.assertTrue(results.hasNext()); + } + for (int i = 0; i < 10; i++) { + results.next(); + } + Assert.assertFalse(results.hasNext()); + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + + Iterator results2 = new FlatMapperFilterIterator<>(keys, + key -> DATA.get(key).iterator(), + val -> false); + Assert.assertFalse(results2.hasNext()); + Assert.assertFalse(results2.hasNext()); + } + + @Test + public void testNext() { + Iterator keys = DATA.keySet().iterator(); + + Iterator results = new FlatMapperFilterIterator<>(keys, + key -> DATA.get(key).iterator(), + val -> true); + // Call next() without hasNext() + results.next(); + + Iterator results2 = new FlatMapperFilterIterator<>(keys, + key -> DATA.get(key).iterator(), + val -> false); + Assert.assertThrows(NoSuchElementException.class, () -> { + results2.next(); + }); + } + + @Test + public void testNextWithMultiTimes() { + Iterator keys = DATA.keySet().iterator(); + + Iterator results = new FlatMapperFilterIterator<>(keys, + key -> DATA.get(key).iterator(), + val -> true); + for (int i = 0; i < 10; i++) { + results.next(); + } + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + + Iterator results2 = new FlatMapperFilterIterator<>(keys, + key -> DATA.get(key).iterator(), + val -> false); + Assert.assertThrows(NoSuchElementException.class, () -> { + results2.next(); + }); + Assert.assertThrows(NoSuchElementException.class, () -> { + results2.next(); + }); + } + + @Test + public void testClose() throws Exception { + CloseableItor vals = new CloseableItor<>( + DATA.keySet().iterator()); + + FlatMapperFilterIterator results; + results = new FlatMapperFilterIterator<>(vals, + k -> DATA.get(k).iterator(), + val -> true); + + Assert.assertFalse(vals.closed()); + results.close(); + Assert.assertTrue(vals.closed()); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperIteratorTest.java b/src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperIteratorTest.java new file mode 100644 index 0000000000..9745029642 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperIteratorTest.java @@ -0,0 +1,181 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.iterator; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Function; + +import org.junit.Test; + +import com.baidu.hugegraph.iterator.FlatMapperIterator; +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; +import com.baidu.hugegraph.unit.iterator.ExtendableIteratorTest.CloseableItor; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; + +@SuppressWarnings("resource") +public class FlatMapperIteratorTest extends BaseUnitTest { + + private static final Map> DATA = ImmutableMap.of( + "first", ImmutableList.of(11), + "second", ImmutableList.of(21, 22), + "third", ImmutableList.of(31, 32, 33), + "forth", ImmutableList.of(41, 42, 43, 44) + ); + + private static final Function> MAPPER = key -> { + List value = DATA.get(key); + if (value == null) { + return ImmutableList.of().iterator(); + } + return value.iterator(); + }; + + @Test + public void testFlatMapper() { + + AtomicInteger keysCount = new AtomicInteger(0); + + Iterator keys = DATA.keySet().iterator(); + + Function> mapper = key -> { + keysCount.incrementAndGet(); + + return DATA.get(key).iterator(); + }; + + Iterator results = new FlatMapperIterator<>(keys, mapper); + + List actual = new ArrayList<>(); + while (results.hasNext()) { + actual.add(results.next()); + } + + List expected = ImmutableList.of(11, + 21, 22, + 31, 32, 33, + 41, 42, 43, 44); + Assert.assertEquals(4, keysCount.get()); + Assert.assertEquals(expected, actual); + } + + @Test + public void testHasNext() { + Iterator keys = DATA.keySet().iterator(); + + Iterator results = new FlatMapperIterator<>(keys, MAPPER); + Assert.assertTrue(results.hasNext()); + } + + @Test + public void testHasNextAndNextWithMultiTimes() { + Iterator keys = DATA.keySet().iterator(); + + Iterator results = new FlatMapperIterator<>(keys, MAPPER); + + for (int i = 0; i < 12; i++) { + Assert.assertTrue(results.hasNext()); + } + + for (int i = 0; i < 10; i++) { + results.next(); + } + + Assert.assertFalse(results.hasNext()); + Assert.assertFalse(results.hasNext()); + + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + } + + @Test + public void testNext() { + Iterator keys = DATA.keySet().iterator(); + + Iterator results = new FlatMapperIterator<>(keys, MAPPER); + // Call next() without hasNext() + results.next(); + } + + @Test + public void testNextWithMultiTimes() { + Iterator keys = DATA.keySet().iterator(); + + Iterator results = new FlatMapperIterator<>(keys, MAPPER); + for (int i = 0; i < 10; i++) { + results.next(); + } + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + } + + @Test + public void testMapperReturnNullThenHasNext() { + Iterator keys = ImmutableList.of("fifth").iterator(); + + Iterator results = new FlatMapperIterator<>(keys, key -> { + Assert.assertNull(DATA.get(key)); + return null; + }); + Assert.assertFalse(results.hasNext()); + Assert.assertFalse(results.hasNext()); + } + + @Test + public void testMapperReturnNullThenNext() { + Iterator keys = ImmutableList.of("fifth").iterator(); + + Iterator results = new FlatMapperIterator<>(keys, key -> { + Assert.assertNull(DATA.get(key)); + return null; + }); + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + } + + @Test + public void testClose() throws Exception { + CloseableItor vals = new CloseableItor<>( + DATA.keySet().iterator()); + + FlatMapperIterator results; + results = new FlatMapperIterator<>(vals, + key -> DATA.get(key).iterator()); + + Assert.assertFalse(vals.closed()); + results.close(); + Assert.assertTrue(vals.closed()); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/MapperIteratorTest.java b/src/test/java/com/baidu/hugegraph/unit/iterator/MapperIteratorTest.java new file mode 100644 index 0000000000..e2c63ed657 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/iterator/MapperIteratorTest.java @@ -0,0 +1,167 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.iterator; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Function; + +import org.junit.Test; + +import com.baidu.hugegraph.iterator.MapperIterator; +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; +import com.baidu.hugegraph.unit.iterator.ExtendableIteratorTest.CloseableItor; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; + +@SuppressWarnings("resource") +public class MapperIteratorTest extends BaseUnitTest { + + private static final Map DATA = ImmutableMap.of( + "first", 1, + "second", 2, + "third", 3, + "forth", 4 + ); + + private static final Function MAPPER = key -> { + return DATA.get(key); + }; + + @Test + public void testMapper() { + + AtomicInteger keysCount = new AtomicInteger(0); + + Iterator keys = DATA.keySet().iterator(); + + Function mapper = key -> { + keysCount.incrementAndGet(); + + return DATA.get(key); + }; + + Iterator results = new MapperIterator<>(keys, mapper); + + List actual = new ArrayList<>(); + while (results.hasNext()) { + actual.add(results.next()); + } + + List expected = ImmutableList.of(1, 2, 3, 4); + Assert.assertEquals(4, keysCount.get()); + Assert.assertEquals(expected, actual); + } + + @Test + public void testHasNext() { + Iterator keys = DATA.keySet().iterator(); + + Iterator results = new MapperIterator<>(keys, MAPPER); + Assert.assertTrue(results.hasNext()); + } + + @Test + public void testHasNextAndNextWithMultiTimes() { + Iterator keys = DATA.keySet().iterator(); + + Iterator results = new MapperIterator<>(keys, MAPPER); + + for (int i = 0; i < 5; i++) { + Assert.assertTrue(results.hasNext()); + } + + for (int i = 0; i < 4; i++) { + results.next(); + } + + Assert.assertFalse(results.hasNext()); + Assert.assertFalse(results.hasNext()); + + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + } + + @Test + public void testNext() { + Iterator keys = DATA.keySet().iterator(); + + Iterator results = new MapperIterator<>(keys, MAPPER); + // Call next() without hasNext() + results.next(); + } + + @Test + public void testNextWithMultiTimes() { + Iterator keys = DATA.keySet().iterator(); + + Iterator results = new MapperIterator<>(keys, MAPPER); + for (int i = 0; i < 4; i++) { + results.next(); + } + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + } + + @Test + public void testMapperReturnNullThenHasNext() { + Iterator keys = ImmutableList.of("fifth").iterator(); + + Iterator results = new MapperIterator<>(keys, key -> { + return null; + }); + Assert.assertFalse(results.hasNext()); + } + + @Test + public void testMapperReturnNullThenNext() { + Iterator keys = ImmutableList.of("fifth").iterator(); + + Iterator results = new MapperIterator<>(keys, key -> { + return null; + }); + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + } + + @Test + public void testClose() throws Exception { + CloseableItor keys = new CloseableItor<>( + ImmutableList.of("fifth").iterator()); + + MapperIterator results = + new MapperIterator<>(keys, k -> null); + + Assert.assertFalse(keys.closed()); + results.close(); + Assert.assertTrue(keys.closed()); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/util/BytesTest.java b/src/test/java/com/baidu/hugegraph/unit/util/BytesTest.java new file mode 100644 index 0000000000..6e5a554e84 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/util/BytesTest.java @@ -0,0 +1,127 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.util; + +import org.junit.Test; + +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; +import com.baidu.hugegraph.util.Bytes; +import com.baidu.hugegraph.util.NumericUtil; + +public class BytesTest extends BaseUnitTest { + + @Test + public void testBytesEquals() { + Assert.assertTrue(Bytes.equals("12345678".getBytes(), + "12345678".getBytes())); + Assert.assertTrue(Bytes.equals(new byte[]{1, 3, 5, 7}, + new byte[]{1, 3, 5, 7})); + + Assert.assertFalse(Bytes.equals(new byte[]{1, 3, 5, 7}, + new byte[]{1, 3, 6, 7})); + Assert.assertFalse(Bytes.equals(new byte[]{1, 3, 5, 7}, + new byte[]{1, 3, 5, 7, 0})); + } + + @Test + public void testBytesPrefixWith() { + Assert.assertTrue(Bytes.prefixWith("12345678".getBytes(), + "12345678".getBytes())); + Assert.assertTrue(Bytes.prefixWith("12345678".getBytes(), + "1234567".getBytes())); + + Assert.assertTrue(Bytes.prefixWith(new byte[]{1, 3, 5, 7}, + new byte[]{1, 3, 5, 7})); + Assert.assertTrue(Bytes.prefixWith(new byte[]{1, 3, 5, 7}, + new byte[]{1, 3, 5})); + Assert.assertTrue(Bytes.prefixWith(new byte[]{1, 3, 5, 7}, + new byte[]{1, 3})); + + Assert.assertFalse(Bytes.prefixWith(new byte[]{1, 3, 5, 7}, + new byte[]{1, 3, 6, 6})); + Assert.assertFalse(Bytes.prefixWith(new byte[]{1, 3, 5, 7}, + new byte[]{3, 1})); + Assert.assertFalse(Bytes.prefixWith(new byte[]{1, 3, 5, 7}, + new byte[]{1, 3, 5, 7, 0})); + } + + @Test + public void testBytesCompare() { + Assert.assertTrue(Bytes.compare("12345678".getBytes(), + "12345678".getBytes()) == 0); + Assert.assertTrue(Bytes.compare("12345678".getBytes(), + "1234567".getBytes()) > 0); + Assert.assertTrue(Bytes.compare("12345678".getBytes(), + "12345679".getBytes()) < 0); + + Assert.assertTrue(Bytes.compare(new byte[]{1, 3, 5, 7}, + new byte[]{1, 3, 5, 7}) == 0); + + Assert.assertTrue(Bytes.compare(new byte[]{1, 3, 5, 7}, + new byte[]{1, 3, 5, 6}) > 0); + + Assert.assertTrue(Bytes.compare(new byte[]{1, 3, 5, 7}, + new byte[]{1, 3, 5}) > 0); + + Assert.assertTrue(Bytes.compare(new byte[]{1, 3, 5, 0}, + new byte[]{1, 3, 5}) > 0); + + Assert.assertTrue(Bytes.compare(new byte[]{1, 3, 5, 7}, + new byte[]{1, 3}) > 0); + + Assert.assertTrue(Bytes.compare(new byte[]{1, 3, 5, 7}, + new byte[]{1, 3, 6, 0}) < 0); + + Assert.assertTrue(Bytes.compare(new byte[]{1, 3, 5, 7}, + new byte[]{1, 4}) < 0); + + Assert.assertTrue(Bytes.compare(new byte[]{1, 3, 5, 7}, + new byte[]{3, 1}) < 0); + + Assert.assertTrue(Bytes.compare(new byte[]{1, 3, 5, 7}, + new byte[]{1, 3, 5, 7, 0}) < 0); + + Assert.assertTrue(Bytes.compare(new byte[]{1, 3, 5, 7}, + new byte[]{1, 3, 5, -1}) < 0); + + Assert.assertTrue(Bytes.compare(new byte[]{1, 3, 5, 0}, + new byte[]{1, 3, 5, -128}) < 0); + + Assert.assertTrue(Bytes.compare(new byte[]{1, 3, 5, -2}, + new byte[]{1, 3, 5, -1}) < 0); + + Assert.assertTrue(Bytes.compare(new byte[]{1, 3, 5, -128}, + new byte[]{1, 3, 5, -1}) < 0); + } + + @Test + public void testBytesTohex() { + int value = 0x0103807f; + byte[] bytes = NumericUtil.intToBytes(value); + Assert.assertEquals("0103807f", Bytes.toHex(bytes)); + } + + @Test + public void testBytesFromhex() { + Assert.assertEquals(0x0103807f, + NumericUtil.bytesToInt(Bytes.fromHex("0103807f"))); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/util/HashUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/HashUtilTest.java new file mode 100644 index 0000000000..39d307662e --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/util/HashUtilTest.java @@ -0,0 +1,71 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.util; + +import org.junit.Test; + +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; +import com.baidu.hugegraph.util.HashUtil; + +public class HashUtilTest extends BaseUnitTest { + + @Test + public void testHash() { + // hash 32 bits (4 bytes) + + String h = HashUtil.hash(""); + Assert.assertEquals(8, h.length()); + Assert.assertEquals("00000000", h); + + h = HashUtil.hash("q"); + Assert.assertEquals(8, h.length()); + Assert.assertEquals("e80982ff", h); + + h = HashUtil.hash("qq"); + Assert.assertEquals(8, h.length()); + Assert.assertEquals("252ef918", h); + + h = HashUtil.hash("qwertyuiop[]asdfghjkl;'zxcvbnm,./"); + Assert.assertEquals(8, h.length()); + Assert.assertEquals("fcc1f9fa", h); + } + + @Test + public void testHash128() { + // hash 128 bits (16 bytes) + + String h = HashUtil.hash128(""); + Assert.assertEquals(32, h.length()); + Assert.assertEquals("00000000000000000000000000000000", h); + + h = HashUtil.hash128("q"); + Assert.assertEquals(32, h.length()); + Assert.assertEquals("b1aba139b20c3ebcf667a14f41c7d17c", h); + + h = HashUtil.hash128("qq"); + Assert.assertEquals(32, h.length()); + Assert.assertEquals("2dbabe8ac8d8ce9eedc4b97add0f7c7c", h); + + h = HashUtil.hash128("qwertyuiop[]asdfghjkl;'zxcvbnm,./"); + Assert.assertEquals(32, h.length()); + Assert.assertEquals("49780e7800e613230520ed7b1116fef5", h); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java new file mode 100644 index 0000000000..e7733b4e15 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java @@ -0,0 +1,105 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.util; + +import org.junit.Test; + +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; +import com.baidu.hugegraph.util.VersionUtil; +import com.baidu.hugegraph.util.VersionUtil.Version; + +public class VersionUtilTest extends BaseUnitTest { + + @Test + public void testVersionWithTwoPart() { + Version version = Version.of("0.2"); + + Assert.assertTrue(VersionUtil.match(version, "0", "1")); + Assert.assertTrue(VersionUtil.match(version, "0.0", "1.0")); + Assert.assertTrue(VersionUtil.match(version, "0.1", "0.3")); + Assert.assertTrue(VersionUtil.match(version, "0.2", "0.3")); + Assert.assertTrue(VersionUtil.match(version, "0.2", "0.2.1")); + Assert.assertTrue(VersionUtil.match(version, "0.2", "0.2.01")); + Assert.assertTrue(VersionUtil.match(version, "0.2", "0.10")); + Assert.assertTrue(VersionUtil.match(version, "0.2", "1.0")); + + Assert.assertFalse(VersionUtil.match(version, "1", "0.3")); + Assert.assertFalse(VersionUtil.match(version, "0.3", "0.4")); + Assert.assertFalse(VersionUtil.match(version, "0.2", "0.1")); + Assert.assertFalse(VersionUtil.match(version, "0.2", "0.2")); + Assert.assertFalse(VersionUtil.match(version, "0.2", "0.2.0")); + Assert.assertFalse(VersionUtil.match(version, "0.3", "0.1")); + } + + @Test + public void testVersionWithThreePart() { + Version version = Version.of("3.2.5"); + + Assert.assertTrue(VersionUtil.match(version, "2", "4")); + Assert.assertTrue(VersionUtil.match(version, "3", "4")); + Assert.assertTrue(VersionUtil.match(version, "3.1", "3.3")); + Assert.assertTrue(VersionUtil.match(version, "3.2", "3.3")); + Assert.assertTrue(VersionUtil.match(version, "3.2.4", "3.3")); + Assert.assertTrue(VersionUtil.match(version, "3.2.5", "3.3")); + Assert.assertTrue(VersionUtil.match(version, "3.2.5", "3.2.6")); + Assert.assertTrue(VersionUtil.match(version, "3.2.5", "3.2.10")); + Assert.assertTrue(VersionUtil.match(version, "3.2.5", "3.20.0")); + + Assert.assertFalse(VersionUtil.match(version, "2", "3")); + Assert.assertFalse(VersionUtil.match(version, "3.3", "3.1")); + Assert.assertFalse(VersionUtil.match(version, "3.3", "3.2")); + Assert.assertFalse(VersionUtil.match(version, "3.3", "3.2")); + Assert.assertFalse(VersionUtil.match(version, "3.2.5", "3.2.5")); + Assert.assertFalse(VersionUtil.match(version, "3.2.6", "3.2.5")); + Assert.assertFalse(VersionUtil.match(version, "3.2.6", "3.2.4")); + Assert.assertFalse(VersionUtil.match(version, "3.2.50", "3.2.6")); + Assert.assertFalse(VersionUtil.match(version, "3.20.0", "3.3")); + } + + @Test + public void testVersionCheck() { + Version version = Version.of("0.6.5"); + + VersionUtil.check(version, "0.6", "0.7", "test-component"); + VersionUtil.check(version, "0.6.5", "0.7", "test-component"); + VersionUtil.check(version, "0.6.5", "0.6.6", "test-component"); + + Assert.assertThrows(IllegalStateException.class, () -> { + VersionUtil.check(version, "0.6.5", "0.6.5", "test-component"); + }); + + Assert.assertThrows(IllegalStateException.class, () -> { + VersionUtil.check(version, "0.6.5", "0.6", "test-component"); + }); + + Assert.assertThrows(IllegalStateException.class, () -> { + VersionUtil.check(version, "0.7", "0.6", "test-component"); + }); + + Assert.assertThrows(IllegalStateException.class, () -> { + VersionUtil.check(version, "0.5", "0.6", "test-component"); + }); + + Assert.assertThrows(IllegalStateException.class, () -> { + VersionUtil.check(version, "0.7", "1.0", "test-component"); + }); + } +} From 1db56cfd86e764b8d0ee272b763e0ee8b001a4ee Mon Sep 17 00:00:00 2001 From: liningrui Date: Wed, 11 Jul 2018 22:56:21 +0800 Subject: [PATCH 077/217] HugeGraph-1341: Upgrade version to 1.4.8(1.4.7 failed deploying to maven respority) Change-Id: I7fedf79f96607a3e07cceba4bfa263ce56f36f71 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 11c1fcbff0..8b20c5f005 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.4.7 + 1.4.8 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -191,7 +191,7 @@ - 1.4.7.0 + 1.4.8.0 From 553cd60b8f129ef5aab89fd5e48aa9e6b34e53ce Mon Sep 17 00:00:00 2001 From: zhangyi51 Date: Wed, 18 Jul 2018 17:44:23 +0800 Subject: [PATCH 078/217] hugegraph-889 add ACCEPTED to POST, PUT and DELETE for async Change-Id: If0acdc33acb4ac1e50295d920e0b77b35d11b12f --- pom.xml | 4 ++-- .../java/com/baidu/hugegraph/rest/RestClient.java | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 8b20c5f005..e745b93750 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.4.8 + 1.4.9 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -191,7 +191,7 @@ - 1.4.8.0 + 1.4.9.0 diff --git a/src/main/java/com/baidu/hugegraph/rest/RestClient.java b/src/main/java/com/baidu/hugegraph/rest/RestClient.java index 6d30c55711..cce2d141e6 100644 --- a/src/main/java/com/baidu/hugegraph/rest/RestClient.java +++ b/src/main/java/com/baidu/hugegraph/rest/RestClient.java @@ -116,7 +116,8 @@ public RestResult post(String path, Object object, return builder.get().post(entity.get()); }); // If check status failed, throw client exception. - checkStatus(response, Response.Status.CREATED, Response.Status.OK); + checkStatus(response, Response.Status.CREATED, + Response.Status.OK, Response.Status.ACCEPTED); return new RestResult(response); } @@ -138,7 +139,7 @@ public RestResult put(String path, String id, Object object, .put(Entity.json(object)); }); // If check status failed, throw client exception. - checkStatus(response, Response.Status.OK); + checkStatus(response, Response.Status.OK, Response.Status.ACCEPTED); return new RestResult(response); } @@ -185,7 +186,8 @@ public RestResult delete(String path, Map params) { Response response = this.request(() -> { return target.get().path(path).request().delete(); }); - checkStatus(response, Response.Status.NO_CONTENT); + checkStatus(response, Response.Status.NO_CONTENT, + Response.Status.ACCEPTED); return new RestResult(response); } @@ -193,7 +195,8 @@ public RestResult delete(String path, String id) { Response response = this.request(() -> { return this.target.path(path).path(encode(id)).request().delete(); }); - checkStatus(response, Response.Status.NO_CONTENT); + checkStatus(response, Response.Status.NO_CONTENT, + Response.Status.ACCEPTED); return new RestResult(response); } From a4121451cefb37472f74ff495dc55353ee3b39cc Mon Sep 17 00:00:00 2001 From: liningrui Date: Mon, 23 Jul 2018 16:50:28 +0800 Subject: [PATCH 079/217] HugeGraph-1349: Add some badges(licence, build, coverage and maven) in README Change-Id: I4d8498adbcf4289ecc897ffe629080cd524d5004 --- .travis.yml | 11 +++++++++++ README.md | 5 +++++ pom.xml | 19 ++++++++++++++++--- 3 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..8e5340be2a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +language: java + +jdk: + - oraclejdk8 + +install: mvn compile -Dmaven.javadoc.skip=true + +script: mvn test -Dtest=UnitTestSuite && mvn cobertura:cobertura + +after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/README.md b/README.md index eaeac5efdb..7562352703 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ # hugegraph-common +[![License](https://img.shields.io/badge/license-Apache%202-0E78BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) +[![Build Status](https://travis-ci.org/hugegraph/hugegraph-common.svg?branch=master)](https://travis-ci.org/hugegraph/hugegraph-common) +[![codecov](https://codecov.io/gh/hugegraph/hugegraph-common/branch/master/graph/badge.svg)](https://codecov.io/gh/hugegraph/hugegraph-common) +[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.baidu.hugegraph/hugegraph-common/badge.svg)](https://mvnrepository.com/artifact/com.baidu.hugegraph/hugegraph-common) + hugegraph-common is a common module for [HugeGraph](https://github.com/hugegraph/hugegraph) and its peripheral components. hugegraph-common encapsulates locks, configurations, events, iterators, rest and some numeric or collection util classes to simplify the development of HugeGraph and diff --git a/pom.xml b/pom.xml index e745b93750..db87a482ac 100644 --- a/pom.xml +++ b/pom.xml @@ -190,13 +190,26 @@ - - 1.4.9.0 - + + 1.4.9.0 + + + org.codehaus.mojo + cobertura-maven-plugin + 2.7 + + + html + xml + + + + From 1c7c839d45c78b4f4d38498ee241e51641e999a4 Mon Sep 17 00:00:00 2001 From: zhangyi51 Date: Thu, 26 Jul 2018 21:23:02 +0800 Subject: [PATCH 080/217] hugegraph-1364 add LICENSE for hugegraph-common Change-Id: I1e494152aeef3c4ff2bd9a09aeb3ab64303eec29 --- LICENSE | 202 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 202 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000..e06d208186 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed 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. + From 07793f9971cf347fa976bc57123e5f5b076688f6 Mon Sep 17 00:00:00 2001 From: zhangyi51 Date: Fri, 27 Jul 2018 11:48:36 +0800 Subject: [PATCH 081/217] HugeGraph-622: Bump up to version 1.5.0 Change-Id: Id1a905adf907370a5e8c30ba0ae7a8327c519daf --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index db87a482ac..8e03390548 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.4.9 + 1.5.0 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -192,7 +192,7 @@ - 1.4.9.0 + 1.5.0.0 From 591d3f3834764b53c54a54002740f19f606d534e Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Wed, 22 Aug 2018 19:34:08 +0800 Subject: [PATCH 082/217] HugeGraph-1399: let EventHub.notify() return Future to sync Change-Id: If7412da120c9652946a9aff41b0df5571fac3145 --- pom.xml | 4 ++-- src/main/java/com/baidu/hugegraph/event/EventHub.java | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 8e03390548..bf442bb09b 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.5.0 + 1.5.1 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -192,7 +192,7 @@ - 1.5.0.0 + 1.5.1.0 diff --git a/src/main/java/com/baidu/hugegraph/event/EventHub.java b/src/main/java/com/baidu/hugegraph/event/EventHub.java index b2a92ab884..cd6499792c 100644 --- a/src/main/java/com/baidu/hugegraph/event/EventHub.java +++ b/src/main/java/com/baidu/hugegraph/event/EventHub.java @@ -22,10 +22,12 @@ import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import javax.annotation.Nullable; @@ -128,7 +130,7 @@ public int unlisten(String event, EventListener listener) { return count; } - public void notify(String event, @Nullable Object... args) { + public Future notify(String event, @Nullable Object... args) { @SuppressWarnings("resource") ExtendableIterator all = new ExtendableIterator<>(); @@ -142,21 +144,24 @@ public void notify(String event, @Nullable Object... args) { } if (!all.hasNext()) { - return; + return CompletableFuture.completedFuture(0); } Event ev = new Event(this, event, args); // The submit will catch params: `all`(Listeners) and `ev`(Event) - executor().submit(() -> { + return executor().submit(() -> { + int count = 0; // Notify all listeners, and ignore the results while (all.hasNext()) { try { all.next().event(ev); + count++; } catch (Throwable ignored) { LOG.warn("Failed to handle event: {}", ev, ignored); } } + return count; }); } From 16fbcb354da7ca4412a6a545bb10cf8600cf0339 Mon Sep 17 00:00:00 2001 From: liningrui Date: Tue, 9 Oct 2018 15:37:49 +0800 Subject: [PATCH 083/217] Optimize intersect action improve #2 Change-Id: I9c4daeaf812ffdae84a83b2bc94bb114461bda45 --- pom.xml | 4 +- .../baidu/hugegraph/util/CollectionUtil.java | 79 ++++++++++ .../unit/util/CollectionUtilTest.java | 140 ++++++++++++++++++ 3 files changed, 221 insertions(+), 2 deletions(-) create mode 100644 src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java diff --git a/pom.xml b/pom.xml index bf442bb09b..b2d6e712c7 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.5.1 + 1.5.2 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -192,7 +192,7 @@ - 1.5.1.0 + 1.5.2.0 diff --git a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java index 9fa728566f..2c091a34ce 100644 --- a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java @@ -84,4 +84,83 @@ public static Set subSet(Set original, int from, int to) { } return new LinkedHashSet<>(list.subList(from, to)); } + + public static Set union(Collection first, Collection second) { + E.checkNotNull(first, "first"); + E.checkNotNull(second, "second"); + HashSet results = new HashSet<>(first); + results.addAll(second); + return results; + } + + /** + * Find the intersection of two collections, the original collections + * will not be modified + * @param first the first collection + * @param second the second collection + * @param element type of collection + * @return intersection of the two collections + */ + public static Collection intersect(Collection first, + Collection second) { + E.checkNotNull(first, "first"); + E.checkNotNull(second, "second"); + + HashSet results = null; + if (first instanceof HashSet) { + @SuppressWarnings("unchecked") + HashSet clone = (HashSet) ((HashSet) first).clone(); + results = clone; + } else { + results = new HashSet<>(first); + } + results.retainAll(second); + return results; + } + + /** + * Find the intersection of two collections, note that the first collection + * will be modified and store the results + * @param first the first collection, it will be modified + * @param second the second collection + * @param element type of collection + * @return intersection of the two collections + */ + public static Collection intersectWithModify(Collection first, + Collection second) { + E.checkNotNull(first, "first"); + E.checkNotNull(second, "second"); + first.retainAll(second); + return first; + } + + public static boolean hasIntersection(List first, Set second) { + E.checkNotNull(first, "first"); + E.checkNotNull(second, "second"); + for (T firstElem : first) { + if (second.contains(firstElem)) { + return true; + } + } + return false; + } + + public static boolean hasIntersection(Set first, Set second) { + E.checkNotNull(first, "first"); + E.checkNotNull(second, "second"); + if (first.size() <= second.size()) { + for (T firstElem : first) { + if (second.contains(firstElem)) { + return true; + } + } + } else { + for (T secondElem : second) { + if (first.contains(secondElem)) { + return true; + } + } + } + return false; + } } diff --git a/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java new file mode 100644 index 0000000000..c9be43fdb0 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java @@ -0,0 +1,140 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.util; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.junit.Test; + +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.util.CollectionUtil; + +public class CollectionUtilTest { + + @Test + public void testUnion() { + List first = new ArrayList<>(); + first.add(1); + first.add(2); + + Set second = new HashSet<>(); + second.add(1); + second.add(3); + + Set results = CollectionUtil.union(first, second); + Assert.assertEquals(3, results.size()); + } + + @Test + public void testIntersectWithoutModifying() { + List first = new ArrayList<>(); + first.add(1); + first.add(2); + first.add(3); + + List second = new ArrayList<>(); + + second.add(4); + second.add(5); + Collection results = CollectionUtil.intersect(first, second); + Assert.assertEquals(0, results.size()); + Assert.assertEquals(3, first.size()); + + second.add(3); + results = CollectionUtil.intersect(first, second); + Assert.assertEquals(1, results.size()); + Assert.assertEquals(3, first.size()); + + second.add(1); + second.add(2); + results = CollectionUtil.intersect(first, second); + Assert.assertEquals(3, results.size()); + Assert.assertEquals(3, first.size()); + } + + @Test + public void testIntersectWithModifying() { + Set first = new HashSet<>(); + first.add(1); + first.add(2); + first.add(3); + + Set second = new HashSet<>(); + second.add(1); + second.add(2); + second.add(3); + + Collection results = CollectionUtil.intersectWithModify( + first, second); + Assert.assertEquals(3, results.size()); + Assert.assertEquals(3, first.size()); + + // The second set has "1", "2" + second.remove(3); + results = CollectionUtil.intersectWithModify(first, second); + Assert.assertEquals(2, results.size()); + Assert.assertEquals(2, first.size()); + + // The second set is empty + second.remove(1); + second.remove(2); + results = CollectionUtil.intersectWithModify(first, second); + Assert.assertEquals(0, results.size()); + Assert.assertEquals(0, first.size()); + } + + @Test + public void testHasIntersectionBetweenListAndSet() { + List first = new ArrayList<>(); + first.add(1); + first.add(2); + first.add(3); + + Set second = new HashSet<>(); + Assert.assertFalse(CollectionUtil.hasIntersection(first, second)); + + second.add(4); + Assert.assertFalse(CollectionUtil.hasIntersection(first, second)); + + second.add(1); + Assert.assertTrue(CollectionUtil.hasIntersection(first, second)); + } + + @Test + public void testHasIntersectionBetweenSetAndSet() { + Set first = new HashSet<>(); + first.add(1); + first.add(2); + first.add(3); + + Set second = new HashSet<>(); + Assert.assertFalse(CollectionUtil.hasIntersection(first, second)); + + second.add(4); + Assert.assertFalse(CollectionUtil.hasIntersection(first, second)); + + second.add(1); + Assert.assertTrue(CollectionUtil.hasIntersection(first, second)); + } +} From 904f4260b9816b6d537111f1a6a598020eff08e1 Mon Sep 17 00:00:00 2001 From: zhangyi51 Date: Fri, 12 Oct 2018 15:02:13 +0800 Subject: [PATCH 084/217] README improve Change-Id: I4550093fb02a0156bc353ef33eaad97f3e63fb12 --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7562352703..d3115240d7 100644 --- a/README.md +++ b/README.md @@ -12,12 +12,12 @@ its components. ## Components -- Lock, atomic lock, key lock, lock group and lock manger -- Config, register and load config option with security check -- Event, listening and notification, do something asynchronously -- Iterator, some iterators with extra functions,map, filter, extend etc. -- Rest, RESTful client implemented on Jersey, POST, PUT, GET and DELETE -- Util, Numeric and Collection utils, log and exception utils etc. +- Lock: atomic lock, key lock, lock group and lock manger +- Config: register and load config option with security check +- Event: listening and notification, do something asynchronously +- Iterator: some iterators with extra functions, map, filter, extend etc. +- Rest: RESTful client implemented on Jersey, POST, PUT, GET and DELETE +- Util: Performance analyzer, version checker, numeric and Collection utils, log and exception utils etc. ## Licence The same as HugeGraph, hugegraph-common is also licensed under Apache 2.0 License. From 146e4bc3621f04e61834fc0e879d87aab3cceebf Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Fri, 19 Oct 2018 14:47:57 +0800 Subject: [PATCH 085/217] add api for setting thread pool name Change-Id: I93aeddc6783e6b03d2aa31aa8ca42059e253ba81 --- pom.xml | 4 +-- .../com/baidu/hugegraph/event/EventHub.java | 5 +-- .../baidu/hugegraph/util/ExecutorUtil.java | 36 +++++++++++++++++++ 3 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 src/main/java/com/baidu/hugegraph/util/ExecutorUtil.java diff --git a/pom.xml b/pom.xml index b2d6e712c7..864480e41a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.5.2 + 1.5.3 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -192,7 +192,7 @@ - 1.5.2.0 + 1.5.3.0 diff --git a/src/main/java/com/baidu/hugegraph/event/EventHub.java b/src/main/java/com/baidu/hugegraph/event/EventHub.java index cd6499792c..6b6779f7b9 100644 --- a/src/main/java/com/baidu/hugegraph/event/EventHub.java +++ b/src/main/java/com/baidu/hugegraph/event/EventHub.java @@ -26,7 +26,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; @@ -36,6 +35,7 @@ import com.baidu.hugegraph.iterator.ExtendableIterator; import com.baidu.hugegraph.util.E; +import com.baidu.hugegraph.util.ExecutorUtil; import com.baidu.hugegraph.util.Log; import com.google.common.collect.ImmutableList; @@ -43,6 +43,7 @@ public class EventHub { private static final Logger LOG = Log.logger(EventHub.class); + public static final String EVENT_WORKER = "event-worker-%d"; public static final String ANY_EVENT = "*"; private static final List EMPTY = ImmutableList.of(); @@ -70,7 +71,7 @@ public static synchronized void init(int poolSize) { return; } LOG.debug("Init pool(size {}) for EventHub", poolSize); - executor = Executors.newFixedThreadPool(poolSize); + executor = ExecutorUtil.newFixedThreadPool(poolSize, EVENT_WORKER); } public static synchronized boolean destroy(long timeout) diff --git a/src/main/java/com/baidu/hugegraph/util/ExecutorUtil.java b/src/main/java/com/baidu/hugegraph/util/ExecutorUtil.java new file mode 100644 index 0000000000..773ec0d8dc --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/util/ExecutorUtil.java @@ -0,0 +1,36 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.util; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; + +import org.apache.commons.lang3.concurrent.BasicThreadFactory; + +public final class ExecutorUtil { + + public static ExecutorService newFixedThreadPool(int size, String name) { + ThreadFactory factory = new BasicThreadFactory.Builder() + .namingPattern(name) + .build(); + return Executors.newFixedThreadPool(size, factory); + } +} From 476bb78315ff1b504544d91391b9eb86f41d00b6 Mon Sep 17 00:00:00 2001 From: liningrui Date: Mon, 17 Dec 2018 16:14:08 +0800 Subject: [PATCH 086/217] Add CollectionUtilTest to UnitTestSuite Change-Id: I36f632f0e0b8e6680d4fe16b30cf54e87ef01780 --- src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java index e567b31e6f..c178649b05 100644 --- a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java +++ b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -29,6 +29,7 @@ import com.baidu.hugegraph.unit.iterator.FlatMapperIteratorTest; import com.baidu.hugegraph.unit.iterator.MapperIteratorTest; import com.baidu.hugegraph.unit.util.BytesTest; +import com.baidu.hugegraph.unit.util.CollectionUtilTest; import com.baidu.hugegraph.unit.util.HashUtilTest; import com.baidu.hugegraph.unit.util.VersionUtilTest; @@ -43,6 +44,7 @@ FlatMapperFilterIteratorTest.class, BytesTest.class, + CollectionUtilTest.class, HashUtilTest.class, VersionUtilTest.class }) From 6f20cb8bdcd0736f14d505de9b27901f33dcc8fa Mon Sep 17 00:00:00 2001 From: liningrui Date: Tue, 18 Dec 2018 19:33:15 +0800 Subject: [PATCH 087/217] Fix dependency conflict "InjectionManagerFactory not found" Fix #9 Change-Id: I83f2074c431994f72a62e37ab4a6086c3142a1b5 --- pom.xml | 10 ++++- .../com/baidu/hugegraph/util/VersionUtil.java | 34 +++++++++++++++++ .../hugegraph/version/CommonVersion.java | 4 +- .../hugegraph/unit/version/VersionTest.java | 37 +++++++++++++++++++ 4 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 src/test/java/com/baidu/hugegraph/unit/version/VersionTest.java diff --git a/pom.xml b/pom.xml index 864480e41a..e2ca47893b 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.5.3 + 1.5.4 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -67,6 +67,7 @@ 3.0.1 3.21.0-GA 2.25.1 + 2.27 4.12 @@ -155,6 +156,11 @@ jersey-media-json-jackson ${jersey.version} + + org.glassfish.jersey.inject + jersey-hk2 + ${jersey.hk2.version} + @@ -192,7 +198,7 @@ - 1.5.3.0 + 1.5.4.0 diff --git a/src/main/java/com/baidu/hugegraph/util/VersionUtil.java b/src/main/java/com/baidu/hugegraph/util/VersionUtil.java index a6fd43ffae..ba580d83a1 100644 --- a/src/main/java/com/baidu/hugegraph/util/VersionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/VersionUtil.java @@ -19,7 +19,9 @@ package com.baidu.hugegraph.util; +import java.io.BufferedReader; import java.io.IOException; +import java.io.InputStreamReader; import java.net.URL; import java.util.jar.Attributes; import java.util.jar.Manifest; @@ -86,6 +88,38 @@ public static String getImplementationVersion(Class clazz) { .getValue(Attributes.Name.IMPLEMENTATION_VERSION); } + /** + * Get version from pom.xml + * @return The pom version + */ + public static String getPomVersion() { + String cmd = "mvn help:evaluate -Dexpression=project.version " + + "-q -DforceStdout"; + Process process = null; + InputStreamReader isr = null; + try { + process = Runtime.getRuntime().exec(cmd); + process.waitFor(); + + isr = new InputStreamReader(process.getInputStream()); + BufferedReader br = new BufferedReader(isr); + return br.readLine(); + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + if (isr != null) { + try { + isr.close(); + } catch (Exception ignored) {} + } + + // Destroy child process + if (process != null) { + process.destroy(); + } + } + } + /** * class Version for compare * https://stackoverflow.com/questions/198431/how-do-you-compare-two-version-strings-in-java diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index deb96e0401..aa9c14f7cc 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -25,5 +25,7 @@ public class CommonVersion { public static final String NAME = "hugegraph-common"; - public static final Version VERSION = Version.of(CommonVersion.class); + // The second parameter of Version.of() is for all-in-one JAR + public static final Version VERSION = Version.of(CommonVersion.class, + "1.5.4"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/version/VersionTest.java b/src/test/java/com/baidu/hugegraph/unit/version/VersionTest.java new file mode 100644 index 0000000000..1d9ea1b5d5 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/version/VersionTest.java @@ -0,0 +1,37 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.version; + +import org.junit.Test; + +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.util.VersionUtil; +import com.baidu.hugegraph.version.CommonVersion; + +public class VersionTest { + + @Test + public void testGetCommonVersion() { + String version = CommonVersion.VERSION.get(); + Assert.assertNotNull(version); + String pomVersion = VersionUtil.getPomVersion(); + Assert.assertEquals(version, pomVersion); + } +} From bbbc8e70f5cd41acc34c77465aa9606de43a6ec6 Mon Sep 17 00:00:00 2001 From: liningrui Date: Mon, 24 Dec 2018 19:32:34 +0800 Subject: [PATCH 088/217] Add CollectionUtil.sortByValue() Change-Id: I9152cc7d8fc5a23e3407118ed09c9b6ac116eed9 --- .travis.yml | 2 +- pom.xml | 35 ++-- .../baidu/hugegraph/util/CollectionUtil.java | 37 ++++- .../hugegraph/version/CommonVersion.java | 2 +- src/main/resources/log4j.properties | 24 --- .../baidu/hugegraph/unit/UnitTestSuite.java | 2 + .../unit/util/CollectionUtilTest.java | 155 +++++++++++++++++- .../unit/util/InsertionOrderUtilTest.java | 73 +++++++++ 8 files changed, 290 insertions(+), 40 deletions(-) delete mode 100644 src/main/resources/log4j.properties create mode 100644 src/test/java/com/baidu/hugegraph/unit/util/InsertionOrderUtilTest.java diff --git a/.travis.yml b/.travis.yml index 8e5340be2a..43fa8a0d2f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ jdk: install: mvn compile -Dmaven.javadoc.skip=true -script: mvn test -Dtest=UnitTestSuite && mvn cobertura:cobertura +script: mvn test -Dtest=UnitTestSuite after_success: - bash <(curl -s https://codecov.io/bash) diff --git a/pom.xml b/pom.xml index e2ca47893b..8936c7b101 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.5.4 + 1.5.5 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -198,23 +198,34 @@ - 1.5.4.0 + 1.5.5.0 - org.codehaus.mojo - cobertura-maven-plugin - 2.7 - - - html - xml - - - + org.jacoco + jacoco-maven-plugin + 0.8.2 + + + pre-unit-test + + prepare-agent + + + + post-unit-test + test + + report + + + ${project.build.directory} + + + diff --git a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java index 2c091a34ce..ca8ef5eb76 100644 --- a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java @@ -22,9 +22,12 @@ import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.HashSet; +import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; +import java.util.Map; import java.util.Set; public final class CollectionUtil { @@ -65,7 +68,7 @@ public static boolean prefixOf(List prefix, List all) { return true; } - public static boolean allUnique(Collection collection){ + public static boolean allUnique(Collection collection) { return collection.stream().allMatch(new HashSet<>()::add); } @@ -163,4 +166,36 @@ public static boolean hasIntersection(Set first, Set second) { } return false; } + + public static , V> Map sortByKey( + Map map, boolean incr) { + List> list = new ArrayList<>(map.entrySet()); + if (incr) { + list.sort(Map.Entry.comparingByKey()); + } else { + list.sort(Collections.reverseOrder(Map.Entry.comparingByKey())); + } + + Map result = new LinkedHashMap<>(); + for (Map.Entry entry : list) { + result.put(entry.getKey(), entry.getValue()); + } + return result; + } + + public static > Map sortByValue( + Map map, boolean incr) { + List> list = new ArrayList<>(map.entrySet()); + if (incr) { + list.sort(Map.Entry.comparingByValue()); + } else { + list.sort(Collections.reverseOrder(Map.Entry.comparingByValue())); + } + + Map result = new LinkedHashMap<>(); + for (Map.Entry entry : list) { + result.put(entry.getKey(), entry.getValue()); + } + return result; + } } diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index aa9c14f7cc..e8d5f7a584 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.5.4"); + "1.5.5"); } diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties deleted file mode 100644 index 3e9f7e1550..0000000000 --- a/src/main/resources/log4j.properties +++ /dev/null @@ -1,24 +0,0 @@ -log4j.rootLogger=INFO, console, file - -log4j.logger.org.apache.cassandra=INFO -log4j.logger.org.apache.hadoop=INFO -log4j.logger.com.datastax.driver=WARN -log4j.logger.io.netty=INFO -log4j.logger.org.apache.commons=INFO -log4j.logger.com.baidu.hugegraph=INFO - -# Console Logger. -log4j.appender.console=org.apache.log4j.ConsoleAppender -log4j.appender.console.Threshold=DEBUG -log4j.appender.console.layout=org.apache.log4j.PatternLayout -log4j.appender.console.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss} %-5r\ - [%t] [%-5p] %c %x - %m%n - -# File Logger -log4j.appender.file=org.apache.log4j.DailyRollingFileAppender -log4j.appender.file.File=logs/hugegraph-common.log -log4j.appender.file.Threshold=INFO -log4j.appender.file.DatePattern='-'yyyy-MM-dd'.log' -log4j.appender.file.layout=org.apache.log4j.PatternLayout -log4j.appender.file.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss} %-5r\ - [%t] [%-5p] %c %x - %m%n diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java index c178649b05..143772dd23 100644 --- a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java +++ b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -31,6 +31,7 @@ import com.baidu.hugegraph.unit.util.BytesTest; import com.baidu.hugegraph.unit.util.CollectionUtilTest; import com.baidu.hugegraph.unit.util.HashUtilTest; +import com.baidu.hugegraph.unit.util.InsertionOrderUtilTest; import com.baidu.hugegraph.unit.util.VersionUtilTest; @RunWith(Suite.class) @@ -46,6 +47,7 @@ BytesTest.class, CollectionUtilTest.class, HashUtilTest.class, + InsertionOrderUtilTest.class, VersionUtilTest.class }) public class UnitTestSuite { diff --git a/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java index c9be43fdb0..ec0e1b7e58 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java @@ -21,16 +21,89 @@ import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; import org.junit.Test; import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; import com.baidu.hugegraph.util.CollectionUtil; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; -public class CollectionUtilTest { +public class CollectionUtilTest extends BaseUnitTest { + + @Test + public void testToList() { + Object array1 = new Integer[]{1, 2, 3}; + Assert.assertEquals(ImmutableList.of(1, 2, 3), + CollectionUtil.toList(array1)); + + Object array2 = new String[]{"1", "2", "3"}; + Assert.assertEquals(ImmutableList.of("1", "2", "3"), + CollectionUtil.toList(array2)); + + Assert.assertThrows(NullPointerException.class, () -> { + CollectionUtil.toList(null); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + CollectionUtil.toList("123"); + }); + } + + @Test + public void testPrefixOf() { + List list = ImmutableList.of(1, 2, 3); + + List list1 = ImmutableList.of(); + Assert.assertTrue(CollectionUtil.prefixOf(list1, list)); + + List list2 = ImmutableList.of(1, 2); + Assert.assertTrue(CollectionUtil.prefixOf(list2, list)); + + List list3 = ImmutableList.of(1, 2, 3); + Assert.assertTrue(CollectionUtil.prefixOf(list3, list)); + + List list4 = ImmutableList.of(1, 2, 3, 4); + Assert.assertFalse(CollectionUtil.prefixOf(list4, list)); + } + + @Test + public void testAllUnique() { + List list = ImmutableList.of(); + Assert.assertTrue(CollectionUtil.allUnique(list)); + + list = ImmutableList.of(1, 2, 3, 2, 3); + Assert.assertFalse(CollectionUtil.allUnique(list)); + + list = ImmutableList.of(1, 2, 3, 4, 5); + Assert.assertTrue(CollectionUtil.allUnique(list)); + + list = ImmutableList.of(1, 1, 1, 1, 1); + Assert.assertFalse(CollectionUtil.allUnique(list)); + } + + @Test + public void testSubSet() { + Set originSet = ImmutableSet.of(1, 2, 3, 4, 5); + + Set subSet = CollectionUtil.subSet(originSet, 1, 1); + Assert.assertEquals(ImmutableSet.of(), subSet); + + subSet = CollectionUtil.subSet(originSet, 2, 4); + Assert.assertEquals(ImmutableSet.of(3, 4), subSet); + + subSet = CollectionUtil.subSet(originSet, 2, 5); + Assert.assertEquals(ImmutableSet.of(3, 4, 5), subSet); + + subSet = CollectionUtil.subSet(originSet, 0, 5); + Assert.assertEquals(ImmutableSet.of(1, 2, 3, 4, 5), subSet); + } @Test public void testUnion() { @@ -137,4 +210,84 @@ public void testHasIntersectionBetweenSetAndSet() { second.add(1); Assert.assertTrue(CollectionUtil.hasIntersection(first, second)); } + + @Test + public void testMapSortByStringKey() { + Map unordered = new HashMap<>(); + unordered.put("D", 1); + unordered.put("B", 2); + unordered.put("E", 3); + unordered.put("A", 4); + unordered.put("C", 5); + + Map incrOrdered = CollectionUtil.sortByKey(unordered, + true); + Assert.assertEquals(ImmutableList.of("A", "B", "C", "D", "E"), + ImmutableList.copyOf(incrOrdered.keySet())); + + Map decrOrdered = CollectionUtil.sortByKey(unordered, + false); + Assert.assertEquals(ImmutableList.of("E", "D", "C", "B", "A"), + ImmutableList.copyOf(decrOrdered.keySet())); + } + + @Test + public void testMapSortByIntegerKey() { + Map unordered = new HashMap<>(); + unordered.put(4, "A"); + unordered.put(2, "B"); + unordered.put(5, "C"); + unordered.put(1, "D"); + unordered.put(3, "E"); + + Map incrOrdered = CollectionUtil.sortByKey(unordered, + true); + Assert.assertEquals(ImmutableList.of(1, 2, 3, 4, 5), + ImmutableList.copyOf(incrOrdered.keySet())); + + Map decrOrdered = CollectionUtil.sortByKey(unordered, + false); + Assert.assertEquals(ImmutableList.of(5, 4, 3, 2, 1), + ImmutableList.copyOf(decrOrdered.keySet())); + } + + @Test + public void testMapSortByIntegerValue() { + Map unordered = new HashMap<>(); + unordered.put("A", 4); + unordered.put("B", 2); + unordered.put("C", 5); + unordered.put("D", 1); + unordered.put("E", 3); + + Map incrOrdered = CollectionUtil.sortByValue(unordered, + true); + Assert.assertEquals(ImmutableList.of(1, 2, 3, 4, 5), + ImmutableList.copyOf(incrOrdered.values())); + + Map decrOrdered = CollectionUtil.sortByValue(unordered, + false); + Assert.assertEquals(ImmutableList.of(5, 4, 3, 2, 1), + ImmutableList.copyOf(decrOrdered.values())); + } + + @Test + public void testMapSortByStringValue() { + Map unordered = new HashMap<>(); + unordered.put(1, "D"); + unordered.put(2, "B"); + unordered.put(3, "E"); + unordered.put(4, "A"); + unordered.put(5, "C"); + + Map incrOrdered = CollectionUtil.sortByValue(unordered, + true); + Assert.assertEquals(ImmutableList.of("A", "B", "C", "D", "E"), + ImmutableList.copyOf(incrOrdered.values())); + + Map decrOrdered = CollectionUtil.sortByValue(unordered, + false); + Assert.assertEquals(ImmutableList.of("E", "D", "C", "B", "A"), + ImmutableList.copyOf(decrOrdered.values())); + } } diff --git a/src/test/java/com/baidu/hugegraph/unit/util/InsertionOrderUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/InsertionOrderUtilTest.java new file mode 100644 index 0000000000..3298c5ae22 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/util/InsertionOrderUtilTest.java @@ -0,0 +1,73 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.util; + +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.junit.Test; + +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; +import com.baidu.hugegraph.util.InsertionOrderUtil; +import com.google.common.collect.ImmutableList; + +public class InsertionOrderUtilTest extends BaseUnitTest { + + @Test + public void testSet() { + Set set = InsertionOrderUtil.newSet(); + set.add(4); + set.add(2); + set.add(5); + set.add(1); + set.add(3); + + Assert.assertEquals(ImmutableList.of(4, 2, 5, 1, 3), + ImmutableList.copyOf(set)); + } + + @Test + public void testList() { + List list = InsertionOrderUtil.newList(); + list.add(4); + list.add(2); + list.add(5); + list.add(1); + list.add(3); + + Assert.assertEquals(ImmutableList.of(4, 2, 5, 1, 3), + ImmutableList.copyOf(list)); + } + + @Test + public void testMap() { + Map map = InsertionOrderUtil.newMap(); + map.put(4, 4); + map.put(2, 2); + map.put(5, 5); + map.put(1, 1); + map.put(3, 3); + + Assert.assertEquals(ImmutableList.of(4, 2, 5, 1, 3), + ImmutableList.copyOf(map.keySet())); + } +} From 5f6012cbe41a579212d26499dd8ab73af7cbc25c Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Sat, 22 Dec 2018 00:29:23 +0800 Subject: [PATCH 089/217] Support for sortable base64 encoding implement #11 Change-Id: I39b8f26d025e095d9d654f655657df6d6dc2543f --- pom.xml | 4 +- .../baidu/hugegraph/util/LongEncoding.java | 76 ++- .../com/baidu/hugegraph/util/NumericUtil.java | 66 ++- .../com/baidu/hugegraph/util/VersionUtil.java | 11 + .../hugegraph/version/CommonVersion.java | 2 +- .../baidu/hugegraph/unit/UnitTestSuite.java | 6 +- .../hugegraph/unit/event/EventHubTest.java | 12 +- .../hugegraph/unit/util/LongEncodingTest.java | 478 ++++++++++++++++++ .../hugegraph/unit/util/VersionUtilTest.java | 16 + .../hugegraph/unit/version/VersionTest.java | 5 +- 10 files changed, 649 insertions(+), 27 deletions(-) create mode 100644 src/test/java/com/baidu/hugegraph/unit/util/LongEncodingTest.java diff --git a/pom.xml b/pom.xml index 8936c7b101..cf7270223c 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.5.5 + 1.5.6 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -198,7 +198,7 @@ - 1.5.5.0 + 1.5.6.0 diff --git a/src/main/java/com/baidu/hugegraph/util/LongEncoding.java b/src/main/java/com/baidu/hugegraph/util/LongEncoding.java index e0d5c07d89..1fccbddb3c 100644 --- a/src/main/java/com/baidu/hugegraph/util/LongEncoding.java +++ b/src/main/java/com/baidu/hugegraph/util/LongEncoding.java @@ -24,20 +24,77 @@ public final class LongEncoding { private static final String BASE_SYMBOLS = - "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-~"; + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~"; - public static long decode(String s) { - return decode(s, BASE_SYMBOLS); + private static final String LENGTH_SYMBOLS = "0123456789ABCDEF"; + private static final char NEG = LENGTH_SYMBOLS.charAt(0); + + private static final long FULL_LONG = 0x8000000000000000L; + + public static String encodeNumber(Object number) { + Number num = NumericUtil.convertToNumber(number); + long value = NumericUtil.numberToSortableLong(num); + return encodeSortable(value); + } + + public static Number decodeNumber(String str, Class clazz) { + long value = decodeSortable(str); + Number number = NumericUtil.sortableLongToNumber(value, clazz); + return number; + } + + public static String encodeSortable(long num) { + boolean negative = false; + if (num < 0L) { + negative = true; + num += FULL_LONG; + } + + String encoded = encode(num, BASE_SYMBOLS); + int length = encoded.length(); + E.checkArgument(length <= LENGTH_SYMBOLS.length(), + "Length symbols can't represent encoded number '%s'", + encoded); + StringBuilder sb = new StringBuilder(length + 2); + if (negative) { + sb.append(NEG); + } + char len = LENGTH_SYMBOLS.charAt(length); + sb.append(len); + sb.append(encoded); + + return sb.toString(); + } + + public static long decodeSortable(String str) { + E.checkArgument(str.length() >= 2, + "Length of sortable encoded string must be >=2"); + boolean negative = str.charAt(0) == NEG; + int prefix = 1; + if (negative) { + prefix = 2; + } + String encoded = str.substring(prefix); + long value = decode(encoded); + if (negative) { + value -= FULL_LONG; + } + return value; } public static String encode(long num) { return encode(num, BASE_SYMBOLS); } - public static long decode(String s, String symbols) { + public static long decode(String str) { + return decode(str, BASE_SYMBOLS); + } + + public static long decode(String str, String symbols) { final int B = symbols.length(); + E.checkArgument(B > 0, "The symbols parameter can't be empty"); long num = 0; - for (char ch : s.toCharArray()) { + for (char ch : str.toCharArray()) { num *= B; int pos = symbols.indexOf(ch); if (pos < 0) @@ -49,13 +106,16 @@ public static long decode(String s, String symbols) { } public static String encode(long num, String symbols) { - E.checkArgument(num >= 0, "Expected non-negative number: %s", num); final int B = symbols.length(); + E.checkArgument(num >= 0, "Expected non-negative number: %s", num); + E.checkArgument(B > 0, "The symbols parameter can't be empty"); + StringBuilder sb = new StringBuilder(); - while (num != 0) { + do { sb.append(symbols.charAt((int) (num % B))); num /= B; - } + } while (num != 0); + return sb.reverse().toString(); } } diff --git a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java index 16127c8d2f..ee608d3e19 100644 --- a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java @@ -103,6 +103,48 @@ public static int sortableFloatBits(int bits) { return bits ^ (bits >> 31) & 0x7fffffff; } + public static long numberToSortableLong(Number number) { + if (number instanceof Double) { + return doubleToSortableLong(number.doubleValue()); + } else if (number instanceof Float) { + return floatToSortableInt(number.floatValue()); + } else if (number instanceof Long || number instanceof Integer || + number instanceof Short || number instanceof Byte) { + return number.longValue(); + } else if (number instanceof BigDecimal) { + BigDecimal bd = (BigDecimal) number; + boolean intNumber = bd.stripTrailingZeros().scale() <= 0; + return intNumber ? bd.longValueExact() : + doubleToSortableLong(bd.doubleValue()); + } + // TODO: support other number types + throw new IllegalArgumentException(String.format( + "Unsupported number type: %s(%s)", + number.getClass().getSimpleName(), number)); + } + + public static Number sortableLongToNumber(long value, Class clazz) { + assert NumericUtil.isNumber(clazz); + + if (clazz == Double.class) { + return sortableLongToDouble(value); + } else if (clazz == Float.class) { + return sortableIntToFloat((int) value); + } else if (clazz == Long.class) { + return value; + } else if (clazz == Integer.class) { + return (int) value; + } else if (clazz == Short.class) { + return (short) value; + } else if (clazz == Byte.class) { + return (byte) value; + } + + // TODO: support other number types + throw new IllegalArgumentException(String.format( + "Unsupported number type: %s", clazz.getSimpleName())); + } + public static byte[] numberToSortableBytes(Number number) { if (number instanceof Long) { return longToBytes(number.longValue()); @@ -117,7 +159,9 @@ public static byte[] numberToSortableBytes(Number number) { } // TODO: support other number types - return null; + throw new IllegalArgumentException(String.format( + "Unsupported number type: %s(%s)", + number.getClass().getSimpleName(), number)); } public static Number sortableBytesToNumber(byte[] bytes, Class clazz) { @@ -138,7 +182,8 @@ public static Number sortableBytesToNumber(byte[] bytes, Class clazz) { } // TODO: support other number types - return null; + throw new IllegalArgumentException(String.format( + "Unsupported number type: %s", clazz.getSimpleName())); } public static byte[] longToBytes(long value) { @@ -174,16 +219,23 @@ public static boolean isNumber(Class clazz) { return Number.class.isAssignableFrom(clazz); } - public static Object convertToNumber(Object value) { - if (!isNumber(value) && value != null) { + public static Number convertToNumber(Object value) { + if (value == null) { + return null; + } + + Number number; + if (isNumber(value)) { + number = (Number) value; + } else { if (value instanceof Date) { - value = ((Date) value).getTime(); + number = ((Date) value).getTime(); } else { // TODO: add some more types to convert - value = new BigDecimal(value.toString()); + number = new BigDecimal(value.toString()); } } - return value; + return number; } /** diff --git a/src/main/java/com/baidu/hugegraph/util/VersionUtil.java b/src/main/java/com/baidu/hugegraph/util/VersionUtil.java index ba580d83a1..6ac64f20f7 100644 --- a/src/main/java/com/baidu/hugegraph/util/VersionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/VersionUtil.java @@ -41,6 +41,17 @@ public static boolean match(Version version, String begin, String end) { version.compareTo(new Version(end)) < 0; } + /** + * Compare if a version is greater than the other one (inclusive) + * @param version The version to be compared + * @param begin The lower bound of the range + * @return true if it's greater than the other, otherwise false + */ + public static boolean gte(String version, String other) { + E.checkArgumentNotNull(version, "The version to match is null"); + return new Version(version).compareTo(new Version(other)) >= 0; + } + /** * Check whether a component version is matched expected range, * throw an exception if it's not matched. diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index e8d5f7a584..845bbe6708 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.5.5"); + "1.5.6"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java index 143772dd23..2ea760eb7a 100644 --- a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java +++ b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -32,10 +32,13 @@ import com.baidu.hugegraph.unit.util.CollectionUtilTest; import com.baidu.hugegraph.unit.util.HashUtilTest; import com.baidu.hugegraph.unit.util.InsertionOrderUtilTest; +import com.baidu.hugegraph.unit.util.LongEncodingTest; import com.baidu.hugegraph.unit.util.VersionUtilTest; +import com.baidu.hugegraph.unit.version.VersionTest; @RunWith(Suite.class) @Suite.SuiteClasses({ + VersionTest.class, EventHubTest.class, ExtendableIteratorTest.class, @@ -48,7 +51,8 @@ CollectionUtilTest.class, HashUtilTest.class, InsertionOrderUtilTest.class, - VersionUtilTest.class + VersionUtilTest.class, + LongEncodingTest.class }) public class UnitTestSuite { } diff --git a/src/test/java/com/baidu/hugegraph/unit/event/EventHubTest.java b/src/test/java/com/baidu/hugegraph/unit/event/EventHubTest.java index b9f9188e83..ee572833ad 100644 --- a/src/test/java/com/baidu/hugegraph/unit/event/EventHubTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/event/EventHubTest.java @@ -461,7 +461,7 @@ public Object event(Event event) { event.checkArgs(Integer.class); int i = (int) event.args()[0]; - if (i % 100000 == 0) { + if (i % 10000 == 0) { System.out.println("On event '" + notify + "': " + i); } return null; @@ -469,8 +469,8 @@ public Object event(Event event) { }; Thread listenerUpdateThread = new Thread(() -> { - // This will cost about 10s - for (int i = 0; i < 100; i++) { + // This will cost about 1s + for (int i = 0; i < 10; i++) { this.eventHub.listen(notify, listener1); if (!this.eventHub.listeners(notify).contains(listener2)) { this.eventHub.listen(notify, listener2); @@ -478,7 +478,7 @@ public Object event(Event event) { this.wait100ms(); - if (i % 10 == 0) { + if (i % 2 == 0) { this.eventHub.unlisten(notify); } else { this.eventHub.unlisten(notify, listener1); @@ -488,8 +488,8 @@ public Object event(Event event) { listenerUpdateThread.start(); runWithThreads(THREADS_NUM, () -> { - // This will cost about 10s ~ 20s - for (int i = 0; i < 10000 * 100; i++) { + // This will cost about 1s ~ 2s + for (int i = 0; i < 10000 * 10; i++) { this.eventHub.notify(notify, i); Thread.yield(); } diff --git a/src/test/java/com/baidu/hugegraph/unit/util/LongEncodingTest.java b/src/test/java/com/baidu/hugegraph/unit/util/LongEncodingTest.java new file mode 100644 index 0000000000..13ca425da9 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/util/LongEncodingTest.java @@ -0,0 +1,478 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.util; + +import java.math.BigDecimal; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Random; +import java.util.TimeZone; + +import org.junit.Test; + +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; +import com.baidu.hugegraph.util.Bytes; +import com.baidu.hugegraph.util.LongEncoding; +import com.baidu.hugegraph.util.NumericUtil; + +public class LongEncodingTest extends BaseUnitTest { + + @Test + public void testEncode() { + String val0 = LongEncoding.encode(0); + Assert.assertEquals("0", val0); + + String val1 = LongEncoding.encode(1); + Assert.assertEquals("1", val1); + + String val9 = LongEncoding.encode(9); + Assert.assertEquals("9", val9); + + String val10 = LongEncoding.encode(10); + Assert.assertEquals("A", val10); + + String val35 = LongEncoding.encode(35); + Assert.assertEquals("Z", val35); + + String val36 = LongEncoding.encode(36); + Assert.assertEquals("_", val36); + + String val37 = LongEncoding.encode(37); + Assert.assertEquals("a", val37); + + String val62 = LongEncoding.encode(62); + Assert.assertEquals("z", val62); + + String val63 = LongEncoding.encode(63); + Assert.assertEquals("~", val63); + } + + @Test + public void testEncodeWithMultiString() { + String val64 = LongEncoding.encode(64); + Assert.assertEquals("10", val64); + + String val65 = LongEncoding.encode(65); + Assert.assertEquals("11", val65); + + String val99 = LongEncoding.encode(99); + Assert.assertEquals("1Z", val99); + + String val100 = LongEncoding.encode(100); + Assert.assertEquals("1_", val100); + + String val126 = LongEncoding.encode(126); + Assert.assertEquals("1z", val126); + + String val127 = LongEncoding.encode(127); + Assert.assertEquals("1~", val127); + + String val128 = LongEncoding.encode(128); + Assert.assertEquals("20", val128); + + String val200 = LongEncoding.encode(200); + Assert.assertEquals("38", val200); + + String val1000 = LongEncoding.encode(1000); + Assert.assertEquals("Fd", val1000); + + String val1234 = LongEncoding.encode(1234); + Assert.assertEquals("JI", val1234); + + String val10000 = LongEncoding.encode(10000); + Assert.assertEquals("2SG", val10000); + + String val12345 = LongEncoding.encode(12345); + Assert.assertEquals("30u", val12345); + + String val22345 = LongEncoding.encode(22345); + Assert.assertEquals("5T9", val22345); + + String val92345 = LongEncoding.encode(92345); + Assert.assertEquals("MYu", val92345); + + String val12345678 = LongEncoding.encode(12345678); + Assert.assertEquals("k65E", val12345678); + + String val112345678 = LongEncoding.encode(112345678); + Assert.assertEquals("6h_9E", val112345678); + + String valIntMax = LongEncoding.encode(Integer.MAX_VALUE); + Assert.assertEquals("1~~~~~", valIntMax); + + String valLongMax = LongEncoding.encode(Long.MAX_VALUE); + Assert.assertEquals("7~~~~~~~~~~", valLongMax); + } + + @Test + public void testEncodeNegative() { + Assert.assertThrows(IllegalArgumentException.class, () -> { + LongEncoding.encode(-1); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + LongEncoding.encode(Long.MIN_VALUE); + }); + } + + @Test + public void testDecode() { + long valEmpty = LongEncoding.decode(""); + Assert.assertEquals(0, valEmpty); + + long val0 = LongEncoding.decode("0"); + Assert.assertEquals(0, val0); + + long val1 = LongEncoding.decode("1"); + Assert.assertEquals(1, val1); + + long val9 = LongEncoding.decode("9"); + Assert.assertEquals(9, val9); + + long val10 = LongEncoding.decode("A"); + Assert.assertEquals(10, val10); + + long val35 = LongEncoding.decode("Z"); + Assert.assertEquals(35, val35); + + long val36 = LongEncoding.decode("_"); + Assert.assertEquals(36, val36); + + long val37 = LongEncoding.decode("a"); + Assert.assertEquals(37, val37); + + long val62 = LongEncoding.decode("z"); + Assert.assertEquals(62, val62); + + long val63 = LongEncoding.decode("~"); + Assert.assertEquals(63, val63); + } + + @Test + public void testDecodeWithMultiString() { + long val64 = LongEncoding.decode("10"); + Assert.assertEquals(64, val64); + + long val65 = LongEncoding.decode("11"); + Assert.assertEquals(65, val65); + + long val99 = LongEncoding.decode("1Z"); + Assert.assertEquals(99, val99); + + long val100 = LongEncoding.decode("1_"); + Assert.assertEquals(100, val100); + + long val126 = LongEncoding.decode("1z"); + Assert.assertEquals(126, val126); + + long val127 = LongEncoding.decode("1~"); + Assert.assertEquals(127, val127); + + long val128 = LongEncoding.decode("20"); + Assert.assertEquals(128, val128); + + long val200 = LongEncoding.decode("38"); + Assert.assertEquals(200, val200); + + long val1000 = LongEncoding.decode("Fd"); + Assert.assertEquals(1000, val1000); + + long val1234 = LongEncoding.decode("JI"); + Assert.assertEquals(1234, val1234); + + long val10000 = LongEncoding.decode("2SG"); + Assert.assertEquals(10000, val10000); + + long val12345 = LongEncoding.decode("30u"); + Assert.assertEquals(12345, val12345); + + long val22345 = LongEncoding.decode("5T9"); + Assert.assertEquals(22345, val22345); + + long val92345 = LongEncoding.decode("MYu"); + Assert.assertEquals(92345, val92345); + + long val12345678 = LongEncoding.decode("k65E"); + Assert.assertEquals(12345678, val12345678); + + long val112345678 = LongEncoding.decode("6h_9E"); + Assert.assertEquals(112345678, val112345678); + + long valIntMax = LongEncoding.decode("1~~~~~"); + Assert.assertEquals(Integer.MAX_VALUE, valIntMax); + + long valLongMax = LongEncoding.decode("7~~~~~~~~~~"); + Assert.assertEquals(Long.MAX_VALUE, valLongMax); + } + + @Test + public void testEncodeSortable() { + String val1234 = LongEncoding.encodeSortable(1234); + Assert.assertEquals("2JI", val1234); + + String val23 = LongEncoding.encodeSortable(23); + Assert.assertEquals("1N", val23); + + String valIntMax = LongEncoding.encodeSortable(Integer.MAX_VALUE); + Assert.assertEquals("61~~~~~", valIntMax); + + String valLongMax = LongEncoding.encodeSortable(Long.MAX_VALUE); + Assert.assertEquals("B7~~~~~~~~~~", valLongMax); + + String val0 = LongEncoding.encodeSortable(0); + Assert.assertEquals("10", val0); + + String valNeg1 = LongEncoding.encodeSortable(-1); + Assert.assertEquals("0B7~~~~~~~~~~", valNeg1); + + String valIntMin = LongEncoding.encodeSortable(Integer.MIN_VALUE); + Assert.assertEquals("0B7~~~~z00000", valIntMin); + + String valLongMin = LongEncoding.encodeSortable(Long.MIN_VALUE); + Assert.assertEquals("010", valLongMin); + } + + @Test + public void testDecodeSortable() { + long val1234 = LongEncoding.decodeSortable("2JI"); + Assert.assertEquals(1234, val1234); + + long val23 = LongEncoding.decodeSortable("1N"); + Assert.assertEquals(23, val23); + + long valIntMax = LongEncoding.decodeSortable("61~~~~~"); + Assert.assertEquals(Integer.MAX_VALUE, valIntMax); + + long valLongMax = LongEncoding.decodeSortable("B7~~~~~~~~~~"); + Assert.assertEquals(Long.MAX_VALUE, valLongMax); + + long val0 = LongEncoding.decodeSortable("10"); + Assert.assertEquals(0, val0); + + long valn1 = LongEncoding.decodeSortable("0B7~~~~~~~~~~"); + Assert.assertEquals(-1, valn1); + + long valIntMin = LongEncoding.decodeSortable("0B7~~~~z00000"); + Assert.assertEquals(Integer.MIN_VALUE, valIntMin); + + long valLongMin = LongEncoding.decodeSortable("010"); + Assert.assertEquals(Long.MIN_VALUE, valLongMin); + } + + @Test + public void testEncodeNumber() throws ParseException { + String l1234 = LongEncoding.encodeNumber(1234); + Assert.assertEquals("2JI", l1234); + + String d1234 = LongEncoding.encodeNumber(1.234); + Assert.assertEquals("B3~okcR8i3aO", d1234); + + String d21 = LongEncoding.encodeNumber(2.1); + Assert.assertEquals("B400oCoCoCoD", d21); + + String dpi = LongEncoding.encodeNumber(3.1415926); + Assert.assertEquals("B4098ViD4iXA", dpi); + + String fpi = LongEncoding.encodeNumber(3.1415926f); + Assert.assertEquals("610IG~Q", fpi); + + String fn1 = LongEncoding.encodeNumber(-1.0f); + Assert.assertEquals("0B7~~~~~0V~~~", fn1); + + String bMax = LongEncoding.encodeNumber(Byte.MAX_VALUE); + Assert.assertEquals("21~", bMax); + + String bMin = LongEncoding.encodeNumber(Byte.MIN_VALUE); + Assert.assertEquals("0B7~~~~~~~~z0", bMin); + + String sMax = LongEncoding.encodeNumber(Short.MAX_VALUE); + Assert.assertEquals("37~~", sMax); + + String sMin = LongEncoding.encodeNumber(Short.MIN_VALUE); + Assert.assertEquals("0B7~~~~~~~t00", sMin); + + String iMax = LongEncoding.encodeNumber(Integer.MAX_VALUE); + Assert.assertEquals("61~~~~~", iMax); + + String iMin = LongEncoding.encodeNumber(Integer.MIN_VALUE); + Assert.assertEquals("0B7~~~~z00000", iMin); + + String lMax = LongEncoding.encodeNumber(Long.MAX_VALUE); + Assert.assertEquals("B7~~~~~~~~~~", lMax); + + String lMin = LongEncoding.encodeNumber(Long.MIN_VALUE); + Assert.assertEquals("010", lMin); + + String fMax = LongEncoding.encodeNumber(Float.MAX_VALUE); + Assert.assertEquals("61~V~~~", fMax); + + String fMin = LongEncoding.encodeNumber(Float.MIN_VALUE); + Assert.assertEquals("11", fMin); + + String dMax = LongEncoding.encodeNumber(Double.MAX_VALUE); + Assert.assertEquals("B7~k~~~~~~~~", dMax); + + String dMin = LongEncoding.encodeNumber(Double.MIN_VALUE); + Assert.assertEquals("11", dMin); + + String bdLong = LongEncoding.encodeNumber(new BigDecimal("1234")); + Assert.assertEquals("2JI", bdLong); + + String bdFLong = LongEncoding.encodeNumber(new BigDecimal("1234.00")); + Assert.assertEquals("2JI", bdFLong); + + String bdDouble = LongEncoding.encodeNumber(new BigDecimal("1.234")); + Assert.assertEquals("B3~okcR8i3aO", bdDouble); + + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + dateFormat.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai")); + Date time = dateFormat.parse("2018-12-18"); + String date = LongEncoding.encodeNumber(time); + Assert.assertEquals("7MUxuK00", date); + } + + @Test + public void testDecodeNumber() { + Number l1234 = LongEncoding.decodeNumber("2JI", Long.class); + Assert.assertEquals(1234L, l1234); + + Number d1234 = LongEncoding.decodeNumber("B3~okcR8i3aO", Double.class); + Assert.assertEquals(1.234, d1234); + + Number d21 = LongEncoding.decodeNumber("B400oCoCoCoD", Double.class); + Assert.assertEquals(2.1, d21); + + Number dpi = LongEncoding.decodeNumber("B4098ViD4iXA", Double.class); + Assert.assertEquals(3.1415926, dpi); + + Number fpi = LongEncoding.decodeNumber("610IG~Q", Float.class); + Assert.assertEquals(3.1415926f, fpi); + + Number fn1 = LongEncoding.decodeNumber("0B7~~~~~0V~~~", Float.class); + Assert.assertEquals(-1.0f, fn1); + + Number bMax = LongEncoding.decodeNumber("21~", Byte.class); + Assert.assertEquals(Byte.MAX_VALUE, bMax); + + Number bMin = LongEncoding.decodeNumber("0B7~~~~~~~~z0", Byte.class); + Assert.assertEquals(Byte.MIN_VALUE, bMin); + + Number sMax = LongEncoding.decodeNumber("37~~", Short.class); + Assert.assertEquals(Short.MAX_VALUE, sMax); + + Number sMin = LongEncoding.decodeNumber("0B7~~~~~~~t00", Short.class); + Assert.assertEquals(Short.MIN_VALUE, sMin); + + Number iMax = LongEncoding.decodeNumber("61~~~~~", Integer.class); + Assert.assertEquals(Integer.MAX_VALUE, iMax); + + Number iMin = LongEncoding.decodeNumber("0B7~~~~z00000", Integer.class); + Assert.assertEquals(Integer.MIN_VALUE, iMin); + + Number lMax = LongEncoding.decodeNumber("B7~~~~~~~~~~", Long.class); + Assert.assertEquals(Long.MAX_VALUE, lMax); + + Number lMin = LongEncoding.decodeNumber("010", Long.class); + Assert.assertEquals(Long.MIN_VALUE, lMin); + + Number fMax = LongEncoding.decodeNumber("61~V~~~", Float.class); + Assert.assertEquals(Float.MAX_VALUE, fMax); + + Number fMin = LongEncoding.decodeNumber("11", Float.class); + Assert.assertEquals(Float.MIN_VALUE, fMin); + + Number dMax = LongEncoding.decodeNumber("B7~k~~~~~~~~", Double.class); + Assert.assertEquals(Double.MAX_VALUE, dMax); + + Number dMin = LongEncoding.decodeNumber("11", Double.class); + Assert.assertEquals(Double.MIN_VALUE, dMin); + } + + @Test + public void testEncodeSortableThenCompare() { + int count = 100000; + Random random1 = new Random(); + Random random2 = new Random(); + for (int i = 0; i < count; i++) { + long num1 = random1.nextLong(); + long num2 = random2.nextLong(); + + String encoded1 = LongEncoding.encodeSortable(num1); + String encoded2 = LongEncoding.encodeSortable(num2); + int cmp = Bytes.compare(encoded1.getBytes(), encoded2.getBytes()); + + if (num1 == num2) { + Assert.assertTrue(cmp == 0); + } else if (num1 > num2) { + Assert.assertTrue(cmp > 0); + } else { + assert num1 < num2; + Assert.assertTrue(cmp < 0); + } + } + } + + @Test + public void testEncodeNumberThenCompare() { + int count = 100000; + Random random1 = new Random(); + Random random2 = new Random(); + + for (int i = 0; i < count; i++) { + compareEncodedNumber(random1.nextInt(), random2.nextInt()); + } + for (int i = 0; i < count; i++) { + compareEncodedNumber(random1.nextLong(), random2.nextLong()); + } + + for (int i = 0; i < count; i++) { + compareEncodedNumber(random1.nextInt(), random2.nextLong()); + } + for (int i = 0; i < count; i++) { + compareEncodedNumber(random1.nextLong(), random2.nextInt()); + } + + for (int i = 0; i < count; i++) { + compareEncodedNumber(random1.nextFloat(), random2.nextFloat()); + } + for (int i = 0; i < count; i++) { + compareEncodedNumber(random1.nextDouble(), random2.nextDouble()); + } + } + + private static void compareEncodedNumber(Number num1, Number num2) { + int cmpExpected = NumericUtil.compareNumber(num1, num2); + + String encoded1 = LongEncoding.encodeNumber(num1); + String encoded2 = LongEncoding.encodeNumber(num2); + int cmp = Bytes.compare(encoded1.getBytes(), encoded2.getBytes()); + + if (cmpExpected == 0) { + Assert.assertTrue(cmp == 0); + } else if (cmpExpected > 0) { + Assert.assertTrue(cmp > 0); + } else { + assert cmpExpected < 0; + Assert.assertTrue(cmp < 0); + } + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java index e7733b4e15..29e91fd83b 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java @@ -74,6 +74,22 @@ public void testVersionWithThreePart() { Assert.assertFalse(VersionUtil.match(version, "3.20.0", "3.3")); } + @Test + public void testVersionGte() { + String version = "0.2"; + + Assert.assertTrue(VersionUtil.gte(version, "0.2")); + Assert.assertTrue(VersionUtil.gte(version, "0.2.0")); + Assert.assertTrue(VersionUtil.gte(version, "0.1")); + Assert.assertTrue(VersionUtil.gte(version, "0.1.9")); + Assert.assertTrue(VersionUtil.gte(version, "0.0.3")); + + Assert.assertFalse(VersionUtil.gte(version, "0.2.0.1")); + Assert.assertFalse(VersionUtil.gte(version, "0.2.1")); + Assert.assertFalse(VersionUtil.gte(version, "0.3")); + Assert.assertFalse(VersionUtil.gte(version, "0.10")); + } + @Test public void testVersionCheck() { Version version = Version.of("0.6.5"); diff --git a/src/test/java/com/baidu/hugegraph/unit/version/VersionTest.java b/src/test/java/com/baidu/hugegraph/unit/version/VersionTest.java index 1d9ea1b5d5..6d92e1176a 100644 --- a/src/test/java/com/baidu/hugegraph/unit/version/VersionTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/version/VersionTest.java @@ -29,9 +29,10 @@ public class VersionTest { @Test public void testGetCommonVersion() { + String pomVersion = VersionUtil.getPomVersion(); + Assert.assertNotNull(pomVersion); String version = CommonVersion.VERSION.get(); Assert.assertNotNull(version); - String pomVersion = VersionUtil.getPomVersion(); - Assert.assertEquals(version, pomVersion); + Assert.assertEquals(pomVersion, version); } } From 5bac575b29c20acc33d2ebed20dadd597e92d05b Mon Sep 17 00:00:00 2001 From: zhangyi51 Date: Sat, 16 Feb 2019 01:33:49 +0800 Subject: [PATCH 090/217] Set origin iterator last one if all iterators of extendable iterator are empty implemented: #360 Change-Id: I5586ea3626816c085af788830917759f653ed0c4 --- pom.xml | 2 +- .../java/com/baidu/hugegraph/iterator/ExtendableIterator.java | 1 + src/main/java/com/baidu/hugegraph/version/CommonVersion.java | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index cf7270223c..aff3d224e8 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.5.6 + 1.5.7 hugegraph-common https://github.com/hugegraph/hugegraph-common diff --git a/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java b/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java index 0854847adc..4534c6e51c 100644 --- a/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java +++ b/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java @@ -94,6 +94,7 @@ protected boolean fetch() { Iterator first = null; while ((first = this.itors.peekFirst()) != null && !first.hasNext()) { if (first == this.itors.peekLast() && this.itors.size() == 1) { + this.currentIterator = first; // The last one return false; } diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 845bbe6708..f3f1a0f495 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.5.6"); + "1.5.7"); } From 95530cc4b3801084f2c1771fb3067bf5d63d0da5 Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Wed, 27 Feb 2019 21:48:21 +0800 Subject: [PATCH 091/217] add PerfUtil.clear()/Bytes.concat()/CollectionUtil.randomSet() also add some unit tests: HugeConfigTest, PerfUtilTest, NumericUtilTest, ReflectionUtilTest and TimeUtilTest. Change-Id: Ida64154a0bdee62e281585836c5e7ccfc6061c06 --- pom.xml | 9 +- .../baidu/hugegraph/config/HugeConfig.java | 47 ++-- .../com/baidu/hugegraph/perf/PerfUtil.java | 37 +-- .../baidu/hugegraph/testutil/Whitebox.java | 8 +- .../java/com/baidu/hugegraph/util/Bytes.java | 7 + .../baidu/hugegraph/util/CollectionUtil.java | 13 + .../com/baidu/hugegraph/util/NumericUtil.java | 9 +- .../baidu/hugegraph/util/ReflectionUtil.java | 18 +- .../hugegraph/version/CommonVersion.java | 2 +- .../baidu/hugegraph/testclass/TestClass.java | 53 ++++ .../baidu/hugegraph/unit/UnitTestSuite.java | 12 +- .../hugegraph/unit/config/HugeConfigTest.java | 232 ++++++++++++++++++ .../com/baidu/hugegraph/unit/config/test.conf | 16 ++ .../hugegraph/unit/perf/PerfUtilTest.java | 112 +++++++++ .../baidu/hugegraph/unit/util/BytesTest.java | 37 +-- .../unit/util/CollectionUtilTest.java | 23 ++ .../hugegraph/unit/util/NumericUtilTest.java | 109 ++++++++ .../unit/util/ReflectionUtilTest.java | 114 +++++++++ .../hugegraph/unit/util/TimeUtilTest.java | 63 +++++ 19 files changed, 850 insertions(+), 71 deletions(-) create mode 100644 src/test/java/com/baidu/hugegraph/testclass/TestClass.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/config/test.conf create mode 100644 src/test/java/com/baidu/hugegraph/unit/perf/PerfUtilTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/util/TimeUtilTest.java diff --git a/pom.xml b/pom.xml index aff3d224e8..079239dd9f 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.5.7 + 1.5.8 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -60,8 +60,8 @@ 1.10 2.1.1 3.2.2 - 20030203.000550 - 20041127.091804 + 2.4 + 1.11 19.0 1.0 3.0.1 @@ -146,6 +146,7 @@ ${javassist.version} + org.glassfish.jersey.core jersey-client @@ -198,7 +199,7 @@ - 1.5.6.0 + 1.5.8.0 diff --git a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java index d389026962..c61b8fd7eb 100644 --- a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java +++ b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java @@ -60,30 +60,31 @@ public HugeConfig(String configFile) { this(loadConfigFile(configFile)); } - private void reloadIfNeed(Configuration config) { - if (config instanceof AbstractFileConfiguration) { - AbstractFileConfiguration fileConfig = - (AbstractFileConfiguration) config; - - File file = fileConfig.getFile(); - if (file != null) { - // May need to use the original file - this.setFile(file); - } + private void reloadIfNeed(Configuration conf) { + if (!(conf instanceof AbstractFileConfiguration)) { + return; + } + + AbstractFileConfiguration fileConfig = (AbstractFileConfiguration) conf; + + File file = fileConfig.getFile(); + if (file != null) { + // May need to use the original file + this.setFile(file); + } - if (!fileConfig.isDelimiterParsingDisabled()) { - /* - * PropertiesConfiguration will parse the containing comma - * config options into list directly, but we want to do - * this work by ourselves, so reload it and parse into `String` - */ - fileConfig.setDelimiterParsingDisabled(true); - try { - fileConfig.refresh(); - } catch (ConfigurationException e) { - throw new ConfigException("Unable to load config file: %s", - e, file); - } + if (!fileConfig.isDelimiterParsingDisabled()) { + /* + * PropertiesConfiguration will parse the containing comma + * config options into list directly, but we want to do + * this work by ourselves, so reload it and parse into `String` + */ + fileConfig.setDelimiterParsingDisabled(true); + try { + fileConfig.refresh(); + } catch (ConfigurationException e) { + throw new ConfigException("Unable to load config file: %s", + e, file); } } } diff --git a/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java b/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java index 7335e984ef..1cf22ae063 100644 --- a/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java +++ b/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java @@ -26,8 +26,8 @@ import java.lang.annotation.Target; import java.security.InvalidParameterException; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; -import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -39,6 +39,7 @@ import org.slf4j.Logger; import com.baidu.hugegraph.func.TriFunction; +import com.baidu.hugegraph.util.E; import com.baidu.hugegraph.util.Log; import com.baidu.hugegraph.util.ReflectionUtil; import com.google.common.reflect.ClassPath.ClassInfo; @@ -52,10 +53,10 @@ public class PerfUtil { private static final Logger LOG = Log.logger(PerfUtil.class); - private static ThreadLocal instance = new ThreadLocal<>(); + private static final ThreadLocal INSTANCE = new ThreadLocal<>(); - private Map stopwatches; - private Stack callStack; + private final Map stopwatches; + private final Stack callStack; private PerfUtil() { this.stopwatches = new HashMap<>(); @@ -63,10 +64,10 @@ private PerfUtil() { } public static PerfUtil instance() { - PerfUtil p = instance.get(); + PerfUtil p = INSTANCE.get(); if (p == null) { p = new PerfUtil(); - instance.set(p); + INSTANCE.set(p); } return p; } @@ -89,6 +90,7 @@ public boolean start(String name) { } public boolean end(String name) { + long time = now(); String current = this.callStack.pop(); assert current.endsWith(name); @@ -97,15 +99,21 @@ public boolean end(String name) { if (item == null) { throw new InvalidParameterException(name); } - item.endTime(now()); + item.endTime(time); return true; } - public void profilePackage(String... packages) throws - NotFoundException, CannotCompileException, - ClassNotFoundException, IOException { - Set loadedClasses = new LinkedHashSet<>(); + public void clear() { + E.checkState(this.callStack.empty(), + "Can't be cleared when the call has not ended yet"); + this.stopwatches.clear(); + } + + public void profilePackage(String... packages) + throws NotFoundException, IOException, + ClassNotFoundException, CannotCompileException { + Set loadedClasses = new HashSet<>(); Iterator classes = ReflectionUtil.classes(packages); while (classes.hasNext()) { @@ -125,8 +133,9 @@ public void profilePackage(String... packages) throws } } - public void profileClass(String... classes) throws - NotFoundException, CannotCompileException, ClassNotFoundException { + public void profileClass(String... classes) + throws NotFoundException, CannotCompileException, + ClassNotFoundException { ClassPool classPool = ClassPool.getDefault(); for (String cls : classes) { @@ -145,7 +154,7 @@ public void profileClass(String... classes) throws } private void profile(CtMethod ctMethod) - throws CannotCompileException, ClassNotFoundException { + throws CannotCompileException, ClassNotFoundException { final String START = "com.baidu.hugegraph.perf.PerfUtil.instance().start(\"%s\");"; final String END = diff --git a/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java b/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java index 1b90a5d014..f4436765aa 100644 --- a/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java +++ b/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java @@ -26,12 +26,12 @@ public class Whitebox { public static void setInternalState(Object target, String fieldName, Object value) { try { - Field field = target.getClass().getDeclaredField(fieldName); - field.setAccessible(true); - field.set(target, value); + Field f = getFieldFromHierarchy(target.getClass(), fieldName); + f.setAccessible(true); + f.set(target, value); } catch (Exception e) { Assert.fail(String.format("Can't change value of '%s' against " + - "target '%s'", fieldName, target)); + "target '%s': %s", fieldName, target, e)); } } diff --git a/src/main/java/com/baidu/hugegraph/util/Bytes.java b/src/main/java/com/baidu/hugegraph/util/Bytes.java index 8a2a72ef08..795130b288 100644 --- a/src/main/java/com/baidu/hugegraph/util/Bytes.java +++ b/src/main/java/com/baidu/hugegraph/util/Bytes.java @@ -44,6 +44,13 @@ public static int compare(byte[] bytes1, byte[] bytes2) { return CMP.compare(bytes1, bytes2); } + public static byte[] concat(byte[] bytes1, byte[] bytes2) { + byte[] result = new byte[bytes1.length + bytes2.length]; + System.arraycopy(bytes1, 0, result, 0, bytes1.length); + System.arraycopy(bytes2, 0, result, bytes1.length, bytes2.length); + return result; + } + public static boolean prefixWith(byte[] bytes, byte[] prefix) { if (bytes.length < prefix.length) { return false; diff --git a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java index ca8ef5eb76..2a4c7ca63e 100644 --- a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java @@ -29,6 +29,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import java.util.concurrent.ThreadLocalRandom; public final class CollectionUtil { @@ -68,6 +69,18 @@ public static boolean prefixOf(List prefix, List all) { return true; } + public static Set randomSet(int min, int max, int count) { + E.checkArgument(max > min, "Invalid min/max: %s/%s", min, max); + E.checkArgument(0 < count && count <= max - min, + "Invalid count %s", count); + + Set randoms = new HashSet<>(); + while (randoms.size() < count) { + randoms.add(ThreadLocalRandom.current().nextInt(min, max)); + } + return randoms; + } + public static boolean allUnique(Collection collection) { return collection.stream().allMatch(new HashSet<>()::add); } diff --git a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java index ee608d3e19..9ab7c74d0d 100644 --- a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java @@ -90,7 +90,7 @@ public static float sortableIntToFloat(int val) { * @return The sortable long value */ public static long sortableDoubleBits(long bits) { - return bits ^ (bits >> 63) & 0x7fffffffffffffffL; + return bits ^ ((bits >> 63) & 0x7fffffffffffffffL); } /** @@ -100,7 +100,12 @@ public static long sortableDoubleBits(long bits) { * @return The sortable int value */ public static int sortableFloatBits(int bits) { - return bits ^ (bits >> 31) & 0x7fffffff; + /* + * Convert to its inverse digits if negative else keep the origin + * NOTE: (bits >> 31) is 0x00000000 if bits >= 0 + * (bits >> 31) is 0xFFFFFFFF if bits < 0 + */ + return bits ^ ((bits >> 31) & 0x7fffffff); } public static long numberToSortableLong(Number number) { diff --git a/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java b/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java index e5aa3ec7ba..7b0eca174b 100644 --- a/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java @@ -42,6 +42,7 @@ public static boolean isSimpleType(Class type) { if (type.isPrimitive() || type.equals(String.class) || type.equals(Boolean.class) || + type.equals(Character.class) || NumericUtil.isNumber(type)) { return true; } @@ -49,9 +50,9 @@ public static boolean isSimpleType(Class type) { } public static List getMethodsAnnotatedWith( - Class type, - Class annotation, - boolean withSuperClass) { + Class type, + Class annotation, + boolean withSuperClass) { final List methods = new LinkedList<>(); Class klass = type; do { @@ -66,9 +67,10 @@ public static List getMethodsAnnotatedWith( } public static List getMethodsAnnotatedWith( - CtClass type, - Class annotation, - boolean withSuperClass) throws NotFoundException { + CtClass type, + Class annotation, + boolean withSuperClass) + throws NotFoundException { final List methods = new LinkedList<>(); CtClass klass = type; @@ -84,7 +86,7 @@ public static List getMethodsAnnotatedWith( } public static Iterator classes(String... packages) - throws IOException { + throws IOException { ClassPath path = ClassPath.from(ReflectionUtil.class.getClassLoader()); ExtendableIterator results = new ExtendableIterator<>(); for (String p : packages) { @@ -94,7 +96,7 @@ public static Iterator classes(String... packages) } public static List superClasses(String clazz) - throws NotFoundException { + throws NotFoundException { CtClass klass = ClassPool.getDefault().get(clazz); klass = klass.getSuperclass(); diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index f3f1a0f495..b7bafdefa0 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.5.7"); + "1.5.8"); } diff --git a/src/test/java/com/baidu/hugegraph/testclass/TestClass.java b/src/test/java/com/baidu/hugegraph/testclass/TestClass.java new file mode 100644 index 0000000000..0fe47a1b6d --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/testclass/TestClass.java @@ -0,0 +1,53 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.testclass; + +import com.baidu.hugegraph.perf.PerfUtil.Watched; + +public class TestClass { + + public static class Foo { + + @Watched + public void foo() { + this.bar(); + } + + @Watched + public void bar() {} + } + + public static class Base { + + @Watched + public void func() {} + } + + public static class Sub extends Base { + + @Watched + public void func1() {} + + public void func2() {} + + @Watched + public void func3() {} + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java index 2ea760eb7a..c8f6e4cfb3 100644 --- a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java +++ b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -22,24 +22,31 @@ import org.junit.runner.RunWith; import org.junit.runners.Suite; +import com.baidu.hugegraph.unit.config.HugeConfigTest; import com.baidu.hugegraph.unit.event.EventHubTest; import com.baidu.hugegraph.unit.iterator.ExtendableIteratorTest; import com.baidu.hugegraph.unit.iterator.FilterIteratorTest; import com.baidu.hugegraph.unit.iterator.FlatMapperFilterIteratorTest; import com.baidu.hugegraph.unit.iterator.FlatMapperIteratorTest; import com.baidu.hugegraph.unit.iterator.MapperIteratorTest; +import com.baidu.hugegraph.unit.perf.PerfUtilTest; import com.baidu.hugegraph.unit.util.BytesTest; import com.baidu.hugegraph.unit.util.CollectionUtilTest; import com.baidu.hugegraph.unit.util.HashUtilTest; import com.baidu.hugegraph.unit.util.InsertionOrderUtilTest; import com.baidu.hugegraph.unit.util.LongEncodingTest; +import com.baidu.hugegraph.unit.util.NumericUtilTest; +import com.baidu.hugegraph.unit.util.ReflectionUtilTest; +import com.baidu.hugegraph.unit.util.TimeUtilTest; import com.baidu.hugegraph.unit.util.VersionUtilTest; import com.baidu.hugegraph.unit.version.VersionTest; @RunWith(Suite.class) @Suite.SuiteClasses({ - VersionTest.class, + HugeConfigTest.class, EventHubTest.class, + PerfUtilTest.class, + VersionTest.class, ExtendableIteratorTest.class, FilterIteratorTest.class, @@ -51,6 +58,9 @@ CollectionUtilTest.class, HashUtilTest.class, InsertionOrderUtilTest.class, + NumericUtilTest.class, + ReflectionUtilTest.class, + TimeUtilTest.class, VersionUtilTest.class, LongEncodingTest.class }) diff --git a/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java b/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java new file mode 100644 index 0000000000..6d5066a9d8 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java @@ -0,0 +1,232 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.config; + +import static com.baidu.hugegraph.config.OptionChecker.allowValues; +import static com.baidu.hugegraph.config.OptionChecker.disallowEmpty; +import static com.baidu.hugegraph.config.OptionChecker.nonNegativeInt; +import static com.baidu.hugegraph.config.OptionChecker.positiveInt; +import static com.baidu.hugegraph.config.OptionChecker.rangeDouble; +import static com.baidu.hugegraph.config.OptionChecker.rangeInt; + +import java.util.Arrays; + +import org.apache.commons.configuration.Configuration; +import org.apache.commons.configuration.PropertiesConfiguration; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.baidu.hugegraph.config.ConfigListOption; +import com.baidu.hugegraph.config.ConfigOption; +import com.baidu.hugegraph.config.HugeConfig; +import com.baidu.hugegraph.config.OptionHolder; +import com.baidu.hugegraph.config.OptionSpace; +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.testutil.Whitebox; +import com.baidu.hugegraph.unit.BaseUnitTest; +import com.google.common.collect.ImmutableMap; + +public class HugeConfigTest extends BaseUnitTest { + + private static final String CONF = + "src/test/java/com/baidu/hugegraph/unit/config/test.conf"; + + @BeforeClass + public static void init() { + OptionSpace.register("test", TestOptions.class.getName()); + } + + @Test + public void testHugeConfig() throws Exception { + Configuration conf = new PropertiesConfiguration(); + Whitebox.setInternalState(conf, "delimiterParsingDisabled", true); + + HugeConfig config = new HugeConfig(conf); + + Assert.assertEquals("text1-value", config.get(TestOptions.text1)); + Assert.assertEquals("text2-value", config.get(TestOptions.text2)); + Assert.assertEquals("CHOICE-1", config.get(TestOptions.text3)); + + Assert.assertEquals(1, (int) config.get(TestOptions.int1)); + Assert.assertEquals(10, (int) config.get(TestOptions.int2)); + Assert.assertEquals(10, (int) config.get(TestOptions.int3)); + + Assert.assertEquals(100L, (long) config.get(TestOptions.long1)); + + Assert.assertEquals(100.0f, config.get(TestOptions.float1), 0f); + Assert.assertEquals(100.0f, config.get(TestOptions.double1), 0d); + + Assert.assertEquals(true, config.get(TestOptions.bool)); + + Assert.assertEquals(Arrays.asList("list-value1", "list-value2"), + config.get(TestOptions.list)); + + Assert.assertEquals(ImmutableMap.of("key1", "value1", "key2", "value2"), + config.getMap(TestOptions.map)); + } + + @Test + public void testHugeConfigWithFile() throws Exception { + HugeConfig config = new HugeConfig(CONF); + + Assert.assertEquals("file-text1-value", config.get(TestOptions.text1)); + Assert.assertEquals("file-text2-value", config.get(TestOptions.text2)); + Assert.assertEquals("CHOICE-3", config.get(TestOptions.text3)); + + Assert.assertEquals(2, (int) config.get(TestOptions.int1)); + Assert.assertEquals(0, (int) config.get(TestOptions.int2)); + Assert.assertEquals(1, (int) config.get(TestOptions.int3)); + + Assert.assertEquals(99L, (long) config.get(TestOptions.long1)); + + Assert.assertEquals(66.0f, config.get(TestOptions.float1), 0f); + Assert.assertEquals(66.0f, config.get(TestOptions.double1), 0d); + + Assert.assertEquals(false, config.get(TestOptions.bool)); + + Assert.assertEquals(Arrays.asList("file-v1", "file-v2", "file-v3"), + config.get(TestOptions.list)); + + Assert.assertEquals(ImmutableMap.of("key1", "value1", "key3", "value3"), + config.getMap(TestOptions.map)); + } + + @Test + public void testHugeConfigWithConfiguration() throws Exception { + HugeConfig config = new HugeConfig(new PropertiesConfiguration(CONF)); + + Assert.assertEquals("file-text1-value", config.get(TestOptions.text1)); + Assert.assertEquals("file-text2-value", config.get(TestOptions.text2)); + Assert.assertEquals("CHOICE-3", config.get(TestOptions.text3)); + } + + public static final class TestOptions extends OptionHolder { + + private static volatile TestOptions instance; + + public static synchronized TestOptions instance() { + if (instance == null) { + instance = new TestOptions(); + instance.registerOptions(); + } + return instance; + } + + public static final ConfigOption text1 = + new ConfigOption<>( + "group1.text1", + "description of group1.text1", + disallowEmpty(), + "text1-value" + ); + + public static final ConfigOption text2 = + new ConfigOption<>( + "group1.text2", + "description of group1.text2", + disallowEmpty(), + "text2-value" + ); + + public static final ConfigOption text3 = + new ConfigOption<>( + "group1.text3", + "description of group1.text3", + allowValues("CHOICE-1", "CHOICE-2", "CHOICE-3"), + "CHOICE-1" + ); + + public static final ConfigOption int1 = + new ConfigOption<>( + "group1.int1", + "description of group1.int1", + rangeInt(1, 100), + 1 + ); + + public static final ConfigOption int2 = + new ConfigOption<>( + "group1.int2", + "description of group1.int2", + nonNegativeInt(), + 10 + ); + + public static final ConfigOption int3 = + new ConfigOption<>( + "group1.int3", + "description of group1.int3", + positiveInt(), + 10 + ); + + public static final ConfigOption long1 = + new ConfigOption<>( + "group1.long1", + "description of group1.long1", + rangeInt(1L, 100L), + 100L + ); + + public static final ConfigOption float1 = + new ConfigOption<>( + "group1.float1", + "description of group1.float1", + rangeDouble(1.0f, 100.0f), + 100.0f + ); + + public static final ConfigOption double1 = + new ConfigOption<>( + "group1.double1", + "description of group1.double1", + rangeDouble(1.0, 100.0), + 100.0 + ); + + public static final ConfigOption bool = + new ConfigOption<>( + "group1.bool", + "description of group1.bool", + disallowEmpty(), + true + ); + + public static final ConfigListOption list = + new ConfigListOption<>( + "group1.list", + false, + "description of group1.list", + disallowEmpty(), + String.class, + "list-value1", "list-value2" + ); + + public static final ConfigListOption map = + new ConfigListOption<>( + "group1.map", + false, + "description of group1.map", + disallowEmpty(), + String.class, + "key1:value1", "key2:value2" + ); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/config/test.conf b/src/test/java/com/baidu/hugegraph/unit/config/test.conf new file mode 100644 index 0000000000..bf31c70f6a --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/config/test.conf @@ -0,0 +1,16 @@ +group1.text1=file-text1-value +group1.text2=file-text2-value +group1.text3=CHOICE-3 + +group1.int1=2 +group1.int2=0 +group1.int3=1 +group1.long1=99 + +group1.float1=66 +group1.double1=66 + +group1.bool=false + +group1.list=[file-v1, file-v2, file-v3] +group1.map=[key1:value1, key3:value3] diff --git a/src/test/java/com/baidu/hugegraph/unit/perf/PerfUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/perf/PerfUtilTest.java new file mode 100644 index 0000000000..f7a5c524ae --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/perf/PerfUtilTest.java @@ -0,0 +1,112 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.perf; + +import java.io.IOException; +import java.util.Map; + +import org.junit.After; +import org.junit.Test; + +import com.baidu.hugegraph.perf.PerfUtil; +import com.baidu.hugegraph.testclass.TestClass.Foo; +import com.baidu.hugegraph.testclass.TestClass.Sub; +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class PerfUtilTest extends BaseUnitTest { + + private static final PerfUtil perf = PerfUtil.instance(); + + @After + public void teardown() { + perf.clear(); + } + + @Test + public void testPerfUtil() throws Exception { + /* + * TODO: call profilePackage("com.baidu.hugegraph.testclass") and + * remove class Foo. now exception "duplicate class definition" throws + * since JUnit loaded class TestClass before testPerfUtil() + */ + perf.profilePackage("com.baidu.hugegraph.testclass"); + perf.profileClass("com.baidu.hugegraph.testclass.TestClass$Foo"); + + Foo obj = new Foo(); + obj.foo(); + + perf.toString(); + perf.toECharts(); + String json = perf.toJson(); + + assertContains(json, "foo.times", 1); + assertContains(json, "foo/bar.times", 1); + + perf.clear(); + + obj.foo(); + obj.foo(); + + perf.toString(); + perf.toECharts(); + json = perf.toJson(); + + assertContains(json, "foo.times", 2); + assertContains(json, "foo/bar.times", 2); + } + + @Test + public void testPerfUtilWithProfileClass() throws Exception { + perf.profileClass("com.baidu.hugegraph.testclass.TestClass$Base"); + perf.profileClass("com.baidu.hugegraph.testclass.TestClass$Sub"); + + Sub obj = new Sub(); + obj.func(); + obj.func1(); + obj.func2(); + obj.func3(); + obj.func3(); + obj.func3(); + + String json = perf.toJson(); + assertContains(json, "func.times", 1); + assertContains(json, "func1.times", 1); + assertContains(json, "func3.times", 3); + } + + private static void assertContains(String json, String key, Object value) + throws JsonParseException, JsonMappingException, IOException { + ObjectMapper mapper = new ObjectMapper(); + Map map = mapper.readValue(json, Map.class); + String[] keys = key.split("\\."); + Object actual = null; + for (String k : keys) { + actual = map.get(k); + if (actual instanceof Map) { + map = (Map) actual; + } + } + Assert.assertEquals(value, actual); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/util/BytesTest.java b/src/test/java/com/baidu/hugegraph/unit/util/BytesTest.java index 6e5a554e84..f09c5e1e08 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/BytesTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/BytesTest.java @@ -30,8 +30,8 @@ public class BytesTest extends BaseUnitTest { @Test public void testBytesEquals() { - Assert.assertTrue(Bytes.equals("12345678".getBytes(), - "12345678".getBytes())); + Assert.assertTrue(Bytes.equals(b("12345678"), + b("12345678"))); Assert.assertTrue(Bytes.equals(new byte[]{1, 3, 5, 7}, new byte[]{1, 3, 5, 7})); @@ -43,10 +43,8 @@ public void testBytesEquals() { @Test public void testBytesPrefixWith() { - Assert.assertTrue(Bytes.prefixWith("12345678".getBytes(), - "12345678".getBytes())); - Assert.assertTrue(Bytes.prefixWith("12345678".getBytes(), - "1234567".getBytes())); + Assert.assertTrue(Bytes.prefixWith(b("12345678"), b("12345678"))); + Assert.assertTrue(Bytes.prefixWith(b("12345678"), b("1234567"))); Assert.assertTrue(Bytes.prefixWith(new byte[]{1, 3, 5, 7}, new byte[]{1, 3, 5, 7})); @@ -65,12 +63,9 @@ public void testBytesPrefixWith() { @Test public void testBytesCompare() { - Assert.assertTrue(Bytes.compare("12345678".getBytes(), - "12345678".getBytes()) == 0); - Assert.assertTrue(Bytes.compare("12345678".getBytes(), - "1234567".getBytes()) > 0); - Assert.assertTrue(Bytes.compare("12345678".getBytes(), - "12345679".getBytes()) < 0); + Assert.assertTrue(Bytes.compare(b("12345678"), b("12345678")) == 0); + Assert.assertTrue(Bytes.compare(b("12345678"), b("1234567")) > 0); + Assert.assertTrue(Bytes.compare(b("12345678"), b("12345679")) < 0); Assert.assertTrue(Bytes.compare(new byte[]{1, 3, 5, 7}, new byte[]{1, 3, 5, 7}) == 0); @@ -113,15 +108,29 @@ public void testBytesCompare() { } @Test - public void testBytesTohex() { + public void testBytesConcat() { + Assert.assertArrayEquals(b("12345678"), + Bytes.concat(b("1234"), b("5678"))); + Assert.assertArrayEquals(b("12345678"), + Bytes.concat(b("12345678"), b(""))); + Assert.assertArrayEquals(b("12345678"), + Bytes.concat(b(""), b("12345678"))); + } + + @Test + public void testBytesToHex() { int value = 0x0103807f; byte[] bytes = NumericUtil.intToBytes(value); Assert.assertEquals("0103807f", Bytes.toHex(bytes)); } @Test - public void testBytesFromhex() { + public void testBytesFromHex() { Assert.assertEquals(0x0103807f, NumericUtil.bytesToInt(Bytes.fromHex("0103807f"))); } + + private static byte[] b(String string) { + return string.getBytes(); + } } diff --git a/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java index ec0e1b7e58..72ba0239d9 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java @@ -73,6 +73,29 @@ public void testPrefixOf() { Assert.assertFalse(CollectionUtil.prefixOf(list4, list)); } + @Test + public void testRandomSet() { + Set set = CollectionUtil.randomSet(0, 100, 10); + for (int i : set) { + Assert.assertTrue(0 <= i && i < 100); + } + + // invalid min + Assert.assertThrows(IllegalArgumentException.class, () -> { + CollectionUtil.randomSet(200, 100, 10); + }); + + // invalid count = 0 + Assert.assertThrows(IllegalArgumentException.class, () -> { + CollectionUtil.randomSet(1, 100, 0); + }); + + // invalid count > max - min + Assert.assertThrows(IllegalArgumentException.class, () -> { + CollectionUtil.randomSet(1, 100, 100); + }); + } + @Test public void testAllUnique() { List list = ImmutableList.of(); diff --git a/src/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java new file mode 100644 index 0000000000..bd64f79352 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java @@ -0,0 +1,109 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.util; + +import java.math.BigDecimal; + +import org.junit.Test; + +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; +import com.baidu.hugegraph.util.Bytes; +import com.baidu.hugegraph.util.NumericUtil; + +public class NumericUtilTest extends BaseUnitTest { + + @Test + public void testNumberToSortableBytes() { + // byte + byte[] bytes = NumericUtil.numberToSortableBytes((byte) 0x33); + assertEquals(new byte[]{0x33}, bytes); + + // short + bytes = NumericUtil.numberToSortableBytes((short) 0x11223344); + assertEquals(new byte[]{0, 0, 0x33, 0x44}, bytes); + + // int + bytes = NumericUtil.numberToSortableBytes(0x11223344); + assertEquals(new byte[]{0x11, 0x22, 0x33, 0x44}, bytes); + + // long + bytes = NumericUtil.numberToSortableBytes(0x1122334455L); + assertEquals(new byte[]{0, 0, 0, 0x11, 0x22, 0x33, 0x44, 0x55}, bytes); + + // float + bytes = NumericUtil.numberToSortableBytes(3.14f); + assertEquals(new byte[]{0x40, 0x48, (byte) 0xf5, (byte) 0xc3}, bytes); + + // double + bytes = NumericUtil.numberToSortableBytes(3.1415926d); + assertEquals(new byte[]{0x40, 0x09, 0x21, (byte) 0xfb, + 0x4d, 0x12, (byte) 0xd8, 0x4a}, bytes); + + // BigDecimal + Assert.assertThrows(IllegalArgumentException.class, () -> { + NumericUtil.numberToSortableBytes(new BigDecimal(123)); + }); + } + @Test + public void testSortableBytesToNumber() { + // byte + Number value = NumericUtil.sortableBytesToNumber(new byte[]{0x33}, + Byte.class); + Assert.assertEquals(value, (byte) 0x33); + + // short + value = NumericUtil.sortableBytesToNumber(new byte[]{0, 0, 0x33, 0x44}, + Short.class); + Assert.assertEquals((short) 0x3344, value); + + // int + value = NumericUtil.sortableBytesToNumber( + new byte[]{0x11, 0x22, 0x33, 0x44}, Integer.class); + Assert.assertEquals(0x11223344, value); + + // long + value = NumericUtil.sortableBytesToNumber( + new byte[]{0, 0, 0, 0x11, 0x22, 0x33, 0x44, 0x55}, Long.class); + Assert.assertEquals(0x1122334455L, value); + + // float + value = NumericUtil.sortableBytesToNumber( + new byte[]{0x40, 0x48, (byte) 0xf5, (byte) 0xc3}, Float.class); + Assert.assertEquals(3.14f, value); + + // double + value = NumericUtil.sortableBytesToNumber( + new byte[]{0x40, 0x09, 0x21, (byte) 0xfb, + 0x4d, 0x12, (byte) 0xd8, 0x4a}, + Double.class); + Assert.assertEquals(3.1415926d, value); + + // BigDecimal + Assert.assertThrows(IllegalArgumentException.class, () -> { + NumericUtil.sortableBytesToNumber(new byte[123], BigDecimal.class); + }); + } + + private static void assertEquals(byte[] bytes1, byte[] bytes2) { + Assert.assertTrue(Bytes.toHex(bytes1) + " != " + Bytes.toHex(bytes2), + Bytes.equals(bytes1, bytes2)); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java new file mode 100644 index 0000000000..c619fdc081 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java @@ -0,0 +1,114 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.util; + +import java.io.IOException; +import java.lang.reflect.Method; +import java.util.List; + +import org.apache.commons.collections.IteratorUtils; +import org.junit.Test; + +import com.baidu.hugegraph.perf.PerfUtil.Watched; +import com.baidu.hugegraph.testclass.TestClass.Base; +import com.baidu.hugegraph.testclass.TestClass.Sub; +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; +import com.baidu.hugegraph.util.ReflectionUtil; +import com.google.common.reflect.ClassPath.ClassInfo; + +import javassist.NotFoundException; + +public class ReflectionUtilTest extends BaseUnitTest { + + @Test + public void testIsSimpleType() { + Assert.assertTrue(ReflectionUtil.isSimpleType(byte.class)); + Assert.assertTrue(ReflectionUtil.isSimpleType(char.class)); + Assert.assertTrue(ReflectionUtil.isSimpleType(short.class)); + Assert.assertTrue(ReflectionUtil.isSimpleType(int.class)); + Assert.assertTrue(ReflectionUtil.isSimpleType(long.class)); + Assert.assertTrue(ReflectionUtil.isSimpleType(float.class)); + Assert.assertTrue(ReflectionUtil.isSimpleType(double.class)); + Assert.assertTrue(ReflectionUtil.isSimpleType(boolean.class)); + + Assert.assertTrue(ReflectionUtil.isSimpleType(Byte.class)); + Assert.assertTrue(ReflectionUtil.isSimpleType(Character.class)); + Assert.assertTrue(ReflectionUtil.isSimpleType(Short.class)); + Assert.assertTrue(ReflectionUtil.isSimpleType(Integer.class)); + Assert.assertTrue(ReflectionUtil.isSimpleType(Long.class)); + Assert.assertTrue(ReflectionUtil.isSimpleType(Float.class)); + Assert.assertTrue(ReflectionUtil.isSimpleType(Double.class)); + Assert.assertTrue(ReflectionUtil.isSimpleType(Boolean.class)); + Assert.assertTrue(ReflectionUtil.isSimpleType(String.class)); + + Assert.assertFalse(ReflectionUtil.isSimpleType(Object.class)); + Assert.assertFalse(ReflectionUtil.isSimpleType(BaseUnitTest.class)); + } + + @Test + public void testGetMethodsAnnotatedWith() { + List methods; + + methods = ReflectionUtil.getMethodsAnnotatedWith(Sub.class, + Watched.class, + false); + methods.sort((m1, m2) -> m1.getName().compareTo(m2.getName())); + Assert.assertEquals(2, methods.size()); + Assert.assertEquals("func1", methods.get(0).getName()); + Assert.assertEquals("func3", methods.get(1).getName()); + + + methods = ReflectionUtil.getMethodsAnnotatedWith(Sub.class, + Watched.class, + true); + methods.sort((m1, m2) -> m1.getName().compareTo(m2.getName())); + Assert.assertEquals(3, methods.size()); + Assert.assertEquals("func", methods.get(0).getName()); + Assert.assertEquals("func1", methods.get(1).getName()); + Assert.assertEquals("func3", methods.get(2).getName()); + } + + @Test + public void testClasses() throws IOException { + @SuppressWarnings("unchecked") + List classes = IteratorUtils.toList(ReflectionUtil.classes( + "com.baidu.hugegraph.util")); + Assert.assertEquals(13, classes.size()); + classes.sort((c1, c2) -> c1.getName().compareTo(c2.getName())); + Assert.assertEquals("com.baidu.hugegraph.util.Bytes", + classes.get(0).getName()); + Assert.assertEquals("com.baidu.hugegraph.util.CheckSocket", + classes.get(1).getName()); + Assert.assertEquals("com.baidu.hugegraph.util.CollectionUtil", + classes.get(2).getName()); + Assert.assertEquals("com.baidu.hugegraph.util.VersionUtil", + classes.get(12).getName()); + } + + @Test + public void testSuperClasses() throws NotFoundException { + List classes = ReflectionUtil.superClasses(Sub.class.getName()); + Assert.assertEquals(2, classes.size()); + classes.sort((c1, c2) -> c1.compareTo(c2)); + Assert.assertEquals(Base.class.getName(), classes.get(0)); + Assert.assertEquals(Object.class.getName(), classes.get(1)); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/util/TimeUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/TimeUtilTest.java new file mode 100644 index 0000000000..218e4dccd0 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/util/TimeUtilTest.java @@ -0,0 +1,63 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.util; + +import java.util.Date; + +import org.junit.Test; + +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; +import com.baidu.hugegraph.util.TimeUtil; + +public class TimeUtilTest extends BaseUnitTest { + + @Test + public void testTimeGen() { + long time = TimeUtil.timeGen(); + long base = TimeUtil.BASE_TIME; + long difference = time - base - System.currentTimeMillis(); + Assert.assertTrue(difference < 1000); + } + + @Test + public void testTimeGenWithDate() { + @SuppressWarnings("deprecation") + Date date = new Date(2019 - 1900, 2, 28); + long time = TimeUtil.timeGen(date); + Assert.assertEquals(41904000000L, time); + } + + @Test + public void testTimeGenWithLong() { + long date = TimeUtil.BASE_TIME + 123L; + long time = TimeUtil.timeGen(date); + Assert.assertEquals(123L, time); + } + + @Test + public void testTillNextMillis() { + for (int i = 0; i < 100; i++) { + long lastTimestamp = TimeUtil.timeGen(); + long time = TimeUtil.tillNextMillis(lastTimestamp); + Assert.assertNotEquals(lastTimestamp, time); + } + } +} From 306b4f1829790caa7c6aa51e93592c93e95218a8 Mon Sep 17 00:00:00 2001 From: Zhangmei Li Date: Mon, 8 Apr 2019 16:02:59 +0800 Subject: [PATCH 092/217] fix NPE in EventHub.destroy() fix: #18 Change-Id: I30f12a583c8168045a2b240995c5277b0efbaa4c --- .../com/baidu/hugegraph/event/EventHub.java | 1 + .../iterator/ExtendableIterator.java | 22 +++++++++---------- .../unit/iterator/ExtendableIteratorTest.java | 10 ++++----- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/baidu/hugegraph/event/EventHub.java b/src/main/java/com/baidu/hugegraph/event/EventHub.java index 6b6779f7b9..5bd08706a2 100644 --- a/src/main/java/com/baidu/hugegraph/event/EventHub.java +++ b/src/main/java/com/baidu/hugegraph/event/EventHub.java @@ -76,6 +76,7 @@ public static synchronized void init(int poolSize) { public static synchronized boolean destroy(long timeout) throws InterruptedException { + E.checkState(executor != null, "EventHub has not been initialized"); LOG.debug("Destroy pool for EventHub"); executor.shutdown(); return executor.awaitTermination(timeout, TimeUnit.SECONDS); diff --git a/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java b/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java index 4534c6e51c..7d036111ae 100644 --- a/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java +++ b/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java @@ -40,9 +40,9 @@ public ExtendableIterator() { this.currentIterator = null; } - public ExtendableIterator(Iterator itor) { + public ExtendableIterator(Iterator iter) { this(); - this.extend(itor); + this.extend(iter); } public ExtendableIterator(Iterator itor1, Iterator itor2) { @@ -51,25 +51,25 @@ public ExtendableIterator(Iterator itor1, Iterator itor2) { this.extend(itor2); } - public ExtendableIterator extend(Iterator itor) { + public ExtendableIterator extend(Iterator iter) { E.checkState(this.currentIterator == null, "Can't extend iterator after iterating"); - if (itor != null) { - this.itors.addLast(itor); + if (iter != null) { + this.itors.addLast(iter); } return this; } @Override public void close() throws Exception { - for (Iterator itor : this.removedItors) { - if (itor instanceof AutoCloseable) { - ((AutoCloseable) itor).close(); + for (Iterator iter : this.removedItors) { + if (iter instanceof AutoCloseable) { + ((AutoCloseable) iter).close(); } } - for (Iterator itor : this.itors) { - if (itor instanceof AutoCloseable) { - ((AutoCloseable) itor).close(); + for (Iterator iter : this.itors) { + if (iter instanceof AutoCloseable) { + ((AutoCloseable) iter).close(); } } } diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/ExtendableIteratorTest.java b/src/test/java/com/baidu/hugegraph/unit/iterator/ExtendableIteratorTest.java index 2a4cf2d7aa..1a9a635b5f 100644 --- a/src/test/java/com/baidu/hugegraph/unit/iterator/ExtendableIteratorTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/iterator/ExtendableIteratorTest.java @@ -205,21 +205,21 @@ public void testCloseAfterNext() throws Exception { protected static class CloseableItor implements Iterator, AutoCloseable { - private final Iterator itor; + private final Iterator iter; private boolean closed = false; - public CloseableItor(Iterator itor) { - this.itor = itor; + public CloseableItor(Iterator iter) { + this.iter = iter; } @Override public boolean hasNext() { - return this.itor.hasNext(); + return this.iter.hasNext(); } @Override public V next() { - return this.itor.next(); + return this.iter.next(); } @Override From 87c582648088a6ee86eea61032be00a1132d0121 Mon Sep 17 00:00:00 2001 From: liningrui Date: Sun, 6 Jan 2019 20:13:39 +0800 Subject: [PATCH 093/217] Let RestClient can reuse connections Implement #14 Change-Id: I49c0675566145e233e40f25fe0c30c9614bf2c14 --- pom.xml | 19 +- .../com/baidu/hugegraph/rest/RestClient.java | 117 ++++++-- .../com/baidu/hugegraph/rest/RestResult.java | 6 +- .../com/baidu/hugegraph/util/VersionUtil.java | 2 +- .../hugegraph/version/CommonVersion.java | 2 +- .../baidu/hugegraph/unit/UnitTestSuite.java | 4 + .../hugegraph/unit/rest/RestClientTest.java | 265 ++++++++++++++++++ .../hugegraph/unit/rest/RestResultTest.java | 144 ++++++++++ 8 files changed, 521 insertions(+), 38 deletions(-) create mode 100644 src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/rest/RestResultTest.java diff --git a/pom.xml b/pom.xml index 079239dd9f..6ead7db1fd 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.5.8 + 1.5.9 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -66,9 +66,11 @@ 1.0 3.0.1 3.21.0-GA - 2.25.1 + + 2.22 2.27 4.12 + 2.25.1 @@ -78,6 +80,12 @@ junit ${junit.version} + + org.mockito + mockito-core + ${mockito.version} + test + @@ -157,6 +165,11 @@ jersey-media-json-jackson ${jersey.version} + + org.glassfish.jersey.connectors + jersey-apache-connector + ${jersey.version} + org.glassfish.jersey.inject jersey-hk2 @@ -199,7 +212,7 @@ - 1.5.8.0 + 1.5.9.0 diff --git a/src/main/java/com/baidu/hugegraph/rest/RestClient.java b/src/main/java/com/baidu/hugegraph/rest/RestClient.java index cce2d141e6..4a519b0427 100644 --- a/src/main/java/com/baidu/hugegraph/rest/RestClient.java +++ b/src/main/java/com/baidu/hugegraph/rest/RestClient.java @@ -19,6 +19,8 @@ package com.baidu.hugegraph.rest; +import static org.glassfish.jersey.apache.connector.ApacheClientProperties.CONNECTION_MANAGER; + import java.util.Collection; import java.util.Map; import java.util.concurrent.Callable; @@ -33,6 +35,9 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.Variant; +import org.apache.http.config.SocketConfig; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.glassfish.jersey.apache.connector.ApacheConnectorProvider; import org.glassfish.jersey.client.ClientConfig; import org.glassfish.jersey.client.ClientProperties; import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; @@ -45,24 +50,42 @@ public abstract class RestClient { - private Client client; - private WebTarget target; + private final ClientConfig config; + private final Client client; + private final WebTarget target; public RestClient(String url, int timeout) { - this(url, buildConfig(timeout)); + this(url, new ConfigBuilder().config(timeout).build()); + } + + public RestClient(String url, int timeout, int maxTotal, int maxPerRoute) { + this(url, new ConfigBuilder().config(timeout) + .config(timeout, maxTotal, maxPerRoute) + .build()); } public RestClient(String url, String user, String password, int timeout) { - this(url, buildConfigWithBasicAuth(user, password, timeout)); + this(url, new ConfigBuilder().config(timeout) + .config(user, password) + .build()); } + public RestClient(String url, String user, String password, int timeout, + int maxTotal, int maxPerRoute) { + this(url, new ConfigBuilder().config(timeout) + .config(user, password) + .config(timeout, maxTotal, maxPerRoute) + .build()); + } + public RestClient(String url, ClientConfig config) { - this.client = ClientBuilder.newClient(config); + this.config = config; + this.client = ClientBuilder.newClient(this.config); this.client.register(GZipEncoder.class); this.target = this.client.target(url); } - private Response request(Callable method) { + protected Response request(Callable method) { try { return method.call(); } catch (Exception e) { @@ -208,30 +231,64 @@ private static String encode(String raw) { return UriComponent.encode(raw, UriComponent.Type.PATH_SEGMENT); } - private static ClientConfig buildConfigWithBasicAuth(String username, - String password, - int timeout) { - ClientConfig config = buildConfig(timeout); - /* - * NOTE: don't use non-preemptive mode - * In non-preemptive mode the authentication information is added - * only when server refuses the request with 401 status code and - * then the request is repeated. - * Non-preemptive has negative impact on the performance. The advantage - * is that it does not send credentials when they are not needed. - * https://jersey.github.io/documentation/latest/client.html#d0e5461 - */ - config.register(HttpAuthenticationFeature.basic(username, password)); - return config; - } - - private static ClientConfig buildConfig(int timeout) { - ClientConfig config = new ClientConfig(); - config.property(ClientProperties.CONNECT_TIMEOUT, timeout); - config.property(ClientProperties.READ_TIMEOUT, timeout); - return config; - } - protected abstract void checkStatus(Response response, Response.Status... statuses); + + private static class ConfigBuilder { + + private final ClientConfig config; + + public ConfigBuilder() { + this.config = new ClientConfig(); + } + + public ConfigBuilder config(int timeout) { + this.config.property(ClientProperties.CONNECT_TIMEOUT, timeout); + this.config.property(ClientProperties.READ_TIMEOUT, timeout); + return this; + } + + public ConfigBuilder config(String username, String password) { + /* + * NOTE: don't use non-preemptive mode + * In non-preemptive mode the authentication information is added + * only when server refuses the request with 401 status code and + * then the request is repeated. + * Non-preemptive has negative impact on the performance. The + * advantage is it doesn't send credentials when they are not needed + * https://jersey.github.io/documentation/latest/client.html#d0e5461 + */ + this.config.register(HttpAuthenticationFeature.basic(username, + password)); + return this; + } + + public ConfigBuilder config(int timeout, int maxTotal, + int maxPerRoute) { + /* + * Using httpclient with connection pooling, and configuring the + * jersey connector, reference: + * http://www.theotherian.com/2013/08/jersey-client-2.0-httpclient-timeouts-max-connections.html + * https://stackoverflow.com/questions/43228051/memory-issue-with-jax-rs-using-jersey/46175943#46175943 + * + * But the jersey that has been released in the maven central + * repository seems to have a bug. + * https://github.com/jersey/jersey/pull/3752 + */ + PoolingHttpClientConnectionManager pcm = + new PoolingHttpClientConnectionManager(); + pcm.setDefaultSocketConfig(SocketConfig.custom() + .setSoTimeout(timeout) + .build()); + pcm.setMaxTotal(maxTotal); + pcm.setDefaultMaxPerRoute(maxPerRoute); + this.config.property(CONNECTION_MANAGER, pcm); + this.config.connectorProvider(new ApacheConnectorProvider()); + return this; + } + + public ClientConfig build() { + return this.config; + } + } } diff --git a/src/main/java/com/baidu/hugegraph/rest/RestResult.java b/src/main/java/com/baidu/hugegraph/rest/RestResult.java index 3be29b8cae..39abf6ca56 100644 --- a/src/main/java/com/baidu/hugegraph/rest/RestResult.java +++ b/src/main/java/com/baidu/hugegraph/rest/RestResult.java @@ -34,9 +34,9 @@ public class RestResult { private static final ObjectMapper mapper = new ObjectMapper(); - private int status; - private MultivaluedMap headers; - private String content; + private final int status; + private final MultivaluedMap headers; + private final String content; public RestResult(Response response) { this.status = response.getStatus(); diff --git a/src/main/java/com/baidu/hugegraph/util/VersionUtil.java b/src/main/java/com/baidu/hugegraph/util/VersionUtil.java index 6ac64f20f7..92bef3da23 100644 --- a/src/main/java/com/baidu/hugegraph/util/VersionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/VersionUtil.java @@ -44,7 +44,7 @@ public static boolean match(Version version, String begin, String end) { /** * Compare if a version is greater than the other one (inclusive) * @param version The version to be compared - * @param begin The lower bound of the range + * @param other The lower bound of the range * @return true if it's greater than the other, otherwise false */ public static boolean gte(String version, String other) { diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index b7bafdefa0..a34e52abf6 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.5.8"); + "1.5.9"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java index c8f6e4cfb3..6850815ff9 100644 --- a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java +++ b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -30,6 +30,8 @@ import com.baidu.hugegraph.unit.iterator.FlatMapperIteratorTest; import com.baidu.hugegraph.unit.iterator.MapperIteratorTest; import com.baidu.hugegraph.unit.perf.PerfUtilTest; +import com.baidu.hugegraph.unit.rest.RestClientTest; +import com.baidu.hugegraph.unit.rest.RestResultTest; import com.baidu.hugegraph.unit.util.BytesTest; import com.baidu.hugegraph.unit.util.CollectionUtilTest; import com.baidu.hugegraph.unit.util.HashUtilTest; @@ -46,6 +48,8 @@ HugeConfigTest.class, EventHubTest.class, PerfUtilTest.class, + RestClientTest.class, + RestResultTest.class, VersionTest.class, ExtendableIteratorTest.class, diff --git a/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java b/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java new file mode 100644 index 0000000000..0b097682f6 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java @@ -0,0 +1,265 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.rest; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.Callable; + +import javax.ws.rs.core.MultivaluedHashMap; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; + +import org.glassfish.jersey.internal.util.collection.ImmutableMultivaluedMap; +import org.junit.Test; +import org.mockito.Mockito; + +import com.baidu.hugegraph.rest.ClientException; +import com.baidu.hugegraph.rest.RestClient; +import com.baidu.hugegraph.rest.RestResult; +import com.baidu.hugegraph.testutil.Assert; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; + +public class RestClientTest { + + private static class RestClientImpl extends RestClient { + + private final int status; + private final MultivaluedMap headers; + private final String content; + + public RestClientImpl(String url, int timeout, + int maxTotal, int maxPerRoute, int status) { + super(url, timeout, maxTotal, maxPerRoute); + this.status = status; + this.headers = ImmutableMultivaluedMap.empty(); + this.content = ""; + } + + public RestClientImpl(String url, String user, String password, + int timeout, int status) { + super(url, user, password, timeout); + this.status = status; + this.headers = ImmutableMultivaluedMap.empty(); + this.content = ""; + } + + public RestClientImpl(String url, String user, String password, + int timeout, int maxTotal, int maxPerRoute, + int status) { + super(url, user, password, timeout, maxTotal, maxPerRoute); + this.status = status; + this.headers = ImmutableMultivaluedMap.empty(); + this.content = ""; + } + + public RestClientImpl(String url, int timeout, int status) { + this(url, timeout, status, ImmutableMultivaluedMap.empty(), ""); + } + + public RestClientImpl(String url, int timeout, int status, + MultivaluedMap headers) { + this(url, timeout, status, headers, ""); + } + + public RestClientImpl(String url, int timeout, int status, + String content) { + this(url, timeout, status, ImmutableMultivaluedMap.empty(), content); + } + + public RestClientImpl(String url, int timeout, int status, + MultivaluedMap headers, + String content) { + super(url, timeout); + this.status = status; + this.headers = headers; + this.content = content; + } + + @Override + protected Response request(Callable method) { + Response response = Mockito.mock(Response.class); + Mockito.when(response.getStatus()).thenReturn(this.status); + Mockito.when(response.getHeaders()).thenReturn(this.headers); + Mockito.when(response.readEntity(String.class)) + .thenReturn(this.content); + return response; + } + + @Override + protected void checkStatus(Response response, + Response.Status... statuses) { + boolean match = false; + for (Response.Status status : statuses) { + if (status.getStatusCode() == response.getStatus()) { + match = true; + break; + } + } + if (!match) { + throw new ClientException("Invalid response '%s'", response); + } + } + } + + @Test + public void testPost() { + RestClient client = new RestClientImpl("/test", 1000, 200); + RestResult restResult = client.post("path", "body"); + Assert.assertEquals(200, restResult.status()); + } + + @Test + // TODO: How to verify it? + public void testPostWithMaxTotalAndPerRoute() { + RestClient client = new RestClientImpl("/test", 1000, 10, 5, 200); + RestResult restResult = client.post("path", "body"); + Assert.assertEquals(200, restResult.status()); + } + + @Test + public void testPostWithUserAndPassword() { + RestClient client = new RestClientImpl("/test", "user", "", 1000, 200); + RestResult restResult = client.post("path", "body"); + Assert.assertEquals(200, restResult.status()); + } + + @Test + public void testPostWithAllParams() { + RestClient client = new RestClientImpl("/test", "user", "", 1000, + 10, 5, 200); + RestResult restResult = client.post("path", "body"); + Assert.assertEquals(200, restResult.status()); + } + + @Test + public void testPostWithHeaderAndContent() { + MultivaluedMap headers = new MultivaluedHashMap<>(); + headers.add("key1", "value1-1"); + headers.add("key1", "value1-2"); + headers.add("Content-Encoding", "gzip"); + String content = "{\"names\": [\"marko\", \"josh\", \"lop\"]}"; + RestClient client = new RestClientImpl("/test", 1000, 200, + headers, content); + RestResult restResult = client.post("path", "body"); + Assert.assertEquals(200, restResult.status()); + Assert.assertEquals(headers, restResult.headers()); + Assert.assertEquals(content, restResult.content()); + Assert.assertEquals(ImmutableList.of("marko", "josh", "lop"), + restResult.readList("names", String.class)); + } + + @Test + public void testPostWithException() { + RestClient client = new RestClientImpl("/test", 1000, 400); + Assert.assertThrows(ClientException.class, () -> { + client.post("path", "body"); + }); + } + + @Test + public void testPostWithParams() { + RestClient client = new RestClientImpl("/test", 1000, 200); + MultivaluedMap headers = ImmutableMultivaluedMap.empty(); + Map params = ImmutableMap.of("param1", "value1"); + RestResult restResult = client.post("path", "body", headers, + params); + Assert.assertEquals(200, restResult.status()); + } + + @Test + public void testPut() { + RestClient client = new RestClientImpl("/test", 1000, 200); + RestResult restResult = client.put("path", "id1", "body"); + Assert.assertEquals(200, restResult.status()); + } + + @Test + public void testPutWithParams() { + RestClient client = new RestClientImpl("/test", 1000, 200); + Map params = ImmutableMap.of("param1", "value1"); + RestResult restResult = client.put("path", "id1", "body", params); + Assert.assertEquals(200, restResult.status()); + } + + @Test + public void testPutWithException() { + RestClient client = new RestClientImpl("/test", 1000, 400); + Assert.assertThrows(ClientException.class, () -> { + client.put("path", "id1", "body"); + }); + } + + @Test + public void testGet() { + RestClient client = new RestClientImpl("/test", 1000, 200); + RestResult restResult = client.get("path"); + Assert.assertEquals(200, restResult.status()); + } + + @Test + public void testGetWithId() { + RestClient client = new RestClientImpl("/test", 1000, 200); + RestResult restResult = client.get("path", "id1"); + Assert.assertEquals(200, restResult.status()); + } + + @Test + public void testGetWithParams() { + RestClient client = new RestClientImpl("/test", 1000, 200); + Map params = new HashMap<>(); + params.put("key1", ImmutableList.of("value1-1", "value1-2")); + params.put("key2", "value2"); + RestResult restResult = client.get("path", params); + Assert.assertEquals(200, restResult.status()); + } + + @Test + public void testGetWithException() { + RestClient client = new RestClientImpl("/test", 1000, 400); + Assert.assertThrows(ClientException.class, () -> { + client.get("path", "id1"); + }); + } + + @Test + public void testDeleteWithId() { + RestClient client = new RestClientImpl("/test", 1000, 204); + RestResult restResult = client.delete("path", "id1"); + Assert.assertEquals(204, restResult.status()); + } + + @Test + public void testDeleteWithParams() { + RestClient client = new RestClientImpl("/test", 1000, 204); + Map params = ImmutableMap.of("param1", "value1"); + RestResult restResult = client.delete("path", params); + Assert.assertEquals(204, restResult.status()); + } + + @Test + public void testDeleteWithException() { + RestClient client = new RestClientImpl("/test", 1000, 400); + Assert.assertThrows(ClientException.class, () -> { + client.delete("path", "id1"); + }); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/rest/RestResultTest.java b/src/test/java/com/baidu/hugegraph/unit/rest/RestResultTest.java new file mode 100644 index 0000000000..357c4a06d7 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/rest/RestResultTest.java @@ -0,0 +1,144 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.rest; + +import java.util.Map; + +import javax.ws.rs.core.MultivaluedHashMap; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; + +import org.glassfish.jersey.internal.util.collection.ImmutableMultivaluedMap; +import org.junit.Test; +import org.mockito.Mockito; + +import com.baidu.hugegraph.rest.RestResult; +import com.baidu.hugegraph.rest.SerializeException; +import com.baidu.hugegraph.testutil.Assert; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; + +public class RestResultTest { + + @Test + public void testStatus() { + RestResult result = newRestResult(200); + Assert.assertEquals(200, result.status()); + } + + @Test + public void testHeaders() { + MultivaluedMap headers = new MultivaluedHashMap<>(); + headers.add("key1", "value1-1"); + headers.add("key1", "value1-2"); + headers.add("key2", "value2"); + RestResult result = newRestResult(200, headers); + Assert.assertEquals(200, result.status()); + Assert.assertEquals(headers, result.headers()); + } + + @Test + public void testContent() { + String content = "{\"name\": \"marko\"}"; + RestResult result = newRestResult(200, content); + Assert.assertEquals(200, result.status()); + Assert.assertEquals(content, result.content()); + Assert.assertEquals(ImmutableMap.of("name", "marko"), + result.readObject(Map.class)); + } + + @Test + public void testContentWithException() { + String content = "{illegal key: \"marko\"}"; + RestResult result = newRestResult(200, content); + Assert.assertEquals(200, result.status()); + Assert.assertEquals(content, result.content()); + Assert.assertThrows(SerializeException.class, () -> { + result.readObject(Map.class); + }); + } + + @Test + public void testContentList() { + String content = "{\"names\": [\"marko\", \"josh\", \"lop\"]}"; + RestResult result = newRestResult(200, content); + Assert.assertEquals(200, result.status()); + Assert.assertEquals(content, result.content()); + Assert.assertEquals(ImmutableList.of("marko", "josh", "lop"), + result.readList("names", String.class)); + + content = "[\"marko\", \"josh\", \"lop\"]"; + result = newRestResult(200, content); + Assert.assertEquals(200, result.status()); + Assert.assertEquals(content, result.content()); + Assert.assertEquals(ImmutableList.of("marko", "josh", "lop"), + result.readList(String.class)); + } + + @Test + public void testContentListWithException() { + String content = "{\"names\": [\"marko\", \"josh\", \"lop\"]}"; + RestResult result = newRestResult(200, content); + Assert.assertEquals(200, result.status()); + Assert.assertEquals(content, result.content()); + Assert.assertThrows(SerializeException.class, () -> { + result.readList("unexitsed key", String.class); + }); + + content = "{\"names\": [marko, josh, \"lop\"]}"; + RestResult result2 = newRestResult(200, content); + Assert.assertEquals(200, result2.status()); + Assert.assertEquals(content, result2.content()); + Assert.assertThrows(SerializeException.class, () -> { + result2.readList("names", String.class); + }); + + content = "[marko, josh, \"lop\"]"; + RestResult result3 = newRestResult(200, content); + Assert.assertEquals(200, result3.status()); + Assert.assertEquals(content, result3.content()); + Assert.assertThrows(SerializeException.class, () -> { + result3.readList(String.class); + }); + } + + private static RestResult newRestResult(int status) { + return newRestResult(status, "", ImmutableMultivaluedMap.empty()); + } + + private static RestResult newRestResult(int status, String content) { + return newRestResult(status, content, ImmutableMultivaluedMap.empty()); + } + + private static RestResult newRestResult(int status, + MultivaluedMap h) { + return newRestResult(status, "", h); + } + + private static RestResult newRestResult(int status, String content, + MultivaluedMap h) { + Response response = Mockito.mock(Response.class); + Mockito.when(response.getStatus()).thenReturn(status); + Mockito.when(response.getHeaders()).thenReturn(h); + Mockito.when(response.readEntity(String.class)) + .thenReturn(content); + return new RestResult(response); + } +} From 1eb2414134b639a13f68ca352c1b3eb2d956e7b2 Mon Sep 17 00:00:00 2001 From: liningrui Date: Tue, 16 Apr 2019 21:11:15 +0800 Subject: [PATCH 094/217] Add OrderLimitMap Change-Id: I66956a0098373a9e8999a335c1d158b6aa482bb6 --- pom.xml | 4 +- .../baidu/hugegraph/util/OrderLimitMap.java | 106 +++++++++ .../hugegraph/version/CommonVersion.java | 2 +- .../baidu/hugegraph/unit/UnitTestSuite.java | 4 +- .../unit/util/OrderLimitMapTest.java | 202 ++++++++++++++++++ .../unit/util/ReflectionUtilTest.java | 4 +- 6 files changed, 316 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/baidu/hugegraph/util/OrderLimitMap.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/util/OrderLimitMapTest.java diff --git a/pom.xml b/pom.xml index 6ead7db1fd..49e4694f99 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.5.9 + 1.6.0 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -212,7 +212,7 @@ - 1.5.9.0 + 1.6.0.0 diff --git a/src/main/java/com/baidu/hugegraph/util/OrderLimitMap.java b/src/main/java/com/baidu/hugegraph/util/OrderLimitMap.java new file mode 100644 index 0000000000..031295400d --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/util/OrderLimitMap.java @@ -0,0 +1,106 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.util; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; + +import com.google.common.base.Functions; +import com.google.common.collect.Ordering; + +/** + * Reference: https://stackoverflow.com/questions/109383/sort-a-mapkey-value-by-values + */ +public class OrderLimitMap, V extends Comparable> + extends TreeMap { + + private final int capacity; + private final Map valueMap; + + private static > Ordering incr() { + return Ordering.from((V o1, V o2) -> o1.compareTo(o2)); + } + + private static > Ordering decr() { + return Ordering.from((V o1, V o2) -> -o1.compareTo(o2)); + } + + public OrderLimitMap(int capacity) { + this(capacity, false); + } + + public OrderLimitMap(int capacity, boolean incr) { + this(capacity, incr ? incr() : decr(), new HashMap<>()); + } + + private OrderLimitMap(int capacity, Ordering ordering, + HashMap valueMap) { + /* + * onResultOf: for getting the value for the key from value map + * compound: keep insertion order + */ + super(ordering.onResultOf(Functions.forMap(valueMap)) + .compound(Ordering.natural())); + this.capacity = capacity; + this.valueMap = valueMap; + } + + @Override + public V put(K k, V v) { + if (this.valueMap.containsKey(k)) { + super.remove(k); + } else if (this.valueMap.size() >= this.capacity) { + K key = super.lastKey(); + super.remove(key); + this.valueMap.remove(key); + } + this.valueMap.put(k, v); + return super.put(k, v); + } + + @Override + public V get(Object key) { + return this.valueMap.get(key); + } + + @Override + public V getOrDefault(Object key, V defaultValue) { + return this.valueMap.getOrDefault(key, defaultValue); + } + + @Override + public boolean containsKey(Object key) { + return this.valueMap.containsKey(key); + } + + public Map topN(int n) { + E.checkArgument(n > 0, "'N' Must be positive, but got '%s'", n); + Map top = InsertionOrderUtil.newMap(); + int i = 0; + for (Map.Entry entry : this.entrySet()) { + top.put(entry.getKey(), entry.getValue()); + if (++i >= n) { + break; + } + } + return top; + } +} diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index a34e52abf6..cabad17481 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.5.9"); + "1.6.0"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java index 6850815ff9..ef37f26a05 100644 --- a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java +++ b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -38,6 +38,7 @@ import com.baidu.hugegraph.unit.util.InsertionOrderUtilTest; import com.baidu.hugegraph.unit.util.LongEncodingTest; import com.baidu.hugegraph.unit.util.NumericUtilTest; +import com.baidu.hugegraph.unit.util.OrderLimitMapTest; import com.baidu.hugegraph.unit.util.ReflectionUtilTest; import com.baidu.hugegraph.unit.util.TimeUtilTest; import com.baidu.hugegraph.unit.util.VersionUtilTest; @@ -66,7 +67,8 @@ ReflectionUtilTest.class, TimeUtilTest.class, VersionUtilTest.class, - LongEncodingTest.class + LongEncodingTest.class, + OrderLimitMapTest.class }) public class UnitTestSuite { } diff --git a/src/test/java/com/baidu/hugegraph/unit/util/OrderLimitMapTest.java b/src/test/java/com/baidu/hugegraph/unit/util/OrderLimitMapTest.java new file mode 100644 index 0000000000..b6aa6e9bd9 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/util/OrderLimitMapTest.java @@ -0,0 +1,202 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.util; + +import java.util.Map; +import java.util.TreeMap; + +import org.junit.Test; + +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.util.OrderLimitMap; +import com.google.common.collect.ImmutableList; + +public class OrderLimitMapTest { + + @Test + public void testMap() { + OrderLimitMap map = new OrderLimitMap<>(5); + map.put(4, 0.4); + map.put(2, 0.2); + map.put(5, 0.5); + map.put(1, 0.2); + map.put(3, 0.3); + + Assert.assertEquals(5, map.size()); + + Assert.assertEquals(0.2, map.get(2), 1E-9); + Assert.assertEquals(0.4, map.get(4), 1E-9); + + Assert.assertTrue(map.containsKey(1)); + Assert.assertTrue(map.containsKey(3)); + Assert.assertFalse(map.containsKey(6)); + + Assert.assertNull(map.get(6)); + + Assert.assertEquals(0.5, map.getOrDefault(5, 0.0), 1E-9); + Assert.assertEquals(0.0, map.getOrDefault(7, 0.0), 1E-9); + } + + @Test + public void testOrder() { + OrderLimitMap map = new OrderLimitMap<>(5); + map.put(1, 0.1); + map.put(2, 0.2); + map.put(3, 0.3); + map.put(4, 0.4); + map.put(5, 0.5); + + Assert.assertEquals(5, map.size()); + Assert.assertEquals(ImmutableList.of(5, 4, 3, 2, 1), + ImmutableList.copyOf(map.keySet())); + } + + @Test + public void testOrderWithIncrOrder() { + OrderLimitMap map = new OrderLimitMap<>(5, true); + map.put(1, 0.5); + map.put(2, 0.4); + map.put(3, 0.3); + map.put(4, 0.2); + map.put(5, 0.1); + + Assert.assertEquals(5, map.size()); + Assert.assertEquals(ImmutableList.of(5, 4, 3, 2, 1), + ImmutableList.copyOf(map.keySet())); + } + + @Test + public void testOrderWithDupValue() { + OrderLimitMap map = new OrderLimitMap<>(5); + map.put(1, 0.1); + map.put(2, 0.2); + map.put(3, 0.3); + map.put(4, 0.2); + map.put(5, 0.3); + + Assert.assertEquals(5, map.size()); + Assert.assertEquals(ImmutableList.of(3, 5, 2, 4, 1), + ImmutableList.copyOf(map.keySet())); + } + + @Test + public void testOrderWithDupValueAndKeyIncrOrder() { + OrderLimitMap map = new OrderLimitMap<>(5); + map.put(4, 0.2); + map.put(2, 0.2); + map.put(1, 0.1); + map.put(5, 0.3); + map.put(3, 0.3); + + Assert.assertEquals(5, map.size()); + Assert.assertEquals(ImmutableList.of(3, 5, 2, 4, 1), + ImmutableList.copyOf(map.keySet())); + } + + @Test + public void testOrderWithDupKey() { + OrderLimitMap map = new OrderLimitMap<>(5); + map.put(1, 0.1); + map.put(2, 0.2); + map.put(3, 0.3); + map.put(2, 0.4); + map.put(3, 0.2); + + Assert.assertEquals(3, map.size()); + Assert.assertEquals(ImmutableList.of(2, 3, 1), + ImmutableList.copyOf(map.keySet())); + } + + @Test + public void testLimit() { + OrderLimitMap map = new OrderLimitMap<>(5); + map.put(1, 0.1); + map.put(2, 0.2); + map.put(3, 0.3); + map.put(4, 0.4); + map.put(5, 0.5); + + map.put(6, 0.6); + Assert.assertEquals(5, map.size()); + Assert.assertEquals(ImmutableList.of(6, 5, 4, 3, 2), + ImmutableList.copyOf(map.keySet())); + + map.put(7, 0.7); + Assert.assertEquals(5, map.size()); + Assert.assertEquals(ImmutableList.of(7, 6, 5, 4, 3), + ImmutableList.copyOf(map.keySet())); + } + + @Test + public void testLimitWithDupValue() { + OrderLimitMap map = new OrderLimitMap<>(5); + map.put(1, 0.1); + map.put(2, 0.2); + map.put(3, 0.3); + map.put(4, 0.4); + map.put(5, 0.5); + + map.put(6, 0.1); + Assert.assertEquals(5, map.size()); + Assert.assertEquals(ImmutableList.of(5, 4, 3, 2, 6), + ImmutableList.copyOf(map.keySet())); + + map.put(7, 0.3); + Assert.assertEquals(5, map.size()); + Assert.assertEquals(ImmutableList.of(5, 4, 3, 7, 2), + ImmutableList.copyOf(map.keySet())); + + map.put(8, 0.5); + Assert.assertEquals(5, map.size()); + Assert.assertEquals(ImmutableList.of(5, 8, 4, 3, 7), + ImmutableList.copyOf(map.keySet())); + + map.put(0, 0.5); + Assert.assertEquals(5, map.size()); + Assert.assertEquals(ImmutableList.of(0, 5, 8, 4, 3), + ImmutableList.copyOf(map.keySet())); + } + + @Test + public void testTopN() { + OrderLimitMap map = new OrderLimitMap<>(5); + map.put(1, 0.1); + map.put(2, 0.2); + map.put(3, 0.3); + map.put(4, 0.4); + map.put(5, 0.5); + + Map top = map.topN(1); + Assert.assertEquals(ImmutableList.of(5), + ImmutableList.copyOf(top.keySet())); + + top = map.topN(3); + Assert.assertEquals(ImmutableList.of(5, 4, 3), + ImmutableList.copyOf(top.keySet())); + + top = map.topN(5); + Assert.assertEquals(ImmutableList.of(5, 4, 3, 2, 1), + ImmutableList.copyOf(top.keySet())); + + top = map.topN(6); + Assert.assertEquals(ImmutableList.of(5, 4, 3, 2, 1), + ImmutableList.copyOf(top.keySet())); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java index c619fdc081..5e07fe1354 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java @@ -91,7 +91,7 @@ public void testClasses() throws IOException { @SuppressWarnings("unchecked") List classes = IteratorUtils.toList(ReflectionUtil.classes( "com.baidu.hugegraph.util")); - Assert.assertEquals(13, classes.size()); + Assert.assertEquals(14, classes.size()); classes.sort((c1, c2) -> c1.getName().compareTo(c2.getName())); Assert.assertEquals("com.baidu.hugegraph.util.Bytes", classes.get(0).getName()); @@ -100,7 +100,7 @@ public void testClasses() throws IOException { Assert.assertEquals("com.baidu.hugegraph.util.CollectionUtil", classes.get(2).getName()); Assert.assertEquals("com.baidu.hugegraph.util.VersionUtil", - classes.get(12).getName()); + classes.get(13).getName()); } @Test From 194ed53b8588cd309cc79a9a84d02bf0633d40d6 Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Tue, 7 May 2019 01:35:33 -0500 Subject: [PATCH 095/217] add Whitebox.invoke() method (#22) Change-Id: If246e9193a4c61621c942f4b88a703c28c9d2846 --- pom.xml | 4 +- .../java/com/baidu/hugegraph/event/Event.java | 3 + .../com/baidu/hugegraph/rest/RestResult.java | 9 +- .../com/baidu/hugegraph/testutil/Assert.java | 28 +++ .../baidu/hugegraph/testutil/Whitebox.java | 98 +++++++++-- .../baidu/hugegraph/util/OrderLimitMap.java | 2 + .../hugegraph/version/CommonVersion.java | 2 +- .../baidu/hugegraph/testutil/AssertTest.java | 80 +++++++++ .../hugegraph/testutil/WhiteboxTest.java | 160 ++++++++++++++++++ .../baidu/hugegraph/unit/UnitTestSuite.java | 7 +- .../hugegraph/unit/rest/RestClientTest.java | 2 + .../unit/util/OrderLimitMapTest.java | 1 - 12 files changed, 378 insertions(+), 18 deletions(-) create mode 100644 src/test/java/com/baidu/hugegraph/testutil/AssertTest.java create mode 100644 src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java diff --git a/pom.xml b/pom.xml index 49e4694f99..e61af211d7 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.6.0 + 1.6.1 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -212,7 +212,7 @@ - 1.6.0.0 + 1.6.1.0 diff --git a/src/main/java/com/baidu/hugegraph/event/Event.java b/src/main/java/com/baidu/hugegraph/event/Event.java index 4df6cdf652..733fd204e1 100644 --- a/src/main/java/com/baidu/hugegraph/event/Event.java +++ b/src/main/java/com/baidu/hugegraph/event/Event.java @@ -56,6 +56,9 @@ public void checkArgs(Class... classes) throws IllegalArgumentException { int i = 0; for (Class c : classes) { Object arg = this.args[i++]; + if (arg == null) { + continue; + } E.checkArgument(c.isAssignableFrom(arg.getClass()), "The arg '%s'(%s) can't match %s", arg, arg.getClass(), c); diff --git a/src/main/java/com/baidu/hugegraph/rest/RestResult.java b/src/main/java/com/baidu/hugegraph/rest/RestResult.java index 39abf6ca56..92962eacde 100644 --- a/src/main/java/com/baidu/hugegraph/rest/RestResult.java +++ b/src/main/java/com/baidu/hugegraph/rest/RestResult.java @@ -20,6 +20,7 @@ package com.baidu.hugegraph.rest; import java.io.IOException; +import java.util.ArrayList; import java.util.List; import javax.ws.rs.core.MultivaluedMap; @@ -74,7 +75,8 @@ public List readList(String key, Class clazz) { "Can't find value of the key: %s in json.", key); } JavaType type = mapper.getTypeFactory() - .constructParametricType(List.class, clazz); + .constructParametrizedType(ArrayList.class, + List.class, clazz); return mapper.readValue(element.toString(), type); } catch (IOException e) { throw new SerializeException( @@ -83,9 +85,10 @@ public List readList(String key, Class clazz) { } public List readList(Class clazz) { + JavaType type = mapper.getTypeFactory() + .constructParametrizedType(ArrayList.class, + List.class, clazz); try { - JavaType type = mapper.getTypeFactory() - .constructParametricType(List.class, clazz); return mapper.readValue(this.content, type); } catch (IOException e) { throw new SerializeException( diff --git a/src/main/java/com/baidu/hugegraph/testutil/Assert.java b/src/main/java/com/baidu/hugegraph/testutil/Assert.java index c1d5c94fba..188d0fe89d 100644 --- a/src/main/java/com/baidu/hugegraph/testutil/Assert.java +++ b/src/main/java/com/baidu/hugegraph/testutil/Assert.java @@ -56,4 +56,32 @@ public static void assertThrows(Class throwable, throwable)); } } + + public static void assertEquals(byte expected, Object actual) { + org.junit.Assert.assertEquals(expected, actual); + } + + public static void assertEquals(short expected, Object actual) { + org.junit.Assert.assertEquals(expected, actual); + } + + public static void assertEquals(char expected, Object actual) { + org.junit.Assert.assertEquals(expected, actual); + } + + public static void assertEquals(int expected, Object actual) { + org.junit.Assert.assertEquals(expected, actual); + } + + public static void assertEquals(long expected, Object actual) { + org.junit.Assert.assertEquals(expected, actual); + } + + public static void assertEquals(float expected, Object actual) { + org.junit.Assert.assertEquals(expected, actual); + } + + public static void assertEquals(double expected, Object actual) { + org.junit.Assert.assertEquals(expected, actual); + } } diff --git a/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java b/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java index f4436765aa..934157054b 100644 --- a/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java +++ b/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java @@ -20,31 +20,56 @@ package com.baidu.hugegraph.testutil; import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Objects; + +import com.baidu.hugegraph.util.E; public class Whitebox { + public static final char SEPARATOR = '.'; + public static void setInternalState(Object target, String fieldName, Object value) { + assert target != null; + assert fieldName != null; + int sep = fieldName.lastIndexOf(SEPARATOR); + if (sep > 0) { + target = getInternalState(target, fieldName.substring(0, sep)); + fieldName = fieldName.substring(sep + 1); + } try { Field f = getFieldFromHierarchy(target.getClass(), fieldName); f.setAccessible(true); f.set(target, value); } catch (Exception e) { - Assert.fail(String.format("Can't change value of '%s' against " + - "target '%s': %s", fieldName, target, e)); + throw new RuntimeException(String.format( + "Can't set value of '%s' against object '%s'", + fieldName, target), e); } } - public static Object getInternalState(Object target, String field) { + public static T getInternalState(Object target, String fieldName) { + assert fieldName != null; + int sep = fieldName.indexOf(SEPARATOR); + if (sep > 0) { + String field = fieldName.substring(0, sep); + Object value = getInternalState(target, field); + field = fieldName.substring(sep + 1); + return getInternalState(value, field); + } Class c = target.getClass(); try { - Field f = getFieldFromHierarchy(c, field); + Field f = getFieldFromHierarchy(c, fieldName); f.setAccessible(true); - return f.get(target); + @SuppressWarnings("unchecked") + T result = (T) f.get(target); + return result; } catch (Exception e) { - throw new RuntimeException( - "Unable to set internal state on a private field. " + - "Please report to mockito mailing list.", e); + throw new RuntimeException(String.format( + "Unable to get internal state on field '%s' of %s", + fieldName, target), e); } } @@ -56,8 +81,7 @@ private static Field getFieldFromHierarchy(Class clazz, String field) { } if (f == null) { throw new RuntimeException(String.format( - "You want to set value to field '%s' on class '%s' " + - "but this field is not declared in the class!", + "Not declared field '%s' in class '%s'", field, clazz.getSimpleName())); } return f; @@ -70,4 +94,58 @@ private static Field getField(Class clazz, String field) { return null; } } + + public static T invokeStatic(Class clazz, String methodName, + Object... args) { + return invoke(clazz, methodName, (Object) null, args); + } + + public static T invokeStatic(Class clazz, Class[] classes, + String methodName, Object... args) { + return invoke(clazz, classes, methodName, (Object) null, args); + } + + public static T invoke(Object owner, String field, + String methodName, Object... args) { + Object self = getInternalState(owner, field); + Objects.requireNonNull(self); + return invoke(self.getClass(), methodName, self, args); + } + + public static T invoke(Object owner, String field, Class[] classes, + String methodName, Object... args) { + Object self = getInternalState(owner, field); + Objects.requireNonNull(self); + return invoke(self.getClass(), classes, methodName, self, args); + } + + public static T invoke(Class clazz, String methodName, + Object self, Object... args) { + Class[] classes = new Class[args.length]; + int i = 0; + for (Object arg : args) { + E.checkArgument(arg != null, "The argument can't be null"); + classes[i++] = arg.getClass(); + } + return invoke(clazz, classes, methodName, self, args); + } + + public static T invoke(Class clazz, Class[] classes, + String methodName, Object self, Object... args) { + try { + Method method = clazz.getDeclaredMethod(methodName, classes); + method.setAccessible(true); + @SuppressWarnings("unchecked") + T result = (T) method.invoke(self, args); + return result; + } catch (NoSuchMethodException e) { + throw new RuntimeException(String.format( + "Can't find method '%s' of class '%s'", + methodName, clazz), e); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(String.format( + "Can't invoke method '%s' of class '%s'", + methodName, clazz), e); + } + } } diff --git a/src/main/java/com/baidu/hugegraph/util/OrderLimitMap.java b/src/main/java/com/baidu/hugegraph/util/OrderLimitMap.java index 031295400d..f7e6cf7c7c 100644 --- a/src/main/java/com/baidu/hugegraph/util/OrderLimitMap.java +++ b/src/main/java/com/baidu/hugegraph/util/OrderLimitMap.java @@ -32,6 +32,8 @@ public class OrderLimitMap, V extends Comparable> extends TreeMap { + private static final long serialVersionUID = 756490437953358633L; + private final int capacity; private final Map valueMap; diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index cabad17481..29d4fb77e7 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.6.0"); + "1.6.1"); } diff --git a/src/test/java/com/baidu/hugegraph/testutil/AssertTest.java b/src/test/java/com/baidu/hugegraph/testutil/AssertTest.java new file mode 100644 index 0000000000..480842e904 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/testutil/AssertTest.java @@ -0,0 +1,80 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.testutil; + +import org.junit.Test; + +import com.baidu.hugegraph.unit.BaseUnitTest; + +public class AssertTest extends BaseUnitTest { + + @Test + public void testAssertEquals() { + Assert.assertEquals((byte) 1, Byte.valueOf("1")); + Assert.assertEquals((short) 1, Short.valueOf("1")); + Assert.assertEquals('1', Character.valueOf('1')); + Assert.assertEquals(1, Integer.valueOf("1")); + Assert.assertEquals(1L, Long.valueOf("1")); + Assert.assertEquals(1f, Float.valueOf("1")); + Assert.assertEquals(1d, Double.valueOf("1")); + } + + @Test + public void testAssertThrows() { + Assert.assertThrows(NullPointerException.class, () -> { + throw new NullPointerException(); + }); + Assert.assertThrows(RuntimeException.class, () -> { + throw new RuntimeException(); + }); + + Assert.assertThrows(RuntimeException.class, () -> { + throw new RuntimeException("fake-error"); + }, e -> { + Assert.assertEquals("fake-error", e.getMessage()); + }); + } + + @Test + public void testAssertThrowsWithError() { + try { + Assert.assertThrows(NullPointerException.class, () -> { + // pass + }); + Assert.fail("Expect error"); + } catch (AssertionError e) { + Assert.assertEquals("No exception was thrown" + + "(expect class java.lang.NullPointerException)", + e.getMessage()); + } + + try { + Assert.assertThrows(NullPointerException.class, () -> { + throw new RuntimeException(); + }); + Assert.fail("Expect error"); + } catch (AssertionError e) { + Assert.assertEquals("Bad exception type class " + + "java.lang.RuntimeException" + + "(expect class java.lang.NullPointerException)", + e.getMessage()); + } + } +} diff --git a/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java b/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java new file mode 100644 index 0000000000..3702f7e227 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java @@ -0,0 +1,160 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.testutil; + +import org.junit.Test; + +public class WhiteboxTest { + + @Test + public void testGetInternalState() { + Test1 test1 = newTest(); + Assert.assertEquals(1, Whitebox.getInternalState(test1, "ivalue")); + Assert.assertEquals(2f, Whitebox.getInternalState(test1, + "test2.fvalue")); + Assert.assertEquals("3", Whitebox.getInternalState(test1, + "test2.test3.str")); + + Assert.assertThrows(RuntimeException.class, () -> { + Whitebox.getInternalState(test1, "ivalue2"); + }); + + Assert.assertThrows(RuntimeException.class, () -> { + Whitebox.getInternalState(test1, "test2.fvalue2"); + }); + } + + @Test + public void testSetInternalState() { + Test1 test1 = newTest(); + + Whitebox.setInternalState(test1, "ivalue", 11); + Assert.assertEquals(11, Whitebox.getInternalState(test1, "ivalue")); + + Whitebox.setInternalState(test1, "test2.fvalue", 22f); + Assert.assertEquals(22f, Whitebox.getInternalState(test1, + "test2.fvalue")); + + Whitebox.setInternalState(test1, "test2.test3.str", "33"); + Assert.assertEquals("33", Whitebox.getInternalState(test1, + "test2.test3.str")); + + Assert.assertThrows(RuntimeException.class, () -> { + Whitebox.setInternalState(test1, "ivalue2", 11); + }); + + Assert.assertThrows(RuntimeException.class, () -> { + Whitebox.setInternalState(test1, "test2.fvalue2", 22f); + }); + + Assert.assertThrows(RuntimeException.class, () -> { + Whitebox.setInternalState(test1, "test2.fvalue", 22d); + }); + } + + @Test + public void testInvokeStatic() { + Assert.assertEquals(1, Whitebox.invokeStatic(Test1.class, "svalue")); + Assert.assertEquals(2, Whitebox.invokeStatic(Test1.class, "svalue", 2)); + Assert.assertEquals(2, Whitebox.invokeStatic(Test1.class, "svalue", 2)); + Assert.assertEquals(2d, Whitebox.invokeStatic(Test1.class, + new Class[]{Object.class}, + "svalue", 2d)); + Assert.assertThrows(RuntimeException.class, () -> { + Whitebox.invokeStatic(Test1.class, "svalue2"); + }); + } + + @Test + public void testInvoke() { + Test1 test1 = newTest(); + Assert.assertEquals(1, Whitebox.invoke(test1.getClass(), + "value", test1)); + Assert.assertEquals(2f, Whitebox.invoke(test1, "test2", "value")); + Assert.assertEquals(2, Whitebox.invoke(test1, "test2", + new Class[]{Object.class}, + "value", 2)); + + Assert.assertThrows(RuntimeException.class, () -> { + Whitebox.invoke(test1.getClass(), "value2", test1); + }); + Assert.assertThrows(RuntimeException.class, () -> { + Whitebox.invoke(test1, "test22", "value"); + }); + Assert.assertThrows(RuntimeException.class, () -> { + Whitebox.invoke(test1, "test2", "value", 2); + }); + } + + private static Test1 newTest() { + Test1 test1 = new Test1(); + test1.test2 = new Test2(); + test1.test2.test3 = new Test3(); + return test1; + } + + @SuppressWarnings("unused") + private static class Test1 { + + private int ivalue = 1; + private Test2 test2; + + private int value() { + return this.ivalue; + } + + private static int svalue() { + return 1; + } + + private static int svalue(Integer i) { + return i; + } + + private static T svalue(T o) { + return o; + } + } + + @SuppressWarnings("unused") + private static class Test2 { + + private final float fvalue = 2; + private Test3 test3; + + private float value() { + return this.fvalue; + } + + private T value(T o) { + return o; + } + } + + @SuppressWarnings("unused") + private static class Test3 { + + private String str = "3"; + + private String value() { + return this.str; + } + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java index ef37f26a05..70fe2d81bf 100644 --- a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java +++ b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -22,6 +22,8 @@ import org.junit.runner.RunWith; import org.junit.runners.Suite; +import com.baidu.hugegraph.testutil.AssertTest; +import com.baidu.hugegraph.testutil.WhiteboxTest; import com.baidu.hugegraph.unit.config.HugeConfigTest; import com.baidu.hugegraph.unit.event.EventHubTest; import com.baidu.hugegraph.unit.iterator.ExtendableIteratorTest; @@ -68,7 +70,10 @@ TimeUtilTest.class, VersionUtilTest.class, LongEncodingTest.class, - OrderLimitMapTest.class + OrderLimitMapTest.class, + + AssertTest.class, + WhiteboxTest.class }) public class UnitTestSuite { } diff --git a/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java b/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java index 0b097682f6..9d1dd95fc3 100644 --- a/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java @@ -75,11 +75,13 @@ public RestClientImpl(String url, int timeout, int status) { this(url, timeout, status, ImmutableMultivaluedMap.empty(), ""); } + @SuppressWarnings("unused") public RestClientImpl(String url, int timeout, int status, MultivaluedMap headers) { this(url, timeout, status, headers, ""); } + @SuppressWarnings("unused") public RestClientImpl(String url, int timeout, int status, String content) { this(url, timeout, status, ImmutableMultivaluedMap.empty(), content); diff --git a/src/test/java/com/baidu/hugegraph/unit/util/OrderLimitMapTest.java b/src/test/java/com/baidu/hugegraph/unit/util/OrderLimitMapTest.java index b6aa6e9bd9..8786933faa 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/OrderLimitMapTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/OrderLimitMapTest.java @@ -20,7 +20,6 @@ package com.baidu.hugegraph.unit.util; import java.util.Map; -import java.util.TreeMap; import org.junit.Test; From 5ea077f13eb0497039ba64903c2927979efd955f Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Mon, 20 May 2019 23:06:42 -0500 Subject: [PATCH 096/217] add support of sortable negative number for NumericUtil (#23) Change-Id: I93290d3c1f9f89913d31ec2e5b4293d4a1d1ce1f --- pom.xml | 4 +- .../baidu/hugegraph/util/LongEncoding.java | 2 +- .../com/baidu/hugegraph/util/NumericUtil.java | 126 ++++++-- .../hugegraph/version/CommonVersion.java | 2 +- .../hugegraph/unit/util/NumericUtilTest.java | 284 +++++++++++++++++- 5 files changed, 370 insertions(+), 48 deletions(-) diff --git a/pom.xml b/pom.xml index e61af211d7..60222d3c3a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.6.1 + 1.6.2 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -212,7 +212,7 @@ - 1.6.1.0 + 1.6.2.0 diff --git a/src/main/java/com/baidu/hugegraph/util/LongEncoding.java b/src/main/java/com/baidu/hugegraph/util/LongEncoding.java index 1fccbddb3c..87b1366fa1 100644 --- a/src/main/java/com/baidu/hugegraph/util/LongEncoding.java +++ b/src/main/java/com/baidu/hugegraph/util/LongEncoding.java @@ -29,7 +29,7 @@ public final class LongEncoding { private static final String LENGTH_SYMBOLS = "0123456789ABCDEF"; private static final char NEG = LENGTH_SYMBOLS.charAt(0); - private static final long FULL_LONG = 0x8000000000000000L; + private static final long FULL_LONG = Long.MIN_VALUE; public static String encodeNumber(Object number) { Number num = NumericUtil.convertToNumber(number); diff --git a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java index 9ab7c74d0d..f976f92c0b 100644 --- a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java @@ -28,6 +28,10 @@ */ public final class NumericUtil { + private static final long FULL_LONG = Long.MIN_VALUE; + private static final int FULL_INT = Integer.MIN_VALUE; + private static final byte FULL_BYTE = Byte.MIN_VALUE; + private NumericUtil() { } @@ -39,22 +43,22 @@ private NumericUtil() { * precision is not reduced, but the value can easily used as a long. The * sort order (including {@link Double#NaN}) is defined by * {@link Double#compareTo}; {@code NaN} is greater than positive infinity. - * @param val input double value + * @param value input double value * @return output sortable long value * @see #sortableLongToDouble */ - public static long doubleToSortableLong(double val) { - return sortableDoubleBits(Double.doubleToLongBits(val)); + public static long doubleToSortableLong(double value) { + return sortableDoubleBits(Double.doubleToLongBits(value)); } /** * Converts a sortable long back to a double. - * @param val input double value + * @param value input double value * @return output sortable long value * @see #doubleToSortableLong */ - public static double sortableLongToDouble(long val) { - return Double.longBitsToDouble(sortableDoubleBits(val)); + public static double sortableLongToDouble(long value) { + return Double.longBitsToDouble(sortableDoubleBits(value)); } /** @@ -65,22 +69,22 @@ public static double sortableLongToDouble(long val) { * is not reduced, but the value can easily used as an int. The sort order * (including {@link Float#NaN}) is defined by {@link Float#compareTo}; * {@code NaN} is greater than positive infinity. - * @param val input float value + * @param value input float value * @return output sortable int value * @see #sortableIntToFloat */ - public static int floatToSortableInt(float val) { - return sortableFloatBits(Float.floatToIntBits(val)); + public static int floatToSortableInt(float value) { + return sortableFloatBits(Float.floatToIntBits(value)); } /** * Converts a sortable int back to a float. - * @param val input int value + * @param value input int value * @return output sortable float value * @see #floatToSortableInt */ - public static float sortableIntToFloat(int val) { - return Float.intBitsToFloat(sortableFloatBits(val)); + public static float sortableIntToFloat(int value) { + return Float.intBitsToFloat(sortableFloatBits(value)); } /** @@ -122,10 +126,9 @@ public static long numberToSortableLong(Number number) { return intNumber ? bd.longValueExact() : doubleToSortableLong(bd.doubleValue()); } + // TODO: support other number types - throw new IllegalArgumentException(String.format( - "Unsupported number type: %s(%s)", - number.getClass().getSimpleName(), number)); + throw unsupportedNumberType(number); } public static Number sortableLongToNumber(long value, Class clazz) { @@ -146,49 +149,95 @@ public static Number sortableLongToNumber(long value, Class clazz) { } // TODO: support other number types - throw new IllegalArgumentException(String.format( - "Unsupported number type: %s", clazz.getSimpleName())); + throw unsupportedNumberType(clazz); } public static byte[] numberToSortableBytes(Number number) { if (number instanceof Long) { - return longToBytes(number.longValue()); + return longToSortableBytes(number.longValue()); } else if (number instanceof Double) { - return longToBytes(doubleToSortableLong(number.doubleValue())); + long value = doubleToSortableLong(number.doubleValue()); + return longToSortableBytes(value); } else if (number instanceof Float) { - return intToBytes(floatToSortableInt(number.floatValue())); + int value = floatToSortableInt(number.floatValue()); + return intToSortableBytes(value); } else if (number instanceof Integer || number instanceof Short) { - return intToBytes(number.intValue()); + return intToSortableBytes(number.intValue()); } else if (number instanceof Byte) { - return new byte[]{number.byteValue()} ; + return byteToSortableBytes(number.byteValue()); } // TODO: support other number types - throw new IllegalArgumentException(String.format( - "Unsupported number type: %s(%s)", - number.getClass().getSimpleName(), number)); + throw unsupportedNumberType(number); } public static Number sortableBytesToNumber(byte[] bytes, Class clazz) { assert NumericUtil.isNumber(clazz); if (clazz == Long.class) { - return bytesToLong(bytes); + return sortableBytesToLong(bytes); } else if (clazz == Double.class) { - return sortableLongToDouble(bytesToLong(bytes)); + return sortableLongToDouble(sortableBytesToLong(bytes)); } else if (clazz == Float.class) { - return sortableIntToFloat(bytesToInt(bytes)); + return sortableIntToFloat(sortableBytesToInt(bytes)); } else if (clazz == Integer.class) { - return bytesToInt(bytes); + return sortableBytesToInt(bytes); } else if (clazz == Short.class) { - return (short) bytesToInt(bytes); + return (short) sortableBytesToInt(bytes); } else if (clazz == Byte.class) { - return bytes[0]; + return sortableBytesToByte(bytes); } // TODO: support other number types - throw new IllegalArgumentException(String.format( - "Unsupported number type: %s", clazz.getSimpleName())); + throw unsupportedNumberType(clazz); + } + + public static Number minValueOf(Class clazz) { + E.checkArgumentNotNull(clazz, "The clazz can't be null"); + + if (Long.class.isAssignableFrom(clazz) || + Double.class.isAssignableFrom(clazz)) { + return Long.MIN_VALUE; + } + if (Integer.class.isAssignableFrom(clazz) || + Short.class.isAssignableFrom(clazz) || + Float.class.isAssignableFrom(clazz)) { + return Integer.MIN_VALUE; + } + if (Byte.class.isAssignableFrom(clazz)) { + return Byte.MIN_VALUE; + } + + // TODO: support other number types + throw unsupportedNumberType(clazz); + } + + public static byte[] longToSortableBytes(long value) { + return longToBytes(value + FULL_LONG); + } + + public static long sortableBytesToLong(byte[] bytes) { + return bytesToLong(bytes) - FULL_LONG; + } + + public static byte[] intToSortableBytes(int value) { + return intToBytes(value + FULL_INT); + } + + public static int sortableBytesToInt(byte[] bytes) { + return bytesToInt(bytes) - FULL_INT; + } + + public static byte[] byteToSortableBytes(byte value) { + value += FULL_BYTE; + return new byte[]{value}; + } + + public static byte sortableBytesToByte(byte[] bytes) { + assert bytes.length == 1; + byte value = bytes[0]; + value -= FULL_BYTE; + return value; } public static byte[] longToBytes(long value) { @@ -274,4 +323,15 @@ public static int compareNumber(Object first, Number second) { return n1.compareTo(n2); } + + private static IllegalArgumentException unsupportedNumberType(Class c) { + return new IllegalArgumentException(String.format( + "Unsupported number type: %s", c.getSimpleName())); + } + + private static IllegalArgumentException unsupportedNumberType(Number num) { + return new IllegalArgumentException(String.format( + "Unsupported number type: %s(%s)", + num.getClass().getSimpleName(), num)); + } } diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 29d4fb77e7..2aefe577c3 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.6.1"); + "1.6.2"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java index bd64f79352..0a90964527 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java @@ -34,27 +34,41 @@ public class NumericUtilTest extends BaseUnitTest { public void testNumberToSortableBytes() { // byte byte[] bytes = NumericUtil.numberToSortableBytes((byte) 0x33); - assertEquals(new byte[]{0x33}, bytes); + assertEquals(new byte[]{(byte) 0xb3}, bytes); + + bytes = NumericUtil.numberToSortableBytes(Byte.MIN_VALUE); + assertEquals(new byte[]{0x00}, bytes); + + bytes = NumericUtil.numberToSortableBytes(Byte.MAX_VALUE); + assertEquals(new byte[]{(byte) 0xff}, bytes); + + bytes = NumericUtil.numberToSortableBytes((byte) -1); + assertEquals(new byte[]{(byte) 0x7f}, bytes); + + bytes = NumericUtil.numberToSortableBytes((byte) 0); + assertEquals(new byte[]{(byte) 0x80}, bytes); // short bytes = NumericUtil.numberToSortableBytes((short) 0x11223344); - assertEquals(new byte[]{0, 0, 0x33, 0x44}, bytes); + assertEquals(new byte[]{(byte) 0x80, 0x00, 0x33, 0x44}, bytes); // int bytes = NumericUtil.numberToSortableBytes(0x11223344); - assertEquals(new byte[]{0x11, 0x22, 0x33, 0x44}, bytes); + assertEquals(new byte[]{(byte) 0x91, 0x22, 0x33, 0x44}, bytes); // long bytes = NumericUtil.numberToSortableBytes(0x1122334455L); - assertEquals(new byte[]{0, 0, 0, 0x11, 0x22, 0x33, 0x44, 0x55}, bytes); + assertEquals(new byte[]{(byte) 0x80, 0, 0, 0x11, + 0x22, 0x33, 0x44, 0x55}, bytes); // float bytes = NumericUtil.numberToSortableBytes(3.14f); - assertEquals(new byte[]{0x40, 0x48, (byte) 0xf5, (byte) 0xc3}, bytes); + assertEquals(new byte[]{(byte) 0xc0, 0x48, (byte) 0xf5, (byte) 0xc3}, + bytes); // double bytes = NumericUtil.numberToSortableBytes(3.1415926d); - assertEquals(new byte[]{0x40, 0x09, 0x21, (byte) 0xfb, + assertEquals(new byte[]{(byte) 0xc0, 0x09, 0x21, (byte) 0xfb, 0x4d, 0x12, (byte) 0xd8, 0x4a}, bytes); // BigDecimal @@ -62,12 +76,29 @@ public void testNumberToSortableBytes() { NumericUtil.numberToSortableBytes(new BigDecimal(123)); }); } + @Test public void testSortableBytesToNumber() { // byte Number value = NumericUtil.sortableBytesToNumber(new byte[]{0x33}, Byte.class); - Assert.assertEquals(value, (byte) 0x33); + Assert.assertEquals(value, (byte) 0xb3); + + value = NumericUtil.sortableBytesToNumber(new byte[]{(byte) 0x00}, + Byte.class); + Assert.assertEquals(value, Byte.MIN_VALUE); + + value = NumericUtil.sortableBytesToNumber(new byte[]{(byte) 0xff}, + Byte.class); + Assert.assertEquals(value, Byte.MAX_VALUE); + + value = NumericUtil.sortableBytesToNumber(new byte[]{(byte) 0x7f}, + Byte.class); + Assert.assertEquals(value, (byte) -1); + + value = NumericUtil.sortableBytesToNumber(new byte[]{(byte) 0x80}, + Byte.class); + Assert.assertEquals(value, (byte) 0); // short value = NumericUtil.sortableBytesToNumber(new byte[]{0, 0, 0x33, 0x44}, @@ -76,22 +107,24 @@ public void testSortableBytesToNumber() { // int value = NumericUtil.sortableBytesToNumber( - new byte[]{0x11, 0x22, 0x33, 0x44}, Integer.class); + new byte[]{(byte) 0x91, 0x22, 0x33, 0x44}, Integer.class); Assert.assertEquals(0x11223344, value); // long value = NumericUtil.sortableBytesToNumber( - new byte[]{0, 0, 0, 0x11, 0x22, 0x33, 0x44, 0x55}, Long.class); + new byte[]{(byte) 0x80, 0, 0, 0x11, 0x22, 0x33, 0x44, 0x55}, + Long.class); Assert.assertEquals(0x1122334455L, value); // float value = NumericUtil.sortableBytesToNumber( - new byte[]{0x40, 0x48, (byte) 0xf5, (byte) 0xc3}, Float.class); + new byte[]{(byte) 0xc0, 0x48, (byte) 0xf5, (byte) 0xc3}, + Float.class); Assert.assertEquals(3.14f, value); // double value = NumericUtil.sortableBytesToNumber( - new byte[]{0x40, 0x09, 0x21, (byte) 0xfb, + new byte[]{(byte) 0xc0, 0x09, 0x21, (byte) 0xfb, 0x4d, 0x12, (byte) 0xd8, 0x4a}, Double.class); Assert.assertEquals(3.1415926d, value); @@ -102,6 +135,235 @@ public void testSortableBytesToNumber() { }); } + @Test + public void testIntToSortableBytesAndCompare() { + byte[] bytes1 = NumericUtil.numberToSortableBytes(123456); + byte[] bytes2 = NumericUtil.numberToSortableBytes(123456); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) == 0); + + bytes1 = NumericUtil.numberToSortableBytes(1); + bytes2 = NumericUtil.numberToSortableBytes(2); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) < 0); + + bytes1 = NumericUtil.numberToSortableBytes(666); + bytes2 = NumericUtil.numberToSortableBytes(88); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + + bytes1 = NumericUtil.numberToSortableBytes(Integer.MAX_VALUE); + bytes2 = NumericUtil.numberToSortableBytes(0); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + + bytes1 = NumericUtil.numberToSortableBytes(-123456); + bytes2 = NumericUtil.numberToSortableBytes(-123456); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) == 0); + + bytes1 = NumericUtil.numberToSortableBytes(-1); + bytes2 = NumericUtil.numberToSortableBytes(-2); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + + bytes1 = NumericUtil.numberToSortableBytes(-666); + bytes2 = NumericUtil.numberToSortableBytes(-88); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) < 0); + + bytes1 = NumericUtil.numberToSortableBytes(Integer.MIN_VALUE); + bytes2 = NumericUtil.numberToSortableBytes(-1); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) < 0); + + bytes1 = NumericUtil.numberToSortableBytes(0); + bytes2 = NumericUtil.numberToSortableBytes(-1); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + + bytes1 = NumericUtil.numberToSortableBytes(0); + bytes2 = NumericUtil.numberToSortableBytes(Integer.MIN_VALUE); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + + bytes1 = NumericUtil.numberToSortableBytes(1); + bytes2 = NumericUtil.numberToSortableBytes(-1); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + + bytes1 = NumericUtil.numberToSortableBytes(Integer.MAX_VALUE); + bytes2 = NumericUtil.numberToSortableBytes(-1); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + } + + @Test + public void testLongToSortableBytesAndCompare() { + byte[] bytes1 = NumericUtil.numberToSortableBytes(123456L); + byte[] bytes2 = NumericUtil.numberToSortableBytes(123456L); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) == 0); + + bytes1 = NumericUtil.numberToSortableBytes(1L); + bytes2 = NumericUtil.numberToSortableBytes(2L); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) < 0); + + bytes1 = NumericUtil.numberToSortableBytes(666L); + bytes2 = NumericUtil.numberToSortableBytes(88L); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + + bytes1 = NumericUtil.numberToSortableBytes(Long.MAX_VALUE); + bytes2 = NumericUtil.numberToSortableBytes(0L); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + + bytes1 = NumericUtil.numberToSortableBytes(-123456L); + bytes2 = NumericUtil.numberToSortableBytes(-123456L); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) == 0); + + bytes1 = NumericUtil.numberToSortableBytes(-1L); + bytes2 = NumericUtil.numberToSortableBytes(-2L); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + + bytes1 = NumericUtil.numberToSortableBytes(-666L); + bytes2 = NumericUtil.numberToSortableBytes(-88L); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) < 0); + + bytes1 = NumericUtil.numberToSortableBytes(Long.MIN_VALUE); + bytes2 = NumericUtil.numberToSortableBytes(-1L); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) < 0); + + bytes1 = NumericUtil.numberToSortableBytes(0L); + bytes2 = NumericUtil.numberToSortableBytes(-1L); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + + bytes1 = NumericUtil.numberToSortableBytes(0L); + bytes2 = NumericUtil.numberToSortableBytes(Long.MIN_VALUE); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + + bytes1 = NumericUtil.numberToSortableBytes(1L); + bytes2 = NumericUtil.numberToSortableBytes(-1L); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + + bytes1 = NumericUtil.numberToSortableBytes(Long.MAX_VALUE); + bytes2 = NumericUtil.numberToSortableBytes(-1L); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + } + + @Test + public void testFloatToSortableBytesAndCompare() { + byte[] bytes1 = NumericUtil.numberToSortableBytes(123456F); + byte[] bytes2 = NumericUtil.numberToSortableBytes(123456F); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) == 0); + + bytes1 = NumericUtil.numberToSortableBytes(1F); + bytes2 = NumericUtil.numberToSortableBytes(2F); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) < 0); + + bytes1 = NumericUtil.numberToSortableBytes(666F); + bytes2 = NumericUtil.numberToSortableBytes(88F); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + + bytes1 = NumericUtil.numberToSortableBytes(Float.MAX_VALUE); + bytes2 = NumericUtil.numberToSortableBytes(0F); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + + bytes1 = NumericUtil.numberToSortableBytes(-123456F); + bytes2 = NumericUtil.numberToSortableBytes(-123456F); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) == 0); + + bytes1 = NumericUtil.numberToSortableBytes(-1F); + bytes2 = NumericUtil.numberToSortableBytes(-2F); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + + bytes1 = NumericUtil.numberToSortableBytes(-666F); + bytes2 = NumericUtil.numberToSortableBytes(-88F); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) < 0); + + bytes1 = NumericUtil.numberToSortableBytes(-Float.MAX_VALUE); + bytes2 = NumericUtil.numberToSortableBytes(-1F); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) < 0); + + bytes1 = NumericUtil.numberToSortableBytes(0F); + bytes2 = NumericUtil.numberToSortableBytes(-1F); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + + bytes1 = NumericUtil.numberToSortableBytes(0F); + bytes2 = NumericUtil.numberToSortableBytes(-Float.MAX_VALUE); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + + bytes1 = NumericUtil.numberToSortableBytes(1F); + bytes2 = NumericUtil.numberToSortableBytes(-1F); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + + bytes1 = NumericUtil.numberToSortableBytes(Float.MAX_VALUE); + bytes2 = NumericUtil.numberToSortableBytes(-1F); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + } + + @Test + public void testDoubleToSortableBytesAndCompare() { + byte[] bytes1 = NumericUtil.numberToSortableBytes(123456D); + byte[] bytes2 = NumericUtil.numberToSortableBytes(123456D); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) == 0); + + bytes1 = NumericUtil.numberToSortableBytes(1D); + bytes2 = NumericUtil.numberToSortableBytes(2D); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) < 0); + + bytes1 = NumericUtil.numberToSortableBytes(666D); + bytes2 = NumericUtil.numberToSortableBytes(88D); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + + bytes1 = NumericUtil.numberToSortableBytes(Double.MAX_VALUE); + bytes2 = NumericUtil.numberToSortableBytes(0D); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + + bytes1 = NumericUtil.numberToSortableBytes(-123456D); + bytes2 = NumericUtil.numberToSortableBytes(-123456D); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) == 0); + + bytes1 = NumericUtil.numberToSortableBytes(-1D); + bytes2 = NumericUtil.numberToSortableBytes(-2D); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + + bytes1 = NumericUtil.numberToSortableBytes(-666D); + bytes2 = NumericUtil.numberToSortableBytes(-88D); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) < 0); + + bytes1 = NumericUtil.numberToSortableBytes(-Double.MAX_VALUE); + bytes2 = NumericUtil.numberToSortableBytes(-1D); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) < 0); + + bytes1 = NumericUtil.numberToSortableBytes(0D); + bytes2 = NumericUtil.numberToSortableBytes(-1D); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + + bytes1 = NumericUtil.numberToSortableBytes(0D); + bytes2 = NumericUtil.numberToSortableBytes(-Double.MAX_VALUE); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + + bytes1 = NumericUtil.numberToSortableBytes(1D); + bytes2 = NumericUtil.numberToSortableBytes(-1D); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + + bytes1 = NumericUtil.numberToSortableBytes(Double.MAX_VALUE); + bytes2 = NumericUtil.numberToSortableBytes(-1F); + Assert.assertTrue(Bytes.compare(bytes1, bytes2) > 0); + } + + @Test + public void testMinValueOf() { + Assert.assertEquals(Byte.MIN_VALUE, + NumericUtil.minValueOf(Byte.class)); + + Assert.assertEquals(Integer.MIN_VALUE, + NumericUtil.minValueOf(Short.class)); + Assert.assertEquals(Integer.MIN_VALUE, + NumericUtil.minValueOf(Integer.class)); + Assert.assertEquals(Integer.MIN_VALUE, + NumericUtil.minValueOf(Float.class)); + + Assert.assertEquals(Long.MIN_VALUE, + NumericUtil.minValueOf(Long.class)); + Assert.assertEquals(Long.MIN_VALUE, + NumericUtil.minValueOf(Double.class)); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + NumericUtil.minValueOf(null); + }); + Assert.assertThrows(IllegalArgumentException.class, () -> { + NumericUtil.minValueOf(Character.class); + }); + } + private static void assertEquals(byte[] bytes1, byte[] bytes2) { Assert.assertTrue(Bytes.toHex(bytes1) + " != " + Bytes.toHex(bytes2), Bytes.equals(bytes1, bytes2)); From 0822dd93f62b8b144d1101044270c031e25cf854 Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Tue, 28 May 2019 03:40:43 -0500 Subject: [PATCH 097/217] let subclass of ConfigOption be able to override parent options (#24) also implement ConfigOption.toString() Change-Id: I1f1fd5eeaa80252fc093e7cba5af525a32a23c99 --- .../baidu/hugegraph/config/ConfigOption.java | 6 ++ .../baidu/hugegraph/config/OptionHolder.java | 3 +- .../hugegraph/unit/config/HugeConfigTest.java | 63 ++++++++++++++++++- 3 files changed, 70 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java index 2bc993fe79..06fb43a23f 100644 --- a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java +++ b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java @@ -160,4 +160,10 @@ public void check(Object value) { this.name, value); } } + + @Override + public String toString() { + return String.format("[%s]%s=%s", this.dataType.getSimpleName(), + this.name, this.defaultValue); + } } diff --git a/src/main/java/com/baidu/hugegraph/config/OptionHolder.java b/src/main/java/com/baidu/hugegraph/config/OptionHolder.java index 10aa1532c0..f306741a21 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionHolder.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionHolder.java @@ -42,7 +42,8 @@ protected void registerOptions() { for (Field field : this.getClass().getFields()) { try { ConfigOption option = (ConfigOption) field.get(this); - this.options.put(option.name(), option); + // Fields of subclass first, don't overwrite by superclass + this.options.putIfAbsent(option.name(), option); } catch (Exception e) { LOG.error("Failed to register option: {}", field, e); throw new ConfigException( diff --git a/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java b/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java index 6d5066a9d8..5e23e50710 100644 --- a/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java @@ -53,6 +53,33 @@ public static void init() { OptionSpace.register("test", TestOptions.class.getName()); } + @Test + public void testOptionsToString() { + Assert.assertEquals("[String]group1.text1=text1-value", + TestOptions.text1.toString()); + Assert.assertEquals("[Integer]group1.int1=1", + TestOptions.int1.toString()); + Assert.assertEquals("[Long]group1.long1=100", + TestOptions.long1.toString()); + Assert.assertEquals("[Float]group1.float1=100.0", + TestOptions.float1.toString()); + Assert.assertEquals("[Double]group1.double1=100.0", + TestOptions.double1.toString()); + Assert.assertEquals("[Boolean]group1.bool=true", + TestOptions.bool.toString()); + Assert.assertEquals("[List]group1.list=[list-value1, list-value2]", + TestOptions.list.toString()); + Assert.assertEquals("[List]group1.map=[key1:value1, key2:value2]", + TestOptions.map.toString()); + + Assert.assertEquals("[String]group1.text1=text1-value", + TestSubOptions.text1.toString()); + Assert.assertEquals("[String]group1.text2=text2-value-override", + TestSubOptions.text2.toString()); + Assert.assertEquals("[String]group1.textsub=textsub-value", + TestSubOptions.textsub.toString()); + } + @Test public void testHugeConfig() throws Exception { Configuration conf = new PropertiesConfiguration(); @@ -117,7 +144,22 @@ public void testHugeConfigWithConfiguration() throws Exception { Assert.assertEquals("CHOICE-3", config.get(TestOptions.text3)); } - public static final class TestOptions extends OptionHolder { + @Test + public void testHugeConfigWithOverride() throws Exception { + Configuration conf = new PropertiesConfiguration(); + Whitebox.setInternalState(conf, "delimiterParsingDisabled", true); + + HugeConfig config = new HugeConfig(conf); + + Assert.assertEquals("text1-value", config.get(TestSubOptions.text1)); + + Assert.assertEquals("text2-value-override", + config.get(TestSubOptions.text2)); + Assert.assertEquals("textsub-value", + config.get(TestSubOptions.textsub)); + } + + public static class TestOptions extends OptionHolder { private static volatile TestOptions instance; @@ -229,4 +271,23 @@ public static synchronized TestOptions instance() { "key1:value1", "key2:value2" ); } + + public static class TestSubOptions extends TestOptions { + + public static final ConfigOption text2 = + new ConfigOption<>( + "group1.text2", + "description of group1.text2", + disallowEmpty(), + "text2-value-override" + ); + + public static final ConfigOption textsub = + new ConfigOption<>( + "group1.textsub", + "description of group1.textsub", + disallowEmpty(), + "textsub-value" + ); + } } From 1a66a608976a0a9c737a3ecd9c7d76946f9af201 Mon Sep 17 00:00:00 2001 From: Linary Date: Wed, 29 May 2019 20:07:59 +0800 Subject: [PATCH 098/217] Enhance toList and add toSet in CollectionUtil (#25) --- pom.xml | 4 +- .../baidu/hugegraph/util/CollectionUtil.java | 36 ++++++++++----- .../hugegraph/version/CommonVersion.java | 2 +- .../unit/util/CollectionUtilTest.java | 44 ++++++++++++++++--- 4 files changed, 66 insertions(+), 20 deletions(-) diff --git a/pom.xml b/pom.xml index 60222d3c3a..64d6b9c70d 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.6.2 + 1.6.3 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -212,7 +212,7 @@ - 1.6.2.0 + 1.6.3.0 diff --git a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java index 2a4c7ca63e..5a1c6a69df 100644 --- a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java @@ -33,19 +33,33 @@ public final class CollectionUtil { + public static Set toSet(Object object) { + E.checkNotNull(object, "object"); + Set set = InsertionOrderUtil.newSet(); + fillCollection(set, object); + return set; + } + + public static List toList(Object object) { + E.checkNotNull(object, "object"); + List list = new ArrayList<>(); + fillCollection(list, object); + return list; + } + @SuppressWarnings("unchecked") - public static List toList(Object array) { - E.checkNotNull(array, "array"); - E.checkArgument(array.getClass().isArray(), - "The parameter of toList() must be an array: '%s'", - array.getClass().getSimpleName()); - - int length = Array.getLength(array); - List list = new ArrayList<>(length); - for (int i = 0; i < length; i++) { - list.add((T) Array.get(array, i)); + private static void fillCollection(Collection collection, + Object object) { + if (object.getClass().isArray()) { + int length = Array.getLength(object); + for (int i = 0; i < length; i++) { + collection.add((T) Array.get(object, i)); + } + } else if (object instanceof Collection) { + collection.addAll((Collection) object); + } else { + collection.add((T) object); } - return list; } public static boolean prefixOf(List prefix, List all) { diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 2aefe577c3..dc67cd0aec 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.6.2"); + "1.6.3"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java index 72ba0239d9..e7e9e95ed3 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java @@ -37,8 +37,37 @@ public class CollectionUtilTest extends BaseUnitTest { + @Test + public void testToSet() { + Assert.assertThrows(NullPointerException.class, () -> { + CollectionUtil.toSet(null); + }); + + Object array1 = new Integer[]{1, 2, 3}; + Assert.assertEquals(ImmutableSet.of(1, 2, 3), + CollectionUtil.toSet(array1)); + + Object array2 = new String[]{"1", "2", "3"}; + Assert.assertEquals(ImmutableSet.of("1", "2", "3"), + CollectionUtil.toSet(array2)); + + Set set = ImmutableSet.of(1, 2, 3); + Assert.assertEquals(ImmutableSet.of(1, 2, 3), + CollectionUtil.toSet(set)); + + List list = ImmutableList.of(1, 2, 3); + Assert.assertEquals(ImmutableSet.of(1, 2, 3), + CollectionUtil.toSet(list)); + + Assert.assertEquals(ImmutableSet.of(1), CollectionUtil.toSet(1)); + } + @Test public void testToList() { + Assert.assertThrows(NullPointerException.class, () -> { + CollectionUtil.toList(null); + }); + Object array1 = new Integer[]{1, 2, 3}; Assert.assertEquals(ImmutableList.of(1, 2, 3), CollectionUtil.toList(array1)); @@ -47,13 +76,16 @@ public void testToList() { Assert.assertEquals(ImmutableList.of("1", "2", "3"), CollectionUtil.toList(array2)); - Assert.assertThrows(NullPointerException.class, () -> { - CollectionUtil.toList(null); - }); + Set set = ImmutableSet.of(1, 2, 3); + Assert.assertEquals(ImmutableList.of(1, 2, 3), + CollectionUtil.toList(set)); - Assert.assertThrows(IllegalArgumentException.class, () -> { - CollectionUtil.toList("123"); - }); + List list = ImmutableList.of(1, 2, 3); + Assert.assertEquals(ImmutableList.of(1, 2, 3), + CollectionUtil.toList(list)); + + Assert.assertEquals(ImmutableList.of("123"), + CollectionUtil.toList("123")); } @Test From 64bd1543e844a29bd1d58af922a71117121c5072 Mon Sep 17 00:00:00 2001 From: Linary Date: Tue, 11 Jun 2019 18:43:20 +0800 Subject: [PATCH 099/217] RestClient support to close idle connection periodically (#26) --- pom.xml | 4 +- .../com/baidu/hugegraph/rest/RestClient.java | 172 +++++++++++------- .../baidu/hugegraph/testutil/Whitebox.java | 9 +- .../hugegraph/version/CommonVersion.java | 2 +- .../hugegraph/testutil/WhiteboxTest.java | 30 +++ .../baidu/hugegraph/unit/UnitTestSuite.java | 2 + .../unit/date/SafeDateFormatTest.java | 100 ++++++++++ .../hugegraph/unit/rest/RestClientTest.java | 103 +++++++++++ 8 files changed, 355 insertions(+), 67 deletions(-) create mode 100644 src/test/java/com/baidu/hugegraph/unit/date/SafeDateFormatTest.java diff --git a/pom.xml b/pom.xml index 64d6b9c70d..fd1b382262 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.6.3 + 1.6.4 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -212,7 +212,7 @@ - 1.6.3.0 + 1.6.4.0 diff --git a/src/main/java/com/baidu/hugegraph/rest/RestClient.java b/src/main/java/com/baidu/hugegraph/rest/RestClient.java index 4a519b0427..63871e021e 100644 --- a/src/main/java/com/baidu/hugegraph/rest/RestClient.java +++ b/src/main/java/com/baidu/hugegraph/rest/RestClient.java @@ -24,19 +24,23 @@ import java.util.Collection; import java.util.Map; import java.util.concurrent.Callable; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.Entity; -import javax.ws.rs.client.Invocation; +import javax.ws.rs.client.Invocation.Builder; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; import javax.ws.rs.core.Variant; -import org.apache.http.config.SocketConfig; +import org.apache.commons.lang3.tuple.Pair; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.apache.http.pool.PoolStats; import org.glassfish.jersey.apache.connector.ApacheConnectorProvider; import org.glassfish.jersey.client.ClientConfig; import org.glassfish.jersey.client.ClientProperties; @@ -50,23 +54,32 @@ public abstract class RestClient { - private final ClientConfig config; + // Time unit: hours + private static long TTL = 24L; + // Time unit: seconds + private static long IDLE_TIME = 40L; + // Time unit: seconds + private static long CHECK_PERIOD = IDLE_TIME / 2; + private final Client client; private final WebTarget target; + private PoolingHttpClientConnectionManager pool; + private ScheduledExecutorService cleanExecutor; + public RestClient(String url, int timeout) { this(url, new ConfigBuilder().config(timeout).build()); } - public RestClient(String url, int timeout, int maxTotal, int maxPerRoute) { + public RestClient(String url, String user, String password, int timeout) { this(url, new ConfigBuilder().config(timeout) - .config(timeout, maxTotal, maxPerRoute) + .config(user, password) .build()); } - public RestClient(String url, String user, String password, int timeout) { + public RestClient(String url, int timeout, int maxTotal, int maxPerRoute) { this(url, new ConfigBuilder().config(timeout) - .config(user, password) + .config(maxTotal, maxPerRoute) .build()); } @@ -74,15 +87,37 @@ public RestClient(String url, String user, String password, int timeout, int maxTotal, int maxPerRoute) { this(url, new ConfigBuilder().config(timeout) .config(user, password) - .config(timeout, maxTotal, maxPerRoute) + .config(maxTotal, maxPerRoute) .build()); } public RestClient(String url, ClientConfig config) { - this.config = config; - this.client = ClientBuilder.newClient(this.config); + this.client = ClientBuilder.newClient(config); this.client.register(GZipEncoder.class); this.target = this.client.target(url); + this.pool = (PoolingHttpClientConnectionManager) + config.getProperty(CONNECTION_MANAGER); + if (this.pool != null) { + this.cleanExecutor = Executors.newScheduledThreadPool(1); + this.cleanExecutor.scheduleWithFixedDelay(() -> { + PoolStats stats = this.pool.getTotalStats(); + int using = stats.getLeased() + stats.getPending(); + if (using > 0) { + // Do clean only when all connections are idle + return; + } + this.pool.closeIdleConnections(IDLE_TIME, TimeUnit.SECONDS); + this.pool.closeExpiredConnections(); + }, CHECK_PERIOD, CHECK_PERIOD, TimeUnit.SECONDS); + } + } + + public void close() { + if (this.pool != null) { + this.pool.close(); + this.cleanExecutor.shutdownNow(); + } + this.client.close(); } protected Response request(Callable method) { @@ -94,7 +129,7 @@ protected Response request(Callable method) { } public RestResult post(String path, Object object) { - return this.post(path, object, null); + return this.post(path, object, null, null); } public RestResult post(String path, Object object, @@ -103,40 +138,18 @@ public RestResult post(String path, Object object, } public RestResult post(String path, Object object, - MultivaluedMap headers, Map params) { - WebTarget target = this.target; - if (params != null && !params.isEmpty()) { - for (Map.Entry param : params.entrySet()) { - target = target.queryParam(param.getKey(), param.getValue()); - } - } - - Ref builder = Refs.of(target.path(path).request()); - - String encoding = null; - if (headers != null && !headers.isEmpty()) { - // Add headers - builder.set(builder.get().headers(headers)); - encoding = (String) headers.getFirst("Content-Encoding"); - } - - /* - * We should specify the encoding of the entity object manually, - * because Entity.json() method will reset "content encoding = - * null" that has been set up by headers before. - */ - Ref> entity = Refs.of(null); - if (encoding == null) { - entity.set(Entity.json(object)); - } else { - Variant variant = new Variant(MediaType.APPLICATION_JSON_TYPE, - (String) null, encoding); - entity.set(Entity.entity(object, variant)); - } + return this.post(path, object, null, params); + } + public RestResult post(String path, Object object, + MultivaluedMap headers, + Map params) { + Pair> pair = this.buildRequest(path, null, object, + headers, params); Response response = this.request(() -> { - return builder.get().post(entity.get()); + // pair.getLeft() is builder, pair.getRight() is entity (http body) + return pair.getLeft().post(pair.getRight()); }); // If check status failed, throw client exception. checkStatus(response, Response.Status.CREATED, @@ -148,18 +161,24 @@ public RestResult put(String path, String id, Object object) { return this.put(path, id, object, ImmutableMap.of()); } + public RestResult put(String path, String id, Object object, + MultivaluedMap headers) { + return this.put(path, id, object, headers, null); + } + public RestResult put(String path, String id, Object object, Map params) { - Ref target = Refs.of(this.target); - if (params != null && !params.isEmpty()) { - for (String key : params.keySet()) { - target.set(target.get().queryParam(key, params.get(key))); - } - } + return this.put(path, id, object, null, params); + } + public RestResult put(String path, String id, Object object, + MultivaluedMap headers, + Map params) { + Pair> pair = this.buildRequest(path, id, object, + headers, params); Response response = this.request(() -> { - return target.get().path(path).path(encode(id)).request() - .put(Entity.json(object)); + // pair.getLeft() is builder, pair.getRight() is entity (http body) + return pair.getLeft().put(pair.getRight()); }); // If check status failed, throw client exception. checkStatus(response, Response.Status.OK, Response.Status.ACCEPTED); @@ -223,8 +242,41 @@ public RestResult delete(String path, String id) { return new RestResult(response); } - public void close() { - this.client.close(); + private Pair> buildRequest( + String path, String id, Object object, + MultivaluedMap headers, + Map params) { + WebTarget target = this.target; + if (params != null && !params.isEmpty()) { + for (Map.Entry param : params.entrySet()) { + target = target.queryParam(param.getKey(), param.getValue()); + } + } + + Builder builder = id == null ? target.path(path).request() : + target.path(path).path(encode(id)).request(); + + String encoding = null; + if (headers != null && !headers.isEmpty()) { + // Add headers + builder = builder.headers(headers); + encoding = (String) headers.getFirst("Content-Encoding"); + } + + /* + * We should specify the encoding of the entity object manually, + * because Entity.json() method will reset "content encoding = + * null" that has been set up by headers before. + */ + Entity entity; + if (encoding == null) { + entity = Entity.json(object); + } else { + Variant variant = new Variant(MediaType.APPLICATION_JSON_TYPE, + (String) null, encoding); + entity = Entity.entity(object, variant); + } + return Pair.of(builder, entity); } private static String encode(String raw) { @@ -263,8 +315,7 @@ public ConfigBuilder config(String username, String password) { return this; } - public ConfigBuilder config(int timeout, int maxTotal, - int maxPerRoute) { + public ConfigBuilder config(int maxTotal, int maxPerRoute) { /* * Using httpclient with connection pooling, and configuring the * jersey connector, reference: @@ -275,14 +326,11 @@ public ConfigBuilder config(int timeout, int maxTotal, * repository seems to have a bug. * https://github.com/jersey/jersey/pull/3752 */ - PoolingHttpClientConnectionManager pcm = - new PoolingHttpClientConnectionManager(); - pcm.setDefaultSocketConfig(SocketConfig.custom() - .setSoTimeout(timeout) - .build()); - pcm.setMaxTotal(maxTotal); - pcm.setDefaultMaxPerRoute(maxPerRoute); - this.config.property(CONNECTION_MANAGER, pcm); + PoolingHttpClientConnectionManager pool; + pool = new PoolingHttpClientConnectionManager(TTL, TimeUnit.HOURS); + pool.setMaxTotal(maxTotal); + pool.setDefaultMaxPerRoute(maxPerRoute); + this.config.property(CONNECTION_MANAGER, pool); this.config.connectorProvider(new ApacheConnectorProvider()); return this; } diff --git a/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java b/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java index 934157054b..834d5796d5 100644 --- a/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java +++ b/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java @@ -39,8 +39,11 @@ public static void setInternalState(Object target, String fieldName, target = getInternalState(target, fieldName.substring(0, sep)); fieldName = fieldName.substring(sep + 1); } + + Class c = target instanceof Class ? + (Class) target : target.getClass(); try { - Field f = getFieldFromHierarchy(target.getClass(), fieldName); + Field f = getFieldFromHierarchy(c, fieldName); f.setAccessible(true); f.set(target, value); } catch (Exception e) { @@ -59,7 +62,9 @@ public static T getInternalState(Object target, String fieldName) { field = fieldName.substring(sep + 1); return getInternalState(value, field); } - Class c = target.getClass(); + + Class c = target instanceof Class ? + (Class) target : target.getClass(); try { Field f = getFieldFromHierarchy(c, fieldName); f.setAccessible(true); diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index dc67cd0aec..5843330cc0 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.6.3"); + "1.6.4"); } diff --git a/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java b/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java index 3702f7e227..9e84a592e5 100644 --- a/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java +++ b/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java @@ -23,6 +23,34 @@ public class WhiteboxTest { + @Test + public void testGetStaticInternalState() { + Assert.assertEquals(1, Whitebox.getInternalState(Test1.class, + "staticValue")); + Test1 test1 = newTest(); + Assert.assertEquals(1, Whitebox.getInternalState(test1, "staticValue")); + Assert.assertEquals(2, Whitebox.getInternalState(test1, + "test2.staticValue")); + } + + @Test + public void testSetStaticInternalState() { + try { + Whitebox.setInternalState(Test1.class, "staticValue", 11); + Assert.assertEquals(11, Test1.staticValue); + + Test1 test1 = newTest(); + Whitebox.setInternalState(test1, "staticValue", 111); + Assert.assertEquals(111, Test1.staticValue); + + Whitebox.setInternalState(test1, "test2.staticValue", 22); + Assert.assertEquals(22, Test2.staticValue); + } finally { + Whitebox.setInternalState(Test1.class, "staticValue", 1); + Whitebox.setInternalState(Test2.class, "staticValue", 2); + } + } + @Test public void testGetInternalState() { Test1 test1 = newTest(); @@ -113,6 +141,7 @@ private static Test1 newTest() { @SuppressWarnings("unused") private static class Test1 { + private static int staticValue = 1; private int ivalue = 1; private Test2 test2; @@ -136,6 +165,7 @@ private static T svalue(T o) { @SuppressWarnings("unused") private static class Test2 { + private static int staticValue = 2; private final float fvalue = 2; private Test3 test3; diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java index 70fe2d81bf..629e986d5b 100644 --- a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java +++ b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -25,6 +25,7 @@ import com.baidu.hugegraph.testutil.AssertTest; import com.baidu.hugegraph.testutil.WhiteboxTest; import com.baidu.hugegraph.unit.config.HugeConfigTest; +import com.baidu.hugegraph.unit.date.SafeDateFormatTest; import com.baidu.hugegraph.unit.event.EventHubTest; import com.baidu.hugegraph.unit.iterator.ExtendableIteratorTest; import com.baidu.hugegraph.unit.iterator.FilterIteratorTest; @@ -49,6 +50,7 @@ @RunWith(Suite.class) @Suite.SuiteClasses({ HugeConfigTest.class, + SafeDateFormatTest.class, EventHubTest.class, PerfUtilTest.class, RestClientTest.class, diff --git a/src/test/java/com/baidu/hugegraph/unit/date/SafeDateFormatTest.java b/src/test/java/com/baidu/hugegraph/unit/date/SafeDateFormatTest.java new file mode 100644 index 0000000000..f5133a93bb --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/date/SafeDateFormatTest.java @@ -0,0 +1,100 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.date; + +import java.text.DateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.concurrent.CountDownLatch; + +import org.junit.Test; + +import com.baidu.hugegraph.date.SafeDateFormat; +import com.baidu.hugegraph.testutil.Assert; +import com.google.common.collect.ImmutableList; + +public class SafeDateFormatTest { + + @SuppressWarnings("deprecation") + @Test + public void testSafeDateFormatInConcurrency() throws Exception { + DateFormat format = new SafeDateFormat("yyyy-MM-dd"); + List sources = ImmutableList.of( + "2010-01-01", + "2011-02-02", + "2012-03-03", + "2013-04-04", + "2014-05-05", + "2015-06-06", + "2016-07-07", + "2017-08-08", + "2018-09-09", + "2019-10-10" + ); + List dates = new ArrayList<>(sources.size()); + + for (int i = 0; i < sources.size(); i++) { + Date date = format.parse(sources.get(i)); + Assert.assertEquals(2010 + i, 1900 + date.getYear()); + Assert.assertEquals(i, date.getMonth()); + Assert.assertEquals(1 + i, date.getDate()); + dates.add(date); + } + + List exceptions = new ArrayList<>(); + final CountDownLatch latch = new CountDownLatch(1); + int threadCount = 10; + List threads = new ArrayList<>(threadCount); + for (int t = 0; t < threadCount; t++) { + Thread thread = new Thread(() -> { + try { + latch.await(); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + + for (int i = 0; i < sources.size(); i++) { + try { + Assert.assertEquals(dates.get(i), + format.parse(sources.get(i))); + Assert.assertEquals(sources.get(i), + format.format(dates.get(i))); + } catch (Exception e) { + exceptions.add(e); + } + } + }); + threads.add(thread); + } + + for (Thread thread : threads) { + thread.start(); + } + + latch.countDown(); + + for (Thread thread : threads) { + thread.join(); + } + + Assert.assertTrue(exceptions.isEmpty()); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java b/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java index 9d1dd95fc3..bb9fb54deb 100644 --- a/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java @@ -22,11 +22,19 @@ import java.util.HashMap; import java.util.Map; import java.util.concurrent.Callable; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; import javax.ws.rs.core.MultivaluedHashMap; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; +import org.apache.http.HttpClientConnection; +import org.apache.http.HttpHost; +import org.apache.http.conn.routing.HttpRoute; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.apache.http.pool.PoolStats; import org.glassfish.jersey.internal.util.collection.ImmutableMultivaluedMap; import org.junit.Test; import org.mockito.Mockito; @@ -35,6 +43,7 @@ import com.baidu.hugegraph.rest.RestClient; import com.baidu.hugegraph.rest.RestResult; import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.testutil.Whitebox; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; @@ -137,6 +146,66 @@ public void testPostWithMaxTotalAndPerRoute() { Assert.assertEquals(200, restResult.status()); } + @Test + public void testCleanExecutor() throws Exception { + long oldIdleTime = Whitebox.getInternalState(RestClient.class, + "IDLE_TIME"); + long oldCheckPeriod = Whitebox.getInternalState(RestClient.class, + "CHECK_PERIOD"); + long newCheckPeriod = 1L; + long newIdleTime = 2 * newCheckPeriod; + // Modify IDLE_TIME and CHECK_PERIOD to speed test + Whitebox.setInternalState(RestClient.class, "IDLE_TIME", newIdleTime); + Whitebox.setInternalState(RestClient.class, "CHECK_PERIOD", + newCheckPeriod); + + try { + RestClient client = new RestClientImpl("/test", 1000, 10, 5, 200); + + PoolingHttpClientConnectionManager pool; + pool = Whitebox.getInternalState(client, "pool"); + pool = Mockito.spy(pool); + Whitebox.setInternalState(client, "pool", pool); + HttpRoute route = new HttpRoute(HttpHost.create( + "http://127.0.0.1:8080")); + // Create a connection manually, it will be put into leased list + HttpClientConnection conn = pool.requestConnection(route, null) + .get(1L, TimeUnit.SECONDS); + PoolStats stats = pool.getTotalStats(); + int usingConns = stats.getLeased() + stats.getPending(); + Assert.assertTrue(usingConns >= 1); + + // Sleep more than two check periods for busy connection + Thread.sleep(newCheckPeriod * 1000 * 2); + Mockito.verify(pool, Mockito.never()) + .closeExpiredConnections(); + stats = pool.getTotalStats(); + usingConns = stats.getLeased() + stats.getPending(); + Assert.assertTrue(usingConns >= 1); + + // The connection will be put into available list + pool.releaseConnection(conn, null, 0, TimeUnit.SECONDS); + + stats = pool.getTotalStats(); + usingConns = stats.getLeased() + stats.getPending(); + Assert.assertEquals(0, usingConns); + /* + * Sleep more than two check periods for free connection, + * ensure connection has been closed + */ + Thread.sleep(newCheckPeriod * 1000 * 2); + Mockito.verify(pool, Mockito.atLeastOnce()) + .closeExpiredConnections(); + Mockito.verify(pool, Mockito.atLeastOnce()) + .closeIdleConnections(newIdleTime, TimeUnit.SECONDS); + } finally { + Whitebox.setInternalState(RestClient.class, "IDLE_TIME", + oldIdleTime); + Whitebox.setInternalState(RestClient.class, "CHECK_PERIOD", + oldCheckPeriod); + } + } + @Test public void testPostWithUserAndPassword() { RestClient client = new RestClientImpl("/test", "user", "", 1000, 200); @@ -194,6 +263,17 @@ public void testPut() { Assert.assertEquals(200, restResult.status()); } + @Test + public void testPutWithHeaders() { + RestClient client = new RestClientImpl("/test", 1000, 200); + MultivaluedMap headers = new MultivaluedHashMap<>(); + headers.add("key1", "value1-1"); + headers.add("key1", "value1-2"); + headers.add("Content-Encoding", "gzip"); + RestResult restResult = client.put("path", "id1", "body", headers); + Assert.assertEquals(200, restResult.status()); + } + @Test public void testPutWithParams() { RestClient client = new RestClientImpl("/test", 1000, 200); @@ -264,4 +344,27 @@ public void testDeleteWithException() { client.delete("path", "id1"); }); } + + @Test + public void testClose() { + RestClient client = new RestClientImpl("/test", 1000, 10, 5, 200); + RestResult restResult = client.post("path", "body"); + Assert.assertEquals(200, restResult.status()); + + client.close(); + Assert.assertThrows(IllegalStateException.class, () -> { + client.post("path", "body"); + }); + + PoolingHttpClientConnectionManager pool; + pool = Whitebox.getInternalState(client, "pool"); + Assert.assertNotNull(pool); + AtomicBoolean isShutDown = Whitebox.getInternalState(pool, "isShutDown"); + Assert.assertTrue(isShutDown.get()); + + ScheduledExecutorService cleanExecutor; + cleanExecutor = Whitebox.getInternalState(client, "cleanExecutor"); + Assert.assertNotNull(cleanExecutor); + Assert.assertTrue(cleanExecutor.isShutdown()); + } } From 2f453c0af9b5aee581e2cf92189bf80bffb57d1d Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Mon, 17 Jun 2019 15:13:07 +0800 Subject: [PATCH 100/217] support typed option (#27) Change-Id: I845d3e0f59b3de4eb086a57f206a02fae0aae549 --- pom.xml | 4 +- .../hugegraph/config/ConfigConvOption.java | 47 +++++ .../config/ConfigListConvOption.java | 72 ++++++++ .../hugegraph/config/ConfigListOption.java | 26 ++- .../baidu/hugegraph/config/ConfigOption.java | 140 +-------------- .../baidu/hugegraph/config/HugeConfig.java | 6 +- .../baidu/hugegraph/config/OptionChecker.java | 11 ++ .../baidu/hugegraph/config/OptionHolder.java | 6 +- .../baidu/hugegraph/config/OptionSpace.java | 4 +- .../baidu/hugegraph/config/TypedOption.java | 160 ++++++++++++++++++ .../hugegraph/version/CommonVersion.java | 2 +- .../hugegraph/unit/config/HugeConfigTest.java | 35 +++- 12 files changed, 356 insertions(+), 157 deletions(-) create mode 100644 src/main/java/com/baidu/hugegraph/config/ConfigConvOption.java create mode 100644 src/main/java/com/baidu/hugegraph/config/ConfigListConvOption.java create mode 100644 src/main/java/com/baidu/hugegraph/config/TypedOption.java diff --git a/pom.xml b/pom.xml index fd1b382262..13b0cd76d8 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.6.4 + 1.6.5 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -212,7 +212,7 @@ - 1.6.4.0 + 1.6.5.0 diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigConvOption.java b/src/main/java/com/baidu/hugegraph/config/ConfigConvOption.java new file mode 100644 index 0000000000..9f354d086b --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/config/ConfigConvOption.java @@ -0,0 +1,47 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.config; + +import java.util.function.Function; + +import com.google.common.base.Predicate; + +public class ConfigConvOption extends TypedOption { + + private final Function converter; + + public ConfigConvOption(String name, String desc, Predicate pred, + Function convert, String value) { + this(name, false, desc, pred, convert, value); + } + + public ConfigConvOption(String name, boolean required, String desc, + Predicate pred, Function convert, + String value) { + super(name, required, desc, pred, String.class, value); + this.converter = convert; + } + + @Override + public R convert(Object value) { + assert value instanceof String; + return this.converter.apply((String) value); + } +} diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigListConvOption.java b/src/main/java/com/baidu/hugegraph/config/ConfigListConvOption.java new file mode 100644 index 0000000000..6d5fa95891 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/config/ConfigListConvOption.java @@ -0,0 +1,72 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.config; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.function.Function; + +import com.baidu.hugegraph.util.E; +import com.google.common.base.Predicate; + +public class ConfigListConvOption extends TypedOption, List> { + + private final Class elemClass; + private final Function converter; + + @SuppressWarnings("unchecked") + public ConfigListConvOption(String name, String desc, + Predicate> pred, Function convert, + T value) { + this(name, desc, pred, convert, (Class) value.getClass(), value); + } + + @SuppressWarnings("unchecked") + public ConfigListConvOption(String name, String desc, + Predicate> pred, Function convert, + Class clazz, T... values) { + this(name, false, desc, pred, convert, clazz, Arrays.asList(values)); + } + + @SuppressWarnings("unchecked") + public ConfigListConvOption(String name, boolean required, String desc, + Predicate> pred, Function convert, + Class clazz, List values) { + super(name, required, desc, pred, + (Class>) values.getClass(), values); + E.checkArgumentNotNull(clazz, "Element class can't be null"); + this.elemClass = clazz; + this.converter = convert; + } + + @Override + public List convert(Object value) { + List results = ConfigListOption.convert(value, part -> { + return super.convert(part, this.elemClass); + }); + + List enums = new ArrayList<>(results.size()); + for (T elem : results) { + enums.add(this.converter.apply(elem)); + } + return enums; + } +} diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java b/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java index ff3a6f287c..9add0bc944 100644 --- a/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java +++ b/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java @@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.function.Function; import com.baidu.hugegraph.util.E; import com.google.common.base.Predicate; @@ -32,30 +33,37 @@ public class ConfigListOption extends ConfigOption> { @SuppressWarnings("unchecked") public ConfigListOption(String name, String desc, - Predicate> func, T value) { - this(name, false, desc, func, (Class) value.getClass(), value); + Predicate> pred, T value) { + this(name, desc, pred, (Class) value.getClass(), value); } @SuppressWarnings("unchecked") - public ConfigListOption(String name, boolean required, String desc, - Predicate> func, Class clazz, + public ConfigListOption(String name, String desc, + Predicate> pred, Class clazz, T... values) { - this(name, required, desc, func, clazz, Arrays.asList(values)); + this(name, false, desc, pred, clazz, Arrays.asList(values)); } @SuppressWarnings("unchecked") public ConfigListOption(String name, boolean required, String desc, - Predicate> func, Class clazz, + Predicate> pred, Class clazz, List values) { - super(name, required, desc, func, + super(name, required, desc, pred, (Class>) values.getClass(), values); E.checkArgumentNotNull(clazz, "Element class can't be null"); this.elemClass = clazz; } @Override - @SuppressWarnings("unchecked") public List convert(Object value) { + return convert(value, part -> super.convert(part, this.elemClass)); + } + + @SuppressWarnings("unchecked") + public static List convert(Object value, Function conv) { + if (value instanceof List) { + return (List) value; + } // If target data type is List, parse it as a list String str = (String) value; if (str.startsWith("[") && str.endsWith("]")) { @@ -69,7 +77,7 @@ public List convert(Object value) { String[] parts = str.split(","); List results = new ArrayList<>(parts.length); for (String part : parts) { - results.add((T) super.convert(part.trim(), this.elemClass)); + results.add((T) conv.apply(part.trim())); } return results; } diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java index 06fb43a23f..cb958744b4 100644 --- a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java +++ b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java @@ -19,151 +19,21 @@ package com.baidu.hugegraph.config; -import java.lang.reflect.Method; -import java.util.List; -import java.util.Set; - -import org.apache.commons.configuration.PropertyConverter; -import org.slf4j.Logger; - -import com.baidu.hugegraph.util.E; -import com.baidu.hugegraph.util.Log; -import com.google.common.base.Joiner; import com.google.common.base.Predicate; -import com.google.common.collect.ImmutableSet; - -public class ConfigOption { - - private static final Logger LOG = Log.logger(ConfigOption.class); - - private static final Set> ACCEPTED_DATA_TYPES; - private static final String ACCEPTED_DATA_TYPES_STRING; - static { - ACCEPTED_DATA_TYPES = ImmutableSet.of( - Boolean.class, - Short.class, - Integer.class, - Byte.class, - Long.class, - Float.class, - Double.class, - String.class, - String[].class, - List.class - ); - - ACCEPTED_DATA_TYPES_STRING = Joiner.on(", ").join(ACCEPTED_DATA_TYPES); - } - - private final String name; - private final String desc; - private final boolean required; - private final Class dataType; - private final T defaultValue; - private final Predicate checkFunc; +public class ConfigOption extends TypedOption { public ConfigOption(String name, String desc, T value) { this(name, desc, null, value); } @SuppressWarnings("unchecked") - public ConfigOption(String name, String desc, Predicate func, T value) { - this(name, false, desc, func, (Class) value.getClass(), value); + public ConfigOption(String name, String desc, Predicate pred, T value) { + this(name, false, desc, pred, (Class) value.getClass(), value); } - @SuppressWarnings("unchecked") public ConfigOption(String name, boolean required, String desc, - Predicate func, Class type, T value) { - E.checkNotNull(name, "name"); - E.checkNotNull(type, "dataType"); - - this.name = name; - this.dataType = (Class) this.checkAndAssignDataType(type); - this.defaultValue = value; - this.required = required; - this.desc = desc; - this.checkFunc = func; - - this.check(this.defaultValue); - } - - private Class checkAndAssignDataType(Class dataType) { - for (Class clazz : ACCEPTED_DATA_TYPES) { - if (clazz.isAssignableFrom(dataType)) { - return clazz; - } - } - - String msg = String.format("Input data type '%s' doesn't belong " + - "to acceptable type set: [%s]", - dataType, ACCEPTED_DATA_TYPES_STRING); - throw new IllegalArgumentException(msg); - } - - public String name() { - return this.name; - } - - public Class dataType() { - return this.dataType; - } - - public String desc() { - return this.desc; - } - - public boolean required() { - return this.required; - } - - public T defaultValue() { - return this.defaultValue; - } - - @SuppressWarnings("unchecked") - public T convert(Object value) { - return (T) this.convert(value, this.dataType); - } - - public Object convert(Object value, Class dataType) { - if (dataType.equals(String.class)) { - return value; - } - - // Use PropertyConverter method `toXXX` convert value - String methodTo = "to" + dataType.getSimpleName(); - try { - Method method = PropertyConverter.class.getMethod( - methodTo, Object.class); - return method.invoke(null, value); - } catch (ReflectiveOperationException e) { - LOG.error("Invalid type of value '{}' for option '{}'", - value, this.name, e); - throw new ConfigException( - "Invalid type of value '%s' for option '%s', " + - "expect '%s' type", - value, this.name, dataType.getSimpleName()); - } - } - - public void check(Object value) { - E.checkNotNull(value, "value", this.name); - E.checkArgument(this.dataType.isInstance(value), - "Invalid type of value '%s' for option '%s'", - value, this.name); - if (this.checkFunc != null) { - @SuppressWarnings("unchecked") - T result = (T) value; - E.checkArgument(this.checkFunc.apply(result), - "Invalid option value for '%s': %s", - this.name, value); - } - } - - @Override - public String toString() { - return String.format("[%s]%s=%s", this.dataType.getSimpleName(), - this.name, this.defaultValue); + Predicate pred, Class type, T value) { + super(name, required, desc, pred, type, value); } } diff --git a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java index c61b8fd7eb..7dc6ec8c1b 100644 --- a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java +++ b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java @@ -110,9 +110,9 @@ private static PropertiesConfiguration loadConfigFile(String path) { } @SuppressWarnings("unchecked") - public T get(ConfigOption option) { + public R get(TypedOption option) { Object value = this.getProperty(option.name()); - return value != null ? (T) value : option.defaultValue(); + return value != null ? (R) value : option.defaultValue(); } public Map getMap(ConfigListOption option) { @@ -144,7 +144,7 @@ private Object validateOption(String key, Object value) { E.checkArgument(value instanceof String, "Invalid value for key '%s': %s", key, value); - ConfigOption option = OptionSpace.get(key); + TypedOption option = OptionSpace.get(key); Class dataType = option.dataType(); if (List.class.isAssignableFrom(dataType)) { diff --git a/src/main/java/com/baidu/hugegraph/config/OptionChecker.java b/src/main/java/com/baidu/hugegraph/config/OptionChecker.java index ff70581a8d..f3e116f419 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionChecker.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionChecker.java @@ -21,6 +21,7 @@ import java.lang.reflect.Array; import java.util.Arrays; +import java.util.List; import javax.annotation.Nullable; @@ -62,6 +63,16 @@ public boolean apply(@Nullable O o) { }; } + @SuppressWarnings("unchecked") + public static Predicate> inValues(O... values) { + return new Predicate>() { + @Override + public boolean apply(@Nullable List o) { + return o != null && Arrays.asList(values).containsAll(o); + } + }; + } + public static Predicate positiveInt() { return new Predicate() { @Override diff --git a/src/main/java/com/baidu/hugegraph/config/OptionHolder.java b/src/main/java/com/baidu/hugegraph/config/OptionHolder.java index f306741a21..6b5c398d9c 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionHolder.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionHolder.java @@ -32,7 +32,7 @@ public class OptionHolder { private static final Logger LOG = Log.logger(HugeConfig.class); - protected Map> options; + protected Map> options; public OptionHolder() { this.options = new HashMap<>(); @@ -41,7 +41,7 @@ public OptionHolder() { protected void registerOptions() { for (Field field : this.getClass().getFields()) { try { - ConfigOption option = (ConfigOption) field.get(this); + TypedOption option = (TypedOption) field.get(this); // Fields of subclass first, don't overwrite by superclass this.options.putIfAbsent(option.name(), option); } catch (Exception e) { @@ -52,7 +52,7 @@ protected void registerOptions() { } } - public Map> options() { + public Map> options() { return Collections.unmodifiableMap(this.options); } } diff --git a/src/main/java/com/baidu/hugegraph/config/OptionSpace.java b/src/main/java/com/baidu/hugegraph/config/OptionSpace.java index 632f37e5de..485fb81d27 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionSpace.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionSpace.java @@ -34,7 +34,7 @@ public final class OptionSpace { private static final Logger LOG = Log.logger(OptionSpace.class); private static final Map> holders; - private static final Map> options; + private static final Map> options; private static final String INSTANCE_METHOD = "instance"; static { @@ -105,7 +105,7 @@ public static Boolean containKey(String key) { return options.containsKey(key); } - public static ConfigOption get(String key) { + public static TypedOption get(String key) { return options.get(key); } } diff --git a/src/main/java/com/baidu/hugegraph/config/TypedOption.java b/src/main/java/com/baidu/hugegraph/config/TypedOption.java new file mode 100644 index 0000000000..91fb7ea333 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/config/TypedOption.java @@ -0,0 +1,160 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.config; + +import java.lang.reflect.Method; +import java.util.List; +import java.util.Set; + +import org.apache.commons.configuration.PropertyConverter; +import org.slf4j.Logger; + +import com.baidu.hugegraph.util.E; +import com.baidu.hugegraph.util.Log; +import com.google.common.base.Joiner; +import com.google.common.base.Predicate; +import com.google.common.collect.ImmutableSet; + +public class TypedOption { + + private static final Logger LOG = Log.logger(TypedOption.class); + + private static final Set> ACCEPTED_DATA_TYPES; + private static final String ACCEPTED_DATA_TYPES_STRING; + + static { + ACCEPTED_DATA_TYPES = ImmutableSet.of( + Boolean.class, + Short.class, + Integer.class, + Byte.class, + Long.class, + Float.class, + Double.class, + String.class, + String[].class, + List.class + ); + + ACCEPTED_DATA_TYPES_STRING = Joiner.on(", ").join(ACCEPTED_DATA_TYPES); + } + + private final String name; + private final String desc; + private final boolean required; + private final Class dataType; + private final T defaultValue; + private final Predicate checkFunc; + + @SuppressWarnings("unchecked") + public TypedOption(String name, boolean required, String desc, + Predicate pred, Class type, T value) { + E.checkNotNull(name, "name"); + E.checkNotNull(type, "dataType"); + + this.name = name; + this.dataType = (Class) this.checkAndAssignDataType(type); + this.defaultValue = value; + this.required = required; + this.desc = desc; + this.checkFunc = pred; + + this.check(this.defaultValue); + } + + private Class checkAndAssignDataType(Class dataType) { + for (Class clazz : ACCEPTED_DATA_TYPES) { + if (clazz.isAssignableFrom(dataType)) { + return clazz; + } + } + + String msg = String.format("Input data type '%s' doesn't belong " + + "to acceptable type set: [%s]", + dataType, ACCEPTED_DATA_TYPES_STRING); + throw new IllegalArgumentException(msg); + } + + public String name() { + return this.name; + } + + public Class dataType() { + return this.dataType; + } + + public String desc() { + return this.desc; + } + + public boolean required() { + return this.required; + } + + public R defaultValue() { + return this.convert(this.defaultValue); + } + + @SuppressWarnings("unchecked") + public R convert(Object value) { + return (R) this.convert(value, this.dataType); + } + + public Object convert(Object value, Class dataType) { + if (dataType.equals(String.class)) { + return value; + } + + // Use PropertyConverter method `toXXX` convert value + String methodTo = "to" + dataType.getSimpleName(); + try { + Method method = PropertyConverter.class.getMethod( + methodTo, Object.class); + return method.invoke(null, value); + } catch (ReflectiveOperationException e) { + LOG.error("Invalid type of value '{}' for option '{}'", + value, this.name, e); + throw new ConfigException( + "Invalid type of value '%s' for option '%s', " + + "expect '%s' type", + value, this.name, dataType.getSimpleName()); + } + } + + public void check(Object value) { + E.checkNotNull(value, "value", this.name); + E.checkArgument(this.dataType.isInstance(value), + "Invalid type of value '%s' for option '%s'", + value, this.name); + if (this.checkFunc != null) { + @SuppressWarnings("unchecked") + T result = (T) value; + E.checkArgument(this.checkFunc.apply(result), + "Invalid option value for '%s': %s", + this.name, value); + } + } + + @Override + public String toString() { + return String.format("[%s]%s=%s", this.dataType.getSimpleName(), + this.name, this.defaultValue); + } +} diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 5843330cc0..55585ad67c 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.6.4"); + "1.6.5"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java b/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java index 5e23e50710..131cedc9ce 100644 --- a/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java @@ -21,6 +21,7 @@ import static com.baidu.hugegraph.config.OptionChecker.allowValues; import static com.baidu.hugegraph.config.OptionChecker.disallowEmpty; +import static com.baidu.hugegraph.config.OptionChecker.inValues; import static com.baidu.hugegraph.config.OptionChecker.nonNegativeInt; import static com.baidu.hugegraph.config.OptionChecker.positiveInt; import static com.baidu.hugegraph.config.OptionChecker.rangeDouble; @@ -33,6 +34,8 @@ import org.junit.BeforeClass; import org.junit.Test; +import com.baidu.hugegraph.config.ConfigConvOption; +import com.baidu.hugegraph.config.ConfigListConvOption; import com.baidu.hugegraph.config.ConfigListOption; import com.baidu.hugegraph.config.ConfigOption; import com.baidu.hugegraph.config.HugeConfig; @@ -102,6 +105,10 @@ public void testHugeConfig() throws Exception { Assert.assertEquals(true, config.get(TestOptions.bool)); + Assert.assertEquals(WeekDay.WEDNESDAY, config.get(TestOptions.weekday)); + Assert.assertEquals(Arrays.asList(WeekDay.SATURDAY, WeekDay.SUNDAY), + config.get(TestOptions.weekdays)); + Assert.assertEquals(Arrays.asList("list-value1", "list-value2"), config.get(TestOptions.list)); @@ -251,10 +258,30 @@ public static synchronized TestOptions instance() { true ); + public static final ConfigConvOption weekday = + new ConfigConvOption<>( + "group1.weekday", + "description of group1.weekday", + allowValues("SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", + "THURSDAY", "FRIDAY", "SATURDAY"), + WeekDay::valueOf, + "WEDNESDAY" + ); + + public static final ConfigListConvOption weekdays = + new ConfigListConvOption<>( + "group1.weekdays", + "description of group1.weekdays", + inValues("SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", + "THURSDAY", "FRIDAY", "SATURDAY"), + WeekDay::valueOf, + String.class, + "SATURDAY", "SUNDAY" + ); + public static final ConfigListOption list = new ConfigListOption<>( "group1.list", - false, "description of group1.list", disallowEmpty(), String.class, @@ -264,7 +291,6 @@ public static synchronized TestOptions instance() { public static final ConfigListOption map = new ConfigListOption<>( "group1.map", - false, "description of group1.map", disallowEmpty(), String.class, @@ -290,4 +316,9 @@ public static class TestSubOptions extends TestOptions { "textsub-value" ); } + + public enum WeekDay { + + SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY; + } } From 48a39fcef836e5735cfb8bb86a94a20b78c4f8dc Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Mon, 24 Jun 2019 15:07:56 +0800 Subject: [PATCH 101/217] improve exception message for InvocationTargetException (#28) Change-Id: Id2bb1d4b90d1f091f4949d7ba4cb6d7df9efb8b0 --- .../baidu/hugegraph/testutil/Whitebox.java | 22 ++++++++++---- .../hugegraph/testutil/WhiteboxTest.java | 30 +++++++++++++++++-- 2 files changed, 44 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java b/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java index 834d5796d5..3c171925c5 100644 --- a/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java +++ b/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java @@ -22,9 +22,11 @@ import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.util.Arrays; import java.util.Objects; import com.baidu.hugegraph.util.E; +import com.google.common.primitives.Primitives; public class Whitebox { @@ -130,7 +132,7 @@ public static T invoke(Class clazz, String methodName, int i = 0; for (Object arg : args) { E.checkArgument(arg != null, "The argument can't be null"); - classes[i++] = arg.getClass(); + classes[i++] = Primitives.unwrap(arg.getClass()); } return invoke(clazz, classes, methodName, self, args); } @@ -145,12 +147,20 @@ public static T invoke(Class clazz, Class[] classes, return result; } catch (NoSuchMethodException e) { throw new RuntimeException(String.format( - "Can't find method '%s' of class '%s'", - methodName, clazz), e); - } catch (IllegalAccessException | InvocationTargetException e) { + "Can't find method '%s' with args %s of class '%s'", + methodName, Arrays.asList(classes), clazz), e); + } catch (IllegalAccessException e) { throw new RuntimeException(String.format( - "Can't invoke method '%s' of class '%s'", - methodName, clazz), e); + "Can't invoke method '%s' of class '%s': %s", + methodName, clazz, e.getMessage()), e); + } catch (InvocationTargetException e) { + Throwable target = e.getTargetException(); + if (target instanceof RuntimeException) { + throw (RuntimeException) target; + } + throw new RuntimeException(String.format( + "Can't invoke method '%s' of class '%s': %s", + methodName, clazz, target.getMessage()), target); } } } diff --git a/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java b/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java index 9e84a592e5..f9941c4b30 100644 --- a/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java +++ b/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java @@ -101,13 +101,22 @@ public void testSetInternalState() { public void testInvokeStatic() { Assert.assertEquals(1, Whitebox.invokeStatic(Test1.class, "svalue")); Assert.assertEquals(2, Whitebox.invokeStatic(Test1.class, "svalue", 2)); - Assert.assertEquals(2, Whitebox.invokeStatic(Test1.class, "svalue", 2)); + Assert.assertEquals(2, Whitebox.invokeStatic(Test1.class, "svalue", + new Integer(2))); Assert.assertEquals(2d, Whitebox.invokeStatic(Test1.class, new Class[]{Object.class}, "svalue", 2d)); + Assert.assertThrows(RuntimeException.class, () -> { Whitebox.invokeStatic(Test1.class, "svalue2"); }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + Whitebox.invokeStatic(Test1.class, "throwfunc1"); + }); + Assert.assertThrows(RuntimeException.class, () -> { + Whitebox.invokeStatic(Test1.class, "throwfunc2"); + }); } @Test @@ -115,6 +124,8 @@ public void testInvoke() { Test1 test1 = newTest(); Assert.assertEquals(1, Whitebox.invoke(test1.getClass(), "value", test1)); + Assert.assertEquals(3, Whitebox.invoke(test1.getClass(), + "addValue", test1, 2)); Assert.assertEquals(2f, Whitebox.invoke(test1, "test2", "value")); Assert.assertEquals(2, Whitebox.invoke(test1, "test2", new Class[]{Object.class}, @@ -129,6 +140,9 @@ public void testInvoke() { Assert.assertThrows(RuntimeException.class, () -> { Whitebox.invoke(test1, "test2", "value", 2); }); + Assert.assertThrows(RuntimeException.class, () -> { + Whitebox.invoke(test1.getClass(), "addValue", test1, 2.0); + }); } private static Test1 newTest() { @@ -149,17 +163,29 @@ private int value() { return this.ivalue; } + private int addValue(int i) { + return this.ivalue + i; + } + private static int svalue() { return 1; } - private static int svalue(Integer i) { + private static int svalue(int i) { return i; } private static T svalue(T o) { return o; } + + private static int throwfunc1() { + throw new IllegalArgumentException("fake runtime exception"); + } + + private static int throwfunc2() throws Exception { + throw new Exception("fake exception"); + } } @SuppressWarnings("unused") From 85a6b7e24d6dac30781f6bf991a43b8a36e1f4aa Mon Sep 17 00:00:00 2001 From: Linary Date: Mon, 24 Jun 2019 15:18:21 +0800 Subject: [PATCH 102/217] Enhance ExecutorUtil to create ScheduledThreadPool (#29) --- pom.xml | 4 ++-- .../com/baidu/hugegraph/rest/RestClient.java | 5 +++-- .../com/baidu/hugegraph/rest/RestResult.java | 2 +- .../com/baidu/hugegraph/util/ExecutorUtil.java | 17 +++++++++++++++++ .../baidu/hugegraph/version/CommonVersion.java | 2 +- 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 13b0cd76d8..7f97011a31 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.6.5 + 1.6.6 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -212,7 +212,7 @@ - 1.6.5.0 + 1.6.6.0 diff --git a/src/main/java/com/baidu/hugegraph/rest/RestClient.java b/src/main/java/com/baidu/hugegraph/rest/RestClient.java index 63871e021e..cb66395f19 100644 --- a/src/main/java/com/baidu/hugegraph/rest/RestClient.java +++ b/src/main/java/com/baidu/hugegraph/rest/RestClient.java @@ -24,7 +24,6 @@ import java.util.Collection; import java.util.Map; import java.util.concurrent.Callable; -import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; @@ -50,6 +49,7 @@ import org.glassfish.jersey.message.GZipEncoder; import org.glassfish.jersey.uri.UriComponent; +import com.baidu.hugegraph.util.ExecutorUtil; import com.google.common.collect.ImmutableMap; public abstract class RestClient { @@ -98,7 +98,8 @@ public RestClient(String url, ClientConfig config) { this.pool = (PoolingHttpClientConnectionManager) config.getProperty(CONNECTION_MANAGER); if (this.pool != null) { - this.cleanExecutor = Executors.newScheduledThreadPool(1); + this.cleanExecutor = ExecutorUtil.newScheduledThreadPool( + "conn-clean-worker-%d"); this.cleanExecutor.scheduleWithFixedDelay(() -> { PoolStats stats = this.pool.getTotalStats(); int using = stats.getLeased() + stats.getPending(); diff --git a/src/main/java/com/baidu/hugegraph/rest/RestResult.java b/src/main/java/com/baidu/hugegraph/rest/RestResult.java index 92962eacde..e4908f8b3f 100644 --- a/src/main/java/com/baidu/hugegraph/rest/RestResult.java +++ b/src/main/java/com/baidu/hugegraph/rest/RestResult.java @@ -77,7 +77,7 @@ public List readList(String key, Class clazz) { JavaType type = mapper.getTypeFactory() .constructParametrizedType(ArrayList.class, List.class, clazz); - return mapper.readValue(element.toString(), type); + return mapper.convertValue(element, type); } catch (IOException e) { throw new SerializeException( "Failed to deserialize %s", e, this.content); diff --git a/src/main/java/com/baidu/hugegraph/util/ExecutorUtil.java b/src/main/java/com/baidu/hugegraph/util/ExecutorUtil.java index 773ec0d8dc..e30893021d 100644 --- a/src/main/java/com/baidu/hugegraph/util/ExecutorUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/ExecutorUtil.java @@ -21,16 +21,33 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ThreadFactory; import org.apache.commons.lang3.concurrent.BasicThreadFactory; public final class ExecutorUtil { + public static ExecutorService newFixedThreadPool(String name) { + return newFixedThreadPool(1, name); + } + public static ExecutorService newFixedThreadPool(int size, String name) { ThreadFactory factory = new BasicThreadFactory.Builder() .namingPattern(name) .build(); return Executors.newFixedThreadPool(size, factory); } + + public static ScheduledExecutorService newScheduledThreadPool(String name) { + return newScheduledThreadPool(1, name); + } + + public static ScheduledExecutorService newScheduledThreadPool(int size, + String name) { + ThreadFactory factory = new BasicThreadFactory.Builder() + .namingPattern(name) + .build(); + return Executors.newScheduledThreadPool(size, factory); + } } diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 55585ad67c..da9b44c593 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.6.5"); + "1.6.6"); } From b525aef0265ed27b21f7c41b781b79f52bba202e Mon Sep 17 00:00:00 2001 From: zhoney Date: Wed, 26 Jun 2019 17:56:27 +0800 Subject: [PATCH 103/217] add maxValueOf() for NumericUtil (#30) Change-Id: Ie34be6a9aa187691b004391f956891b8c55554fb --- pom.xml | 4 +-- .../com/baidu/hugegraph/util/NumericUtil.java | 20 +++++++++++++++ .../hugegraph/version/CommonVersion.java | 2 +- .../hugegraph/unit/util/NumericUtilTest.java | 25 +++++++++++++++++++ 4 files changed, 48 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 7f97011a31..41974a8fe9 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.6.6 + 1.6.7 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -212,7 +212,7 @@ - 1.6.6.0 + 1.6.7.0 diff --git a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java index f976f92c0b..1dafa8b2c7 100644 --- a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java @@ -212,6 +212,26 @@ public static Number minValueOf(Class clazz) { throw unsupportedNumberType(clazz); } + public static Number maxValueOf(Class clazz) { + E.checkArgumentNotNull(clazz, "The clazz can't be null"); + + if (Long.class.isAssignableFrom(clazz) || + Double.class.isAssignableFrom(clazz) ) { + return Long.MAX_VALUE; + } + if (Integer.class.isAssignableFrom(clazz) || + Float.class.isAssignableFrom(clazz) || + Short.class.isAssignableFrom(clazz)) { + return Integer.MAX_VALUE; + } + if (Byte.class.isAssignableFrom(clazz)) { + return Byte.MAX_VALUE; + } + + // TODO: support other number types + throw unsupportedNumberType(clazz); + } + public static byte[] longToSortableBytes(long value) { return longToBytes(value + FULL_LONG); } diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index da9b44c593..43494b52c1 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.6.6"); + "1.6.7"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java index 0a90964527..a7221b9356 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java @@ -364,6 +364,31 @@ public void testMinValueOf() { }); } + @Test + public void testMaxValueOf() { + Assert.assertEquals(Byte.MAX_VALUE, + NumericUtil.maxValueOf(Byte.class)); + + Assert.assertEquals(Integer.MAX_VALUE, + NumericUtil.maxValueOf(Short.class)); + Assert.assertEquals(Integer.MAX_VALUE, + NumericUtil.maxValueOf(Integer.class)); + Assert.assertEquals(Integer.MAX_VALUE, + NumericUtil.maxValueOf(Float.class)); + + Assert.assertEquals(Long.MAX_VALUE, + NumericUtil.maxValueOf(Long.class)); + Assert.assertEquals(Long.MAX_VALUE, + NumericUtil.maxValueOf(Double.class)); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + NumericUtil.minValueOf(null); + }); + Assert.assertThrows(IllegalArgumentException.class, () -> { + NumericUtil.minValueOf(Character.class); + }); + } + private static void assertEquals(byte[] bytes1, byte[] bytes2) { Assert.assertTrue(Bytes.toHex(bytes1) + " != " + Bytes.toHex(bytes2), Bytes.equals(bytes1, bytes2)); From 88d88382098f8b466aa30e27431193359f7befbd Mon Sep 17 00:00:00 2001 From: Linary Date: Mon, 1 Jul 2019 17:39:53 +0800 Subject: [PATCH 104/217] Support show time in readable format (#31) --- pom.xml | 4 +- .../com/baidu/hugegraph/util/StringUtil.java | 40 +++++++++++ .../com/baidu/hugegraph/util/TimeUtil.java | 13 ++++ .../hugegraph/version/CommonVersion.java | 2 +- .../unit/util/ReflectionUtilTest.java | 4 +- .../hugegraph/unit/util/StringUtilTest.java | 70 +++++++++++++++++++ .../hugegraph/unit/util/TimeUtilTest.java | 28 ++++++++ 7 files changed, 156 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/baidu/hugegraph/util/StringUtil.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/util/StringUtilTest.java diff --git a/pom.xml b/pom.xml index 41974a8fe9..aa117849af 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.6.7 + 1.6.8 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -212,7 +212,7 @@ - 1.6.7.0 + 1.6.8.0 diff --git a/src/main/java/com/baidu/hugegraph/util/StringUtil.java b/src/main/java/com/baidu/hugegraph/util/StringUtil.java new file mode 100644 index 0000000000..8a2a723786 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/util/StringUtil.java @@ -0,0 +1,40 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.util; + +import java.nio.CharBuffer; +import java.util.ArrayList; +import java.util.List; + +public final class StringUtil { + + public static List split(String line, String delimiter) { + E.checkArgument(delimiter.length() > 0, + "The delimiter can't be empty"); + List results = new ArrayList<>(); + int from = 0; + for (int to; (to = line.indexOf(delimiter, from)) >= 0; + from = to + delimiter.length()) { + results.add(CharBuffer.wrap(line, from, to)); + } + results.add(CharBuffer.wrap(line, from, line.length())); + return results; + } +} diff --git a/src/main/java/com/baidu/hugegraph/util/TimeUtil.java b/src/main/java/com/baidu/hugegraph/util/TimeUtil.java index 4845adc1ed..35696f0de1 100644 --- a/src/main/java/com/baidu/hugegraph/util/TimeUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/TimeUtil.java @@ -19,6 +19,7 @@ package com.baidu.hugegraph.util; +import java.time.Duration; import java.util.Date; public final class TimeUtil { @@ -45,4 +46,16 @@ public static long tillNextMillis(long lastTimestamp) { } return timestamp; } + + public static String readableTime(long time) { + if (time > 60 * 1000) { + // Remove the milliseconds part + time = time / 1000 * 1000; + } + Duration duration = Duration.ofMillis(time); + return duration.toString() + .substring(2) + .replaceAll("(\\d[HMS])(?!$)", "$1 ") + .toLowerCase(); + } } diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 43494b52c1..81c9333fd0 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.6.7"); + "1.6.8"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java index 5e07fe1354..79f365a1dc 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java @@ -91,7 +91,7 @@ public void testClasses() throws IOException { @SuppressWarnings("unchecked") List classes = IteratorUtils.toList(ReflectionUtil.classes( "com.baidu.hugegraph.util")); - Assert.assertEquals(14, classes.size()); + Assert.assertEquals(15, classes.size()); classes.sort((c1, c2) -> c1.getName().compareTo(c2.getName())); Assert.assertEquals("com.baidu.hugegraph.util.Bytes", classes.get(0).getName()); @@ -100,7 +100,7 @@ public void testClasses() throws IOException { Assert.assertEquals("com.baidu.hugegraph.util.CollectionUtil", classes.get(2).getName()); Assert.assertEquals("com.baidu.hugegraph.util.VersionUtil", - classes.get(13).getName()); + classes.get(14).getName()); } @Test diff --git a/src/test/java/com/baidu/hugegraph/unit/util/StringUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/StringUtilTest.java new file mode 100644 index 0000000000..2c9fd4fc47 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/util/StringUtilTest.java @@ -0,0 +1,70 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.util; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.util.StringUtil; +import com.google.common.base.Splitter; + +public class StringUtilTest { + + @Test + public void testSplit() { + Assert.assertEquals(guavaSplit("123", " "), + toStringList(StringUtil.split("123", " "))); + Assert.assertEquals(guavaSplit("1 2 3", " "), + toStringList(StringUtil.split("1 2 3", " "))); + Assert.assertEquals(guavaSplit("1:2:3", ":"), + toStringList(StringUtil.split("1:2:3", ":"))); + Assert.assertEquals(guavaSplit("1::2:3", ":"), + toStringList(StringUtil.split("1::2:3", ":"))); + Assert.assertEquals(guavaSplit("1::2::3", ":"), + toStringList(StringUtil.split("1::2::3", ":"))); + Assert.assertEquals(guavaSplit("1::2::3", "::"), + toStringList(StringUtil.split("1::2::3", "::"))); + Assert.assertEquals(guavaSplit("1:|2|:3", "|"), + toStringList(StringUtil.split("1:|2|:3", "|"))); + Assert.assertEquals(guavaSplit("1\t2\t3", "\t"), + toStringList(StringUtil.split("1\t2\t3", "\t"))); + Assert.assertEquals(guavaSplit("111", "1"), + toStringList(StringUtil.split("111", "1"))); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + StringUtil.split("123", ""); + }); + } + + private static List guavaSplit(String line, String delimiter) { + return Splitter.on(delimiter).splitToList(line); + } + + private static List toStringList(List chars) { + List results = new ArrayList<>(chars.size()); + for (CharSequence seq : chars) { + results.add(seq.toString()); + } + return results; + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/util/TimeUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/TimeUtilTest.java index 218e4dccd0..13f831af55 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/TimeUtilTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/TimeUtilTest.java @@ -60,4 +60,32 @@ public void testTillNextMillis() { Assert.assertNotEquals(lastTimestamp, time); } } + + @Test + public void testReadableTime() { + Assert.assertEquals("0.001s", TimeUtil.readableTime(1)); + Assert.assertEquals("0.999s", TimeUtil.readableTime(999)); + Assert.assertEquals("1s", TimeUtil.readableTime(1000)); + Assert.assertEquals("1.5s", TimeUtil.readableTime(1500)); + Assert.assertEquals("15s", TimeUtil.readableTime(15 * 1000)); + Assert.assertEquals("59.99s", TimeUtil.readableTime(59990)); + Assert.assertEquals("1m", TimeUtil.readableTime(60000)); + // Ignore milliseconds part + Assert.assertEquals("1m", TimeUtil.readableTime(60000 + 100)); + Assert.assertEquals("1m 1s", TimeUtil.readableTime(60000 + 1000)); + Assert.assertEquals("1m 1s", TimeUtil.readableTime(60000 + 1200)); + Assert.assertEquals("59m", TimeUtil.readableTime(59 * 60 * 1000)); + Assert.assertEquals("1h", TimeUtil.readableTime(60 * 60 * 1000)); + Assert.assertEquals("1h 1m", TimeUtil.readableTime(60 * 60 * 1000 + + 60 * 1000)); + Assert.assertEquals("23h 59m 59s", TimeUtil.readableTime( + 23 * 60 * 60 * 1000 + + 59 * 60 * 1000 + + 59 * 1000)); + Assert.assertEquals("24h", TimeUtil.readableTime(24 * 60 * 60 * 1000)); + Assert.assertEquals("25h 1m 1s", TimeUtil.readableTime( + 25 * 60 * 60 * 1000 + + 1 * 60 * 1000 + + 1 * 1200)); + } } From ce75fb96e026c57a1e1fb1de06ec7bdb7ed5423e Mon Sep 17 00:00:00 2001 From: Linary Date: Tue, 9 Jul 2019 21:12:56 +0800 Subject: [PATCH 105/217] Enhance split in StringUtil (#32) --- pom.xml | 4 +- .../com/baidu/hugegraph/util/StringUtil.java | 111 ++++++++++++++++-- .../hugegraph/version/CommonVersion.java | 2 +- .../baidu/hugegraph/unit/UnitTestSuite.java | 2 + .../hugegraph/unit/util/StringUtilTest.java | 39 +++++- 5 files changed, 136 insertions(+), 22 deletions(-) diff --git a/pom.xml b/pom.xml index aa117849af..2349b14822 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.6.8 + 1.6.9 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -212,7 +212,7 @@ - 1.6.8.0 + 1.6.9.0 diff --git a/src/main/java/com/baidu/hugegraph/util/StringUtil.java b/src/main/java/com/baidu/hugegraph/util/StringUtil.java index 8a2a723786..f7dcbb98a5 100644 --- a/src/main/java/com/baidu/hugegraph/util/StringUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/StringUtil.java @@ -19,22 +19,107 @@ package com.baidu.hugegraph.util; -import java.nio.CharBuffer; -import java.util.ArrayList; -import java.util.List; - public final class StringUtil { - public static List split(String line, String delimiter) { + public static Chars[] splitToCharsArray(String text, String delimiter) { + E.checkArgument(delimiter.length() > 0, + "The delimiter can't be empty"); + Chars[] buffer = new Chars[text.length()]; + int count = Chars.split(text, delimiter, buffer); + if (count == buffer.length) { + return buffer; + } + Chars[] result = new Chars[count]; + System.arraycopy(buffer, 0, result, 0, count); + return result; + } + + public static String[] split(String text, String delimiter) { E.checkArgument(delimiter.length() > 0, "The delimiter can't be empty"); - List results = new ArrayList<>(); - int from = 0; - for (int to; (to = line.indexOf(delimiter, from)) >= 0; - from = to + delimiter.length()) { - results.add(CharBuffer.wrap(line, from, to)); - } - results.add(CharBuffer.wrap(line, from, line.length())); - return results; + Chars[] buffer = new Chars[text.length()]; + int count = Chars.split(text, delimiter, buffer); + String[] result = new String[count]; + for (int i = 0; i < count; i++) { + result[i] = buffer[i].toString(); + } + return result; + } + + public static class Chars implements CharSequence { + + private final char[] chars; + private final int start; + private final int end; + + public Chars(char[] chars, int start, int end) { + E.checkArgument(0 < start && start < chars.length || start == 0, + "Invalid start parameter %s", start); + E.checkArgument(start <= end && end <= chars.length, + "Invalid end parameter %s", end); + this.chars = chars; + this.start = start; + this.end = end; + } + + @Override + public int length() { + return this.end - this.start; + } + + @Override + public char charAt(int index) { + return this.chars[this.start + index]; + } + + @Override + public CharSequence subSequence(int start, int end) { + return new Chars(this.chars, this.start + start, this.start + end); + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Chars)) { + return false; + } + Chars other = (Chars) object; + return this.toString().equals(other.toString()); + } + + @Override + public int hashCode() { + return this.toString().hashCode(); + } + + @Override + public String toString() { + return new String(this.chars, this.start, this.length()); + } + + public static Chars of(String string) { + return new Chars(string.toCharArray(), 0, string.length()); + } + + public static Chars[] of(String... strings) { + Chars[] results = new Chars[strings.length]; + for (int i = 0; i < strings.length; i++) { + results[i] = Chars.of(strings[i]); + } + return results; + } + + public static int split(String text, String delimiter, Chars[] buffer) { + int count = 0; + int from = 0; + char[] chars = text.toCharArray(); + for (int to; (to = text.indexOf(delimiter, from)) >= 0; + from = to + delimiter.length()) { + buffer[count++] = new Chars(chars, from, to); + } + if (from < text.length()) { + buffer[count++] = new Chars(chars, from, text.length()); + } + return count; + } } } diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 81c9333fd0..5d166370cd 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.6.8"); + "1.6.9"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java index 629e986d5b..e5f65d705e 100644 --- a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java +++ b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -43,6 +43,7 @@ import com.baidu.hugegraph.unit.util.NumericUtilTest; import com.baidu.hugegraph.unit.util.OrderLimitMapTest; import com.baidu.hugegraph.unit.util.ReflectionUtilTest; +import com.baidu.hugegraph.unit.util.StringUtilTest; import com.baidu.hugegraph.unit.util.TimeUtilTest; import com.baidu.hugegraph.unit.util.VersionUtilTest; import com.baidu.hugegraph.unit.version.VersionTest; @@ -69,6 +70,7 @@ InsertionOrderUtilTest.class, NumericUtilTest.class, ReflectionUtilTest.class, + StringUtilTest.class, TimeUtilTest.class, VersionUtilTest.class, LongEncodingTest.class, diff --git a/src/test/java/com/baidu/hugegraph/unit/util/StringUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/StringUtilTest.java index 2c9fd4fc47..f37ba41714 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/StringUtilTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/StringUtilTest.java @@ -26,12 +26,20 @@ import com.baidu.hugegraph.testutil.Assert; import com.baidu.hugegraph.util.StringUtil; +import com.baidu.hugegraph.util.StringUtil.Chars; import com.google.common.base.Splitter; public class StringUtilTest { @Test public void testSplit() { + Assert.assertArrayEquals(new String[]{"1", "2", "3"}, + StringUtil.split("1, 2, 3", ", ")); + Assert.assertArrayEquals(new String[]{"1", "1", "1"}, + StringUtil.split("1 1 1", " ")); + Assert.assertArrayEquals(new String[]{"", "", ""}, + StringUtil.split("111", "1")); + Assert.assertEquals(guavaSplit("123", " "), toStringList(StringUtil.split("123", " "))); Assert.assertEquals(guavaSplit("1 2 3", " "), @@ -48,22 +56,41 @@ public void testSplit() { toStringList(StringUtil.split("1:|2|:3", "|"))); Assert.assertEquals(guavaSplit("1\t2\t3", "\t"), toStringList(StringUtil.split("1\t2\t3", "\t"))); - Assert.assertEquals(guavaSplit("111", "1"), - toStringList(StringUtil.split("111", "1"))); Assert.assertThrows(IllegalArgumentException.class, () -> { StringUtil.split("123", ""); }); } + @Test + public void testSplitToCharsArray() { + Assert.assertArrayEquals(Chars.of("1", "2", "3"), + StringUtil.splitToCharsArray("1, 2, 3", ", ")); + Assert.assertArrayEquals(Chars.of("1", "1", "1"), + StringUtil.splitToCharsArray("1 1 1", " ")); + Assert.assertArrayEquals(Chars.of("", "", ""), + StringUtil.splitToCharsArray("111", "1")); + + Assert.assertArrayEquals(new Chars[]{Chars.of("123")}, + StringUtil.splitToCharsArray("123", " ")); + Assert.assertArrayEquals(Chars.of("1", "", "2", "3"), + StringUtil.splitToCharsArray("1::2:3", ":")); + Assert.assertArrayEquals(Chars.of("1", "", "2", "", "3"), + StringUtil.splitToCharsArray("1::2::3", ":")); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + StringUtil.splitToCharsArray("123", ""); + }); + } + private static List guavaSplit(String line, String delimiter) { return Splitter.on(delimiter).splitToList(line); } - private static List toStringList(List chars) { - List results = new ArrayList<>(chars.size()); - for (CharSequence seq : chars) { - results.add(seq.toString()); + private static List toStringList(String[] stringArray) { + List results = new ArrayList<>(stringArray.length); + for (String str : stringArray) { + results.add(str); } return results; } From 0436a145911b90c642f2cb2af20779126591ac23 Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Wed, 17 Jul 2019 21:46:50 +0800 Subject: [PATCH 106/217] add methods Bytes.contains() & Bytes.indexOf() (#33) Change-Id: I2ddca3eb233a9f9f9610850ceff3a7fadd1bb784 --- pom.xml | 4 ++-- .../java/com/baidu/hugegraph/util/Bytes.java | 18 +++++++++++++++++ .../hugegraph/version/CommonVersion.java | 2 +- .../baidu/hugegraph/unit/util/BytesTest.java | 20 +++++++++++++++++++ 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 2349b14822..fc6ac29099 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.6.9 + 1.6.10 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -212,7 +212,7 @@ - 1.6.9.0 + 1.6.10.0 diff --git a/src/main/java/com/baidu/hugegraph/util/Bytes.java b/src/main/java/com/baidu/hugegraph/util/Bytes.java index 795130b288..2743a38a18 100644 --- a/src/main/java/com/baidu/hugegraph/util/Bytes.java +++ b/src/main/java/com/baidu/hugegraph/util/Bytes.java @@ -63,6 +63,24 @@ public static boolean prefixWith(byte[] bytes, byte[] prefix) { return true; } + public static boolean contains(byte[] bytes, byte value) { + for (byte b : bytes) { + if (b == value) { + return true; + } + } + return false; + } + + public static int indexOf(byte[] bytes, byte value) { + for (int i = 0; i < bytes.length; i++) { + if (bytes[i] == value) { + return i; + } + } + return -1; + } + public static boolean equals(byte[] bytes1, byte[] bytes2) { return Arrays.equals(bytes1, bytes2); } diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 5d166370cd..a54b4186b7 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.6.9"); + "1.6.10"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/util/BytesTest.java b/src/test/java/com/baidu/hugegraph/unit/util/BytesTest.java index f09c5e1e08..bfb19ceff2 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/BytesTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/BytesTest.java @@ -117,6 +117,26 @@ public void testBytesConcat() { Bytes.concat(b(""), b("12345678"))); } + @Test + public void testBytesContains() { + Assert.assertTrue(Bytes.contains(b("1234"), (byte) '1')); + Assert.assertTrue(Bytes.contains(b("1234"), (byte) '3')); + Assert.assertTrue(Bytes.contains(b("1234"), (byte) '4')); + + Assert.assertFalse(Bytes.contains(b("1234"), (byte) '0')); + Assert.assertFalse(Bytes.contains(b(""), (byte) '0')); + } + + @Test + public void testBytesIndexOf() { + Assert.assertEquals(0, Bytes.indexOf(b("1234"), (byte) '1')); + Assert.assertEquals(2, Bytes.indexOf(b("1234"), (byte) '3')); + Assert.assertEquals(3, Bytes.indexOf(b("1234"), (byte) '4')); + + Assert.assertEquals(-1, Bytes.indexOf(b("1234"), (byte) '0')); + Assert.assertEquals(-1, Bytes.indexOf(b(""), (byte) '0')); + } + @Test public void testBytesToHex() { int value = 0x0103807f; From cc463411ea64fa91104ee2b52bf980c9fd80237a Mon Sep 17 00:00:00 2001 From: zhoney Date: Mon, 22 Jul 2019 11:17:53 +0800 Subject: [PATCH 107/217] improve LongEncoding.decodeSortable() (#34) Change-Id: I7962ffe9f55a2ef33752a414262e89d5a7918cc1 --- pom.xml | 4 ++-- .../baidu/hugegraph/util/LongEncoding.java | 14 ++++++++--- .../hugegraph/version/CommonVersion.java | 2 +- .../hugegraph/unit/util/LongEncodingTest.java | 23 +++++++++++++++++++ 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index fc6ac29099..0bb4694256 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.6.10 + 1.6.11 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -212,7 +212,7 @@ - 1.6.10.0 + 1.6.11.0 diff --git a/src/main/java/com/baidu/hugegraph/util/LongEncoding.java b/src/main/java/com/baidu/hugegraph/util/LongEncoding.java index 87b1366fa1..4456cf5174 100644 --- a/src/main/java/com/baidu/hugegraph/util/LongEncoding.java +++ b/src/main/java/com/baidu/hugegraph/util/LongEncoding.java @@ -70,11 +70,15 @@ public static long decodeSortable(String str) { E.checkArgument(str.length() >= 2, "Length of sortable encoded string must be >=2"); boolean negative = str.charAt(0) == NEG; - int prefix = 1; + int lengthPos = 0; if (negative) { - prefix = 2; + lengthPos = 1; } - String encoded = str.substring(prefix); + int length = BASE_SYMBOLS.indexOf(str.charAt(lengthPos)); + E.checkArgument(length == str.length() - lengthPos - 1, + "Can't decode illegal string '%s' with wrong length", + str); + String encoded = str.substring(lengthPos + 1); long value = decode(encoded); if (negative) { value -= FULL_LONG; @@ -82,6 +86,10 @@ public static long decodeSortable(String str) { return value; } + public static boolean validSortableChar(char c) { + return BASE_SYMBOLS.indexOf(c) != -1; + } + public static String encode(long num) { return encode(num, BASE_SYMBOLS); } diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index a54b4186b7..1a8bddea36 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.6.10"); + "1.6.11"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/util/LongEncodingTest.java b/src/test/java/com/baidu/hugegraph/unit/util/LongEncodingTest.java index 13ca425da9..3004d856cd 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/LongEncodingTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/LongEncodingTest.java @@ -278,6 +278,29 @@ public void testDecodeSortable() { Assert.assertEquals(Long.MIN_VALUE, valLongMin); } + @Test + public void testDecodeIllegalSortable() { + // Length is 1, actual length is 0 + Assert.assertThrows(IllegalArgumentException.class, () -> { + LongEncoding.decodeSortable("1"); + }); + + // Length is 1, actual length is 2 + Assert.assertThrows(IllegalArgumentException.class, () -> { + LongEncoding.decodeSortable("123"); + }); + + // Length is 1, actual length is 0 + Assert.assertThrows(IllegalArgumentException.class, () -> { + LongEncoding.decodeSortable("01"); + }); + + // Length is 1, actual length is 2 + Assert.assertThrows(IllegalArgumentException.class, () -> { + LongEncoding.decodeSortable("0123"); + }); + } + @Test public void testEncodeNumber() throws ParseException { String l1234 = LongEncoding.encodeNumber(1234); From f8e65f83bd68c0ae51cd699512167fc37cde83c8 Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Thu, 15 Aug 2019 17:20:25 +0800 Subject: [PATCH 108/217] add Bytes.toHex() method (#35) Change-Id: I613cf44728b347634bda726c3376a6fe1f4d4b2f --- .travis.yml | 2 +- pom.xml | 2 +- src/main/java/com/baidu/hugegraph/util/Bytes.java | 4 ++++ .../baidu/hugegraph/version/CommonVersion.java | 2 +- .../com/baidu/hugegraph/unit/util/BytesTest.java | 15 +++++++++++++++ 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 43fa8a0d2f..8df38075e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: java jdk: - - oraclejdk8 + - openjdk8 install: mvn compile -Dmaven.javadoc.skip=true diff --git a/pom.xml b/pom.xml index 0bb4694256..7cc353b492 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.6.11 + 1.6.12 hugegraph-common https://github.com/hugegraph/hugegraph-common diff --git a/src/main/java/com/baidu/hugegraph/util/Bytes.java b/src/main/java/com/baidu/hugegraph/util/Bytes.java index 2743a38a18..b882e3fec5 100644 --- a/src/main/java/com/baidu/hugegraph/util/Bytes.java +++ b/src/main/java/com/baidu/hugegraph/util/Bytes.java @@ -85,6 +85,10 @@ public static boolean equals(byte[] bytes1, byte[] bytes2) { return Arrays.equals(bytes1, bytes2); } + public static String toHex(byte b) { + return toHex(new byte[]{b}); + } + public static String toHex(byte[] bytes) { return new String(Hex.encodeHex(bytes)); } diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 1a8bddea36..b5c0dbeac9 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.6.11"); + "1.6.12"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/util/BytesTest.java b/src/test/java/com/baidu/hugegraph/unit/util/BytesTest.java index bfb19ceff2..c3d2cb1dd0 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/BytesTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/BytesTest.java @@ -137,6 +137,21 @@ public void testBytesIndexOf() { Assert.assertEquals(-1, Bytes.indexOf(b(""), (byte) '0')); } + @Test + public void testByteToHex() { + byte value = 0; + Assert.assertEquals("00", Bytes.toHex(value)); + + value = 127; + Assert.assertEquals("7f", Bytes.toHex(value)); + + value = -128; + Assert.assertEquals("80", Bytes.toHex(value)); + + value = -1; + Assert.assertEquals("ff", Bytes.toHex(value)); + } + @Test public void testBytesToHex() { int value = 0x0103807f; From 41bc25ce859d00d63d12127e9337550e23dfe7ba Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Thu, 5 Sep 2019 14:41:19 +0800 Subject: [PATCH 109/217] support calling superclass method for Whitebox.invoke() (#37) Change-Id: I36b460d1a95b4f063ccd329d2058e4e80ebb71c0 --- pom.xml | 4 ++-- .../baidu/hugegraph/testutil/Whitebox.java | 23 +++++++++++++++---- .../hugegraph/version/CommonVersion.java | 2 +- .../hugegraph/testutil/WhiteboxTest.java | 12 ++++++++++ 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 7cc353b492..5710de7cb9 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.6.12 + 1.6.13 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -212,7 +212,7 @@ - 1.6.11.0 + 1.6.13.0 diff --git a/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java b/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java index 3c171925c5..60938b385d 100644 --- a/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java +++ b/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java @@ -139,16 +139,12 @@ public static T invoke(Class clazz, String methodName, public static T invoke(Class clazz, Class[] classes, String methodName, Object self, Object... args) { + Method method = method(clazz, methodName, classes); try { - Method method = clazz.getDeclaredMethod(methodName, classes); method.setAccessible(true); @SuppressWarnings("unchecked") T result = (T) method.invoke(self, args); return result; - } catch (NoSuchMethodException e) { - throw new RuntimeException(String.format( - "Can't find method '%s' with args %s of class '%s'", - methodName, Arrays.asList(classes), clazz), e); } catch (IllegalAccessException e) { throw new RuntimeException(String.format( "Can't invoke method '%s' of class '%s': %s", @@ -163,4 +159,21 @@ public static T invoke(Class clazz, Class[] classes, methodName, clazz, target.getMessage()), target); } } + + public static Method method(Class clazz, String methodName, + Class[] argsClasses) { + try { + return clazz.getDeclaredMethod(methodName, argsClasses); + } catch (NoSuchMethodException e) { + Class superclass = clazz.getSuperclass(); + if (superclass != null) { + try { + return method(superclass, methodName, argsClasses); + } catch (Exception ignored){} + } + throw new RuntimeException(String.format( + "Can't find method '%s' with args %s of class '%s'", + methodName, Arrays.asList(argsClasses), clazz), e); + } + } } diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index b5c0dbeac9..d38af9c02b 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.6.12"); + "1.6.13"); } diff --git a/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java b/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java index f9941c4b30..92ab1aff12 100644 --- a/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java +++ b/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java @@ -130,6 +130,8 @@ public void testInvoke() { Assert.assertEquals(2, Whitebox.invoke(test1, "test2", new Class[]{Object.class}, "value", 2)); + Assert.assertEquals(3, Whitebox.invoke(test1, "test4", "addValue", 2)); + Assert.assertEquals(4, Whitebox.invoke(test1, "test4", "value")); Assert.assertThrows(RuntimeException.class, () -> { Whitebox.invoke(test1.getClass(), "value2", test1); @@ -149,6 +151,7 @@ private static Test1 newTest() { Test1 test1 = new Test1(); test1.test2 = new Test2(); test1.test2.test3 = new Test3(); + test1.test4 = new TestSubClass(); return test1; } @@ -158,6 +161,7 @@ private static class Test1 { private static int staticValue = 1; private int ivalue = 1; private Test2 test2; + private TestSubClass test4; private int value() { return this.ivalue; @@ -213,4 +217,12 @@ private String value() { return this.str; } } + + @SuppressWarnings("unused") + private static class TestSubClass extends Test1 { + + private int value() { + return 4; + } + } } From 0ff4b0e23437c24b99863ced9d39d00206cf87f7 Mon Sep 17 00:00:00 2001 From: Linary Date: Fri, 6 Sep 2019 10:14:23 +0800 Subject: [PATCH 110/217] Extract license common structures (#36) --- pom.xml | 10 +- .../license/CommonLicenseManager.java | 130 ++++++++ .../baidu/hugegraph/license/ExtraParam.java | 88 ++++++ .../hugegraph/license/FileKeyStoreParam.java | 68 ++++ .../hugegraph/license/LicenseCreateParam.java | 125 ++++++++ .../hugegraph/license/LicenseVerifyParam.java | 60 ++++ .../baidu/hugegraph/license/MachineInfo.java | 128 ++++++++ .../hugegraph/version/CommonVersion.java | 2 +- .../baidu/hugegraph/unit/UnitTestSuite.java | 11 + .../unit/license/ExtraParamTest.java | 57 ++++ .../unit/license/LicenseCreateParamTest.java | 101 ++++++ .../unit/license/LicenseManagerTest.java | 297 ++++++++++++++++++ .../unit/license/LicenseVerifyParamTest.java | 51 +++ .../unit/license/MachineInfoTest.java | 89 ++++++ src/test/resources/create-license.json | 19 ++ .../resources/hugegraph-evaluation.license | Bin 0 -> 720 bytes src/test/resources/log4j2.xml | 26 ++ src/test/resources/privateKeys.store | Bin 0 -> 1281 bytes src/test/resources/publicCerts.store | Bin 0 -> 874 bytes src/test/resources/verify-license.json | 7 + 20 files changed, 1266 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/baidu/hugegraph/license/CommonLicenseManager.java create mode 100644 src/main/java/com/baidu/hugegraph/license/ExtraParam.java create mode 100755 src/main/java/com/baidu/hugegraph/license/FileKeyStoreParam.java create mode 100644 src/main/java/com/baidu/hugegraph/license/LicenseCreateParam.java create mode 100644 src/main/java/com/baidu/hugegraph/license/LicenseVerifyParam.java create mode 100755 src/main/java/com/baidu/hugegraph/license/MachineInfo.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/license/ExtraParamTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/license/LicenseManagerTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/license/LicenseVerifyParamTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/license/MachineInfoTest.java create mode 100644 src/test/resources/create-license.json create mode 100644 src/test/resources/hugegraph-evaluation.license create mode 100644 src/test/resources/log4j2.xml create mode 100644 src/test/resources/privateKeys.store create mode 100644 src/test/resources/publicCerts.store create mode 100644 src/test/resources/verify-license.json diff --git a/pom.xml b/pom.xml index 5710de7cb9..2e8d3524d8 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.6.13 + 1.6.14 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -175,6 +175,12 @@ jersey-hk2 ${jersey.hk2.version} + + + de.schlichtherle.truelicense + truelicense-core + 1.33 + @@ -212,7 +218,7 @@ - 1.6.13.0 + 1.6.14.0 diff --git a/src/main/java/com/baidu/hugegraph/license/CommonLicenseManager.java b/src/main/java/com/baidu/hugegraph/license/CommonLicenseManager.java new file mode 100644 index 0000000000..ede39d0764 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/license/CommonLicenseManager.java @@ -0,0 +1,130 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.license; + +import java.beans.XMLDecoder; +import java.io.BufferedInputStream; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; + +import org.slf4j.Logger; + +import com.baidu.hugegraph.util.Log; + +import de.schlichtherle.license.LicenseContent; +import de.schlichtherle.license.LicenseContentException; +import de.schlichtherle.license.LicenseManager; +import de.schlichtherle.license.LicenseNotary; +import de.schlichtherle.license.LicenseParam; +import de.schlichtherle.license.NoLicenseInstalledException; +import de.schlichtherle.xml.GenericCertificate; + +public class CommonLicenseManager extends LicenseManager { + + private static final Logger LOG = Log.logger(CommonLicenseManager.class); + + private static final String CHARSET = "UTF-8"; + private static final int BUF_SIZE = 8 * 1024; + + public CommonLicenseManager(LicenseParam param) { + super(param); + } + + @Override + protected synchronized byte[] create(LicenseContent content, + LicenseNotary notary) + throws Exception { + super.initialize(content); + this.validateCreate(content); + GenericCertificate certificate = notary.sign(content); + return super.getPrivacyGuard().cert2key(certificate); + } + + @Override + protected synchronized LicenseContent install(byte[] key, + LicenseNotary notary) + throws Exception { + GenericCertificate certificate = super.getPrivacyGuard().key2cert(key); + notary.verify(certificate); + String encodedText = certificate.getEncoded(); + LicenseContent content = (LicenseContent) this.load(encodedText); + this.validate(content); + super.setLicenseKey(key); + super.setCertificate(certificate); + return content; + } + + @Override + protected synchronized LicenseContent verify(LicenseNotary notary) + throws Exception { + // Load license key from preferences + byte[] key = super.getLicenseKey(); + if (key == null) { + String subject = super.getLicenseParam().getSubject(); + throw new NoLicenseInstalledException(subject); + } + + GenericCertificate certificate = super.getPrivacyGuard().key2cert(key); + notary.verify(certificate); + String encodedText = certificate.getEncoded(); + LicenseContent content = (LicenseContent) this.load(encodedText); + this.validate(content); + super.setCertificate(certificate); + return content; + } + + @Override + protected synchronized void validate(LicenseContent content) + throws LicenseContentException { + // Call super validate, expected to be overwritten + super.validate(content); + } + + protected synchronized void validateCreate(LicenseContent content) + throws LicenseContentException { + // Just call super validate is ok + super.validate(content); + } + + private Object load(String text) throws Exception { + InputStream bis = null; + XMLDecoder decoder = null; + try { + bis = new ByteArrayInputStream(text.getBytes(CHARSET)); + decoder = new XMLDecoder(new BufferedInputStream(bis, BUF_SIZE)); + return decoder.readObject(); + } catch (UnsupportedEncodingException e) { + throw new LicenseContentException(String.format( + "Unsupported charset: %s", CHARSET)); + } finally { + if (decoder != null) { + decoder.close(); + } + try { + if (bis != null) { + bis.close(); + } + } catch (Exception e) { + LOG.warn("Failed to close stream", e); + } + } + } +} diff --git a/src/main/java/com/baidu/hugegraph/license/ExtraParam.java b/src/main/java/com/baidu/hugegraph/license/ExtraParam.java new file mode 100644 index 0000000000..43f6d05121 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/license/ExtraParam.java @@ -0,0 +1,88 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.license; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ExtraParam { + + @JsonProperty("id") + private String id; + + @JsonProperty("version") + private String version; + + @JsonProperty("graphs") + private int graphs; + + @JsonProperty("ip") + private String ip; + + @JsonProperty("mac") + private String mac; + + @JsonProperty("cpus") + private int cpus; + + @JsonProperty("ram") + private int ram; + + @JsonProperty("threads") + private int threads; + + @JsonProperty("memory") + private int memory; + + public String id() { + return this.id; + } + + public String version() { + return this.version; + } + + public int graphs() { + return this.graphs; + } + + public String ip() { + return this.ip; + } + + public String mac() { + return this.mac; + } + + public int cpus() { + return this.cpus; + } + + public int ram() { + return this.ram; + } + + public int threads() { + return this.threads; + } + + public int memory() { + return this.memory; + } +} diff --git a/src/main/java/com/baidu/hugegraph/license/FileKeyStoreParam.java b/src/main/java/com/baidu/hugegraph/license/FileKeyStoreParam.java new file mode 100755 index 0000000000..919cc23745 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/license/FileKeyStoreParam.java @@ -0,0 +1,68 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.license; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; + +import de.schlichtherle.license.AbstractKeyStoreParam; + +/** + * Custom KeyStoreParam to store public and private key storage files to + * other disk locations instead of projects + */ +public class FileKeyStoreParam extends AbstractKeyStoreParam { + + private String storePath; + private String alias; + private String keyPwd; + private String storePwd; + + public FileKeyStoreParam(Class clazz, String resource, String alias, + String storePwd, String keyPwd) { + super(clazz, resource); + this.storePath = resource; + this.alias = alias; + this.storePwd = storePwd; + this.keyPwd = keyPwd; + } + + @Override + public String getAlias() { + return this.alias; + } + + @Override + public String getStorePwd() { + return this.storePwd; + } + + @Override + public String getKeyPwd() { + return this.keyPwd; + } + + @Override + public InputStream getStream() throws IOException { + return new FileInputStream(new File(this.storePath)); + } +} diff --git a/src/main/java/com/baidu/hugegraph/license/LicenseCreateParam.java b/src/main/java/com/baidu/hugegraph/license/LicenseCreateParam.java new file mode 100644 index 0000000000..00f0bdc96f --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/license/LicenseCreateParam.java @@ -0,0 +1,125 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.license; + +import java.util.Date; +import java.util.List; + +import org.apache.commons.lang3.time.DateUtils; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class LicenseCreateParam { + + @JsonProperty("subject") + private String subject; + + @JsonProperty("private_alias") + private String privateAlias; + + @JsonProperty("key_password") + private String keyPassword; + + @JsonProperty("store_password") + private String storePassword; + + @JsonProperty("privatekey_path") + private String privateKeyPath; + + @JsonProperty("license_path") + private String licensePath; + + @JsonProperty("issued_time") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date issuedTime = new Date(); + + @JsonProperty("not_before") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date notBefore = this.issuedTime; + + @JsonProperty("not_after") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date notAfter = DateUtils.addDays(this.notBefore, 30); + + @JsonProperty("consumer_type") + private String consumerType = "user"; + + @JsonProperty("consumer_amount") + private Integer consumerAmount = 1; + + @JsonProperty("description") + private String description = ""; + + @JsonProperty("extra_params") + private List extraParams; + + public String subject() { + return this.subject; + } + + public String privateAlias() { + return this.privateAlias; + } + + public String keyPassword() { + return this.keyPassword; + } + + public String storePassword() { + return this.storePassword; + } + + public String privateKeyPath() { + return this.privateKeyPath; + } + + public String licensePath() { + return this.licensePath; + } + + public Date issuedTime() { + return this.issuedTime; + } + + public Date notBefore() { + return this.notBefore; + } + + public Date notAfter() { + return this.notAfter; + } + + public String consumerType() { + return this.consumerType; + } + + public Integer consumerAmount() { + return this.consumerAmount; + } + + public String description() { + return this.description; + } + + public List extraParams() { + return this.extraParams; + } +} diff --git a/src/main/java/com/baidu/hugegraph/license/LicenseVerifyParam.java b/src/main/java/com/baidu/hugegraph/license/LicenseVerifyParam.java new file mode 100644 index 0000000000..f2359bffde --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/license/LicenseVerifyParam.java @@ -0,0 +1,60 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.license; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class LicenseVerifyParam { + + @JsonProperty("subject") + private String subject; + + @JsonProperty("public_alias") + private String publicAlias; + + @JsonProperty("store_password") + private String storePassword; + + @JsonProperty("publickey_path") + private String publicKeyPath; + + @JsonProperty("license_path") + private String licensePath; + + public String subject() { + return this.subject; + } + + public String publicAlias() { + return this.publicAlias; + } + + public String storePassword() { + return this.storePassword; + } + + public String licensePath() { + return this.licensePath; + } + + public String publicKeyPath() { + return this.publicKeyPath; + } +} diff --git a/src/main/java/com/baidu/hugegraph/license/MachineInfo.java b/src/main/java/com/baidu/hugegraph/license/MachineInfo.java new file mode 100755 index 0000000000..eccc7bb7ec --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/license/MachineInfo.java @@ -0,0 +1,128 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.license; + +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.net.SocketException; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +public class MachineInfo { + + private List ipAddressList; + private List macAddressList; + + public MachineInfo() { + this.ipAddressList = null; + this.macAddressList = null; + } + + public List getIpAddress() { + if (this.ipAddressList != null) { + return this.ipAddressList; + } + this.ipAddressList = new ArrayList<>(); + List inetAddresses = this.getLocalAllInetAddress(); + if (inetAddresses != null && !inetAddresses.isEmpty()) { + this.ipAddressList = inetAddresses.stream() + .map(InetAddress::getHostAddress) + .distinct() + .map(String::toLowerCase) + .collect(Collectors.toList()); + } + return this.ipAddressList; + } + + public List getMacAddress() { + if (this.macAddressList != null) { + return this.macAddressList; + } + this.macAddressList = new ArrayList<>(); + List inetAddresses = this.getLocalAllInetAddress(); + if (inetAddresses != null && !inetAddresses.isEmpty()) { + // Get the Mac address of all network interfaces + List list = new ArrayList<>(); + Set uniqueValues = new HashSet<>(); + for (InetAddress inetAddress : inetAddresses) { + String macByInetAddress = this.getMacByInetAddress(inetAddress); + if (uniqueValues.add(macByInetAddress)) { + list.add(macByInetAddress); + } + } + this.macAddressList = list; + } + return this.macAddressList; + } + + public List getLocalAllInetAddress() { + Enumeration interfaces; + try { + interfaces = NetworkInterface.getNetworkInterfaces(); + } catch (SocketException e) { + throw new RuntimeException("Failed to get network interfaces"); + } + + List result = new ArrayList<>(); + while (interfaces.hasMoreElements()) { + NetworkInterface iface = (NetworkInterface) interfaces.nextElement(); + for (Enumeration inetAddresses = iface.getInetAddresses(); + inetAddresses.hasMoreElements(); ) { + InetAddress inetAddr = (InetAddress) inetAddresses.nextElement(); + if (!inetAddr.isLoopbackAddress() && + !inetAddr.isLinkLocalAddress() && + !inetAddr.isMulticastAddress()) { + result.add(inetAddr); + } + } + } + return result; + } + + public String getMacByInetAddress(InetAddress inetAddr) { + byte[] mac; + try { + mac = NetworkInterface.getByInetAddress(inetAddr) + .getHardwareAddress(); + } catch (Exception e) { + throw new RuntimeException(String.format( + "Failed to get mac address for inet address '%s'", + inetAddr)); + } + + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < mac.length; i++) { + if (i != 0) { + sb.append("-"); + } + String temp = Integer.toHexString(mac[i] & 0xff); + if (temp.length() == 1) { + sb.append("0").append(temp); + } else { + sb.append(temp); + } + } + return sb.toString().toUpperCase(); + } +} diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index d38af9c02b..92c5f2759f 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.6.13"); + "1.6.14"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java index e5f65d705e..6131b33cb1 100644 --- a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java +++ b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -32,6 +32,11 @@ import com.baidu.hugegraph.unit.iterator.FlatMapperFilterIteratorTest; import com.baidu.hugegraph.unit.iterator.FlatMapperIteratorTest; import com.baidu.hugegraph.unit.iterator.MapperIteratorTest; +import com.baidu.hugegraph.unit.license.ExtraParamTest; +import com.baidu.hugegraph.unit.license.LicenseCreateParamTest; +import com.baidu.hugegraph.unit.license.LicenseManagerTest; +import com.baidu.hugegraph.unit.license.LicenseVerifyParamTest; +import com.baidu.hugegraph.unit.license.MachineInfoTest; import com.baidu.hugegraph.unit.perf.PerfUtilTest; import com.baidu.hugegraph.unit.rest.RestClientTest; import com.baidu.hugegraph.unit.rest.RestResultTest; @@ -76,6 +81,12 @@ LongEncodingTest.class, OrderLimitMapTest.class, + ExtraParamTest.class, + LicenseCreateParamTest.class, + LicenseVerifyParamTest.class, + MachineInfoTest.class, + LicenseManagerTest.class, + AssertTest.class, WhiteboxTest.class }) diff --git a/src/test/java/com/baidu/hugegraph/unit/license/ExtraParamTest.java b/src/test/java/com/baidu/hugegraph/unit/license/ExtraParamTest.java new file mode 100644 index 0000000000..0e0cc22c9e --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/license/ExtraParamTest.java @@ -0,0 +1,57 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.license; + +import java.io.IOException; + +import org.junit.Test; + +import com.baidu.hugegraph.license.ExtraParam; +import com.baidu.hugegraph.testutil.Assert; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class ExtraParamTest { + + @Test + public void testDeserializeExtraParam() throws IOException { + String json = "{" + + "\"id\":\"server-1\"," + + "\"version\":\"0.10.2\"," + + "\"graphs\":3," + + "\"ip\":\"127.0.0.1\"," + + "\"mac\":\"00-01-6C-06-A6-29\"," + + "\"cpus\":32," + + "\"ram\":65536," + + "\"threads\":96," + + "\"memory\":32768" + + "}"; + ObjectMapper mapper = new ObjectMapper(); + ExtraParam param = mapper.readValue(json, ExtraParam.class); + Assert.assertEquals("server-1", param.id()); + Assert.assertEquals("0.10.2", param.version()); + Assert.assertEquals(3, param.graphs()); + Assert.assertEquals("127.0.0.1", param.ip()); + Assert.assertEquals("00-01-6C-06-A6-29", param.mac()); + Assert.assertEquals(32, param.cpus()); + Assert.assertEquals(65536, param.ram()); + Assert.assertEquals(96, param.threads()); + Assert.assertEquals(32768, param.memory()); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java b/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java new file mode 100644 index 0000000000..cc9ddaafc4 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java @@ -0,0 +1,101 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.license; + +import java.io.IOException; +import java.text.DateFormat; +import java.text.ParseException; +import java.util.TimeZone; + +import org.junit.Test; + +import com.baidu.hugegraph.date.SafeDateFormat; +import com.baidu.hugegraph.license.LicenseCreateParam; +import com.baidu.hugegraph.testutil.Assert; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class LicenseCreateParamTest { + + @Test + public void testDeserializeLicenseCreateParam() + throws IOException, ParseException { + String json = "{" + + "\"subject\":\"hugegraph-evaluation\"," + + "\"private_alias\":\"privatekey\"," + + "\"key_password\":\"123456\"," + + "\"store_password\":\"123456\"," + + "\"privatekey_path\":\"./privateKeys.store\"," + + "\"license_path\":\"./hugegraph-evaluation.license\"," + + "\"issued_time\":\"2019-08-10 00:00:00\"," + + "\"not_before\":\"2019-08-10 00:00:00\"," + + "\"not_after\":\"2020-08-10 00:00:00\"," + + "\"consumer_type\":\"user\"," + + "\"consumer_amount\":1," + + "\"description\":\"hugegraph license\"," + + "\"extra_params\":[" + + "{" + + "\"id\":\"server-1\"," + + "\"version\":\"0.9.2\"," + + "\"graphs\":3," + + "\"ip\":\"127.0.0.1\"," + + "\"mac\":\"00-01-6C-06-A6-29\"," + + "\"cpus\":32," + + "\"ram\":65536," + + "\"threads\":96," + + "\"memory\":32768" + + "}," + + "{" + + "\"id\":\"server-2\"," + + "\"version\":\"0.10.2\"," + + "\"graphs\":3," + + "\"ip\":\"127.0.0.1\"," + + "\"mac\":\"00-02-6C-06-A6-29\"," + + "\"cpus\":64," + + "\"ram\":65536," + + "\"threads\":96," + + "\"memory\":65536" + + "}" + + "]" + + "}"; + ObjectMapper mapper = new ObjectMapper(); + LicenseCreateParam param = mapper.readValue(json, + LicenseCreateParam.class); + Assert.assertEquals("hugegraph-evaluation", param.subject()); + Assert.assertEquals("privatekey", param.privateAlias()); + Assert.assertEquals("123456", param.keyPassword()); + Assert.assertEquals("123456", param.storePassword()); + Assert.assertEquals("./privateKeys.store", param.privateKeyPath()); + Assert.assertEquals("./hugegraph-evaluation.license", + param.licensePath()); + + DateFormat df = new SafeDateFormat("yyyy-MM-dd HH:mm:ss"); + df.setTimeZone(TimeZone.getTimeZone("GMT+08:00")); + Assert.assertEquals(df.parse("2019-08-10 00:00:00"), + param.issuedTime()); + Assert.assertEquals(df.parse("2019-08-10 00:00:00"), + param.notBefore()); + Assert.assertEquals(df.parse("2020-08-10 00:00:00"), + param.notAfter()); + Assert.assertEquals("user", param.consumerType()); + Assert.assertEquals(1, param.consumerAmount()); + Assert.assertEquals("hugegraph license", param.description()); + Assert.assertEquals(2, param.extraParams().size()); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/license/LicenseManagerTest.java b/src/test/java/com/baidu/hugegraph/unit/license/LicenseManagerTest.java new file mode 100644 index 0000000000..65f6e03b6d --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/license/LicenseManagerTest.java @@ -0,0 +1,297 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.license; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.Charset; +import java.util.List; +import java.util.prefs.Preferences; + +import javax.security.auth.x500.X500Principal; + +import org.apache.commons.codec.Charsets; +import org.apache.commons.io.FileUtils; +import org.junit.Test; + +import com.baidu.hugegraph.license.CommonLicenseManager; +import com.baidu.hugegraph.license.ExtraParam; +import com.baidu.hugegraph.license.FileKeyStoreParam; +import com.baidu.hugegraph.license.LicenseCreateParam; +import com.baidu.hugegraph.license.LicenseVerifyParam; +import com.baidu.hugegraph.testutil.Assert; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +import de.schlichtherle.license.CipherParam; +import de.schlichtherle.license.DefaultCipherParam; +import de.schlichtherle.license.DefaultLicenseParam; +import de.schlichtherle.license.KeyStoreParam; +import de.schlichtherle.license.LicenseContent; +import de.schlichtherle.license.LicenseContentException; +import de.schlichtherle.license.LicenseManager; +import de.schlichtherle.license.LicenseParam; +import de.schlichtherle.license.NoLicenseInstalledException; + +public class LicenseManagerTest { + + private static final Charset CHARSET = Charsets.UTF_8; + private static final ObjectMapper MAPPER = new ObjectMapper(); + + @Test + public void testCreateInstallVerifyLicense() throws IOException { + String createConfigPath = "src/test/resources/create-license.json"; + LicenseCreator creator = LicenseCreator.build(createConfigPath); + creator.create(); + + String verifyConfigPath = "src/test/resources/verify-license.json"; + LicenseVerifier verifier = LicenseVerifier.build(verifyConfigPath); + verifier.install(); + verifier.verify(); + } + + @Test + public void testCreateVerifyLicenseWithoutInstall() throws IOException { + String createConfigPath = "src/test/resources/create-license.json"; + LicenseCreator creator = LicenseCreator.build(createConfigPath); + creator.create(); + + String verifyConfigPath = "src/test/resources/verify-license.json"; + LicenseVerifier verifier = LicenseVerifier.build(verifyConfigPath); + verifier.uninstall(); + Assert.assertThrows(RuntimeException.class, () -> { + verifier.verify(); + }, e -> { + Assert.assertEquals(NoLicenseInstalledException.class, + e.getCause().getClass()); + }); + } + + private static class LicenseCreator { + + private static final X500Principal DEFAULT_ISSUER = new X500Principal( + "CN=localhost, OU=localhost, O=localhost, L=SH, ST=SH, C=CN"); + + private final LicenseCreateParam param; + + public LicenseCreator(LicenseCreateParam param) { + this.param = param; + } + + public static LicenseCreator build(String path) throws IOException { + File file = FileUtils.getFile(path); + String json; + try { + json = FileUtils.readFileToString(file, CHARSET); + } catch (IOException e) { + throw new RuntimeException(String.format( + "Failed to read file '%s'", path)); + } + LicenseCreateParam param = MAPPER.readValue( + json, LicenseCreateParam.class); + return new LicenseCreator(param); + } + + public void create(){ + try { + LicenseParam licenseParam = this.initLicenseParam(); + LicenseManager manager = new LicenseCreateManager(licenseParam); + LicenseContent licenseContent = this.initLicenseContent(); + File licenseFile = new File(this.param.licensePath()); + manager.store(licenseContent, licenseFile); + } catch (Exception e){ + throw new RuntimeException("Generate license failed", e); + } + } + + private LicenseParam initLicenseParam(){ + Preferences preferences = Preferences.userNodeForPackage( + LicenseCreator.class); + CipherParam cipherParam = new DefaultCipherParam( + this.param.storePassword()); + KeyStoreParam keyStoreParam; + keyStoreParam = new FileKeyStoreParam(LicenseCreator.class, + this.param.privateKeyPath(), + this.param.privateAlias(), + this.param.storePassword(), + this.param.keyPassword()); + return new DefaultLicenseParam(this.param.subject(), preferences, + keyStoreParam, cipherParam); + } + + private LicenseContent initLicenseContent(){ + LicenseContent content = new LicenseContent(); + content.setHolder(DEFAULT_ISSUER); + content.setIssuer(DEFAULT_ISSUER); + content.setSubject(this.param.subject()); + content.setIssued(this.param.issuedTime()); + content.setNotBefore(this.param.notBefore()); + content.setNotAfter(this.param.notAfter()); + content.setConsumerType(this.param.consumerType()); + content.setConsumerAmount(this.param.consumerAmount()); + content.setInfo(this.param.description()); + // Customized verification params + String json; + try { + json = MAPPER.writeValueAsString(this.param.extraParams()); + } catch (JsonProcessingException e) { + throw new RuntimeException("Failed to write extra params", e); + } + content.setExtra(json); + return content; + } + } + + private static class LicenseCreateManager extends CommonLicenseManager { + + public LicenseCreateManager(LicenseParam param) { + super(param); + } + + @Override + protected synchronized void validateCreate(LicenseContent content) + throws LicenseContentException { + super.validateCreate(content); + } + } + + private static class LicenseVerifier { + + private final LicenseVerifyParam param; + private final LicenseVerifyManager manager; + + public LicenseVerifier(LicenseVerifyParam param) { + this.param = param; + LicenseParam licenseParam = this.initLicenseParam(param); + this.manager = new LicenseVerifyManager(licenseParam); + } + + public static LicenseVerifier build(String path) throws IOException { + File file = FileUtils.getFile(path); + String json; + try { + json = FileUtils.readFileToString(file, CHARSET); + } catch (IOException e) { + throw new RuntimeException(String.format( + "Failed to read file '%s'", path)); + } + LicenseVerifyParam param = MAPPER.readValue( + json, LicenseVerifyParam.class); + return new LicenseVerifier(param); + } + + public synchronized void install() { + try { + this.manager.uninstall(); + File licenseFile = new File(this.param.licensePath()); + this.manager.install(licenseFile); + } catch (Exception e) { + throw new RuntimeException("Failed to install license", e); + } + } + + public synchronized void uninstall() { + try { + this.manager.uninstall(); + } catch (Exception e) { + throw new RuntimeException("Failed to uninstall license", e); + } + } + + public void verify() { + try { + this.manager.verify(); + } catch (Exception e) { + throw new RuntimeException("The license verify failed", e); + } + } + + private LicenseParam initLicenseParam(LicenseVerifyParam param) { + Preferences preferences = Preferences.userNodeForPackage( + LicenseVerifier.class); + CipherParam cipherParam = new DefaultCipherParam( + param.storePassword()); + KeyStoreParam keyStoreParam = new FileKeyStoreParam( + LicenseVerifier.class, + param.publicKeyPath(), + param.publicAlias(), + param.storePassword(), + null); + return new DefaultLicenseParam(param.subject(), preferences, + keyStoreParam, cipherParam); + } + } + + private static class LicenseVerifyManager extends CommonLicenseManager { + + private final String serverId = "server-1"; + + public LicenseVerifyManager(LicenseParam param) { + super(param); + } + + @Override + protected synchronized void validate(LicenseContent content) + throws LicenseContentException { + // Call super validate firstly, will verify expired + super.validate(content); + + // Verify the customized license parameters + String extra = (String) content.getExtra(); + List extraParams; + try { + TypeReference type = new TypeReference>() {}; + extraParams = MAPPER.readValue(extra, type); + } catch (IOException e) { + throw new RuntimeException("Failed to read extra params", e); + } + ExtraParam param = this.matchParam(this.serverId, extraParams); + if (param == null) { + throw newLicenseException("The current server's id '%s' " + + "is not authorized"); + } + if (this.usingGraphs() > param.graphs()) { + throw newLicenseException("The using graphs exceeded '%s'" + + "authorized limit '%s'", + this.usingGraphs(), param.graphs()); + } + } + + private int usingGraphs() { + // Assume + return 2; + } + + private ExtraParam matchParam(String id, List extraParams) { + for (ExtraParam param : extraParams) { + if (param.id().equals(id)) { + return param; + } + } + return null; + } + + private LicenseContentException newLicenseException(String message, + Object... args) { + return new LicenseContentException(String.format(message, args)); + } + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/license/LicenseVerifyParamTest.java b/src/test/java/com/baidu/hugegraph/unit/license/LicenseVerifyParamTest.java new file mode 100644 index 0000000000..f1126ce771 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/license/LicenseVerifyParamTest.java @@ -0,0 +1,51 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.license; + +import java.io.IOException; + +import org.junit.Test; + +import com.baidu.hugegraph.license.LicenseVerifyParam; +import com.baidu.hugegraph.testutil.Assert; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class LicenseVerifyParamTest { + + @Test + public void testDeserializeLicenseVerifyParam() throws IOException { + String json = "{" + + "\"subject\":\"hugegraph-evaluation\"," + + "\"public_alias\":\"publiccert\"," + + "\"store_password\":\"123456\"," + + "\"publickey_path\":\"./publicCerts.store\"," + + "\"license_path\":\"./hugegraph-evaluation.license\"" + + "}"; + ObjectMapper mapper = new ObjectMapper(); + LicenseVerifyParam param = mapper.readValue(json, + LicenseVerifyParam.class); + Assert.assertEquals("hugegraph-evaluation", param.subject()); + Assert.assertEquals("publiccert", param.publicAlias()); + Assert.assertEquals("123456", param.storePassword()); + Assert.assertEquals("./publicCerts.store", param.publicKeyPath()); + Assert.assertEquals("./hugegraph-evaluation.license", + param.licensePath()); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/license/MachineInfoTest.java b/src/test/java/com/baidu/hugegraph/unit/license/MachineInfoTest.java new file mode 100644 index 0000000000..c436943e98 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/license/MachineInfoTest.java @@ -0,0 +1,89 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.license; + +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.List; +import java.util.regex.Pattern; + +import org.junit.Test; + +import com.baidu.hugegraph.license.MachineInfo; +import com.baidu.hugegraph.testutil.Assert; + +public class MachineInfoTest { + + private static final Pattern IPV4_PATTERN = Pattern.compile( + "^(([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.){3}" + + "([01]?\\d\\d?|2[0-4]\\d|25[0-5])$" + ); + private static final Pattern IPV6_PATTERN = Pattern.compile( + "^(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$" + ); + + private static final Pattern MAC_PATTERN = Pattern.compile( + "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$" + ); + + private static final MachineInfo machineInfo = new MachineInfo(); + + @Test + public void testGetIpAddressList() { + List ipAddressList = machineInfo.getIpAddress(); + for (String ip : ipAddressList) { + Assert.assertTrue(IPV4_PATTERN.matcher(ip).matches() || + IPV6_PATTERN.matcher(ip).matches()); + } + Assert.assertEquals(ipAddressList, machineInfo.getIpAddress()); + } + + @Test + public void testGetMacAddressList() { + List macAddressList = machineInfo.getMacAddress(); + for (String mac : macAddressList) { + Assert.assertTrue(MAC_PATTERN.matcher(mac).matches()); + } + Assert.assertEquals(macAddressList, machineInfo.getMacAddress()); + } + + @Test + public void testGetLocalAllInetAddress() { + List addressList = machineInfo.getLocalAllInetAddress(); + for (InetAddress address : addressList) { + String ip = address.getHostAddress(); + Assert.assertTrue(IPV4_PATTERN.matcher(ip).matches() || + IPV6_PATTERN.matcher(ip).matches()); + } + } + + @Test + public void testGetMacByInetAddress() throws UnknownHostException { + List addressList = machineInfo.getLocalAllInetAddress(); + for (InetAddress address : addressList) { + String mac = machineInfo.getMacByInetAddress(address); + Assert.assertTrue(MAC_PATTERN.matcher(mac).matches()); + } + InetAddress address = InetAddress.getByAddress(new byte[]{0, 0, 0, 0}); + Assert.assertThrows(RuntimeException.class, () -> { + machineInfo.getMacByInetAddress(address); + }); + } +} diff --git a/src/test/resources/create-license.json b/src/test/resources/create-license.json new file mode 100644 index 0000000000..26b3bd501e --- /dev/null +++ b/src/test/resources/create-license.json @@ -0,0 +1,19 @@ +{ + "subject": "hugegraph-evaluation", + "private_alias": "privatekey", + "key_password": "private_password123456", + "store_password": "public_password123456", + "privatekey_path": "src/test/resources/privateKeys.store", + "license_path": "src/test/resources/hugegraph-evaluation.license", + "issued_time": "2019-08-01 00:00:00", + "not_before": "2019-08-01 00:00:00", + "not_after": "2029-08-01 00:00:00", + "consumer_type": "user", + "consumer_amount": 1, + "extra_params": [ + { + "id": "server-1", + "graphs": 3 + } + ] +} diff --git a/src/test/resources/hugegraph-evaluation.license b/src/test/resources/hugegraph-evaluation.license new file mode 100644 index 0000000000000000000000000000000000000000..d09b0b93080c1ff1e4119fa992d7e6159b433c7f GIT binary patch literal 720 zcmV;>0x$hH)?*-Kt3h!0TQ^N)<5Q3;p2}q@scvSWl_?9>BlvjlCtm8;URYGKM~Bhd zxt%4=9OPbKS1l?PpcH|hrbGyde+x6yY_s-2=xpl~U$82Q0N~;uH~IXciJI7izDhnD z=0c%pF2ib#-Eotoof2gNBxk^+P%<^u5X-st3{_hcikb6*ij{X714{~0b|xDISV-Dho0Wngtf#g0zW&0WVJ$fMGY)q|=T0cK>m(KfN3h9Zr*D43Sb zLO6{S`V1RnOv@_J<<{wz{v~o|B^(=7kY*SxaMWZSE({0JsT<7gu!eRMB%^DdFBK}U z;h>UO6LmLuh-2qwI?L-B2`KSp=xF2d5^~0w_W7ZXA_y*|Eul2e`G7ol)3#T_&E@dP z)YWRQrrx~?yQp9{m=L&ez7_iERpm4E23(H0i`TQ?2oeLW7^(3khBs{bo+bq*4%DeU z$RelBmk|$Tw&>wyKWtkn&5Z|Z-%8LI?ER2;T^aWbO=dxRbDySBOr!20Z;uzQR?Szi zbSeX>c{HyFnblu(rD|2FEH(?qn>jAbHh_>$wEJK+QHtr4I??Bn`Vwa+Td({9N0g!))-`?Vh6H7$-(Q;0 z*tWzg;^Fp0b;4KC^%Dv<93J3aOHH*Gh{5==?gK?wTN6pFU}#U2U0wB_r@zoAGL-uA zG_#v{(%NpuWzq2)NhKf2BReZ@w6ry@eTymnG0d= z=jFe!_)Jv^lPeAGW7jnF(Dd$DV1D>@a=!+_{ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/privateKeys.store b/src/test/resources/privateKeys.store new file mode 100644 index 0000000000000000000000000000000000000000..836e413a7c76c1fae94922c567efd74e4d00008c GIT binary patch literal 1281 zcmezO_TO6u1_mY|W&~rdf}+f_#FEtP)JmXG&h>Ss|ABPBK@(%Q0UsNeHX9=gqZX4O zBO@yVOA}*x_N!dil`?P7ei2jCV2!ZfsPCdMDKmQ=Yt7StOwPWAUVEbg67m#cAAD%; zeYATD%d*}6-WAK%d<;I)e0y=B7PF_7NzT66ej-hxmuyND9ITeiZu-c~_0LAXWRcY_ zQ8}v{abM0~JK1@!>Id`OJ=Va^76;|2nv}g+S-rDo$`PL8AGK14cCLJ7 z)G+6^p2_!ZG8Y9ygiM*g&6AcXH($mjZaS&OGAiEGTqHQL;rQKvCknHi&gkCU$EG8& zvn9bu-j4H4&&y5xDc{pPvTj~@(x4K^w6>(*C|4~&YURGg;U1gzZJ7}l|4EFsTO;7| z_2gug~GZKUumpe?sKUeMfobevn$LlFL_V=0595So`Ty59AgYs})WSNItz$ z`Qz7!b!~6r1z4Jdbtsb*%wRxPgU}0uuFi1A!HsEAq4rO5zW^(p}aX5sT zf<0gyb}&cCKmeqSOPDh!KRGccBfq%B5GuxvMT{9q%s@_@*U-|y!pOqVz`)qpBubpu z2*fpoa_QrUCdTc+w5kL1JR^`J&(zq+@V7p=QMOb_Gw8n89KAPBo_`bE9%S?0h2gNA zeZ#guwM^Go2c^K@k+!`NzxE&fy363(>Di$<*Bh-HWKHrvr6p|7o*A%o$^7{*SgHk- z4*Bn1dHvt^W70pY!=E2pu}qYo<#+S9%SYu7Gns}6M~O`|`d0dRop$1Nt@odlm?h_4 z^k6*BB+4*7A)sGWnfuJ9NjsYsy>8+D5Fzsw8%yqn;DX9@>aib%)gS zYCKrHPELFCveJopi|e_6DVipI{GC+AsA7F)$;W*w0w;8?Xukh2>gjy8N!@924b`El zDU3eW|IT}AF*mj_Ff}%?@6!yrVOQPZZ)<(fKxf8j#osr~_aB^Z^5%T~&i7`@dFpG6 zR!eO*ytn0C@_8Qn*Y{s5t~uv>ac1ROw!qa}55w+_Ka%G>(K6}G&YiY;N9LOxJG4_@ZGKw}*UK|+qKn911>#^DfV3ig0;*ufkj z0|AgSE@94`{N%)(jQrvfL#P-x7BOZdF#|bqUPDU*3nL3d0|R4YlPGasBM{dV%B7DZ zni#hmG%@PHJkJQ^$TKxIGW@L%Zj>z*(hR!qHAnBwljq+Aw+Gq0cVRdzXWy_bP%YCn z)lc6xSb&h+t8tRxA_cXZhXy?ebB%!%U_j!ck%qjlPwBUZ1VhP zw=H{9dSGOD->xf>{?7{81sWT+c#0J&zwprz6W)HF)2QdfvWGTeRox*qy&4Y|uanc> zysUI$-r{=hUy7zlAAcuRF{)UfS@Ln;iogk-E1K^=jCwksZBlnyTtjuJY6_!|^}q9; zTFi|t3`~s;?E5r>ZrD|K_}f|^G|-uGTJiS{^Zf_so4h$+zw^DBa-RCyqSaEH4exC^ zmwcYb{`LLWifhjKUYuFEmMw7g)$|Qh zZnt+wQsTj~1nDPlg7)k^Ik`#j>)OMelPg>`l@7E1+i+#pm&rZ3ixmyz4P=3-PnM5G zj77xo?QP!HYx%Wx4L#E)ahRQA?5&ePNz}{+3 Date: Wed, 25 Sep 2019 21:17:19 +0800 Subject: [PATCH 111/217] Support keyLock in LockGroup (#38) Change-Id: I43360da8b4c701bf02d635a7270af96a433ca5c7 --- pom.xml | 4 +- .../baidu/hugegraph/concurrent/LockGroup.java | 7 ++ .../hugegraph/version/CommonVersion.java | 2 +- .../baidu/hugegraph/unit/UnitTestSuite.java | 2 + .../unit/concurrent/LockGroupTest.java | 76 +++++++++++++++++++ 5 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 src/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java diff --git a/pom.xml b/pom.xml index 2e8d3524d8..8c8fc7d487 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.6.14 + 1.6.15 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -218,7 +218,7 @@ - 1.6.14.0 + 1.6.15.0 diff --git a/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java b/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java index b5172fe944..44d064deeb 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java @@ -57,6 +57,13 @@ public ReadWriteLock readWriteLock(String lockName) { return (ReadWriteLock) this.locksMap.get(lockName); } + public KeyLock keyLock(String lockName) { + if (!this.locksMap.containsKey(lockName)) { + this.locksMap.putIfAbsent(lockName, new KeyLock()); + } + return (KeyLock) this.locksMap.get(lockName); + } + public String name() { return this.name; } diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 92c5f2759f..74498bc9b3 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.6.14"); + "1.6.15"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java index 6131b33cb1..ef3f194015 100644 --- a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java +++ b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -24,6 +24,7 @@ import com.baidu.hugegraph.testutil.AssertTest; import com.baidu.hugegraph.testutil.WhiteboxTest; +import com.baidu.hugegraph.unit.concurrent.LockGroupTest; import com.baidu.hugegraph.unit.config.HugeConfigTest; import com.baidu.hugegraph.unit.date.SafeDateFormatTest; import com.baidu.hugegraph.unit.event.EventHubTest; @@ -55,6 +56,7 @@ @RunWith(Suite.class) @Suite.SuiteClasses({ + LockGroupTest.class, HugeConfigTest.class, SafeDateFormatTest.class, EventHubTest.class, diff --git a/src/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java b/src/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java new file mode 100644 index 0000000000..bd830fede5 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java @@ -0,0 +1,76 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.concurrent; + +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; + +import org.junit.Test; + +import com.baidu.hugegraph.concurrent.AtomicLock; +import com.baidu.hugegraph.concurrent.KeyLock; +import com.baidu.hugegraph.concurrent.LockGroup; +import com.baidu.hugegraph.testutil.Assert; + +public class LockGroupTest { + + private static final String GROUP = "testGroup"; + + private LockGroup group = new LockGroup(GROUP); + + @Test + public void testLock() { + Lock lock = this.group.lock("lock"); + Assert.assertTrue(lock instanceof ReentrantLock); + Lock lock1 = this.group.lock("lock"); + Assert.assertSame(lock, lock1); + } + + @Test + public void testAtomicLock() { + AtomicLock lock = this.group.atomicLock("lock"); + Assert.assertNotNull(lock); + AtomicLock lock1 = this.group.atomicLock("lock"); + Assert.assertSame(lock, lock1); + } + + @Test + public void testReadWriteLock() { + ReadWriteLock lock = this.group.readWriteLock("lock"); + Assert.assertTrue(lock instanceof ReentrantReadWriteLock); + ReadWriteLock lock1 = this.group.readWriteLock("lock"); + Assert.assertSame(lock, lock1); + } + + @Test + public void testKeyLock() { + KeyLock lock = this.group.keyLock("lock"); + Assert.assertNotNull(lock); + KeyLock lock1 = this.group.keyLock("lock"); + Assert.assertSame(lock, lock1); + } + + @Test + public void testName() { + Assert.assertEquals(GROUP, this.group.name()); + } +} From 49bff5eadc8371dd726584ac66e935995afd9287 Mon Sep 17 00:00:00 2001 From: zhoney Date: Fri, 11 Oct 2019 20:07:27 +0800 Subject: [PATCH 112/217] Support RowLock in LockGroup (#39) Change-Id: Ic25b7d81b5dd5ddc9d85b057e5f00a00763460c7 --- pom.xml | 4 +- .../baidu/hugegraph/concurrent/LockGroup.java | 14 +++ .../baidu/hugegraph/concurrent/RowLock.java | 106 +++++++++++++++++ .../hugegraph/version/CommonVersion.java | 2 +- .../baidu/hugegraph/unit/UnitTestSuite.java | 2 + .../unit/concurrent/LockGroupTest.java | 17 +++ .../unit/concurrent/RowLockTest.java | 108 ++++++++++++++++++ 7 files changed, 250 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/baidu/hugegraph/concurrent/RowLock.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java diff --git a/pom.xml b/pom.xml index 8c8fc7d487..034fce13e9 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.6.15 + 1.6.16 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -218,7 +218,7 @@ - 1.6.15.0 + 1.6.16.0 diff --git a/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java b/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java index 44d064deeb..a3f26ef9f1 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java @@ -64,6 +64,20 @@ public KeyLock keyLock(String lockName) { return (KeyLock) this.locksMap.get(lockName); } + public KeyLock keyLock(String lockName, int size) { + if (!this.locksMap.containsKey(lockName)) { + this.locksMap.putIfAbsent(lockName, new KeyLock(size)); + } + return (KeyLock) this.locksMap.get(lockName); + } + + public RowLock rowLock(String lockName) { + if (!this.locksMap.containsKey(lockName)) { + this.locksMap.putIfAbsent(lockName, new RowLock()); + } + return (RowLock) this.locksMap.get(lockName); + } + public String name() { return this.name; } diff --git a/src/main/java/com/baidu/hugegraph/concurrent/RowLock.java b/src/main/java/com/baidu/hugegraph/concurrent/RowLock.java new file mode 100644 index 0000000000..6fa5197d00 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/concurrent/RowLock.java @@ -0,0 +1,106 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.concurrent; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; + +import com.baidu.hugegraph.util.E; + +public class RowLock> { + + private final Map locks = new ConcurrentHashMap<>(); + private final ThreadLocal> localLocks = + ThreadLocal.withInitial(HashMap::new); + + public void lock(K key) { + if (key == null) { + return; + } + LocalLock localLock = this.localLocks.get().get(key); + if (localLock != null) { + localLock.lockCount++; + } else { + Lock current = new ReentrantLock(); + Lock previous = this.locks.putIfAbsent(key, current); + if (previous != null) { + current = previous; + } + current.lock(); + this.localLocks.get().put(key, new LocalLock(current)); + } + } + + public void unlock(K key) { + if (key == null) { + return; + } + LocalLock localLock = this.localLocks.get().get(key); + if (localLock == null) { + return; + } + if (--localLock.lockCount == 0) { + this.locks.remove(key, localLock.current); + this.localLocks.get().remove(key); + localLock.current.unlock(); + } + E.checkState(localLock.lockCount >= 0, + "The lock count must be >= 0, but got %s", + localLock.lockCount); + } + + public void lockAll(Set keys) { + if (keys == null) { + return; + } + List list = new ArrayList<>(keys); + Collections.sort(list); + for (K key : list) { + this.lock(key); + } + } + + public void unlockAll(Set keys) { + if (keys == null) { + return; + } + for (K key : keys) { + this.unlock(key); + } + } + + private static class LocalLock { + + private final Lock current; + private int lockCount; + + private LocalLock(Lock current) { + this.current = current; + this.lockCount = 1; + } + } +} diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 74498bc9b3..0e4d2be9f8 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.6.15"); + "1.6.16"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java index ef3f194015..a8d597a6e5 100644 --- a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java +++ b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -24,6 +24,7 @@ import com.baidu.hugegraph.testutil.AssertTest; import com.baidu.hugegraph.testutil.WhiteboxTest; +import com.baidu.hugegraph.unit.concurrent.RowLockTest; import com.baidu.hugegraph.unit.concurrent.LockGroupTest; import com.baidu.hugegraph.unit.config.HugeConfigTest; import com.baidu.hugegraph.unit.date.SafeDateFormatTest; @@ -57,6 +58,7 @@ @RunWith(Suite.class) @Suite.SuiteClasses({ LockGroupTest.class, + RowLockTest.class, HugeConfigTest.class, SafeDateFormatTest.class, EventHubTest.class, diff --git a/src/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java b/src/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java index bd830fede5..ed7c7425bc 100644 --- a/src/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java @@ -28,6 +28,7 @@ import com.baidu.hugegraph.concurrent.AtomicLock; import com.baidu.hugegraph.concurrent.KeyLock; +import com.baidu.hugegraph.concurrent.RowLock; import com.baidu.hugegraph.concurrent.LockGroup; import com.baidu.hugegraph.testutil.Assert; @@ -69,6 +70,22 @@ public void testKeyLock() { Assert.assertSame(lock, lock1); } + @Test + public void testKeyLockWithSize() { + KeyLock lock = this.group.keyLock("lock", 10); + Assert.assertNotNull(lock); + KeyLock lock1 = this.group.keyLock("lock"); + Assert.assertSame(lock, lock1); + } + + @Test + public void testRowLock() { + RowLock lock = this.group.rowLock("lock"); + Assert.assertNotNull(lock); + RowLock lock1 = this.group.rowLock("lock"); + Assert.assertSame(lock, lock1); + } + @Test public void testName() { Assert.assertEquals(GROUP, this.group.name()); diff --git a/src/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java b/src/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java new file mode 100644 index 0000000000..d7dd153266 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java @@ -0,0 +1,108 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.concurrent; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Random; +import java.util.Set; + +import org.junit.Assert; +import org.junit.Test; + +import com.baidu.hugegraph.concurrent.RowLock; +import com.baidu.hugegraph.unit.BaseUnitTest; +import com.google.common.collect.ImmutableSet; + +public class RowLockTest extends BaseUnitTest { + + private static final int THREADS_NUM = 8; + + @Test + public void testRowLock() { + RowLock lock = new RowLock<>(); + // Regular lock and unlock + lock.lock(1); + lock.unlock(1); + + // Lock one lock multiple times + lock.lock(1); + lock.lock(1); + lock.unlock(1); + lock.unlock(1); + + // Unlock one lock multiple times + lock.lock(1); + lock.unlock(1); + lock.unlock(1); + } + + @Test + public void testRowLockMultiRows() { + RowLock lock = new RowLock<>(); + lock.lockAll(ImmutableSet.of(1, 2, 3)); + lock.unlockAll(ImmutableSet.of(1, 2, 3)); + } + + @SuppressWarnings("unchecked") + @Test + public void testRowLockWithMultiThreads() { + RowLock lock = new RowLock(); + Set names = new HashSet<>(THREADS_NUM); + List keys = new ArrayList<>(5); + Random random = new Random(); + for (int i = 0; i < 5; i++) { + keys.add(random.nextInt(THREADS_NUM)); + } + + Assert.assertEquals(0, names.size()); + + runWithThreads(THREADS_NUM, () -> { + lock.lockAll(new HashSet<>(keys)); + names.add(Thread.currentThread().getName()); + lock.unlockAll(new HashSet<>(keys)); + }); + + Assert.assertEquals(THREADS_NUM, names.size()); + } + + @SuppressWarnings("unchecked") + @Test + public void testRowLockWithMultiThreadsWithRandomKey() { + RowLock lock = new RowLock(); + Set names = new HashSet<>(THREADS_NUM); + + Assert.assertEquals(0, names.size()); + + runWithThreads(THREADS_NUM, () -> { + List keys = new ArrayList<>(5); + Random random = new Random(); + for (int i = 0; i < 5; i++) { + keys.add(random.nextInt(THREADS_NUM)); + } + lock.lockAll(new HashSet<>(keys)); + names.add(Thread.currentThread().getName()); + lock.unlockAll(new HashSet<>(keys)); + }); + + Assert.assertEquals(THREADS_NUM, names.size()); + } +} From d78b728aa22d48ddad365480755a55bcd676e5a0 Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Tue, 31 Dec 2019 14:17:26 +0800 Subject: [PATCH 113/217] Split ConfigOption read into two steps: parse() and convert() (#40) also fix ConfigConvOption/ConfigListConvOption read bug fix: github.com/hugegraph/hugegraph/issues/774 Change-Id: I716c9f187128be9b0d173f152da05e5bdc2208a3 --- pom.xml | 4 +- .../hugegraph/config/ConfigConvOption.java | 22 +- .../config/ConfigListConvOption.java | 37 ++- .../hugegraph/config/ConfigListOption.java | 23 +- .../baidu/hugegraph/config/HugeConfig.java | 15 +- .../baidu/hugegraph/config/OptionHolder.java | 4 + .../baidu/hugegraph/config/OptionSpace.java | 16 +- .../baidu/hugegraph/config/TypedOption.java | 45 ++- .../hugegraph/version/CommonVersion.java | 2 +- .../baidu/hugegraph/unit/UnitTestSuite.java | 4 +- .../hugegraph/unit/config/HugeConfigTest.java | 295 +++++++++++++++++- .../unit/config/OptionSpaceTest.java | 217 +++++++++++++ .../unit/config/test-check-error.conf | 1 + .../unit/config/test-list-error.conf | 2 + .../unit/config/test-type-error.conf | 1 + .../com/baidu/hugegraph/unit/config/test.conf | 5 + 16 files changed, 614 insertions(+), 79 deletions(-) create mode 100644 src/test/java/com/baidu/hugegraph/unit/config/OptionSpaceTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/config/test-check-error.conf create mode 100644 src/test/java/com/baidu/hugegraph/unit/config/test-list-error.conf create mode 100644 src/test/java/com/baidu/hugegraph/unit/config/test-type-error.conf diff --git a/pom.xml b/pom.xml index 034fce13e9..cf647667dc 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.6.16 + 1.7.0 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -218,7 +218,7 @@ - 1.6.16.0 + 1.7.0.0 diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigConvOption.java b/src/main/java/com/baidu/hugegraph/config/ConfigConvOption.java index 9f354d086b..f67d0e478e 100644 --- a/src/main/java/com/baidu/hugegraph/config/ConfigConvOption.java +++ b/src/main/java/com/baidu/hugegraph/config/ConfigConvOption.java @@ -21,27 +21,29 @@ import java.util.function.Function; +import com.baidu.hugegraph.util.E; import com.google.common.base.Predicate; -public class ConfigConvOption extends TypedOption { +public class ConfigConvOption extends TypedOption { - private final Function converter; + private final Function converter; - public ConfigConvOption(String name, String desc, Predicate pred, - Function convert, String value) { + public ConfigConvOption(String name, String desc, Predicate pred, + Function convert, T value) { this(name, false, desc, pred, convert, value); } + @SuppressWarnings("unchecked") public ConfigConvOption(String name, boolean required, String desc, - Predicate pred, Function convert, - String value) { - super(name, required, desc, pred, String.class, value); + Predicate pred, Function convert, + T value) { + super(name, required, desc, pred, (Class) value.getClass(), value); + E.checkNotNull(convert, "convert"); this.converter = convert; } @Override - public R convert(Object value) { - assert value instanceof String; - return this.converter.apply((String) value); + public R convert(T value) { + return this.converter.apply(value); } } diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigListConvOption.java b/src/main/java/com/baidu/hugegraph/config/ConfigListConvOption.java index 6d5fa95891..8162500c7f 100644 --- a/src/main/java/com/baidu/hugegraph/config/ConfigListConvOption.java +++ b/src/main/java/com/baidu/hugegraph/config/ConfigListConvOption.java @@ -35,15 +35,8 @@ public class ConfigListConvOption extends TypedOption, List> { @SuppressWarnings("unchecked") public ConfigListConvOption(String name, String desc, Predicate> pred, Function convert, - T value) { - this(name, desc, pred, convert, (Class) value.getClass(), value); - } - - @SuppressWarnings("unchecked") - public ConfigListConvOption(String name, String desc, - Predicate> pred, Function convert, - Class clazz, T... values) { - this(name, false, desc, pred, convert, clazz, Arrays.asList(values)); + T... values) { + this(name, false, desc, pred, convert, null, Arrays.asList(values)); } @SuppressWarnings("unchecked") @@ -52,21 +45,33 @@ public ConfigListConvOption(String name, boolean required, String desc, Class clazz, List values) { super(name, required, desc, pred, (Class>) values.getClass(), values); + E.checkNotNull(convert, "convert"); + if (clazz == null && values.size() > 0) { + clazz = (Class) values.get(0).getClass(); + } E.checkArgumentNotNull(clazz, "Element class can't be null"); this.elemClass = clazz; this.converter = convert; } @Override - public List convert(Object value) { - List results = ConfigListOption.convert(value, part -> { - return super.convert(part, this.elemClass); + protected boolean forList() { + return true; + } + + @Override + protected List parse(Object value) { + return ConfigListOption.convert(value, part -> { + return this.parse(part, this.elemClass); }); + } - List enums = new ArrayList<>(results.size()); - for (T elem : results) { - enums.add(this.converter.apply(elem)); + @Override + public List convert(List values) { + List results = new ArrayList<>(values.size()); + for (T value : values) { + results.add(this.converter.apply(value)); } - return enums; + return results; } } diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java b/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java index 9add0bc944..565e9c71b0 100644 --- a/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java +++ b/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java @@ -33,15 +33,8 @@ public class ConfigListOption extends ConfigOption> { @SuppressWarnings("unchecked") public ConfigListOption(String name, String desc, - Predicate> pred, T value) { - this(name, desc, pred, (Class) value.getClass(), value); - } - - @SuppressWarnings("unchecked") - public ConfigListOption(String name, String desc, - Predicate> pred, Class clazz, - T... values) { - this(name, false, desc, pred, clazz, Arrays.asList(values)); + Predicate> pred, T... values) { + this(name, false, desc, pred, null, Arrays.asList(values)); } @SuppressWarnings("unchecked") @@ -50,13 +43,21 @@ public ConfigListOption(String name, boolean required, String desc, List values) { super(name, required, desc, pred, (Class>) values.getClass(), values); + if (clazz == null && values.size() > 0) { + clazz = (Class) values.get(0).getClass(); + } E.checkArgumentNotNull(clazz, "Element class can't be null"); this.elemClass = clazz; } @Override - public List convert(Object value) { - return convert(value, part -> super.convert(part, this.elemClass)); + protected boolean forList() { + return true; + } + + @Override + protected List parse(Object value) { + return convert(value, part -> this.parse(part, this.elemClass)); } @SuppressWarnings("unchecked") diff --git a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java index 7dc6ec8c1b..1c9b16b8e0 100644 --- a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java +++ b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java @@ -48,9 +48,6 @@ public HugeConfig(Configuration config) { Iterator keys = config.getKeys(); while (keys.hasNext()) { String key = keys.next(); - if (key.contains("..")) { - key = key.replace("..", "."); - } this.addProperty(key, config.getProperty(key)); } this.checkRequiredOptions(); @@ -145,17 +142,7 @@ private Object validateOption(String key, Object value) { "Invalid value for key '%s': %s", key, value); TypedOption option = OptionSpace.get(key); - Class dataType = option.dataType(); - - if (List.class.isAssignableFrom(dataType)) { - E.checkState(option instanceof ConfigListOption, - "List option must be registered with " + - "class ConfigListOption"); - } - - value = option.convert(value); - option.check(value); - return value; + return option.parseConvert(value); } private void checkRequiredOptions() { diff --git a/src/main/java/com/baidu/hugegraph/config/OptionHolder.java b/src/main/java/com/baidu/hugegraph/config/OptionHolder.java index 6b5c398d9c..e5c5be6a60 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionHolder.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionHolder.java @@ -40,6 +40,10 @@ public OptionHolder() { protected void registerOptions() { for (Field field : this.getClass().getFields()) { + if (!TypedOption.class.isAssignableFrom(field.getType())) { + // Skip if not option + continue; + } try { TypedOption option = (TypedOption) field.get(this); // Fields of subclass first, don't overwrite by superclass diff --git a/src/main/java/com/baidu/hugegraph/config/OptionSpace.java b/src/main/java/com/baidu/hugegraph/config/OptionSpace.java index 485fb81d27..8e633fa264 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionSpace.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionSpace.java @@ -21,12 +21,15 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.Collections; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import org.slf4j.Logger; +import com.baidu.hugegraph.util.E; import com.baidu.hugegraph.util.Log; public final class OptionSpace { @@ -62,7 +65,15 @@ public static void register(String module, String holder) { Exception exception = null; try { Method method = clazz.getMethod(INSTANCE_METHOD); + if (!Modifier.isStatic(method.getModifiers())) { + throw new NoSuchMethodException(INSTANCE_METHOD); + } instance = (OptionHolder) method.invoke(null); + if (instance == null) { + exception = new ConfigException( + "Returned null from %s() method", + INSTANCE_METHOD); + } } catch (NoSuchMethodException e) { LOG.warn("Class {} does not has static method {}.", holder, INSTANCE_METHOD); @@ -91,6 +102,7 @@ public static void register(String module, OptionHolder holder) { LOG.warn("Already registered option holder: {} ({})", module, holders.get(module)); } + E.checkArgumentNotNull(holder, "OptionHolder can't be null"); holders.put(module, holder.getClass()); options.putAll(holder.options()); LOG.debug("Registered options for OptionHolder: {}", @@ -98,10 +110,10 @@ public static void register(String module, OptionHolder holder) { } public static Set keys() { - return options.keySet(); + return Collections.unmodifiableSet(options.keySet()); } - public static Boolean containKey(String key) { + public static boolean containKey(String key) { return options.containsKey(key); } diff --git a/src/main/java/com/baidu/hugegraph/config/TypedOption.java b/src/main/java/com/baidu/hugegraph/config/TypedOption.java index 91fb7ea333..57d77c6fa7 100644 --- a/src/main/java/com/baidu/hugegraph/config/TypedOption.java +++ b/src/main/java/com/baidu/hugegraph/config/TypedOption.java @@ -112,14 +112,24 @@ public R defaultValue() { return this.convert(this.defaultValue); } + public R parseConvert(Object value) { + T parsed = this.parse(value); + this.check(parsed); + return this.convert(parsed); + } + @SuppressWarnings("unchecked") - public R convert(Object value) { - return (R) this.convert(value, this.dataType); + protected T parse(Object value) { + return (T) this.parse(value, this.dataType); } - public Object convert(Object value, Class dataType) { + protected Object parse(Object value, Class dataType) { if (dataType.equals(String.class)) { return value; + } else if (List.class.isAssignableFrom(dataType)) { + E.checkState(this.forList(), + "List option can't be registered with class %s", + this.getClass().getSimpleName()); } // Use PropertyConverter method `toXXX` convert value @@ -138,20 +148,35 @@ public Object convert(Object value, Class dataType) { } } - public void check(Object value) { + protected void check(Object value) { E.checkNotNull(value, "value", this.name); - E.checkArgument(this.dataType.isInstance(value), - "Invalid type of value '%s' for option '%s'", - value, this.name); + if (!this.dataType.isInstance(value)) { + throw new ConfigException( + "Invalid type of value '%s' for option '%s', " + + "expect type %s but got %s", value, this.name, + this.dataType.getSimpleName(), + value.getClass().getSimpleName()); + } + if (this.checkFunc != null) { @SuppressWarnings("unchecked") T result = (T) value; - E.checkArgument(this.checkFunc.apply(result), - "Invalid option value for '%s': %s", - this.name, value); + if (!this.checkFunc.apply(result)) { + throw new ConfigException("Invalid option value for '%s': %s", + this.name, value); + } } } + @SuppressWarnings("unchecked") + protected R convert(T value) { + return (R) value; + } + + protected boolean forList() { + return false; + } + @Override public String toString() { return String.format("[%s]%s=%s", this.dataType.getSimpleName(), diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 0e4d2be9f8..27048fd3ad 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.6.16"); + "1.7.0"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java index a8d597a6e5..4d292d6267 100644 --- a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java +++ b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -24,9 +24,10 @@ import com.baidu.hugegraph.testutil.AssertTest; import com.baidu.hugegraph.testutil.WhiteboxTest; -import com.baidu.hugegraph.unit.concurrent.RowLockTest; import com.baidu.hugegraph.unit.concurrent.LockGroupTest; +import com.baidu.hugegraph.unit.concurrent.RowLockTest; import com.baidu.hugegraph.unit.config.HugeConfigTest; +import com.baidu.hugegraph.unit.config.OptionSpaceTest; import com.baidu.hugegraph.unit.date.SafeDateFormatTest; import com.baidu.hugegraph.unit.event.EventHubTest; import com.baidu.hugegraph.unit.iterator.ExtendableIteratorTest; @@ -60,6 +61,7 @@ LockGroupTest.class, RowLockTest.class, HugeConfigTest.class, + OptionSpaceTest.class, SafeDateFormatTest.class, EventHubTest.class, PerfUtilTest.class, diff --git a/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java b/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java index 131cedc9ce..30369d0916 100644 --- a/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java @@ -28,6 +28,7 @@ import static com.baidu.hugegraph.config.OptionChecker.rangeInt; import java.util.Arrays; +import java.util.List; import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.PropertiesConfiguration; @@ -35,6 +36,7 @@ import org.junit.Test; import com.baidu.hugegraph.config.ConfigConvOption; +import com.baidu.hugegraph.config.ConfigException; import com.baidu.hugegraph.config.ConfigListConvOption; import com.baidu.hugegraph.config.ConfigListOption; import com.baidu.hugegraph.config.ConfigOption; @@ -44,18 +46,51 @@ import com.baidu.hugegraph.testutil.Assert; import com.baidu.hugegraph.testutil.Whitebox; import com.baidu.hugegraph.unit.BaseUnitTest; +import com.google.common.base.Predicate; +import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; public class HugeConfigTest extends BaseUnitTest { - private static final String CONF = - "src/test/java/com/baidu/hugegraph/unit/config/test.conf"; + private static final String PATH = + "src/test/java/com/baidu/hugegraph/unit/config/"; + private static final String CONF = PATH + "test.conf"; @BeforeClass public static void init() { OptionSpace.register("test", TestOptions.class.getName()); } + @Test + public void testOptionDataType() { + Assert.assertEquals(String.class, TestOptions.text1.dataType()); + Assert.assertEquals(Integer.class, TestOptions.int1.dataType()); + Assert.assertEquals(Long.class, TestOptions.long1.dataType()); + Assert.assertEquals(Float.class, TestOptions.float1.dataType()); + Assert.assertEquals(Double.class, TestOptions.double1.dataType()); + Assert.assertEquals(Boolean.class, TestOptions.bool.dataType()); + + Assert.assertEquals(List.class, TestOptions.list.dataType()); + Assert.assertEquals(List.class, TestOptions.map.dataType()); + + Assert.assertEquals(String.class, TestOptions.weekday.dataType()); + Assert.assertEquals(List.class, TestOptions.weekdays.dataType()); + } + + @Test + public void testOptionDesc() { + Assert.assertEquals("description of group1.text1", + TestOptions.text1.desc()); + Assert.assertEquals("description of group1.text2 sub", + TestSubOptions.text2.desc()); + } + + @Test + public void testOptionRequired() { + Assert.assertEquals(false, TestOptions.text1.required()); + Assert.assertEquals(true, TestSubOptions.text2.required()); + } + @Test public void testOptionsToString() { Assert.assertEquals("[String]group1.text1=text1-value", @@ -83,6 +118,126 @@ public void testOptionsToString() { TestSubOptions.textsub.toString()); } + @Test + public void testOptionWithError() { + Assert.assertThrows(ConfigException.class, () -> { + new ConfigOption<>( + "group1.text", + "description of group1.text", + disallowEmpty(), + "" + ); + }); + + Assert.assertThrows(ConfigException.class, () -> { + new ConfigOption<>( + "group1.choice", + "description of group1.choice", + allowValues("CHOICE-1", "CHOICE-2", "CHOICE-3"), + "CHOICE-4" + ); + }); + + Assert.assertThrows(ConfigException.class, () -> { + new ConfigListOption<>( + "group1.list", + true, + "description of group1.list", + disallowEmpty(), + String.class, + ImmutableList.of() + ); + }); + + Assert.assertThrows(ConfigException.class, () -> { + new ConfigOption<>( + "group1.int", + "description of group1.int", + positiveInt(), + 0 + ); + }); + + Assert.assertThrows(ConfigException.class, () -> { + new ConfigOption<>( + "group1.int", + "description of group1.int", + nonNegativeInt(), + -1 + ); + }); + + Assert.assertThrows(ConfigException.class, () -> { + new ConfigOption<>( + "group1.long", + "description of group1.long", + rangeInt(1L, 100L), + 0L + ); + }); + + Assert.assertThrows(ConfigException.class, () -> { + new ConfigOption<>( + "group1.long", + "description of group1.long", + rangeInt(1L, 100L), + 101L + ); + }); + + Assert.assertThrows(ConfigException.class, () -> { + new ConfigOption<>( + "group1.double", + "description of group1.double", + rangeDouble(1D, 10D), + 0D + ); + }); + + Assert.assertThrows(ConfigException.class, () -> { + new ConfigOption<>( + "group1.double", + "description of group1.double", + rangeDouble(1D, 10D), + 11D + ); + }); + + Assert.assertThrows(ConfigException.class, () -> { + new ConfigListOption<>( + "group1.list", + "description of list with invalid default values", + disallowEmpty() + ); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + new ConfigListOption<>( + "group1.list", + "description of list with invalid default values", + null + ); + }); + + Assert.assertThrows(ConfigException.class, () -> { + new ConfigListConvOption( + "group1.list_conv", + "description of list_conv with invalid default values", + disallowEmpty(), + s -> WeekDay.valueOf(s) + ); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + new ConfigListConvOption( + "group1.list_conv", + "description of list_conv with invalid default values", + null, + s -> WeekDay.valueOf(s) + ); + }); + } + @Test public void testHugeConfig() throws Exception { Configuration conf = new PropertiesConfiguration(); @@ -105,15 +260,19 @@ public void testHugeConfig() throws Exception { Assert.assertEquals(true, config.get(TestOptions.bool)); - Assert.assertEquals(WeekDay.WEDNESDAY, config.get(TestOptions.weekday)); - Assert.assertEquals(Arrays.asList(WeekDay.SATURDAY, WeekDay.SUNDAY), - config.get(TestOptions.weekdays)); - Assert.assertEquals(Arrays.asList("list-value1", "list-value2"), config.get(TestOptions.list)); Assert.assertEquals(ImmutableMap.of("key1", "value1", "key2", "value2"), config.getMap(TestOptions.map)); + + Assert.assertEquals(WeekDay.WEDNESDAY, config.get(TestOptions.weekday)); + Assert.assertEquals(Arrays.asList(WeekDay.SATURDAY, WeekDay.SUNDAY), + config.get(TestOptions.weekdays)); + + Assert.assertThrows(ConfigException.class, () -> { + new HugeConfig((Configuration) null); + }); } @Test @@ -140,6 +299,10 @@ public void testHugeConfigWithFile() throws Exception { Assert.assertEquals(ImmutableMap.of("key1", "value1", "key3", "value3"), config.getMap(TestOptions.map)); + + Assert.assertEquals(WeekDay.SUNDAY, config.get(TestOptions.weekday)); + Assert.assertEquals(Arrays.asList(WeekDay.SATURDAY, WeekDay.FRIDAY), + config.get(TestOptions.weekdays)); } @Test @@ -166,6 +329,36 @@ public void testHugeConfigWithOverride() throws Exception { config.get(TestSubOptions.textsub)); } + @Test + public void testHugeConfigWithTypeError() { + OptionSpace.register("test-type-error", + TestOptionsWithTypeError.class.getName()); + + Assert.assertThrows(ConfigException.class, () -> { + new HugeConfig(PATH + "test-type-error.conf"); + }); + } + + @Test + public void testHugeConfigWithCheckError() throws Exception { + OptionSpace.register("test-check-error", + TestOptionsWithCheckError.class.getName()); + + Assert.assertThrows(ConfigException.class, () -> { + new HugeConfig(PATH + "test-check-error.conf"); + }); + } + + @Test + public void testHugeConfigWithListOptionError() throws Exception { + OptionSpace.register("test-list-error", + TestOptionsWithListError.class.getName()); + + Assert.assertThrows(IllegalStateException.class, () -> { + new HugeConfig(PATH + "test-list-error.conf"); + }); + } + public static class TestOptions extends OptionHolder { private static volatile TestOptions instance; @@ -190,7 +383,6 @@ public static synchronized TestOptions instance() { new ConfigOption<>( "group1.text2", "description of group1.text2", - disallowEmpty(), "text2-value" ); @@ -258,7 +450,7 @@ public static synchronized TestOptions instance() { true ); - public static final ConfigConvOption weekday = + public static final ConfigConvOption weekday = new ConfigConvOption<>( "group1.weekday", "description of group1.weekday", @@ -275,7 +467,6 @@ public static synchronized TestOptions instance() { inValues("SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY"), WeekDay::valueOf, - String.class, "SATURDAY", "SUNDAY" ); @@ -284,7 +475,6 @@ public static synchronized TestOptions instance() { "group1.list", "description of group1.list", disallowEmpty(), - String.class, "list-value1", "list-value2" ); @@ -293,7 +483,6 @@ public static synchronized TestOptions instance() { "group1.map", "description of group1.map", disallowEmpty(), - String.class, "key1:value1", "key2:value2" ); } @@ -303,8 +492,10 @@ public static class TestSubOptions extends TestOptions { public static final ConfigOption text2 = new ConfigOption<>( "group1.text2", - "description of group1.text2", + true, + "description of group1.text2 sub", disallowEmpty(), + String.class, "text2-value-override" ); @@ -317,6 +508,86 @@ public static class TestSubOptions extends TestOptions { ); } + public static class TestOptionsWithTypeError extends OptionHolder { + + private static volatile TestOptionsWithTypeError instance; + + public static synchronized TestOptionsWithTypeError instance() { + if (instance == null) { + instance = new TestOptionsWithTypeError(); + instance.registerOptions(); + } + return instance; + } + + public static final ConfigOption intError = + new ConfigOption<>( + "group1.int_type_error", + "description of group1.int_type_error", + rangeInt(1, 100), + 1 + ); + } + + public static class TestOptionsWithCheckError extends OptionHolder { + + private static volatile TestOptionsWithCheckError instance; + + public static synchronized TestOptionsWithCheckError instance() { + if (instance == null) { + instance = new TestOptionsWithCheckError(); + instance.registerOptions(); + } + return instance; + } + + public static final ConfigOption intError = + new ConfigOption<>( + "group1.int_check_error", + "description of group1.int_check_error", + rangeInt(1, 100), + 1 + ); + } + + public static class TestOptionsWithListError extends OptionHolder { + + private static volatile TestOptionsWithListError instance; + + public static synchronized TestOptionsWithListError instance() { + if (instance == null) { + instance = new TestOptionsWithListError(); + instance.registerOptions(); + } + return instance; + } + + public static final InvalidConfigListOption listError = + new InvalidConfigListOption<>( + "group1.list_for_list_error", + "description of group1.list_for_list_error", + disallowEmpty(), + 1 + ); + + static class InvalidConfigListOption extends ConfigOption> { + + @SuppressWarnings("unchecked") + public InvalidConfigListOption(String name, String desc, + Predicate> pred, + T... values) { + super(name, false, desc, pred, + (Class>) Arrays.asList(values).getClass(), + Arrays.asList(values)); + } + + @Override + protected boolean forList() { + return false; + } + } + } + public enum WeekDay { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY; diff --git a/src/test/java/com/baidu/hugegraph/unit/config/OptionSpaceTest.java b/src/test/java/com/baidu/hugegraph/unit/config/OptionSpaceTest.java new file mode 100644 index 0000000000..3ff2c0512e --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/config/OptionSpaceTest.java @@ -0,0 +1,217 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.config; + +import static com.baidu.hugegraph.config.OptionChecker.disallowEmpty; + +import org.junit.Test; + +import com.baidu.hugegraph.config.ConfigException; +import com.baidu.hugegraph.config.ConfigOption; +import com.baidu.hugegraph.config.OptionHolder; +import com.baidu.hugegraph.config.OptionSpace; +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; +import com.google.common.base.Predicate; + +public class OptionSpaceTest extends BaseUnitTest { + + @Test + public void tesRegister() { + int oldSize = OptionSpace.keys().size(); + + OptionSpace.register("testgroup1", OptionHolder1.class.getName()); + Assert.assertEquals(oldSize + 2, OptionSpace.keys().size()); + Assert.assertTrue(OptionSpace.containKey("testgroup1.text1")); + Assert.assertTrue(OptionSpace.containKey("testgroup1.text2")); + + OptionSpace.register("testgroup1", new OptionHolder1()); + Assert.assertEquals(oldSize + 2, OptionSpace.keys().size()); + Assert.assertTrue(OptionSpace.containKey("testgroup1.text1")); + Assert.assertTrue(OptionSpace.containKey("testgroup1.text2")); + + OptionSpace.register("testgroup2", OptionHolder2.class.getName()); + Assert.assertEquals(oldSize + 4, OptionSpace.keys().size()); + + Assert.assertTrue(OptionSpace.containKey("testgroup1.text1")); + Assert.assertTrue(OptionSpace.containKey("testgroup1.text2")); + Assert.assertTrue(OptionSpace.containKey("testgroup2.text1")); + Assert.assertTrue(OptionSpace.containKey("testgroup2.text2")); + + Assert.assertEquals("text1 value", + OptionSpace.get("testgroup1.text1").defaultValue()); + Assert.assertEquals("text2 value", + OptionSpace.get("testgroup1.text2").defaultValue()); + Assert.assertEquals("text1 value", + OptionSpace.get("testgroup2.text1").defaultValue()); + Assert.assertEquals("text2 value", + OptionSpace.get("testgroup2.text2").defaultValue()); + } + + @Test + public void testRegisterWithError() { + Assert.assertThrows(ConfigException.class, () -> { + OptionSpace.register("test-error", "fake"); + }); + + Assert.assertThrows(ConfigException.class, () -> { + OptionSpace.register("test-error", Exception.class.getName()); + }); + + Assert.assertThrows(ConfigException.class, () -> { + OptionSpace.register("test-error", + OptionHolderWithoutInstance.class.getName()); + }); + + Assert.assertThrows(ConfigException.class, () -> { + OptionSpace.register("test-error", OptionHolderWithNonStaticInstance + .class.getName()); + }); + + Assert.assertThrows(ConfigException.class, () -> { + OptionSpace.register("test-error", + OptionHolderWithInstanceNull.class.getName()); + }); + + Assert.assertThrows(ConfigException.class, () -> { + OptionSpace.register("test-error", + OptionHolderWithInstanceThrow.class.getName()); + }); + + Assert.assertThrows(ConfigException.class, () -> { + OptionSpace.register("test-error", + OptionHolderWithInvalidOption.class.getName()); + }); + } + + public static class OptionHolderWithoutInstance extends OptionHolder { + // no instance() + } + + public static class OptionHolderWithNonStaticInstance extends OptionHolder { + + // not static instance() + public OptionHolderWithNonStaticInstance instance() { + return new OptionHolderWithNonStaticInstance(); + } + } + + public static class OptionHolderWithInstanceNull extends OptionHolder { + + public static OptionHolderWithInstanceNull instance() { + return null; + } + } + + public static class OptionHolderWithInstanceThrow extends OptionHolder { + + public static OptionHolderWithInstanceNull instance() { + throw new RuntimeException("test error"); + } + } + + public static class OptionHolderWithInvalidOption extends OptionHolder { + + public static OptionHolderWithInvalidOption instance() { + return new OptionHolderWithInvalidOption(); + } + + private OptionHolderWithInvalidOption() { + this.registerOptions(); + } + + public static final String fake = "fake"; + + public static final ConfigOption invalid = + new InvalidOption<>( + "group1.text1", + "description of group1.text1", + disallowEmpty(), + "value" + ); + + public static class InvalidOption extends ConfigOption { + + public InvalidOption(String name, String desc, + Predicate pred, T value) { + super(name, desc, pred, value); + } + + @Override + public String name() { + throw new RuntimeException("fake"); + } + } + } + + public static class OptionHolder1 extends OptionHolder { + + public static OptionHolder1 instance() { + return new OptionHolder1(); + } + + OptionHolder1() { + this.registerOptions(); + } + + public static final ConfigOption text1 = + new ConfigOption<>( + "testgroup1.text1", + "description of testgroup1.text1", + disallowEmpty(), + "text1 value" + ); + + public static final ConfigOption text2 = + new ConfigOption<>( + "testgroup1.text2", + "description of testgroup1.text2", + disallowEmpty(), + "text2 value" + ); + } + + public static class OptionHolder2 extends OptionHolder { + + public static OptionHolder2 instance() { + return new OptionHolder2(); + } + + OptionHolder2() { + this.registerOptions(); + } + + public static final ConfigOption text1 = + new ConfigOption<>( + "testgroup2.text1", + "description of testgroup2.text1", + disallowEmpty(), + "text1 value" + ); + + public static final ConfigOption text2 = + new ConfigOption<>( + "testgroup2.text2", + "description of testgroup2.text2", + disallowEmpty(), + "text2 value" + ); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/config/test-check-error.conf b/src/test/java/com/baidu/hugegraph/unit/config/test-check-error.conf new file mode 100644 index 0000000000..53aec18463 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/config/test-check-error.conf @@ -0,0 +1 @@ +group1.int_check_error=101 diff --git a/src/test/java/com/baidu/hugegraph/unit/config/test-list-error.conf b/src/test/java/com/baidu/hugegraph/unit/config/test-list-error.conf new file mode 100644 index 0000000000..907b197f44 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/config/test-list-error.conf @@ -0,0 +1,2 @@ +group1.list_for_list_error=[1,2,3] + diff --git a/src/test/java/com/baidu/hugegraph/unit/config/test-type-error.conf b/src/test/java/com/baidu/hugegraph/unit/config/test-type-error.conf new file mode 100644 index 0000000000..ac70d48913 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/config/test-type-error.conf @@ -0,0 +1 @@ +group1.int_type_error=string diff --git a/src/test/java/com/baidu/hugegraph/unit/config/test.conf b/src/test/java/com/baidu/hugegraph/unit/config/test.conf index bf31c70f6a..bd2ea2a854 100644 --- a/src/test/java/com/baidu/hugegraph/unit/config/test.conf +++ b/src/test/java/com/baidu/hugegraph/unit/config/test.conf @@ -14,3 +14,8 @@ group1.bool=false group1.list=[file-v1, file-v2, file-v3] group1.map=[key1:value1, key3:value3] + +group1.weekday=SUNDAY +group1.weekdays=[SATURDAY, FRIDAY] + +group1.no-used=value From 8268b755ef147ce0cef88fcd8b47cc1821bb20c9 Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Tue, 31 Dec 2019 15:06:33 +0800 Subject: [PATCH 114/217] add generic parameter for RowLock (#42) Change-Id: I309b89846ca15d58ea39095d406a0b0b5de510e7 --- .../java/com/baidu/hugegraph/concurrent/LockGroup.java | 9 ++++++--- .../baidu/hugegraph/unit/concurrent/LockGroupTest.java | 6 +++--- .../com/baidu/hugegraph/unit/concurrent/RowLockTest.java | 6 ++---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java b/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java index a3f26ef9f1..7d29c98ed6 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java @@ -71,11 +71,14 @@ public KeyLock keyLock(String lockName, int size) { return (KeyLock) this.locksMap.get(lockName); } - public RowLock rowLock(String lockName) { + public > RowLock rowLock(String lockName) { if (!this.locksMap.containsKey(lockName)) { - this.locksMap.putIfAbsent(lockName, new RowLock()); + this.locksMap.putIfAbsent(lockName, new RowLock<>()); } - return (RowLock) this.locksMap.get(lockName); + Object value = this.locksMap.get(lockName); + @SuppressWarnings("unchecked") + RowLock lock = (RowLock) value; + return lock; } public String name() { diff --git a/src/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java b/src/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java index ed7c7425bc..7a52304021 100644 --- a/src/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java @@ -28,8 +28,8 @@ import com.baidu.hugegraph.concurrent.AtomicLock; import com.baidu.hugegraph.concurrent.KeyLock; -import com.baidu.hugegraph.concurrent.RowLock; import com.baidu.hugegraph.concurrent.LockGroup; +import com.baidu.hugegraph.concurrent.RowLock; import com.baidu.hugegraph.testutil.Assert; public class LockGroupTest { @@ -80,9 +80,9 @@ public void testKeyLockWithSize() { @Test public void testRowLock() { - RowLock lock = this.group.rowLock("lock"); + RowLock lock = this.group.rowLock("lock"); Assert.assertNotNull(lock); - RowLock lock1 = this.group.rowLock("lock"); + RowLock lock1 = this.group.rowLock("lock"); Assert.assertSame(lock, lock1); } diff --git a/src/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java b/src/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java index d7dd153266..bd8419bb00 100644 --- a/src/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java @@ -62,10 +62,9 @@ public void testRowLockMultiRows() { lock.unlockAll(ImmutableSet.of(1, 2, 3)); } - @SuppressWarnings("unchecked") @Test public void testRowLockWithMultiThreads() { - RowLock lock = new RowLock(); + RowLock lock = new RowLock<>(); Set names = new HashSet<>(THREADS_NUM); List keys = new ArrayList<>(5); Random random = new Random(); @@ -84,10 +83,9 @@ public void testRowLockWithMultiThreads() { Assert.assertEquals(THREADS_NUM, names.size()); } - @SuppressWarnings("unchecked") @Test public void testRowLockWithMultiThreadsWithRandomKey() { - RowLock lock = new RowLock(); + RowLock lock = new RowLock<>(); Set names = new HashSet<>(THREADS_NUM); Assert.assertEquals(0, names.size()); From 24b8a33e9c85af00a881f0521b167a70518ee259 Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Wed, 1 Jan 2020 01:17:03 +0800 Subject: [PATCH 115/217] support assert range conditions (#41) add methods to Assert class: assertGt() assertGte() assertLt() assertLte() assertContains() Change-Id: If4c5df19c937a8bb06fcdd60122ac54ab04f501b --- pom.xml | 4 +- .../com/baidu/hugegraph/testutil/Assert.java | 76 +++- .../hugegraph/version/CommonVersion.java | 2 +- .../baidu/hugegraph/testutil/AssertTest.java | 356 +++++++++++++++++- 4 files changed, 427 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index cf647667dc..9ad4475d30 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.7.0 + 1.7.1 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -218,7 +218,7 @@ - 1.7.0.0 + 1.7.1.0 diff --git a/src/main/java/com/baidu/hugegraph/testutil/Assert.java b/src/main/java/com/baidu/hugegraph/testutil/Assert.java index 188d0fe89d..535f41e0c5 100644 --- a/src/main/java/com/baidu/hugegraph/testutil/Assert.java +++ b/src/main/java/com/baidu/hugegraph/testutil/Assert.java @@ -20,6 +20,11 @@ package com.baidu.hugegraph.testutil; import java.util.function.Consumer; +import java.util.function.Function; + +import org.hamcrest.BaseMatcher; +import org.hamcrest.CoreMatchers; +import org.hamcrest.Description; public class Assert extends org.junit.Assert { @@ -43,17 +48,17 @@ public static void assertThrows(Class throwable, runnable.run(); fail = true; } catch (Throwable e) { - exceptionConsumer.accept(e); if (!throwable.isInstance(e)) { Assert.fail(String.format( - "Bad exception type %s(expect %s)", - e.getClass(), throwable)); + "Bad exception type %s(expected %s)", + e.getClass().getName(), throwable.getName())); } + exceptionConsumer.accept(e); } if (fail) { Assert.fail(String.format( - "No exception was thrown(expect %s)", - throwable)); + "No exception was thrown(expected %s)", + throwable.getName())); } } @@ -84,4 +89,65 @@ public static void assertEquals(float expected, Object actual) { public static void assertEquals(double expected, Object actual) { org.junit.Assert.assertEquals(expected, actual); } + + public static void assertGt(Number expected, Object actual) { + org.junit.Assert.assertThat(actual, new NumberMatcher(expected, cmp -> { + return cmp > 0; + }, ">")); + } + + public static void assertGte(Number expected, Object actual) { + org.junit.Assert.assertThat(actual, new NumberMatcher(expected, cmp -> { + return cmp >= 0; + }, ">=")); + } + + public static void assertLt(Number expected, Object actual) { + org.junit.Assert.assertThat(actual, new NumberMatcher(expected, cmp -> { + return cmp < 0; + }, "<")); + } + + public static void assertLte(Number expected, Object actual) { + org.junit.Assert.assertThat(actual, new NumberMatcher(expected, cmp -> { + return cmp <= 0; + }, "<=")); + } + + public static void assertContains(String sub, String actual) { + org.junit.Assert.assertThat(actual, CoreMatchers.containsString(sub)); + } + + public static void assertInstanceOf(Class clazz, Object object) { + org.junit.Assert.assertThat(object, CoreMatchers.instanceOf(clazz)); + } + + private static class NumberMatcher extends BaseMatcher { + + private final String symbol; + private final Number expected; + private final Function cmp; + + public NumberMatcher(Number expected, Function cmp, + String symbol) { + this.expected = expected; + this.cmp = cmp; + this.symbol = symbol; + } + + @SuppressWarnings("unchecked") + @Override + public boolean matches(Object actual) { + Assert.assertInstanceOf(this.expected.getClass(), actual); + Assert.assertInstanceOf(Comparable.class, actual); + int cmp = ((Comparable) actual).compareTo(this.expected); + return this.cmp.apply(cmp); + } + + @Override + public void describeTo(Description desc) { + desc.appendText("a number ").appendText(this.symbol) + .appendText(" ").appendText(this.expected.toString()); + } + } } diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 27048fd3ad..5bfcbcb53c 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.7.0"); + "1.7.1"); } diff --git a/src/test/java/com/baidu/hugegraph/testutil/AssertTest.java b/src/test/java/com/baidu/hugegraph/testutil/AssertTest.java index 480842e904..91b7ee4bf9 100644 --- a/src/test/java/com/baidu/hugegraph/testutil/AssertTest.java +++ b/src/test/java/com/baidu/hugegraph/testutil/AssertTest.java @@ -36,6 +36,138 @@ public void testAssertEquals() { Assert.assertEquals(1d, Double.valueOf("1")); } + @Test + public void testAssertEqualsWithError() { + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertEquals((byte) 1, "1"); + }, e -> { + Assert.assertContains("expected: java.lang.Byte", + e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertEquals((short) 1, "1"); + }, e -> { + Assert.assertContains("expected: java.lang.Short", + e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertEquals('1', "1"); + }, e -> { + Assert.assertContains("expected: java.lang.Character", + e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertEquals(1, "1"); + }, e -> { + Assert.assertContains("expected: java.lang.Integer", + e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertEquals(1L, "1"); + }, e -> { + Assert.assertContains("expected: java.lang.Long", + e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertEquals(1f, "1.0"); + }, e -> { + Assert.assertContains("expected: java.lang.Float", + e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertEquals(1d, "1.0"); + }, e -> { + Assert.assertContains("expected: java.lang.Double", + e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertEquals(1f, "1"); + }, e -> { + Assert.assertContains("expected:<1.0> but was:<1>", + e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertEquals(1d, "1"); + }, e -> { + Assert.assertContains("expected:<1.0> but was:<1>", + e.getMessage()); + }); + } + + @Test + public void testAssertEqualsOfIntWithError() { + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertEquals(1, (Byte) (byte) 1); + }, e -> { + Assert.assertContains("expected: java.lang.Integer", + e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertEquals(1, (Short) (short) 1); + }, e -> { + Assert.assertContains("expected: java.lang.Integer", + e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertEquals(1, (Character) '1'); + }, e -> { + Assert.assertContains("expected: java.lang.Integer", + e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertEquals(1, (Long) 1l); + }, e -> { + Assert.assertContains("expected: java.lang.Integer", + e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertEquals(1, (Float) 1f); + }, e -> { + Assert.assertContains("expected:<1> but was:<1.0>", + e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertEquals(1, (Double) 1d); + }, e -> { + Assert.assertContains("expected:<1> but was:<1.0>", + e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertEquals(1, "1.0"); + }, e -> { + Assert.assertContains("expected:<1> but was:<1.0>", + e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertEquals(1, (Byte) (byte) 2); + }, e -> { + Assert.assertContains("expected:<1> but was:<2>", + e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertEquals(1, null); + }, e -> { + Assert.assertContains("expected:<1> but was:", + e.getMessage()); + }); + } + @Test public void testAssertThrows() { Assert.assertThrows(NullPointerException.class, () -> { @@ -61,7 +193,7 @@ public void testAssertThrowsWithError() { Assert.fail("Expect error"); } catch (AssertionError e) { Assert.assertEquals("No exception was thrown" + - "(expect class java.lang.NullPointerException)", + "(expected java.lang.NullPointerException)", e.getMessage()); } @@ -71,10 +203,228 @@ public void testAssertThrowsWithError() { }); Assert.fail("Expect error"); } catch (AssertionError e) { - Assert.assertEquals("Bad exception type class " + + Assert.assertEquals("Bad exception type " + "java.lang.RuntimeException" + - "(expect class java.lang.NullPointerException)", + "(expected java.lang.NullPointerException)", e.getMessage()); } } + + @Test + public void testAssertGt() { + Assert.assertGt((byte) 1, Byte.valueOf("2")); + Assert.assertGt((short) 1, Short.valueOf("2")); + Assert.assertGt(1, Integer.valueOf("2")); + Assert.assertGt(1L, Long.valueOf("2")); + Assert.assertGt(1f, Float.valueOf("1.01")); + Assert.assertGt(1d, Double.valueOf("1.01")); + + Assert.assertGt((byte) 1, (byte) 2); + Assert.assertGt((short) 1, (short) 2); + Assert.assertGt(1, 2); + Assert.assertGt(1L, 2L); + Assert.assertGt(1f, 1.01f); + Assert.assertGt(1d, 1.01d); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertGt(1, 0); + }, e -> { + Assert.assertContains("Expected: a number > 1", e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertGt(1, null); + }, e -> { + Assert.assertContains("Expected: an instance of java.lang.Integer", + e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertGt(1, (byte) 2); + }, e -> { + Assert.assertContains("Expected: an instance of java.lang.Integer", + e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertGt(1, 1.1); + }, e -> { + Assert.assertContains("Expected: an instance of java.lang.Integer", + e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertGt(1, Character.valueOf('2')); + }, e -> { + Assert.assertContains("Expected: an instance of java.lang.Integer", + e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertGt(0.9, 1); + }, e -> { + Assert.assertContains("Expected: an instance of java.lang.Double", + e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertGt(0.9d, 0.98f); + }, e -> { + Assert.assertContains("Expected: an instance of java.lang.Double", + e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertGt(0.9f, 0.98d); + }, e -> { + Assert.assertContains("Expected: an instance of java.lang.Float", + e.getMessage()); + }); + } + + @Test + public void testAssertGte() { + Assert.assertGte((byte) 1, Byte.valueOf("2")); + Assert.assertGte((short) 1, Short.valueOf("2")); + Assert.assertGte(1, Integer.valueOf("2")); + Assert.assertGte(1L, Long.valueOf("2")); + Assert.assertGte(1f, Float.valueOf("1.01")); + Assert.assertGte(1d, Double.valueOf("1.01")); + + Assert.assertGte((byte) 1, Byte.valueOf("1")); + Assert.assertGte((short) 1, Short.valueOf("1")); + Assert.assertGte(1, Integer.valueOf("1")); + Assert.assertGte(1L, Long.valueOf("1")); + Assert.assertGte(1f, Float.valueOf("1")); + Assert.assertGte(1d, Double.valueOf("1")); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertGte(1, 0); + }, e -> { + Assert.assertContains("Expected: a number >= 1", e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertGte(1, 1.1); + }, e -> { + Assert.assertContains("Expected: an instance of java.lang.Integer", + e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertGte(1, Character.valueOf('2')); + }, e -> { + Assert.assertContains("Expected: an instance of java.lang.Integer", + e.getMessage()); + }); + } + + @Test + public void testAssertLt() { + Assert.assertLt((byte) 1, Byte.valueOf("0")); + Assert.assertLt((short) 1, Short.valueOf("0")); + Assert.assertLt(1, Integer.valueOf("0")); + Assert.assertLt(1L, Long.valueOf("0")); + Assert.assertLt(1f, Float.valueOf("0.99")); + Assert.assertLt(1d, Double.valueOf("0.99")); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertLt(1, 2); + }, e -> { + Assert.assertContains("Expected: a number < 1", e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertGt(1, 0.9); + }, e -> { + Assert.assertContains("Expected: an instance of java.lang.Integer", + e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertGt(1, Character.valueOf('0')); + }, e -> { + Assert.assertContains("Expected: an instance of java.lang.Integer", + e.getMessage()); + }); + } + + @Test + public void testAssertLte() { + Assert.assertLte((byte) 1, Byte.valueOf("0")); + Assert.assertLte((short) 1, Short.valueOf("0")); + Assert.assertLte(1, Integer.valueOf("0")); + Assert.assertLte(1L, Long.valueOf("0")); + Assert.assertLte(1f, Float.valueOf("0.99")); + Assert.assertLte(1d, Double.valueOf("0.99")); + + Assert.assertLte((byte) 1, Byte.valueOf("1")); + Assert.assertLte((short) 1, Short.valueOf("1")); + Assert.assertLte(1, Integer.valueOf("1")); + Assert.assertLte(1L, Long.valueOf("1")); + Assert.assertLte(1f, Float.valueOf("1")); + Assert.assertLte(1d, Double.valueOf("1")); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertLte(1, 2); + }, e -> { + Assert.assertContains("Expected: a number <= 1", e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertLte(1, 0.9); + }, e -> { + Assert.assertContains("Expected: an instance of java.lang.Integer", + e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertLte(1, Character.valueOf('0')); + }, e -> { + Assert.assertContains("Expected: an instance of java.lang.Integer", + e.getMessage()); + }); + } + + @Test + public void testAssertContains() { + Assert.assertContains("test", "test"); + Assert.assertContains("test", "hellotest"); + Assert.assertContains("test", "test123"); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertContains("test123", "test"); + }, e -> { + Assert.assertContains("Expected: a string containing", + e.getMessage()); + }); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertContains("null", null); + }, e -> { + Assert.assertContains("Expected: a string containing", + e.getMessage()); + }); + + Assert.assertThrows(NullPointerException.class, () -> { + Assert.assertContains(null, "null"); + }, e -> { + Assert.assertNull(e.getMessage()); + }); + } + + @Test + public void testAssertInstanceOf() { + Assert.assertInstanceOf(Integer.class, 1); + Assert.assertInstanceOf(Double.class, 1.0); + Assert.assertInstanceOf(String.class, "1.0"); + Assert.assertInstanceOf(BaseUnitTest.class, this); + + Assert.assertThrows(AssertionError.class, () -> { + Assert.assertInstanceOf(Float.class, 1); + }, e -> { + Assert.assertContains("Expected: an instance of java.lang.Float", + e.getMessage()); + }); + } } From 4bd64ce8b584b5247efc296063aff201ea998c79 Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Wed, 8 Jan 2020 15:13:38 +0800 Subject: [PATCH 116/217] fix iterators may not be closed (#43) Change-Id: I3709d96fd2114fa782d6f28f8853b32d65fbd22b --- pom.xml | 4 +- .../iterator/BatchMapperIterator.java | 103 +++++++ .../{IterableIterator.java => CIter.java} | 29 +- .../iterator/ExtendableIterator.java | 13 +- .../iterator/FlatMapperFilterIterator.java | 10 +- .../iterator/FlatMapperIterator.java | 39 ++- .../hugegraph/iterator/ListIterator.java | 80 ++++++ .../hugegraph/iterator/MapperIterator.java | 2 +- .../hugegraph/iterator/WrappedIterator.java | 13 +- .../hugegraph/version/CommonVersion.java | 2 +- .../baidu/hugegraph/unit/UnitTestSuite.java | 4 + .../iterator/BatchMapperIteratorTest.java | 265 ++++++++++++++++++ .../unit/iterator/ExtendableIteratorTest.java | 29 +- .../unit/iterator/ListIteratorTest.java | 262 +++++++++++++++++ 14 files changed, 790 insertions(+), 65 deletions(-) create mode 100644 src/main/java/com/baidu/hugegraph/iterator/BatchMapperIterator.java rename src/main/java/com/baidu/hugegraph/iterator/{IterableIterator.java => CIter.java} (60%) create mode 100644 src/main/java/com/baidu/hugegraph/iterator/ListIterator.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/iterator/BatchMapperIteratorTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/iterator/ListIteratorTest.java diff --git a/pom.xml b/pom.xml index 9ad4475d30..7f639e5c2f 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.7.1 + 1.7.2 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -218,7 +218,7 @@ - 1.7.1.0 + 1.7.2.0 diff --git a/src/main/java/com/baidu/hugegraph/iterator/BatchMapperIterator.java b/src/main/java/com/baidu/hugegraph/iterator/BatchMapperIterator.java new file mode 100644 index 0000000000..6b2a9135f9 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/iterator/BatchMapperIterator.java @@ -0,0 +1,103 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.iterator; + +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; + +import com.baidu.hugegraph.util.E; +import com.baidu.hugegraph.util.InsertionOrderUtil; +import com.google.common.collect.ImmutableList; + +public class BatchMapperIterator extends WrappedIterator { + + private final int batch; + private final Iterator originIterator; + private final Function, Iterator> mapperCallback; + + private Iterator batchIterator; + + public BatchMapperIterator(int batch, Iterator origin, + Function, Iterator> mapper) { + E.checkArgument(batch > 0, "Expect batch > 0, but got %s", batch); + this.batch = batch; + this.originIterator = origin; + this.mapperCallback = mapper; + this.batchIterator = null; + } + + @Override + protected Iterator originIterator() { + return this.originIterator; + } + + @Override + protected final boolean fetch() { + if (this.batchIterator != null && this.fetchFromBatch()) { + return true; + } + + List list = this.nextBatch(); + if (!list.isEmpty()) { + assert this.batchIterator == null; + // Do fetch + this.batchIterator = this.mapperCallback.apply(list); + if (this.batchIterator != null && this.fetchFromBatch()) { + return true; + } + } + return false; + } + + protected final List nextBatch() { + if (!this.originIterator.hasNext()) { + return ImmutableList.of(); + } + List list = InsertionOrderUtil.newList(); + for (int i = 0; i < this.batch && this.originIterator.hasNext(); i++) { + T next = this.originIterator.next(); + list.add(next); + } + return list; + } + + protected final boolean fetchFromBatch() { + E.checkNotNull(this.batchIterator, "mapper results"); + while (this.batchIterator.hasNext()) { + R result = this.batchIterator.next(); + if (result != null) { + assert this.current == none(); + this.current = result; + return true; + } + } + this.resetBatchIterator(); + return false; + } + + protected final void resetBatchIterator() { + if (this.batchIterator == null) { + return; + } + close(this.batchIterator); + this.batchIterator = null; + } +} diff --git a/src/main/java/com/baidu/hugegraph/iterator/IterableIterator.java b/src/main/java/com/baidu/hugegraph/iterator/CIter.java similarity index 60% rename from src/main/java/com/baidu/hugegraph/iterator/IterableIterator.java rename to src/main/java/com/baidu/hugegraph/iterator/CIter.java index eb2a966377..35eda45272 100644 --- a/src/main/java/com/baidu/hugegraph/iterator/IterableIterator.java +++ b/src/main/java/com/baidu/hugegraph/iterator/CIter.java @@ -21,32 +21,5 @@ import java.util.Iterator; -public class IterableIterator implements Iterator { - - private final Iterable iterable; - private final Iterator iterator; - - public IterableIterator(Iterable iterable) { - this.iterable = iterable; - this.iterator = iterable.iterator(); - } - - @Override - public boolean hasNext() { - return this.iterator.hasNext(); - } - - @Override - public T next() { - return this.iterator.next(); - } - - @Override - public void remove() { - this.iterator.remove(); - } - - public Iterable iterable() { - return iterable; - } +public interface CIter extends Iterator, AutoCloseable, Metadatable { } diff --git a/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java b/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java index 7d036111ae..d9985edc53 100644 --- a/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java +++ b/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java @@ -19,10 +19,8 @@ package com.baidu.hugegraph.iterator; -import java.util.ArrayList; import java.util.Deque; import java.util.Iterator; -import java.util.List; import java.util.concurrent.ConcurrentLinkedDeque; import com.baidu.hugegraph.util.E; @@ -30,13 +28,11 @@ public class ExtendableIterator extends WrappedIterator { private final Deque> itors; - private final List> removedItors; private Iterator currentIterator; public ExtendableIterator() { this.itors = new ConcurrentLinkedDeque<>(); - this.removedItors = new ArrayList<>(); this.currentIterator = null; } @@ -62,11 +58,6 @@ public ExtendableIterator extend(Iterator iter) { @Override public void close() throws Exception { - for (Iterator iter : this.removedItors) { - if (iter instanceof AutoCloseable) { - ((AutoCloseable) iter).close(); - } - } for (Iterator iter : this.itors) { if (iter instanceof AutoCloseable) { ((AutoCloseable) iter).close(); @@ -75,7 +66,7 @@ public void close() throws Exception { } @Override - protected Iterator originIterator() { + protected Iterator originIterator() { return this.currentIterator; } @@ -98,7 +89,7 @@ protected boolean fetch() { // The last one return false; } - this.removedItors.add(this.itors.removeFirst()); + close(this.itors.removeFirst()); } assert first != null && first.hasNext(); diff --git a/src/main/java/com/baidu/hugegraph/iterator/FlatMapperFilterIterator.java b/src/main/java/com/baidu/hugegraph/iterator/FlatMapperFilterIterator.java index 6046dd25a0..a222319b13 100644 --- a/src/main/java/com/baidu/hugegraph/iterator/FlatMapperFilterIterator.java +++ b/src/main/java/com/baidu/hugegraph/iterator/FlatMapperFilterIterator.java @@ -36,17 +36,17 @@ public FlatMapperFilterIterator(Iterator origin, } @Override - protected final boolean fetchMapped() { - E.checkNotNull(this.results, "mapper results"); - while (this.results.hasNext()) { - R result = this.results.next(); + protected final boolean fetchFromBatch() { + E.checkNotNull(this.batchIterator, "mapper results"); + while (this.batchIterator.hasNext()) { + R result = this.batchIterator.next(); if (result != null && this.filterCallback.apply(result)) { assert this.current == none(); this.current = result; return true; } } - this.results = null; + this.resetBatchIterator(); return false; } } diff --git a/src/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java b/src/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java index 9d50d79c5b..6b4cd9855b 100644 --- a/src/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java +++ b/src/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java @@ -29,48 +29,63 @@ public class FlatMapperIterator extends WrappedIterator { private final Iterator originIterator; private final Function> mapperCallback; - protected Iterator results; + protected Iterator batchIterator; public FlatMapperIterator(Iterator origin, Function> mapper) { this.originIterator = origin; this.mapperCallback = mapper; - this.results = null; + this.batchIterator = null; } @Override - protected Iterator originIterator() { + public void close() throws Exception { + this.resetBatchIterator(); + super.close(); + } + + @Override + protected Iterator originIterator() { return this.originIterator; } @Override protected final boolean fetch() { - if (this.results != null && this.fetchMapped()) { + if (this.batchIterator != null && this.fetchFromBatch()) { return true; } while (this.originIterator.hasNext()) { T next = this.originIterator.next(); - assert this.results == null; - this.results = this.mapperCallback.apply(next); - if (this.results != null && this.fetchMapped()) { + assert this.batchIterator == null; + // Do fetch + this.batchIterator = this.mapperCallback.apply(next); + if (this.batchIterator != null && this.fetchFromBatch()) { return true; } } return false; } - protected boolean fetchMapped() { - E.checkNotNull(this.results, "mapper results"); - while (this.results.hasNext()) { - R result = this.results.next(); + protected boolean fetchFromBatch() { + E.checkNotNull(this.batchIterator, "mapper results"); + while (this.batchIterator.hasNext()) { + R result = this.batchIterator.next(); if (result != null) { assert this.current == none(); this.current = result; return true; } } - this.results = null; + this.resetBatchIterator(); return false; } + + protected final void resetBatchIterator() { + if (this.batchIterator == null) { + return; + } + close(this.batchIterator); + this.batchIterator = null; + } } diff --git a/src/main/java/com/baidu/hugegraph/iterator/ListIterator.java b/src/main/java/com/baidu/hugegraph/iterator/ListIterator.java new file mode 100644 index 0000000000..f21a436461 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/iterator/ListIterator.java @@ -0,0 +1,80 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.iterator; + +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +import com.baidu.hugegraph.util.InsertionOrderUtil; + +public class ListIterator extends WrappedIterator { + + private final Iterator originIterator; + private final Iterator resultsIterator; + private final Collection results; + + public ListIterator(long capacity, Iterator origin) { + List results = InsertionOrderUtil.newList(); + while (origin.hasNext()) { + if (capacity >= 0L && results.size() >= capacity) { + throw new IllegalArgumentException( + "The iterator exceeded capacity " + capacity); + } + results.add(origin.next()); + } + this.originIterator = origin; + this.results = Collections.unmodifiableList(results); + this.resultsIterator = this.results.iterator(); + } + + public ListIterator(Collection origin) { + this.originIterator = origin.iterator(); + this.results = origin instanceof List ? + Collections.unmodifiableList((List) origin) : + Collections.unmodifiableCollection(origin); + this.resultsIterator = this.results.iterator(); + } + + @Override + public void remove() { + this.resultsIterator.remove(); + } + + public Collection list() { + return this.results; + } + + @Override + protected boolean fetch() { + assert this.current == none(); + if (!this.resultsIterator.hasNext()) { + return false; + } + this.current = this.resultsIterator.next(); + return true; + } + + @Override + protected Iterator originIterator() { + return this.originIterator; + } +} diff --git a/src/main/java/com/baidu/hugegraph/iterator/MapperIterator.java b/src/main/java/com/baidu/hugegraph/iterator/MapperIterator.java index f9930f5128..c02d17c27b 100644 --- a/src/main/java/com/baidu/hugegraph/iterator/MapperIterator.java +++ b/src/main/java/com/baidu/hugegraph/iterator/MapperIterator.java @@ -33,7 +33,7 @@ public MapperIterator(Iterator origin, Function mapper) { } @Override - protected Iterator originIterator() { + protected Iterator originIterator() { return this.originIterator; } diff --git a/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java b/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java index 30cf0725e2..c6e9ae7bc5 100644 --- a/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java +++ b/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java @@ -22,8 +22,7 @@ import java.util.Iterator; import java.util.NoSuchElementException; -public abstract class WrappedIterator - implements Iterator, AutoCloseable, Metadatable { +public abstract class WrappedIterator implements CIter { private static final Object NONE = new Object(); @@ -86,6 +85,16 @@ protected static final R none() { return (R) NONE; } + public static void close(Iterator iterator) { + if (iterator instanceof AutoCloseable) { + try { + ((AutoCloseable) iterator).close(); + } catch (Exception e) { + throw new IllegalStateException("Failed to close iterator"); + } + } + } + protected abstract Iterator originIterator(); protected abstract boolean fetch(); diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 5bfcbcb53c..5c4ed4b68a 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.7.1"); + "1.7.2"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java index 4d292d6267..dc90b35bf2 100644 --- a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java +++ b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -30,10 +30,12 @@ import com.baidu.hugegraph.unit.config.OptionSpaceTest; import com.baidu.hugegraph.unit.date.SafeDateFormatTest; import com.baidu.hugegraph.unit.event.EventHubTest; +import com.baidu.hugegraph.unit.iterator.BatchMapperIteratorTest; import com.baidu.hugegraph.unit.iterator.ExtendableIteratorTest; import com.baidu.hugegraph.unit.iterator.FilterIteratorTest; import com.baidu.hugegraph.unit.iterator.FlatMapperFilterIteratorTest; import com.baidu.hugegraph.unit.iterator.FlatMapperIteratorTest; +import com.baidu.hugegraph.unit.iterator.ListIteratorTest; import com.baidu.hugegraph.unit.iterator.MapperIteratorTest; import com.baidu.hugegraph.unit.license.ExtraParamTest; import com.baidu.hugegraph.unit.license.LicenseCreateParamTest; @@ -74,6 +76,8 @@ MapperIteratorTest.class, FlatMapperIteratorTest.class, FlatMapperFilterIteratorTest.class, + ListIteratorTest.class, + BatchMapperIteratorTest.class, BytesTest.class, CollectionUtilTest.class, diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/BatchMapperIteratorTest.java b/src/test/java/com/baidu/hugegraph/unit/iterator/BatchMapperIteratorTest.java new file mode 100644 index 0000000000..e08ff69216 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/iterator/BatchMapperIteratorTest.java @@ -0,0 +1,265 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.iterator; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.function.Function; + +import org.junit.Test; + +import com.baidu.hugegraph.iterator.BatchMapperIterator; +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; +import com.baidu.hugegraph.unit.iterator.ExtendableIteratorTest.CloseableItor; +import com.google.common.collect.ImmutableList; + +@SuppressWarnings("resource") +public class BatchMapperIteratorTest extends BaseUnitTest { + + private static final Iterator EMPTY = Collections.emptyIterator(); + + private static final List DATA1 = ImmutableList.of(1); + private static final List DATA2 = ImmutableList.of(2, 3); + private static final List DATA3 = ImmutableList.of(4, 5, 6); + + private static final Function, Iterator> MAPPER = + batch -> batch.iterator(); + + @Test + public void testBatchMapper() { + Iterator results; + + results = new BatchMapperIterator<>(1, DATA1.iterator(), MAPPER); + Assert.assertEquals(ImmutableList.of(1), ImmutableList.copyOf(results)); + + results = new BatchMapperIterator<>(1, DATA2.iterator(), MAPPER); + Assert.assertEquals(ImmutableList.of(2, 3), + ImmutableList.copyOf(results)); + + results = new BatchMapperIterator<>(1, DATA3.iterator(), MAPPER); + Assert.assertEquals(ImmutableList.of(4, 5, 6), + ImmutableList.copyOf(results)); + } + + @Test + public void testBatch() { + Iterator results; + + results = new BatchMapperIterator<>(2, DATA2.iterator(), MAPPER); + Assert.assertEquals(ImmutableList.of(2, 3), + ImmutableList.copyOf(results)); + + results = new BatchMapperIterator<>(2, DATA3.iterator(), MAPPER); + Assert.assertEquals(ImmutableList.of(4, 5, 6), + ImmutableList.copyOf(results)); + + results = new BatchMapperIterator<>(3, DATA3.iterator(), MAPPER); + Assert.assertEquals(ImmutableList.of(4, 5, 6), + ImmutableList.copyOf(results)); + + results = new BatchMapperIterator<>(4, DATA3.iterator(), MAPPER); + Assert.assertEquals(ImmutableList.of(4, 5, 6), + ImmutableList.copyOf(results)); + } + + @Test + public void testInvalidBatch() { + Assert.assertThrows(IllegalArgumentException.class, () -> { + new BatchMapperIterator<>(0, DATA1.iterator(), MAPPER); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + new BatchMapperIterator<>(-1, DATA1.iterator(), MAPPER); + }); + } + + @Test + public void testHasNext() { + Iterator results; + + results = new BatchMapperIterator<>(1, EMPTY, MAPPER); + Assert.assertFalse(results.hasNext()); + + results = new BatchMapperIterator<>(1, DATA1.iterator(), MAPPER); + Assert.assertTrue(results.hasNext()); + } + + @Test + public void testHasNextAndNextWithMultiTimes() { + Iterator results; + + results = new BatchMapperIterator<>(1, DATA3.iterator(), MAPPER); + + for (int i = 0; i < 5; i++) { + Assert.assertTrue(results.hasNext()); + } + + for (int i = 0; i < 3; i++) { + results.next(); + } + + Assert.assertFalse(results.hasNext()); + Assert.assertFalse(results.hasNext()); + + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + } + + @Test + public void testNext() { + Iterator results; + + results = new BatchMapperIterator<>(1, DATA1.iterator(), MAPPER); + // Call next() without hasNext() + Assert.assertEquals(1, results.next()); + + results = new BatchMapperIterator<>(1, DATA3.iterator(), MAPPER); + Assert.assertEquals(4, results.next()); + Assert.assertEquals(5, results.next()); + Assert.assertEquals(6, results.next()); + + results = new BatchMapperIterator<>(2, DATA3.iterator(), MAPPER); + Assert.assertEquals(4, results.next()); + Assert.assertEquals(5, results.next()); + Assert.assertEquals(6, results.next()); + } + + @Test + public void testNextWithMultiTimes() { + Iterator results; + + results = new BatchMapperIterator<>(1, DATA2.iterator(), MAPPER); + + for (int i = 0; i < 2; i++) { + results.next(); + } + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + } + + @Test + public void testMapperWithBatch() { + Iterator results; + + results = new BatchMapperIterator<>(1, DATA3.iterator(), batch -> { + Assert.assertEquals(1, batch.size()); + return batch.iterator(); + }); + Assert.assertEquals(4, results.next()); + Assert.assertEquals(5, results.next()); + Assert.assertEquals(6, results.next()); + Assert.assertFalse(results.hasNext()); + + results = new BatchMapperIterator<>(2, DATA3.iterator(), batch -> { + if (batch.size() == 1) { + Assert.assertEquals(6, batch.get(0)); + } else { + Assert.assertEquals(2, batch.size()); + } + return batch.iterator(); + }); + Assert.assertEquals(4, results.next()); + Assert.assertEquals(5, results.next()); + Assert.assertEquals(6, results.next()); + Assert.assertFalse(results.hasNext()); + + results = new BatchMapperIterator<>(3, DATA3.iterator(), batch -> { + Assert.assertEquals(3, batch.size()); + return batch.iterator(); + }); + Assert.assertEquals(4, results.next()); + Assert.assertEquals(5, results.next()); + Assert.assertEquals(6, results.next()); + Assert.assertFalse(results.hasNext()); + + results = new BatchMapperIterator<>(4, DATA3.iterator(), batch -> { + Assert.assertEquals(3, batch.size()); + return batch.iterator(); + }); + Assert.assertEquals(4, results.next()); + Assert.assertEquals(5, results.next()); + Assert.assertEquals(6, results.next()); + Assert.assertFalse(results.hasNext()); + } + + @Test + public void testMapperThenReturn2X() { + Iterator results; + + results = new BatchMapperIterator<>(1, DATA3.iterator(), batch -> { + List list = new ArrayList<>(); + for (int i : batch) { + list.add(2 * i); + } + return list.iterator(); + }); + + Assert.assertEquals(8, results.next()); + Assert.assertEquals(10, results.next()); + Assert.assertEquals(12, results.next()); + Assert.assertFalse(results.hasNext()); + } + + @Test + public void testMapperReturnNullThenHasNext() { + Iterator results; + + results = new BatchMapperIterator<>(1, DATA3.iterator(), batch -> { + return null; + }); + Assert.assertFalse(results.hasNext()); + Assert.assertFalse(results.hasNext()); + } + + @Test + public void testMapperReturnNullThenNext() { + Iterator results; + + results = new BatchMapperIterator<>(1, DATA3.iterator(), batch -> { + return null; + }); + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + } + + @Test + public void testClose() throws Exception { + CloseableItor vals = new CloseableItor<>(DATA1.iterator()); + + Iterator results = new BatchMapperIterator<>(1, vals, MAPPER); + + Assert.assertFalse(vals.closed()); + ((BatchMapperIterator) results).close(); + Assert.assertTrue(vals.closed()); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/ExtendableIteratorTest.java b/src/test/java/com/baidu/hugegraph/unit/iterator/ExtendableIteratorTest.java index 1a9a635b5f..4c7ba31b82 100644 --- a/src/test/java/com/baidu/hugegraph/unit/iterator/ExtendableIteratorTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/iterator/ExtendableIteratorTest.java @@ -175,7 +175,30 @@ public void testClose() throws Exception { } @Test - public void testCloseAfterNext() throws Exception { + public void testCloseAfterNext1() throws Exception { + CloseableItor c1 = new CloseableItor<>(DATA1.iterator()); + CloseableItor c2 = new CloseableItor<>(DATA2.iterator()); + CloseableItor c3 = new CloseableItor<>(DATA3.iterator()); + + ExtendableIterator results = new ExtendableIterator<>(); + results.extend(c1).extend(c2).extend(c3); + + results.next(); + results.hasNext(); + + Assert.assertTrue(c1.closed()); // close after iterated + Assert.assertFalse(c2.closed()); + Assert.assertFalse(c3.closed()); + + results.close(); + + Assert.assertTrue(c1.closed()); + Assert.assertTrue(c2.closed()); + Assert.assertTrue(c3.closed()); + } + + @Test + public void testCloseAfterNext3() throws Exception { CloseableItor c1 = new CloseableItor<>(DATA1.iterator()); CloseableItor c2 = new CloseableItor<>(DATA2.iterator()); CloseableItor c3 = new CloseableItor<>(DATA3.iterator()); @@ -191,8 +214,8 @@ public void testCloseAfterNext() throws Exception { results.next(); } - Assert.assertFalse(c1.closed()); - Assert.assertFalse(c2.closed()); + Assert.assertTrue(c1.closed()); + Assert.assertTrue(c2.closed()); Assert.assertFalse(c3.closed()); results.close(); diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/ListIteratorTest.java b/src/test/java/com/baidu/hugegraph/unit/iterator/ListIteratorTest.java new file mode 100644 index 0000000000..8ddd995ba0 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/iterator/ListIteratorTest.java @@ -0,0 +1,262 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.iterator; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; + +import org.junit.Test; + +import com.baidu.hugegraph.iterator.ListIterator; +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; +import com.baidu.hugegraph.unit.iterator.ExtendableIteratorTest.CloseableItor; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Iterators; + +@SuppressWarnings("resource") +public class ListIteratorTest extends BaseUnitTest { + + private static final Iterator EMPTY = Collections.emptyIterator(); + + private static final List DATA1 = ImmutableList.of(1); + private static final List DATA2 = ImmutableList.of(2, 3); + private static final List DATA3 = ImmutableList.of(4, 5, 6); + + @Test + public void testCapacity() { + Iterator results; + + results = new ListIterator<>(0, EMPTY); + Assert.assertFalse(results.hasNext()); + Assert.assertEquals(0, Iterators.size(results)); + + results = new ListIterator<>(2, DATA1.iterator()); + Assert.assertTrue(results.hasNext()); + Assert.assertEquals(1, Iterators.size(results)); + + results = new ListIterator<>(2, DATA2.iterator()); + Assert.assertTrue(results.hasNext()); + Assert.assertEquals(2, Iterators.size(results)); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + new ListIterator<>(0, DATA1.iterator()); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + new ListIterator<>(2, DATA3.iterator()); + }); + } + + @Test + public void testList() { + ListIterator results; + + results = new ListIterator<>(-1, EMPTY); + Assert.assertEquals(ImmutableList.of(), results.list()); + + results = new ListIterator<>(-1, DATA1.iterator()); + Assert.assertEquals(ImmutableList.of(1), results.list()); + + results = new ListIterator<>(-1, DATA2.iterator()); + Assert.assertEquals(ImmutableList.of(2, 3), results.list()); + + results = new ListIterator<>(-1, DATA3.iterator()); + Assert.assertEquals(ImmutableList.of(4, 5, 6), results.list()); + } + + @Test + public void testHasNext() { + Iterator origin = DATA1.iterator(); + Assert.assertTrue(origin.hasNext()); + + Iterator results = new ListIterator<>(-1, origin); + Assert.assertTrue(results.hasNext()); + Assert.assertTrue(results.hasNext()); + Assert.assertFalse(origin.hasNext()); + } + + @Test + public void testNext() { + Iterator results = new ListIterator<>(-1, DATA1.iterator()); + Assert.assertEquals(1, (int) results.next()); + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + } + + @Test + public void testNextAfterList() { + Iterator results = new ListIterator<>(-1, DATA1.iterator()); + Assert.assertEquals(ImmutableList.of(1), + ((ListIterator) results).list()); + Assert.assertEquals(1, (int) results.next()); + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + } + + @Test + public void testNextWithMultiTimes() { + Iterator results = new ListIterator<>(-1, DATA2.iterator()); + Assert.assertEquals(2, (int) results.next()); + Assert.assertEquals(3, (int) results.next()); + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + } + + @Test + public void testHasNextAndNext() { + Iterator results = new ListIterator<>(-1, DATA1.iterator()); + Assert.assertTrue(results.hasNext()); + Assert.assertTrue(results.hasNext()); + Assert.assertEquals(1, (int) results.next()); + Assert.assertFalse(results.hasNext()); + Assert.assertFalse(results.hasNext()); + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + } + + @Test + public void testRemove() { + List list = new ArrayList<>(DATA3); + ListIterator results = new ListIterator<>(-1, list.iterator()); + + Assert.assertEquals(ImmutableList.of(4, 5, 6), list); + Assert.assertEquals(ImmutableList.of(4, 5, 6), results.list()); + + Assert.assertThrows(UnsupportedOperationException.class, () -> { + results.remove(); + }); + results.next(); + Assert.assertThrows(UnsupportedOperationException.class, () -> { + results.remove(); + }); + + Assert.assertEquals(ImmutableList.of(4, 5, 6), list); + Assert.assertEquals(ImmutableList.of(4, 5, 6), results.list()); + } + + @Test + public void testRemoveWithoutResult() { + Iterator results = new ListIterator<>(-1, EMPTY); + Assert.assertThrows(UnsupportedOperationException.class, () -> { + results.remove(); + }); + + List list0 = new ArrayList<>(); + Iterator results2 = new ListIterator<>(-1, list0.iterator()); + Assert.assertThrows(UnsupportedOperationException.class, () -> { + results2.remove(); + }); + } + + @Test + public void testClose() throws Exception { + CloseableItor c1 = new CloseableItor<>(DATA1.iterator()); + + ListIterator results = new ListIterator<>(-1, c1); + + Assert.assertFalse(c1.closed()); + + results.close(); + + Assert.assertTrue(c1.closed()); + } + + @Test + public void testListWithConstructFromList() { + ListIterator results; + + results = new ListIterator<>(ImmutableList.of()); + Assert.assertEquals(ImmutableList.of(), results.list()); + + results = new ListIterator<>(DATA1); + Assert.assertEquals(ImmutableList.of(1), results.list()); + + results = new ListIterator<>(DATA2); + Assert.assertEquals(ImmutableList.of(2, 3), results.list()); + + results = new ListIterator<>(DATA3); + Assert.assertEquals(ImmutableList.of(4, 5, 6), results.list()); + } + + @Test + public void testHasNextAndNextWithConstructFromList() { + ListIterator results0 = new ListIterator<>(ImmutableList.of()); + Assert.assertFalse(results0.hasNext()); + Assert.assertThrows(NoSuchElementException.class, () -> { + results0.next(); + }); + + ListIterator results1 = new ListIterator<>(DATA1); + Assert.assertTrue(results1.hasNext()); + Assert.assertEquals(1, results1.next()); + Assert.assertFalse(results1.hasNext()); + Assert.assertThrows(NoSuchElementException.class, () -> { + results1.next(); + }); + + ListIterator results3 = new ListIterator<>(DATA3); + Assert.assertTrue(results3.hasNext()); + Assert.assertEquals(4, results3.next()); + Assert.assertTrue(results3.hasNext()); + Assert.assertEquals(5, results3.next()); + Assert.assertTrue(results3.hasNext()); + Assert.assertEquals(6, results3.next()); + Assert.assertFalse(results3.hasNext()); + Assert.assertThrows(NoSuchElementException.class, () -> { + results3.next(); + }); + } + + @Test + public void testNextWithConstructFromList() { + ListIterator results0 = new ListIterator<>(ImmutableList.of()); + Assert.assertThrows(NoSuchElementException.class, () -> { + results0.next(); + }); + + ListIterator results3 = new ListIterator<>(DATA3); + Assert.assertEquals(4, results3.next()); + Assert.assertEquals(5, results3.next()); + Assert.assertEquals(6, results3.next()); + Assert.assertThrows(NoSuchElementException.class, () -> { + results3.next(); + }); + } + + @Test + public void testNextAfterListWithConstructFromList() { + ListIterator results3 = new ListIterator<>(DATA3); + Assert.assertEquals(ImmutableList.of(4, 5, 6), results3.list()); + Assert.assertEquals(4, results3.next()); + Assert.assertEquals(5, results3.next()); + Assert.assertEquals(6, results3.next()); + Assert.assertThrows(NoSuchElementException.class, () -> { + results3.next(); + }); + } +} From 0a71d120f99e664aa730de1a2fc2dcfb98af11d9 Mon Sep 17 00:00:00 2001 From: Linary Date: Tue, 4 Feb 2020 17:45:01 +0800 Subject: [PATCH 117/217] Add nodes and data size to extra param (#44) --- pom.xml | 4 +-- .../baidu/hugegraph/license/ExtraParam.java | 31 +++++++++++++++++++ .../hugegraph/version/CommonVersion.java | 2 +- .../unit/license/ExtraParamTest.java | 10 +++++- .../unit/license/LicenseCreateParamTest.java | 12 +++++-- 5 files changed, 53 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 7f639e5c2f..27809ffa82 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.7.2 + 1.7.3 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -218,7 +218,7 @@ - 1.7.2.0 + 1.7.3.0 diff --git a/src/main/java/com/baidu/hugegraph/license/ExtraParam.java b/src/main/java/com/baidu/hugegraph/license/ExtraParam.java index 43f6d05121..ebd2f949f8 100644 --- a/src/main/java/com/baidu/hugegraph/license/ExtraParam.java +++ b/src/main/java/com/baidu/hugegraph/license/ExtraParam.java @@ -41,15 +41,30 @@ public class ExtraParam { @JsonProperty("cpus") private int cpus; + // The unit is MB @JsonProperty("ram") private int ram; @JsonProperty("threads") private int threads; + // The unit is MB @JsonProperty("memory") private int memory; + @JsonProperty("nodes") + private int nodes; + + // The unit is MB + @JsonProperty("data_size") + private long dataSize; + + @JsonProperty("vertices") + private long vertices; + + @JsonProperty("edges") + private long edges; + public String id() { return this.id; } @@ -85,4 +100,20 @@ public int threads() { public int memory() { return this.memory; } + + public int nodes() { + return this.nodes; + } + + public long dataSize() { + return this.dataSize; + } + + public long vertices() { + return this.vertices; + } + + public long edges() { + return this.edges; + } } diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 5c4ed4b68a..29487b920c 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.7.2"); + "1.7.3"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/license/ExtraParamTest.java b/src/test/java/com/baidu/hugegraph/unit/license/ExtraParamTest.java index 0e0cc22c9e..9655019484 100644 --- a/src/test/java/com/baidu/hugegraph/unit/license/ExtraParamTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/license/ExtraParamTest.java @@ -40,7 +40,11 @@ public void testDeserializeExtraParam() throws IOException { + "\"cpus\":32," + "\"ram\":65536," + "\"threads\":96," - + "\"memory\":32768" + + "\"memory\":32768," + + "\"nodes\":3," + + "\"data_size\":1024," + + "\"vertices\":1000," + + "\"edges\":2000" + "}"; ObjectMapper mapper = new ObjectMapper(); ExtraParam param = mapper.readValue(json, ExtraParam.class); @@ -53,5 +57,9 @@ public void testDeserializeExtraParam() throws IOException { Assert.assertEquals(65536, param.ram()); Assert.assertEquals(96, param.threads()); Assert.assertEquals(32768, param.memory()); + Assert.assertEquals(3, param.nodes()); + Assert.assertEquals(1024, param.dataSize()); + Assert.assertEquals(1000, param.vertices()); + Assert.assertEquals(2000, param.edges()); } } diff --git a/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java b/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java index cc9ddaafc4..7000cb5934 100644 --- a/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java @@ -59,7 +59,11 @@ public void testDeserializeLicenseCreateParam() + "\"cpus\":32," + "\"ram\":65536," + "\"threads\":96," - + "\"memory\":32768" + + "\"memory\":32768," + + "\"nodes\":3," + + "\"data_size\":1024," + + "\"vertices\":1000," + + "\"edges\":2000" + "}," + "{" + "\"id\":\"server-2\"," @@ -70,7 +74,11 @@ public void testDeserializeLicenseCreateParam() + "\"cpus\":64," + "\"ram\":65536," + "\"threads\":96," - + "\"memory\":65536" + + "\"memory\":65536," + + "\"nodes\":30," + + "\"data_size\":10240," + + "\"vertices\":10000," + + "\"edges\":20000" + "}" + "]" + "}"; From fffccf1b2f78b9b374674563687a12d811e81bf3 Mon Sep 17 00:00:00 2001 From: Linary Date: Sun, 23 Feb 2020 20:37:09 +0800 Subject: [PATCH 118/217] Upgrade jackson version to 2.10.2 (#45) --- pom.xml | 48 +++++++++++++++++-- .../hugegraph/version/CommonVersion.java | 2 +- .../unit/license/LicenseManagerTest.java | 3 +- 3 files changed, 48 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 27809ffa82..5f70e9fd31 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.7.3 + 1.7.4 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -66,9 +66,9 @@ 1.0 3.0.1 3.21.0-GA - 2.22 2.27 + 2.10.2 4.12 2.25.1 @@ -154,6 +154,38 @@ ${javassist.version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson.version} + + + com.fasterxml.jackson.core + jackson-core + ${jackson.version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + + + com.fasterxml.jackson.module + jackson-module-jaxb-annotations + ${jackson.version} + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-base + ${jackson.version} + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-json-provider + ${jackson.version} + + org.glassfish.jersey.core @@ -164,6 +196,16 @@ org.glassfish.jersey.media jersey-media-json-jackson ${jersey.version} + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-base + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-json-provider + + org.glassfish.jersey.connectors @@ -218,7 +260,7 @@ - 1.7.3.0 + 1.7.4.0 diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 29487b920c..e8e2dd1fa0 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.7.3"); + "1.7.4"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/license/LicenseManagerTest.java b/src/test/java/com/baidu/hugegraph/unit/license/LicenseManagerTest.java index 65f6e03b6d..6c27a8c1b8 100644 --- a/src/test/java/com/baidu/hugegraph/unit/license/LicenseManagerTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/license/LicenseManagerTest.java @@ -258,7 +258,8 @@ protected synchronized void validate(LicenseContent content) String extra = (String) content.getExtra(); List extraParams; try { - TypeReference type = new TypeReference>() {}; + TypeReference> type; + type = new TypeReference>() {}; extraParams = MAPPER.readValue(extra, type); } catch (IOException e) { throw new RuntimeException("Failed to read extra params", e); From 0d90ae433102504aeaec10d61f53df498e8b01c2 Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Thu, 19 Mar 2020 16:06:19 +0800 Subject: [PATCH 119/217] add encodeSignedB64() method (#46) Change-Id: I771dfaeb923b6f13c14ec1a66df6142eaf2e42ae --- pom.xml | 4 +- .../hugegraph/license/FileKeyStoreParam.java | 2 +- .../baidu/hugegraph/license/MachineInfo.java | 8 +- .../com/baidu/hugegraph/rest/RestResult.java | 2 + .../hugegraph/util/InsertionOrderUtil.java | 12 + .../baidu/hugegraph/util/LongEncoding.java | 66 ++-- .../hugegraph/version/CommonVersion.java | 2 +- .../unit/util/InsertionOrderUtilTest.java | 102 ++++++ .../hugegraph/unit/util/LongEncodingTest.java | 301 ++++++++++++++---- 9 files changed, 413 insertions(+), 86 deletions(-) diff --git a/pom.xml b/pom.xml index 5f70e9fd31..4f694db689 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.7.4 + 1.7.5 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -260,7 +260,7 @@ - 1.7.4.0 + 1.7.5.0 diff --git a/src/main/java/com/baidu/hugegraph/license/FileKeyStoreParam.java b/src/main/java/com/baidu/hugegraph/license/FileKeyStoreParam.java index 919cc23745..4065513e7d 100755 --- a/src/main/java/com/baidu/hugegraph/license/FileKeyStoreParam.java +++ b/src/main/java/com/baidu/hugegraph/license/FileKeyStoreParam.java @@ -37,7 +37,7 @@ public class FileKeyStoreParam extends AbstractKeyStoreParam { private String keyPwd; private String storePwd; - public FileKeyStoreParam(Class clazz, String resource, String alias, + public FileKeyStoreParam(Class clazz, String resource, String alias, String storePwd, String keyPwd) { super(clazz, resource); this.storePath = resource; diff --git a/src/main/java/com/baidu/hugegraph/license/MachineInfo.java b/src/main/java/com/baidu/hugegraph/license/MachineInfo.java index eccc7bb7ec..9b9a96ca65 100755 --- a/src/main/java/com/baidu/hugegraph/license/MachineInfo.java +++ b/src/main/java/com/baidu/hugegraph/license/MachineInfo.java @@ -77,7 +77,7 @@ public List getMacAddress() { } public List getLocalAllInetAddress() { - Enumeration interfaces; + Enumeration interfaces; try { interfaces = NetworkInterface.getNetworkInterfaces(); } catch (SocketException e) { @@ -86,10 +86,10 @@ public List getLocalAllInetAddress() { List result = new ArrayList<>(); while (interfaces.hasMoreElements()) { - NetworkInterface iface = (NetworkInterface) interfaces.nextElement(); - for (Enumeration inetAddresses = iface.getInetAddresses(); + NetworkInterface nw = interfaces.nextElement(); + for (Enumeration inetAddresses = nw.getInetAddresses(); inetAddresses.hasMoreElements(); ) { - InetAddress inetAddr = (InetAddress) inetAddresses.nextElement(); + InetAddress inetAddr = inetAddresses.nextElement(); if (!inetAddr.isLoopbackAddress() && !inetAddr.isLinkLocalAddress() && !inetAddr.isMulticastAddress()) { diff --git a/src/main/java/com/baidu/hugegraph/rest/RestResult.java b/src/main/java/com/baidu/hugegraph/rest/RestResult.java index e4908f8b3f..b633591935 100644 --- a/src/main/java/com/baidu/hugegraph/rest/RestResult.java +++ b/src/main/java/com/baidu/hugegraph/rest/RestResult.java @@ -66,6 +66,7 @@ public T readObject(Class clazz) { } } + @SuppressWarnings("deprecation") public List readList(String key, Class clazz) { try { JsonNode root = mapper.readTree(this.content); @@ -84,6 +85,7 @@ public List readList(String key, Class clazz) { } } + @SuppressWarnings("deprecation") public List readList(Class clazz) { JavaType type = mapper.getTypeFactory() .constructParametrizedType(ArrayList.class, diff --git a/src/main/java/com/baidu/hugegraph/util/InsertionOrderUtil.java b/src/main/java/com/baidu/hugegraph/util/InsertionOrderUtil.java index 3f235a485e..bfe911468d 100644 --- a/src/main/java/com/baidu/hugegraph/util/InsertionOrderUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/InsertionOrderUtil.java @@ -32,6 +32,10 @@ public static Map newMap() { return new LinkedHashMap<>(); } + public static Map newMap(int initialCapacity) { + return new LinkedHashMap<>(initialCapacity); + } + public static Map newMap(Map origin) { return new LinkedHashMap<>(origin); } @@ -40,6 +44,10 @@ public static Set newSet() { return new LinkedHashSet<>(); } + public static Set newSet(int initialCapacity) { + return new LinkedHashSet<>(initialCapacity); + } + public static Set newSet(Set origin) { return new LinkedHashSet<>(origin); } @@ -48,6 +56,10 @@ public static List newList() { return new ArrayList<>(); } + public static List newList(int initialCapacity) { + return new ArrayList<>(initialCapacity); + } + public static List newList(List origin) { return new ArrayList<>(origin); } diff --git a/src/main/java/com/baidu/hugegraph/util/LongEncoding.java b/src/main/java/com/baidu/hugegraph/util/LongEncoding.java index 4456cf5174..0383cd79e2 100644 --- a/src/main/java/com/baidu/hugegraph/util/LongEncoding.java +++ b/src/main/java/com/baidu/hugegraph/util/LongEncoding.java @@ -23,11 +23,12 @@ */ public final class LongEncoding { - private static final String BASE_SYMBOLS = + private static final String B64_SYMBOLS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~"; private static final String LENGTH_SYMBOLS = "0123456789ABCDEF"; - private static final char NEG = LENGTH_SYMBOLS.charAt(0); + private static final char SORTABLE_NEG = LENGTH_SYMBOLS.charAt(0); + private static final char SIGNED_NEG = '-'; private static final long FULL_LONG = Long.MIN_VALUE; @@ -50,14 +51,14 @@ public static String encodeSortable(long num) { num += FULL_LONG; } - String encoded = encode(num, BASE_SYMBOLS); + String encoded = encode(num, B64_SYMBOLS); int length = encoded.length(); E.checkArgument(length <= LENGTH_SYMBOLS.length(), "Length symbols can't represent encoded number '%s'", encoded); StringBuilder sb = new StringBuilder(length + 2); if (negative) { - sb.append(NEG); + sb.append(SORTABLE_NEG); } char len = LENGTH_SYMBOLS.charAt(length); sb.append(len); @@ -69,45 +70,70 @@ public static String encodeSortable(long num) { public static long decodeSortable(String str) { E.checkArgument(str.length() >= 2, "Length of sortable encoded string must be >=2"); - boolean negative = str.charAt(0) == NEG; + boolean negative = str.charAt(0) == SORTABLE_NEG; int lengthPos = 0; if (negative) { lengthPos = 1; } - int length = BASE_SYMBOLS.indexOf(str.charAt(lengthPos)); + int length = B64_SYMBOLS.indexOf(str.charAt(lengthPos)); E.checkArgument(length == str.length() - lengthPos - 1, "Can't decode illegal string '%s' with wrong length", str); String encoded = str.substring(lengthPos + 1); - long value = decode(encoded); + long value = decode(encoded, B64_SYMBOLS); if (negative) { value -= FULL_LONG; } return value; } - public static boolean validSortableChar(char c) { - return BASE_SYMBOLS.indexOf(c) != -1; + public static String encodeSignedB64(long value) { + boolean negative = false; + if (value < 0L) { + negative = true; + if (value == FULL_LONG) { + return "-80000000000"; + } + value = -value; + } + assert value >= 0L : value; + String encoded = encodeB64(value); + return negative ? SIGNED_NEG + encoded : encoded; + } + + public static long decodeSignedB64(String value) { + boolean negative = false; + if (!value.isEmpty() && value.charAt(0) == SIGNED_NEG) { + negative = true; + value = value.substring(1); + } + long decoded = decodeB64(value); + return negative ? -decoded : decoded; + } + + public static boolean validB64Char(char c) { + return B64_SYMBOLS.indexOf(c) != -1; } - public static String encode(long num) { - return encode(num, BASE_SYMBOLS); + public static String encodeB64(long num) { + return encode(num, B64_SYMBOLS); } - public static long decode(String str) { - return decode(str, BASE_SYMBOLS); + public static long decodeB64(String str) { + return decode(str, B64_SYMBOLS); } - public static long decode(String str, String symbols) { + public static long decode(String encoded, String symbols) { final int B = symbols.length(); E.checkArgument(B > 0, "The symbols parameter can't be empty"); - long num = 0; - for (char ch : str.toCharArray()) { + long num = 0L; + for (char ch : encoded.toCharArray()) { num *= B; int pos = symbols.indexOf(ch); if (pos < 0) - throw new NumberFormatException( - "Symbol set does not match string"); + throw new NumberFormatException(String.format( + "Can't decode symbol '%s' in string '%s'", + ch, encoded)); num += pos; } return num; @@ -115,14 +141,14 @@ public static long decode(String str, String symbols) { public static String encode(long num, String symbols) { final int B = symbols.length(); - E.checkArgument(num >= 0, "Expected non-negative number: %s", num); + E.checkArgument(num >= 0L, "Expected non-negative number: %s", num); E.checkArgument(B > 0, "The symbols parameter can't be empty"); StringBuilder sb = new StringBuilder(); do { sb.append(symbols.charAt((int) (num % B))); num /= B; - } while (num != 0); + } while (num != 0L); return sb.reverse().toString(); } diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index e8e2dd1fa0..c409ff66b0 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.7.4"); + "1.7.5"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/util/InsertionOrderUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/InsertionOrderUtilTest.java index 3298c5ae22..a8d9fa5d7c 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/InsertionOrderUtilTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/InsertionOrderUtilTest.java @@ -45,6 +45,40 @@ public void testSet() { ImmutableList.copyOf(set)); } + @Test + public void testSetWithInitialCapacity() { + Set set = InsertionOrderUtil.newSet(3); + set.add(4); + set.add(2); + set.add(5); + set.add(1); + set.add(3); + + Assert.assertEquals(ImmutableList.of(4, 2, 5, 1, 3), + ImmutableList.copyOf(set)); + } + + @Test + public void testSetCopy() { + Set set = InsertionOrderUtil.newSet(); + set.add(4); + set.add(2); + set.add(5); + set.add(1); + set.add(3); + Assert.assertEquals(ImmutableList.of(4, 2, 5, 1, 3), + ImmutableList.copyOf(set)); + + Set set2 = InsertionOrderUtil.newSet(set); + set2.add(6); + set2.add(1); + + Assert.assertEquals(ImmutableList.of(4, 2, 5, 1, 3, 6), + ImmutableList.copyOf(set2)); + Assert.assertEquals(ImmutableList.of(4, 2, 5, 1, 3), + ImmutableList.copyOf(set)); + } + @Test public void testList() { List list = InsertionOrderUtil.newList(); @@ -58,6 +92,40 @@ public void testList() { ImmutableList.copyOf(list)); } + @Test + public void testListWithInitialCapacity() { + List list = InsertionOrderUtil.newList(3); + list.add(4); + list.add(2); + list.add(5); + list.add(1); + list.add(3); + + Assert.assertEquals(ImmutableList.of(4, 2, 5, 1, 3), + ImmutableList.copyOf(list)); + } + + @Test + public void testListCopy() { + List list = InsertionOrderUtil.newList(); + list.add(4); + list.add(2); + list.add(5); + list.add(1); + list.add(3); + Assert.assertEquals(ImmutableList.of(4, 2, 5, 1, 3), + ImmutableList.copyOf(list)); + + List list2 = InsertionOrderUtil.newList(list); + list2.add(6); + list2.add(1); + + Assert.assertEquals(ImmutableList.of(4, 2, 5, 1, 3, 6, 1), + ImmutableList.copyOf(list2)); + Assert.assertEquals(ImmutableList.of(4, 2, 5, 1, 3), + ImmutableList.copyOf(list)); + } + @Test public void testMap() { Map map = InsertionOrderUtil.newMap(); @@ -70,4 +138,38 @@ public void testMap() { Assert.assertEquals(ImmutableList.of(4, 2, 5, 1, 3), ImmutableList.copyOf(map.keySet())); } + + @Test + public void testMapWithInitialCapacity() { + Map map = InsertionOrderUtil.newMap(3); + map.put(4, 4); + map.put(2, 2); + map.put(5, 5); + map.put(1, 1); + map.put(3, 3); + + Assert.assertEquals(ImmutableList.of(4, 2, 5, 1, 3), + ImmutableList.copyOf(map.keySet())); + } + + @Test + public void testMapCopy() { + Map map = InsertionOrderUtil.newMap(3); + map.put(4, 4); + map.put(2, 2); + map.put(5, 5); + map.put(1, 1); + map.put(3, 3); + Assert.assertEquals(ImmutableList.of(4, 2, 5, 1, 3), + ImmutableList.copyOf(map.keySet())); + + Map map2 = InsertionOrderUtil.newMap(map); + map2.put(6, 6); + map2.put(1, 7); + Assert.assertEquals(ImmutableList.of(4, 2, 5, 1, 3, 6), + ImmutableList.copyOf(map2.keySet())); + + Assert.assertEquals(ImmutableList.of(4, 2, 5, 1, 3), + ImmutableList.copyOf(map.keySet())); + } } diff --git a/src/test/java/com/baidu/hugegraph/unit/util/LongEncodingTest.java b/src/test/java/com/baidu/hugegraph/unit/util/LongEncodingTest.java index 3004d856cd..5a245a3977 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/LongEncodingTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/LongEncodingTest.java @@ -36,194 +36,379 @@ public class LongEncodingTest extends BaseUnitTest { + @Test + public void testValidB64Char() { + Assert.assertTrue(LongEncoding.validB64Char('0')); + Assert.assertTrue(LongEncoding.validB64Char('1')); + Assert.assertTrue(LongEncoding.validB64Char('9')); + Assert.assertTrue(LongEncoding.validB64Char('A')); + Assert.assertTrue(LongEncoding.validB64Char('Z')); + Assert.assertTrue(LongEncoding.validB64Char('_')); + Assert.assertTrue(LongEncoding.validB64Char('a')); + Assert.assertTrue(LongEncoding.validB64Char('z')); + Assert.assertTrue(LongEncoding.validB64Char('~')); + + Assert.assertFalse(LongEncoding.validB64Char('`')); + Assert.assertFalse(LongEncoding.validB64Char('!')); + Assert.assertFalse(LongEncoding.validB64Char('@')); + Assert.assertFalse(LongEncoding.validB64Char('#')); + Assert.assertFalse(LongEncoding.validB64Char('$')); + Assert.assertFalse(LongEncoding.validB64Char('%')); + Assert.assertFalse(LongEncoding.validB64Char('^')); + Assert.assertFalse(LongEncoding.validB64Char('&')); + Assert.assertFalse(LongEncoding.validB64Char('*')); + Assert.assertFalse(LongEncoding.validB64Char('(')); + Assert.assertFalse(LongEncoding.validB64Char(')')); + Assert.assertFalse(LongEncoding.validB64Char('-')); + Assert.assertFalse(LongEncoding.validB64Char('+')); + Assert.assertFalse(LongEncoding.validB64Char('=')); + Assert.assertFalse(LongEncoding.validB64Char('[')); + Assert.assertFalse(LongEncoding.validB64Char(']')); + Assert.assertFalse(LongEncoding.validB64Char('{')); + Assert.assertFalse(LongEncoding.validB64Char('}')); + Assert.assertFalse(LongEncoding.validB64Char('|')); + Assert.assertFalse(LongEncoding.validB64Char('\\')); + Assert.assertFalse(LongEncoding.validB64Char(';')); + Assert.assertFalse(LongEncoding.validB64Char(':')); + Assert.assertFalse(LongEncoding.validB64Char('\'')); + Assert.assertFalse(LongEncoding.validB64Char('\"')); + Assert.assertFalse(LongEncoding.validB64Char('<')); + Assert.assertFalse(LongEncoding.validB64Char(',')); + Assert.assertFalse(LongEncoding.validB64Char('>')); + Assert.assertFalse(LongEncoding.validB64Char('.')); + Assert.assertFalse(LongEncoding.validB64Char('?')); + Assert.assertFalse(LongEncoding.validB64Char('/')); + Assert.assertFalse(LongEncoding.validB64Char('\t')); + Assert.assertFalse(LongEncoding.validB64Char('\b')); + } + @Test public void testEncode() { - String val0 = LongEncoding.encode(0); + String val0 = LongEncoding.encodeB64(0); Assert.assertEquals("0", val0); - String val1 = LongEncoding.encode(1); + String val1 = LongEncoding.encodeB64(1); Assert.assertEquals("1", val1); - String val9 = LongEncoding.encode(9); + String val9 = LongEncoding.encodeB64(9); Assert.assertEquals("9", val9); - String val10 = LongEncoding.encode(10); + String val10 = LongEncoding.encodeB64(10); Assert.assertEquals("A", val10); - String val35 = LongEncoding.encode(35); + String val35 = LongEncoding.encodeB64(35); Assert.assertEquals("Z", val35); - String val36 = LongEncoding.encode(36); + String val36 = LongEncoding.encodeB64(36); Assert.assertEquals("_", val36); - String val37 = LongEncoding.encode(37); + String val37 = LongEncoding.encodeB64(37); Assert.assertEquals("a", val37); - String val62 = LongEncoding.encode(62); + String val62 = LongEncoding.encodeB64(62); Assert.assertEquals("z", val62); - String val63 = LongEncoding.encode(63); + String val63 = LongEncoding.encodeB64(63); Assert.assertEquals("~", val63); } @Test public void testEncodeWithMultiString() { - String val64 = LongEncoding.encode(64); + Assert.assertEquals("0", LongEncoding.encode(0L, "0123456789")); + Assert.assertEquals("1", LongEncoding.encode(1L, "0123456789")); + Assert.assertEquals("123", LongEncoding.encode(123L, "0123456789")); + Assert.assertEquals("13579", LongEncoding.encode(13579L, "0123456789")); + Assert.assertEquals("24680", LongEncoding.encode(24680L, "0123456789")); + + String val64 = LongEncoding.encodeB64(64); Assert.assertEquals("10", val64); - String val65 = LongEncoding.encode(65); + String val65 = LongEncoding.encodeB64(65); Assert.assertEquals("11", val65); - String val99 = LongEncoding.encode(99); + String val99 = LongEncoding.encodeB64(99); Assert.assertEquals("1Z", val99); - String val100 = LongEncoding.encode(100); + String val100 = LongEncoding.encodeB64(100); Assert.assertEquals("1_", val100); - String val126 = LongEncoding.encode(126); + String val126 = LongEncoding.encodeB64(126); Assert.assertEquals("1z", val126); - String val127 = LongEncoding.encode(127); + String val127 = LongEncoding.encodeB64(127); Assert.assertEquals("1~", val127); - String val128 = LongEncoding.encode(128); + String val128 = LongEncoding.encodeB64(128); Assert.assertEquals("20", val128); - String val200 = LongEncoding.encode(200); + String val200 = LongEncoding.encodeB64(200); Assert.assertEquals("38", val200); - String val1000 = LongEncoding.encode(1000); + String val1000 = LongEncoding.encodeB64(1000); Assert.assertEquals("Fd", val1000); - String val1234 = LongEncoding.encode(1234); + String val1234 = LongEncoding.encodeB64(1234); Assert.assertEquals("JI", val1234); - String val10000 = LongEncoding.encode(10000); + String val10000 = LongEncoding.encodeB64(10000); Assert.assertEquals("2SG", val10000); - String val12345 = LongEncoding.encode(12345); + String val12345 = LongEncoding.encodeB64(12345); Assert.assertEquals("30u", val12345); - String val22345 = LongEncoding.encode(22345); + String val22345 = LongEncoding.encodeB64(22345); Assert.assertEquals("5T9", val22345); - String val92345 = LongEncoding.encode(92345); + String val92345 = LongEncoding.encodeB64(92345); Assert.assertEquals("MYu", val92345); - String val12345678 = LongEncoding.encode(12345678); + String val12345678 = LongEncoding.encodeB64(12345678); Assert.assertEquals("k65E", val12345678); - String val112345678 = LongEncoding.encode(112345678); + String val112345678 = LongEncoding.encodeB64(112345678); Assert.assertEquals("6h_9E", val112345678); - String valIntMax = LongEncoding.encode(Integer.MAX_VALUE); + String valIntMax = LongEncoding.encodeB64(Integer.MAX_VALUE); Assert.assertEquals("1~~~~~", valIntMax); - String valLongMax = LongEncoding.encode(Long.MAX_VALUE); + String valLongMax = LongEncoding.encodeB64(Long.MAX_VALUE); Assert.assertEquals("7~~~~~~~~~~", valLongMax); } @Test - public void testEncodeNegative() { + public void testEncodeWithError() { + Assert.assertThrows(IllegalArgumentException.class, () -> { + LongEncoding.encode(1, ""); + }, e -> { + Assert.assertEquals("The symbols parameter can't be empty", + e.getMessage()); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + LongEncoding.encode(-1, ""); + }, e -> { + Assert.assertContains("Expected non-negative number", + e.getMessage()); + }); + Assert.assertThrows(IllegalArgumentException.class, () -> { - LongEncoding.encode(-1); + LongEncoding.encodeB64(-1); + }, e -> { + Assert.assertContains("Expected non-negative number", + e.getMessage()); }); Assert.assertThrows(IllegalArgumentException.class, () -> { - LongEncoding.encode(Long.MIN_VALUE); + LongEncoding.encodeB64(Long.MIN_VALUE); + }, e -> { + Assert.assertContains("Expected non-negative number", + e.getMessage()); }); } @Test public void testDecode() { - long valEmpty = LongEncoding.decode(""); + long valEmpty = LongEncoding.decodeB64(""); Assert.assertEquals(0, valEmpty); - long val0 = LongEncoding.decode("0"); + long val0 = LongEncoding.decodeB64("0"); Assert.assertEquals(0, val0); - long val1 = LongEncoding.decode("1"); + long val1 = LongEncoding.decodeB64("1"); Assert.assertEquals(1, val1); - long val9 = LongEncoding.decode("9"); + long val9 = LongEncoding.decodeB64("9"); Assert.assertEquals(9, val9); - long val10 = LongEncoding.decode("A"); + long val10 = LongEncoding.decodeB64("A"); Assert.assertEquals(10, val10); - long val35 = LongEncoding.decode("Z"); + long val35 = LongEncoding.decodeB64("Z"); Assert.assertEquals(35, val35); - long val36 = LongEncoding.decode("_"); + long val36 = LongEncoding.decodeB64("_"); Assert.assertEquals(36, val36); - long val37 = LongEncoding.decode("a"); + long val37 = LongEncoding.decodeB64("a"); Assert.assertEquals(37, val37); - long val62 = LongEncoding.decode("z"); + long val62 = LongEncoding.decodeB64("z"); Assert.assertEquals(62, val62); - long val63 = LongEncoding.decode("~"); + long val63 = LongEncoding.decodeB64("~"); Assert.assertEquals(63, val63); } @Test public void testDecodeWithMultiString() { - long val64 = LongEncoding.decode("10"); + Assert.assertEquals(0L, LongEncoding.decode("0", "0123456789")); + Assert.assertEquals(1L, LongEncoding.decode("1", "0123456789")); + Assert.assertEquals(123L, LongEncoding.decode("123", "0123456789")); + Assert.assertEquals(13579L, LongEncoding.decode("13579", "0123456789")); + Assert.assertEquals(24680L, LongEncoding.decode("24680", "0123456789")); + + long val64 = LongEncoding.decodeB64("10"); Assert.assertEquals(64, val64); - long val65 = LongEncoding.decode("11"); + long val65 = LongEncoding.decodeB64("11"); Assert.assertEquals(65, val65); - long val99 = LongEncoding.decode("1Z"); + long val99 = LongEncoding.decodeB64("1Z"); Assert.assertEquals(99, val99); - long val100 = LongEncoding.decode("1_"); + long val100 = LongEncoding.decodeB64("1_"); Assert.assertEquals(100, val100); - long val126 = LongEncoding.decode("1z"); + long val126 = LongEncoding.decodeB64("1z"); Assert.assertEquals(126, val126); - long val127 = LongEncoding.decode("1~"); + long val127 = LongEncoding.decodeB64("1~"); Assert.assertEquals(127, val127); - long val128 = LongEncoding.decode("20"); + long val128 = LongEncoding.decodeB64("20"); Assert.assertEquals(128, val128); - long val200 = LongEncoding.decode("38"); + long val200 = LongEncoding.decodeB64("38"); Assert.assertEquals(200, val200); - long val1000 = LongEncoding.decode("Fd"); + long val1000 = LongEncoding.decodeB64("Fd"); Assert.assertEquals(1000, val1000); - long val1234 = LongEncoding.decode("JI"); + long val1234 = LongEncoding.decodeB64("JI"); Assert.assertEquals(1234, val1234); - long val10000 = LongEncoding.decode("2SG"); + long val10000 = LongEncoding.decodeB64("2SG"); Assert.assertEquals(10000, val10000); - long val12345 = LongEncoding.decode("30u"); + long val12345 = LongEncoding.decodeB64("30u"); Assert.assertEquals(12345, val12345); - long val22345 = LongEncoding.decode("5T9"); + long val22345 = LongEncoding.decodeB64("5T9"); Assert.assertEquals(22345, val22345); - long val92345 = LongEncoding.decode("MYu"); + long val92345 = LongEncoding.decodeB64("MYu"); Assert.assertEquals(92345, val92345); - long val12345678 = LongEncoding.decode("k65E"); + long val12345678 = LongEncoding.decodeB64("k65E"); Assert.assertEquals(12345678, val12345678); - long val112345678 = LongEncoding.decode("6h_9E"); + long val112345678 = LongEncoding.decodeB64("6h_9E"); Assert.assertEquals(112345678, val112345678); - long valIntMax = LongEncoding.decode("1~~~~~"); + long valIntMax = LongEncoding.decodeB64("1~~~~~"); Assert.assertEquals(Integer.MAX_VALUE, valIntMax); - long valLongMax = LongEncoding.decode("7~~~~~~~~~~"); + long valLongMax = LongEncoding.decodeB64("7~~~~~~~~~~"); Assert.assertEquals(Long.MAX_VALUE, valLongMax); } + @Test + public void testDecodeWithError() { + Assert.assertThrows(IllegalArgumentException.class, () -> { + LongEncoding.decode("1", ""); + }, e -> { + Assert.assertEquals("The symbols parameter can't be empty", + e.getMessage()); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + LongEncoding.decode("1a", "0123456789"); + }, e -> { + Assert.assertEquals("Can't decode symbol 'a' in string '1a'", + e.getMessage()); + }); + } + + @Test + public void testEncodeSignedB64() { + String val1234 = LongEncoding.encodeSignedB64(1234); + Assert.assertEquals("JI", val1234); + + String val23 = LongEncoding.encodeSignedB64(23); + Assert.assertEquals("N", val23); + + String valIntMax = LongEncoding.encodeSignedB64(Integer.MAX_VALUE); + Assert.assertEquals("1~~~~~", valIntMax); + + String valLongMax = LongEncoding.encodeSignedB64(Long.MAX_VALUE); + Assert.assertEquals("7~~~~~~~~~~", valLongMax); + + String val0 = LongEncoding.encodeSignedB64(0); + Assert.assertEquals("0", val0); + + String valNeg1 = LongEncoding.encodeSignedB64(-1); + Assert.assertEquals("-1", valNeg1); + + String valIntMinP1 = LongEncoding.encodeSignedB64(Integer.MIN_VALUE + + 1L); + Assert.assertEquals("-1~~~~~", valIntMinP1); + + String valIntMin = LongEncoding.encodeSignedB64(Integer.MIN_VALUE); + Assert.assertEquals("-200000", valIntMin); + + String valLongMinPlus1 = LongEncoding.encodeSignedB64(Long.MIN_VALUE + + 1L); + Assert.assertEquals("-7~~~~~~~~~~", valLongMinPlus1); + + String valLongMin = LongEncoding.encodeSignedB64(Long.MIN_VALUE); + Assert.assertEquals("-80000000000", valLongMin); + } + + @Test + public void testDecodeSignedB64() { + long val1234 = LongEncoding.decodeSignedB64("JI"); + Assert.assertEquals(1234, val1234); + + long val23 = LongEncoding.decodeSignedB64("N"); + Assert.assertEquals(23, val23); + + long valIntMax = LongEncoding.decodeSignedB64("1~~~~~"); + Assert.assertEquals(Integer.MAX_VALUE, valIntMax); + + long valLongMax = LongEncoding.decodeSignedB64("7~~~~~~~~~~"); + Assert.assertEquals(Long.MAX_VALUE, valLongMax); + + long val0 = LongEncoding.decodeSignedB64("0"); + Assert.assertEquals(0, val0); + + long valn1 = LongEncoding.decodeSignedB64("-1"); + Assert.assertEquals(-1, valn1); + + long valIntMinPlus1 = LongEncoding.decodeSignedB64("-1~~~~~"); + Assert.assertEquals(Integer.MIN_VALUE + 1L, valIntMinPlus1); + + long valIntMin = LongEncoding.decodeSignedB64("-200000"); + Assert.assertEquals(Integer.MIN_VALUE, valIntMin); + + long valLongMinPlus1 = LongEncoding.decodeSignedB64("-7~~~~~~~~~~"); + Assert.assertEquals(Long.MIN_VALUE + 1L, valLongMinPlus1); + + long valLongMin = LongEncoding.decodeSignedB64("-80000000000"); + Assert.assertEquals(Long.MIN_VALUE, valLongMin); + } + + @Test + public void testDecodeSignedB64Overflow() { + long valOverflow = LongEncoding.decodeSignedB64("80000000000"); + Assert.assertEquals(Long.MIN_VALUE, valOverflow); + + long valOverflow2 = LongEncoding.decodeSignedB64("80000000001"); + Assert.assertEquals(Long.MIN_VALUE + 1L, valOverflow2); + + long valOverflow3 = LongEncoding.decodeSignedB64("800000000001"); + Assert.assertEquals(1L, valOverflow3); + + long valOverflow4 = LongEncoding.decodeSignedB64("80000000000JI"); + Assert.assertEquals(1234L, valOverflow4); + + long valOverflow5 = LongEncoding.decodeSignedB64("80000000000N"); + Assert.assertEquals(23L, valOverflow5); + + long valOverflow6 = LongEncoding.decodeSignedB64("80000000000" + + "7~~~~~~~~~~"); + Assert.assertEquals(Long.MAX_VALUE, valOverflow6); + } + @Test public void testEncodeSortable() { String val1234 = LongEncoding.encodeSortable(1234); From c2c5ba4689f178481be7a995db9d0a15f9e951b5 Mon Sep 17 00:00:00 2001 From: shzcore Date: Thu, 11 Jun 2020 21:46:38 +0800 Subject: [PATCH 120/217] add https support (#47) --- pom.xml | 4 +- .../com/baidu/hugegraph/rest/RestClient.java | 108 +++++++++++++++++- .../hugegraph/version/CommonVersion.java | 2 +- .../hugegraph/unit/rest/RestClientTest.java | 54 +++++++++ src/test/resources/cacerts.jks | Bin 0 -> 110281 bytes 5 files changed, 163 insertions(+), 5 deletions(-) create mode 100644 src/test/resources/cacerts.jks diff --git a/pom.xml b/pom.xml index 4f694db689..16459ae5b5 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.7.5 + 1.7.6 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -260,7 +260,7 @@ - 1.7.5.0 + 1.7.6.0 diff --git a/src/main/java/com/baidu/hugegraph/rest/RestClient.java b/src/main/java/com/baidu/hugegraph/rest/RestClient.java index cb66395f19..d8ab27dc25 100644 --- a/src/main/java/com/baidu/hugegraph/rest/RestClient.java +++ b/src/main/java/com/baidu/hugegraph/rest/RestClient.java @@ -21,12 +21,23 @@ import static org.glassfish.jersey.apache.connector.ApacheClientProperties.CONNECTION_MANAGER; +import java.net.URI; +import java.security.KeyManagementException; +import java.security.SecureRandom; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; import java.util.Collection; import java.util.Map; import java.util.concurrent.Callable; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.Entity; @@ -40,6 +51,7 @@ import org.apache.commons.lang3.tuple.Pair; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.pool.PoolStats; +import org.glassfish.jersey.SslConfigurator; import org.glassfish.jersey.apache.connector.ApacheConnectorProvider; import org.glassfish.jersey.client.ClientConfig; import org.glassfish.jersey.client.ClientProperties; @@ -90,9 +102,70 @@ public RestClient(String url, String user, String password, int timeout, .config(maxTotal, maxPerRoute) .build()); } - + + public RestClient(String url, String user, String password, int timeout, + int maxTotal, int maxPerRoute, String protocol, + String trustStoreFile, String trustStorePassword) { + this(url, new ConfigBuilder().config(timeout) + .config(user, password) + .config(maxTotal, maxPerRoute) + .config(protocol, trustStoreFile, + trustStorePassword) + .build()); + } + + private TrustManager[] createNoCheckTrustManager() { + return new TrustManager[]{new NoCheckTrustManager()}; + } + + private static class NoCheckTrustManager implements X509TrustManager { + + @Override + public void checkClientTrusted(X509Certificate[] chain, String authType) + throws CertificateException { + } + + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType) + throws CertificateException { + } + + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + } + + private Client wrapTrustConfig(String url, ClientConfig config) { + + SslConfigurator sslConfig = SslConfigurator.newInstance(); + String trustStoreFile = config.getProperty("trustStoreFile").toString(); + String trustStorePassword = config.getProperty("trustStorePassword").toString(); + sslConfig.trustStoreFile(trustStoreFile) + .trustStorePassword(trustStorePassword); + sslConfig.securityProtocol("SSL"); + SSLContext sc = sslConfig.createSSLContext(); + TrustManager[] trustAllCerts = createNoCheckTrustManager(); + try { + sc.init(null, trustAllCerts, new SecureRandom()); + } catch (KeyManagementException e) { + throw new ClientException("Failed to init security key management", e); + } + return ClientBuilder.newBuilder() + .hostnameVerifier(new HostNameVerifier(url)) + .sslContext(sc) + .build(); + } + public RestClient(String url, ClientConfig config) { - this.client = ClientBuilder.newClient(config); + Client client = null; + Object protocol = config.getProperty("protocol"); + if (protocol != null && protocol.equals("https")) { + client = wrapTrustConfig(url, config); + } else { + client = ClientBuilder.newClient(config); + } + this.client = client; this.client.register(GZipEncoder.class); this.target = this.client.target(url); this.pool = (PoolingHttpClientConnectionManager) @@ -284,6 +357,29 @@ private static String encode(String raw) { return UriComponent.encode(raw, UriComponent.Type.PATH_SEGMENT); } + public static class HostNameVerifier implements HostnameVerifier { + + private final String url; + + public HostNameVerifier(String url) { + if (!url.startsWith("http://") && !url.startsWith("https://")) { + url = "http://" + url; + } + url = URI.create(url).getHost(); + this.url = url; + } + + @Override + public boolean verify(String hostname, SSLSession session) { + if (!this.url.isEmpty() && this.url.endsWith(hostname)) { + return true; + } else { + HostnameVerifier verifier = HttpsURLConnection.getDefaultHostnameVerifier(); + return verifier.verify(hostname, session); + } + } + } + protected abstract void checkStatus(Response response, Response.Status... statuses); @@ -336,6 +432,14 @@ public ConfigBuilder config(int maxTotal, int maxPerRoute) { return this; } + public ConfigBuilder config(String protocol, String trustStoreFile, + String trustStorePassword) { + this.config.property("protocol", protocol); + this.config.property("trustStoreFile", trustStoreFile); + this.config.property("trustStorePassword", trustStorePassword); + return this; + } + public ClientConfig build() { return this.config; } diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index c409ff66b0..e1777ba6af 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.7.5"); + "1.7.6"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java b/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java index bb9fb54deb..6fa08e0b92 100644 --- a/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java @@ -19,13 +19,18 @@ package com.baidu.hugegraph.unit.rest; +import java.security.NoSuchAlgorithmException; import java.util.HashMap; import java.util.Map; import java.util.concurrent.Callable; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.function.BiFunction; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.SSLSessionContext; import javax.ws.rs.core.MultivaluedHashMap; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; @@ -80,6 +85,17 @@ public RestClientImpl(String url, String user, String password, this.content = ""; } + public RestClientImpl(String url, String user, String password, + int timeout, int maxTotal, int maxPerRoute, + String protocol, String trustStoreFile, + String trustStorePassword, int status) { + super(url, user, password, timeout, maxTotal, maxPerRoute, protocol, + trustStoreFile, trustStorePassword); + this.status = status; + this.headers = ImmutableMultivaluedMap.empty(); + this.content = ""; + } + public RestClientImpl(String url, int timeout, int status) { this(url, timeout, status, ImmutableMultivaluedMap.empty(), ""); } @@ -221,6 +237,44 @@ public void testPostWithAllParams() { Assert.assertEquals(200, restResult.status()); } + @Test + public void testPostHttpsWithAllParams() { + String trustStoreFile = "src/test/resources/cacerts.jks"; + String trustStorePassword = "changeit"; + RestClient client = new RestClientImpl("/test", "user", "", 1000, + 10, 5, "https", trustStoreFile, + trustStorePassword, 200); + RestResult restResult = client.post("path", "body"); + Assert.assertEquals(200, restResult.status()); + } + + @Test + public void testHostNameVerifier() { + BiFunction verifer = (url, hostname) -> { + RestClient.HostNameVerifier verifier; + SSLSession session; + try { + SSLSessionContext sc = SSLContext.getDefault() + .getClientSessionContext(); + session = sc.getSession(new byte[]{11}); + verifier = new RestClient.HostNameVerifier(url); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException(e); + } + return verifier.verify(hostname, session); + }; + + Assert.assertTrue(verifer.apply("http://baidu.com", "baidu.com")); + Assert.assertTrue(verifer.apply("http://test1.baidu.com", "baidu.com")); + Assert.assertTrue(verifer.apply("http://test2.baidu.com", "baidu.com")); + Assert.assertFalse(verifer.apply("http://baidu2.com", "baidu.com")); + Assert.assertTrue(verifer.apply("http://baidu.com", "")); + Assert.assertTrue(verifer.apply("baidu.com", "baidu.com")); + Assert.assertTrue(verifer.apply("http://baidu.com/test/abc", "baidu.com")); + Assert.assertTrue(verifer.apply("baidu.com/test/abc", "baidu.com")); + Assert.assertFalse(verifer.apply("baidu.com.sina.com", "baidu.com")); + } + @Test public void testPostWithHeaderAndContent() { MultivaluedMap headers = new MultivaluedHashMap<>(); diff --git a/src/test/resources/cacerts.jks b/src/test/resources/cacerts.jks new file mode 100644 index 0000000000000000000000000000000000000000..ab9a1253c3a4ec9356aa323c4f2ae9df5c69b548 GIT binary patch literal 110281 zcmeFa1yoh-);3Icce4TM+M5Om>6Y&9?naQ5kdzK-kOpaxR2o6LrAs6w3=sS`V4%-A z=XuZg-}n6Q_l@5%7`hf~uXXRe=XK3FuQ})K<=*8U1Ox;W_{aGAZvuBSXDb&g3wsk= zBNrDo3pNuYfR44PjUEI9r1~rA?qCR5O%_fdF9ZZMJTMR%8W;#=3xx^M#A-MgmX+fz zf!L_yX#2Plhzf_u5F!=w2^A6&78U{+@DhX!M1+G@gMq__Qd0rp197hokg(Cz!Ov3x zKaU9@ZEwN?;s^3w{Q?=AUG!=J05*W4o3X8x2|&@=%Ff8y3m|Id>}q9hWn$!N!_)cX?X<72z~5<` zfpXs<855Q|QzN7m(_kuj`SYX-FPI~2-j@$jULY{Ndlih$RARM_c+y)8l`ry&N#kV*@Gx_Kh!nQ6Bp5pvcP(yw|{-BmduL89G{3;c#^d&-Pv_r}iy3K|ju z^7it;h6N2?mov*3ztIm)=Utf}yY-bG-%Dw<{G3h_G_#t~`fV>~)BHUv;>p1D`vS(q zk9Q11aT#zXJyshxif56L&)5{r8w5B8`aWkl&g z%@%7dLTP_YWI&7Jk$EiL)6xUY18<-<_Yl#3)lYv!9DuInjxm*e=a6}k>&TX#H%|n3 z4~P!_m`Jf9A-}=E0-?cw0nx5bpkJMU0e?{;*Ze?=27?EK^LnJUcqIi^DMy|=H^}Qv z6e+`c@a=C6+5!S-3I(Lj4-kj4!IE`zRp_Hyb3Af$Ui1k+9Dd?#l&Oyqr={K$)Qhpj zv#m+P;)ZP_=r%?-BeU&Q@?`1=clq`du=U9ol`Bsv6`VUVB#At51pjkxuzAUWoZ zr*YH2X=+DOQB4^}KbekA3G&|5B;<+g{e6O`>Zb%-YwvXARpx4SNk(`&m zS`7Z_JG3)-nJ$VYdZQRNN~6H;P;&c79|JsqlGv!Dg2wwblC?pvea#uPS2g1C9ZXwk z_>2!AxV?qhJy+OQk1>e+LYdk=o_-Qp-DnRr4mW_1UFu#~cN1e1<|A{mw|b52CV?ZohSkrz-645<7& zki!A(;1C$$z%dIvBnpfX&>%-ITL-8G)BvjCA%X)C3o}*=D{~+PkQ@jP<|j00C?Xh~ zn2m9wkg}*~o6cc>>j^0WrU!&9Kx#ZHOIKG%K2}y+2MY(59}vBwWL9^V>vLCkx{5h& zIHlg>%t}f!O9gB4)q8k0clgm{c*5IXD;SC3uN4wP=JV(0(3?ya57rYrOa|@czWAb{ zzU^z`Y;sgEIlFUa8x$#-ao6NH?Tb5G;*%Wgkpl zH_DM}#mXGS;?a?7S74k6DDt4#4t@~mJT+OXS)=H`!@GTfYc6p@j5#9jlIJV&MPRSU zz8LR!zF~JL(C7otrb2QGgLc$4n@+5e8BM{q$_w9G=;5Y&`(s7{6Q1$!eE0ABT(EuIa23H% zpL-okg5%8_hs*J|4);H?hCryl5(m^3aX^8I0}2wNeKXd@axMxu1ZNBf(Cskywp^>Gk8I8i&pil^$ zRo@?Yptn}uub{udxdnPX7q9;|I>vvl{z=NcSg%gc-ukMpI%@(RXpE?t3GRFrSl_VI zKtYTrj-_gW!fey?FfI)CPau6LhStBF+#?N9SOB#Ms_>wv)xOwFc5>jB#E6dpD3!UF&mowjwT}=nS>2X zs!RyP5{cZ6AAaoed1d9Z>gxGae=4l8>C5kjXBEK^H*D#-XY-BtqfUl(<0# z;A;+9cSlTa)k7qj)YEk<))Z3a)7j!`(hcGp;`}#bquuGXz%eI1Q@JG;3!$wSDHSB> z3V#3$`pUSPjb?p|ZQJm>o)CBD5>7?s2wBie;xG^>yoHhd4#Mq$o@8v}!IKZ@8m7O^BF^ z(+E|K;oiYiMk4eZc|*AX;px$*rnB#9aw2f1hn` zxIo;T?Cfk;`O)pe|L({A9W&QcCVb78s(dGDgLF>ozJ4V1_^!7M6Nn))>UnV|$fn4{ zJ(#AxEIXtfyL$@`HrGFJWh*Dk^pEfCLT z81Ge=t=yG;#hkI8lfFyDM|Ox%GqQe%6F%!{ZNIYJJp4dRoz7v zPD4|BJ&HK3G!qr&2#KASk{2nN7>dEQ(vwOl&4zeA%f)}o(~AZp+7jpl;zGAvwQHmDAMU}5}A$&NrXD98Zk)@OI zQqVdV-3-|uU8sUFh#|LrG4t<9D%@WK++Pvqn$vRTOrgl^ywek#g!rA#yiuIIKVWms z%#vpdNY62!@RZBzecC`vRwWFS3RR6PF-@J(z6^ux)+|V^qEe-5uqFj)Y(N?dQfayqp8 zd|&c>>d}6;<~_oE(!wvYqTFvSwH1bUUYWWs*5b~dsHzgNl1wK%sm4an0y0z>{Yqn2 z-ve6|xeq=_*7^D{!R%UQ)JltCoH)ypm~MUDw257?^0m5vP%mgGt1oXD5QIE18M+4;LRi~!b#Rexy1@YrZ7Mz*d1IU^f0fGAkv1(5+sZa5rQ)zS>0rXsGas;s7> z`a_@veUG}4u?fCsURPS!)qA*hFxO%jDUkSv@^REu?=xTBLgMQEF)LiZ!7G;MV?7}egtL^JWj4I zA^9pimc#Y>T;R!ztyxFTv-Pdm&h)(WasE@RRFA3##AVA(lE&i%lQ3)ROJw){wiC*A zi>6W{eUF!q;1^JB+xOvmJ*~_Y?3NzCLQpFYO`$Elk&st{)yO;l)%d$4}=> zgy+Dsw68#7iI5Sk%p`Kmn|jfGd%=SFYU7u<93B_5B(g1%vP;SLqpuYD*%nf5nz_d#0{9PjUE5 z7gCE`b?D?H`1@yoB3Caahq(&`n?*KfHhT!@yQ!Ht+x~89tpCWsSiqM7>96iV4MPb8 z{E!-;p@04h0S*Z)Kfpi+aw9>*`~jQm^dEs-xr$rNbN=E@(_CUwN{O1Of1UQd1&V_1 zm&XQ7a($B8R`1^(a&n%GP#^a_%MX=lC9ZNoXr1UBsON0f3h@9975d{;U>|&~lKNsp zP0g%S&txb5GNtdax}M;^=zT#O+UOBJ*+<9*<9pVHZm&nRLs@yI^%i52-C)KpPORIH>(&y04(+$ymW>tTHFVF&by&v(=e4mt3o%>@-D`c0g8K*o*6 zO~)$bwsnlTSS5rCh;#Z|@jcNv2$zRIe}e3gNAi8X(-F{@_LHA7@XF$tvZ*$nK2au5 zSi(8yGA(g_v-;n|9|I!~tg|AgcFiU`SM$YdF zIvek;!~d?w{9R=D3|B2XuV~O7JC^YvmNCc~ zL1@zns^cQ;*&L)~;_eFy0|eZ=k8r&S5x!3LK0Q1tX2B?q+Z50gD8{qoXLX|>@T2o6 zSTVwHc((nSEOp++{sbwP!ghbIQV;TBuG>|* zRJ)Uwk5qeF5asidC?Q*@2VL;!p}tu-Y-UU%Uwpu(d_me=2bWV#pa8%|(h*6tLXwUo*R7=7?cg?@5=hub zUOAtzsM@wnf!_E{KHJ*@?LV61ttYTvkSlYdl)QZhkN{) zEOdfaH0<3EZm7-#X!I|+t(m3dIZ9&~jgqUb9rSp|OpN!`wPZy~1w#PD^T(O{M;H7a zYKHuUoxn*w$aAx|ZmBWhUcXaU5$CQ1>8nS_bebX0k-tV)^Tvp&m6`_YS{09^@$jE* zkaKQ`t@(Q;Smrl(WeKcs3;`t~R2dTs4n7H`248S)4ug8$TDKQYQz5LR=yz%(xEDXG z^k8i;Y!#ERK1lxNlK3+EUHth4s9{$F6H`1L_<<;l_oV`VA;e_w*HSxwO2-0}Wjz>r zsPos^Pey&FIv*-dW@xqv^XxRa@#D^>_saxnbByX;t`4Ba)r|47g2)lt4#y6M+R93_FAZLGmQB8V?H*` z1~^1gF+_4(HIgLJa^j4DeW|6b1;l8AqPcrfaWt4JMlO0gty^94^xQ@}WxUK5EO=9= z5J8V}2L0T-eAgRf%@3f(4Xx@?l#}9u^`GU{|Zdsjn52e5s;eru&%I+&rYr^2xW^O%)RK2wf{PB$_@lj!r$L z2h+t*;c~bZCc_h2X4jcf^bu_ll6~?7eB!?e<=_+!*Xixd&y#eyFNHO=io+%nSA3PQ zmaCLndsBfv_Hbv@_NhXEwYO9JLaCR!vFNY+gw8hER-%X<@;9SrzR*iO ze&ce$TnPOSEa9INK^F>Vn;$nKpCkKGj2*VM zxg4|W5w&oj*!bnF+;$bFp)_$}J3jQv<7J?J5+1}fu`;G_ zk?pztZ9!W?0L`F45algLwnA7kqs+XWNQlWUCt+NXVYJPgVNr^Y3QfLbvMrj&qkkBz zLX26kEj_dG%Z38-n(MqWjcUwPd|Narox9ijc2wFAAF{D8B<6l(7-Lad@#F4Mh}O@l zt7#iLJ~g!X*H%YjYUbwZVq$6LYG!L@<6w7F17*8i6QE81X?M_h;E*5-YK!vdN= z=nUv|%htriK_oz;o3H>|?E7;7sy7b;2ut2-9#Lh!It|v3zITs^g7qykXAl*T;>PfZ z{_^r4A`{!K^n(oqx-L}Sq#suuCg8*WFP8LonMEmb9_MldJx&$Qqe^~^bzTQfJ(-Gy z_eN2P(kBk4c|_oXUGY82;Ms|S4bONqOUUvjd0oCY@{q&lRVF`#R_W;+$|)N^W0~UIROez)!axy9DjOPtl)8@f z`P_=8CZx21voJp{9Ava!c}Zh@?NH`U;X7+)WsZ5i16?HC42V*rwtIqu8ncw`i*3-pn zKi+*l#7mgMw(*|AC>C5tjOM8N#L6l22xD&RF*ikN3RnWI1gGk zR`SNjUoN{}%y6v-?QWShw3}!jOH>9Va8C$FPEk#f4WC*Pi<#tVzbNF?%Gq#)O-G~B zNKHVpd%4W7+RK(`TXbp8|3P#0h{e*ypa-yj+l z;#q_jJ@^(7iX%_H+$JVqK>IChgS*jwh5X_-V)XZBG&&&76=;#M$yLnE09R_l_qDLt zo4K;unpqgxGK0Zw=W+$pn=64=jb~TA1%Tgf1@1dD|0jKC>_E^BGcbIA#lLK30N+Sl z^hSzIR1Aa7aSDG}(33 z<0`lCsOZn|Q4{0KHBllzT{E62mV_4^1YA48-vix$si`)YY!NL)Z6iEW3(8-%RuneF z6p_AdYu`J8jJ#$xL?o9;DpXSO>m5jZSK2WXMxn#p)}zAnAA3kF+8G@{ou1b%4PM^= zc3Hex2nEzhoqog(SN8znVuvwkr&PXo1u>c25TOcy8B?n4%7LcHp%9dxPeca}yQ5Hdt^n%*zf0av#JSy_@2TNE(Iqkbj*mW#g0}zQ)9oQL;ZqnIDaptB$;NsrTk{Q?>WHGtqDq{jk*W^U`bihr3f}rL(Pm zsz(LeUT3pY?sw>1ZakL|P~cV%O16u1s^!~9I%aF>bgUX#t?VuEQnv-Oe*lHw8-1_c zmgT+TqULo4J+B(rI{X?#?46!Cz2(ty>&x@Dbi4LmSUW917s+A6T(BmT$(a=1fkFZD zCz+HZA#h?VX=CyRL2^e~$n$BXe8uNUh2gXm1`J_d<*tR|LXP1S-oSn;IM*U&EOI#R~DO&HJ%bcs@x!9MU?}F^KoJ?{%3(pGhtO=I{s~Gs(D&>G85{p5X}Ri~ z{#m1B1}L+Euz{F2NJaW}#gCKF*tbqz%T-)pm%#~cjk{_11jn4e4uSu@Py0JCJ{!J+ z*2dyMmntsORVqlKnvOi~7wmY3Rr9(%)S$;NWV{-vJ9Sb1;lbOD&xT2eaTuo~DvRe2 z9=e2;DTh6fc{U*ZOuwiwQX8|yJ8-8ha=WH1i5fmxCY1r6wU*4I{V{qSln-%IV|NoD zQ_B=q(~g$!>IhtjfxfhL9j|^E$8L)!3PMV-ZPAcyZMH9pm;7NP^J|KMNn0J?m2CRp zoG;@E(y#9rKLNBXAWzN?etA!e#OU&*Cxf`G@AbRo>=V}52>J8pT*My1Hj*BPk_6)_zl2I{B#tvBa?T?X1C)bFm?|J_KaH%$ZRBdw6IHsOZ1}=vV16-v#QY zz<|`h1cra!9)uu5oy(J7`xo(pLYt*bjW*}oWeKu_f^(~G1 zmsMWJFjtO(*_rKHm%eIQ`l0{)!yEqtsHX;~gpyb$hdkL`mT442E)6K7RhW9&NFwT4 zgOc|3JrlpZ5wW~1{b?2~Db35q?H~wa@%mzf_@-iZS%S1zpF_j$&o4M}5WQ5LlMq@S zXDGE(r99;`9s)SLpbwv3c(OmPn=6>3BYe8FVJgbJJ;_@-mb=stG1B2rNFv_B9Qp1u zbH1y(bT@3B0`8){m?v*&(Zl9rFM=n{Ck`1e4IVY9=RI->j z4Dftqh&4}rFVgz!LlK^PrdXdc16JZ$ZlM0NiNVyx)$_Nu?}-P$pne|=^{duzwi~Ep zh*duKpUR_s5f0=HVflQ|=1;r}{b=1rx@p~ZHL?XPOp++hAAyL4drQ7?nWMiT=U z!>$}I0Nk>mdEL_uMmE^zUL*V3=Yp;dL06p%oZ7(u*AMtRR4-L-Co3WZY19rHn|+K8 z-0dA_vH=e0?9O)j_TGC*fD^I&j@@0FVNHlaI=<{aTBV@WYqR~Y;}qy-V+^xwF_9ae zJf34cs7ve!&nteh=fdKR0>>7V`|vRia0oMdg@LEZ3kh_g*y?Y#)SzS%)VCUD^j_8| zU{~3uDR)(th%QSiFB4@BF4({;43Vb&PaEhI)F9wGDyvtV1ZhU&-NLF#KnT`3uusg;n_v zn4He$S7c+|zIEXmJ_^V9!!)kFY#tF)IzEJMG1)$yIX7Q>P_K||Ct`LYKyPhUOKeOK zRj~E3Y_==;8;roGu0*5{Q-~H`W6Rb6#MYl|4}SG6n77`z+`L%6zt8}|SLY~Qd9<+u z^;G>b12rV;%p~+N+Xq~Y|)@udTHVA1<{MPWAxuM)qKl3EXt* z48pkPY8ZHIcyOf}oZp#(h=2q){udJ*Co704Tp>};%FYVhq6%WXuKa_rx=bN7Ot9cBbpTkD~OV;^M(lltv2dr-Wfw+&(-PWJrO_Um^o(d`> z!@UuP@Jn7ny2DQj39~OS7KNCMvh22gcJA?*;S}0XmMa2}3a=c|=|tv)PO7qWZDN=Vk2_+qEuZ*U;s_E))F04#H+agFvuHf_FLIQ~Y;#D}Lb8^=3! zZMN9obp&uK#PgfsN>7pfG+Y=Ka90Hb*lA$h7%mKt$>Qffm;e}13&H_n-Pj!RcLCu# zGrI>AygG}F!~LgjA*!fiaP?q-mA#3Bvm*<@*bCrnX3hejv%RuZ7l5smkueKBh#E+B zeFtok@56MwKQxW22mCbazvvg&zx^k(7y!DfC)3|3ogg+g4sbgic%<$s9Ry1#;6sk9 zkt48v@qgyq`a6eME-zb*6;k~^4*-vgXUf1RJKBycBOkrz?_OZh;CZjZMWoNNV_t=E zLBG*Gg)=^aD8mPv4~<->foyo=4h~sWKyj3BOKjdi+yQtB2{Kzp&;jR!>O1fn`&Bd{J#Ghqj&q?>6tZ)P$gB z_y|b<<$+YbRmd8r5Lt+xw>NI<0Yo$|r7Au|EKPh1nzZGU_Ro^z8Hpk<(d3sLXofop zD2&ZT9j7Kc;8%V*#6SJtUmWBwaI38cjAHt?&4f20pee1P3Y!Xzfi{La}uVhY-UO=p)Qg-cNCMIVZsrAm)~Aa=@G zefgZ8z=t>XA8|1g0#Wvb5-TxF(WhA#$)RI3n8^B@(}=_pcL)@okq`N5V6djcAZiEK z+0T&jtxRQ(+Is1Gk>GT%jmX8{HRIn~5@>t2kx0~8N7&h_uhaaE>cEolHC8;WE;O?P zaD=R$sBBUD(`ZQ%?Xyd-fG)38c8wQU&x@BuY~u&i7ccFCkr5&uM!la-q3Ai@;`d_J ze>y6M8?~}a$vv1Rik$q`KQ^kyBHcj>0atyv{R5+qewzEXR&2LV5GSUY5|~*aA>d4G zt-$00{-<+zf3zyNF*XP6`ZB;|c+*$H0EG#j$c2CbyTqaCuGP)^L-=;%f!P&zW(GP!5Y^BUnluBpR!?S92C&|s?Wvfy}XL9$GrgtlDCZDx>FSuH%_;qu~+vbC~5 zOoCON-4Ijel2;amH2!OGBbBi`YeVgBfJ`h*%rR?z;g{BLBu&GWb=_$vx{0v|j^}9J z;?iJ?NBUgU>h60&yZMJ~ZW9OM&hbiR)09s^|%f zAKfF*&a-JdPz=~vpb(aJgY*Ua*8fC*^wM*_BA9=0kI_e-qVn|IW2#kO=T8~9TNrX8eJQF z2fGzWb!|~?SDMp8_S$fNjFrPN0R!Raz&$(T-@P6~cf)n7fnkUgq!~1L5)<6q9SDg7 zVgfQ;xhFVmDtl`n8?%dvt%I8>vyr0}v$+|Njpgbji?NZFsoQnq-}kE#{;jLw|E;T$ z{;jK#|E;T`|4Ub2xmECxBNvbh#17)+;J$LJ-~Jdk2r7XWs=@X2tii%d;m6 zmbQT;jjtIQd4);LGKqI<{Eh2829a3_W9UaYOPYDXURGJP)F9c~z2~exvD^7c;{|#u zIy+y*Cq5E>6cX5L4&|kOb#!Oh14M6E6uL_$DfRi`xxr$CYB0!#l5KHAWuX!ZlM$61 zY7UspcIT3|VlE;>mY#C>+ z(*QiPbPdx>q-bdDwuQ@BMBOmSQ46H|*2nfMEMqSg(L)y4ygSghX8`keqV4p&62zuT zs}X}~p@J_&$2K_XB7b~{b+DWrUg#t>5M&S_hNHCjvw-D>$Cw3ESpN7L<d3u)@Zv|VcRVphrR~^6o4Wj_A4JRXHfkX>>FjEt7|mokpLu@ zAXrtW*RRh78(;8L`xo7U^$4EBnD2)`#nI||a zw>Pr=J*8@<`IS=ffm13jFx<&*oXcOEK^<R;(PF zr$wf1#MXPu_w9rYoVA@0xNE%3^0l%PxIaO#qP~iAo*UtDp2sN?@6u!NZK$2<+AkZz z7HjBdTo8qzJ~L{vveu-+Y$#-pQFqfi9ipF>Xh32#s~;C}z^!h4aDK3@r!vW*P5WJ{ ze+vwly=Cp?tts9dwKSj3x@c4npj(&kyjCUpo61>0D%d!{f_uOdU_i7#&Of?Cj!VAN zf7}AVL+1Y|y?UO${D}J16xAwv5?ow{aLUu!V6T8#G94UvDlW5_=QAG7Wx}?ShCxct zzpx2xef>y--RqB6(60S8blB4?oFZ*i4jw6lv*l<}scS5$;qAlw`;HeRygMjRN;u5X zt$52Xmn7V_?v(GIh}1rccf_!GkpagkLom+hJ*Xs-<83m!*__kO_=>9y8+EhQKV?t^oNRM+(#}=@AO3_(ShU#wPw%y#u#EIFoxAy}4w_b`3g8Y(MC!wN=rZhlNX;*G2K{LYc=&)eAh`SXG&Z-3m-QV>9KC<=(TaXH!8&xWC&Z+1~6$DZM6FhlR| z^N-sP6xq7BA%_v9T(jy2d5LqXt|SUkghvUrxT`vCcKR`9i9;QX93 z0`I@_yZ`xU_0u9?SHX$RBG~`*eAl8OFYJI{^9GcPh+9n2IH8$u1Mg}lf`G7F{s`Qu z^u4}|fQ@wD%mW|;-t5K9>xYwq$40(6@n4&kVgWMUI4A1sNvi9uu9Q`T|CJ&Q?nwl< zHvMi)zZB{JJxl$&83}(ZGkh+z&Ux^7YncYB``!@kxLmnnkkM)hKpv6V6!Gnw@T@_B z;@ywKFW-I`ubO(mO^3-SImg@6!bezZ@T}E0BhN&n-uGgb`TBQu4Q4VjqU$Jovay9zC(H)PrdufuQs{1V>e|ZQ_H@22Zn%_D-DQSo=Tvh=l%A2+B=U>n z+Ej`|JErj^k;iZ8-xZ}9X%{xQS1cxWlDef4nyE;xp;{z(;cCKKrD%q@sVTxDN+ef% zNG+*#216D^#gu^>%X{4(Is_PM-bOUW;v>0a z5_ln0<WV5)t)lV-2az_^br zpXK)nk|zNtQ4}8W+^~3`q!cSMJ59eZ#ahcQLI~l!Z&bXJ0M|4Y3*Ci|rF-?x{jZw4 zhbQ8flr=l7(POjXMzAlF9g5tYV%Qi;>TN|S9QKbD@^T&o6Fy{OH%jYWBLOr_z}ie3ErcTP_t7o{&3IGu8F zX%k3>jn-(I9r7%wDfBiMNRe4AiSGth?gm*rnn+P{t!hg35C7)pNvP{3W5^PBuR@NS zfvLaOxDQS56PM1wGBq`1?E(?}Qx6ECk++k(0uyJ=LW7T{9Q=xzmztnHohGN%an5yG zJP(yArpu&?{-#T7v+`Ww7=9muWkM_TwX$&H`xD9OeN$mIpC~P;#0BGwS55ocbgsb# z=?$^HDDX?C;ask4Q*xjvPEsO(H8-$y+(gW=E9x6F`-}3J2X&5N z6@rAr_vmK6_Qf{qrBa?MZ)$dvhk-=*!$_xlqWMLwNec-UeFgA77=IavExNdN2c$nn zAbxHKcM~hz>RpxUHv8!ppqs%yp#iKqWPSGwC|k=L_%jlhF&lqo0TWsb&0KN>Yx7`(|C#U$-jsxWVv?6IMaRTbhKhl9M;5 z0A4yxLzK_{bH%ucY)1TbRdm6RAHU5)LJ7k6j)^UMyyc~$3kqiVh@Qg6l*9GK#&6;|kKjw<&Pevz8CHTzI`o>t zps7xKu?{27B)m(lrxEUU(;sqWQ5nA>JI`erjzq_D_IRp=0&>9F5K^DC4=9D*mU26E zgiSm51$H3j9xr}IDxY)C=2`yiBtFQk;*l?9g%G4f$VWP_zN)!(4g9W$BxuiTW<)xPv(lvTJ)rbr`G<%+HzCw)04K$o~2H}wP(mGj?u<4}&)Gr6?{a$@= z2zcP#_^h zof4|{pNGvKR~+$$KjHV@EQKSo87^afr;m6??1gdK!>PQYhs&yN0N66chNmV(w!pV@ z>U>a*>DPUbMZY<}UNX@UO-cGlHFpM+&ra&Q0@W~>! z)Clfr%+ZVO+U+niXwHI<~k+d=zI6i?HLoRXScrtJ(k&2@+WQc9}Ihzy%7eN~sEkOlHT^4j7 zU2t#&B-}egal$D$?&tyL6_iwCS|e%T6k|kFd6R4-yI?2x7{|+h`;pQz{P`s4VyQ> zLL`{#NZf*RH>~}0%yT0Yj{FLMTyW3)XU-M(*`;S9&Anm>A%0x0ceLkhQE{|5TaTm{ z>dE_SP$d}zQdygIo9iY3E2#!561el0>4(R_NkPzRRB-0nPulJ7Ox}x)QPRS&6B$+>WZEQ*#`!tAw2{!x;J$FaT=P$2j5}%VH<*LlfEJ(Joaa z&X_X3MNl@$&LWEEFXlI*UUw+t+Y%Z?M&0gP6j|1l(k2<#M$>Ft~{Ny@&lTo?BX??hCcPj$dfqotW|D%ifyKJnm zr>lTIpXp$Op!>OEo`cfeEF|szS5iDkuSl{9{GQZ>Hr*3iAhje%2%2Oj3(Ni-qaI_I z3KbWNH)()i8$P{K)&h7{wH&1M*h(HEN!x+7L+oK5+WM0r&HcCMy=3B&3$#rLkXg?t zNKb{CS>-P1%9kIPQ`V}RMTe-y#Ea4|@=AE-0jXXL9r|Kxbm)x**+|KCm1g;C>+rSq z7g7rO)3WQJH9SVqgXczgZ9C>INh!wJJvhh`y}+>7;A@U*V5CH;M!Y7mwk9ybX`D7+ ziPNW(GZ;?10;KtxolYK5C`k^plgAqemz6r+KK@=o@hRbDQYaa}*~dJBJ3%2BTdIOZ zeC~G?0w}uI(4juZCrARCFDKB(Et?j)yn_SRR8+kd=AVuo!Kbs-w+QY%vOA#0JW3`K zG5REv{4Syj1OCh`pgNa#_!Iv(g7cma+7Vi-P-PF|M(*P%Xo-JB(Wf(b{!U1Ic(^j% z;XHWULp#x-EFm~^zokPaMkfBV7{w|`+(_|0#>^V0j~rp`B5ZpeTvlJ*&^q}vJ{+od zqN^IJCDB(5Vq?<`yXC~}&IEW3RGiIL*z?A$&83Ldo~?&TA62^jITYzM53v-T@PRKj zJxy9ps>{V=1T}tJQ;%xE+`b!mRP|CXBOh6gakiS^v@T2bSM>6W zwv=bW`1-Ou&G*8OAMiLP^g}^$jr=v3x!tk+4`1;+Fa9=TcTIfYiFM=$&Y>NK&!pwT zG&f1ZKH->3J)6-)LQ}xzT;e31*nw{hl`ru!{^`N9;j!XD3f$=_$LWsR6S!0wi~ zKWw+b%igK${Tipr%7{rz&Fv|tWc~bjP*V@*gS8ayw^#7>RZ-~Cx{4At0_~6~3e{Sw zl7bu$JnhuuSzO+m(|Hb&;fpoMjzIi;1p*f@7SzF!duF%BsDAFa}LEipsY9;h|jA6r3TuxPMcsMz5sPh?% zF?$6bl!uu1Rsa%zp%{x-qYzAsZg%Jjaivo9&@R*2=S#aoKA)0^b&EvM_q~Y!%`G+G zbjmcPsvR}X8@3leY*nvI<|>@}!_2NTv4H}$$hAIUdn?*PH_QY65H5$Yj2=%OQmdrg zI4c$&+jL);iSU9d5clJLiosIbp$L++sdlL`HuIN{JC0fT4m#E*o`j4lu0hYccsR)L zs_ZS&^w#-SGK!448L!DOLiH-jE?cc8*`kS=V~E9+!|r_cDtku!j+-MxrQfI|SGiKg z5ijHwUtblrBiGFE{s|Jtq>kJL{L|bQvyjfZ$MP>1(5gsKyG+{3PjJq|cXNf&PpvsZ`^&G$$|PxTd^-~Mc`)E4nuv74wA=-0LrDp!xXp2GUI2LLoS-mlY=;3Zu3 zfM5OZ6xXF*E)b9nJaWYj{C~K6>$s}gb!(XJ?gnY37TqaGC`d{p-QC@-ASoS^64FRF z(gG5a(jC$Wi26=I6n*yI&-u=~&v(vw|G*z}t?8O`F7E5P$5msnaR8-Ww%dpQuFL!# z-YQxC1E=v$s=_$=gemP|Qo{{-&TyXpa>)X}fn-y7ov=^WR*^7K?osMvEv zx&#`K<$56@QQ_1{W*sA)y_U=j7m(2RNRpXWpNLvgzq?UMOd zJ(GSM5e0S;q3JgplF`0sV&xgW%m2~vNUKPGm(r)W;Bmb5*=x@!U7-YL{+y^cM9-+F z3^U;^TNjm=u9HME_vS#71f@<^$uePnA(J4}S#GdHKYCjNKXq%>e4zCj zZvjkbzWIOTi~hlQ=PyX6LFN7;+fd%ChUc)w#YlUdcWv*}Z~3Bsc*6b58aEl#<(MfS z(EAbS0ImiO0Th@ot4}|O)*--g$bL+y*%{hc+nYLA+qp9RwBpP5J?1|w@+#3zQ@0fB zv0vOWi@UlqF?Os}>VH)KP8-_&QM#j13IF{R8r0U2-f| z3({VA%%*B@1PpxXm;3`($%7+2=RZLt>ei4P)zF7v-~_a>#Bjf0$*tv66l$l8d8}a? zz5TYeo*Qgw8#ljZrpp7|Kb=*gPJx`AnAHvbah?YiXTHFLsTMzLgnEqb;0HA5XC#bW zF+yq6PpHimCYi$au{y=VvGc2&8)tI~J{2>5k#xrWR=-_>cYIfVk0&5L&cceYoxa0C z$CauSfo5(_dzfcX+*9E9yXB?)>A@Bl^oBOr3M>SagVrn* za-`25J*Q}Q5YZ=6euec>a9&<+aGwzL7$v&YFL1)YkKCYvv4(0)DYFJ<^L2DKWkzdI zl{BWA#2^#m<2a?hfuw1(%G~m45x5{4=g(#tq85nU1LKZztkG?A^dNG{p)nC|Dy{4d zt@O@V$06~rp!j>wBMT9_g6wsqO&Mo%T*hIh%+ekRI`fiYl7kO5o22RMm~+S=TGqW3 zXo;Ekrl?SUZAT@0|7;j%x745&JZ+;l!z=-1a6;#RS*m7Pbb*@#=cwE2(P!Vs>vdU8 z6eY!9ts&&ZVT}}SKb~Qh<-0i zm)Al1?4ihKYYc z3js84UYBR-#IK+5M{p0YS^hKmqpJ-D7^47jv2d|+aIjx)FaQ(9=8W?VKr?P@|?P=y1 zAk$J-Gb}N%+#}V&mpA)G$y23iZ{4cRwVW4Gc~LF_hZR$k+2wI-TWrOF`Z7&YI^}rh z_E0jF-%@{DhxprP@oq5YchS@H5v(NntfxoO@kKvBhiyJqe3Bw~gv+pMS|rQ*P|ta@ zdVQsyy#fDeaf!Nyt-{d4Im6XQRY{!9`5{grP|8sBDZ$M^)IRq1< zq1wHTMFJKRmL+3{PN?trLb%COEn<>71e*N_4TW-1wF)j)%CUQ^UUxPK3KlP=HwM`+{x1fQ z_)UYA?6d9LV!q3x6=5rZPh3Ekg}(H5@K2H&pOJMBleB&+esYa2Z5^$hbPY`HuN@BS z@5E*^5kEZ+v;lxFbpVeedF^qq#8lWRHGD&pISvMD==n7AsP`QI;(;V@IUrG)8&xL+ zOf-2%>&KT@{W*2@i;eQt$T6<;~PyYcG~^zXaU-@(n7 z#Z=|scrz*?Lie}MN*1>$Y!{Q>>l)p8Qcyx8zhXs*Gs@^GSE}gT=)$YBXaJGy5tRIa zAma6RQf%+BI1-G$RjdH0);Z1!ob<4zp6LYkfeAKT+WQxIJ$u8IV>0k|QfCLjOZiit zFFno6d8zU(6~u~8o2gGaXksYiBXNA0eo$>5@E+Ulz)fx`?SYHi?FH#oY z-onC#y4HY?t>vjyp&(yf&A1Qvmz*t)inrQ2cUdw@xYo&d(_gVNAoar&kEBItH9SoC z^p?QHeOobi1B)YT?wwCMlH?bnqy1*-n)9(|w$fdsufK^TRrqTi1U%l&QMorj_xf3( za&yNQ4e*Z?cV4Q3MYIo@VeViqVbJ@`7_Y{azat^Hx_c@zdeDmn8y=>N(P?^I6J)}y zs9ic-aHln46|`im+?8xqg#Su8R~%-Df_Hk$Q0p!_`X1k-Udto)4%_ALVCpBD#S}V$ z_WR3dWmLsu(e;?ENb@{Xl{_j{g&YNTcli7PF^oC4J61KUaGu1hQP|RYc7sdKFB`_t z37x==;pRmU+qbZ-PP6eRGYd-=X%rsQLxeG4QJyu6LNrr%cRruD;`UTzT-iyeh|@Rm zKI1r=3wf)<5#8cpN~8;vA-84`O9Y|N#0^#DxJx7t)ZXA6@FPb;blNb1zvjmt|K*eZ z;)DKlQonrC&YHE8db7^9ltyQcbG;poZE}aeUwjgfy^EUj5xNKOW!v_7t0Lt2f_!;{ zfa4jhR(C^Uvb$EnO78-~=k@ZD^pD0YUUlFFU1lPDk)v>$e(g#PL2Ws3fuK~1DG3b@ z>5=v!-W;+L)MetV=Rl!(@zsc(PuI?VA4gLHMo9|HO%a zfCpu%?jeJZ*>#qAn7X$gbBg!tT4_IweXCu(j-vgv`SZK^otG$tY@d|yzM(eldIgx@ zTe3-*)^aRIR)Y=1rr`OoKbKF9`a!a*BA5J_jY~aFBHg_X58L|t2P^}BsbK`;JJYBf z`Z~1aOJ#BX?*el_GNY~;D_GSt2YMV!+poP9Y-zlM0WEY<4Jieo(M`3wsKkBj8vKk{ zv0OIL9frG$0Z=fq3#VFfRycwrlFXHR5<&*DI`F$!C=eg8rugMf>myY1q@WtLyC)I? z_#uqzfeUHdfpBJJ7VJI5+miHrE;~jY5w52Gv)<3Hd@{vts`Bgkx2p<{rLO7kt>BW2 zTtEFYR4#xBGXeh`_9KsXi?f`H%D5-=_Hw)8EHA$0oB?$B{~KpHCy4zT2{QgpDShv1 z((g(F^HvE+*UErQ{PM{!(cljkz^}~~T^W#C3}Yto7-oU(lCAVNNM)iM%QWZ+ zYz&m=aLtxAiF7A&%Z`49dys&A5Yyk2%^Fva^a#|Lkb(FV*sU_}pSv_mz*CiwC!cTHGcNtgA(s7LUtXb zbA@5|SCSD2y#l;mlNgehfnLWFhJB|pDzpy6?B79eKAq@+u%0n&{Rr%9LB4Npx1M+Y zwQ%yw(T4gNdv>H!+kic&l#}$B6)1+X@&u_~2JNI!@}Nf`nT!V+Qb7{87-W7nx?Tn5 z|7c16UX%nDsu#|2px(o>I#bmDzx{4!rlH--VN zIPjI7<780c%kO-^>+0yO1`5Wbzb%(+9Z?hG-1W8q#c?sSVHA0P?0S#>Og^D}C@X5{ z^+|e~e+&t+XwCf+bECav@69Dhh!qI=)`BsPR6AkF&^i|4w`e8`X>*x@Z#Cg^T~-wz zm91BgV5P<6wi_%JdD*^eNZ)`Y?EkV+#L`;gf$ad1*j_G?+s3Lp-eoOGDNplqELi!# z{ds}_PTD8OH>X1p2Zx=-v>JJPhn%<+U`nim*t1>BfvEC+Zor~=Rltr5NYzT0VEZdLo7Uiydn!Qgb3mQm}dTcSNc02 zP?+tz68G--1S_KLQSa!YOPp$o$O3YrFeNTe6r0gT(}I7Ao@VI#3rY>$ig|Q&5h7x% zy_)*d**xF6T*=OK;>MU3?rB2Ovr~^|tc<@fqLjsXA5XC4TE*^(nrPb)O&(e;KQdi786D_t{a9#Zm zACL<2O#)i+;eTieU_n5^kU)Xm0~5LJ82)8@m?-NToO7tJ-?SdMwSWEmP?%W#Udh!) z1ULqOSPBFXOJz_6-Dn(M${*ZXqgSp$QR$w@mC>X9ybo;fOC{Am=?1T&OVG|E=>=6@ z1v`zZ+$=-9+Qx|y+68HYmE>ceGh>)70rjX?XE7OUT3O&X7=57rlxEzvBBex68*AjX1xks zaaw*BJ~e706I|);SJS~n0{HNyyma~=PIh<73YUj*xY;n&ByS89IG^YkPo}(uc0gP+ zrWl612-zrp>b(Fu;_~|1$vVZDCI$joe1e@FX1^HzE`0Lf$ml+dQtkmOf<86KJo)|1 zQ;E8T+A+PM%#0&rXcszt0&A!br=1V8lFGO$!&hh@5T`M;)tEHwKzw4kvU37`UCS%U z6-!-x6J1L^puhh&bC+5<`f2X4iXcDOM?jFtb#3nOU|Cb5UfE^EQ-9j|ZyUY1GRr-X z$R(hF#pIRIHLx=^AfvSh=uH6!V+Y^}GGLg_&Ja-E)^)gIJpFY?SAWzW@6xgS5Y&Rk zgcspvtB}%R#`z5CNENem)A&$|AzVLIaV{*GM!H$2ea#mFUKeKuV5KI+oE7A~=# zS>6PsCmdsq(|yQdc7oL9kqUMCe6*_8ITe<%xrZMOkd#kO)(*(YeY6+!I^WPO_*xt^ zuXwVWDP^$Yt9>JVIxe6S6i8{kgkIq+NcMu`j(G*#qz#k7=YVL%4=AOPVPQ+b;V>hO zktmCaFA0NCrjiiq5q0HY6!z1+owoZ>he(hI6F~w*9pY%JMIT1i$5%Grg2Ot0kY9!L z4wKB0F>$QjXh@UAw>@TkkYcHWkNBlO)p4eo`rY#w7amu8Z7P&r%`ImP*ggXh3A>m= zx%Mr1Cj<6jo@ys_cw{H>j{IT)vyv)LL*`gjv~5j~60gNKc#}iPvg%TE`9_HS{GBcy zc`3w80}+Z%(6c(I<|_o#LQ4yGdgxmBw_sBg2*JhV`Q53;J605ww5VWvamZ?3FN=I~ zgZq|f?VlS3QEI`dY_{fk{9?7&_e1=CtpCPNX_+~ODM`^6t^BtM8 z;?Rfni>5%reuj|rY*R@r)1-0|u9Z%zzD13GPqD8i9>;uSeG~s9F7jHht-&jD3Z`v0;h|uce&Z{oY1emwjVg4RRV5uMdx!ZM18{+ zjdW|$@QktuwY=)owdGtVgs@{$1|kg?ALP4q3E6;I!fBB2gb&s~I_ITtWwvkG|2o_8 zyXDvZ%ohk;J~SCH&vX1(CkOFmaDcsRFaBs>%dIlx<*+qKG z=uVzTIGg-lZudvU&F;V2a`bzgSD4{pg2{H03fi-#;i06s8~HVoj^iL^jyBcx)on7(OC(iRiDyCcP0lch3-fKxc(3zqz2Byu z;K&BO5v9@PO{vr7hXb@ zINynD<@#p=cNqUKLrxlKg%v1uxQ(G$wx1vR zb*Cqb_7) z2S`5Kx&FQdvn2i8f+2kX#O(nfZi63)8?UI!?5pV;Y+ikflBx5KmwzlVkm^m=00vMx zyUjcPQ&LFEN}mY;(#+ReCGF4G<*sk#Urpx$tRF0_T)(FCH~~1$dBYd?Uw7rdL*z|0 z*zVs)Jv@zH`y04-iz+hCodm#<>3#rLGfNReFWGha8s{~j3#xbXe*)16Zq)k;JKXvu zD5ddbU|KBi;o}f6mcfZnW-lNncOajAakO09tWm~+#z{Jw*DecbF$mPemI>*quA6t< zcnvL(+7&7}Ur*Z&xd4hW&{k+svmxhD2?^VeL+~GOV6g{h-`TxyJ8us0io?!4KG|r# zkI41O1Ob!@i3G%Is?H*3JowxINAz5iahIjD8sGEO50Tih4WjI5tvqLCG=g3q!W`e0 zm%JFsoK0R%X!2ax@O}Np`eGbqYM#9mnZS8%2`*t*^*kk@nzN*Bu4woO4aUZn<3E-E zWEhhZiN}7r_ncE#L;8#PWMU6n^dF1q3N@?Scr$#gW`A@XB%e>+^q{6--xhgBw<}|l zoy5%<6^dh>=D9^=a}*BceL-p20eYMRkO{2=T2^_plF`LD&Mav_t=P&NaaOkszN_|L{?d@8Vg$MgQ)wP?bm+1T^j$At| zqwuK4C83uaKe5Ly&E?&Lq7wWJdkn^lHjz5ts3{zEmg=)gTOSO`L_2$RHN{qa1-6~M zo?#vcoAdcHQ6sv7WceMC5;@kB$wK1R<=DN`WBSjVy)O4Z)I@#FMW!df0vGhz6U~T& z)wX=s{~%jDybxo(Vpe@6!($zloLGHB?aE&9fAX&atpb;5(iC7y)i5(K*8*s;9=A#D zrv0?oKdUlmKV@XQ#i}kp?Dm&@SreB2-D3ZdjO-5%bVy8+Uox^kVD06N+>~W*Yshi~ zNS5ugJbSGndwuwCz1H6$&OAB%S)oLMQMUX0*7CZ3<@t}E8;5EIOe%gvqMaPy`(7M( z&o1$-O3NdxRdj(x&f&c;vd6pRJB9Zai(YF7SslWMk*c#cW^Tovt!pA|e@_@Lv8||7 zOqUJbjc#b%e#8n2d4Q{}(xKRP0udiRsYl;TNvan<*Iq;SK+1(bMkj>)B5{hdyDf8+ zK?%&5!^*xHLUk|u<4S2JwOj8zXAVBj@z?6zVjk2 zC!miITIus+5{;ExgfHu*q$bieAP&QpDI=Hl9zAL;d5YqI`|7=2h?yI>RDb1t*G}BB zsRR;OwR6WifrcL=9}j#f%+X2hNIg?1ecBj&_MDyqfx?OJGuuKB*rDm!gUor^2Co>N z0NBrBHeTOg)mO@j-sANjaI8p4!Sz1w5%_|N=lPVc6|+s|dCwyht_{+cC}wkdOnn?M z@~#ZsRNP1B5As4aQ-+t2d4i-JJjT?5+k|A1G!>2nJ}da`Z)O#Jm0~BLJroJy#r(8B z`#q8PNnPJM$w950P7BM3{mO1r#ts{zLlYTUhq1*T9Hg7FkN17q7kNh{f(s`T@C$4P z^!nqh+UaL4?x-%-@eMIaXDJwwE^a=-*yDB%DasBmWpxWyHc)ksGU`m)-M_Q!*$W87 z-Yr8ELCN?g6JluY%2s)+D)T3(`b(AOSF&(N48LV$59aBoZ1*P7HEN~q2u`Oz4CV?& zAs0uop5#985Oc!UC842xr>(S0)vyE?c}6#0Yy!6s3#Piu#N?%@@a&By>}E(^;#0ZU zaX+6qU3jpV*FbamK29rfE3R96zJ7P>YM_z-kOJ}r4YB%^N}je z@;rYhiv-U1w3a78jPW$@(MQSxMN0Ld$Q2BRg0jat=eOhPnJ;Q!g|<@&H2&%J73SfdWRDcz6Z-?n|@Gu zA#&XMbQ_FI3w}k`XZO5JlN%<7PW=qMzx*fHDVh#=eD(dj&C1H84-c3>M}GNZnf)Hd08r{z zPv-Sy|DxdXJ0Yo}p`DYdzM(ytn5mPgy{WYo3-=XoI-vE!e68RD;wHQONkFI0{eL3h zLJ1C}R zGCiU3(Z!uG&DqGePq4wG_%N3yi9O4N#g>~*Z~4&H$h9orFe~Tj*mE65A<_NsiAl=F zle-h!cce6vPuw=Vl{vg#n1{#2(DX&uZx#u+q_>^=3~C*z&kQ&OmK^DQdaQo>NBEuZhXe zb>gri?3#(mZ_>ktLAteX2_Y~j;AGI>tEGw*vdL$ovJ@wv<)axaXr~h;oa1}g!p5#4 z64Go=Z&*URTYlVLU^L+V_)~RvpK)tX3ISeCN4pf{z7C4qyZdhson1e_!Jg-y?qa6R zKoWAMc9^8Xm|~eCAeo^Pi6ZAW&8vqvc%w-J8F~b>nY?W0xAYRebps54L~zu`yv{ba zK(+X&e#7F;Zg78c{db<#$GRg3c^#S$b=;wysok0kE*HC^GT@iqM>FY^+>2brMJ<+?%)WUETm0 z+YQva%wMtqJSnW4Aa0=YdRYzuaNe&&(7*e7e+Tw*rV!$A=yIINwo9l&0euG$fszkGW1n>OCZ9p5+$!F#l?Uh+*0VeIvp|9^0<#kS%yQLkm%J zUIq3p==fa+mou#lUes#yn8H_EMjOGk&W^C9JzB&gr-YYJgO$s9F)ykGX}BWDmtH-( zyQ@<#P|eeh0xprLh4EYcN<#Q2z^#kn$;1M4cYks%E z1luY*W^;S+LHQIq{DEodaRn`>CRT^My^J~HK0E9*F3c+%f*iMXT)#+hAWi$zBY-2qyJpJ7J zLhvX`tlG`UdTunkKI_wy4`9@})TxHxFq}uN;pO55x{2H8o{57Vca9ho8XdN1zes8C z*lqVPf6D9XT_H6nuo#-20eTQvn-WXu`rOkzU)%(herSJ+sL!;fS4z*adq`jJqYkQS z!Sk05&^bn#gM?1y0S09cc@$beb$ibqK$O0z{ui$37r2wCdG~$A`qOFoHnS|s8C7Wn zzj^y#`onLH|KAMIfss*&a6m=23G3mvJk73Ct|gII=<}N)+3%% zl25iOBO4g=i4cp3#xhOFe4svDls#vzmu5kh4kFrGJ1ham0r>*K!JD*l*wAaOlQi&9A#|f@F)9KiqB7w2T=*6%1VJB{2%EuD76-06+eV0E_kV z;1`1XA9c6B>9@a4fT9%AHymhj4~6jc1^Ym+>Y^(iq`1lME}ybfy2^xy@@@XfE1HqY zo_P;7SsWC5C7o99lXRvH-atxh{%Hv){r0quSOWFAhi-?H_lWt?++3-qBfss*uYo>@ zfPGD;opWu9txtV}wL}p(o-Z>0Fx$11p5W=hDPNeNc#&;1SY@P0!j~sI=haMMry*R| z{snt=ibJh^@=|Yd_2K zEeH9Q{MBy$%;H$yRKdWJpmae`UTS4%fYd-LAY~kQpr&DL$ZTwC1iB>bg@u8pM}dSO zfWmsdGC~kk6dqyTKImgMDv8J7j?V<5!ntYju&_3^W^(%B=C67Iob0b&yZoeIFroq{ z>g%UmtK}*tspr8izCPP4WmUJA{I${w$mk9d9<`1-xBFw!`Me9x0Qo2~1}B+&0v*Hw z6hlQHJUCzm-kCN=B2QaLiV~v~hyps&DFTu_6g;W~*cfVNX}e=;<-`gMiMH>$=;jFT z>bl#$pFM0@LFSb%V9c8cy8DsoS|ErJ5FmFjwY0V~)OQ8iDgN3)B_;gkm+iU(cIymm zP*1LH7YYIltoF7Wz1)=4Z&|FA_)Q-K0w%oZ&6RFg8WAxO?p%*JN# zc?(7_OkdK%WG|bW^M}*z+I(nFyrL`s=(M-w)YuCbGM zd(A3{*F4@qpRLgZk7ds#+^P8j==r}JlqVB8LqqT*o(Ejzt;N2Q3dEHXs{KXha7vs( z?z~k{GJF4^d=L4raP;Li=LZfB7Ko%3v1~1GA_|@HvHlSaRRCn;XM?YdAqRM(~vO4ke{40jBn@ofXhGF~2Wl*z#SO1HIth4!>0OSVkf9%1(G~E9<@tUpo zrwQ`_y-SyzyMUz8RoC^^;f)FZH{I61f`f6W8E^LFQr6wNLf(DEMPVw99U>G!If-ov zi|vBxj*RcFF(7dBvfx)-;G(tH@h*>7giTjGvs8^8E(x~`G4@&ADUTbpW9iKyva8dC zSThh^JIiPIz>8cIE?Phd&a;{#1Rkh@tQstSIuckAV@e%pBk3cAf!*a=Nea!(ryZn;QOBo)yv-X)-kbweU3Q<6B{c+fQG2znO*=6U1 zyB)@BJ!g)bls%L6mGCz9HV-w+CZCFu)V9RQ)}4> zMvaTv?TejABTdx|wCpM94@*^&G+l&UF2uv9qKs#FTu{ugI|o2CdCJ1`WUnKIZ~ zh?sEs;DxKdB<8@a4doxceJduqO1c1>h58=R(5T#?h}UXOs%N{+kT&Ocs|YvdSxNLU zb|(I6@irx@yoFX0F8?>N#c#wVAvfciwo=S0xim?cM$G+u?`a?ip)2bboqNDRaAolG zK(T#`XYE#4nWT~_?fhgyYExi8paMDLiGa*@Fswd@V8PdqE+0>jeJ3-J17h5Vd^n)| zw57nLd2Fko9kKAG2mR+`zTgEVm2GIsT~|@r!>1JurVtNdNp ziPMc=>wO6QaB@L2%SzK1Fy$P0=OxCSE7SZlDEmWZ*=+QeVZs202>}?UIRu*L50+T}h}T$nc)0)L@!H=7gIB2v zZU8u5NjqQT$g6(ZpT(yC2cGd??P&el@6ok1O@|6cYRw)dlBy+uB5(r9?psO-jRukh zELc{YX73>Flst<88YC6IMJxCATPyBU>a15@48WMZPwN1Dce+0lOF zGUR36HEH%G;HO}hgY&pB$)FnB*d%tMsmEq3$|zaVmmq5iKQ$N`|1|qpH~L9#2Qiv1 z=LiE0|2iFfExLh2f0cbYkz{^@F8HTK++3t3VK_dNwJkCGyGi?|(Yv--?L0-cc~S7z z%eF8Tb!sZqu3#sp$eC;)+R*~ljMP-qsB3Ow@?UL`Kby>dbYcI#vq=sAG$5!}U|Oyb zFru96o$W6@{2=dJRs*zT{{U48m?VF+f&&EeQuoPz^^E@jRfw1bKYBGU_&i7mTAwYtI1c9gh)y53Ec~BesKTU&K-^Tv; zhc$7qw79*_ZsJQMk@z-(pcZnE^e>Tz1n(isb}`THJb_A?>d6VGv3L<2)g%%LZWpsg z;`!txv{Nfj7+#=AN?d$~DI8={4qx}Bow>gbaZbqD{k|tJ24%#H=lswJ*2A&1#Fj`c zOd;fB6NAKfauCLRPP-Hg&SfI*^!rd}X3hA^1tpbJAxW!O^YyQ>9_joyhru zp@atRDtrE?r!!ZO0n6Un%Fs^tDvSFETzH}I)7wE(0-lZxfD3RxydCi$Unq#@mbbev zb*t8(c=h==%ngv3XxA@X=TljKlo5cc0Xv}5$HfYa$6aIhUx)uUAN_ZLJrY-%Bei!A z`9+u5IS$u_WMiYZ4QpC5$o~1g9Q0Wkga4gi$U`-I;E`2JC?Q_-p%@z07)0<~l z;A~4%!#}V~uts(oQhv^m_JFc~&SQ=H%&w~OLATqfyMH^aYzq9Qu~4}&6k$8o)ajZO zWz-O{*|{#yuKC&>M;O=%jLJJ?Hlnt^Q~XJsO}QG#W)?}LQSN7FyP|cnvT6ND;juH5 z;wjqOqH_AhM_L_a7&Ep0#(!9}f4rKX%1RpAvOSISAZ0nOEDa@0qLmYyUNS@TDF`gGH($Ca83C28xgL_7jNkKGf z_L{sd5uC}=u&;^INSX41uvi)4_(EG?%PblohFEj4zfYk!(`*=TJ$WW<8}8W{H#*Ri zp-n?E`!#on8U>7Qi~s(ffKIcJ-0%#wh(O0 zWdaUar+cqV!05(#ISUSr=> zyE6vvHf~U3!1JzWr)1{=q-0)3BDl|tVHRhxp_=3)zX#oh`zpjMYD@@178CD}SKuox zl)wusDHE^2Fo}~mTYS0%C6&__XrM*C&12}Wy;iOEWtaAlzV5Rc1mL` z(bts$%j@}`LCXT4*Qm<#Ym~KLSrc5$G?v7ECRdku8h@8_iNULwxf4@=Kb-?9QT82m zFr`2u9L{JY&GX#X&C^#_Nao;RXkiEp;ND77{ez~chra+lWEWtF?SLT`{@CJv(|o(k zRQdYd+T+B;S%8t>%WxL~iCl?M(be9;(9-@=58luY=UM>DPgH6c~eYBM8f%X z@^yOa9x!8SXm=wn4~ayi#Ha+^J1|gAcAeq6?wY*rsJa66+?OT{v`_JHZ~~hp8{3sd z-*ip>Pq@jyv;RiNm_0pmYs%tzH>V=c#!1Stn(B*pd!qAOE+LP#larK)Wst&7Mh0z; z6sjg-pqB0j*@{Th@7-lkhWsGeKF`CwbD+sDB-Rikpj#;W4!LQMj7Akj%o~azIA{C? z7H8y;l>1A^F9hcHWv2uA@C*lvW9?XCH9%mS$s~R8hP$|` zJH~-Ht+sMSCzbi}`}r+xjfWUENETvbh3FGU_$R|D3S4XFZ`xS+q(`w5Uw084YdtxK zt?@u6{oqeh@yq`I(p&zgf&X$4Rgj;Z_;mfuFbeP#w;=DtHh&xFy^X?dGGUJec4NmH zr|ipBn~Eb}C(y)y11~F80IQK%CcNW7=+*K`+w?9~iRK65sbSZi!+5&+px{|3HPn5z zQG>t-i6vA}Bt7@@<7fTK32o9-PD*T9KDtBaFpSjpN}Ti_oUFaBl@w~gscyAA+JrCJ zKCD`UPRk_;QxmHS71uY zEU97_O<;A)`h7RKL|^|PI7{>--V%8eJPCoIdik??fLMI#3o~?wXab^FQE_Ohl z%C+(Tw)aYDfB(7nLa_reJP0s*ylaz3lZ&<3#@ifAkr|8Mb$p)j`u5j*xd;E|0f0^T z2j>_fCiZ2Fes#&KnSWCUV6@WO@*$!z?;8(12Emj0+0t>`VmM> z%ImX!|n0t^PDa< zh;T9mIlR!8LupoyE(CzUokR4q*ixCPwS0CrJMLE^{rs`$o?G3y z&#Hs^dfE6U1-PDmaT5$;ShF8TP$@D<#@{+Zg@Ow!g2cr)I8vt~4`*j6KQST3up9{^ z!J6uLp1Vj9IOc}jXg0sGy^UKhN@!d_wIl9-=c2X8V@yx*{NOF)$k$QBYYzZq?0i%H z?^r21A7u)_=m)^34CpOG6@_b7ZM-48YTO4B1I!>`X=MPs6hTxs@iM?l@t0-FtSa$O zcqx9{0&nm|6gCeeIHB=Ok&`yx&gobc>#FiGSdJeI2_MWM{_)E!cpMAy`X zL7H^5WTFt{(l7%NmKqd`NXqPFP21;n^61Yxg`eCwQy!!w=XKJ4VqKV7|f!pz(d`czCo;<00DS;Ncer z-%|-m)o|rs@c%Lq`#bMpzuqq|1Ekp@zX8Bv^@o?iF0zWnFL!+)azc~ej)zKm+sj;LmuUA8{0I})i>xh`3p931do$xOvG=4E?{rn#{GaCQI?EoM4 zADP+spL^?n=aFU>we?hq*;IH~+0M86f}iD$N`Hh2*))h?Nyy=jBuN-#(x>0M-yl{V z`m%)YzAsDf-o-I2x&t(?cFGRYlw6J3K z(d4FikRcYS`rQgs2{dbP4{Zc1doWtx8vARp9YUgSn++*0zOUodiS?-mQZX91UUR~+ zB!$RrcW7-wzJH*$u+V{`l2!Kd+-;7PoUJDQXcG?oBqS&KpzYJ6jdo2E`6%%iHPZVABRq3d?4zykWPSHgp*kol*k5$!7J%kVbnVB_ zA_7BqQMBV|rSH-_M~h(c25wT7}<^W8$dWbyb^!ces`LgPVAUi@c1*Yo*e>*!$)W5$u7CJjev6DJ_gF zxb3UEN;%y-kHQFBF8FvR{8%IqRx%k0u}@0KbG!O$U$}87LE%n4NfsC!9PV8|O%|>D zVT`Cj$qtj^Uq*$?+zLz>gUS=h7h37NQce$_yz;}?!biVWWhee?nE^&%{yw|k7M?5*Tt2z9Iu#vZ_?{!wc zSRQim9c-amH;rh=iEIq+Q2elJpW#JT>&GckA41R&D;x}>9dr&)2Js&0lv50K@eSxc zNPOOgG$dS}FoXO`Hmeq)SSRDPxPpG2QKQNHSrfr4-+B@e7srv-Z(z!$!Ak2iksQPi z*q@H4Cmf zof`rkB`Axl$}Jz z>6aAw;-@x^H0ic2=0%>7M(g8RyvU_vZQ*0xsj01&LqpB-%S)&2+?>T9@*G!70`6(W zL?fBO&hil_kbfv@<(SUOp!#lCpb#)59z8&`vcg6@1I#yM75MQbaWT() z%rMwk{n%K1VGu~npVtF38}QwH-JF2`ZDxh&m#6T8Pv8`~^g2eNZJRp`mQP>$uM1)% zzakmslwr0#38y{r&&M3rZH=mzY+-*c^6bIGX;X~va&GUb24r2QhR%v~~T!&44mG?EUYND*5}&a|Fod=N>3TQk1SV6ZZ?O>C_ZLY%n%I3LGaZDp@b+WWIv0-QH63 z=;YX+!Q0q3UMZ;)pNF6A6+>;qMRAT2cVm0<yW8gl*J?hRj9t9Rz5ZAuJv3;^4z2 z^*cK$RH9?FIaJgp1_V}2~Lh`1p%PWxjJlm{lN+0xoH-@X+h}jeR^IG+T zgjkN2NnX0v)N(mCV(EPK+#bl?oujo^R$-MY0bAKZL!Sx?f;IHlV;0R{jn>$?m=o^s zENk^87X*(zk_G!VX_n5z@oej1|AN&t%ZHfa#Ee}kGy8;44PGY9 z5R&GW=va2bC7SA|B-Wze*EYD4<%k(G&mcbasjBkYHkd3Gw3ZOjl4j0O7z+7r7AKBO zfCe#pih8G}^e*kxm3u?{DfJZ$7)B-BW#p91}cX5M!18!}?0BZjyio-*gZ~+~`A>!gGRIQ<+~ZRB62;2 z&lctB`1X9Wr?qKR=6kwZ+G3eU((Ak+c>Cb@Ye`FPIR#c<>MCqnj6*UxMgdO2udmy7 zS!1HxW^dxnE$e*A)!;a0r#f)#6KdL9T6{_Pc_t?x-8ryhbTWV)sEJ0Q#k_D!@x^AqZ2RYR7U4AJTQqc*vM3rSG8I6GWyG!(P%^w zsdS1ySf-MGjc$(y+oO9P6FW}ZLNP0(oYw+|4D05sMQ z{tFHbL)FrZSWQJtSyfq0MfFF*iRF5x%?-0far4~uSQ26}5kLv??`L*=&rSgv0RO6A z=6}zv{)+{STdJyE{MC}|gVzMPy-K(CluSwYM9sSmXUDSn^hpGx%h~L3@H$BJU5%kV zy$35Kl|!G$BRrRKgM1m1M~pfTQsyY)O-lTjbE_OydUDv(k6IaZRmu%2eOUb>?yq`! z-Yno>{sPZ3Z0PtfPRCO>7b&;7CH8I;lhnUdZv2H~hJ%8k4V4_?hX4ov-h9Ggk%I{{ zx0VbdL?GX?YyvvW`$8DSG&>`a8w|x$*PGzXw0;j$xUw~(1GaN_ty~URzgx6M5>d+1 zGV<6Cr<0g;~r`095_dB192Ryds5r0>lCf8>)^G;908vADb5}E*?yo0Ul z_YQT3?^+nYuVmBhpDP(W1>jDSfR*fXyOL2rT6Je@4)N{UKHf3ss4jX$Q2HTw1^U>cAPr4p zcJGvtpkD6mRadn)HtlfTlO&Dru^+8-;%)G2i?*$8l5i%W4f$3&N&OsWBH5a!zVxBk z?uOi(*&@9zy})Os(%LUJ=wJ|#U7Czfd88oBr5)fuJxV^4q5t#10V)#7%B<+t6mB8 zrXLWXMFBB6W`=Bl7!9TRPK(}D*nM9gH;r5(%Cby1B{6J@H?>lKlV+uOu}mu1k>}4> z`&=(2n#fC-oy!~xWwH6y1qRA99JUQe;b7GwnVr`evz#-S%7Q2^maSWT70AK01fn3G zRQM;FP*~Wk>^02ECfxyTXP0oZ-%11O_!iz@TDHXMqE1b zSYCHMHSR+77dVF(Lko)h;Qq5ykGmwH*1(6S@@c}Mf*qsndp?2&(~pVF=v7iu^d;dstNTYHP#j(&%)KFh5m^F=sXDX8}nfK%+>ehO^QfU&*vu25Au!; zGO_v21iE(5%D^?sxHv_au=t63hb)oXJ<4#v>5$LpJ%dg+>n-cm4k1JfxxZdOL=ql6 zm!tY>^tt z{SB`qZQwnUw7S6}_BX+JL6rh6c}Z5FJmDZ75Yv6fDL5tSzB-Yi+!*nB$n>zR{)Uwa zZL~Gm@EN|*QisUWeqSfVnQ)%urW8_^Hb(JnAT>!q&p9g{IG8fQe65loV73+Arr`{E zVrkwK#C7G(%{Zp`iRfJ4u%@`+j7sPr4cqDPB-ll|&!SVcOwx2Q>Yd$df@SDf7{Ziv z$1T~Z{Ld1oL@w`?GDD9#o|6f}JI~4#d~k+}YR}$k*D4i1+hF=K?3gb8u)Y%`n#&Vh zOme?d?>)?37&mEX1>!wTkJwW9_>(Uh=WmS_FMQm zZW{GqR{79I{!ZHI_e4&6S4uggLgkKNCb)sGjZ5@3P>B`?=3TSf^gQFD@Rk%e7Fe#H zc{>>7$4$Nb0#;)`W;ib>L)yjvlE*6x7gr+QldU0ej@1hMsU4BbC&#N*3#aVzR^7<8 zvlP;v;Cj4hvg8LJDVB!K8c&QM_U8#Jw1r5ubF%d4H+A|R79${dyfExmj|J66uxzrz z@$4k>O@?gk+9FrdAD@s>`8Z9c%>izf+YbIxi1|nyFC^}jS@lHu8m5kiD?zf?L#<-k zSnq{5Vd2OrQqCT|{LM=2F0>N|zE*g&jl9hib*b9?PDXL&VS5OZa^om2@YYxG;1{`S z8sS&c17$i`kiCb|WGpINqYTy$0_&q;tUv1ux!Aoy@r5p>F^qq})vtk!*v!n-lfNO9 zJyQl5mYSVsW-AMe5Z+KXR^OHo!F(3Io@#>uDsS;(##mh-7{+|Glf$P_0Quta(zyRR zNb`#$d8k}3>#xR6tFQ_?X-J@C2U(4e=H_fsk|`<Gp=d3lf=-6Ep{G)<33u1v z8fj&BU=6v4`i-X;?QS3+*XUP$n}d_tLo3&Zzq@aTm%lJy8o+#Uz=dPHb>CnfMxl$B z7r^b^_1X{s%onM z5$91Ciw&-X=I2j<$y}$U%X}WGO;exzyt3J7=c0*q${6fFBusNSSX&OqDCLIeSU_YW zliTZ22ev0`Oi9w9)hxHf%Poc=s9>iOl0R37{q#Hpe&CqKZ!}MHk5aDhMUi*v^cmNJ zs0PORm#E%p$rVIQDgwgZpb(1Mh8Jo=gW#kx4Dr#C8{x0ad$zvOZSj@Pj8?u`woDKI z;sv6fi@BGk^&^yAay@=03*Cf4lL{(U zdWr^(xw{bw3p68zR0j6p-VvQ+RCNP4w3PeBKI4-($Y=&8ckg|XR`$l!sjtq3^oJuF zd(`rj2C;FLuuOGd=AgD1Qw5X?-;s906>>@1R(}2FQxdAN+Ata7;ocy!E$MeU)k5}= zu=O2>t)}k5ULKAr?g{v)+s1NKGhgMHq|8e17r!S(ZsO^}W&(MH?a<)b;tX}kN3|0b zY9#v&bFv`G=jcgPY^|Fj65^vUDVT=5slKBdAGx-7K?(UJ)umv2WH~`HA0xFnFWZ}M zIY}@JAg{xN_oWJh*mfoQ8g)i2`UT>`YjtX|x>q(CTB&niRzZ2wPnvQ}H%opDCi2ZE zjis#jO z-Ke8IUucM9O`Is7){1Vzh_+$}kHY)E?Lxf-QG+xJ6Pl|g&*bZz>OFVJWb$|#M9i`9 z=$;kY<9t_+XD|ibi={)Wnv=Bx3k^p*_XVe(2b_33V4BFkn0`L44}pXQjBfk1Ug2~m z8ptNR$)NdJJ<9k&gYfHg1YKW7GfG_*1&|64-yFmghUhwinCG3ZFAYbS^J01-jEg%z zvM+cge?;Qaf5MdDkYAi`U+9BI;M)x&S*~xfqXa{-wLxK{OcS3z%IyrJv5*2)rIUdS zwcG(xREIAO28TY#ZKZA$aPq(8jr)CkoeG=r>kP5F+4P3Gp+9)PoY;`&Lyr7C?-`WY~}p2!et50C6Bz>o}A!Z;*<5a+(XePt=`YSt%j$(IwL(-t+w zP6^u#=G7H-Yy5l_`?68nJJ78q?5S#@P1pt1Mfz1iwl-FRV_9((Ummk6&AG}a> zgY)w7!pc#5DxAUsJ8y^*4aw}g5hMOC1AV3kYYp;gR3~{g-Y`0Jh2WRmOrg*wh!LBo zy|n)KFI)Gaa_2R>Lihz@uQF+tYU*GuaqzK4Zon7ywxa1;SLk=p4d3|*y5ODw;JN}a zv)(P}!b1Qr1p&p7(SDP77k96HZH+s)D=hY-NFNxlc$>nz8RTu}#^7wkf_y_O0L2E- z-$fjM%(ehWL%nnI_b0E>7-;(Dz8}!!f_bh*tPAKOUusfxoY~*U9+#VoUij-e>9I1Uqw#zKHXo(AI?YYDGAYIyaX+ z6yIYj9a_1rLe)Ck@WHgNeEsW};U}nkPduJZ&binnh#I|%?h&tWMGD=-iI{k3JK=$u z^n9xqj%(+T98JMlH32Pz2d|0nesv^dRK0s-`79A}d`%pQ{FClLDSDOFNl*?ae zqF({Fp|?4%7-DjNxFVAe#M}Et-!3ly4BKuL8z!AUJW_BQiEiC(c;0fqi<-6i(S>a~ zJzXS3n9OMQn2icjq*w}AW7=b>3Ux)wh%l(rnj#Wqxdr9oOrjecTFik3og|qW? z+st0gf>;(Ufuj&`D#B#RNn0keSE{^AG$|xjf3=|Gu}jN;Bq^yV0JkWv7D@H+4YC|! zyt2qt*pi++M>R>m0kURD)o_VI+ay5sl)oA4&ax+qKSj+QyaWDR)zaff?ZqsW4bd0$;gXl1hi_9eoEU; z8-zsdq{JD;)PryNbmlC1eO%d#1VnYPj7No=7Rn__L`&iVQ+aRtwYymSHziZE60NRq z=BJz=1@u2%i1}E_3TYO6e`DiP1G(D3t(ECDGGf=QDF%Y#0*PVFzxo8f% zfuxyGnERr{giLDbAowpVZ@?J9hXCwWzyNbVFLQu@wr}>MP%m3kBL^NPCQ~aw?#JbN zio7Yq&FW+XT2q)roo&>yWvEE?`+pU3jzPJUVj0rhhE|Om@e*_+(VMYFYXc3~FD7Rr7Q%72GqyL)Y5J{HsWV*@AP(grv7 zV!&o#Vr0N-aDBl)iMJoMM1IM$%)N_w={_W0{tiRvs8)~BlMF>cODndR719(t%%^;# znX4UGwpOfqjvQu*F+xWWKed#Cx&{yVX34eI8uF$e^%JbB(Dn^j&hJ(ja1cP z&A8c#ZSC-}3=$lV=^in6%;(VvL(f6!(0 zOX2@+EXK^ie8aqbkHu~d|4+J%?p)=c@Z}Uw!2+5t2jc{abbtu7V%1p;N>qxzQHlb6 za_CKM3B5wM5No2w8ET;p(n>55VJJ@Fi)w~?1H_1qS0U`4tPG9##+--cI@0|8ZygP` zgj*6fdl$ZvN}6`BmvqxTdzXKADb}*B7=2b^9sFtHkY-)ZxR4 z=k;PAR|T<9#$7(av#iijTBpfsl$8<-G>CaY9yO;~VU+pE6Pt9hyYWDS^>JSINbGGM zxDhyG946;g_j-9w3%{WA)4dv^RLC_CV1Fgrph}3(%xadg!Iz+~DDSn(Gj2DCd;WEl zvy7a!L<5|Z8d1vCuaeoytkf`)I@%o82eY~ z`O`JHLx2CULe0`+2&A`dh~MBY#~UyWXqvq(Q#7SUs|Yyd{HT1yq4Y$$Lm35}D=2*w z5{hd&X;Vu`lF`c-qQ*+XF{W(D#}6>ert);h{gh%pVuO|^m^3$iG4fB%EFThfSSj{_ zqVS>0xw7A_BqX0%l~Kb5;bpJloqn&!d>Mcie%Jv;_tBy=rcb0o*9IdTtjYL7{;-=s-)BYgs0V2c(*z8q)|GsxcnRQW2vRD_61SCinzyqy*a7pqZXLMKb}hlocK7h#f5CrZOI~i0J0GKS9;Ic{ zX;9;bwanEna>Yg2@oi{idwh27cz$(aZFdTyKs~!)8EPwU1N;JC7l1AeD zj*YKD@?_p~v9j(P>H$frOnXGAqm{I|xoxa3pF`_Q8d9jEwYClavK5)w+7#bJ@T@V3 z0VH!CG^St(R(dV9ZFz9Eo956{ARydy`a=2!m zBRQ25q&0zmm4ciKn1`&QofO(C1$9e;yEnBs(TqyO&P0u6JNm4>2-eiyPJ**xs8mbe zGQ-blGQ0~)h(UPl;4<+rCMm1g(H9(Kc)s1a!vH&qlVjv$mz;aU+>(ZG}%x#~vPeFv&!+~ zNvjw+pYuNU(HrESe=DU1V{Ccv-MH%L9fvsvtuLi9fxzx4L(I2AO;y#dNohzn$+KNw9 zVN^b~^G!o|%2TJz@L*DB`5dMr_=>zJH+-hldKsIxyhy}IXN+i$H`?uxVKdrw5sS^1 zU*+6;K*-?R-18A5uH~n7rFxN^?_DR@+EP%;GKAWlT!UM{goF(&$R!isrBSs&Kd7%$ z2yjta_Nx7uLAKJeG(io4#>WDlIqzi~+YOD~?YAHi^ME=N0%|y4^}c)aZg|=jmdK*c ztie?bp~myKf*HQXq%#ZHR5$Sav)b#1rFI4;TmYkx?z%{l1I|Ao8k`4!XAXci$-0GT zWDZo)r(LUD`NTP+2D0yARqrmdo2u)fI}rV^wV1yTNP2w6?`|JzH-S{x#gSy>vV4zPazj7}( zQpcw@NQKEj*QjQLQ2^s1QTtvwy_uu%&6A74%3lieTTazpHk>mh;}d3-yRkMDU=7)u z+8Y@e{bplQ#b`fm3>Zuq2*C>28Sbr(0cpuQuI05+dEc=q3E>|cBMbtngp-*O;P?>B z8QGaw-e{fwpd_IYpjC`)&F!5`S#X)LuMGzd0R;#XfP1;-K4h&PTDh2+vivX=1Z*K8 zKyv9<*!r^>^M)U}o=fqo{Op>rWc#US{{QOD{Zq8lBA9V(x4i8ZhA$^38q*@)8w8cn zPJ4w-6tf0)c2uIL7=g(Gp9(e7S<%fn}J;=xosZmp|>?DUcP(57aAZIZ8x;=dYY zxe+TC#rK$3?|2x4tAC2XMcZb{CCpB_brF(0@|1Zn(q{FW~0E72|PW3-d%Y` zvmco62P7z}{z9Gn#ozG0rBYm&otU|@IkNAEvfk;Ryj|udMmL2*z*@Sqlzss84Rry$ zE}J#efn>Y8t>3yEgYj+?O!lkrBMwTEj9qIB6+j6SGhApTF+G_4! z)RdUnL7d{v@hxd%bZ1TYm@02?Z#FGfbAA76)| zEFn!c{1T_{GX6YOrTMVfa_PBU$9voI+9}}c1FCI8-nTG(e1Kb9 zVX|^!OdmLI4I-p?z#Wv8w8ioC*=^$aZ(1&Y<5q{C|HK)v3Sb{E1HRb5@8x_I$C7X$ zD_1+@y!wU$Z)|=qfc@__Epih7?4G=C$o#kWTmC1ix&Qax`oAcU#VFsr1ji6rFWm{_ zL^0kU4dPJt5z~N|j`mjN<*_rs0Bch$7^YzI>6fhQQ8dA)C4qUA$}t6h^^UR&2x6%z zj`Z|$>uU0=o_w^W&)S(634hKfBNX~@`2@?Wj+#xP*lP*OXmsCWr(bpe`t z)`Froad&lqTYxZ|f-##u)hgJ8U5IQr(|-K;6H)w_c+sJ>ESSl;tpV38qfkOI(niJ{ z3w}j*AvV6}at{X>GmrYKR2SRR^PnZRF&KlK^bVaY@yVKjcqo(SP#@Sz1&RVtM+O>3 zp1{{+K79dkFXCnoMgNuGbNXX`)5C?I%NyJT*g_3}kmym8KT`wOyU5JB;^i)J-Kp2n@Fv=_&28u5$mmma4IM~jc zzS}vW&%GDOk3d(J{JsV~6xp+p7tP;23T9bq)Y_PdNdN4qE|Pjttb2- z%TR2afpldm1w5F}QS(Ab#5`?Pg*jUl3UQ3AhFcl~^$<@iE!Vjy4P7g;+`q-6@0Srv zUAz>;kbDQmVuYh#m%RVdz1B3%SF2 z$9|IWD`FHQFOyR|Gf9nHSeeIb`eV`D>^U-mvu%nmu6hynKR;C!lWKel0xMKni5414 z4b9eXv*A+T0K!m~2RC+daBwf8)!9Nis7KV>W9gNhtvxtR3>&xDo0zqF4ciwNs84rQ zx*68UZR-W0}#-t<{s4b60@ycmp&*!rX=9+fojrAdv;M6mD{gi|Q? zqv*r;D%8ooM-~u-81EyVR*fylQsv3wIXk-@W2JNuc_FPbz`TURr~k%RqK0%Y-j`$N zjfPaqG9$wy!^k&6N@!#mL!Vh~5H z!pb#MPdN>Z87rC*?mS5jVwtY2?w8PfU~prPIJe=^_cHbCJjL(6Z8Y>xql5q?@*n_- zJn-)ldC2$WCp3sBKJH2#GYxUh(mlNUN4|+4i|_cl|GHu5KOYSKrL~CTKigXLLpBTz z^Y;DzEQr5NB;HiTUk}p;^j`i6RZ6ozo%?Hzr}yLyXXI!(!y=0z zAky1e9@y$gT1shgUcj^Abh!HsA~Pi2$KTkIgDu1#t?NtX0ILljCpUm<8x&1Uj0Q8d z-_f2&iKb4~4UR(wwl3x2X-))!vq2BiOTOUyhUabO zOgWk%<|=vbHI0%QBG&6A=5wRONnVi!;K4Qeo|tr&d-=zol{O4{NAv_9pc^y($&-TrWko=a0qnbc^idtR%q>UgrSWF(FQ=-@0OhXcX#g z2m2~&LYx^eBs@0xfZlD)BwcGhwqO}4n^EX9W0J&h(wki$n7={2Kg6h zZm~NMA}n{Oen-jGUj6zCKf_-h2 z%pBKB!T+Yq{8L6?P(v6~HGSjR*qGej)yJMJ5pHR-%1zA2_h%8c;$4QH)IkWo1e0MY zX^M`woFYcT1zo}QmdDatiKu;$g8O#IsHDTJfT*^%xiZxz@1b#yuLh zZ{_NqVsu2AUaFh9H0+jnpbGc$7&-UxT32I{i=0X{H9n|@_Vyj=%+Sy1#n|!X3e21b zuFoIpRzR}ZM{o>{pvix0l}5NPTkwXYSrI~Qr@S%aT#V2ZV?hlx3e2r~Am@RwRTERQ zr3j{aI4!3UFs!{yzHI>AERj>@3DiEsNN@V%S$OY&SLOV)on|~9HG6aZ<)dRM={$Qj z+BTKZwG%_>9WD7XOqk`Fmb_5*Wj*H=7cTW$R%f!Y3nD6 zQu0+Vr9(P%NtrKTKU$JH7d%E#BhlKlBj660nF)?#+0f?pVrCS_|R1{#>G%|6q0)C5%3&2%91a$ovnHhfG6euRiomz+=5OC}8-*5?l zaPhzDa5`*5TM85rINxKkV13H2J6ksZHo|Oo%~Fs-STLLUqyOCrIZ}BN|0dH7{44g{ zq*)YRX4A`_wH?}jHdiYlyTA8=X6B7f&Fi4)k&zXW^CQDTUOht5}TC<(j z)5)z_%HzDKW`j|}sS4b+x!$*yhF__mG@P#>=)4`f2}aaMsJmkpv}} z(K_Z>)0oGR{-g6>D%{>&aG||GSP-_NvpeG3@u!+SDG)`>(pJ-gpFmWW>?+GTWb*IY zW>sWIO=fIg{&qn2Scxm^&|KZ^!#$?k5A^@{1 zNAwqMFB>D{G-wQYME8Vo(>FhIK4rO;%AP^*g?HE$+`P<1%n9Y1orAC)+b&C{cS8GG zpA{~Dn~gl_!@Uwsx$Y66cDii^)G+-Wu_@b=XJBL5Q)&@VDLBuw-QO{1mJYh^1)aP$ z<{q}ySdkr#hevXy#!GFz#1%Q{cR%NiHLA0s#uSFocc8^5nTlO*CevYX5qvUjf`jNh zZ`EWh(X`}3SFz*MB7|4nCf=1pI$$8*PW@y7yJ3Qsx)CK3E8$s+VWKYCur^h)K0G8; z0w*D_6~|6-rV&9b>r4#7q>F$zEcpzmyF@4N+xt-|C;iJ5Mr;*Ycq?}AIW=k!i&1B8 zwlgeXCZvCAFq7Tz zxoG%+McrP4Sk=tL(#{^3vu0)XV+;{cEp&YvJQ~ff({AdRfWo(5Hh*oQKj-s(=XyDS z0ys`KZkC%86+m+O=i&e0o&2K;K5OsQmSX`#$V&ti)5RgV{a$eFum?FM=X?cOpWfum zj8ECosl=U==LrOV%G@;AU8fQ~p)Ppfy|6_4srQu%Q)WLTXaZrZIX-ux+?jTbGX#bC zj=SFnt#0WQ3Ut*S%AO-XoC#)!*jKN`X}`VPq51ee>jgwu?)ca6{QCy8BJqJ7)8>5T zb@hRl={y3+y}bKSX69aLIN1E(9F_Q(84X(a-JL7+plsiesi)F~P(Hyg1gl(ofcOf= zGq8?>e>;7Qy|T%w|70*@^U^dL%b(3oUs^Avk1(t%1GjC$4vn2me=*H~e}D3`TgSFQ zqX#0su!Rl8)R)N_`^ZDlY|xTx75r;>@3=$jwi?vF8=5ByJ=RexoqLbmfmHnX19QNW zTR;RlM+3tA(f{t89NRqW|GAGg5Eu%9aD7id2jTn;w+or^;Bm&gK3uh&QmdmQt(i2? zFkA(V;v7#{+S$)c6@-I5`qooHVL8eBQtSfmP(qrH9qe-xsMeyjUsq_K~F1(;a6y^$4D^-0#A%fVEGlR?zlPfBemAN9A+d| zP;Z4<4+Ef?&;%5l&1>ZKe<2ovxBPT`?$V;J=jD0wl^|r5A*toWF-~MKnkW?nE{tYN zjZ_naY3z0bS*C1{f`o90&dx!*PmxH{xuYk~KX zR>h`I=+nN>uNjAX_@!15MLd&D^0*2%M*PsUcF4Wxm z(RUI`KT+maA1e2CE&Q+Gne%R1>3`oH|5J$E{IMPU;xzUGtlVBFOL98HbLDw0xRE;c z8;P3t{rv2V;Ub@NtkM=Da4*q_)2pQ1S!vWS>vyB(Nza_-sEm^LPPKz~?QrVD>F0uV zCS1;K47$Sek(I;6)sE|2@i+X|RLf+(s5xnX;e5ez)Y>7WhIZ-7kZiH7I?j82WXkFJ zq-|GR-*5S$imdUgw?yzJjXW9W7oH%`j9i8(0|iZvDx9ow5L5cckz5Bk&m+UzwGNE^ z3@Q!Gn7ffdFYj&h94pJC_~9i3lrJ_fq;%hNrC}*eyT8HXx zi2S3n4n^yXLIK=9F@-mkC@_S3+zm2Of0;Vrp|KupM|RQpYgev=`_>t2SrMU>N*na= zx*6<}h^3!^?$$+Ec(bfnFh(VTQ!C*i0a3h2nE0w$xc?sh4(xKn@3%GB>1e_le*G;uhiQT!zSOvHO zT%S6hS;m$R3=wtho~8Q^`<5R-Gt^wP_UE;ZBtuF!ZDUh|#WkyXz>+wQz4IZM#(Z6D z#6JQDLVD5TJpgMe2G1)P@Y&}P>&dfz%@`lry*Mpr)2|#Z`V=`Q=8%kj+!)2Q=ZcXr zAy&sXfPnd9uIi0T@dp)7==~E9zytv--~-}?d@y9bc$NX8(-AzR)VdMTR@9cef81;5 z!r*sc_?MG~IhomS-3i89CxVUmKR5IDdjSO?uK&}}fupXl%VX{C8dEU*zi$nf387GQdZ2 zJlSh`_?~$6W8l9vK1!$5h2~#ZJnp*DvPr(bG68?`kaq=bZu50mut#B!6}4aWwh6aN7@XKzhc0zexvX)iyodC|yT97a zRM`*9$C>f|L!J1+WzLEt7_+cen8>)&V#63LtM<@iUk(0r17VvJXol)ffeBx=?8{8g zG}j{uS4~=~1K!$$MS0%Bl!cl7O+UqL7;kd7xJ)WR_$N$(YXWYI>NQl|x-H;f_tpQf z1!m#j;ptzg{{ABJekPx9vvxqS%S}|n%FGVbZQZ}dpzHkH-NS#&HU7ytm>I-2VZJ=Z zBEtp58y5L&xz-$OJ>tika;9Xz6p7S;Z^@BB!#tkRWHRTbX@>NO%;4IDthM%a%-iTR zEO@=|zZOn?FOy>OW6;sdg7}_ieZtu6=ov4ci9caf=syS(X~#^`U{Kr-XYlvZczL*I zU^5C5U61|+9fN(kO+44zsW-m0PmS*FNU}gWrRm_}P!Nt|zx>Adgm*E{TeXGW-BEom zm33W(D26LVGL8%Lje(dvZXA%>Brt9uzP{pOd`AG8dMYPie-E1A6+L0BA@|A|hYA|^ zxIQJ_EPoMtGwTjEIJGi_<9Z1j|1wu2G)J&;y5}|~^RYo2-KL|>+Sgm>K!sW9uj}>~ zU*6{R%rZLsyadt|0mbKqk6B&+p!{#z4u5;X--HkBt2EZ@OnRy@G>VB?DY)osu^zO> ziO;DlGDn7S^(D62EAoctg>WI|(`5Ff?bVbk$#Xd2c1+!98R?HMd0pdL&m5j3l_rpIlQ^tC6h}Fh+`QG`VcxQQp7-dhESA9Ntg1sYcM2XO}F(GTs}hz^h78l z%wkkEKTKQiE?2cIUbTv=NzK1kSO0+6r%bxKE`5!lreq^Azr82uth~ej2Ol-Kr9uzU$`1$ehCcj~$Ta{y761Y&T|zaU(+ml-Jx6>c5qRAUOQALP#KR zfSd*_vHjKxkqI-YHzg0(_uo8{Ce+5ZsJUyB*Rh1@9g{S%Wcei~b)z{0T<=HN0FQ<* zYGq;NVq|-VaQHO>?*(Es|7otg9I@PFto z{)wDV5|$6nP}&%S-E`6>vzqmAh`~Idi$w$tQs@{@#I|>J@%QlErQM@uja0 zPi4PZYd)*RTEkOb_k{)_Fqqj8NP?)fdd!_8WJqBolf-Rlj9(598Q#Vbh)(jLY&Pez z$sXS@v_>USs-8}~O96zgHK%dl!BUR~zQ*RH)t7d1<&4K_^BrM~E@UIjJ%rdV+iMPn0 zEe$4k(b-nB#exe%y>9r1s534G+1OANaTl&d4cn1E|G1(F!}uHiY74;(p++U2@7q9v z_*I!5dgc4CBQ8Y%W}0QmQ=TCaB>}+q`K9UIFhP@;C#br^EeqYO2O@ z-5Hv$Wde^yUh)WDN^K~sjN#PK{s@9!QkH#~LRdtM0nDQpIv3h4Iq_L)KJu^Otp;Bw z78Qmaj!7%d892ShbR`_9!ZuEQUC8|+Ez5i=y1@1+#_Go5mxCZ<+eWo5ql8@klX8tn z1+v#^>xtG(i&2Y7N;HN!@HA_>YMQl07b$xba6<>kyXJ$dcUr}i5&j$ zUB)&blsO>ij{>^TTVjR;0@$(ueOqY55EoDtFwmbr{Eg-<^c^loj*^%(TxM({4=%@k zVFfjy>wu5(Hz@qu6YfCaP2dCu3c?Ckk%u?n(-No=UT^JpbllE};!}qs;8|N#m(^2m1x9Taa3g>w_TE~h8sgnWxi4)J>l*)^CS(nwSW*SZm z2x`IwF>#08R}CIW5wt@fo^x#mI2QCaGW(X6@FJ_F?Z&YC1@mS`*{_1tB;%FwyD8#n zN7_lrjI>^fp@a~ClHZRVuKb4OM2yzq|AK_xksE0wR=0iZT@0y{xGcfbG6l!-Wk{N* zTE~rHDpgXT3APXApzD)QFb`F@JkiH|8vEv^AFdLRMIKMUZ7#E zeR%7!!re}Xnpu#E*R_E(%`$zn6(Aeg+y2ciP?h&<7bpUDfjnRri26<;{iO)m`Q#M`HRav`K@M zc2XihLo`rbr8yKG6#l}`B~QETpaG>iO;g*yiqiv@?GdX4xNc{DkmRw3x?KPV6}G}| z8g<8b)%!;X0tj@A{SfcFW41Nri}LcZ@omMP>OG$ za63j&j4<5-SJ$3oqn3rxxpB$aX4+P1wV6#H#q%nEth&TjQ2yN=$uzhoty9=bbr`gu->C2YVKd*(qytgUXe4UXR+|K= zpE`Glb}Okza`>q|!4rz!?(X(>1jtg#&QaIVWm=0iex3Z(ondd>q6~Dg^?TW=W(!Qz z%|rHy=0TD)Q`=@yuM(zBv(z*wTkQupSyFNh8}VO;-)A+h6Cr_eLdem5DBg8OGt9gY zKIf=2U&AS|sCZHbO+mTdRDHzay+ zb-e(x<|eynVFOifAjV58!&bS0XQL%gI#^$uN6}Z<`APLDyy;Q7rh>lGMMbhVm08Dn z{|7__3UA}pv#hGHS~2lgLHWs&QTfdWm~?4w^j_?SwkZC|gT+sjH|RF3J{EuBV4!zz zHIjU10$;DA{1N-Lh%jkExqI1yRoB}d{G9T9eB^WN7F>t<_9rqeG};*t*jv_pl)k7f zQMi(Y5$eu0WV|k|w3@{V>ifKa&;&CVpIJ2W9)r_4pS|wFw@XwI>dnpFZlwTr#$NP}5ev{kZMJSlkx% zlSFSz?_^py3x*IdF61?EqwyIEjvg3IhMYpBSIlryCk0kv&KXQw^x<64J0s_b_0;8kBHvcX$a83XH0jS^mLEzA^ueFOM z?1@FMuX5W%OMeUPfKccy5lH>>>03tdKb2MlT=?q%ob7vB@#gS<<|h6rqqvaqep>@u zDo1DMy@6!tcFX*?wS5cxV>8Q24aaPK_r{NDQdw(#`C$qG6de5&OFTpSPtw&=l?+oxvte`$eW0;D0Wq`_`4Fd^NqnmHW1tFF~m}_Y0 z(j}DdWQ=FrMPzS)E8GI6WL8v0hHZV}0bVTU=l|xcMEfE~Fs~m6^QxkEU*8#V&%HVI z)bm+WIkd%d48-|t&2CX|I00j7g9agJ70qE3UoMxfFW;)I;$nkcwv+K*-DDL1XcQUk zd_5XJE{oz=X*9r}b2VRNJ-*5u5PhA!112wo08`cc(f{t89E&`&|B+AiKb1^ml{u>D z7l^+=?aqOYigC|ogF@GhBgFm;Q@{_0^EJ#L#m;K&DHij$`|&1DTziA~pt%Hz)OjqY zUY)A%PuE#A!JiKf8P6t)Iajxe^^sRk1cJRJ^R$YttC1TTmhERF+r)qTA|q1B4zrJV zJv{R*?~KD|-xNw>bXAHHJLiy%G?ENB+d!nEFC7SH$b_~}_rnl7?-@nD+zX;h`V#Xb z*ok|GcsuB0(A#7?n5G?h${J_7wXsv#D@w-|BNP|uZyLB^_gp0zhn1|bvcXV|k|y2> zRv^pnb(SKF6y#^ZO(YqoA`U+e>|#Y&qstQ8K+K{}FR!Q7)_BQz?-haHY;)Fch;i)( z{*g+QhI{rCF~Iu(AFvBRjF*3h7&ocJpx+(A|70rhM;96ziiG_Qs9aa~{0=GLXulxk z4?ofDSCPVhGJW{J;x7M*6>N1hhB-LXy8juk4?Fj>zm(<{X%JdL7qJK^Z}7oJh*TEU z_GvJle0J5W!?PY%&~iutX!*V4GX*9sX3`HOIO;Yl{?Hdkn6CcZO5W>V*=t1NJu$XYqJT8Q6%B}@FBW-9wphv&kcvdpgs=4RUR5;>pTePhV!OGyDCRgx`XP-2H*zpf4Nd;r5 zMn0a3>w$0<{OClHU7WR>Sz?KrqR}0T$^)C%EP4rr!P%a+#+v()Yjeu7Y(w;)m}FmmF8?s3P}G?w ztqRrU=Q9CwZw3F#7ptyR|8yL)LIf5;?zGURDka#g-|O+pifD`O=WYCx8?(p$J!NRY z4g_jC)}}UkfcTwyhm`X2Ps@jR5BLgWfb}ijiQzZWEnU%oebs=;H4VX_IyrdR%Mz|fx=H(@K)5pYOTAicd96(4RjeQvF)0A(ZQMv3OZKCpqyQY*JGqCf3R_qp_O~ zN^Toz+B{D+&Nr}z zW4^tm$Q{ne-Q)MAho_(TU(LJ5v*8fn3l6xDr&yowIvyZ#`{xsDBPSnt98u%{7wDw`DFCy@tKFay)0{;}Nu z;g4EYPy`4gW`i8PY#nATW({UFOjxUjMiypF7FOoWfM3lF4FySu1P+D^fgZa)h8tQM z9b@xm*x!0w5}V!|hmn~Alk9sXEKtU0&-lY`Z;D{uoNpex{!PEKC4OUOg&p&|jh~od zk3_i7z+SPju>E19H{AsZ=5(?46ek&*RPMBXv0_$BTfrEwBtjxo7#Yi7sRgr(*ALAR_Mjj zQ{uk2rWjlSeTjR|gK6N=>|M95P+)Oa&-#4` zHlt07XbxS_55Np!KptGUEDEH3NKJ$Y-?{z)ml9|B7{wmBI_ctrFeK~jP==B|bxmf- zn9hE_kC>oSOf8ZP64W^xyQE`X232IInE_&`Te_&%Y102g-CKrL)pqT|bc1wvH;WDl z>23s(?(PohZcrK&X{4p3K}xzo0cns1k*$?JnV^aBS4A^zjX1l*r;p&;`keF2At`q-|NhQ`n3|Mm6%$*c#;TNy{?J^LvJu=(ZNBW!%k z9X@C%o}`Y<)Prc2XIwae@A&S8?2sv~uVS!97BRqfIG@sS`-CnhO2_2nyPh}*dt~dC zeSFflU}@}?_6=71u|dFi{_eMOMu2HWJMYIL>&WD%F>-7(94XPhAqq8C2|}>nCgc4P z1*OZ(Elw^Tc%odWS;mjWu`E@^hw7;u-dvXSo`s zJ<0-$NSz6)DAvd8#s!ogz2lX);Q~YIdE^Q$twdEc#9>TmZHLkWox6biV?{Eoow?Rbo02?y69Av zEG`iZZ|#!?`}+iHKadNdPpDn2QVJIktoXzXfU8jR9}A40$Zng%@jORMeTYtmW{@T@ z98Bf5BBQtjS{$f_`>=f60Xchgzrot@@TqD{eixFA;{!&!hsPhp56o;Z_EEI`3DZ24 zN-n{sQ1jJIu%{brKc|+PZTk#_K9Vp;V(+0b#vpk?zotu@8YuPXn?)G;78EAE!(G(y zqay!r*kjmVGBJ?#K=!x>XhGj)V!$9_|1_R|OSjCA@f9~+I9x#Exup{BnsT^USXo*B zO-(sKF%B@&`(FU`mV0|}!=%80`2n*kDcC*IFAzZ(O2KKu_8$0tD3QSlB!GEUNFx&X zjmfu|g)l~}IV*?~m+;C9ADc%rO&5!n$I+h^@JvqyrFXk(Igmy9N%P;c}gS z7p}7cd41-+7}kl_W%ktdOUb8ctE{W!3C99;8g%&X?C&Q`t_qD6!mX%v>2@b|+q#}N zL~_J_^FEnIL2FNQac(WC0WDXpTQ1=<^cL(D^P&=KQ+tvTiqRd=fz?>SM-n6x74>4sGB z59eQGO%aq0my@Z?i8xzr3w~^UOIodrKgUim^V)@$d70sGWo7!q{Pl{@B)mb!HS6mK zb@Uh*8;KPonN>~u5ebC2(FB&+dYrXE4y==j2`|Z>`DM%aF1{YFGtr5M&Z0uu!9@0G z5S5a73o%l-JAR3vIG|t-!+aV$g%EA13EsvNPAp&@X~M@darI0iq+9#EPj4oi)n!zK zg&kHOA`TPz<4Y>>^M@o$Cz}KscTnP62JkKZE11CF@FNc(Ai#m?zI*R$+yMOs2^m%j zh_RiaBk*<{vEdgMzqPCU-3kA`b`=(2yUL$dc}pns!(qz4g3`z@vD0FLWHMPr6ZLQB zIQrH?iGWxoZm4xqY2PiD1CCAgIMnr-^F{)j4;Jyv7ypyU3+Q)KIuE1x(+Lko&0Ae_(pQ9gehaYag`Yvif(g|gz9B_>H>jMMJ%Q5=cualG5v z2?J%Yu`0kNm(!J13HeEhfL_$TdHF83mz26ePh_U*cpg)OD$yW!>*6_FJ_h|WS$Bg@ z%R~|05t}wCEVz@H5w%Pl#TTixbkcPpP{@D}*z1;-s#cb($~fc2bH|i<044W4_HcR86VRg&T};vUbTh z8siNeOG_}}r5Wg-T*d_>u&#Z|4!zv1Z>{E?rx1T!_aSvPDigG0!noN@?;9`vLam>s zRz}$gF8ru-6|xFI!K3EF90yHxrxi?KMGBVS2A*I^0yCEEEaGZ(x% zdZyoOzmWBupf8N_DJ<8}z$Bs%W~FNmPq0j6SkAau;yyicZG#GF3#fvb@XLd@yH+P# zQ(u?LcjscGRcPTUS}Aebm5?Eg#{G~t-ZS^#&CtWUEf%?vP`9-Ns?}OMS^Ys0NesCE zbe1521kugpBJhGcX9-5`ErSFR5 zG&vIyns7FVFWD@$Ck_)857KuHnjq$;JSfS!B>R$+Rz*sJQ^Wb3v_%0p&T(uULPWE- z^8Ks0Ci0ISCZvmIIxCQ_W5J*7Y*{IkD}x`>#87jjJQe|%X8R|4BNC=LUt^@}CW1tU z1%hw+G;PpZBP+)Bd5veWew>h;eL`D$gt;m05yO<bKUi>xr5q1YxEYlC?~Q zDR>csd|9#sy`D$)X&Gm*17!Md*Aa;p?Wv<*6`2x0vw4^w$PDWZ-?e76zT}DoYXS&o z^E=m??@RZ!(%*q0grJv8-MT7}*SR!v-GwE3UDZczEKCdC8r(9W) z1zSfwwdEa;gayfa(@@6DY4srholv7u)PUGR+A*SWng^+M@F`|=PSU<}=vy?@hwv^g zMfEGZG*WT)J$krw+A@p&jxJ~H67GSrktxdUbFMv!u@ZEmbfCxhxS8A7b#RUTXEqIy zYR?~zjpYsye$6N!D7>VjPLao(Y_p%vZg19-IsELAV76oGv-%~ej-%$vdYi71_{0cj z>M^Vr#mtqSzWu2eHrTE~<@W%(vA8^*^qexCw-`A`YJk>0oAu)}eAk5Tm<6XYN*|An#eS%0 zArPIJpvUcMA-$5DaiTn@i2Pjtix1P{@O(oQhnNfN*1Pkl6#7tEW|Rk%FCpq{AR^)S zYcHOrKg6tI`jAw36{euhnDy|2Mk~Bkx_dDUji9`_UWh>Hv)o5?ZRAd7=v_OiV?1uy z8NZG2iufSy%fl%x=G=Ma>KCgbl8zmiE5}6Odej{sdQmfkq)#nEU?MA7u)jIIYWD__ zhm23l!UAinP)>bA%uPdQe3o9ST@g1@mAim@${=Xwi(Xk-wH?Yga9)tkE+kTpkM7_* zNDIoI!aU9pZ51%*BdfL~&=KG?71{}?-;C}hg~=#+^A+5ZM_Lv(2g$xu)q+Gwj*J4` zw8RGA#i?#(67!Vf*MR4CvO4Fw zPlnIiTdhJf>xqfd?P7abQqlPMpT#M$7sb8E9L0X`*|kyX42k*KgzCK)J~S!Gw?}Yz zY|tWT?*q)E=5U@idv6jf;&KgZmWsz&_*4OMx+6apGW!zEy*K6@eO?e4W0WkA$V`c4pHd}uTh*DQUP2%^0VHPVp&#~uS{ z-$Q>DHRkUy4~Kv&{QZ`|wna-LU>bl}*oKjwSjN$ik(m}iee*7WM<6j$ke2*j5BRf- z=(lo_Th5M+8Cc5;xRImdyiF_KTmHA-|DWCy3ltA_BBw)GolN?RiJtMuS*4FMp?@=Q z>;)w;=iCTTfR?7zfEBhRd1?M(9Q;t%EV^%xbeZVOu{kMo4L!#G{1u3~@O7|JXBBR1 zo{SZ#ElC*jexhS2EGi}b%briDnen_+>n6=G8HP&}LN%hhi3dlAlT}g}U{9VUJ(1RJ z=$}MPL1R@O);o0{pLDHAVLb*38X%B;!Bv{S<*H~KritvYNOFwA#}=f$BGI4d>&GsG zvt@K-(E<5-M;vXUf`sY?GTbNfhjmRNXkq|?MBa~+ljb`Qxt8e05|L{0zCcTQbJCu= zxDKjpYlx+1`5?s#w@zs2px3?1jU*R;q~2`L^_Ihu^E!E03rQWW(CoP7Erh7M3P?$l z@=?{7g%jQ^=8=Lc5+%cqT$4Q~Xs8$HzK=VpmO-PjTFvbyo21WQJbC7Y!dfnLtZ#`u zF$inQ?`?TR7_DENV=xVyM?@+lNNAHB#y@!~@W|b*EC)1hB%KciBL^9jp@PLZKOV8d zJ>?u4*%ifRA-b#X0R^rj?FxR9VDcPE@LD{SIb4OgxUbo@tELkGUCL1canA z|7eHghJrAmg$B8s$O()!0kGeRL!d(ib&J=CqwTQLdd&6?3BI6Ef|(bm$6&@8Z-#!{S&v$kc%b7SSZCMz z$UgYWEYi=lw}#Y5H4BZ`bAEsZc35iUw>2@|PBqXbcU57<3YOSsM8 z^>rT+b3~V(bL=p{ND;hiPSrfw$id5S$o+U?J7apOxkwik~w>+!CWEs zr@Ga3sSSm&2YSy57a4FC0Wa9&w2-QyOL2Un#bXqu8D&2QE{?z{!C|Fb;Fc+Xt$=13 zaFWP~w5KX2qaZn?K}D-D=22^la0jb0a5e^tyjVbxrcY~&3uM#leef<-N?7TNjpy0B zb($IHf)9WbbUU9;LJkQ>QbEmNzcp;TaKTWKFJ4bH^4~?Gt>;;`iEmfnrt6nP`fa>; z`B@#gt@!hz>=N^M*Vfv8*;O1NCLHd?r*9`z)!j`5m6nDv-UrL=8k3wQLP(#pacw+9 zR5~!N7u-!5Pk5RUvw1@wy5`9l_(PDum_+XTNe*dTmiIsK4;bSo4m_6Pqf5J_g@cvd z@I66Ey9Ify-)S6Hli$=;KFs~Xctaq@>jE)e;tu1{84pvzsPm@Xug9|rb{fGm22srk z?r*c3jIhK#od4H)D}(_2J5L|uZ?q)DZzWfNvygxyE5Ifm4ptT*qO;v!{u}S~PuN}2 zi-c?vwSk_P$3hFI%HeG)(^X-^LxvuEjpLouQ?ygzobJ9Jj#p^GJbebQEK}N%gX_i{ zCUadhM=>k+$&UqIWVUBIqA1H6)Bj2|!cS-mYR-$1#Eh4I*jl`G13I-Z;P@ncp|i@l!R2!-7ieg`QQ7IdgC-h^iZN`hQ_ zSujG~gUk)vgT^tKR$TnZ(TxsFfbIH>*zDQpj^1Hi#TUR3Cs~lao+yokx~YvzE~9S~ zw5(0(K)WbfEV?aJG|{V*V6$?h-L_Di%?*6L3wO(~nF(kt$<#8zYBJ^3o>vJWvMGMP`lR+4 zVb6oEyv3HL?U6piLkY7PGG2*I4_LPXtEqfI(x8t$cu1~>Sc$!xCk!}=QAy1Leoi@U zCiAQ@#Bqz`n%(R*pL$;cC2DwJyc%wyg%i989||?EhhEKMw2A!67O#x1kC_@5A*e>= z6~hS_aFMs!Fp@A)g@P4+J+MWh32e6!sED`fD%{;$^&m{qNB z`9myqy<_C#kB=CNLAjwJ&YXOnHA^aN?{>F);&1wRO;-vTk0vDnSR*Z{vm3pZRIZ5>$)IF}qomUT1Ud~0_!EX;7<&$%tbFsRkxYLpz8)#tkpzbBnhx zb_|Nt1dJ#K-v&hw!Cb#{Mz@|_q1q~Rtx~S77FZ)b9m#Lf6YB|%2>5pTHN!NOl+c$l z6&WJdt_6x{CS$Z#HE$`2!P`H5E`lzNC5q+69w;vnVz{<7FVDfwke#-{c(EynP?&;S{gIux@;@dd!a`cKp zwH0Gvi83975&0Y{8UQhyS7}grU7l9LTk2A++EG=Qxo*b8hs5f}B4Fzmm#k+M34n>V z6UdcN!#Satkv7)Mag0tX`Ec3-Mf#=4VJ?U9Txq5p!-)8d-Pmk)j{d8417Mn-9Cdn= zo!vC17o;qagwK(L%!rMy-c>zoV!@d^C0jBo!m-pkJ0Ij!+Y9@A{6Inph=AtaC zT@>!#`;#t$%wq6F`jbJ5&ZBqa%;g4Jaoz@d6y3^28-mNU4ducuvvOMI+qF!#o|vW%|1Q$_n=RJzE-Cf$?9BL zFPM34;PaG3n`BT~Wv|XAbUOb{{9yQ!T^}JHu?S3yd-bEs_GR`30!;j&2D+#TySw%d z^xxgP`|Q-Wp;t!YaUj+3)fB|amaRC#0tT!lgv*i4~{GWfof5M+;y{dTSI<hMQD(xb4j6`Dylr`9o=}*74{@BQBo!A-=~Pa&vBK z%(R3b)r};d5GQ#R>Uh0cpOD@1cP!|#{J29S6-Wz(eyXxMI%NbMZor8;IkeU0K`bbe zwcVS6wP0s7Kw!*#>Uc?lTvW=nP6X%qCF9-=tz62Tl|G$DlRQu=q|6?b zj&k>S0y{z}nlSJgbJ5mp9Bmtp{dk*j&`*9DTB7tugu5Y`Nk)_$4kexM9^X@M~c0YHb5wX4-u^vz#&sNXg z5%@O;2Pdn)Rl);a#F|*o))pvur>AdeL=4pWvNqJSHzam6vbO?C=UE%xNa-1xIRb6L z;YMi>D7Z&Yd{csQHx=;4L~Ot7;sN!#ZqEPhxo&DkzRwRNzLV8s1d#sxR-l-ef1{bl zsBd)-@5807wnu4dp>VdixeN9Z1I&AO=K#JX-w{0*;G5-x{&(lR_6^AP_5B~WGQT@; z`qS0^n=*~CG4!gdgOs>DoUv>#d+g{>rk+aVpG|DI-P_-2^DRCpleJ9>&|AY>GQ&n1 zI2TvQkh|U^Cu)2V@*K<@+LoG zajkI?FLzASxo5J9wytUftb~_f$!Q4vaFFs{^-K2fl$wQ0DzS6Z!;?lUN^ zLlau9HRHuB$>2O;eJT{(%)TCIq>6Q7mapqyothKEy#5 zCgsR+dK=%983OyPZ?>1InThGmwza?6?ncgk<#REtf4&d?EcHePE7GJihkukB4ez#J zB1Ylz=exo3-n-#9Y37?Q@0%@q(;)IgZWSI4*~P_$@yCPRSTi#nfadO9K>G7vNB|$0 zSn$Ua6N{?;XaWCGk@;O8>PMx=&n4hL`!xTA`kj3%4y)&5^(zbvEV*+lz5?C-6q40; zv~A-r*i16v@XK_}avznq*Sw7$O3E$}ROcC;c`?B|?Z}la)hA2gcPy2ojLNn1P14FP z*2|!}FjuE7JK#iKU$N<=V{4i#ZV74yCKjQcTJZ6C@6%8WFS|ANW?6e!z9t?n1q~Nw zyvT|!a?zB$A}bK|rw}!DXq$>~NrHl;az=W=zJdz5ZknO9I8tikjH_Ds%Jg1I{kTw= z*`^LdY!GOgukA*kdOn`kHeBEg2B<=;pj6WMpni4Z4#@;V@uV`Y38``2?}5wbDugq9 z-)yWEAJF=mf-qPMR{@?FwNJ3#8eWm>opkRV>fiLl{cf{Ce}(X06^!NlZD!yn&ElYA zNtC!Sz#N+)UE6ONvA;dxZ$JPa7beY0tt{rPO= zW~pQ!Ub>Rf*$OW`76+=&?*gZfGsyvtGMF*RK73g;!es4j#>LCvJL%C5XAake31vWl z(p0KxKZQ#g#?X0%+T_V$z||;{?Y&G%2iKlxhPWQF*n+I~?t?RG?Bjh2vyTn5U>XlZ z#)z4x59(|wwPJK%Hb`T^GFA2x3Y&IAQ?-r&tGG#OO;OW$)0$si_-LjY^lyp3p`bF! z;QR*S_e^E7;AEW;h+hq0I*M|z19nw<@ex+-DJ z==pu)|F@BR%*6LeK4wl9PN0zT50dZu^4~-9-QMY+NWP3F1>~spealCc5NUz6%sn#< z%P0j9ym*gWzdQjDkXN?t2F^y%FSPQ_`K`(qiw9e7X-Kw8jn_wS1s8eyr37v9fhQ}0 zjZ?Ny|v{PoKEeHS?iRHz< z*)dm-l-3d%ycEI}XmZBiRXC5928o?C`24UuuJVFxba1?#N^<@sZz@byxE3wR`~~+L z<*8?0gSfED4O);8gRiBc!=3#QU!RP0p}T0ra6tQ}@0(;vex`U2Zv6Qh#PFj*29=a0AKrVzF7lTYIb(Qu>O=; z3ur<~Z@VJf2Evpf| z7K{siyq4Z@Z)loMrc`XoF3B57Oql#eJ!J56exV=5rBHN#MnO)Vn$2-<1E4NWQGZiErAO$P0y{uXwQxd3Qi< zfoc4Em~`8I0!-UrpJ_N<@Vj^ExODZ*4eGR^wm;GuV|nw=d~zHELoA6bXEjCxJ6UF_ zSSZVnnIois{k$C_K_VQqD-v{2gB2=4%-E4Ye!I20wh~dV&%kSv(Ip}QpO(zjB2dlQ zmKE)4K|Ytv1^Wy)Vy)4rdr;t@8*65>tDyygkwJ{f%(x9N`f7`RwC6>$GaLnCfd?3V z!O%k;_!eItKEs9PJO;T&+4he#out@99YywFegbcJGI>Z7nLooAv^k;I>QXakn9gGs z82gba9&RdsWKQ*1uSu8Q48a^c)#3`11VnFt-NZR?!DYslHBqr-vN1ZH=G!9K(mpr{ z@6k0<8MZS#IL*!SW#wSC+sk&v5$68IuF~WM{9XJpI%ZQ zBt>n*xKruYAH&*K;e2+uXPFKfbM`XkD9wIQe5#FTnVnd9UuAes&p#Jzk%DVBkcC0p zAx23{sC|G>df^l&fM7gRp-=E!5WTH&qWfu@BU=6+j8Bq z_8X0Xb|w8D1K;*jqxk}jNAD$)eXU*+LDBM}R)#-F%_QH;jht|wm##KUFo+L$FV&CF zNFL0pyV7=x$pkk}nXRRh!!60j@_l5+Z(N_Gf7efB22TL;d~v|Q$^9-wM*#_Jl>YW{ zYRT;A#iUMKjtJTPopuwi^WF2w#FXxd@!a@hH#h!KrVdouxg+#ge$KJDlg8ra25y?+>h{2*bQV^2?i+Ew|I5q&lh-t(kT8UL!af4y>Rzp6dug*XSc}rD<+8A~ z?gbG!(P!fztfpJU3MaA!u7mGG9=nnstBUG(JWqEpU82VriX3TSSyutpIL^@_!AZ8b z_moqK6$^E7SXZ`*Nf2e}2#W$CJhlZd*&|sMv2-iQJXk z+|wq(;v$$1Y^2>0_YZVjTZoi?$npD#}tL?G-;wv71Pd79 zB(6!}1-Y_%H61fEd7wWLZmacW1wx|0)U*4m&^Jr(4tGxi#gMuYIDRUvSq4S9Q8Yud zWyYn^FR8G}x%2U<1GtmkO}qn26(|_353u^d>(eMO>N1@}FQC3+4?UMg^7O08IXKd} z+J2Oq9^lAbJ3|2c=WLj z65JL#JK_3Lf)#FICdW4>Rrd3&mxn4d|jXYkT*qj+vsd8(}7#2ou)@bE#NcF18zSyEiwt1N43t5yOx>rbP@(k~U}$>q?V;iD zb%w&Oi~K{m1p#=&z?8ZtUL$S#qlOfjV{a3AU9=2nS>rDH{SZ@C;)4&XHY55qhI;@^ z-63LC{fH=)*wH(~ulcnw)~E;P+G0{I`-TxjT`G7s!(s^5OAXCKJqq}Q9nY3cNME1N z$hIHqclS_KcKhhE7JT-|0BcU5fYa{Qq4B81@(s80#TokKuL&6~XohPh?DHzWbbdV| zHk^tslTx?;!G3lYn12+u?|ZB;VT@C&Zv@EMPt!#7$Vl8jo)3RF@!Q6F)EkpT1Df|w zD~I?aT!I3q-I=WdKn@_2A(bH!B=+5G?{Y=J@d-xu3(aY(M*FWO`ueWP2GF4B-uf8IIc1z+l^6CY^N*kx1K+H}&%V

$ z6Vi;IoM8_ywv%6AO9=b9B{+GQ^(nClou^eHTQ@B!E8^s{=$#P`L!l4sDb_f8y^$t+ zrg=l;kgIK2b)qGn!c{)5;IhOHkQc(p>Fj1gPA@3@=yD&%V9&M|lzwA~Z;sC!#7}`ze#-JqQofHZ?HcN%CZxwru(`9LHVd49PS9^!w zC%j60_%*Wzat6q}e+0rp%N-;j%e*=5nKrPQCpwnI`TpS7-^lwLD7jHt1^NU(yJCTpkb$i? z-`#`%zdYwZ1$wb-Dsdxls^vw9mCgMVy2Y2Yiogs%cjr>On8~e6#IrQZ zv$--*h>jO8Ao7apUa%x6QZ<;g^)OajY>0Jr5oeSW8O=(- z)Md*R?E8yx25heN`AP_z$l24TYBtK?QHN=gdQ=uBecG8<^lyU|le6MaK8wei@?=#L z(tD85^& z506GO7d2|$LXaxO`#d*Wi;^+=8Vk-~>j<_HZh}E$rUX_$Ij3O$SgbiCi(1dycBn1$ z4L!*l@d4^IC{gETKWwVX@si43g;k3KnIJpBdhQ%%(EP{iN1xA!ghITtSa}#V2?bGn z4F<67EagRCNT=5$UzEuRu51(VX;Y`C^)**0 zPUVTO1l$YsexYD}sTUaES?*WffT-dfuB5F`EG%PxLF2z9Mem^?&`@uyIpDsIiv`q_ zDArrPl@&w>c`lRIyV9aEm_ZQ*c6wQsiFiny#EZsIq?%ba;e`^n&RF-7F~z>T5l6&Q zk3BP`5);+zX~e=Le>UzK6Zk=i9sx2QZFabO#}#DmLd(R5tCuCwbai~mCm$VPpNLuK zrX5UDjmA%L`rG4=I?QK^CxdfojZ3=JiLRN2$5LC&d<@JoxEkjrNs=cK-eDHwzk#2 z{+w&O2vH%}u|obxuy#o@Z@+h@&PR&dWFa)w%}37UB1USv*MTf)B&^E@N| z*1o*bkC@*Z8&~cbxK)L2W{l+brGMZ9L$0DXNh`Z@Ae5BWtKxb*9mm_Zz%PY8=KFqO z&9`5EAy8otJR9g2{!c3GG2eQJe=6(&J1DtX0Bo!`eKdavLj8Bh{4oQQc7JWJ1ifjm z1O>KN0v(HdrnPJ{C~)z%b=stBoJ`x4PKCE#Idi76c%Bcc6HT8nl&p=tAxCl=#b)WMqg5Yyn<8d_@NS#TN5*9F&=UrwM0EUlhyPIe(o4X&Bs@hGj@eu zDb1--tPe;pi5R~?bL{GKcYN-xqd+H{Md;+?9q@x$HRhjEe2B@D1?inJ6Fi=FVPBB( z%yqej`7xnU{g_@EiS9Nsi+x8N1>s4I6t=7QoELzTUjc6#f7Bu+NEy0pw+PDhBp~^U zBvQtw8o}?#*wzhqR6c9)>!4Vf^aK9SA^Ptk3Sg-px_2cm5Uw1&YH2AU&-n2A(}M{Q zNwzr?O5Q=%IAwUDKp4A`7*x@9)+K8D!qkF z%Cw>FP-&!S)G7H8v>`^{TG80LE@_L6nFxaxK|GJg$RplMxC{b_*EkT(YQZf7l`Cv) zA+t6R@R90(-kw>s>1x&gx@12A@xjpq{w$>MHRuPMJ@nF%61`en+*q?uf+jKEMH`$eES$0}d$9w5miL&+t(WhZF--jo8+o?~?tRD&(@5=*a*PFcyo|ZU(d|Y>Bi?~UkH^I<# zP4>z-KdOy-mTiZBfqF3Lm0+m(XXxkKc+b-lmSg^*ri1`3WMpP;W^MB02=uQb^Z?qM zG#VTN+5g5fGJiiC{(tZ6ALSYd6tuTr_8)$M8#n<*mmEMD19srds9Txln!>-0ivbxJ8%r&5pjSaP54l;7vBSbc~QZkT4*xsZLHtzsQQ4ZRltzHF; zPmb2J#Y4{26HlMd@zAKpOeQk7+NQYtY?B}khuyxuIuFa7n-LiaV;33n>J2?2X)IxD zaWk8UqVI;80ND(8r;{`oJCPI$<2z>k8lmy2HlbA#I42)!m=T(K9&H9Fy{w`hQv zK1h3AZykrsDL_WO1c5DLiW&?bCze}5rYq9m3!=07iNV_5|^Jd zqcimSHoW~~Q{NV5g=ZFZ$H@t6z!%2RY7cdJ=+a3qN`H$EF+>x3H9Eip-haFo)u*=M z8W(!4$b6NbJI3t>d*w8=}!Oib!JM-Rcg{87Ios?beSs)Jk`3> zkE18m7Dm3Tk~Mdfk-n3gEifN{$F3RNFY%P*Ecyu=kXpd_P#x$V2;RkqpkROeq5!#j zRwO6?qnHy80bS_s2E>BO4BWt?Ob%977S12T&4J@Heti6c`n@aFy5)$NfpwffQV6K7 z4!EhZ0*=r4wfwi=@1Fv+$u8~VR_HO8b77K$gG00B9Tw2(tRSLgb;Pey^LpDyq|e`evD~oZ1zf0F>?_E+XPC=d)%^0wt{tDZ&RyjJ?R03NI9Tl4*LyyEX<{*{RMKo(_((WIja}JwPx(Yo2->i7 z(k4}g3(=rRzmy|9(*X|gkfhP^jqHX!xa4$~4uQTw*X8HfE!Lewt4eEt>FkFI$}%Ty zk4k9bq}R?Y?_@3I|3xP5SH#xs<1()w=XWTU_O0$%rfv3JRx$TqBDQ<}%#Tc*vJS~% zT^WxOH+@{0B}n(~0P!x=e!|Q3Y)5Z*%!``C>T?V{fx_GtdoAR0yPXF4rQ#xRD@HrU z()Oj|tVRTsyvl2-w;ssIM0sk0Z(B+Z=+!60kwdrdRD!@hg-)MeCFPOm6EQG1ATi3`%F6z7g8dV;LF@hz5;mN!Mm z!|t-1W6+Bd$D~nZ*{{q8qTasMJ;)**BHMiN)ZOg!gXTwSMHcD`pR$q{tgj+L-KfYg zX5-R5U}c|vk(K~F#a@N8T8*9`sb8J*v?lRuHRYDAOnPFh-zOEL-F8L=QSOG}nB3P? zOgu}ei@&L=n47h+oF$NVtvB=asjMXnnea|g{?3jRDlD&--TNlDv-iQK1n`%dW_?gY zDbG}rX}h^`aZ06Wg})hSJ$3m1x--dDCaP?aEkXTCL$EXW9;4n^6AfZNlS8uQE z<^UXZ3!JSh&qyz$BErZ_1)#Wb+2GL#m5mIX?9G7Hg~B#gR!-Ky0>Yaj!P}}QVZl3n zn;Y^T_y+*E(}=pi{O`W~Ke;e->VEB7N+mqPMn2MA`w0!x9ElUTh7tMN zdrNTm$8(8%(j`Y)TO?J2h5fZ&&aawI`8n7!9=0Aaqlh{_=Tr0PI1NqiSt&FhtC|vw zL2jLx5DIpS+24~gHA70pCP7+;8A#ck0Ve%AFAt-+> z9w#re09R;b;Klqb!bXMbbp8vce!&u4V1bJfWRmA2-;)Q4^ju%zws;5s0!#mjNV>%- zVALzalOJAyvo;P z^+)8ddaKIlVJq)$Mc6L3S$&?_%5r}%e`SlEIr(bRf z0`>94%JS!Pen`(n0`1PchD3Q&p2KxUIN|D2HBEg}&zj4uuz-vr{U$otV75JT(E3yw zRo*KQ&OtKEuX1my9mP;BV|Uobw^Cxih&078+mB0v9f7SJ5N&#XN_bpwy%lzvEPl=Y z6zmN|ZHJxieck)LZuHqpRaR#aNv z#~KV3PrDR#3bR>q^@6Ld9|Vm6z!Fa;&D36Fb8DF!x^;r87x6Mnae0nFj7U?j5$imJ z&g_$QnEqBG-=#YKG%q3a>|3Gf7+H`y)gUZYLy@(;KR&>IZa#B;WWmu1r;+xh2Zjm+ z-lQ;h@nhmgN#IN!C8+z*pSBNp~;zQ6m&jJeL`~4~uj*F<+H44A=F=3c1Ko zbjNVnOz-ubM-e8f^N;JwtwK_7OS+*+*GWt>o!XCb_goQuWV1i4d^E@m+O{=|!hoek z^iE+|8z;|f7Mhj1MtgKNpnFD4xT<;%^w)*q5c57)LYa}`;d!7qiqB$GI6q;0Q#3{i!g6-hM< z?`JTyGmF6KCa6LBwk$qR4)**`Fy9}adVHT`oYGOcp>TDyoCg+PJpaD*rf!bvJ1VySB zyuFf^mLUOao?E3sV$_)`J%s@(w|k3wq;UFG3Op4UJ5Bkc_%EkxX^%s2#3pLk4!s7r zQ$BHhRXmobzqR>4MQZ<;Y^kyJ)7~Knf%FP4(B{FwP(V_>pd_>S^=rp>VkGQncGdng z{QoY2T4ru;?*Fhr?QLr`H}_34?pG@AKO#{3Kk{Y&36gs2(v&V-iEs&R@HibBPr5B$ zpaSIgIK&T!V&M+4KIG`NVm^{R57UcTaVBm>fqGU*Z=HLHA{ceXP)w_*o^3)YGql#A zq+v@8@nqP&JKL9GQ45v$v|Yp;pU!@Bz$@zl?jXWLdkOseA@k6GKaJ_6ouMr!;R#Ktg8@z0yzh%@DjCGMdvUcHB- zQ(Sdktr4qPM9l5WZ3x@Ol#E=|H8WbfD;t-gx111m}3E^?zdOV zPhT0%PLs$7C9^qmsC^#7VCpFL#vtO z5JA_bs-=pIlo1-fx4^Miyq=(SGRLBiX+-E!@^fD3pmN<5$W!WOzqyk-Gy;Vnzso2< zG>uppAs_n`mp&%8RPk!HqUCI<{wC-UA^DYiG%7Bt>AQ2|WOQ^<&5|!AW>~&-PdU4_ zX%9LVUu&wQ=Bj`U?tN|TN&?_M4d(93s)VYb;TC7aPD&Q(g8ctU!Q$OxrGxHV3CBq6VL;9{>^WY z*!eYj5+WXmBe6gnal7*yAVe(`RQ`e=W%oP>V8g?&;gh0wH~21J53HEGbM65*9S`4c z&Ioi}n1mISiOn2{&8!V<>}_rA^&Eko0kFl$-pJU<-U!&C!Td`a`=|2t@7HDk(A``c z9F6?@@qd=Y0V>L}Z~_GsSlMm_6j;75*>9Er-~ac%(m!EAb$qq3&{?Myt&POo3mI-T z$elJf6hTvt?X9a6(CF7()ECFdV#bWJgt+Cna-G91@gZg1*UaIp;L|n!9{j`s+S_kc zsq;?eYaiKhcJzuPCDNLJTM_n%+V zs;7{}W6_JgB(fHEvqI2Jx{}E2AQRWrzO?>ASb1bBIvnJ$kr@_QzC`15MPV0G+|&?V zq?922Mlo_3jTvW6PWIJwQHA+<1GkD@kGs2f%;#qWKA(K+)hXYjT&+G|JoZ^OI%nfV zqVchnE#(SgeCe%L`Vy;T6Tg?5M5h}6Wg5*O&; z^my3Ijg?OiC7i1~#i2)lIeyy^n4j)#^-!sTcKXX$K!m~3gI-F|SOv=i9rVTLjxA^} z0XzyzmAW1Hd!!cr{)8k7mQa-+1|GF$3 zxridd(_GrUX7JDuA5M0-;Z4yi+M#Q2@2O`S<=X&?)_^It5e-*=)vYv+ zHp)emBNIu2xWb6@&1?6aK&dwWA2sK)WLJep<nH|>fJHr7V=dUtGv^RJw; zPE*D5^iOvP5;)`=k_!l9#CI@;0utYZnQ_c0_SJ*i&;BgDKjDvG8Cd9hGmY>zdjtgw~dG@zwi=? z>LQRCBd0A|S)JD4Lt-O3-+XcYP_lRcW{mfm8nnb0oRVfylX6ZxDB7#p)1qho=h}74 z(TOHa(ovCy&}v+d&Dc2j&?I){7e|c=vj=f&v^iMEDxn&&K`&hb6hK4|Bed4Y8oaL9 z7q%5V3ILHfqp(q?CR)wBiP*~ZH2NJq+V-to31ia?8I?q4;9DDu3SSX;_lmwLGwk6X zZd-D5JNRIJP%0zqpXZB6vW<8v%ouMAnQW!g3N!3k3!^lA7pmiU;=*O5>+ep$Yxe7#v7!jThg@cGtm{D{#= z+0l583QipZgH%@ZJqAh(WzWzEmiN|Md?X;;-LFj-75o{?c<8=yWE3$i+vvSlgyrTB zSFWu$nVM0qbynv{7hWNr=VQ?gBvq{GVy*v-!IbTq3+>@6#sLxZ*^Rv`p8jE378d)8 z15u@>`tH;QvXO`TkoT*KN?Oi`w&AH7wRAOGZxvA!m1&-i?V%#i$b;3R#xd!S3783c zB2HX9aRLoVe}XAJTNiUJ4jKw&ex&m@#=HV77c8W?Lfnh?)A*UGEBkjn0|5ZvU(xKp z5Zc{~R_6k#IE+q7Kp5XV^LT@`hKBlw9o!b~G%aiD%aI=-z+CT*BA6~emn0Psp|YvB zn)Npx$nQhEI81?BaY2vWOc(S>rVUuRz94DU+FK@4t8prLtpi4RJ=t|EH!FW~j4#&W zF8_$0lzk7Ue8|FtzAS&fAO z!YY-@k}RCAy?%cz^h8echh&TGcAV8h85FJ#8|Fo8$qxd~K9t~;H1ixsN5slYShj3f z=?12R7F%tyLGRE2Oj=@y;=<#2Z`6@$H6x)UiXDS>x-OVi1ko0|NRVF66Cy6OcnAl^ zbc8+WG=g(g+wUZM0Q!kodiKG2T%Z%JrbDEa2Ssepj%W##G)UiQxw^s>Psl?WVKMDQ zI+X!sn@FiI31`iANJ8PBm(&?U52>=)+Aee_l_m?cD~N{o%6lta}IOw zoI7)$dp!T&e|dh-@9)|f?N@X-r3OoNZ9RdpC{4XPd(&FUi?fz#runPzf}~o^)nmR! z45crYR-EYUB-isEJoHe&9A|BKYGSx%i|G2odXV9(OO&ZLR z)P{w3bh0QQ^k5q{V?$*FBLibYqur{K@Qzx`0SMzhPCxh*xVRUjChP$^gu&QI2MT_L z3iyOjwVg)5&hYIWXMkGsBe)N33Y(0xSFa4UgOucq0Ho7?I+bQ`$42A6PE( zUI3p|0{P^Y<iXnNn z7R&jCEXzrdT=WJXmCB*Z9qMBDob(^Bl5{$j+H2Lx-GM)*h&k9gB0C#Qq?JWs>5|wt zi<#k#FVT*U_3lFEcd;|X(T(~k5r*2{`OvAJ`Rv+KiO5a0U2*bS80!B1O(ZRU2hbn& ztD9a{JS@Cvipl3mfy^@{OY`LuWtb8e03IQdg-OFC(c! zb7AmXxQRez&mF;9Lj1iW;=Lo1y(7|Jj0hJRsxloK_Gw8^E!!yNwe(GxhC0mZ1PQ#R z+*%%PH_oLP)iOdPS-a%WW|mrppO`*(xA6mX3D1`8L8I#;R{fE7k~_(53a$!u8#0}( z)>gWT7>4uX_#bGKKPrn=#yLI4Rz+U%)z1!*l8~ZPqitC)kYtVofBQ@aW`jAdH>GG-zVr&E)qKA*Cz=Jn=i>U zSmei)sayVqar_vDYIQ!odOU`|*Hkb0$h3oUKpAub+)teI;$_K^saflF9xkYsJ102UaW&uI@H)S5T%KVY{=G<#lo&;ZSW! ze-EpG76xGiK)nncG%X`~^I4X5zWeE9iO@Fo zi0STZ^=r}Bqba2#HSBY;%#yTI;UrNSd7w_*A9JrC#wPoTPwmDO>2ppc4W41-@XPS7 z9JBrZ3qnUc7=l0;@1qlK8}dzy@I&&`qp2(F-!sNSXxnCj?RwgYx#LU*(Bqcpbq<7Q zn)~sg$$2=PZ3tkVFRQOuOi7PkAdf8cy(Zmi@m+0>%7?3vYz+BK{RM`yt^n?|@J)J@ zzkOBUi~ZH@C6~kdbjX0xs|dnx-;C10OWm7MM5=)IQv|%9!1jzHBoANOZ>!+?sNOz* zr=%=Q4};)l3nirz6t_0Qq3UL%wkz{XNXZGjjdN|=%oJCEEW;rR?pF{2wIG00LlT@u zFiD_i4j}b@5@?(Q)-?8?{txc>CkK3oOXV2m8!gG1y!Vnd=|ZMsK0 znI>l$b+t_Ij=83IC9t7r9I}7(n2nKrz}33i}WbvV=^I)v{q|Q4II4O>fN_b`HM~1jTn^EV7vo6C9|7LFMDz>o^vT1kuG9hA|1a%~jhFWDhY$l`&lA9_m2BhB&ysK;`k=yohM%3? zP85_}M$lbS22e;vcmX@Hy%8LS2roZCH^+M$ly-};Kn-N?;%&@Q1d6%{uU)bSAtkF3 z6eyD*04@i|wiDckUfUcFAf^Uf9SmUA;W)9P;OXA3ssD#T{t4rXtp-`FCcG0r4q7bb zep3DT#nITBn2jL6@`l+L_Df}Ar5jYu18PjOPFLDEHaLq(nP%=;+(BThW(b0Vf}t#Z z4{I+rGlnrltl8fqYcV>C`p{XcF2Agc6j$SwIP|Q3+|lE^WUBT{Oj@E|@l&PBqal*2 zlLj_@v`LmV!YOBn*Zm6E^S(B3Oa?x4E%MZzYQIotU4|K68fdToOY|1L^c5=(&?K9VHXiaDXp9d= zeev?hcHd-97_d6oQsFKZT(71(c24qjf7XTUoG3X$OQtxb++NJTS@r$Z)BkYn4Q3pt z@B+|iE|<%_i}05ZPPB*p)HZY1{)Gv1;RlZROn9AYaa+~SUgIhpMVVkbALUGyBr-{q z6$jI6f4QF*e`_gWS*fUCf-|{P4$p=mW}e{T2K?wJ(HpQpms2)Dr9?*~Oc7&m1TKwp z8;aW)TGb8W+wkSyKJNKRitDc?ceZ2?4h>SVk*O{Eiyt4p4(vDg4JHocQ~gV!P#EIh zsUTgYuNo*w^Inx^ILp2(uGh$ZE!=o2xS21OWzxO!#Tao!n~>avNE>9ERnrAqAJaxP zM#^-_>HH4n>VR|c^qKv1RLg;+XE9vi#88l*&c#yBft-5@*g)W{{J2NpP-_bQtB!H zs?ONgdZtvXgc!r}Bl7Lo91e&ZpH%Ci5Sec-eiF6=r>qNaSX$s+tPnB_U5;MmR*V{V zVll|LI_mkpA4;X;zTB!laQ_Rl$z6f_K6KOAb)NUk57|-#ouy5$$Euoaaifzw48sQ_ zeCVDyWD_|`jU*_XW7E*VDke&goAlv%v>VI@h1``IuM=KXUT(I=Ld*yRE_R5ij?@lc zMYs`QPbA*HJw6=Cs2*&ulPBd?R6Q#u_>hY5f#`_pbh%4B_rQ%8sBUEykra>UVSmbYkx`>DN3oD$MeLYZB~jK9zTSov%huke$FtYmMSK<$!-O7(oe3=Eui*&M zt_w7#ZKj`k{LML8(A6gg%UZSg3_mZj%S*1*yX3$PUrIOSnuP0jQpBs#U03K;55AuW zAG-2=?liuC$MGVYNYO=cvN=zzKgn<_6I+Y|HbjMOiybriV(aLembG|eog#v9RT>q! zrSFe}_;?-_!EMBO??d^QsiW-LJPKZx*6?`*Ovwz|a_4+^tbu*@SoghD<7Vwp!QNUs z*76|2@NZlV~?KoiU+qiIe?-Scm!EWM=OJRVu zwjJ)q-?i-ifg$|Kh{vQyX}pFD^Lz5n7VG6+IpBY_E%(+e?TZw1d~%Ks{GOH;i;jd#a4}*<*++{f;wS3CdU&h5QNgFkh{2L5v7K%o+~sYsD8 zV{dnEz3SL;=cNqM6?HP}xK~zHQV|U|i#4=D3W$L1ChyZxsxSS`<2@ zg)TGtg%|jjx2J`n?DG zW~Ww6deY@YkFk!xBR3gQLoF z{I#bHu~K>@-vlR~o>g~+b29c4m0plJA$8HEV7iQ+Zn8hNsaC>uEYbDSmR+qs_gPpY z%dx!Cx055P!PQmA$cSN|p^pzVC^zWU7JZpc!>286jcG{}vx=vXX_@RzPIeo{Svk|L zBD$w9+!e^l5O%gd8F{(Go{!imtyqG_Xbi z`h1*i@93b5iQyJT!39!LfT)E#{pSYqCky|;p0W9s{9JT?j%q!PRau1C8ylH`3pJCl z>d%y{{7)IS-hK9*zVwv_IipLJ_>z_ps!osJoX-Wp(AaHp(Pq>pSO}3}J)J8Z@XZ#^ zt9-e4;nwoOGlB0zSvtDrYk0r&Pi0r$t0gM_zKp3Vf54AkH(g*tyL)i|CFi6OdWfrk zu9S=>gD-uwSV=j9)>1CZ&0u33E$b*WujvsCktnUB=U(W0QIgvz+$WUtZi~)rBO+-a zI#>&69G=q+rCDK=k{ae7_|~H^lTSkXRC+YA$>iib-CM*da%4$9DduE%Gok1yb6*~} zGYhmXitd`8*Vn|@W+2Gt7emv8Tx${iliL=KdIdvu?-RFa>)Nr%GcFfGPZ(bT`t?qoab|1e)`u1}P*%>&k%hX-s4!14DvtPdtlCFq zo^bp+d3Z&*lJRMuTF6l?$ELp?;nTT48$b>}B0A%|vTPCZad0hqn(Cy1LsxdHA90d= zG6w&Xld(i7H9WoTz18jKa$&Y=#bab@a>a`kkv6xh3I-mFXF66xO+xO~$fL_i`zCeY z4l8@YL_%2v$yXZ;Zq7Delq0baG*)P0`Rbv3@9p`uWv_GoFKs)qrm=WuY~=$ayOi#Q zAx|?+483cLIoHkZnRMhB%;zI};jqkc@zC(Q+5XshSoxM_`b5jk`(6=MUi~a29W?5` N4}_GjK}DoK{|jio=q3OF literal 0 HcmV?d00001 From 034e1a251316a3027c225f764679dcd004dd332b Mon Sep 17 00:00:00 2001 From: zhoney Date: Mon, 15 Jun 2020 14:01:07 +0800 Subject: [PATCH 121/217] Add dateutil (#48) Change-Id: I783d4ba2af19114dafd921c4468d4dbb640964c1 --- pom.xml | 4 +- .../com/baidu/hugegraph/util/DateUtil.java | 95 +++++++++++++++++++ .../hugegraph/version/CommonVersion.java | 2 +- .../baidu/hugegraph/unit/UnitTestSuite.java | 3 + .../hugegraph/unit/util/DateUtilTest.java | 75 +++++++++++++++ .../unit/util/ReflectionUtilTest.java | 4 +- 6 files changed, 178 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/baidu/hugegraph/util/DateUtil.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/util/DateUtilTest.java diff --git a/pom.xml b/pom.xml index 16459ae5b5..6ad3a2aba3 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.7.6 + 1.7.7 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -260,7 +260,7 @@ - 1.7.6.0 + 1.7.7.0 diff --git a/src/main/java/com/baidu/hugegraph/util/DateUtil.java b/src/main/java/com/baidu/hugegraph/util/DateUtil.java new file mode 100644 index 0000000000..71e89b5e7f --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/util/DateUtil.java @@ -0,0 +1,95 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.util; + +import java.text.ParseException; +import java.util.Date; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import com.baidu.hugegraph.date.SafeDateFormat; +import com.google.common.collect.ImmutableMap; + +public final class DateUtil { + + public static final Date DATE_ZERO = new Date(0L); + + private static final Map VALID_DFS = ImmutableMap.of( + "^\\d{4}-\\d{1,2}-\\d{1,2}", + "yyyy-MM-dd", + "^\\d{4}-\\d{1,2}-\\d{1,2}\\s\\d{2}:\\d{2}:\\d{2}", + "yyyy-MM-dd HH:mm:ss", + "^\\d{4}-\\d{1,2}-\\d{1,2}\\s\\d{2}:\\d{2}:\\d{2}\\.\\d{1,3}", + "yyyy-MM-dd HH:mm:ss.SSS" + ); + + private static final Map DATE_FORMATS = + new ConcurrentHashMap<>(); + + public static Date parse(String value) { + for (Map.Entry entry : VALID_DFS.entrySet()) { + if (value.matches(entry.getKey())) { + try { + return parse(value, entry.getValue()); + } catch (ParseException e) { + throw new IllegalArgumentException(String.format( + "%s, expect format: %s", + e.getMessage(), entry.getValue())); + } + } + } + throw new IllegalArgumentException(String.format( + "Expected date format is: %s, but got '%s'", + VALID_DFS.values(), value)); + } + + public static Date parse(String value, String df) throws ParseException { + SafeDateFormat dateFormat = getDateFormat(df); + return dateFormat.parse(value); + } + + public static Date now() { + return new Date(); + } + + private static SafeDateFormat getDateFormat(String df) { + SafeDateFormat dateFormat = DATE_FORMATS.get(df); + if (dateFormat == null) { + dateFormat = new SafeDateFormat(df); + /* + * Specify whether or not date/time parsing is to be lenient. + * With lenient parsing, the parser may use heuristics to interpret + * inputs that do not precisely match this object's format. + * With strict parsing, inputs must match this object's format. + */ + dateFormat.setLenient(false); + SafeDateFormat previous = DATE_FORMATS.putIfAbsent(df, dateFormat); + if (previous != null) { + dateFormat = previous; + } + } + return dateFormat; + } + + public static Object toPattern(String df) { + SafeDateFormat dateFormat = getDateFormat(df); + return dateFormat.toPattern(); + } +} diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index e1777ba6af..dc8d9c7ee7 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.7.6"); + "1.7.7"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java index dc90b35bf2..d0d651be12 100644 --- a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java +++ b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -47,6 +47,7 @@ import com.baidu.hugegraph.unit.rest.RestResultTest; import com.baidu.hugegraph.unit.util.BytesTest; import com.baidu.hugegraph.unit.util.CollectionUtilTest; +import com.baidu.hugegraph.unit.util.DateUtilTest; import com.baidu.hugegraph.unit.util.HashUtilTest; import com.baidu.hugegraph.unit.util.InsertionOrderUtilTest; import com.baidu.hugegraph.unit.util.LongEncodingTest; @@ -57,6 +58,7 @@ import com.baidu.hugegraph.unit.util.TimeUtilTest; import com.baidu.hugegraph.unit.util.VersionUtilTest; import com.baidu.hugegraph.unit.version.VersionTest; +import com.baidu.hugegraph.util.DateUtil; @RunWith(Suite.class) @Suite.SuiteClasses({ @@ -90,6 +92,7 @@ VersionUtilTest.class, LongEncodingTest.class, OrderLimitMapTest.class, + DateUtilTest.class, ExtraParamTest.class, LicenseCreateParamTest.class, diff --git a/src/test/java/com/baidu/hugegraph/unit/util/DateUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/DateUtilTest.java new file mode 100644 index 0000000000..b84384e075 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/util/DateUtilTest.java @@ -0,0 +1,75 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.util; + +import java.util.Date; + +import org.junit.Test; + +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; +import com.baidu.hugegraph.util.DateUtil; + +public class DateUtilTest extends BaseUnitTest { + + @Test + public void testParse() { + Date date1 = DateUtil.parse("2020-06-12 12:00:00"); + Date date2 = DateUtil.parse("2020-06-13"); + Assert.assertTrue(date1.before(date2)); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + DateUtil.parse("2018-"); + }, e -> { + Assert.assertContains("Expected date format is:", + e.getMessage()); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + DateUtil.parse("2018-15-07 12:00:00"); + }, e -> { + Assert.assertContains(", expect format: ", e.getMessage()); + }); + } + + @Test + public void testNow() { + Date date1 = DateUtil.now(); + try { + Thread.sleep(100); + } catch (InterruptedException e) { + // ignore + } + Date date2 = DateUtil.now(); + Assert.assertTrue(date1.before(date2)); + } + + @Test + public void testToPattern() { + Object pattern = DateUtil.toPattern("yyyyMMdd HH:mm:ss.SSS"); + Assert.assertEquals("yyyyMMdd HH:mm:ss.SSS", pattern); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + DateUtil.toPattern("iyyyyMMdd"); + }, e -> { + Assert.assertContains("Illegal pattern character 'i'", e.getMessage()); + }); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java index 79f365a1dc..7b402daf14 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java @@ -91,7 +91,7 @@ public void testClasses() throws IOException { @SuppressWarnings("unchecked") List classes = IteratorUtils.toList(ReflectionUtil.classes( "com.baidu.hugegraph.util")); - Assert.assertEquals(15, classes.size()); + Assert.assertEquals(16, classes.size()); classes.sort((c1, c2) -> c1.getName().compareTo(c2.getName())); Assert.assertEquals("com.baidu.hugegraph.util.Bytes", classes.get(0).getName()); @@ -100,7 +100,7 @@ public void testClasses() throws IOException { Assert.assertEquals("com.baidu.hugegraph.util.CollectionUtil", classes.get(2).getName()); Assert.assertEquals("com.baidu.hugegraph.util.VersionUtil", - classes.get(14).getName()); + classes.get(15).getName()); } @Test From b4fb1f7443386b8d1301b993851a75a6b7b533ea Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Fri, 19 Jun 2020 20:07:27 +0800 Subject: [PATCH 122/217] refactor RestClient as interface (#49) Change-Id: Ib7153dc7b8d3bf3df9d19662b54cb05ff14c032b --- pom.xml | 6 +- .../hugegraph/rest/AbstractRestClient.java | 480 ++++++++++++++++++ .../com/baidu/hugegraph/rest/RestClient.java | 423 +-------------- .../hugegraph/version/CommonVersion.java | 2 +- .../baidu/hugegraph/unit/UnitTestSuite.java | 1 - .../hugegraph/unit/rest/RestClientTest.java | 131 +++-- 6 files changed, 556 insertions(+), 487 deletions(-) create mode 100644 src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java diff --git a/pom.xml b/pom.xml index 6ad3a2aba3..d2ab1b2365 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.7.7 + 1.7.8 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -62,7 +62,7 @@ 3.2.2 2.4 1.11 - 19.0 + 25.1-jre 1.0 3.0.1 3.21.0-GA @@ -260,7 +260,7 @@ - 1.7.7.0 + 1.7.8.0 diff --git a/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java b/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java new file mode 100644 index 0000000000..e4907f6d9b --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java @@ -0,0 +1,480 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.rest; + +import java.net.URI; +import java.security.KeyManagementException; +import java.security.SecureRandom; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.util.Collection; +import java.util.Map; +import java.util.concurrent.Callable; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.Invocation.Builder; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Variant; + +import org.apache.commons.lang3.tuple.Pair; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.apache.http.pool.PoolStats; +import org.glassfish.jersey.SslConfigurator; +import org.glassfish.jersey.apache.connector.ApacheClientProperties; +import org.glassfish.jersey.apache.connector.ApacheConnectorProvider; +import org.glassfish.jersey.client.ClientConfig; +import org.glassfish.jersey.client.ClientProperties; +import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; +import org.glassfish.jersey.internal.util.collection.Ref; +import org.glassfish.jersey.internal.util.collection.Refs; +import org.glassfish.jersey.message.GZipEncoder; +import org.glassfish.jersey.uri.UriComponent; + +import com.baidu.hugegraph.util.ExecutorUtil; +import com.google.common.collect.ImmutableMap; + +public abstract class AbstractRestClient implements RestClient { + + // Time unit: hours + private static final long TTL = 24L; + // Time unit: ms + private static final long IDLE_TIME = 40L * 1000L; + + private final Client client; + private final WebTarget target; + + private PoolingHttpClientConnectionManager pool; + private ScheduledExecutorService cleanExecutor; + + public AbstractRestClient(String url, int timeout) { + this(url, new ConfigBuilder().configTimeout(timeout).build()); + } + + public AbstractRestClient(String url, String user, String password, + int timeout) { + this(url, new ConfigBuilder().configTimeout(timeout) + .configUser(user, password) + .build()); + } + + public AbstractRestClient(String url, int timeout, + int maxTotal, int maxPerRoute) { + this(url, new ConfigBuilder().configTimeout(timeout) + .configPool(maxTotal, maxPerRoute) + .build()); + } + + public AbstractRestClient(String url, int timeout, int idleTime, + int maxTotal, int maxPerRoute) { + this(url, new ConfigBuilder().configTimeout(timeout) + .configIdleTime(idleTime) + .configPool(maxTotal, maxPerRoute) + .build()); + } + + public AbstractRestClient(String url, String user, String password, + int timeout, int maxTotal, int maxPerRoute) { + this(url, new ConfigBuilder().configTimeout(timeout) + .configUser(user, password) + .configPool(maxTotal, maxPerRoute) + .build()); + } + + public AbstractRestClient(String url, String user, String password, + int timeout, int maxTotal, int maxPerRoute, + String protocol, String trustStoreFile, + String trustStorePassword) { + this(url, new ConfigBuilder().configTimeout(timeout) + .configUser(user, password) + .configPool(maxTotal, maxPerRoute) + .configSSL(protocol, trustStoreFile, + trustStorePassword) + .build()); + } + + public AbstractRestClient(String url, ClientConfig config) { + Client client = null; + Object protocol = config.getProperty("protocol"); + if (protocol != null && protocol.equals("https")) { + client = wrapTrustConfig(url, config); + } else { + client = ClientBuilder.newClient(config); + } + this.client = client; + this.client.register(GZipEncoder.class); + this.target = this.client.target(url); + this.pool = (PoolingHttpClientConnectionManager) config.getProperty( + ApacheClientProperties.CONNECTION_MANAGER); + if (this.pool != null) { + this.cleanExecutor = ExecutorUtil.newScheduledThreadPool( + "conn-clean-worker-%d"); + Number idleTimeProp = (Number) config.getProperty("idleTime"); + final long idleTime = idleTimeProp == null ? + IDLE_TIME : idleTimeProp.longValue(); + final long checkPeriod = idleTime / 2L; + this.cleanExecutor.scheduleWithFixedDelay(() -> { + PoolStats stats = this.pool.getTotalStats(); + int using = stats.getLeased() + stats.getPending(); + if (using > 0) { + // Do clean only when all connections are idle + return; + } + // Release connections when all clients are inactive + this.pool.closeIdleConnections(idleTime, TimeUnit.MILLISECONDS); + this.pool.closeExpiredConnections(); + }, checkPeriod, checkPeriod, TimeUnit.MILLISECONDS); + } + } + + protected abstract void checkStatus(Response response, + Response.Status... statuses); + + protected Response request(Callable method) { + try { + return method.call(); + } catch (Exception e) { + throw new ClientException("Failed to do request", e); + } + } + + @Override + public RestResult post(String path, Object object) { + return this.post(path, object, null, null); + } + + @Override + public RestResult post(String path, Object object, + MultivaluedMap headers) { + return this.post(path, object, headers, null); + } + + @Override + public RestResult post(String path, Object object, + Map params) { + return this.post(path, object, null, params); + } + + @Override + public RestResult post(String path, Object object, + MultivaluedMap headers, + Map params) { + Pair> pair = this.buildRequest(path, null, object, + headers, params); + Response response = this.request(() -> { + // pair.getLeft() is builder, pair.getRight() is entity (http body) + return pair.getLeft().post(pair.getRight()); + }); + // If check status failed, throw client exception. + checkStatus(response, Response.Status.CREATED, + Response.Status.OK, Response.Status.ACCEPTED); + return new RestResult(response); + } + + @Override + public RestResult put(String path, String id, Object object) { + return this.put(path, id, object, ImmutableMap.of()); + } + + @Override + public RestResult put(String path, String id, Object object, + MultivaluedMap headers) { + return this.put(path, id, object, headers, null); + } + + @Override + public RestResult put(String path, String id, Object object, + Map params) { + return this.put(path, id, object, null, params); + } + + @Override + public RestResult put(String path, String id, Object object, + MultivaluedMap headers, + Map params) { + Pair> pair = this.buildRequest(path, id, object, + headers, params); + Response response = this.request(() -> { + // pair.getLeft() is builder, pair.getRight() is entity (http body) + return pair.getLeft().put(pair.getRight()); + }); + // If check status failed, throw client exception. + checkStatus(response, Response.Status.OK, Response.Status.ACCEPTED); + return new RestResult(response); + } + + @Override + public RestResult get(String path) { + Response response = this.request(() -> { + return this.target.path(path).request().get(); + }); + checkStatus(response, Response.Status.OK); + return new RestResult(response); + } + + @Override + public RestResult get(String path, Map params) { + Ref target = Refs.of(this.target); + for (String key : params.keySet()) { + Object value = params.get(key); + if (value instanceof Collection) { + for (Object i : (Collection) value) { + target.set(target.get().queryParam(key, i)); + } + } else { + target.set(target.get().queryParam(key, value)); + } + } + Response response = this.request(() -> { + return target.get().path(path).request().get(); + }); + checkStatus(response, Response.Status.OK); + return new RestResult(response); + } + + @Override + public RestResult get(String path, String id) { + Response response = this.request(() -> { + return this.target.path(path).path(encode(id)).request().get(); + }); + checkStatus(response, Response.Status.OK); + return new RestResult(response); + } + + @Override + public RestResult delete(String path, Map params) { + Ref target = Refs.of(this.target); + for (String key : params.keySet()) { + target.set(target.get().queryParam(key, params.get(key))); + } + Response response = this.request(() -> { + return target.get().path(path).request().delete(); + }); + checkStatus(response, Response.Status.NO_CONTENT, + Response.Status.ACCEPTED); + return new RestResult(response); + } + + @Override + public RestResult delete(String path, String id) { + Response response = this.request(() -> { + return this.target.path(path).path(encode(id)).request().delete(); + }); + checkStatus(response, Response.Status.NO_CONTENT, + Response.Status.ACCEPTED); + return new RestResult(response); + } + + @Override + public void close() { + if (this.pool != null) { + this.pool.close(); + this.cleanExecutor.shutdownNow(); + } + this.client.close(); + } + + private Pair> buildRequest( + String path, String id, Object object, + MultivaluedMap headers, + Map params) { + WebTarget target = this.target; + if (params != null && !params.isEmpty()) { + for (Map.Entry param : params.entrySet()) { + target = target.queryParam(param.getKey(), param.getValue()); + } + } + + Builder builder = id == null ? target.path(path).request() : + target.path(path).path(encode(id)).request(); + + String encoding = null; + if (headers != null && !headers.isEmpty()) { + // Add headers + builder = builder.headers(headers); + encoding = (String) headers.getFirst("Content-Encoding"); + } + + /* + * We should specify the encoding of the entity object manually, + * because Entity.json() method will reset "content encoding = + * null" that has been set up by headers before. + */ + Entity entity; + if (encoding == null) { + entity = Entity.json(object); + } else { + Variant variant = new Variant(MediaType.APPLICATION_JSON_TYPE, + (String) null, encoding); + entity = Entity.entity(object, variant); + } + return Pair.of(builder, entity); + } + + private static Client wrapTrustConfig(String url, ClientConfig config) { + SslConfigurator sslConfig = SslConfigurator.newInstance(); + String trustStoreFile = config.getProperty("trustStoreFile").toString(); + String trustStorePassword = config.getProperty("trustStorePassword") + .toString(); + sslConfig.trustStoreFile(trustStoreFile) + .trustStorePassword(trustStorePassword); + sslConfig.securityProtocol("SSL"); + SSLContext context = sslConfig.createSSLContext(); + TrustManager[] trustAllManager = NoCheckTrustManager.create(); + try { + context.init(null, trustAllManager, new SecureRandom()); + } catch (KeyManagementException e) { + throw new ClientException("Failed to init security management", e); + } + return ClientBuilder.newBuilder() + .hostnameVerifier(new HostNameVerifier(url)) + .sslContext(context) + .build(); + } + + public static String encode(String raw) { + return UriComponent.encode(raw, UriComponent.Type.PATH_SEGMENT); + } + + public static class HostNameVerifier implements HostnameVerifier { + + private final String url; + + public HostNameVerifier(String url) { + if (!url.startsWith("http://") && !url.startsWith("https://")) { + url = "http://" + url; + } + url = URI.create(url).getHost(); + this.url = url; + } + + @Override + public boolean verify(String hostname, SSLSession session) { + if (!this.url.isEmpty() && this.url.endsWith(hostname)) { + return true; + } else { + HostnameVerifier verifier = HttpsURLConnection + .getDefaultHostnameVerifier(); + return verifier.verify(hostname, session); + } + } + } + + private static class NoCheckTrustManager implements X509TrustManager { + + @Override + public void checkClientTrusted(X509Certificate[] chain, String authType) + throws CertificateException { + } + + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType) + throws CertificateException { + } + + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + + public static TrustManager[] create() { + return new TrustManager[]{new NoCheckTrustManager()}; + } + } + + private static class ConfigBuilder { + + private final ClientConfig config; + + public ConfigBuilder() { + this.config = new ClientConfig(); + } + + public ConfigBuilder configTimeout(int timeout) { + this.config.property(ClientProperties.CONNECT_TIMEOUT, timeout); + this.config.property(ClientProperties.READ_TIMEOUT, timeout); + return this; + } + + public ConfigBuilder configUser(String username, String password) { + /* + * NOTE: don't use non-preemptive mode + * In non-preemptive mode the authentication information is added + * only when server refuses the request with 401 status code and + * then the request is repeated. + * Non-preemptive has negative impact on the performance. The + * advantage is it doesn't send credentials when they are not needed + * https://jersey.github.io/documentation/latest/client.html#d0e5461 + */ + this.config.register(HttpAuthenticationFeature.basic(username, + password)); + return this; + } + + public ConfigBuilder configPool(int maxTotal, int maxPerRoute) { + /* + * Using httpclient with connection pooling, and configuring the + * jersey connector, reference: + * http://www.theotherian.com/2013/08/jersey-client-2.0-httpclient-timeouts-max-connections.html + * https://stackoverflow.com/questions/43228051/memory-issue-with-jax-rs-using-jersey/46175943#46175943 + * + * But the jersey that has been released in the maven central + * repository seems to have a bug. + * https://github.com/jersey/jersey/pull/3752 + */ + PoolingHttpClientConnectionManager pool; + pool = new PoolingHttpClientConnectionManager(TTL, TimeUnit.HOURS); + pool.setMaxTotal(maxTotal); + pool.setDefaultMaxPerRoute(maxPerRoute); + this.config.property(ApacheClientProperties.CONNECTION_MANAGER, pool); + this.config.connectorProvider(new ApacheConnectorProvider()); + return this; + } + + public ConfigBuilder configIdleTime(int idleTime) { + this.config.property("idleTime", idleTime); + return this; + } + + public ConfigBuilder configSSL(String protocol, String trustStoreFile, + String trustStorePassword) { + this.config.property("protocol", protocol); + this.config.property("trustStoreFile", trustStoreFile); + this.config.property("trustStorePassword", trustStorePassword); + return this; + } + + public ClientConfig build() { + return this.config; + } + } +} diff --git a/src/main/java/com/baidu/hugegraph/rest/RestClient.java b/src/main/java/com/baidu/hugegraph/rest/RestClient.java index d8ab27dc25..54a6df3147 100644 --- a/src/main/java/com/baidu/hugegraph/rest/RestClient.java +++ b/src/main/java/com/baidu/hugegraph/rest/RestClient.java @@ -19,429 +19,36 @@ package com.baidu.hugegraph.rest; -import static org.glassfish.jersey.apache.connector.ApacheClientProperties.CONNECTION_MANAGER; - -import java.net.URI; -import java.security.KeyManagementException; -import java.security.SecureRandom; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; -import java.util.Collection; import java.util.Map; -import java.util.concurrent.Callable; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSession; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.Entity; -import javax.ws.rs.client.Invocation.Builder; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Variant; - -import org.apache.commons.lang3.tuple.Pair; -import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; -import org.apache.http.pool.PoolStats; -import org.glassfish.jersey.SslConfigurator; -import org.glassfish.jersey.apache.connector.ApacheConnectorProvider; -import org.glassfish.jersey.client.ClientConfig; -import org.glassfish.jersey.client.ClientProperties; -import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; -import org.glassfish.jersey.internal.util.collection.Ref; -import org.glassfish.jersey.internal.util.collection.Refs; -import org.glassfish.jersey.message.GZipEncoder; -import org.glassfish.jersey.uri.UriComponent; - -import com.baidu.hugegraph.util.ExecutorUtil; -import com.google.common.collect.ImmutableMap; - -public abstract class RestClient { - - // Time unit: hours - private static long TTL = 24L; - // Time unit: seconds - private static long IDLE_TIME = 40L; - // Time unit: seconds - private static long CHECK_PERIOD = IDLE_TIME / 2; - - private final Client client; - private final WebTarget target; - - private PoolingHttpClientConnectionManager pool; - private ScheduledExecutorService cleanExecutor; - - public RestClient(String url, int timeout) { - this(url, new ConfigBuilder().config(timeout).build()); - } - - public RestClient(String url, String user, String password, int timeout) { - this(url, new ConfigBuilder().config(timeout) - .config(user, password) - .build()); - } - - public RestClient(String url, int timeout, int maxTotal, int maxPerRoute) { - this(url, new ConfigBuilder().config(timeout) - .config(maxTotal, maxPerRoute) - .build()); - } - - public RestClient(String url, String user, String password, int timeout, - int maxTotal, int maxPerRoute) { - this(url, new ConfigBuilder().config(timeout) - .config(user, password) - .config(maxTotal, maxPerRoute) - .build()); - } - - public RestClient(String url, String user, String password, int timeout, - int maxTotal, int maxPerRoute, String protocol, - String trustStoreFile, String trustStorePassword) { - this(url, new ConfigBuilder().config(timeout) - .config(user, password) - .config(maxTotal, maxPerRoute) - .config(protocol, trustStoreFile, - trustStorePassword) - .build()); - } - private TrustManager[] createNoCheckTrustManager() { - return new TrustManager[]{new NoCheckTrustManager()}; - } - - private static class NoCheckTrustManager implements X509TrustManager { - - @Override - public void checkClientTrusted(X509Certificate[] chain, String authType) - throws CertificateException { - } - - @Override - public void checkServerTrusted(X509Certificate[] chain, String authType) - throws CertificateException { - } - - @Override - public X509Certificate[] getAcceptedIssuers() { - return null; - } - } - - private Client wrapTrustConfig(String url, ClientConfig config) { - - SslConfigurator sslConfig = SslConfigurator.newInstance(); - String trustStoreFile = config.getProperty("trustStoreFile").toString(); - String trustStorePassword = config.getProperty("trustStorePassword").toString(); - sslConfig.trustStoreFile(trustStoreFile) - .trustStorePassword(trustStorePassword); - sslConfig.securityProtocol("SSL"); - SSLContext sc = sslConfig.createSSLContext(); - TrustManager[] trustAllCerts = createNoCheckTrustManager(); - try { - sc.init(null, trustAllCerts, new SecureRandom()); - } catch (KeyManagementException e) { - throw new ClientException("Failed to init security key management", e); - } - return ClientBuilder.newBuilder() - .hostnameVerifier(new HostNameVerifier(url)) - .sslContext(sc) - .build(); - } - - public RestClient(String url, ClientConfig config) { - Client client = null; - Object protocol = config.getProperty("protocol"); - if (protocol != null && protocol.equals("https")) { - client = wrapTrustConfig(url, config); - } else { - client = ClientBuilder.newClient(config); - } - this.client = client; - this.client.register(GZipEncoder.class); - this.target = this.client.target(url); - this.pool = (PoolingHttpClientConnectionManager) - config.getProperty(CONNECTION_MANAGER); - if (this.pool != null) { - this.cleanExecutor = ExecutorUtil.newScheduledThreadPool( - "conn-clean-worker-%d"); - this.cleanExecutor.scheduleWithFixedDelay(() -> { - PoolStats stats = this.pool.getTotalStats(); - int using = stats.getLeased() + stats.getPending(); - if (using > 0) { - // Do clean only when all connections are idle - return; - } - this.pool.closeIdleConnections(IDLE_TIME, TimeUnit.SECONDS); - this.pool.closeExpiredConnections(); - }, CHECK_PERIOD, CHECK_PERIOD, TimeUnit.SECONDS); - } - } - - public void close() { - if (this.pool != null) { - this.pool.close(); - this.cleanExecutor.shutdownNow(); - } - this.client.close(); - } - - protected Response request(Callable method) { - try { - return method.call(); - } catch (Exception e) { - throw new ClientException("Failed to do request", e); - } - } - - public RestResult post(String path, Object object) { - return this.post(path, object, null, null); - } +public interface RestClient { + public RestResult post(String path, Object object); public RestResult post(String path, Object object, - MultivaluedMap headers) { - return this.post(path, object, headers, null); - } - + MultivaluedMap headers); public RestResult post(String path, Object object, - Map params) { - return this.post(path, object, null, params); - } - + Map params); public RestResult post(String path, Object object, MultivaluedMap headers, - Map params) { - Pair> pair = this.buildRequest(path, null, object, - headers, params); - Response response = this.request(() -> { - // pair.getLeft() is builder, pair.getRight() is entity (http body) - return pair.getLeft().post(pair.getRight()); - }); - // If check status failed, throw client exception. - checkStatus(response, Response.Status.CREATED, - Response.Status.OK, Response.Status.ACCEPTED); - return new RestResult(response); - } - - public RestResult put(String path, String id, Object object) { - return this.put(path, id, object, ImmutableMap.of()); - } + Map params); + public RestResult put(String path, String id, Object object); public RestResult put(String path, String id, Object object, - MultivaluedMap headers) { - return this.put(path, id, object, headers, null); - } - + MultivaluedMap headers); public RestResult put(String path, String id, Object object, - Map params) { - return this.put(path, id, object, null, params); - } - + Map params); public RestResult put(String path, String id, Object object, MultivaluedMap headers, - Map params) { - Pair> pair = this.buildRequest(path, id, object, - headers, params); - Response response = this.request(() -> { - // pair.getLeft() is builder, pair.getRight() is entity (http body) - return pair.getLeft().put(pair.getRight()); - }); - // If check status failed, throw client exception. - checkStatus(response, Response.Status.OK, Response.Status.ACCEPTED); - return new RestResult(response); - } - - public RestResult get(String path) { - Response response = this.request(() -> { - return this.target.path(path).request().get(); - }); - checkStatus(response, Response.Status.OK); - return new RestResult(response); - } - - public RestResult get(String path, Map params) { - Ref target = Refs.of(this.target); - for (String key : params.keySet()) { - Object value = params.get(key); - if (value instanceof Collection) { - for (Object i : (Collection) value) { - target.set(target.get().queryParam(key, i)); - } - } else { - target.set(target.get().queryParam(key, value)); - } - } - Response response = this.request(() -> { - return target.get().path(path).request().get(); - }); - checkStatus(response, Response.Status.OK); - return new RestResult(response); - } - - public RestResult get(String path, String id) { - Response response = this.request(() -> { - return this.target.path(path).path(encode(id)).request().get(); - }); - checkStatus(response, Response.Status.OK); - return new RestResult(response); - } - - public RestResult delete(String path, Map params) { - Ref target = Refs.of(this.target); - for (String key : params.keySet()) { - target.set(target.get().queryParam(key, params.get(key))); - } - Response response = this.request(() -> { - return target.get().path(path).request().delete(); - }); - checkStatus(response, Response.Status.NO_CONTENT, - Response.Status.ACCEPTED); - return new RestResult(response); - } - - public RestResult delete(String path, String id) { - Response response = this.request(() -> { - return this.target.path(path).path(encode(id)).request().delete(); - }); - checkStatus(response, Response.Status.NO_CONTENT, - Response.Status.ACCEPTED); - return new RestResult(response); - } - - private Pair> buildRequest( - String path, String id, Object object, - MultivaluedMap headers, - Map params) { - WebTarget target = this.target; - if (params != null && !params.isEmpty()) { - for (Map.Entry param : params.entrySet()) { - target = target.queryParam(param.getKey(), param.getValue()); - } - } - - Builder builder = id == null ? target.path(path).request() : - target.path(path).path(encode(id)).request(); - - String encoding = null; - if (headers != null && !headers.isEmpty()) { - // Add headers - builder = builder.headers(headers); - encoding = (String) headers.getFirst("Content-Encoding"); - } - - /* - * We should specify the encoding of the entity object manually, - * because Entity.json() method will reset "content encoding = - * null" that has been set up by headers before. - */ - Entity entity; - if (encoding == null) { - entity = Entity.json(object); - } else { - Variant variant = new Variant(MediaType.APPLICATION_JSON_TYPE, - (String) null, encoding); - entity = Entity.entity(object, variant); - } - return Pair.of(builder, entity); - } - - private static String encode(String raw) { - return UriComponent.encode(raw, UriComponent.Type.PATH_SEGMENT); - } - - public static class HostNameVerifier implements HostnameVerifier { - - private final String url; - - public HostNameVerifier(String url) { - if (!url.startsWith("http://") && !url.startsWith("https://")) { - url = "http://" + url; - } - url = URI.create(url).getHost(); - this.url = url; - } - - @Override - public boolean verify(String hostname, SSLSession session) { - if (!this.url.isEmpty() && this.url.endsWith(hostname)) { - return true; - } else { - HostnameVerifier verifier = HttpsURLConnection.getDefaultHostnameVerifier(); - return verifier.verify(hostname, session); - } - } - } - - protected abstract void checkStatus(Response response, - Response.Status... statuses); - - private static class ConfigBuilder { - - private final ClientConfig config; - - public ConfigBuilder() { - this.config = new ClientConfig(); - } - - public ConfigBuilder config(int timeout) { - this.config.property(ClientProperties.CONNECT_TIMEOUT, timeout); - this.config.property(ClientProperties.READ_TIMEOUT, timeout); - return this; - } - - public ConfigBuilder config(String username, String password) { - /* - * NOTE: don't use non-preemptive mode - * In non-preemptive mode the authentication information is added - * only when server refuses the request with 401 status code and - * then the request is repeated. - * Non-preemptive has negative impact on the performance. The - * advantage is it doesn't send credentials when they are not needed - * https://jersey.github.io/documentation/latest/client.html#d0e5461 - */ - this.config.register(HttpAuthenticationFeature.basic(username, - password)); - return this; - } + Map params); - public ConfigBuilder config(int maxTotal, int maxPerRoute) { - /* - * Using httpclient with connection pooling, and configuring the - * jersey connector, reference: - * http://www.theotherian.com/2013/08/jersey-client-2.0-httpclient-timeouts-max-connections.html - * https://stackoverflow.com/questions/43228051/memory-issue-with-jax-rs-using-jersey/46175943#46175943 - * - * But the jersey that has been released in the maven central - * repository seems to have a bug. - * https://github.com/jersey/jersey/pull/3752 - */ - PoolingHttpClientConnectionManager pool; - pool = new PoolingHttpClientConnectionManager(TTL, TimeUnit.HOURS); - pool.setMaxTotal(maxTotal); - pool.setDefaultMaxPerRoute(maxPerRoute); - this.config.property(CONNECTION_MANAGER, pool); - this.config.connectorProvider(new ApacheConnectorProvider()); - return this; - } + public RestResult get(String path); + public RestResult get(String path, Map params); + public RestResult get(String path, String id); - public ConfigBuilder config(String protocol, String trustStoreFile, - String trustStorePassword) { - this.config.property("protocol", protocol); - this.config.property("trustStoreFile", trustStoreFile); - this.config.property("trustStorePassword", trustStorePassword); - return this; - } + public RestResult delete(String path, Map params); + public RestResult delete(String path, String id); - public ClientConfig build() { - return this.config; - } - } + public void close(); } diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index dc8d9c7ee7..54c48eb9f1 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.7.7"); + "1.7.8"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java index d0d651be12..3e1c283716 100644 --- a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java +++ b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -58,7 +58,6 @@ import com.baidu.hugegraph.unit.util.TimeUtilTest; import com.baidu.hugegraph.unit.util.VersionUtilTest; import com.baidu.hugegraph.unit.version.VersionTest; -import com.baidu.hugegraph.util.DateUtil; @RunWith(Suite.class) @Suite.SuiteClasses({ diff --git a/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java b/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java index 6fa08e0b92..5649b1a471 100644 --- a/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java @@ -44,6 +44,7 @@ import org.junit.Test; import org.mockito.Mockito; +import com.baidu.hugegraph.rest.AbstractRestClient; import com.baidu.hugegraph.rest.ClientException; import com.baidu.hugegraph.rest.RestClient; import com.baidu.hugegraph.rest.RestResult; @@ -54,12 +55,20 @@ public class RestClientTest { - private static class RestClientImpl extends RestClient { + private static class RestClientImpl extends AbstractRestClient { private final int status; private final MultivaluedMap headers; private final String content; + public RestClientImpl(String url, int timeout, int idleTime, + int maxTotal, int maxPerRoute, int status) { + super(url, timeout, idleTime, maxTotal, maxPerRoute); + this.status = status; + this.headers = ImmutableMultivaluedMap.empty(); + this.content = ""; + } + public RestClientImpl(String url, int timeout, int maxTotal, int maxPerRoute, int status) { super(url, timeout, maxTotal, maxPerRoute); @@ -89,8 +98,8 @@ public RestClientImpl(String url, String user, String password, int timeout, int maxTotal, int maxPerRoute, String protocol, String trustStoreFile, String trustStorePassword, int status) { - super(url, user, password, timeout, maxTotal, maxPerRoute, protocol, - trustStoreFile, trustStorePassword); + super(url, user, password, timeout, maxTotal, maxPerRoute, + protocol, trustStoreFile, trustStorePassword); this.status = status; this.headers = ImmutableMultivaluedMap.empty(); this.content = ""; @@ -100,18 +109,6 @@ public RestClientImpl(String url, int timeout, int status) { this(url, timeout, status, ImmutableMultivaluedMap.empty(), ""); } - @SuppressWarnings("unused") - public RestClientImpl(String url, int timeout, int status, - MultivaluedMap headers) { - this(url, timeout, status, headers, ""); - } - - @SuppressWarnings("unused") - public RestClientImpl(String url, int timeout, int status, - String content) { - this(url, timeout, status, ImmutableMultivaluedMap.empty(), content); - } - public RestClientImpl(String url, int timeout, int status, MultivaluedMap headers, String content) { @@ -164,62 +161,48 @@ public void testPostWithMaxTotalAndPerRoute() { @Test public void testCleanExecutor() throws Exception { - long oldIdleTime = Whitebox.getInternalState(RestClient.class, - "IDLE_TIME"); - long oldCheckPeriod = Whitebox.getInternalState(RestClient.class, - "CHECK_PERIOD"); - long newCheckPeriod = 1L; - long newIdleTime = 2 * newCheckPeriod; - // Modify IDLE_TIME and CHECK_PERIOD to speed test - Whitebox.setInternalState(RestClient.class, "IDLE_TIME", newIdleTime); - Whitebox.setInternalState(RestClient.class, "CHECK_PERIOD", - newCheckPeriod); - - try { - RestClient client = new RestClientImpl("/test", 1000, 10, 5, 200); - - PoolingHttpClientConnectionManager pool; - pool = Whitebox.getInternalState(client, "pool"); - pool = Mockito.spy(pool); - Whitebox.setInternalState(client, "pool", pool); - HttpRoute route = new HttpRoute(HttpHost.create( - "http://127.0.0.1:8080")); - // Create a connection manually, it will be put into leased list - HttpClientConnection conn = pool.requestConnection(route, null) - .get(1L, TimeUnit.SECONDS); - PoolStats stats = pool.getTotalStats(); - int usingConns = stats.getLeased() + stats.getPending(); - Assert.assertTrue(usingConns >= 1); - - // Sleep more than two check periods for busy connection - Thread.sleep(newCheckPeriod * 1000 * 2); - Mockito.verify(pool, Mockito.never()) - .closeExpiredConnections(); - stats = pool.getTotalStats(); - usingConns = stats.getLeased() + stats.getPending(); - Assert.assertTrue(usingConns >= 1); - - // The connection will be put into available list - pool.releaseConnection(conn, null, 0, TimeUnit.SECONDS); - - stats = pool.getTotalStats(); - usingConns = stats.getLeased() + stats.getPending(); - Assert.assertEquals(0, usingConns); - /* - * Sleep more than two check periods for free connection, - * ensure connection has been closed - */ - Thread.sleep(newCheckPeriod * 1000 * 2); - Mockito.verify(pool, Mockito.atLeastOnce()) - .closeExpiredConnections(); - Mockito.verify(pool, Mockito.atLeastOnce()) - .closeIdleConnections(newIdleTime, TimeUnit.SECONDS); - } finally { - Whitebox.setInternalState(RestClient.class, "IDLE_TIME", - oldIdleTime); - Whitebox.setInternalState(RestClient.class, "CHECK_PERIOD", - oldCheckPeriod); - } + // Modify IDLE_TIME 100ms to speed test + int newIdleTime = 100; + int newCheckPeriod = newIdleTime + 20; + + RestClient client = new RestClientImpl("/test", 1000, newIdleTime, + 10, 5, 200); + + PoolingHttpClientConnectionManager pool; + pool = Whitebox.getInternalState(client, "pool"); + pool = Mockito.spy(pool); + Whitebox.setInternalState(client, "pool", pool); + HttpRoute route = new HttpRoute(HttpHost.create( + "http://127.0.0.1:8080")); + // Create a connection manually, it will be put into leased list + HttpClientConnection conn = pool.requestConnection(route, null) + .get(1L, TimeUnit.SECONDS); + PoolStats stats = pool.getTotalStats(); + int usingConns = stats.getLeased() + stats.getPending(); + Assert.assertGte(1, usingConns); + + // Sleep more than two check periods for busy connection + Thread.sleep(newCheckPeriod); + Mockito.verify(pool, Mockito.never()).closeExpiredConnections(); + stats = pool.getTotalStats(); + usingConns = stats.getLeased() + stats.getPending(); + Assert.assertGte(1, usingConns); + + // The connection will be put into available list + pool.releaseConnection(conn, null, 0, TimeUnit.SECONDS); + + stats = pool.getTotalStats(); + usingConns = stats.getLeased() + stats.getPending(); + Assert.assertEquals(0, usingConns); + /* + * Sleep more than two check periods for free connection, + * ensure connection has been closed + */ + Thread.sleep(newCheckPeriod); + Mockito.verify(pool, Mockito.atLeastOnce()) + .closeExpiredConnections(); + Mockito.verify(pool, Mockito.atLeastOnce()) + .closeIdleConnections(newIdleTime, TimeUnit.MILLISECONDS); } @Test @@ -251,13 +234,13 @@ public void testPostHttpsWithAllParams() { @Test public void testHostNameVerifier() { BiFunction verifer = (url, hostname) -> { - RestClient.HostNameVerifier verifier; + AbstractRestClient.HostNameVerifier verifier; SSLSession session; try { SSLSessionContext sc = SSLContext.getDefault() .getClientSessionContext(); session = sc.getSession(new byte[]{11}); - verifier = new RestClient.HostNameVerifier(url); + verifier = new AbstractRestClient.HostNameVerifier(url); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } @@ -270,7 +253,7 @@ public void testHostNameVerifier() { Assert.assertFalse(verifer.apply("http://baidu2.com", "baidu.com")); Assert.assertTrue(verifer.apply("http://baidu.com", "")); Assert.assertTrue(verifer.apply("baidu.com", "baidu.com")); - Assert.assertTrue(verifer.apply("http://baidu.com/test/abc", "baidu.com")); + Assert.assertTrue(verifer.apply("http://baidu.com/test", "baidu.com")); Assert.assertTrue(verifer.apply("baidu.com/test/abc", "baidu.com")); Assert.assertFalse(verifer.apply("baidu.com.sina.com", "baidu.com")); } From 544599e316a9eb8879095cb7191d3fd64f27a20d Mon Sep 17 00:00:00 2001 From: Linary Date: Wed, 1 Jul 2020 20:53:47 +0800 Subject: [PATCH 123/217] Fix HugeConfig save to file is empty (#51) --- pom.xml | 4 +-- .../baidu/hugegraph/config/HugeConfig.java | 9 +++++++ .../hugegraph/version/CommonVersion.java | 2 +- .../hugegraph/unit/config/HugeConfigTest.java | 27 +++++++++++++++++++ 4 files changed, 39 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index d2ab1b2365..c410f58122 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.7.8 + 1.7.9 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -260,7 +260,7 @@ - 1.7.8.0 + 1.7.9.0 diff --git a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java index 1c9b16b8e0..5a8d345c98 100644 --- a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java +++ b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java @@ -44,6 +44,7 @@ public HugeConfig(Configuration config) { } this.reloadIfNeed(config); + this.setLayoutIfNeeded(config); Iterator keys = config.getKeys(); while (keys.hasNext()) { @@ -86,6 +87,14 @@ private void reloadIfNeed(Configuration conf) { } } + private void setLayoutIfNeeded(Configuration conf) { + if (!(conf instanceof PropertiesConfiguration)) { + return; + } + PropertiesConfiguration propConf = (PropertiesConfiguration) conf; + this.setLayout(propConf.getLayout()); + } + private static PropertiesConfiguration loadConfigFile(String path) { E.checkNotNull(path, "config path"); E.checkArgument(!path.isEmpty(), diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 54c48eb9f1..dda70faece 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.7.8"); + "1.7.9"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java b/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java index 30369d0916..9744a32cbf 100644 --- a/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java @@ -27,11 +27,16 @@ import static com.baidu.hugegraph.config.OptionChecker.rangeDouble; import static com.baidu.hugegraph.config.OptionChecker.rangeInt; +import java.io.File; +import java.io.IOException; import java.util.Arrays; import java.util.List; +import org.apache.commons.collections.IteratorUtils; import org.apache.commons.configuration.Configuration; +import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.PropertiesConfiguration; +import org.apache.commons.io.FileUtils; import org.junit.BeforeClass; import org.junit.Test; @@ -359,6 +364,28 @@ public void testHugeConfigWithListOptionError() throws Exception { }); } + @Test + public void testSaveHugeConfig() throws ConfigurationException, + IOException { + HugeConfig config = new HugeConfig(CONF); + Assert.assertEquals("file-text1-value", config.get(TestOptions.text1)); + + File copiedFile = new File("copied.conf"); + config.save(copiedFile); + Assert.assertTrue(copiedFile.exists()); + Assert.assertTrue(copiedFile.length() > 0); + + try { + HugeConfig copiedConfig = new HugeConfig(copiedFile.getPath()); + Assert.assertEquals(IteratorUtils.toList(config.getKeys()), + IteratorUtils.toList(copiedConfig.getKeys())); + Assert.assertEquals(config.get(TestOptions.text1), + copiedConfig.get(TestOptions.text1)); + } finally { + FileUtils.forceDelete(copiedFile); + } + } + public static class TestOptions extends OptionHolder { private static volatile TestOptions instance; From 9f329f5f3a8f413dc780a3ad0bf408c5f5a7bf72 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Jul 2020 12:05:58 +0800 Subject: [PATCH 124/217] Bump log4j2.version from 2.8.2 to 2.13.3 (#52) Bumps `log4j2.version` from 2.8.2 to 2.13.3. Updates `log4j-api` from 2.8.2 to 2.13.3 Updates `log4j-core` from 2.8.2 to 2.13.3 Updates `log4j-slf4j-impl` from 2.8.2 to 2.13.3 Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c410f58122..d7a1c5989a 100644 --- a/pom.xml +++ b/pom.xml @@ -56,7 +56,7 @@ ${project.basedir}/.. 1.8 1.8 - 2.8.2 + 2.13.3 1.10 2.1.1 3.2.2 From 630e19f8bca69c13beada4cf252296453d4e8dcb Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Fri, 24 Jul 2020 08:50:03 +0800 Subject: [PATCH 125/217] fix LockManager get/create race condition (#53) * fix LockManager get/create race condition Change-Id: I524a2d4d13a99f3943bfa0e4a44aa0ccf9c573a1 * add unit test Change-Id: I17abf10b3c4e7f41fdd82ce9a9423b9ffc5a07fd * fix not clear test license Change-Id: I41f463a7e42a9b205c251ebc906cc850cdd4b7af --- .../hugegraph/concurrent/AtomicLock.java | 3 + .../baidu/hugegraph/concurrent/KeyLock.java | 9 ++ .../hugegraph/concurrent/LockManager.java | 14 +- .../baidu/hugegraph/concurrent/RowLock.java | 18 +-- .../baidu/hugegraph/unit/UnitTestSuite.java | 7 + .../unit/concurrent/AtomicLockTest.java | 64 +++++++++ .../unit/concurrent/KeyLockTest.java | 125 +++++++++++++++++ .../unit/concurrent/LockGroupTest.java | 19 ++- .../unit/concurrent/LockManagerTest.java | 127 ++++++++++++++++++ .../unit/concurrent/RowLockTest.java | 40 +++++- .../unit/license/LicenseManagerTest.java | 7 + .../resources/hugegraph-evaluation.license | Bin 720 -> 0 bytes 12 files changed, 413 insertions(+), 20 deletions(-) create mode 100644 src/test/java/com/baidu/hugegraph/unit/concurrent/AtomicLockTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/concurrent/KeyLockTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/concurrent/LockManagerTest.java delete mode 100644 src/test/resources/hugegraph-evaluation.license diff --git a/src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java b/src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java index a2377f8003..8316065158 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java @@ -43,6 +43,9 @@ public boolean tryLock() { } public void unlock() { + if (this.sign.get() == null) { + return; + } Thread current = Thread.currentThread(); if (!this.sign.compareAndSet(current, null)) { throw new RuntimeException(String.format( diff --git a/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java b/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java index 42e1329863..dd8781b47a 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.concurrent.locks.Lock; +import com.baidu.hugegraph.util.E; import com.google.common.collect.ImmutableList; import com.google.common.util.concurrent.Striped; @@ -58,6 +59,7 @@ private int indexOf(Lock lock) { * @return The lock(locked) of passed key */ public final Lock lock(Object key) { + E.checkArgument(key != null, "Lock key can't be null"); Lock lock = this.locks.get(key); lock.lock(); return lock; @@ -68,6 +70,7 @@ public final Lock lock(Object key) { * @param key The object to unlock */ public final void unlock(Object key) { + E.checkArgument(key != null, "Unlock key can't be null"); this.locks.get(key).unlock(); } @@ -77,8 +80,11 @@ public final void unlock(Object key) { * @return The locks(locked) of keys */ public final List lockAll(Object... keys) { + E.checkArgument(keys != null && keys.length > 0, + "Lock keys can't be null or empty"); List locks = new ArrayList<>(keys.length); for (Object key : keys) { + E.checkArgument(key != null, "Lock key can't be null"); Lock lock = this.locks.get(key); locks.add(lock); } @@ -104,6 +110,8 @@ public final List lockAll(Object... keys) { * @return locks for the two objects */ public List lockAll(Object key1, Object key2) { + E.checkArgument(key1 != null, "Lock key can't be null"); + E.checkArgument(key2 != null, "Lock key can't be null"); Lock lock1 = this.locks.get(key1); Lock lock2 = this.locks.get(key2); @@ -129,6 +137,7 @@ public List lockAll(Object key1, Object key2) { * @param locks The locks to unlock */ public final void unlockAll(List locks) { + E.checkArgument(locks != null, "Unlock locks can't be null"); for (int i = locks.size(); i > 0; i--) { assert this.indexOf(locks.get(i - 1)) != -1; locks.get(i - 1).unlock(); diff --git a/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java b/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java index d41bc931d2..299b0011a0 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java @@ -41,21 +41,25 @@ public boolean exists(String group) { } public LockGroup create(String group) { - if (this.lockGroupMap.containsKey(group)) { + if (exists(group)) { throw new RuntimeException(String.format( - "LockGroup '%s' already exists!", group)); + "LockGroup '%s' already exists", group)); } LockGroup lockGroup = new LockGroup(group); - this.lockGroupMap.putIfAbsent(group, lockGroup); + LockGroup previous = this.lockGroupMap.putIfAbsent(group, lockGroup); + if (previous != null) { + return previous; + } return lockGroup; } public LockGroup get(String group) { - if (!exists(group)) { + LockGroup lockGroup = this.lockGroupMap.get(group); + if (lockGroup == null) { throw new RuntimeException(String.format( "LockGroup '%s' does not exists", group)); } - return this.lockGroupMap.get(group); + return lockGroup; } public void destroy(String group) { diff --git a/src/main/java/com/baidu/hugegraph/concurrent/RowLock.java b/src/main/java/com/baidu/hugegraph/concurrent/RowLock.java index 6fa5197d00..d70d3b5735 100644 --- a/src/main/java/com/baidu/hugegraph/concurrent/RowLock.java +++ b/src/main/java/com/baidu/hugegraph/concurrent/RowLock.java @@ -38,9 +38,7 @@ public class RowLock> { ThreadLocal.withInitial(HashMap::new); public void lock(K key) { - if (key == null) { - return; - } + E.checkArgument(key != null, "Lock key can't be null"); LocalLock localLock = this.localLocks.get().get(key); if (localLock != null) { localLock.lockCount++; @@ -56,9 +54,7 @@ public void lock(K key) { } public void unlock(K key) { - if (key == null) { - return; - } + E.checkArgument(key != null, "Unlock key can't be null"); LocalLock localLock = this.localLocks.get().get(key); if (localLock == null) { return; @@ -74,9 +70,8 @@ public void unlock(K key) { } public void lockAll(Set keys) { - if (keys == null) { - return; - } + E.checkArgument(keys != null && keys.size() > 0, + "Lock keys can't be null or empty"); List list = new ArrayList<>(keys); Collections.sort(list); for (K key : list) { @@ -85,9 +80,8 @@ public void lockAll(Set keys) { } public void unlockAll(Set keys) { - if (keys == null) { - return; - } + E.checkArgument(keys != null && keys.size() > 0, + "Unlock keys can't be null or empty"); for (K key : keys) { this.unlock(key); } diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java index 3e1c283716..c6dfa62b68 100644 --- a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java +++ b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -24,7 +24,10 @@ import com.baidu.hugegraph.testutil.AssertTest; import com.baidu.hugegraph.testutil.WhiteboxTest; +import com.baidu.hugegraph.unit.concurrent.AtomicLockTest; +import com.baidu.hugegraph.unit.concurrent.KeyLockTest; import com.baidu.hugegraph.unit.concurrent.LockGroupTest; +import com.baidu.hugegraph.unit.concurrent.LockManagerTest; import com.baidu.hugegraph.unit.concurrent.RowLockTest; import com.baidu.hugegraph.unit.config.HugeConfigTest; import com.baidu.hugegraph.unit.config.OptionSpaceTest; @@ -61,8 +64,12 @@ @RunWith(Suite.class) @Suite.SuiteClasses({ + LockManagerTest.class, LockGroupTest.class, + AtomicLockTest.class, + KeyLockTest.class, RowLockTest.class, + HugeConfigTest.class, OptionSpaceTest.class, SafeDateFormatTest.class, diff --git a/src/test/java/com/baidu/hugegraph/unit/concurrent/AtomicLockTest.java b/src/test/java/com/baidu/hugegraph/unit/concurrent/AtomicLockTest.java new file mode 100644 index 0000000000..225fe4296c --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/concurrent/AtomicLockTest.java @@ -0,0 +1,64 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.concurrent; + +import org.junit.Test; + +import com.baidu.hugegraph.concurrent.AtomicLock; +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; + +public class AtomicLockTest extends BaseUnitTest { + + @Test + public void testLockUnlock() { + AtomicLock lock = new AtomicLock("lock"); + Assert.assertEquals("lock", lock.name()); + + Assert.assertTrue(lock.lock(0)); + try { + Assert.assertFalse(lock.lock(1)); + // lock in other threads + runWithThreads(2, () -> { + Assert.assertFalse(lock.tryLock()); + }); + lock.unlock(); + } finally { + lock.unlock(); + // unlock multi times is OK + lock.unlock(); + lock.unlock(); + } + + Assert.assertThrows(RuntimeException.class, () -> { + lock.lock(-1); + }, e -> { + Assert.assertContains("Locking retry times should be in [0, 10], " + + "but got -1", e.getMessage()); + }); + + Assert.assertThrows(RuntimeException.class, () -> { + lock.lock(11); + }, e -> { + Assert.assertContains("Locking retry times should be in [0, 10], " + + "but got 11", e.getMessage()); + }); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/concurrent/KeyLockTest.java b/src/test/java/com/baidu/hugegraph/unit/concurrent/KeyLockTest.java new file mode 100644 index 0000000000..60a946abc1 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/concurrent/KeyLockTest.java @@ -0,0 +1,125 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.concurrent; + +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.locks.Lock; + +import org.junit.Test; + +import com.baidu.hugegraph.concurrent.KeyLock; +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; + +public class KeyLockTest extends BaseUnitTest { + + @Test + public void testLockUnlock() { + KeyLock locks = new KeyLock(); + + locks.lock("1"); + try { + // lock again is OK + locks.lock("1"); + // lock in other threads + runWithThreads(1, () -> { + locks.lock("2"); + }); + locks.unlock("1"); + } finally { + locks.unlock("1"); + } + + Assert.assertThrows(IllegalMonitorStateException.class, () -> { + locks.unlock("2"); + }); + + Assert.assertThrows(IllegalMonitorStateException.class, () -> { + locks.unlock("3"); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + locks.lock(null); + }, e -> { + Assert.assertContains("Lock key can't be null", e.getMessage()); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + locks.unlock(null); + }, e -> { + Assert.assertContains("Unlock key can't be null", e.getMessage()); + }); + } + + @Test + public void testLockUnlockAll() { + KeyLock locks = new KeyLock(); + + List ls = locks.lockAll("1", 2); + locks.unlockAll(ls); + + runWithThreads(1, () -> { + List ls2 = locks.lockAll("1", 3); + locks.unlockAll(ls2); + }); + + List ls3 = locks.lockAll("1", 2, 3); + locks.unlockAll(ls3); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + locks.lockAll("1", null); + }, e -> { + Assert.assertContains("Lock key can't be null", e.getMessage()); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + locks.lockAll(null, "1"); + }, e -> { + Assert.assertContains("Lock key can't be null", e.getMessage()); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + locks.lockAll(Arrays.asList("1", null, 2).toArray()); + }, e -> { + Assert.assertContains("Lock key can't be null", e.getMessage()); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + locks.lockAll(Arrays.asList().toArray()); + }, e -> { + Assert.assertContains("Lock keys can't be null or empty", + e.getMessage()); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + locks.lockAll((Object[]) null); + }, e -> { + Assert.assertContains("Lock keys can't be null or empty", + e.getMessage()); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + locks.unlockAll(null); + }, e -> { + Assert.assertContains("Unlock locks can't be null", e.getMessage()); + }); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java b/src/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java index 7a52304021..1f252917e5 100644 --- a/src/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java @@ -31,10 +31,11 @@ import com.baidu.hugegraph.concurrent.LockGroup; import com.baidu.hugegraph.concurrent.RowLock; import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; -public class LockGroupTest { +public class LockGroupTest extends BaseUnitTest { - private static final String GROUP = "testGroup"; + private static final String GROUP = "LockGroupTest-test-group"; private LockGroup group = new LockGroup(GROUP); @@ -44,6 +45,19 @@ public void testLock() { Assert.assertTrue(lock instanceof ReentrantLock); Lock lock1 = this.group.lock("lock"); Assert.assertSame(lock, lock1); + + lock1.lock(); + try { + // lock again is OK + lock1.lock(); + // lock in other threads + runWithThreads(2, () -> { + Assert.assertFalse(lock1.tryLock()); + }); + lock1.unlock(); + } finally { + lock1.unlock(); + } } @Test @@ -52,6 +66,7 @@ public void testAtomicLock() { Assert.assertNotNull(lock); AtomicLock lock1 = this.group.atomicLock("lock"); Assert.assertSame(lock, lock1); + Assert.assertEquals("lock", lock1.name()); } @Test diff --git a/src/test/java/com/baidu/hugegraph/unit/concurrent/LockManagerTest.java b/src/test/java/com/baidu/hugegraph/unit/concurrent/LockManagerTest.java new file mode 100644 index 0000000000..4eb5abded1 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/concurrent/LockManagerTest.java @@ -0,0 +1,127 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.concurrent; + +import org.junit.After; +import org.junit.Test; + +import com.baidu.hugegraph.concurrent.LockGroup; +import com.baidu.hugegraph.concurrent.LockManager; +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; + +public class LockManagerTest extends BaseUnitTest { + + private static final String GROUP = "LockManagerTest-test-group"; + private static final String GROUP2 = GROUP + 2; + + @After + public void teardown() { + LockManager manager = LockManager.instance(); + + if (manager.exists(GROUP)) { + manager.destroy(GROUP); + } + + if (manager.exists(GROUP2)) { + manager.destroy(GROUP2); + } + } + + @Test + public void testCreate() { + LockManager manager = LockManager.instance(); + + LockGroup lockGroup = manager.create(GROUP); + Assert.assertNotNull(lockGroup); + Assert.assertEquals(GROUP, lockGroup.name()); + Assert.assertTrue(manager.exists(GROUP)); + + Assert.assertFalse(manager.exists(GROUP2)); + LockGroup lockGroup2 = manager.create(GROUP2); + Assert.assertNotNull(lockGroup2); + Assert.assertEquals(GROUP2, lockGroup2.name()); + Assert.assertTrue(manager.exists(GROUP2)); + + Assert.assertThrows(RuntimeException.class, () -> { + manager.create(GROUP); + }, e -> { + Assert.assertContains("LockGroup 'LockManagerTest-test-group' " + + "already exists", e.getMessage()); + }); + } + + @Test + public void testGet() { + LockManager manager = LockManager.instance(); + + LockGroup lockGroup = manager.create(GROUP); + LockGroup lockGroup2 = manager.create(GROUP2); + + Assert.assertSame(lockGroup, manager.get(GROUP)); + Assert.assertSame(lockGroup2, manager.get(GROUP2)); + Assert.assertSame(lockGroup, manager.get(GROUP)); + Assert.assertSame(lockGroup2, manager.get(GROUP2)); + + Assert.assertThrows(RuntimeException.class, () -> { + manager.get("fake-lock-group"); + }, e -> { + Assert.assertContains("LockGroup 'fake-lock-group' " + + "does not exists", e.getMessage()); + }); + } + + @Test + public void testDestroy() { + LockManager manager = LockManager.instance(); + + LockGroup lockGroup = manager.create(GROUP); + LockGroup lockGroup2 = manager.create(GROUP2); + + Assert.assertTrue(manager.exists(GROUP)); + Assert.assertTrue(manager.exists(GROUP2)); + Assert.assertSame(lockGroup, manager.get(GROUP)); + Assert.assertSame(lockGroup2, manager.get(GROUP2)); + + manager.destroy(GROUP); + Assert.assertFalse(manager.exists(GROUP)); + Assert.assertTrue(manager.exists(GROUP2)); + Assert.assertThrows(RuntimeException.class, () -> { + manager.get(GROUP); + }, e -> { + Assert.assertContains("does not exists", e.getMessage()); + }); + Assert.assertSame(lockGroup2, manager.get(GROUP2)); + + manager.destroy(GROUP2); + Assert.assertFalse(manager.exists(GROUP)); + Assert.assertFalse(manager.exists(GROUP2)); + Assert.assertThrows(RuntimeException.class, () -> { + manager.get(GROUP); + }, e -> { + Assert.assertContains("does not exists", e.getMessage()); + }); + Assert.assertThrows(RuntimeException.class, () -> { + manager.get(GROUP2); + }, e -> { + Assert.assertContains("does not exists", e.getMessage()); + }); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java b/src/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java index bd8419bb00..536ee94513 100644 --- a/src/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java @@ -25,10 +25,10 @@ import java.util.Random; import java.util.Set; -import org.junit.Assert; import org.junit.Test; import com.baidu.hugegraph.concurrent.RowLock; +import com.baidu.hugegraph.testutil.Assert; import com.baidu.hugegraph.unit.BaseUnitTest; import com.google.common.collect.ImmutableSet; @@ -53,6 +53,18 @@ public void testRowLock() { lock.lock(1); lock.unlock(1); lock.unlock(1); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + lock.lock(null); + }, e -> { + Assert.assertContains("Lock key can't be null", e.getMessage()); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + lock.unlock(null); + }, e -> { + Assert.assertContains("Unlock key can't be null", e.getMessage()); + }); } @Test @@ -60,6 +72,32 @@ public void testRowLockMultiRows() { RowLock lock = new RowLock<>(); lock.lockAll(ImmutableSet.of(1, 2, 3)); lock.unlockAll(ImmutableSet.of(1, 2, 3)); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + lock.lockAll(null); + }, e -> { + Assert.assertContains("Lock keys can't be null", e.getMessage()); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + lock.unlockAll(null); + }, e -> { + Assert.assertContains("Unlock keys can't be null", e.getMessage()); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + lock.lockAll(ImmutableSet.of()); + }, e -> { + Assert.assertContains("Lock keys can't be null or empty", + e.getMessage()); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + lock.unlockAll(ImmutableSet.of()); + }, e -> { + Assert.assertContains("Unlock keys can't be null or empty", + e.getMessage()); + }); } @Test diff --git a/src/test/java/com/baidu/hugegraph/unit/license/LicenseManagerTest.java b/src/test/java/com/baidu/hugegraph/unit/license/LicenseManagerTest.java index 6c27a8c1b8..555d66527a 100644 --- a/src/test/java/com/baidu/hugegraph/unit/license/LicenseManagerTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/license/LicenseManagerTest.java @@ -29,6 +29,7 @@ import org.apache.commons.codec.Charsets; import org.apache.commons.io.FileUtils; +import org.junit.After; import org.junit.Test; import com.baidu.hugegraph.license.CommonLicenseManager; @@ -56,6 +57,12 @@ public class LicenseManagerTest { private static final Charset CHARSET = Charsets.UTF_8; private static final ObjectMapper MAPPER = new ObjectMapper(); + @After + public void teardown() throws IOException { + File lic = new File("src/test/resources/hugegraph-evaluation.license"); + FileUtils.forceDelete(lic); + } + @Test public void testCreateInstallVerifyLicense() throws IOException { String createConfigPath = "src/test/resources/create-license.json"; diff --git a/src/test/resources/hugegraph-evaluation.license b/src/test/resources/hugegraph-evaluation.license deleted file mode 100644 index d09b0b93080c1ff1e4119fa992d7e6159b433c7f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 720 zcmV;>0x$hH)?*-Kt3h!0TQ^N)<5Q3;p2}q@scvSWl_?9>BlvjlCtm8;URYGKM~Bhd zxt%4=9OPbKS1l?PpcH|hrbGyde+x6yY_s-2=xpl~U$82Q0N~;uH~IXciJI7izDhnD z=0c%pF2ib#-Eotoof2gNBxk^+P%<^u5X-st3{_hcikb6*ij{X714{~0b|xDISV-Dho0Wngtf#g0zW&0WVJ$fMGY)q|=T0cK>m(KfN3h9Zr*D43Sb zLO6{S`V1RnOv@_J<<{wz{v~o|B^(=7kY*SxaMWZSE({0JsT<7gu!eRMB%^DdFBK}U z;h>UO6LmLuh-2qwI?L-B2`KSp=xF2d5^~0w_W7ZXA_y*|Eul2e`G7ol)3#T_&E@dP z)YWRQrrx~?yQp9{m=L&ez7_iERpm4E23(H0i`TQ?2oeLW7^(3khBs{bo+bq*4%DeU z$RelBmk|$Tw&>wyKWtkn&5Z|Z-%8LI?ER2;T^aWbO=dxRbDySBOr!20Z;uzQR?Szi zbSeX>c{HyFnblu(rD|2FEH(?qn>jAbHh_>$wEJK+QHtr4I??Bn`Vwa+Td({9N0g!))-`?Vh6H7$-(Q;0 z*tWzg;^Fp0b;4KC^%Dv<93J3aOHH*Gh{5==?gK?wTN6pFU}#U2U0wB_r@zoAGL-uA zG_#v{(%NpuWzq2)NhKf2BReZ@w6ry@eTymnG0d= z=jFe!_)Jv^lPeAGW7jnF(Dd$DV1D>@a=!+_{ Date: Thu, 5 Nov 2020 17:35:59 +0800 Subject: [PATCH 126/217] Upgrade version to 1.8.0 for release (#55) --- pom.xml | 4 ++-- src/main/java/com/baidu/hugegraph/version/CommonVersion.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index d7a1c5989a..f271922504 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.7.9 + 1.8.0 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -260,7 +260,7 @@ - 1.7.9.0 + 1.8.0.0 diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index dda70faece..28e0393498 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.7.9"); + "1.8.0"); } From 9962e0c9c9ac2ebe55e1f1b166618cc8d902075a Mon Sep 17 00:00:00 2001 From: zhoney Date: Tue, 17 Nov 2020 17:19:23 +0800 Subject: [PATCH 127/217] fix https+auth bug (#57) Change-Id: Ic791c21271c9c9ca60b0ff4294feb5fe2165452a --- pom.xml | 4 +- .../hugegraph/rest/AbstractRestClient.java | 117 ++++++++++++------ .../hugegraph/version/CommonVersion.java | 2 +- .../hugegraph/unit/rest/RestClientTest.java | 8 +- 4 files changed, 83 insertions(+), 48 deletions(-) diff --git a/pom.xml b/pom.xml index f271922504..c356050534 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.8.0 + 1.8.1 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -260,7 +260,7 @@ - 1.8.0.0 + 1.8.1.0 diff --git a/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java b/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java index e4907f6d9b..3507169d36 100644 --- a/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java +++ b/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java @@ -47,6 +47,11 @@ import javax.ws.rs.core.Variant; import org.apache.commons.lang3.tuple.Pair; +import org.apache.http.config.Registry; +import org.apache.http.config.RegistryBuilder; +import org.apache.http.conn.socket.ConnectionSocketFactory; +import org.apache.http.conn.socket.PlainConnectionSocketFactory; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.pool.PoolStats; import org.glassfish.jersey.SslConfigurator; @@ -60,6 +65,7 @@ import org.glassfish.jersey.message.GZipEncoder; import org.glassfish.jersey.uri.UriComponent; +import com.baidu.hugegraph.util.E; import com.baidu.hugegraph.util.ExecutorUtil; import com.google.common.collect.ImmutableMap; @@ -112,25 +118,19 @@ public AbstractRestClient(String url, String user, String password, public AbstractRestClient(String url, String user, String password, int timeout, int maxTotal, int maxPerRoute, - String protocol, String trustStoreFile, + String trustStoreFile, String trustStorePassword) { this(url, new ConfigBuilder().configTimeout(timeout) .configUser(user, password) .configPool(maxTotal, maxPerRoute) - .configSSL(protocol, trustStoreFile, + .configSSL(trustStoreFile, trustStorePassword) .build()); } public AbstractRestClient(String url, ClientConfig config) { - Client client = null; - Object protocol = config.getProperty("protocol"); - if (protocol != null && protocol.equals("https")) { - client = wrapTrustConfig(url, config); - } else { - client = ClientBuilder.newClient(config); - } - this.client = client; + configConnectionManager(url, config); + this.client = ClientBuilder.newClient(config); this.client.register(GZipEncoder.class); this.target = this.client.target(url); this.pool = (PoolingHttpClientConnectionManager) config.getProperty( @@ -340,25 +340,69 @@ private Pair> buildRequest( return Pair.of(builder, entity); } - private static Client wrapTrustConfig(String url, ClientConfig config) { - SslConfigurator sslConfig = SslConfigurator.newInstance(); - String trustStoreFile = config.getProperty("trustStoreFile").toString(); - String trustStorePassword = config.getProperty("trustStorePassword") - .toString(); - sslConfig.trustStoreFile(trustStoreFile) - .trustStorePassword(trustStorePassword); - sslConfig.securityProtocol("SSL"); - SSLContext context = sslConfig.createSSLContext(); + private static void configConnectionManager(String url, ClientConfig conf) { + /* + * Using httpclient with connection pooling, and configuring the + * jersey connector, reference: + * http://www.theotherian.com/2013/08/jersey-client-2.0-httpclient-timeouts-max-connections.html + * https://stackoverflow.com/questions/43228051/memory-issue-with-jax-rs-using-jersey/46175943#46175943 + * + * But the jersey that has been released in the maven central + * repository seems to have a bug. + * https://github.com/jersey/jersey/pull/3752 + */ + PoolingHttpClientConnectionManager pool = connectionManager(url, conf); + Object maxTotal = conf.getProperty("maxTotal"); + Object maxPerRoute = conf.getProperty("maxPerRoute"); + if (maxTotal != null) { + pool.setMaxTotal((int) maxTotal); + } + if (maxPerRoute != null) { + pool.setDefaultMaxPerRoute((int) maxPerRoute); + } + conf.property(ApacheClientProperties.CONNECTION_MANAGER, pool); + conf.connectorProvider(new ApacheConnectorProvider()); + } + + private static PoolingHttpClientConnectionManager connectionManager( + String url, + ClientConfig conf) { + String protocol = (String) conf.getProperty("protocol"); + if (protocol == null || protocol.equals("http")) { + return new PoolingHttpClientConnectionManager(TTL, TimeUnit.HOURS); + } + + assert protocol.equals("https"); + String trustStoreFile = (String) conf.getProperty("trustStoreFile"); + E.checkArgument(trustStoreFile != null && !trustStoreFile.isEmpty(), + "The trust store file must be set when use https"); + String trustStorePass = (String) conf.getProperty("trustStorePassword"); + E.checkArgument(trustStorePass != null, + "The trust store password must be set when use https"); + SSLContext context = SslConfigurator.newInstance() + .trustStoreFile(trustStoreFile) + .trustStorePassword(trustStorePass) + .securityProtocol("SSL") + .createSSLContext(); TrustManager[] trustAllManager = NoCheckTrustManager.create(); try { context.init(null, trustAllManager, new SecureRandom()); } catch (KeyManagementException e) { throw new ClientException("Failed to init security management", e); } - return ClientBuilder.newBuilder() - .hostnameVerifier(new HostNameVerifier(url)) - .sslContext(context) - .build(); + + HostnameVerifier verifier = new HostNameVerifier(url); + ConnectionSocketFactory httpSocketFactory, httpsSocketFactory; + httpSocketFactory = PlainConnectionSocketFactory.getSocketFactory(); + httpsSocketFactory = new SSLConnectionSocketFactory(context, verifier); + Registry registry = + RegistryBuilder.create() + .register("http", httpSocketFactory) + .register("https", httpsSocketFactory) + .build(); + return new PoolingHttpClientConnectionManager(registry, null, + null, null, TTL, + TimeUnit.HOURS); } public static String encode(String raw) { @@ -441,22 +485,8 @@ public ConfigBuilder configUser(String username, String password) { } public ConfigBuilder configPool(int maxTotal, int maxPerRoute) { - /* - * Using httpclient with connection pooling, and configuring the - * jersey connector, reference: - * http://www.theotherian.com/2013/08/jersey-client-2.0-httpclient-timeouts-max-connections.html - * https://stackoverflow.com/questions/43228051/memory-issue-with-jax-rs-using-jersey/46175943#46175943 - * - * But the jersey that has been released in the maven central - * repository seems to have a bug. - * https://github.com/jersey/jersey/pull/3752 - */ - PoolingHttpClientConnectionManager pool; - pool = new PoolingHttpClientConnectionManager(TTL, TimeUnit.HOURS); - pool.setMaxTotal(maxTotal); - pool.setDefaultMaxPerRoute(maxPerRoute); - this.config.property(ApacheClientProperties.CONNECTION_MANAGER, pool); - this.config.connectorProvider(new ApacheConnectorProvider()); + this.config.property("maxTotal", maxTotal); + this.config.property("maxPerRoute", maxPerRoute); return this; } @@ -465,9 +495,14 @@ public ConfigBuilder configIdleTime(int idleTime) { return this; } - public ConfigBuilder configSSL(String protocol, String trustStoreFile, + public ConfigBuilder configSSL(String trustStoreFile, String trustStorePassword) { - this.config.property("protocol", protocol); + if (trustStoreFile == null || trustStoreFile.isEmpty() || + trustStorePassword == null) { + this.config.property("protocol", "http"); + } else { + this.config.property("protocol", "https"); + } this.config.property("trustStoreFile", trustStoreFile); this.config.property("trustStorePassword", trustStorePassword); return this; diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 28e0393498..6a0e3109e3 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.8.0"); + "1.8.1"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java b/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java index 5649b1a471..ab3c419d26 100644 --- a/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java @@ -96,10 +96,10 @@ public RestClientImpl(String url, String user, String password, public RestClientImpl(String url, String user, String password, int timeout, int maxTotal, int maxPerRoute, - String protocol, String trustStoreFile, - String trustStorePassword, int status) { + String trustStoreFile, String trustStorePassword, + int status) { super(url, user, password, timeout, maxTotal, maxPerRoute, - protocol, trustStoreFile, trustStorePassword); + trustStoreFile, trustStorePassword); this.status = status; this.headers = ImmutableMultivaluedMap.empty(); this.content = ""; @@ -225,7 +225,7 @@ public void testPostHttpsWithAllParams() { String trustStoreFile = "src/test/resources/cacerts.jks"; String trustStorePassword = "changeit"; RestClient client = new RestClientImpl("/test", "user", "", 1000, - 10, 5, "https", trustStoreFile, + 10, 5, trustStoreFile, trustStorePassword, 200); RestResult restResult = client.post("path", "body"); Assert.assertEquals(200, restResult.status()); From 37de7be0ee4f13476a394ba708839d5897f514d9 Mon Sep 17 00:00:00 2001 From: Linary Date: Mon, 14 Dec 2020 15:14:50 +0800 Subject: [PATCH 128/217] Improve SafeDateFormat by joda DateTimeFormatter (#59) Fix #58 --- pom.xml | 10 +++- .../baidu/hugegraph/date/SafeDateFormat.java | 59 ++++++++++--------- .../com/baidu/hugegraph/util/DateUtil.java | 7 --- .../baidu/hugegraph/util/OrderLimitMap.java | 1 + .../hugegraph/version/CommonVersion.java | 2 +- .../unit/date/SafeDateFormatTest.java | 32 +++++++++- .../unit/license/LicenseCreateParamTest.java | 6 +- .../hugegraph/unit/util/DateUtilTest.java | 43 +++++++++++++- .../unit/util/OrderLimitMapTest.java | 9 +++ 9 files changed, 126 insertions(+), 43 deletions(-) diff --git a/pom.xml b/pom.xml index c356050534..7f77ac06af 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.8.1 + 1.8.2 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -147,6 +147,12 @@ ${jsr305.version} + + joda-time + joda-time + 2.10.8 + + org.javassist @@ -260,7 +266,7 @@ - 1.8.1.0 + 1.8.2.0 diff --git a/src/main/java/com/baidu/hugegraph/date/SafeDateFormat.java b/src/main/java/com/baidu/hugegraph/date/SafeDateFormat.java index 9994aba146..c8fa31ddce 100644 --- a/src/main/java/com/baidu/hugegraph/date/SafeDateFormat.java +++ b/src/main/java/com/baidu/hugegraph/date/SafeDateFormat.java @@ -19,40 +19,49 @@ package com.baidu.hugegraph.date; -import java.text.DateFormat; -import java.text.FieldPosition; -import java.text.ParsePosition; -import java.text.SimpleDateFormat; import java.util.Date; +import java.util.TimeZone; + +import org.joda.time.DateTimeZone; +import org.joda.time.format.DateTimeFormat; +import org.joda.time.format.DateTimeFormatter; /** - * SafeDateFormat is a thread safe DateFormat - * NOTE: DateFormat is not thread safe, need synchronized manually. - * http://blog.jrwang.me/2016/java-simpledateformat-multithread-threadlocal + * The SafeDateFormat actually is a proxy for joda DateTimeFormatter */ -public class SafeDateFormat extends DateFormat { +public class SafeDateFormat { - private static final long serialVersionUID = -4838048315029312489L; + private static final int ONE_HOUR_MS = 3600 * 1000; - private final ThreadLocal formatter; + private final String pattern; + private DateTimeFormatter formatter; - public SafeDateFormat(String template) { - this.formatter = ThreadLocal.withInitial(() -> { - return new SimpleDateFormat(template); - }); - this.setCalendar(this.formatter.get().getCalendar()); - this.setNumberFormat(this.formatter.get().getNumberFormat()); + public SafeDateFormat(String pattern) { + this.pattern = pattern; + this.formatter = DateTimeFormat.forPattern(pattern); } - @Override - public StringBuffer format(Date date, StringBuffer toAppendTo, - FieldPosition fieldPosition) { - return this.formatter.get().format(date, toAppendTo, fieldPosition); + public synchronized void setTimeZone(String zoneId) { + int hoursOffset = TimeZone.getTimeZone(zoneId).getRawOffset() / + ONE_HOUR_MS; + DateTimeZone zone = DateTimeZone.forOffsetHours(hoursOffset); + this.formatter = this.formatter.withZone(zone); } - @Override - public Date parse(String source, ParsePosition pos) { - return this.formatter.get().parse(source, pos); + public TimeZone getTimeZome() { + return this.formatter.getZone().toTimeZone(); + } + + public Date parse(String source) { + return this.formatter.parseDateTime(source).toDate(); + } + + public String format(Date date) { + return this.formatter.print(date.getTime()); + } + + public Object toPattern() { + return this.pattern; } @Override @@ -60,8 +69,4 @@ public Object clone() { // No need to clone due to itself is thread safe return this; } - - public Object toPattern() { - return this.formatter.get().toPattern(); - } } diff --git a/src/main/java/com/baidu/hugegraph/util/DateUtil.java b/src/main/java/com/baidu/hugegraph/util/DateUtil.java index 71e89b5e7f..2295101405 100644 --- a/src/main/java/com/baidu/hugegraph/util/DateUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/DateUtil.java @@ -73,13 +73,6 @@ private static SafeDateFormat getDateFormat(String df) { SafeDateFormat dateFormat = DATE_FORMATS.get(df); if (dateFormat == null) { dateFormat = new SafeDateFormat(df); - /* - * Specify whether or not date/time parsing is to be lenient. - * With lenient parsing, the parser may use heuristics to interpret - * inputs that do not precisely match this object's format. - * With strict parsing, inputs must match this object's format. - */ - dateFormat.setLenient(false); SafeDateFormat previous = DATE_FORMATS.putIfAbsent(df, dateFormat); if (previous != null) { dateFormat = previous; diff --git a/src/main/java/com/baidu/hugegraph/util/OrderLimitMap.java b/src/main/java/com/baidu/hugegraph/util/OrderLimitMap.java index f7e6cf7c7c..0c22f459f1 100644 --- a/src/main/java/com/baidu/hugegraph/util/OrderLimitMap.java +++ b/src/main/java/com/baidu/hugegraph/util/OrderLimitMap.java @@ -61,6 +61,7 @@ private OrderLimitMap(int capacity, Ordering ordering, */ super(ordering.onResultOf(Functions.forMap(valueMap)) .compound(Ordering.natural())); + E.checkArgument(capacity > 0, "The capacity must be > 0"); this.capacity = capacity; this.valueMap = valueMap; } diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 6a0e3109e3..ec438d335a 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.8.1"); + "1.8.2"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/date/SafeDateFormatTest.java b/src/test/java/com/baidu/hugegraph/unit/date/SafeDateFormatTest.java index f5133a93bb..418424d26d 100644 --- a/src/test/java/com/baidu/hugegraph/unit/date/SafeDateFormatTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/date/SafeDateFormatTest.java @@ -20,9 +20,12 @@ package com.baidu.hugegraph.unit.date; import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.TimeZone; import java.util.concurrent.CountDownLatch; import org.junit.Test; @@ -33,10 +36,9 @@ public class SafeDateFormatTest { - @SuppressWarnings("deprecation") @Test public void testSafeDateFormatInConcurrency() throws Exception { - DateFormat format = new SafeDateFormat("yyyy-MM-dd"); + SafeDateFormat format = new SafeDateFormat("yyyy-MM-dd"); List sources = ImmutableList.of( "2010-01-01", "2011-02-02", @@ -97,4 +99,30 @@ public void testSafeDateFormatInConcurrency() throws Exception { Assert.assertTrue(exceptions.isEmpty()); } + + @Test + public void testTimeZone() throws ParseException { + DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + df.setTimeZone(TimeZone.getTimeZone("GMT+10")); + + SafeDateFormat sdf = new SafeDateFormat("yyyy-MM-dd HH:mm:ss"); + sdf.setTimeZone("GMT+10"); + + Assert.assertEquals(df.getTimeZone(), sdf.getTimeZome()); + Assert.assertEquals(df.parse("2019-08-10 00:00:00"), + sdf.parse("2019-08-10 00:00:00")); + Assert.assertEquals("2019-08-10 00:00:00", + sdf.format(sdf.parse("2019-08-10 00:00:00"))); + Assert.assertEquals(df.format(df.parse("2019-08-10 00:00:00")), + sdf.format(sdf.parse("2019-08-10 00:00:00"))); + + sdf.setTimeZone("GMT+11"); + Assert.assertNotEquals(df.getTimeZone(), sdf.getTimeZome()); + Assert.assertNotEquals(df.parse("2019-08-10 00:00:00"), + sdf.parse("2019-08-10 00:00:00")); + Assert.assertEquals("2019-08-10 00:00:00", + sdf.format(sdf.parse("2019-08-10 00:00:00"))); + Assert.assertEquals(df.format(df.parse("2019-08-10 00:00:00")), + sdf.format(sdf.parse("2019-08-10 00:00:00"))); + } } diff --git a/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java b/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java index 7000cb5934..6a2425919d 100644 --- a/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java @@ -22,6 +22,8 @@ import java.io.IOException; import java.text.DateFormat; import java.text.ParseException; +import java.time.ZoneId; +import java.util.Arrays; import java.util.TimeZone; import org.junit.Test; @@ -93,8 +95,8 @@ public void testDeserializeLicenseCreateParam() Assert.assertEquals("./hugegraph-evaluation.license", param.licensePath()); - DateFormat df = new SafeDateFormat("yyyy-MM-dd HH:mm:ss"); - df.setTimeZone(TimeZone.getTimeZone("GMT+08:00")); + SafeDateFormat df = new SafeDateFormat("yyyy-MM-dd HH:mm:ss"); + df.setTimeZone("GMT+8"); Assert.assertEquals(df.parse("2019-08-10 00:00:00"), param.issuedTime()); Assert.assertEquals(df.parse("2019-08-10 00:00:00"), diff --git a/src/test/java/com/baidu/hugegraph/unit/util/DateUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/DateUtilTest.java index b84384e075..9ac0956960 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/DateUtilTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/DateUtilTest.java @@ -19,7 +19,12 @@ package com.baidu.hugegraph.unit.util; +import java.text.ParseException; +import java.util.ArrayList; import java.util.Date; +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.atomic.AtomicInteger; import org.junit.Test; @@ -45,7 +50,8 @@ public void testParse() { Assert.assertThrows(IllegalArgumentException.class, () -> { DateUtil.parse("2018-15-07 12:00:00"); }, e -> { - Assert.assertContains(", expect format: ", e.getMessage()); + Assert.assertContains("Value 15 for monthOfYear must be " + + "in the range [1,12]", e.getMessage()); }); } @@ -61,6 +67,39 @@ public void testNow() { Assert.assertTrue(date1.before(date2)); } + @Test + public void testParseCornerDateValue() throws InterruptedException { + final CountDownLatch latch = new CountDownLatch(1); + int threadCount = 10; + List threads = new ArrayList<>(threadCount); + AtomicInteger errorCount = new AtomicInteger(0); + for (int t = 0; t < threadCount; t++) { + Thread thread = new Thread(() -> { + try { + latch.await(); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + try { + DateUtil.parse("0", "yyyy"); + } catch (ParseException e) { + errorCount.incrementAndGet(); + } + }); + threads.add(thread); + } + + for (Thread thread : threads) { + thread.start(); + } + latch.countDown(); + for (Thread thread : threads) { + thread.join(); + } + + Assert.assertEquals(0, errorCount.get()); + } + @Test public void testToPattern() { Object pattern = DateUtil.toPattern("yyyyMMdd HH:mm:ss.SSS"); @@ -69,7 +108,7 @@ public void testToPattern() { Assert.assertThrows(IllegalArgumentException.class, () -> { DateUtil.toPattern("iyyyyMMdd"); }, e -> { - Assert.assertContains("Illegal pattern character 'i'", e.getMessage()); + Assert.assertContains("Illegal pattern component: i", e.getMessage()); }); } } diff --git a/src/test/java/com/baidu/hugegraph/unit/util/OrderLimitMapTest.java b/src/test/java/com/baidu/hugegraph/unit/util/OrderLimitMapTest.java index 8786933faa..75137d56ad 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/OrderLimitMapTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/OrderLimitMapTest.java @@ -29,6 +29,15 @@ public class OrderLimitMapTest { + @Test + public void testInvalidCapacity() { + Assert.assertThrows(IllegalArgumentException.class, () -> { + new OrderLimitMap<>(-1); + }, e -> { + Assert.assertEquals("The capacity must be > 0", e.getMessage()); + }); + } + @Test public void testMap() { OrderLimitMap map = new OrderLimitMap<>(5); From f4e861b3a8f7d19e1a7e214ab32705fe813f5f29 Mon Sep 17 00:00:00 2001 From: houzhizhen Date: Mon, 11 Jan 2021 18:01:35 +0800 Subject: [PATCH 129/217] add BarrierEvent (#60) --- pom.xml | 4 +- .../hugegraph/concurrent/BarrierEvent.java | 107 +++++++ .../hugegraph/version/CommonVersion.java | 2 +- .../baidu/hugegraph/unit/UnitTestSuite.java | 2 + .../unit/concurrent/BarrierEventTest.java | 271 ++++++++++++++++++ 5 files changed, 383 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/baidu/hugegraph/concurrent/BarrierEvent.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/concurrent/BarrierEventTest.java diff --git a/pom.xml b/pom.xml index 7f77ac06af..91fb035bc5 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.8.2 + 1.8.3 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -266,7 +266,7 @@ - 1.8.2.0 + 1.8.3.0 diff --git a/src/main/java/com/baidu/hugegraph/concurrent/BarrierEvent.java b/src/main/java/com/baidu/hugegraph/concurrent/BarrierEvent.java new file mode 100644 index 0000000000..ece4c7a4ed --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/concurrent/BarrierEvent.java @@ -0,0 +1,107 @@ +/* + * + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.concurrent; + +import java.util.concurrent.TimeUnit; +import java.util.concurrent.locks.Condition; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; + +import com.baidu.hugegraph.util.E; + +public class BarrierEvent { + + private final Lock lock = new ReentrantLock(); + private final Condition cond = lock.newCondition(); + private volatile boolean signaled = false; + + /** + * Wait forever until the signal is received. + * @return true if signal is received + * @throws InterruptedException if interrupted. + */ + public void await() throws InterruptedException { + this.lock.lock(); + try { + while (!this.signaled) { + this.cond.await(); + } + } finally { + this.lock.unlock(); + } + } + + /** + * Wait specified time in milliseconds. + * @param timeout: the time in millisecond to wait. + * @return true if signal is received, false if time out. + */ + public boolean await(long timeout) throws InterruptedException { + E.checkArgument(timeout >= 0L, + "The time must be >= 0, but got '%d'.", + timeout); + long deadline = System.currentTimeMillis() + timeout; + this.lock.lock(); + try { + while (!this.signaled) { + timeout = deadline - System.currentTimeMillis(); + if (timeout > 0) { + this.cond.await(timeout, TimeUnit.MILLISECONDS); + } + if (System.currentTimeMillis() >= deadline) { + return this.signaled; + } + } + } finally { + this.lock.unlock(); + } + return true; + } + + public void reset() { + this.lock.lock(); + try { + this.signaled = false; + } finally { + this.lock.unlock(); + } + } + + public void signal() { + this.lock.lock(); + try { + this.signaled = true; + this.cond.signal(); + } finally { + this.lock.unlock(); + } + } + + public void signalAll() { + this.lock.lock(); + try { + this.signaled = true; + this.cond.signalAll(); + } finally { + this.lock.unlock(); + } + } +} diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index ec438d335a..4b590a1d05 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.8.2"); + "1.8.3"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java index c6dfa62b68..211806da97 100644 --- a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java +++ b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -32,6 +32,7 @@ import com.baidu.hugegraph.unit.config.HugeConfigTest; import com.baidu.hugegraph.unit.config.OptionSpaceTest; import com.baidu.hugegraph.unit.date.SafeDateFormatTest; +import com.baidu.hugegraph.unit.concurrent.BarrierEventTest; import com.baidu.hugegraph.unit.event.EventHubTest; import com.baidu.hugegraph.unit.iterator.BatchMapperIteratorTest; import com.baidu.hugegraph.unit.iterator.ExtendableIteratorTest; @@ -73,6 +74,7 @@ HugeConfigTest.class, OptionSpaceTest.class, SafeDateFormatTest.class, + BarrierEventTest.class, EventHubTest.class, PerfUtilTest.class, RestClientTest.class, diff --git a/src/test/java/com/baidu/hugegraph/unit/concurrent/BarrierEventTest.java b/src/test/java/com/baidu/hugegraph/unit/concurrent/BarrierEventTest.java new file mode 100644 index 0000000000..c81aa3d1fa --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/concurrent/BarrierEventTest.java @@ -0,0 +1,271 @@ +package com.baidu.hugegraph.unit.concurrent; + +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; + +import org.junit.Test; + +import com.baidu.hugegraph.concurrent.BarrierEvent; +import com.baidu.hugegraph.testutil.Assert; + +public class BarrierEventTest { + + private static int WAIT_THREADS_COUNT = 10; + + @Test(timeout = 5000) + public void testAWait() throws InterruptedException { + BarrierEvent barrierEvent = new BarrierEvent(); + AtomicInteger result = new AtomicInteger(0); + CountDownLatch latch = new CountDownLatch(2); + Thread awaitThread = new Thread(() -> { + try { + barrierEvent.await(); + result.incrementAndGet(); + } catch (InterruptedException e) { + // Do nothing. + } finally { + latch.countDown(); + } + }); + awaitThread.start(); + Thread signalThread = new Thread(() -> { + barrierEvent.signalAll(); + latch.countDown(); + }); + signalThread.start(); + latch.await(); + Assert.assertEquals(1, result.get()); + } + + @Test + public void testAWaitWithTimeout() throws InterruptedException { + BarrierEvent barrierEvent = new BarrierEvent(); + boolean signaled = barrierEvent.await(1L); + Assert.assertFalse(signaled); + } + + @Test + public void testReset() throws InterruptedException { + BarrierEvent barrierEvent = new BarrierEvent(); + boolean signaled = barrierEvent.await(1L); + Assert.assertFalse(signaled); + barrierEvent.signal(); + signaled = barrierEvent.await(1L); + Assert.assertTrue(signaled); + barrierEvent.reset(); + signaled = barrierEvent.await(1L); + Assert.assertFalse(signaled); + } + + @Test + public void testSignal() throws InterruptedException { + BarrierEvent barrierEvent = new BarrierEvent(); + boolean signaled = barrierEvent.await(1L); + Assert.assertFalse(signaled); + barrierEvent.signal(); + signaled = barrierEvent.await(1L); + Assert.assertTrue(signaled); + } + + @Test + public void testSignalByMultiThreadWithSignalFirst() + throws InterruptedException { + BarrierEvent barrierEvent = new BarrierEvent(); + AtomicInteger eventCount = new AtomicInteger(0); + AtomicInteger waitThreadInterruptedCount = new AtomicInteger(0); + ExecutorService executorService = + Executors.newFixedThreadPool(WAIT_THREADS_COUNT + 1); + CountDownLatch waitLatch = new CountDownLatch(WAIT_THREADS_COUNT); + CountDownLatch signalLatch = new CountDownLatch(1); + for (int i = 0; i < WAIT_THREADS_COUNT; i++) { + executorService.submit(() -> { + try { + signalLatch.await(); + barrierEvent.await(); + eventCount.incrementAndGet(); + } catch (InterruptedException e) { + waitThreadInterruptedCount.incrementAndGet(); + } finally { + waitLatch.countDown(); + } + }); + } + + executorService.submit(() -> { + barrierEvent.signal(); + signalLatch.countDown(); + }); + + executorService.shutdown(); + executorService.awaitTermination(2L, TimeUnit.SECONDS); + waitLatch.await(); + Assert.assertEquals(10, eventCount.get()); + Assert.assertEquals(0, waitThreadInterruptedCount.get()); + } + + @Test + public void testSignalByMultiThreadWithSignalLast() + throws InterruptedException { + BarrierEvent barrierEvent = new BarrierEvent(); + AtomicInteger eventCount = new AtomicInteger(0); + AtomicInteger waitThreadInterruptedCount = new AtomicInteger(0); + AtomicInteger signalThreadInterruptedCount = new AtomicInteger(0); + ExecutorService executorService = + Executors.newFixedThreadPool(WAIT_THREADS_COUNT + 1); + CountDownLatch waitLatch = new CountDownLatch(WAIT_THREADS_COUNT); + CountDownLatch signalLatch = new CountDownLatch(1); + for (int i = 0; i < WAIT_THREADS_COUNT; i++) { + executorService.submit(() -> { + try { + waitLatch.countDown(); + barrierEvent.await(); + eventCount.incrementAndGet(); + } catch (InterruptedException e) { + waitThreadInterruptedCount.incrementAndGet(); + } + }); + } + + executorService.submit(() -> { + try { + waitLatch.await(); + } catch (InterruptedException e) { + signalThreadInterruptedCount.incrementAndGet(); + } + barrierEvent.signal(); + signalLatch.countDown(); + }); + signalLatch.await(); + executorService.shutdownNow(); + executorService.awaitTermination(1L, TimeUnit.SECONDS); + Assert.assertEquals(1, eventCount.get()); + Assert.assertEquals(WAIT_THREADS_COUNT - 1, + waitThreadInterruptedCount.get()); + Assert.assertEquals(0, signalThreadInterruptedCount.get()); + } + + @Test + public void testSignalAll() throws InterruptedException { + BarrierEvent barrierEvent = new BarrierEvent(); + boolean signaled = barrierEvent.await(1L); + Assert.assertFalse(signaled); + barrierEvent.signalAll(); + signaled = barrierEvent.await(1L); + Assert.assertTrue(signaled); + } + + @Test + public void testSignalAllByMultiThreadWithSignalFirst() + throws InterruptedException { + BarrierEvent barrierEvent = new BarrierEvent(); + AtomicInteger eventCount = new AtomicInteger(0); + AtomicInteger waitThreadInterruptedCount = new AtomicInteger(0); + ExecutorService executorService = + Executors.newFixedThreadPool(WAIT_THREADS_COUNT + 1); + CountDownLatch waitLatch = new CountDownLatch(WAIT_THREADS_COUNT); + CountDownLatch signalLatch = new CountDownLatch(1); + for (int i = 0; i < WAIT_THREADS_COUNT; i++) { + executorService.submit(() -> { + try { + signalLatch.await(); + waitLatch.countDown(); + barrierEvent.await(); + eventCount.incrementAndGet(); + } catch (InterruptedException e) { + waitThreadInterruptedCount.incrementAndGet(); + } + }); + } + + executorService.submit(() -> { + barrierEvent.signalAll(); + signalLatch.countDown(); + }); + + executorService.shutdown(); + executorService.awaitTermination(1L, TimeUnit.SECONDS); + Assert.assertEquals(10, eventCount.get()); + Assert.assertEquals(0, waitThreadInterruptedCount.get()); + } + + @Test + public void testSignalAllByMultiThreadWithSignalLast() + throws InterruptedException { + BarrierEvent barrierEvent = new BarrierEvent(); + AtomicInteger eventCount = new AtomicInteger(0); + AtomicInteger waitThreadInterruptedCount = new AtomicInteger(0); + AtomicInteger signalThreadInterruptedCount = new AtomicInteger(0); + ExecutorService executorService = + Executors.newFixedThreadPool(WAIT_THREADS_COUNT + 1); + CountDownLatch waitLatch = new CountDownLatch(WAIT_THREADS_COUNT); + CountDownLatch signalLatch = new CountDownLatch(1); + for (int i = 0; i < WAIT_THREADS_COUNT; i++) { + executorService.submit(() -> { + try { + waitLatch.countDown(); + barrierEvent.await(); + eventCount.incrementAndGet(); + } catch (InterruptedException e) { + waitThreadInterruptedCount.incrementAndGet(); + } + }); + } + + executorService.submit(() -> { + try { + waitLatch.await(); + } catch (InterruptedException e) { + signalThreadInterruptedCount.incrementAndGet(); + } + barrierEvent.signalAll(); + signalLatch.countDown(); + }); + signalLatch.await(); + executorService.shutdown(); + executorService.awaitTermination(1L, TimeUnit.SECONDS); + Assert.assertEquals(WAIT_THREADS_COUNT, eventCount.get()); + Assert.assertEquals(0, waitThreadInterruptedCount.get()); + Assert.assertEquals(0, signalThreadInterruptedCount.get()); + } + + @Test + public void testSignalAllByMultiThreadWithSignalAwaitConcurrent() + throws InterruptedException { + BarrierEvent barrierEvent = new BarrierEvent(); + AtomicInteger eventCount = new AtomicInteger(0); + AtomicInteger waitThreadInterruptedCount = new AtomicInteger(0); + AtomicInteger signalThreadInterruptedCount = new AtomicInteger(0); + ExecutorService executorService = + Executors.newFixedThreadPool(WAIT_THREADS_COUNT + 1); + CountDownLatch syncLatch = new CountDownLatch(1); + for (int i = 0; i < WAIT_THREADS_COUNT; i++) { + executorService.submit(() -> { + try { + syncLatch.await(); + barrierEvent.await(); + eventCount.incrementAndGet(); + } catch (InterruptedException e) { + waitThreadInterruptedCount.incrementAndGet(); + } + }); + } + + executorService.submit(() -> { + try { + syncLatch.await(); + } catch (InterruptedException e) { + signalThreadInterruptedCount.incrementAndGet(); + } + barrierEvent.signalAll(); + }); + syncLatch.countDown(); + executorService.shutdown(); + executorService.awaitTermination(1L, TimeUnit.SECONDS); + Assert.assertEquals(WAIT_THREADS_COUNT, eventCount.get()); + Assert.assertEquals(0, waitThreadInterruptedCount.get()); + Assert.assertEquals(0, signalThreadInterruptedCount.get()); + } +} From c80f959579ef4c32843820ec89f803eb7b0af507 Mon Sep 17 00:00:00 2001 From: Linary Date: Wed, 3 Feb 2021 22:03:37 +0800 Subject: [PATCH 130/217] Implement PausableScheduledThreadPool (#61) --- .../PausableScheduledThreadPool.java | 82 ++++++++++++++++ .../baidu/hugegraph/util/ExecutorUtil.java | 15 +++ .../baidu/hugegraph/unit/UnitTestSuite.java | 4 +- .../PausableScheduledThreadPoolTest.java | 95 +++++++++++++++++++ 4 files changed, 195 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/baidu/hugegraph/concurrent/PausableScheduledThreadPool.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java diff --git a/src/main/java/com/baidu/hugegraph/concurrent/PausableScheduledThreadPool.java b/src/main/java/com/baidu/hugegraph/concurrent/PausableScheduledThreadPool.java new file mode 100644 index 0000000000..fb5a5f131d --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/concurrent/PausableScheduledThreadPool.java @@ -0,0 +1,82 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.concurrent; + +import java.util.List; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.ThreadFactory; + +import org.slf4j.Logger; + +import com.baidu.hugegraph.util.Log; + +public class PausableScheduledThreadPool extends ScheduledThreadPoolExecutor { + + private static final Logger LOG = Log.logger( + PausableScheduledThreadPool.class); + + private volatile boolean paused = false; + + public PausableScheduledThreadPool(int corePoolSize, + ThreadFactory factory) { + super(corePoolSize, factory); + } + + public synchronized void pauseSchedule() { + this.paused = true; + LOG.info("PausableScheduledThreadPool was paused"); + } + + public synchronized void resumeSchedule() { + this.paused = false; + this.notifyAll(); + LOG.info("PausableScheduledThreadPool was resumed"); + } + + @Override + protected void beforeExecute(Thread t, Runnable r) { + synchronized (this) { + while (this.paused) { + try { + this.wait(); + } catch (InterruptedException e) { + LOG.warn("PausableScheduledThreadPool was interrupted"); + } + } + } + super.beforeExecute(t, r); + } + + @Override + public void shutdown() { + if (this.paused) { + this.resumeSchedule(); + } + super.shutdown(); + } + + @Override + public List shutdownNow() { + if (this.paused) { + this.resumeSchedule(); + } + return super.shutdownNow(); + } +} diff --git a/src/main/java/com/baidu/hugegraph/util/ExecutorUtil.java b/src/main/java/com/baidu/hugegraph/util/ExecutorUtil.java index e30893021d..087f8d00f5 100644 --- a/src/main/java/com/baidu/hugegraph/util/ExecutorUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/ExecutorUtil.java @@ -26,6 +26,8 @@ import org.apache.commons.lang3.concurrent.BasicThreadFactory; +import com.baidu.hugegraph.concurrent.PausableScheduledThreadPool; + public final class ExecutorUtil { public static ExecutorService newFixedThreadPool(String name) { @@ -50,4 +52,17 @@ public static ScheduledExecutorService newScheduledThreadPool(int size, .build(); return Executors.newScheduledThreadPool(size, factory); } + + public static PausableScheduledThreadPool newPausableScheduledThreadPool( + String name) { + return newPausableScheduledThreadPool(1, name); + } + + public static PausableScheduledThreadPool newPausableScheduledThreadPool( + int size, String name) { + ThreadFactory factory = new BasicThreadFactory.Builder() + .namingPattern(name) + .build(); + return new PausableScheduledThreadPool(size, factory); + } } diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java index 211806da97..8b84932fed 100644 --- a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java +++ b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -25,6 +25,7 @@ import com.baidu.hugegraph.testutil.AssertTest; import com.baidu.hugegraph.testutil.WhiteboxTest; import com.baidu.hugegraph.unit.concurrent.AtomicLockTest; +import com.baidu.hugegraph.unit.concurrent.BarrierEventTest; import com.baidu.hugegraph.unit.concurrent.KeyLockTest; import com.baidu.hugegraph.unit.concurrent.LockGroupTest; import com.baidu.hugegraph.unit.concurrent.LockManagerTest; @@ -32,7 +33,6 @@ import com.baidu.hugegraph.unit.config.HugeConfigTest; import com.baidu.hugegraph.unit.config.OptionSpaceTest; import com.baidu.hugegraph.unit.date.SafeDateFormatTest; -import com.baidu.hugegraph.unit.concurrent.BarrierEventTest; import com.baidu.hugegraph.unit.event.EventHubTest; import com.baidu.hugegraph.unit.iterator.BatchMapperIteratorTest; import com.baidu.hugegraph.unit.iterator.ExtendableIteratorTest; @@ -49,6 +49,7 @@ import com.baidu.hugegraph.unit.perf.PerfUtilTest; import com.baidu.hugegraph.unit.rest.RestClientTest; import com.baidu.hugegraph.unit.rest.RestResultTest; +import com.baidu.hugegraph.unit.concurrent.PausableScheduledThreadPoolTest; import com.baidu.hugegraph.unit.util.BytesTest; import com.baidu.hugegraph.unit.util.CollectionUtilTest; import com.baidu.hugegraph.unit.util.DateUtilTest; @@ -70,6 +71,7 @@ AtomicLockTest.class, KeyLockTest.class, RowLockTest.class, + PausableScheduledThreadPoolTest.class, HugeConfigTest.class, OptionSpaceTest.class, diff --git a/src/test/java/com/baidu/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java b/src/test/java/com/baidu/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java new file mode 100644 index 0000000000..b4feff6ae5 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java @@ -0,0 +1,95 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.concurrent; + +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; + +import org.junit.Assert; +import org.junit.Test; + +import com.baidu.hugegraph.concurrent.PausableScheduledThreadPool; +import com.baidu.hugegraph.util.ExecutorUtil; + +public class PausableScheduledThreadPoolTest { + + @Test + public void testscheduleWithFixedDelay() throws InterruptedException { + PausableScheduledThreadPool executor = + ExecutorUtil.newPausableScheduledThreadPool("test"); + long period = 500L; + AtomicInteger counter = new AtomicInteger(0); + executor.scheduleWithFixedDelay(() -> { + System.out.println("counter: " + counter.incrementAndGet()); + }, period, period, TimeUnit.MILLISECONDS); + + Thread.sleep((long) (2.1 * period)); + Assert.assertEquals(2, counter.get()); + + // pause + executor.pauseSchedule(); + Thread.sleep(period); + Assert.assertEquals(2, counter.get()); + + // resume + executor.resumeSchedule(); + Thread.sleep((long) (0.5 * period)); + Assert.assertEquals(3, counter.get()); + + Thread.sleep((long) (0.6 * period)); + Assert.assertEquals(4, counter.get()); + + // pause again + executor.pauseSchedule(); + + executor.shutdown(); + executor.awaitTermination(3L, TimeUnit.SECONDS); + } + + @Test + public void testscheduleWithFixedRate() throws InterruptedException { + PausableScheduledThreadPool executor = + ExecutorUtil.newPausableScheduledThreadPool(2, "test"); + long period = 500L; + AtomicInteger counter = new AtomicInteger(0); + executor.scheduleAtFixedRate(() -> { + System.out.println("counter: " + counter.incrementAndGet()); + }, period, period, TimeUnit.MILLISECONDS); + + Thread.sleep((long) (2.1 * period)); + Assert.assertEquals(2, counter.get()); + + // pause + executor.pauseSchedule(); + Thread.sleep(period); + Assert.assertEquals(2, counter.get()); + + // resume + executor.resumeSchedule(); + Thread.sleep((long) (1.1 * period)); + Assert.assertEquals(4, counter.get()); + + // pause again + executor.pauseSchedule(); + + executor.shutdownNow(); + executor.awaitTermination(3L, TimeUnit.SECONDS); + } +} From cde7763cc239d651f8b6245c9fffcee133eb1bf0 Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Thu, 25 Feb 2021 20:05:39 +0800 Subject: [PATCH 131/217] fix BatchMapperIterator stopped when fetched none in the middle batch (#64) Change-Id: I658d8e95a68c8a9494efa98e88f350cf6d65b021 --- .../iterator/BatchMapperIterator.java | 10 ++- .../hugegraph/iterator/WrappedIterator.java | 6 +- .../iterator/BatchMapperIteratorTest.java | 84 +++++++++++++++++++ 3 files changed, 93 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/baidu/hugegraph/iterator/BatchMapperIterator.java b/src/main/java/com/baidu/hugegraph/iterator/BatchMapperIterator.java index 6b2a9135f9..283fc45043 100644 --- a/src/main/java/com/baidu/hugegraph/iterator/BatchMapperIterator.java +++ b/src/main/java/com/baidu/hugegraph/iterator/BatchMapperIterator.java @@ -55,14 +55,16 @@ protected final boolean fetch() { return true; } - List list = this.nextBatch(); - if (!list.isEmpty()) { - assert this.batchIterator == null; + List batch = this.nextBatch(); + assert this.batchIterator == null; + while (!batch.isEmpty()) { // Do fetch - this.batchIterator = this.mapperCallback.apply(list); + this.batchIterator = this.mapperCallback.apply(batch); if (this.batchIterator != null && this.fetchFromBatch()) { return true; } + // Try next batch + batch = this.nextBatch(); } return false; } diff --git a/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java b/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java index c6e9ae7bc5..21c4e9ee7e 100644 --- a/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java +++ b/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java @@ -44,9 +44,9 @@ public boolean hasNext() { public R next() { if (this.current == none()) { this.fetch(); - } - if (this.current == none()) { - throw new NoSuchElementException(); + if (this.current == none()) { + throw new NoSuchElementException(); + } } R current = this.current; this.current = none(); diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/BatchMapperIteratorTest.java b/src/test/java/com/baidu/hugegraph/unit/iterator/BatchMapperIteratorTest.java index e08ff69216..a5d33d7413 100644 --- a/src/test/java/com/baidu/hugegraph/unit/iterator/BatchMapperIteratorTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/iterator/BatchMapperIteratorTest.java @@ -24,6 +24,7 @@ import java.util.Iterator; import java.util.List; import java.util.NoSuchElementException; +import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Function; import org.junit.Test; @@ -235,6 +236,42 @@ public void testMapperReturnNullThenHasNext() { }); Assert.assertFalse(results.hasNext()); Assert.assertFalse(results.hasNext()); + + AtomicInteger count1 = new AtomicInteger(0); + results = new BatchMapperIterator<>(1, DATA3.iterator(), batch -> { + if (count1.incrementAndGet() == 1) { + return null; + } + return batch.iterator(); + }); + Assert.assertTrue(results.hasNext()); + Assert.assertEquals(5, results.next()); + Assert.assertEquals(6, results.next()); + Assert.assertFalse(results.hasNext()); + + AtomicInteger count2 = new AtomicInteger(0); + results = new BatchMapperIterator<>(1, DATA3.iterator(), batch -> { + if (count2.incrementAndGet() == 2) { + return null; + } + return batch.iterator(); + }); + Assert.assertTrue(results.hasNext()); + Assert.assertEquals(4, results.next()); + Assert.assertEquals(6, results.next()); + Assert.assertFalse(results.hasNext()); + + AtomicInteger count3 = new AtomicInteger(0); + results = new BatchMapperIterator<>(1, DATA3.iterator(), batch -> { + if (count3.incrementAndGet() == 3) { + return null; + } + return batch.iterator(); + }); + Assert.assertTrue(results.hasNext()); + Assert.assertEquals(4, results.next()); + Assert.assertEquals(5, results.next()); + Assert.assertFalse(results.hasNext()); } @Test @@ -252,6 +289,53 @@ public void testMapperReturnNullThenNext() { }); } + @Test + public void testMapperReturnEmptyThenHasNext() { + Iterator results; + + results = new BatchMapperIterator<>(1, DATA3.iterator(), batch -> { + return Collections.emptyIterator(); + }); + Assert.assertFalse(results.hasNext()); + Assert.assertFalse(results.hasNext()); + + AtomicInteger count1 = new AtomicInteger(0); + results = new BatchMapperIterator<>(1, DATA3.iterator(), batch -> { + if (count1.incrementAndGet() == 1) { + return Collections.emptyIterator(); + } + return batch.iterator(); + }); + Assert.assertTrue(results.hasNext()); + Assert.assertEquals(5, results.next()); + Assert.assertEquals(6, results.next()); + Assert.assertFalse(results.hasNext()); + + AtomicInteger count2 = new AtomicInteger(0); + results = new BatchMapperIterator<>(1, DATA3.iterator(), batch -> { + if (count2.incrementAndGet() == 2) { + return Collections.emptyIterator(); + } + return batch.iterator(); + }); + Assert.assertTrue(results.hasNext()); + Assert.assertEquals(4, results.next()); + Assert.assertEquals(6, results.next()); + Assert.assertFalse(results.hasNext()); + + AtomicInteger count3 = new AtomicInteger(0); + results = new BatchMapperIterator<>(1, DATA3.iterator(), batch -> { + if (count3.incrementAndGet() == 3) { + return Collections.emptyIterator(); + } + return batch.iterator(); + }); + Assert.assertTrue(results.hasNext()); + Assert.assertEquals(4, results.next()); + Assert.assertEquals(5, results.next()); + Assert.assertFalse(results.hasNext()); + } + @Test public void testClose() throws Exception { CloseableItor vals = new CloseableItor<>(DATA1.iterator()); From ccc4d3bd6a1394ae658a5178a10054d399bed70a Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Mon, 1 Mar 2021 21:46:06 +0800 Subject: [PATCH 132/217] add LimitIterator class (#62) * bump up version 1.8.4 Change-Id: I5d150e0c30f83200880cf8dd95e6e4b3678137b0 --- pom.xml | 4 +- .../hugegraph/iterator/LimitIterator.java | 66 ++++++ .../hugegraph/version/CommonVersion.java | 2 +- .../baidu/hugegraph/unit/UnitTestSuite.java | 2 + .../unit/date/SafeDateFormatTest.java | 1 + .../unit/iterator/FilterIteratorTest.java | 30 ++- .../unit/iterator/LimitIteratorTest.java | 193 ++++++++++++++++++ .../unit/license/LicenseCreateParamTest.java | 4 - 8 files changed, 291 insertions(+), 11 deletions(-) create mode 100644 src/main/java/com/baidu/hugegraph/iterator/LimitIterator.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/iterator/LimitIteratorTest.java diff --git a/pom.xml b/pom.xml index 91fb035bc5..de8e289b1d 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.8.3 + 1.8.4 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -266,7 +266,7 @@ - 1.8.3.0 + 1.8.4.0 diff --git a/src/main/java/com/baidu/hugegraph/iterator/LimitIterator.java b/src/main/java/com/baidu/hugegraph/iterator/LimitIterator.java new file mode 100644 index 0000000000..671168bbb2 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/iterator/LimitIterator.java @@ -0,0 +1,66 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.iterator; + +import java.util.Iterator; +import java.util.function.Function; + +public class LimitIterator extends WrappedIterator { + + private final Iterator originIterator; + private final Function filterCallback; + + public LimitIterator(Iterator origin, Function filter) { + this.originIterator = origin; + this.filterCallback = filter; + } + + @Override + protected Iterator originIterator() { + return this.originIterator; + } + + @Override + protected final boolean fetch() { + while (this.originIterator.hasNext()) { + T next = this.originIterator.next(); + if (next == null) { + continue; + } + // Do filter + boolean reachLimit = this.filterCallback.apply(next); + if (reachLimit) { + this.closeOriginIterator(); + return false; + } + assert this.current == none(); + this.current = next; + return true; + } + return false; + } + + protected final void closeOriginIterator() { + if (this.originIterator == null) { + return; + } + close(this.originIterator); + } +} diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 4b590a1d05..ad6cd2cb69 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.8.3"); + "1.8.4"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java index 8b84932fed..25eb9bff2d 100644 --- a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java +++ b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -39,6 +39,7 @@ import com.baidu.hugegraph.unit.iterator.FilterIteratorTest; import com.baidu.hugegraph.unit.iterator.FlatMapperFilterIteratorTest; import com.baidu.hugegraph.unit.iterator.FlatMapperIteratorTest; +import com.baidu.hugegraph.unit.iterator.LimitIteratorTest; import com.baidu.hugegraph.unit.iterator.ListIteratorTest; import com.baidu.hugegraph.unit.iterator.MapperIteratorTest; import com.baidu.hugegraph.unit.license.ExtraParamTest; @@ -85,6 +86,7 @@ ExtendableIteratorTest.class, FilterIteratorTest.class, + LimitIteratorTest.class, MapperIteratorTest.class, FlatMapperIteratorTest.class, FlatMapperFilterIteratorTest.class, diff --git a/src/test/java/com/baidu/hugegraph/unit/date/SafeDateFormatTest.java b/src/test/java/com/baidu/hugegraph/unit/date/SafeDateFormatTest.java index 418424d26d..cf0036ba16 100644 --- a/src/test/java/com/baidu/hugegraph/unit/date/SafeDateFormatTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/date/SafeDateFormatTest.java @@ -37,6 +37,7 @@ public class SafeDateFormatTest { @Test + @SuppressWarnings("deprecation") public void testSafeDateFormatInConcurrency() throws Exception { SafeDateFormat format = new SafeDateFormat("yyyy-MM-dd"); List sources = ImmutableList.of( diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/FilterIteratorTest.java b/src/test/java/com/baidu/hugegraph/unit/iterator/FilterIteratorTest.java index 4f3ec6cbd1..9024673166 100644 --- a/src/test/java/com/baidu/hugegraph/unit/iterator/FilterIteratorTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/iterator/FilterIteratorTest.java @@ -41,13 +41,12 @@ public class FilterIteratorTest extends BaseUnitTest { @Test public void testFilter() { - - AtomicInteger valuesCount = new AtomicInteger(0); + AtomicInteger callbackCount = new AtomicInteger(0); Iterator values = DATA.iterator(); Function filter = value -> { - valuesCount.incrementAndGet(); + callbackCount.incrementAndGet(); return (value % 2 == 0); }; @@ -58,7 +57,7 @@ public void testFilter() { actual.add(results.next()); } - Assert.assertEquals(4, valuesCount.get()); + Assert.assertEquals(4, callbackCount.get()); Assert.assertEquals(ImmutableList.of(2, 4), actual); } @@ -139,6 +138,29 @@ public void testNextWithMultiTimesWithoutAnyResult() { }); } + @Test + public void testNextWithOriginIteratorReturnNullElem() { + List list = new ArrayList<>(); + list.add(1); + list.add(null); + list.add(3); + Iterator vals = list.iterator(); + + AtomicInteger callbackCount = new AtomicInteger(0); + + Iterator results = new FilterIterator<>(vals, val -> { + callbackCount.incrementAndGet(); + return true; + }); + + Assert.assertTrue(results.hasNext()); + for (int i = 0; i < 2; i++) { + results.next(); + } + Assert.assertFalse(results.hasNext()); + Assert.assertEquals(2, callbackCount.get()); + } + @Test public void testRemove() { List list = new ArrayList<>(DATA); diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/LimitIteratorTest.java b/src/test/java/com/baidu/hugegraph/unit/iterator/LimitIteratorTest.java new file mode 100644 index 0000000000..acd4fc1c6c --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/iterator/LimitIteratorTest.java @@ -0,0 +1,193 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.iterator; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Function; + +import org.junit.Test; + +import com.baidu.hugegraph.iterator.LimitIterator; +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; +import com.baidu.hugegraph.unit.iterator.ExtendableIteratorTest.CloseableItor; +import com.google.common.collect.ImmutableList; + +@SuppressWarnings("resource") +public class LimitIteratorTest extends BaseUnitTest { + + private static final List DATA = ImmutableList.of(1, 2, 3, 4); + + @Test + public void testLimit() { + AtomicInteger callbackCount = new AtomicInteger(0); + + Iterator values = DATA.iterator(); + + int limit = 2; + Function filter = value -> { + return callbackCount.incrementAndGet() > limit; + }; + + Iterator results = new LimitIterator<>(values, filter); + + List actual = new ArrayList<>(); + while (results.hasNext()) { + actual.add(results.next()); + } + + Assert.assertEquals(3, callbackCount.get()); + Assert.assertEquals(ImmutableList.of(1, 2), actual); + } + + @Test + public void testHasNext() { + Iterator vals = DATA.iterator(); + + Iterator results = new LimitIterator<>(vals, val -> false); + Assert.assertTrue(results.hasNext()); + } + + @Test + public void testHasNextWithMultiTimesWithoutAnyResult() { + Iterator vals = DATA.iterator(); + + Iterator results = new LimitIterator<>(vals, val -> true); + Assert.assertFalse(results.hasNext()); + Assert.assertFalse(results.hasNext()); + } + + @Test + public void testHasNextAndNextWithMultiTimes() { + Iterator vals = DATA.iterator(); + + Iterator results = new LimitIterator<>(vals, val -> false); + + for (int i = 0; i < 5; i++) { + Assert.assertTrue(results.hasNext()); + } + + for (int i = 0; i < 4; i++) { + results.next(); + } + + Assert.assertFalse(results.hasNext()); + Assert.assertFalse(results.hasNext()); + + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + + Iterator results2 = new LimitIterator<>(vals, val -> false); + Assert.assertFalse(results2.hasNext()); + } + + @Test + public void testNext() { + Iterator vals = DATA.iterator(); + + Iterator results = new LimitIterator<>(vals, val -> false); + // Call next() without testNext() + results.next(); + } + + @Test + public void testNextWithMultiTimes() { + Iterator vals = DATA.iterator(); + + Iterator results = new LimitIterator<>(vals, val -> false); + for (int i = 0; i < 4; i++) { + results.next(); + } + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + } + + @Test + public void testNextWithMultiTimesWithoutAnyResult() { + Iterator vals = DATA.iterator(); + + Iterator results = new LimitIterator<>(vals, val -> true); + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + Assert.assertThrows(NoSuchElementException.class, () -> { + results.next(); + }); + } + + @Test + public void testNextWithOriginIteratorReturnNullElem() { + List list = new ArrayList<>(); + list.add(1); + list.add(null); + list.add(3); + Iterator vals = list.iterator(); + + AtomicInteger callbackCount = new AtomicInteger(0); + + Iterator results = new LimitIterator<>(vals, val -> { + callbackCount.incrementAndGet(); + return false; + }); + Assert.assertTrue(results.hasNext()); + for (int i = 0; i < 2; i++) { + results.next(); + } + Assert.assertFalse(results.hasNext()); + Assert.assertEquals(2, callbackCount.get()); + } + + @Test + public void testRemove() { + List list = new ArrayList<>(DATA); + + Iterator results = new LimitIterator<>(list.iterator(), + val -> false); + + Assert.assertEquals(ImmutableList.of(1, 2, 3, 4), list); + + results.next(); + results.next(); + results.remove(); + + Assert.assertEquals(ImmutableList.of(1, 3, 4), list); + } + + @Test + public void testClose() throws Exception { + CloseableItor vals = new CloseableItor<>(DATA.iterator()); + + LimitIterator results = new LimitIterator<>(vals, + val -> true); + + Assert.assertFalse(vals.closed()); + results.close(); + Assert.assertTrue(vals.closed()); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java b/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java index 6a2425919d..76f6847676 100644 --- a/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java @@ -20,11 +20,7 @@ package com.baidu.hugegraph.unit.license; import java.io.IOException; -import java.text.DateFormat; import java.text.ParseException; -import java.time.ZoneId; -import java.util.Arrays; -import java.util.TimeZone; import org.junit.Test; From 42e5260ba554112fdd052f0c66db391ab3cb987a Mon Sep 17 00:00:00 2001 From: Linary Date: Sun, 7 Mar 2021 16:42:38 +0800 Subject: [PATCH 133/217] Add Class.class as an accept data type in TypedOption (#65) --- pom.xml | 4 +-- .../config/ConfigListConvOption.java | 2 +- .../hugegraph/config/ConfigListOption.java | 2 +- .../baidu/hugegraph/config/HugeConfig.java | 2 +- .../baidu/hugegraph/config/TypedOption.java | 14 +++++++-- .../hugegraph/version/CommonVersion.java | 2 +- .../hugegraph/unit/config/HugeConfigTest.java | 31 +++++++++++++++++++ .../com/baidu/hugegraph/unit/config/test.conf | 2 ++ 8 files changed, 50 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index de8e289b1d..820517ecf1 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.8.4 + 1.8.5 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -266,7 +266,7 @@ - 1.8.4.0 + 1.8.5.0 diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigListConvOption.java b/src/main/java/com/baidu/hugegraph/config/ConfigListConvOption.java index 8162500c7f..151fbf92c4 100644 --- a/src/main/java/com/baidu/hugegraph/config/ConfigListConvOption.java +++ b/src/main/java/com/baidu/hugegraph/config/ConfigListConvOption.java @@ -60,7 +60,7 @@ protected boolean forList() { } @Override - protected List parse(Object value) { + protected List parse(String value) { return ConfigListOption.convert(value, part -> { return this.parse(part, this.elemClass); }); diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java b/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java index 565e9c71b0..ef6e3249e2 100644 --- a/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java +++ b/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java @@ -56,7 +56,7 @@ protected boolean forList() { } @Override - protected List parse(Object value) { + protected List parse(String value) { return convert(value, part -> this.parse(part, this.elemClass)); } diff --git a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java index 5a8d345c98..ed5da5a518 100644 --- a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java +++ b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java @@ -151,7 +151,7 @@ private Object validateOption(String key, Object value) { "Invalid value for key '%s': %s", key, value); TypedOption option = OptionSpace.get(key); - return option.parseConvert(value); + return option.parseConvert((String) value); } private void checkRequiredOptions() { diff --git a/src/main/java/com/baidu/hugegraph/config/TypedOption.java b/src/main/java/com/baidu/hugegraph/config/TypedOption.java index 57d77c6fa7..2aa50e3f72 100644 --- a/src/main/java/com/baidu/hugegraph/config/TypedOption.java +++ b/src/main/java/com/baidu/hugegraph/config/TypedOption.java @@ -50,6 +50,7 @@ public class TypedOption { Double.class, String.class, String[].class, + Class.class, List.class ); @@ -112,20 +113,27 @@ public R defaultValue() { return this.convert(this.defaultValue); } - public R parseConvert(Object value) { + public R parseConvert(String value) { T parsed = this.parse(value); this.check(parsed); return this.convert(parsed); } @SuppressWarnings("unchecked") - protected T parse(Object value) { + protected T parse(String value) { return (T) this.parse(value, this.dataType); } - protected Object parse(Object value, Class dataType) { + protected Object parse(String value, Class dataType) { if (dataType.equals(String.class)) { return value; + } else if (dataType.equals(Class.class)) { + try { + return Class.forName(value); + } catch (ClassNotFoundException e) { + throw new ConfigException( + "Failed to parse Class from String '%s'", e, value); + } } else if (List.class.isAssignableFrom(dataType)) { E.checkState(this.forList(), "List option can't be registered with class %s", diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index ad6cd2cb69..34c07fbebe 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.8.4"); + "1.8.5"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java b/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java index 9744a32cbf..e6c8ac8bec 100644 --- a/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java @@ -75,6 +75,8 @@ public void testOptionDataType() { Assert.assertEquals(Double.class, TestOptions.double1.dataType()); Assert.assertEquals(Boolean.class, TestOptions.bool.dataType()); + Assert.assertEquals(Class.class, TestOptions.clazz.dataType()); + Assert.assertEquals(List.class, TestOptions.list.dataType()); Assert.assertEquals(List.class, TestOptions.map.dataType()); @@ -110,6 +112,8 @@ public void testOptionsToString() { TestOptions.double1.toString()); Assert.assertEquals("[Boolean]group1.bool=true", TestOptions.bool.toString()); + Assert.assertEquals("[Class]group1.class=class java.lang.Object", + TestOptions.clazz.toString()); Assert.assertEquals("[List]group1.list=[list-value1, list-value2]", TestOptions.list.toString()); Assert.assertEquals("[List]group1.map=[key1:value1, key2:value2]", @@ -208,6 +212,15 @@ public void testOptionWithError() { ); }); + Assert.assertThrows(ConfigException.class, () -> { + new ConfigOption<>( + "group1.class", + "description of group1.class", + input -> input != null && input.equals(Long.class), + Integer.class + ); + }); + Assert.assertThrows(ConfigException.class, () -> { new ConfigListOption<>( "group1.list", @@ -265,6 +278,14 @@ public void testHugeConfig() throws Exception { Assert.assertEquals(true, config.get(TestOptions.bool)); + Assert.assertEquals(Object.class, config.get(TestOptions.clazz)); + Assert.assertThrows(ConfigException.class, () -> { + config.setProperty(TestOptions.clazz.name(), + "com.baidu.hugegraph.HugeGraph"); + }, e -> { + Assert.assertTrue(e.getCause() instanceof ClassNotFoundException); + }); + Assert.assertEquals(Arrays.asList("list-value1", "list-value2"), config.get(TestOptions.list)); @@ -299,6 +320,8 @@ public void testHugeConfigWithFile() throws Exception { Assert.assertEquals(false, config.get(TestOptions.bool)); + Assert.assertEquals(String.class, config.get(TestOptions.clazz)); + Assert.assertEquals(Arrays.asList("file-v1", "file-v2", "file-v3"), config.get(TestOptions.list)); @@ -477,6 +500,14 @@ public static synchronized TestOptions instance() { true ); + public static final ConfigOption> clazz = + new ConfigOption<>( + "group1.class", + "description of group1.class", + disallowEmpty(), + Object.class + ); + public static final ConfigConvOption weekday = new ConfigConvOption<>( "group1.weekday", diff --git a/src/test/java/com/baidu/hugegraph/unit/config/test.conf b/src/test/java/com/baidu/hugegraph/unit/config/test.conf index bd2ea2a854..9ee10b0a34 100644 --- a/src/test/java/com/baidu/hugegraph/unit/config/test.conf +++ b/src/test/java/com/baidu/hugegraph/unit/config/test.conf @@ -12,6 +12,8 @@ group1.double1=66 group1.bool=false +group1.class=java.lang.String + group1.list=[file-v1, file-v2, file-v3] group1.map=[key1:value1, key3:value3] From 1114e94924608a3576008cf993f61508ef5dac61 Mon Sep 17 00:00:00 2001 From: liningrui Date: Tue, 16 Mar 2021 18:03:26 +0800 Subject: [PATCH 134/217] First commit --- .gitignore | 21 ++++++ LICENSE | 202 ++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 17 +++++ pom.xml | 203 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 443 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 pom.xml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..fa22f58767 --- /dev/null +++ b/.gitignore @@ -0,0 +1,21 @@ +.DS_Store +*.iml +*.iws +*.orig +*.rej +**/.keep +*.sdf +*.suo +*.vcxproj.user +*.swp +*.log +*.pyc +.idea +.svn +.classpath +.project +.settings +target +gen-java +build +node* diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000..e06d208186 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed 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. + diff --git a/README.md b/README.md new file mode 100644 index 0000000000..9243acf297 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# HugeGraph-RPC + +HugeGraph Database RPC component, currently it's a wrapper of [Sofa-RPC](https://github.com/sofastack/sofa-rpc) + +## Features + +## Learn More + +The [project homepage](https://hugegraph.github.io/hugegraph-doc/) contains more information on HugeGraph and provides links to documentation, getting-started guides and release downloads. + +## Contributing + +Welcome to contribute to HugeGraph, please see [`How to Contribute`](CONTRIBUTING.md) for more information. + +## License + +HugeGraph is licensed under Apache 2.0 License. diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000000..1603590fd0 --- /dev/null +++ b/pom.xml @@ -0,0 +1,203 @@ + + + 4.0.0 + + com.baidu.hugegraph + hugegraph-rpc + 1.0.0 + + hugegraph-rpc + https://github.com/hugegraph/hugegraph-rpc + + HugeGraph Database RPC component + + + + org.sonatype.oss + oss-parent + 7 + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + https://github.com/hugegraph/hugegraph-rpc + https://github.com/hugegraph/hugegraph-rpc + https://github.com/hugegraph/hugegraph-rpc + + + + UTF-8 + ${project.basedir}/.. + 1.8 + 1.8 + + + + + + com.lmax + disruptor + 3.3.7 + + + com.alipay.sofa + sofa-rpc-all + 5.7.6 + + + io.netty + netty-all + + + org.jboss.resteasy + resteasy-client + + + com.alipay.sofa + bolt + + + org.apache.httpcomponents + httpcore + + + org.apache.httpcomponents + httpmime + + + com.alipay.sofa.common + sofa-common-tools + + + org.jboss.logging + jboss-logging + + + com.alipay.sofa + hessian + + + + + + + + + maven-compiler-plugin + 3.1 + + ${compiler.source} + ${compiler.target} + + 500 + + + -Xlint:unchecked + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.6 + + + true + + + false + + + true + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.2 + + + pre-unit-test + + prepare-agent + + + + post-unit-test + test + + report + + + ${project.build.directory} + + + + + + + + + + release + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9.1 + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + + + + From 3914813fb8244b927cfa6b789bd224946c03c1f2 Mon Sep 17 00:00:00 2001 From: liningrui Date: Wed, 17 Mar 2021 15:21:59 +0800 Subject: [PATCH 135/217] Add checkstyle plugin --- checkstyle.xml | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++ pom.xml | 23 ++++++++++++- 2 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 checkstyle.xml diff --git a/checkstyle.xml b/checkstyle.xml new file mode 100644 index 0000000000..9373a70d91 --- /dev/null +++ b/checkstyle.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml index 1603590fd0..5fdbbe6349 100644 --- a/pom.xml +++ b/pom.xml @@ -105,7 +105,28 @@ - + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.1.0 + + checkstyle.xml + UTF-8 + true + true + false + false + + + + validate + validate + + check + + + + org.apache.maven.plugins maven-jar-plugin From 98844d8c2ae3a1ff62f9d3747d6927dd3987404b Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Fri, 19 Mar 2021 20:44:46 +0800 Subject: [PATCH 136/217] add UnitUtil class (#66) * upgrede version to 1.8.6 Change-Id: I67c7b38979b2c0603878d48929247ec0282d10d9 --- pom.xml | 4 +- .../java/com/baidu/hugegraph/util/Bytes.java | 3 + .../com/baidu/hugegraph/util/UnitUtil.java | 182 +++++ .../hugegraph/version/CommonVersion.java | 2 +- .../baidu/hugegraph/unit/UnitTestSuite.java | 4 +- .../unit/util/ReflectionUtilTest.java | 4 +- .../hugegraph/unit/util/UnitUtilTest.java | 667 ++++++++++++++++++ 7 files changed, 860 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/baidu/hugegraph/util/UnitUtil.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/util/UnitUtilTest.java diff --git a/pom.xml b/pom.xml index 820517ecf1..fb2818147a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.8.5 + 1.8.6 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -266,7 +266,7 @@ - 1.8.5.0 + 1.8.6.0 diff --git a/src/main/java/com/baidu/hugegraph/util/Bytes.java b/src/main/java/com/baidu/hugegraph/util/Bytes.java index b882e3fec5..df19c22be0 100644 --- a/src/main/java/com/baidu/hugegraph/util/Bytes.java +++ b/src/main/java/com/baidu/hugegraph/util/Bytes.java @@ -36,6 +36,9 @@ public final class Bytes { public static final long KB = BASE; public static final long MB = KB * BASE; public static final long GB = MB * BASE; + public static final long TB = GB * KB; + public static final long PB = GB * MB; + public static final long EB = GB * GB; private static final Comparator CMP = UnsignedBytes.lexicographicalComparator(); diff --git a/src/main/java/com/baidu/hugegraph/util/UnitUtil.java b/src/main/java/com/baidu/hugegraph/util/UnitUtil.java new file mode 100644 index 0000000000..60c626f85b --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/util/UnitUtil.java @@ -0,0 +1,182 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.util; + +import java.math.BigDecimal; +import java.time.Duration; + +public final class UnitUtil { + + public static double bytesToMB(long bytes) { + return doubleWith2Scale(bytes / (double) Bytes.MB); + } + + public static double bytesToGB(long bytes) { + return doubleWith2Scale(bytes / (double) Bytes.GB); + } + + public static double doubleWith2Scale(double value) { + BigDecimal decimal = new BigDecimal(value); + return decimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + } + + public static String bytesToReadableString(long bytes) { + // NOTE: FileUtils.byteCountToDisplaySize() lost decimal precision + final String[] units = {"B", "KB", "MB", "GB", "TB", "PB", "EB"}; + if (bytes <= 0L) { + return "0 B"; + } + int i = (int) (Math.log(bytes) / Math.log(1024)); + E.checkArgument(i < units.length, + "The bytes parameter is out of %s unit: %s", + units[units.length - 1], bytes); + double value = bytes / Math.pow(1024, i); + if (value % 1L == 0L) { + return ((long) value) + " " + units[i]; + } else { + return doubleWith2Scale(value) + " " + units[i]; + } + } + + public static long bytesFromReadableString(String valueWithUnit) { + int spacePos = valueWithUnit.indexOf(" "); + E.checkArgument(spacePos >= 0, + "Invalid readable bytes '%s', " + + "expect format like '10 MB'", valueWithUnit); + String unit = valueWithUnit.substring(spacePos + 1); + + long factor = 0L; + switch (unit.trim().toUpperCase()) { + case "B": + case "BYTE": + case "BYTES": + factor = 1L; + break; + case "KB": + case "KIB": + factor = Bytes.KB; + break; + case "MB": + case "MIB": + factor = Bytes.MB; + break; + case "GB": + case "GIB": + factor = Bytes.GB; + break; + case "TB": + case "TIB": + factor = Bytes.TB; + break; + case "PB": + case "PIB": + factor = Bytes.PB; + break; + case "EB": + case "EIB": + factor = Bytes.EB; + break; + default: + throw new IllegalArgumentException("Unrecognized unit " + unit); + } + + double value; + try { + value = Double.parseDouble(valueWithUnit.substring(0, spacePos)); + } catch (Exception e) { + throw new IllegalArgumentException(String.format( + "Invalid parameter(not number): '%s'", valueWithUnit), e); + } + value = value * factor; + E.checkArgument(value <= Long.MAX_VALUE, + "The value %s from parameter '%s' is out of range", + value, valueWithUnit); + return (long) value; + } + + public static String timestampToReadableString(long time) { + Duration duration = Duration.ofMillis(time); + long days = duration.toDays(); + long hours = duration.toHours(); + long minutes = duration.toMinutes(); + long seconds = duration.getSeconds(); + + if (days > 0) { + return String.format("%dd%dh%dm%ds", + days, + hours % 24, + minutes % 60, + seconds % 60); + } else if (hours > 0) { + return String.format("%dh%dm%ds", + hours, + minutes % 60, + seconds % 60); + } else if (minutes > 0) { + return String.format("%dm%ds", + minutes, + seconds % 60); + } else if (seconds > 0) { + long ms = duration.toMillis() % 1000L; + if (ms > 0L) { + return String.format("%ds%dms", seconds, ms); + } else { + return String.format("%ds", seconds); + } + } else { + return String.format("%dms", duration.toMillis()); + } + } + + public static long timestampFromReadableString(String valueWithUnit) { + long ms = 0L; + // Adapt format 'nDnHnMnS' to 'PnYnMnDTnHnMnS' + String formatDuration = valueWithUnit.toUpperCase(); + if (formatDuration.indexOf('D') >= 0) { + // Contains days + assert !formatDuration.contains("MS"); + formatDuration = "P" + formatDuration.replace("D", "DT"); + } else { + // Not exists days + int msPos = formatDuration.indexOf("MS"); + // If contains ms, rmove the ms part + if (msPos >= 0) { + int sPos = formatDuration.indexOf("S"); + if (0 <= sPos && sPos < msPos) { + // If contains second part + sPos += 1; + ms = Long.parseLong(formatDuration.substring(sPos, msPos)); + ms %= 1000L; + formatDuration = formatDuration.substring(0, sPos); + } else { + // Not contains second part, only exists ms + ms = Long.parseLong(formatDuration.substring(0, msPos)); + return ms; + } + } else { + assert formatDuration.endsWith("S"); + } + formatDuration = "PT" + formatDuration; + } + + Duration duration = Duration.parse(formatDuration); + return duration.toMillis() + ms; + } +} diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 34c07fbebe..0013e08d0f 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.8.5"); + "1.8.6"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java index 25eb9bff2d..f6855ec598 100644 --- a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java +++ b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -29,6 +29,7 @@ import com.baidu.hugegraph.unit.concurrent.KeyLockTest; import com.baidu.hugegraph.unit.concurrent.LockGroupTest; import com.baidu.hugegraph.unit.concurrent.LockManagerTest; +import com.baidu.hugegraph.unit.concurrent.PausableScheduledThreadPoolTest; import com.baidu.hugegraph.unit.concurrent.RowLockTest; import com.baidu.hugegraph.unit.config.HugeConfigTest; import com.baidu.hugegraph.unit.config.OptionSpaceTest; @@ -50,7 +51,6 @@ import com.baidu.hugegraph.unit.perf.PerfUtilTest; import com.baidu.hugegraph.unit.rest.RestClientTest; import com.baidu.hugegraph.unit.rest.RestResultTest; -import com.baidu.hugegraph.unit.concurrent.PausableScheduledThreadPoolTest; import com.baidu.hugegraph.unit.util.BytesTest; import com.baidu.hugegraph.unit.util.CollectionUtilTest; import com.baidu.hugegraph.unit.util.DateUtilTest; @@ -62,6 +62,7 @@ import com.baidu.hugegraph.unit.util.ReflectionUtilTest; import com.baidu.hugegraph.unit.util.StringUtilTest; import com.baidu.hugegraph.unit.util.TimeUtilTest; +import com.baidu.hugegraph.unit.util.UnitUtilTest; import com.baidu.hugegraph.unit.util.VersionUtilTest; import com.baidu.hugegraph.unit.version.VersionTest; @@ -105,6 +106,7 @@ LongEncodingTest.class, OrderLimitMapTest.class, DateUtilTest.class, + UnitUtilTest.class, ExtraParamTest.class, LicenseCreateParamTest.class, diff --git a/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java index 7b402daf14..df8afcbb77 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java @@ -91,7 +91,7 @@ public void testClasses() throws IOException { @SuppressWarnings("unchecked") List classes = IteratorUtils.toList(ReflectionUtil.classes( "com.baidu.hugegraph.util")); - Assert.assertEquals(16, classes.size()); + Assert.assertEquals(17, classes.size()); classes.sort((c1, c2) -> c1.getName().compareTo(c2.getName())); Assert.assertEquals("com.baidu.hugegraph.util.Bytes", classes.get(0).getName()); @@ -100,7 +100,7 @@ public void testClasses() throws IOException { Assert.assertEquals("com.baidu.hugegraph.util.CollectionUtil", classes.get(2).getName()); Assert.assertEquals("com.baidu.hugegraph.util.VersionUtil", - classes.get(15).getName()); + classes.get(16).getName()); } @Test diff --git a/src/test/java/com/baidu/hugegraph/unit/util/UnitUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/UnitUtilTest.java new file mode 100644 index 0000000000..a7e31e98d1 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/util/UnitUtilTest.java @@ -0,0 +1,667 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.util; + +import org.junit.Test; + +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.util.Bytes; +import com.baidu.hugegraph.util.UnitUtil; + +public class UnitUtilTest { + + @Test + public void testBytesToMB() { + double value = UnitUtil.bytesToMB(0L); + Assert.assertEquals(0d, value, 0d); + + // KB + value = UnitUtil.bytesToMB(Bytes.KB * 1); + Assert.assertEquals(0d, value, 0d); + + value = UnitUtil.bytesToMB(Bytes.KB * 10); + Assert.assertEquals(0.01d, value, 0d); + + value = UnitUtil.bytesToMB(Bytes.KB * 100); + Assert.assertEquals(0.1d, value, 0d); + + value = UnitUtil.bytesToMB(Bytes.KB * (long) (134 * 1.024)); + Assert.assertEquals(0.13d, value, 0d); + + value = UnitUtil.bytesToMB(Bytes.KB * (long) (135 * 1.024)); + Assert.assertEquals(0.13d, value, 0d); + + value = UnitUtil.bytesToMB(Bytes.KB * (long) (136 * 1.024)); + Assert.assertEquals(0.14d, value, 0d); + + value = UnitUtil.bytesToMB(Bytes.KB * (long) (144 * 1.024)); + Assert.assertEquals(0.14d, value, 0d); + + value = UnitUtil.bytesToMB(Bytes.KB * (long) (754 * 1.024)); + Assert.assertEquals(0.75d, value, 0d); + + value = UnitUtil.bytesToMB(Bytes.KB * (long) (755 * 1.024)); + Assert.assertEquals(0.75d, value, 0d); + + value = UnitUtil.bytesToMB(Bytes.KB * (long) (756 * 1.024)); + Assert.assertEquals(0.76d, value, 0d); + + // MB + value = UnitUtil.bytesToMB(Bytes.MB * 1); + Assert.assertEquals(1d, value, 0d); + + value = UnitUtil.bytesToMB(Bytes.MB * 13); + Assert.assertEquals(13d, value, 0d); + + value = UnitUtil.bytesToMB(Bytes.MB * 1357); + Assert.assertEquals(1357d, value, 0d); + + value = UnitUtil.bytesToMB(Bytes.MB * 1357924680); + Assert.assertEquals(1357924680d, value, 0d); + + value = UnitUtil.bytesToMB(Bytes.MB * 1357924680246L); + Assert.assertEquals(1357924680246d, value, 0d); + } + + @Test + public void testBytesToGB() { + double value = UnitUtil.bytesToGB(0L); + Assert.assertEquals(0d, value, 0d); + + // MB + value = UnitUtil.bytesToGB(Bytes.MB * 1); + Assert.assertEquals(0d, value, 0d); + + value = UnitUtil.bytesToGB(Bytes.MB * 10); + Assert.assertEquals(0.01d, value, 0d); + + value = UnitUtil.bytesToGB(Bytes.MB * 100); + Assert.assertEquals(0.10d, value, 0d); + + value = UnitUtil.bytesToGB(Bytes.MB * (long) (134 * 1.024)); + Assert.assertEquals(0.13d, value, 0d); + + value = UnitUtil.bytesToGB(Bytes.MB * (long) (135 * 1.024)); + Assert.assertEquals(0.13d, value, 0d); + + value = UnitUtil.bytesToGB(Bytes.MB * (long) (136 * 1.024)); + Assert.assertEquals(0.14d, value, 0d); + + value = UnitUtil.bytesToGB(Bytes.MB * (long) (144 * 1.024)); + Assert.assertEquals(0.14d, value, 0d); + + value = UnitUtil.bytesToGB(Bytes.MB * (long) (754 * 1.024)); + Assert.assertEquals(0.75d, value, 0d); + + value = UnitUtil.bytesToGB(Bytes.MB * (long) (755 * 1.024)); + Assert.assertEquals(0.75d, value, 0d); + + value = UnitUtil.bytesToGB(Bytes.MB * (long) (756 * 1.024)); + Assert.assertEquals(0.76d, value, 0d); + + // GB + value = UnitUtil.bytesToGB(Bytes.GB * 1); + Assert.assertEquals(1d, value, 0d); + + value = UnitUtil.bytesToGB(Bytes.GB * 13); + Assert.assertEquals(13d, value, 0d); + + value = UnitUtil.bytesToGB(Bytes.GB * 1357); + Assert.assertEquals(1357d, value, 0d); + + value = UnitUtil.bytesToGB(Bytes.GB * 1357924680); + Assert.assertEquals(1357924680d, value, 0d); + + value = UnitUtil.bytesToGB(Bytes.GB * 7357924680L); + Assert.assertEquals(7357924680d, value, 0d); + + // Bytes overflow long value + value = UnitUtil.bytesToGB(Bytes.GB * 9357924680L); + Assert.assertEquals(-7.821944504E9, value, 0d); + } + + @Test + public void testBytesToReadableString() { + String value = UnitUtil.bytesToReadableString(0L); + Assert.assertEquals("0 B", value); + + // B + value = UnitUtil.bytesToReadableString(1); + Assert.assertEquals("1 B", value); + + value = UnitUtil.bytesToReadableString(3); + Assert.assertEquals("3 B", value); + + value = UnitUtil.bytesToReadableString(10); + Assert.assertEquals("10 B", value); + + value = UnitUtil.bytesToReadableString(100); + Assert.assertEquals("100 B", value); + + value = UnitUtil.bytesToReadableString(1000); + Assert.assertEquals("1000 B", value); + + value = UnitUtil.bytesToReadableString(1023); + Assert.assertEquals("1023 B", value); + + // KB + value = UnitUtil.bytesToReadableString(1024); + Assert.assertEquals("1 KB", value); + + value = UnitUtil.bytesToReadableString(Bytes.KB + 1); + Assert.assertEquals("1.0 KB", value); + + value = UnitUtil.bytesToReadableString(Bytes.KB + 10); + Assert.assertEquals("1.01 KB", value); + + value = UnitUtil.bytesToReadableString(Bytes.KB + 20); + Assert.assertEquals("1.02 KB", value); + + value = UnitUtil.bytesToReadableString(Bytes.KB + 100); + Assert.assertEquals("1.1 KB", value); + + value = UnitUtil.bytesToReadableString(Bytes.KB + 123); + Assert.assertEquals("1.12 KB", value); + + value = UnitUtil.bytesToReadableString(Bytes.KB + 129); + Assert.assertEquals("1.13 KB", value); + + value = UnitUtil.bytesToReadableString(Bytes.KB * 8 + + (long) (755 * 1.024)); + Assert.assertEquals("8.75 KB", value); + + value = UnitUtil.bytesToReadableString(Bytes.KB * 168 + + (long) (756 * 1.024)); + Assert.assertEquals("168.76 KB", value); + + // MB + value = UnitUtil.bytesToReadableString(Bytes.KB * 1024); + Assert.assertEquals("1 MB", value); + + value = UnitUtil.bytesToReadableString(Bytes.MB + 1 * Bytes.KB); + Assert.assertEquals("1.0 MB", value); + + value = UnitUtil.bytesToReadableString(Bytes.MB + 10 * Bytes.KB); + Assert.assertEquals("1.01 MB", value); + + value = UnitUtil.bytesToReadableString(Bytes.MB + 20 * Bytes.KB); + Assert.assertEquals("1.02 MB", value); + + value = UnitUtil.bytesToReadableString(Bytes.MB + 100 * Bytes.KB); + Assert.assertEquals("1.1 MB", value); + + value = UnitUtil.bytesToReadableString(Bytes.MB + 123 * Bytes.KB); + Assert.assertEquals("1.12 MB", value); + + value = UnitUtil.bytesToReadableString(Bytes.MB + 129 * Bytes.KB); + Assert.assertEquals("1.13 MB", value); + + value = UnitUtil.bytesToReadableString(Bytes.MB * 8 + + (long) (755 * 1.024) * Bytes.KB); + Assert.assertEquals("8.75 MB", value); + + value = UnitUtil.bytesToReadableString(Bytes.MB * 168 + + (long) (756 * 1.024) * Bytes.KB); + Assert.assertEquals("168.76 MB", value); + + // GB + value = UnitUtil.bytesToReadableString(Bytes.MB * 1024); + Assert.assertEquals("1 GB", value); + + value = UnitUtil.bytesToReadableString(Bytes.GB + 1 * Bytes.MB); + Assert.assertEquals("1.0 GB", value); + + value = UnitUtil.bytesToReadableString(Bytes.GB + 10 * Bytes.MB); + Assert.assertEquals("1.01 GB", value); + + value = UnitUtil.bytesToReadableString(Bytes.GB + 20 * Bytes.MB); + Assert.assertEquals("1.02 GB", value); + + value = UnitUtil.bytesToReadableString(Bytes.GB + 100 * Bytes.MB); + Assert.assertEquals("1.1 GB", value); + + value = UnitUtil.bytesToReadableString(Bytes.GB + 123 * Bytes.MB); + Assert.assertEquals("1.12 GB", value); + + value = UnitUtil.bytesToReadableString(Bytes.GB + 129 * Bytes.MB); + Assert.assertEquals("1.13 GB", value); + + value = UnitUtil.bytesToReadableString(Bytes.GB * 8 + + (long) (755 * 1.024) * Bytes.MB); + Assert.assertEquals("8.75 GB", value); + + value = UnitUtil.bytesToReadableString(Bytes.GB * 168 + + (long) (756 * 1.024) * Bytes.MB); + Assert.assertEquals("168.76 GB", value); + + // TB + value = UnitUtil.bytesToReadableString(Bytes.GB * 1024); + Assert.assertEquals("1 TB", value); + + value = UnitUtil.bytesToReadableString(Bytes.TB + 1 * Bytes.GB); + Assert.assertEquals("1.0 TB", value); + + value = UnitUtil.bytesToReadableString(Bytes.TB + 10 * Bytes.GB); + Assert.assertEquals("1.01 TB", value); + + value = UnitUtil.bytesToReadableString(Bytes.TB + 20 * Bytes.GB); + Assert.assertEquals("1.02 TB", value); + + value = UnitUtil.bytesToReadableString(Bytes.TB + 100 * Bytes.GB); + Assert.assertEquals("1.1 TB", value); + + value = UnitUtil.bytesToReadableString(Bytes.TB + 123 * Bytes.GB); + Assert.assertEquals("1.12 TB", value); + + value = UnitUtil.bytesToReadableString(Bytes.TB + 129 * Bytes.GB); + Assert.assertEquals("1.13 TB", value); + + value = UnitUtil.bytesToReadableString(Bytes.TB * 8 + + (long) (755 * 1.024) * Bytes.GB); + Assert.assertEquals("8.75 TB", value); + + value = UnitUtil.bytesToReadableString(Bytes.TB * 168 + + (long) (756 * 1.024) * Bytes.GB); + Assert.assertEquals("168.76 TB", value); + + // PB + value = UnitUtil.bytesToReadableString(Bytes.TB * 1024); + Assert.assertEquals("1 PB", value); + + value = UnitUtil.bytesToReadableString(Bytes.PB + 1 * Bytes.TB); + Assert.assertEquals("1.0 PB", value); + + value = UnitUtil.bytesToReadableString(Bytes.PB + 10 * Bytes.TB); + Assert.assertEquals("1.01 PB", value); + + value = UnitUtil.bytesToReadableString(Bytes.PB + 20 * Bytes.TB); + Assert.assertEquals("1.02 PB", value); + + value = UnitUtil.bytesToReadableString(Bytes.PB + 100 * Bytes.TB); + Assert.assertEquals("1.1 PB", value); + + value = UnitUtil.bytesToReadableString(Bytes.PB + 123 * Bytes.TB); + Assert.assertEquals("1.12 PB", value); + + value = UnitUtil.bytesToReadableString(Bytes.PB + 129 * Bytes.TB); + Assert.assertEquals("1.13 PB", value); + + value = UnitUtil.bytesToReadableString(Bytes.PB * 8 + + (long) (755 * 1.024) * Bytes.TB); + Assert.assertEquals("8.75 PB", value); + + value = UnitUtil.bytesToReadableString(Bytes.PB * 168 + + (long) (756 * 1.024) * Bytes.TB); + Assert.assertEquals("168.76 PB", value); + + // EB + value = UnitUtil.bytesToReadableString(Bytes.PB * 1024); + Assert.assertEquals("1 EB", value); + + value = UnitUtil.bytesToReadableString(Bytes.EB + 1 * Bytes.PB); + Assert.assertEquals("1.0 EB", value); + + value = UnitUtil.bytesToReadableString(Bytes.EB + 10 * Bytes.PB); + Assert.assertEquals("1.01 EB", value); + + value = UnitUtil.bytesToReadableString(Bytes.EB + 20 * Bytes.PB); + Assert.assertEquals("1.02 EB", value); + + value = UnitUtil.bytesToReadableString(Bytes.EB + 100 * Bytes.PB); + Assert.assertEquals("1.1 EB", value); + + value = UnitUtil.bytesToReadableString(Bytes.EB + 123 * Bytes.PB); + Assert.assertEquals("1.12 EB", value); + + value = UnitUtil.bytesToReadableString(Bytes.EB + 129 * Bytes.PB); + Assert.assertEquals("1.13 EB", value); + + value = UnitUtil.bytesToReadableString(Bytes.EB * 7 + + (long) (755 * 1.024) * Bytes.PB); + Assert.assertEquals("7.75 EB", value); + + // Bytes overflow long value + value = UnitUtil.bytesToReadableString(Bytes.EB * 8); + Assert.assertEquals("0 B", value); + } + + @Test + public void testBytesFromReadableString() { + // B + Assert.assertEquals(0L, UnitUtil.bytesFromReadableString("0 B")); + Assert.assertEquals(1L, UnitUtil.bytesFromReadableString("1 Bytes")); + Assert.assertEquals(3L, UnitUtil.bytesFromReadableString("3 bytes")); + Assert.assertEquals(10L, UnitUtil.bytesFromReadableString("10 Byte")); + Assert.assertEquals(100L, UnitUtil.bytesFromReadableString("100 byte")); + Assert.assertEquals(1000L, UnitUtil.bytesFromReadableString("1000 b")); + Assert.assertEquals(1023L, UnitUtil.bytesFromReadableString("1023 B")); + + Assert.assertEquals(1024L, UnitUtil.bytesFromReadableString("1024 B")); + Assert.assertEquals(10245678L, + UnitUtil.bytesFromReadableString("10245678 B")); + Assert.assertEquals(102456789012L, + UnitUtil.bytesFromReadableString("102456789012 B")); + + Assert.assertEquals(1L, UnitUtil.bytesFromReadableString("1 B")); + Assert.assertEquals(1L, UnitUtil.bytesFromReadableString("1 B ")); + Assert.assertEquals(-2L, UnitUtil.bytesFromReadableString("-2 B")); + + // KB + Assert.assertEquals(0L, UnitUtil.bytesFromReadableString("0 KB")); + Assert.assertEquals(Bytes.KB * 1L, + UnitUtil.bytesFromReadableString("1 KB")); + Assert.assertEquals((long) (Bytes.KB * 3.14), + UnitUtil.bytesFromReadableString("3.14 KB")); + Assert.assertEquals(Bytes.KB * 10L, + UnitUtil.bytesFromReadableString("10 kB")); + Assert.assertEquals(Bytes.KB * 100L, + UnitUtil.bytesFromReadableString("100 KiB")); + Assert.assertEquals(Bytes.KB * 1000L, + UnitUtil.bytesFromReadableString("1000 kb")); + Assert.assertEquals(Bytes.KB * 1023L, + UnitUtil.bytesFromReadableString("1023 kib")); + Assert.assertEquals(Bytes.KB * 1234567890L, + UnitUtil.bytesFromReadableString("1234567890 Kib")); + // MB + Assert.assertEquals(0L, UnitUtil.bytesFromReadableString("0 MB")); + Assert.assertEquals(Bytes.MB * 1L, + UnitUtil.bytesFromReadableString("1 MB")); + Assert.assertEquals((long) (Bytes.MB * 3.14), + UnitUtil.bytesFromReadableString("3.14 MB")); + Assert.assertEquals(Bytes.MB * 10L, + UnitUtil.bytesFromReadableString("10 mB")); + Assert.assertEquals(Bytes.MB * 100L, + UnitUtil.bytesFromReadableString("100 MiB")); + Assert.assertEquals(Bytes.MB * 1000L, + UnitUtil.bytesFromReadableString("1000 mib")); + Assert.assertEquals(Bytes.MB * 1023L, + UnitUtil.bytesFromReadableString("1023 MIB")); + Assert.assertEquals(Bytes.MB * 1234567890L, + UnitUtil.bytesFromReadableString("1234567890 Mb")); + + // GB + Assert.assertEquals(0L, UnitUtil.bytesFromReadableString("0 GB")); + Assert.assertEquals(Bytes.GB * 1L, + UnitUtil.bytesFromReadableString("1 GB")); + Assert.assertEquals((long) (Bytes.GB * 3.14), + UnitUtil.bytesFromReadableString("3.14 GB")); + Assert.assertEquals(Bytes.GB * 10L, + UnitUtil.bytesFromReadableString("10 gB")); + Assert.assertEquals(Bytes.GB * 100L, + UnitUtil.bytesFromReadableString("100 GiB")); + Assert.assertEquals(Bytes.GB * 1000L, + UnitUtil.bytesFromReadableString("1000 gib")); + Assert.assertEquals(Bytes.GB * 1023L, + UnitUtil.bytesFromReadableString("1023 GIB")); + Assert.assertEquals(Bytes.GB * 1234567890L, + UnitUtil.bytesFromReadableString("1234567890 Gb")); + + // TB + Assert.assertEquals(0L, UnitUtil.bytesFromReadableString("0 TB")); + Assert.assertEquals(Bytes.TB * 1L, + UnitUtil.bytesFromReadableString("1 TB")); + Assert.assertEquals((long) (Bytes.TB * 3.14), + UnitUtil.bytesFromReadableString("3.14 TB")); + Assert.assertEquals(Bytes.TB * 10L, + UnitUtil.bytesFromReadableString("10 tB")); + Assert.assertEquals(Bytes.TB * 100L, + UnitUtil.bytesFromReadableString("100 TiB")); + Assert.assertEquals(Bytes.TB * 1000L, + UnitUtil.bytesFromReadableString("1000 tib")); + Assert.assertEquals(Bytes.TB * 1023L, + UnitUtil.bytesFromReadableString("1023 TIB")); + Assert.assertEquals(Bytes.TB * 123456L, + UnitUtil.bytesFromReadableString("123456 Tb")); + + // PB + Assert.assertEquals(0L, UnitUtil.bytesFromReadableString("0 PB")); + Assert.assertEquals(Bytes.PB * 1L, + UnitUtil.bytesFromReadableString("1 PB")); + Assert.assertEquals((long) (Bytes.PB * 3.14), + UnitUtil.bytesFromReadableString("3.14 PB")); + Assert.assertEquals(Bytes.PB * 10L, + UnitUtil.bytesFromReadableString("10 pB")); + Assert.assertEquals(Bytes.PB * 100L, + UnitUtil.bytesFromReadableString("100 PiB")); + Assert.assertEquals(Bytes.PB * 1000L, + UnitUtil.bytesFromReadableString("1000 pib")); + Assert.assertEquals(Bytes.PB * 1023L, + UnitUtil.bytesFromReadableString("1023 PIB")); + Assert.assertEquals(Bytes.PB * 8024L, + UnitUtil.bytesFromReadableString("8024 PIB")); + + // EB + Assert.assertEquals(0L, UnitUtil.bytesFromReadableString("0 EB")); + Assert.assertEquals(Bytes.EB * 1L, + UnitUtil.bytesFromReadableString("1 EB")); + Assert.assertEquals((long) (Bytes.EB * 3.14), + UnitUtil.bytesFromReadableString("3.14 EB")); + Assert.assertEquals((long) (Bytes.EB * 5.01), + UnitUtil.bytesFromReadableString("5.01 eB")); + Assert.assertEquals((long) (Bytes.EB * 6.28), + UnitUtil.bytesFromReadableString("6.28 EiB")); + Assert.assertEquals((long) (Bytes.EB * 7.9876), + UnitUtil.bytesFromReadableString("7.9876 eib")); + Assert.assertEquals((long) (Bytes.EB * 8.0), + UnitUtil.bytesFromReadableString("8.0 EIB")); // max + } + + @Test + public void testBytesFromReadableStringWithInvalidFormat() { + // No space + Assert.assertThrows(IllegalArgumentException.class, () -> { + UnitUtil.bytesFromReadableString("1kb"); + }, e -> { + Assert.assertContains("Invalid readable bytes '1kb'", + e.getMessage()); + }); + + // Invalid unit + Assert.assertThrows(IllegalArgumentException.class, () -> { + UnitUtil.bytesFromReadableString("1 aBc"); + }, e -> { + Assert.assertContains("Unrecognized unit aBc", e.getMessage()); + }); + Assert.assertThrows(IllegalArgumentException.class, () -> { + UnitUtil.bytesFromReadableString("1 k"); + }, e -> { + Assert.assertContains("Unrecognized unit k", e.getMessage()); + }); + Assert.assertThrows(IllegalArgumentException.class, () -> { + UnitUtil.bytesFromReadableString("1 m"); + }, e -> { + Assert.assertContains("Unrecognized unit m", e.getMessage()); + }); + Assert.assertThrows(IllegalArgumentException.class, () -> { + UnitUtil.bytesFromReadableString("1 2 MB"); + }, e -> { + Assert.assertContains("Unrecognized unit 2 MB", e.getMessage()); + }); + + // Invalid number + Assert.assertThrows(IllegalArgumentException.class, () -> { + UnitUtil.bytesFromReadableString("2b kb"); + }, e -> { + Assert.assertContains("Invalid parameter(not number): '2b kb'", + e.getMessage()); + }); + Assert.assertThrows(IllegalArgumentException.class, () -> { + UnitUtil.bytesFromReadableString("2.3.4 kb"); + }, e -> { + Assert.assertContains("Invalid parameter(not number): '2.3.4 kb'", + e.getMessage()); + }); + + // Bytes overflow long value + Assert.assertThrows(IllegalArgumentException.class, () -> { + UnitUtil.bytesFromReadableString("8.1 EIB"); + }, e -> { + Assert.assertContains("The value 9.33866418731546E18 from " + + "parameter '8.1 EIB' is out of range", + e.getMessage()); + }); + Assert.assertThrows(IllegalArgumentException.class, () -> { + UnitUtil.bytesFromReadableString("9024 Pb"); + }, e -> { + Assert.assertContains("is out of range", e.getMessage()); + }); + Assert.assertThrows(IllegalArgumentException.class, () -> { + UnitUtil.bytesFromReadableString("12345678 Tb"); + }, e -> { + Assert.assertContains("is out of range", e.getMessage()); + }); + } + + @Test + public void testTimestampToReadableString() { + Assert.assertEquals("0ms", + UnitUtil.timestampToReadableString(0L)); + Assert.assertEquals("1ms", + UnitUtil.timestampToReadableString(1L)); + Assert.assertEquals("100ms", + UnitUtil.timestampToReadableString(100L)); + Assert.assertEquals("999ms", + UnitUtil.timestampToReadableString(999L)); + + Assert.assertEquals("1s", + UnitUtil.timestampToReadableString(1000L)); + Assert.assertEquals("10s", + UnitUtil.timestampToReadableString(10000L)); + Assert.assertEquals("1s1ms", + UnitUtil.timestampToReadableString(1001L)); + Assert.assertEquals("1s200ms", + UnitUtil.timestampToReadableString(1200L)); + Assert.assertEquals("6s789ms", + UnitUtil.timestampToReadableString(6789L)); + Assert.assertEquals("59s789ms", + UnitUtil.timestampToReadableString(59789L)); + + Assert.assertEquals("1m0s", + UnitUtil.timestampToReadableString(60789L)); + Assert.assertEquals("1m1s", + UnitUtil.timestampToReadableString(61789L)); + Assert.assertEquals("1m2s", + UnitUtil.timestampToReadableString(62000L)); + Assert.assertEquals("2m2s", + UnitUtil.timestampToReadableString(122000L)); + Assert.assertEquals("2m12s", + UnitUtil.timestampToReadableString(132000L)); + Assert.assertEquals("59m59s", + UnitUtil.timestampToReadableString(3599000L)); + + Assert.assertEquals("1h0m0s", + UnitUtil.timestampToReadableString(3600000L)); + Assert.assertEquals("1h0m23s", + UnitUtil.timestampToReadableString(3623000L)); + Assert.assertEquals("1h1m23s", + UnitUtil.timestampToReadableString(3683000L)); + Assert.assertEquals("1h24m43s", + UnitUtil.timestampToReadableString(5083000L)); + Assert.assertEquals("23h59m59s", + UnitUtil.timestampToReadableString(86399000L)); + + Assert.assertEquals("1d0h0m0s", + UnitUtil.timestampToReadableString(86400000L)); + Assert.assertEquals("1d1h24m43s", + UnitUtil.timestampToReadableString(91483000L)); + Assert.assertEquals("1d1h24m43s", + UnitUtil.timestampToReadableString(91483000L)); + + Assert.assertEquals("30d0h0m0s", + UnitUtil.timestampToReadableString(2592000000L)); + Assert.assertEquals("30d23h59m59s", + UnitUtil.timestampToReadableString(2678399000L)); + Assert.assertEquals("130d23h59m59s", + UnitUtil.timestampToReadableString(11318399000L)); + Assert.assertEquals("1130d23h59m59s", + UnitUtil.timestampToReadableString(97718399000L)); + } + + @Test + public void testTimestampFromReadableString() { + Assert.assertEquals(0L, + UnitUtil.timestampFromReadableString("0ms")); + Assert.assertEquals(1L, + UnitUtil.timestampFromReadableString("1ms")); + Assert.assertEquals(100L, + UnitUtil.timestampFromReadableString("100ms")); + Assert.assertEquals(999L, + UnitUtil.timestampFromReadableString("999ms")); + Assert.assertEquals(1001L, + UnitUtil.timestampFromReadableString("1001ms")); + + Assert.assertEquals(0L, + UnitUtil.timestampFromReadableString("0s")); + Assert.assertEquals(1000L, + UnitUtil.timestampFromReadableString("1s")); + Assert.assertEquals(10000L, + UnitUtil.timestampFromReadableString("10s")); + Assert.assertEquals(1001L, + UnitUtil.timestampFromReadableString("1s1ms")); + Assert.assertEquals(1200L, + UnitUtil.timestampFromReadableString("1s200ms")); + Assert.assertEquals(6789L, + UnitUtil.timestampFromReadableString("6s789ms")); + Assert.assertEquals(59789L, + UnitUtil.timestampFromReadableString("59s789ms")); + Assert.assertEquals(59789L, + UnitUtil.timestampFromReadableString("59s2789ms")); + + Assert.assertEquals(60000L, + UnitUtil.timestampFromReadableString("1m0s")); + Assert.assertEquals(61000L, + UnitUtil.timestampFromReadableString("1m1s")); + Assert.assertEquals(62000L, + UnitUtil.timestampFromReadableString("1m2s")); + Assert.assertEquals(122000L, + UnitUtil.timestampFromReadableString("2m2s")); + Assert.assertEquals(132000L, + UnitUtil.timestampFromReadableString("2m12s")); + Assert.assertEquals(3599000L, + UnitUtil.timestampFromReadableString("59m59s")); + + Assert.assertEquals(3600000L, + UnitUtil.timestampFromReadableString("1h0m0s")); + Assert.assertEquals(3623000L, + UnitUtil.timestampFromReadableString("1h0m23s")); + Assert.assertEquals(3683000L, + UnitUtil.timestampFromReadableString("1h1m23s")); + Assert.assertEquals(5083000L, + UnitUtil.timestampFromReadableString("1h24m43s")); + Assert.assertEquals(86399000L, + UnitUtil.timestampFromReadableString("23h59m59s")); + + Assert.assertEquals(86400000L, + UnitUtil.timestampFromReadableString("1d0h0m0s")); + Assert.assertEquals(91483000L, + UnitUtil.timestampFromReadableString("1d1h24m43s")); + Assert.assertEquals(91483000L, + UnitUtil.timestampFromReadableString("1d1h24m43s")); + + Assert.assertEquals(2592000000L, UnitUtil.timestampFromReadableString( + "30d0h0m0s")); + Assert.assertEquals(2678399000L, UnitUtil.timestampFromReadableString( + "30d23h59m59s")); + Assert.assertEquals(11318399000L, UnitUtil.timestampFromReadableString( + "130d23h59m59s")); + Assert.assertEquals(97718399000L, UnitUtil.timestampFromReadableString( + "1130d23h59m59s")); + } +} From 265f74bb5fad0adfccac3ef0879f4a8966ebf04a Mon Sep 17 00:00:00 2001 From: Linary Date: Fri, 19 Mar 2021 21:21:25 +0800 Subject: [PATCH 137/217] Add checkstyle plugin (#67) --- checkstyle.xml | 89 +++++++++++++++++++ pom.xml | 23 ++++- .../baidu/hugegraph/config/OptionSpace.java | 22 ++--- .../baidu/hugegraph/date/SafeDateFormat.java | 6 -- .../com/baidu/hugegraph/rest/RestResult.java | 16 ++-- .../baidu/hugegraph/testutil/Whitebox.java | 4 +- .../com/baidu/hugegraph/util/CheckSocket.java | 2 +- .../com/baidu/hugegraph/util/NumericUtil.java | 2 +- .../com/baidu/hugegraph/util/VersionUtil.java | 10 ++- 9 files changed, 144 insertions(+), 30 deletions(-) create mode 100644 checkstyle.xml diff --git a/checkstyle.xml b/checkstyle.xml new file mode 100644 index 0000000000..9373a70d91 --- /dev/null +++ b/checkstyle.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml index fb2818147a..10a7e8893b 100644 --- a/pom.xml +++ b/pom.xml @@ -247,7 +247,28 @@ - + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.1.0 + + checkstyle.xml + UTF-8 + true + true + false + false + + + + validate + validate + + check + + + + org.apache.maven.plugins maven-jar-plugin diff --git a/src/main/java/com/baidu/hugegraph/config/OptionSpace.java b/src/main/java/com/baidu/hugegraph/config/OptionSpace.java index 8e633fa264..8c1128c1f6 100644 --- a/src/main/java/com/baidu/hugegraph/config/OptionSpace.java +++ b/src/main/java/com/baidu/hugegraph/config/OptionSpace.java @@ -36,13 +36,13 @@ public final class OptionSpace { private static final Logger LOG = Log.logger(OptionSpace.class); - private static final Map> holders; - private static final Map> options; + private static final Map> HOLDERS; + private static final Map> OPTIONS; private static final String INSTANCE_METHOD = "instance"; static { - holders = new ConcurrentHashMap<>(); - options = new ConcurrentHashMap<>(); + HOLDERS = new ConcurrentHashMap<>(); + OPTIONS = new ConcurrentHashMap<>(); } public static void register(String module, String holder) { @@ -98,26 +98,26 @@ public static void register(String module, String holder) { public static void register(String module, OptionHolder holder) { // Check exists - if (holders.containsKey(module)) { + if (HOLDERS.containsKey(module)) { LOG.warn("Already registered option holder: {} ({})", - module, holders.get(module)); + module, HOLDERS.get(module)); } E.checkArgumentNotNull(holder, "OptionHolder can't be null"); - holders.put(module, holder.getClass()); - options.putAll(holder.options()); + HOLDERS.put(module, holder.getClass()); + OPTIONS.putAll(holder.options()); LOG.debug("Registered options for OptionHolder: {}", holder.getClass().getSimpleName()); } public static Set keys() { - return Collections.unmodifiableSet(options.keySet()); + return Collections.unmodifiableSet(OPTIONS.keySet()); } public static boolean containKey(String key) { - return options.containsKey(key); + return OPTIONS.containsKey(key); } public static TypedOption get(String key) { - return options.get(key); + return OPTIONS.get(key); } } diff --git a/src/main/java/com/baidu/hugegraph/date/SafeDateFormat.java b/src/main/java/com/baidu/hugegraph/date/SafeDateFormat.java index c8fa31ddce..68cd0089ed 100644 --- a/src/main/java/com/baidu/hugegraph/date/SafeDateFormat.java +++ b/src/main/java/com/baidu/hugegraph/date/SafeDateFormat.java @@ -63,10 +63,4 @@ public String format(Date date) { public Object toPattern() { return this.pattern; } - - @Override - public Object clone() { - // No need to clone due to itself is thread safe - return this; - } } diff --git a/src/main/java/com/baidu/hugegraph/rest/RestResult.java b/src/main/java/com/baidu/hugegraph/rest/RestResult.java index b633591935..dc78f18715 100644 --- a/src/main/java/com/baidu/hugegraph/rest/RestResult.java +++ b/src/main/java/com/baidu/hugegraph/rest/RestResult.java @@ -33,7 +33,7 @@ public class RestResult { - private static final ObjectMapper mapper = new ObjectMapper(); + private static final ObjectMapper MAPPER = new ObjectMapper(); private final int status; private final MultivaluedMap headers; @@ -59,7 +59,7 @@ public String content() { public T readObject(Class clazz) { try { - return mapper.readValue(this.content, clazz); + return MAPPER.readValue(this.content, clazz); } catch (Exception e) { throw new SerializeException( "Failed to deserialize: %s", e, this.content); @@ -69,16 +69,16 @@ public T readObject(Class clazz) { @SuppressWarnings("deprecation") public List readList(String key, Class clazz) { try { - JsonNode root = mapper.readTree(this.content); + JsonNode root = MAPPER.readTree(this.content); JsonNode element = root.get(key); if (element == null) { throw new SerializeException( "Can't find value of the key: %s in json.", key); } - JavaType type = mapper.getTypeFactory() + JavaType type = MAPPER.getTypeFactory() .constructParametrizedType(ArrayList.class, List.class, clazz); - return mapper.convertValue(element, type); + return MAPPER.convertValue(element, type); } catch (IOException e) { throw new SerializeException( "Failed to deserialize %s", e, this.content); @@ -87,11 +87,11 @@ public List readList(String key, Class clazz) { @SuppressWarnings("deprecation") public List readList(Class clazz) { - JavaType type = mapper.getTypeFactory() + JavaType type = MAPPER.getTypeFactory() .constructParametrizedType(ArrayList.class, List.class, clazz); try { - return mapper.readValue(this.content, type); + return MAPPER.readValue(this.content, type); } catch (IOException e) { throw new SerializeException( "Failed to deserialize %s", e, this.content); @@ -105,6 +105,6 @@ public String toString() { } public static void registerModule(Module module) { - mapper.registerModule(module); + MAPPER.registerModule(module); } } diff --git a/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java b/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java index 60938b385d..0d7c7c4266 100644 --- a/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java +++ b/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java @@ -169,7 +169,9 @@ public static Method method(Class clazz, String methodName, if (superclass != null) { try { return method(superclass, methodName, argsClasses); - } catch (Exception ignored){} + } catch (Exception ignored) { + // pass + } } throw new RuntimeException(String.format( "Can't find method '%s' with args %s of class '%s'", diff --git a/src/main/java/com/baidu/hugegraph/util/CheckSocket.java b/src/main/java/com/baidu/hugegraph/util/CheckSocket.java index 9a6066586d..c0dfc89849 100644 --- a/src/main/java/com/baidu/hugegraph/util/CheckSocket.java +++ b/src/main/java/com/baidu/hugegraph/util/CheckSocket.java @@ -37,7 +37,7 @@ public final class CheckSocket { private static final String MSG_USAGE = "Usage: " + CheckSocket.class.getSimpleName() + " hostname port"; - public static void main(String args[]) { + public static void main(String[] args) { if (args.length != 2) { System.err.println(MSG_USAGE); System.exit(E_USAGE); diff --git a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java index 1dafa8b2c7..f1b4f88ba0 100644 --- a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java @@ -216,7 +216,7 @@ public static Number maxValueOf(Class clazz) { E.checkArgumentNotNull(clazz, "The clazz can't be null"); if (Long.class.isAssignableFrom(clazz) || - Double.class.isAssignableFrom(clazz) ) { + Double.class.isAssignableFrom(clazz)) { return Long.MAX_VALUE; } if (Integer.class.isAssignableFrom(clazz) || diff --git a/src/main/java/com/baidu/hugegraph/util/VersionUtil.java b/src/main/java/com/baidu/hugegraph/util/VersionUtil.java index 92bef3da23..891cab04c6 100644 --- a/src/main/java/com/baidu/hugegraph/util/VersionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/VersionUtil.java @@ -23,6 +23,7 @@ import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; +import java.util.Objects; import java.util.jar.Attributes; import java.util.jar.Manifest; @@ -121,7 +122,9 @@ public static String getPomVersion() { if (isr != null) { try { isr.close(); - } catch (Exception ignored) {} + } catch (Exception ignored) { + // pass + } } // Destroy child process @@ -205,6 +208,11 @@ public boolean equals(Object that) { return this.compareTo((Version) that) == 0; } + @Override + public int hashCode() { + return Objects.hash(this.version); + } + @Override public String toString() { return this.version; From 159143c04dd68f0334f81069ee0d5ce44198ab45 Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Tue, 23 Mar 2021 18:59:43 +0800 Subject: [PATCH 138/217] add rpc framework based on sofa-rpc (#1) * add rpc framework based on sofa-rpc * allowed to start server or client separately * add destroy() method for rpc client * complete the supplement of test cases * remove sleep in destroy-server and improve comments of test block * add fanout exception test case * travis use oraclejdk8 * fix log4j config and remove test/resources from pom to avoid including log4j2.xml in tar Co-authored-by: Jermy Li Co-authored-by: xuliguov5 --- .travis.yml | 13 + README.md | 2 +- pom.xml | 36 +- .../baidu/hugegraph/config/RpcOptions.java | 149 ++++ .../hugegraph/rpc/RpcClientProvider.java | 75 ++ .../baidu/hugegraph/rpc/RpcCommonConfig.java | 46 ++ .../hugegraph/rpc/RpcConsumerConfig.java | 217 ++++++ .../com/baidu/hugegraph/rpc/RpcException.java | 41 + .../hugegraph/rpc/RpcProviderConfig.java | 85 +++ .../com/baidu/hugegraph/rpc/RpcServer.java | 128 ++++ .../rpc/RpcServiceConfig4Client.java | 37 + .../rpc/RpcServiceConfig4Server.java | 32 + .../baidu/hugegraph/version/RpcVersion.java | 31 + .../baidu/hugegraph/unit/BaseUnitTest.java | 58 ++ .../baidu/hugegraph/unit/ExceptionTest.java | 58 ++ .../hugegraph/unit/ServerClientTest.java | 710 ++++++++++++++++++ .../baidu/hugegraph/unit/UnitTestSuite.java | 32 + .../com/baidu/hugegraph/unit/VersionTest.java | 38 + src/test/resources/log4j2.xml | 26 + src/test/resources/rpc-client-lb.properties | 9 + src/test/resources/rpc-client.properties | 9 + src/test/resources/rpc-client345.properties | 9 + src/test/resources/rpc-client346.properties | 9 + src/test/resources/rpc-client67.properties | 9 + src/test/resources/rpc-server.properties | 9 + .../resources/rpc-server1-client.properties | 9 + .../resources/rpc-server2-client.properties | 9 + src/test/resources/rpc-server3.properties | 9 + src/test/resources/rpc-server4.properties | 9 + src/test/resources/rpc-server5.properties | 9 + 30 files changed, 1901 insertions(+), 12 deletions(-) create mode 100644 .travis.yml create mode 100644 src/main/java/com/baidu/hugegraph/config/RpcOptions.java create mode 100644 src/main/java/com/baidu/hugegraph/rpc/RpcClientProvider.java create mode 100644 src/main/java/com/baidu/hugegraph/rpc/RpcCommonConfig.java create mode 100644 src/main/java/com/baidu/hugegraph/rpc/RpcConsumerConfig.java create mode 100644 src/main/java/com/baidu/hugegraph/rpc/RpcException.java create mode 100644 src/main/java/com/baidu/hugegraph/rpc/RpcProviderConfig.java create mode 100644 src/main/java/com/baidu/hugegraph/rpc/RpcServer.java create mode 100644 src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Client.java create mode 100644 src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Server.java create mode 100644 src/main/java/com/baidu/hugegraph/version/RpcVersion.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/ExceptionTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/ServerClientTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/VersionTest.java create mode 100644 src/test/resources/log4j2.xml create mode 100644 src/test/resources/rpc-client-lb.properties create mode 100644 src/test/resources/rpc-client.properties create mode 100644 src/test/resources/rpc-client345.properties create mode 100644 src/test/resources/rpc-client346.properties create mode 100644 src/test/resources/rpc-client67.properties create mode 100644 src/test/resources/rpc-server.properties create mode 100644 src/test/resources/rpc-server1-client.properties create mode 100644 src/test/resources/rpc-server2-client.properties create mode 100644 src/test/resources/rpc-server3.properties create mode 100644 src/test/resources/rpc-server4.properties create mode 100644 src/test/resources/rpc-server5.properties diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..44711a9074 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,13 @@ +language: java + +jdk: + - oraclejdk8 + +dist: trusty + +install: mvn compile -Dmaven.javadoc.skip=true + +script: mvn test -Dtest=UnitTestSuite + +after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/README.md b/README.md index 9243acf297..17a17b6eab 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # HugeGraph-RPC -HugeGraph Database RPC component, currently it's a wrapper of [Sofa-RPC](https://github.com/sofastack/sofa-rpc) +HugeGraph Database RPC component, currently it's based on [Sofa-RPC](https://github.com/sofastack/sofa-rpc) ## Features diff --git a/pom.xml b/pom.xml index 5fdbbe6349..c89a586cc7 100644 --- a/pom.xml +++ b/pom.xml @@ -42,6 +42,13 @@ + + + com.baidu.hugegraph + hugegraph-common + 1.8.5 + + com.lmax @@ -54,16 +61,20 @@ 5.7.6 - io.netty - netty-all + org.jboss.resteasy + resteasy-client org.jboss.resteasy - resteasy-client + resteasy-netty4 + + + org.jboss.resteasy + resteasy-jackson2-provider - com.alipay.sofa - bolt + org.apache.httpcomponents + httpclient org.apache.httpcomponents @@ -73,17 +84,13 @@ org.apache.httpcomponents httpmime - - com.alipay.sofa.common - sofa-common-tools - org.jboss.logging jboss-logging - com.alipay.sofa - hessian + org.slf4j + slf4j-api @@ -105,6 +112,7 @@ + org.apache.maven.plugins maven-checkstyle-plugin @@ -127,6 +135,7 @@ + org.apache.maven.plugins maven-jar-plugin @@ -142,6 +151,11 @@ true + + + 1.0.0.0 + diff --git a/src/main/java/com/baidu/hugegraph/config/RpcOptions.java b/src/main/java/com/baidu/hugegraph/config/RpcOptions.java new file mode 100644 index 0000000000..482b570580 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/config/RpcOptions.java @@ -0,0 +1,149 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.config; + +import static com.baidu.hugegraph.config.OptionChecker.allowValues; +import static com.baidu.hugegraph.config.OptionChecker.disallowEmpty; +import static com.baidu.hugegraph.config.OptionChecker.rangeInt; + +public class RpcOptions extends OptionHolder { + + private RpcOptions() { + super(); + } + + private static volatile RpcOptions instance; + + public static synchronized RpcOptions instance() { + if (instance == null) { + instance = new RpcOptions(); + instance.registerOptions(); + } + return instance; + } + + public static final ConfigOption RPC_SERVER_HOST = + new ConfigOption<>( + "rpc.server_host", + "The hosts/ips bound by rpc server to provide services, " + + "empty value means not enabled.", + null, + "" + ); + + public static final ConfigOption RPC_SERVER_PORT = + new ConfigOption<>( + "rpc.server_port", + "The port bound by rpc server to provide services.", + rangeInt(1, Integer.MAX_VALUE), + 8090 + ); + + public static final ConfigOption RPC_SERVER_TIMEOUT = + new ConfigOption<>( + "rpc.server_timeout", + "The timeout(in seconds) of rpc server execution.", + rangeInt(1, Integer.MAX_VALUE), + 30 + ); + + public static final ConfigOption RPC_REMOTE_URL = + new ConfigOption<>( + "rpc.remote_url", + "The remote urls of rpc peers, it can be set to " + + "multiple addresses, which are concat by ',', " + + "empty value means not enabled.", + null, + "" + ); + + public static final ConfigOption RPC_CLIENT_CONNECT_TIMEOUT = + new ConfigOption<>( + "rpc.client_connect_timeout", + "The timeout(in seconds) of rpc client connect to rpc " + + "server.", + rangeInt(1, Integer.MAX_VALUE), + 20 + ); + + public static final ConfigOption RPC_CLIENT_RECONNECT_PERIOD = + new ConfigOption<>( + "rpc.client_reconnect_period", + "The period(in seconds) of rpc client reconnect to rpc " + + "server.", + rangeInt(1, Integer.MAX_VALUE), + 10 + ); + + public static final ConfigOption RPC_CLIENT_READ_TIMEOUT = + new ConfigOption<>( + "rpc.client_read_timeout", + "The timeout(in seconds) of rpc client read from rpc " + + "server.", + rangeInt(1, Integer.MAX_VALUE), + 40 + ); + + public static final ConfigOption RPC_CLIENT_RETRIES = + new ConfigOption<>( + "rpc.client_retries", + "Failed retry number of rpc client calls to rpc server.", + rangeInt(0, Integer.MAX_VALUE), + 3 + ); + + public static final ConfigOption RPC_CLIENT_LOAD_BALANCER = + new ConfigOption<>( + "rpc.client_load_balancer", + "The rpc client uses a load-balancing algorithm to " + + "access multiple rpc servers in one cluster. Default " + + "value is 'consistentHash', means forwording by request " + + "parameters.", + allowValues("random", "localPref", "roundRobin", + "consistentHash", "weightRoundRobin"), + "consistentHash" + ); + + public static final ConfigOption RPC_PROTOCOL = + new ConfigOption<>( + "rpc.protocol", + "Rpc communication protocol, client and server need to " + + "be specified the same value.", + allowValues("bolt", "rest", "dubbo", "h2c", "http"), + "bolt" + ); + + public static final ConfigOption RPC_CONFIG_ORDER = + new ConfigOption<>( + "rpc.config_order", + "Sofa rpc configuration file loading order, the larger " + + "the more later loading.", + rangeInt(1, Integer.MAX_VALUE), + 999 + ); + + public static final ConfigOption RPC_LOGGER_IMPL = + new ConfigOption<>( + "rpc.logger_impl", + "Sofa rpc log implementation class.", + disallowEmpty(), + "com.alipay.sofa.rpc.log.SLF4JLoggerImpl" + ); +} diff --git a/src/main/java/com/baidu/hugegraph/rpc/RpcClientProvider.java b/src/main/java/com/baidu/hugegraph/rpc/RpcClientProvider.java new file mode 100644 index 0000000000..6f0eba5a6c --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/rpc/RpcClientProvider.java @@ -0,0 +1,75 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.rpc; + +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.Set; + +import com.alipay.sofa.rpc.common.utils.StringUtils; +import com.baidu.hugegraph.config.HugeConfig; +import com.baidu.hugegraph.config.RpcOptions; +import com.baidu.hugegraph.util.E; + +public class RpcClientProvider { + + private final RpcConsumerConfig consumerConfig; + + public RpcClientProvider(HugeConfig config) { + // TODO: fetch from registry server + String rpcUrl = config.get(RpcOptions.RPC_REMOTE_URL); + String selfUrl = config.get(RpcOptions.RPC_SERVER_HOST) + ":" + + config.get(RpcOptions.RPC_SERVER_PORT); + rpcUrl = excludeSelfUrl(rpcUrl, selfUrl); + this.consumerConfig = StringUtils.isNotBlank(rpcUrl) ? + new RpcConsumerConfig(config, rpcUrl) : null; + } + public boolean enabled() { + return this.consumerConfig != null; + } + + public RpcConsumerConfig config() { + E.checkArgument(this.consumerConfig != null, + "RpcClient is not enabled, please config option '%s' " + + "and ensure to add an address other than self service", + RpcOptions.RPC_REMOTE_URL.name()); + return this.consumerConfig; + } + + public void unreferAll() { + if (this.consumerConfig != null) { + this.consumerConfig.removeAllServiceProxy(); + } + } + + public void destroy() { + if (this.consumerConfig != null) { + this.consumerConfig.destroy(); + } + } + + protected static String excludeSelfUrl(String rpcUrl, String selfUrl) { + String[] urls = StringUtils.splitWithCommaOrSemicolon(rpcUrl); + // Keep urls order via LinkedHashSet + Set urlSet = new LinkedHashSet<>(Arrays.asList(urls)); + urlSet.remove(selfUrl); + return String.join(",", urlSet); + } +} diff --git a/src/main/java/com/baidu/hugegraph/rpc/RpcCommonConfig.java b/src/main/java/com/baidu/hugegraph/rpc/RpcCommonConfig.java new file mode 100644 index 0000000000..4ee50b6826 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/rpc/RpcCommonConfig.java @@ -0,0 +1,46 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.rpc; + +import java.util.Map; + +import com.alipay.sofa.rpc.common.RpcConfigs; +import com.baidu.hugegraph.config.HugeConfig; +import com.baidu.hugegraph.config.RpcOptions; + +public class RpcCommonConfig { + + public static void initRpcConfigs(HugeConfig config) { + RpcConfigs.putValue("rpc.config.order", + config.get(RpcOptions.RPC_CONFIG_ORDER)); + RpcConfigs.putValue("logger.impl", + config.get(RpcOptions.RPC_LOGGER_IMPL)); + } + + public static void initRpcConfigs(String key, Object value) { + RpcConfigs.putValue(key, value); + } + + public static void initRpcConfigs(Map conf) { + for (Map.Entry entry : conf.entrySet()) { + RpcConfigs.putValue(entry.getKey(), entry.getValue()); + } + } +} diff --git a/src/main/java/com/baidu/hugegraph/rpc/RpcConsumerConfig.java b/src/main/java/com/baidu/hugegraph/rpc/RpcConsumerConfig.java new file mode 100644 index 0000000000..c9b28f98e7 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/rpc/RpcConsumerConfig.java @@ -0,0 +1,217 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.rpc; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.slf4j.Logger; + +import com.alipay.sofa.rpc.bootstrap.Bootstraps; +import com.alipay.sofa.rpc.bootstrap.ConsumerBootstrap; +import com.alipay.sofa.rpc.client.AbstractCluster; +import com.alipay.sofa.rpc.client.Cluster; +import com.alipay.sofa.rpc.client.ProviderInfo; +import com.alipay.sofa.rpc.config.ConsumerConfig; +import com.alipay.sofa.rpc.core.exception.RpcErrorType; +import com.alipay.sofa.rpc.core.exception.SofaRpcException; +import com.alipay.sofa.rpc.core.request.SofaRequest; +import com.alipay.sofa.rpc.core.response.SofaResponse; +import com.alipay.sofa.rpc.ext.Extension; +import com.alipay.sofa.rpc.ext.ExtensionLoaderFactory; +import com.baidu.hugegraph.config.HugeConfig; +import com.baidu.hugegraph.config.RpcOptions; +import com.baidu.hugegraph.util.Log; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; + +public class RpcConsumerConfig implements RpcServiceConfig4Client { + + private final HugeConfig conf; + private final String remoteUrls; + private final Map> configs; + private final List> bootstraps; + + static { + ExtensionLoaderFactory.getExtensionLoader(Cluster.class) + .loadExtension(FanoutCluster.class); + } + + public RpcConsumerConfig(HugeConfig config, String remoteUrls) { + RpcCommonConfig.initRpcConfigs(config); + this.conf = config; + this.remoteUrls = remoteUrls; + this.configs = Maps.newHashMap(); + this.bootstraps = Lists.newArrayList(); + } + + @Override + public T serviceProxy(String interfaceId) { + return this.serviceProxy(null, interfaceId); + } + + @Override + public T serviceProxy(String graph, String interfaceId) { + ConsumerConfig config = this.consumerConfig(graph, interfaceId); + ConsumerBootstrap bootstrap = Bootstraps.from(config); + this.bootstraps.add(bootstrap); + return bootstrap.refer(); + } + + @Override + public void removeAllServiceProxy() { + for (ConsumerBootstrap bootstrap : this.bootstraps) { + bootstrap.unRefer(); + } + } + + public void destroy() { + Set clusters = Sets.newHashSet(); + for (ConsumerBootstrap bootstrap : this.bootstraps) { + bootstrap.unRefer(); + clusters.add(bootstrap.getCluster()); + } + for (Cluster cluster : clusters) { + cluster.destroy(); + } + } + + private ConsumerConfig consumerConfig(String graph, + String interfaceId) { + String serviceId; + if (graph != null) { + serviceId = interfaceId + ":" + graph; + } else { + serviceId = interfaceId; + } + + @SuppressWarnings("unchecked") + ConsumerConfig consumerConfig = (ConsumerConfig) + this.configs.get(serviceId); + if (consumerConfig != null) { + return consumerConfig; + } + + assert consumerConfig == null; + consumerConfig = new ConsumerConfig<>(); + + HugeConfig conf = this.conf; + String protocol = conf.get(RpcOptions.RPC_PROTOCOL); + int timeout = conf.get(RpcOptions.RPC_CLIENT_READ_TIMEOUT) * 1000; + int connectTimeout = conf.get(RpcOptions + .RPC_CLIENT_CONNECT_TIMEOUT) * 1000; + int reconnectPeriod = conf.get(RpcOptions + .RPC_CLIENT_RECONNECT_PERIOD) * 1000; + int retries = conf.get(RpcOptions.RPC_CLIENT_RETRIES); + String loadBalancer = conf.get(RpcOptions.RPC_CLIENT_LOAD_BALANCER); + + if (graph != null) { + consumerConfig.setId(serviceId).setUniqueId(graph); + // Default is FailoverCluster, set to FanoutCluster to broadcast + consumerConfig.setCluster("fanout"); + } + consumerConfig.setInterfaceId(interfaceId) + .setProtocol(protocol) + .setDirectUrl(this.remoteUrls) + .setTimeout(timeout) + .setConnectTimeout(connectTimeout) + .setReconnectPeriod(reconnectPeriod) + .setRetries(retries) + .setLoadBalancer(loadBalancer); + + this.configs.put(serviceId, consumerConfig); + return consumerConfig; + } + + @Extension("fanout") + private static class FanoutCluster extends AbstractCluster { + + private static final Logger LOG = Log.logger(FanoutCluster.class); + + public FanoutCluster(ConsumerBootstrap consumerBootstrap) { + super(consumerBootstrap); + } + + @Override + protected SofaResponse doInvoke(SofaRequest request) + throws SofaRpcException { + List providers = this.getRouterChain() + .route(request, null); + List responses = new ArrayList<>(providers.size()); + List excepts = new ArrayList<>(providers.size()); + + for (ProviderInfo provider : providers) { + try { + SofaResponse response = this.doInvoke(request, provider); + responses.add(response); + } catch (SofaRpcException e) { + excepts.add(e); + LOG.warn("{}.(error {})", e.getMessage(), e.getErrorType()); + } + } + + if (responses.size() > 0) { + /* + * Just choose the first one as result to return, ignore others + * TODO: maybe more strategies should be provided + */ + return responses.get(0); + } else if (excepts.size() > 0) { + throw excepts.get(0); + } else { + assert providers.isEmpty(); + String method = methodName(request); + throw new SofaRpcException(RpcErrorType.CLIENT_ROUTER, + "No service provider for " + method); + } + } + + private SofaResponse doInvoke(SofaRequest request, + ProviderInfo providerInfo) { + try { + SofaResponse response = this.filterChain(providerInfo, request); + if (response != null) { + return response; + } + String method = methodName(request); + throw new SofaRpcException(RpcErrorType.CLIENT_UNDECLARED_ERROR, + "Failed to call " + method + " on remote server " + + providerInfo + ", return null response"); + } catch (Exception e) { + int error = RpcErrorType.CLIENT_UNDECLARED_ERROR; + if (e instanceof SofaRpcException) { + error = ((SofaRpcException) e).getErrorType(); + } + String method = methodName(request); + throw new SofaRpcException(error, + "Failed to call " + method + " on remote server " + + providerInfo + ", caused by exception: " + e); + } + } + + private static String methodName(SofaRequest request) { + return request.getInterfaceName() + "." + + request.getMethodName() + "()"; + } + } +} diff --git a/src/main/java/com/baidu/hugegraph/rpc/RpcException.java b/src/main/java/com/baidu/hugegraph/rpc/RpcException.java new file mode 100644 index 0000000000..2a2675ce43 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/rpc/RpcException.java @@ -0,0 +1,41 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.rpc; + +public class RpcException extends RuntimeException { + + private static final long serialVersionUID = -6067652498161184537L; + + public RpcException(String message) { + super(message); + } + + public RpcException(String message, Throwable cause) { + super(message, cause); + } + + public RpcException(String message, Object... args) { + super(String.format(message, args)); + } + + public RpcException(String message, Throwable cause, Object... args) { + super(String.format(message, args), cause); + } +} diff --git a/src/main/java/com/baidu/hugegraph/rpc/RpcProviderConfig.java b/src/main/java/com/baidu/hugegraph/rpc/RpcProviderConfig.java new file mode 100644 index 0000000000..8bf0aea3a4 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/rpc/RpcProviderConfig.java @@ -0,0 +1,85 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.rpc; + +import java.util.Map; + +import com.alipay.sofa.rpc.config.ProviderConfig; +import com.baidu.hugegraph.util.E; +import com.google.common.collect.Maps; + +public class RpcProviderConfig implements RpcServiceConfig4Server { + + private final Map> configs = Maps.newHashMap(); + + @Override + public String addService(Class clazz, S serviceImpl) { + return this.addService(null, clazz.getName(), serviceImpl); + } + + @Override + public String addService(String graph, + Class clazz, + S serviceImpl) { + return this.addService(graph, clazz.getName(), serviceImpl); + } + + private String addService(String graph, + String interfaceId, + S serviceImpl) { + ProviderConfig providerConfig = new ProviderConfig<>(); + String serviceId; + if (graph != null) { + serviceId = interfaceId + ":" + graph; + providerConfig.setId(serviceId).setUniqueId(graph); + } else { + serviceId = interfaceId; + } + + providerConfig.setInterfaceId(interfaceId) + .setRef(serviceImpl); + + E.checkArgument(!this.configs.containsKey(serviceId), + "Not allowed to add service already exist: '%s'", + serviceId); + this.configs.put(serviceId, providerConfig); + return serviceId; + } + + @Override + public void removeService(String serviceId) { + ProviderConfig config = this.configs.remove(serviceId); + E.checkArgument(config != null, + "The service '%s' doesn't exist", serviceId); + config.unExport(); + } + + @Override + public void removeAllService() { + for (ProviderConfig config : this.configs.values()) { + config.unExport(); + } + this.configs.clear(); + } + + public Map> configs() { + return this.configs; + } +} diff --git a/src/main/java/com/baidu/hugegraph/rpc/RpcServer.java b/src/main/java/com/baidu/hugegraph/rpc/RpcServer.java new file mode 100644 index 0000000000..d158aea08f --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/rpc/RpcServer.java @@ -0,0 +1,128 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.rpc; + +import java.util.Map; + +import org.apache.commons.collections.MapUtils; +import org.slf4j.Logger; + +import com.alipay.sofa.rpc.common.utils.StringUtils; +import com.alipay.sofa.rpc.config.ProviderConfig; +import com.alipay.sofa.rpc.config.ServerConfig; +import com.baidu.hugegraph.config.HugeConfig; +import com.baidu.hugegraph.config.RpcOptions; +import com.baidu.hugegraph.util.E; +import com.baidu.hugegraph.util.Log; + +public class RpcServer { + + private static final Logger LOG = Log.logger(RpcServer.class); + + private final HugeConfig conf; + private final RpcProviderConfig configs; + private final ServerConfig serverConfig; + + public RpcServer(HugeConfig config) { + RpcCommonConfig.initRpcConfigs(config); + this.conf = config; + this.configs = new RpcProviderConfig(); + + String host = config.get(RpcOptions.RPC_SERVER_HOST); + if (StringUtils.isNotBlank(host)) { + int port = config.get(RpcOptions.RPC_SERVER_PORT); + this.serverConfig = new ServerConfig(); + this.serverConfig.setProtocol(config.get(RpcOptions.RPC_PROTOCOL)) + .setHost(host).setPort(port) + .setDaemon(false); + } else { + this.serverConfig = null; + } + } + + public boolean enabled() { + return this.serverConfig != null; + } + + public RpcProviderConfig config() { + this.checkEnabled(); + return this.configs; + } + + public String host() { + this.checkEnabled(); + return this.serverConfig.getBoundHost(); + } + + public int port() { + this.checkEnabled(); + return this.serverConfig.getPort(); + } + + public void exportAll() { + this.checkEnabled(); + LOG.debug("RpcServer starting on port {}", this.port()); + Map> configs = this.configs.configs(); + if (MapUtils.isEmpty(configs)) { + LOG.info("RpcServer config is empty, skip starting RpcServer"); + return; + } + int timeout = this.conf.get(RpcOptions.RPC_SERVER_TIMEOUT) * 1000; + for (ProviderConfig providerConfig : configs.values()) { + providerConfig.setServer(this.serverConfig) + .setTimeout(timeout) + .export(); + } + LOG.info("RpcServer started success on port {}", this.port()); + } + + public void unexportAll() { + this.configs.removeAllService(); + } + + public void unexport(String serviceId) { + this.configs.removeService(serviceId); + } + + public void destroy() { + if (!this.enabled()) { + return; + } + LOG.info("RpcServer stop on port {}", this.port()); + for (ProviderConfig config : this.configs.configs().values()) { + Object service = config.getRef(); + if (service instanceof AutoCloseable) { + try { + ((AutoCloseable) service).close(); + } catch (Exception e) { + LOG.warn("Failed to close service {}", service, e); + } + } + } + this.configs.removeAllService(); + this.serverConfig.destroy(); + } + + private void checkEnabled() { + E.checkArgument(this.enabled(), + "RpcServer is not enabled, please config option '%s'", + RpcOptions.RPC_SERVER_HOST.name()); + } +} diff --git a/src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Client.java b/src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Client.java new file mode 100644 index 0000000000..13cfca96f0 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Client.java @@ -0,0 +1,37 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.rpc; + +public interface RpcServiceConfig4Client { + + public T serviceProxy(String interfaceId); + + public T serviceProxy(String graph, String interfaceId); + + public default T serviceProxy(Class clazz) { + return this.serviceProxy(clazz.getName()); + } + + public default T serviceProxy(String graph, Class clazz) { + return this.serviceProxy(graph, clazz.getName()); + } + + public void removeAllServiceProxy(); +} diff --git a/src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Server.java b/src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Server.java new file mode 100644 index 0000000000..7139073cf3 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Server.java @@ -0,0 +1,32 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.rpc; + +public interface RpcServiceConfig4Server { + + public String addService(Class clazz, S serviceImpl); + + public String addService(String graph, + Class clazz, S serviceImpl); + + public void removeService(String serviceId); + + public void removeAllService(); +} diff --git a/src/main/java/com/baidu/hugegraph/version/RpcVersion.java b/src/main/java/com/baidu/hugegraph/version/RpcVersion.java new file mode 100644 index 0000000000..884cc260e2 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/version/RpcVersion.java @@ -0,0 +1,31 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.version; + +import com.baidu.hugegraph.util.VersionUtil.Version; + +public class RpcVersion { + + public static final String NAME = "hugegraph-rpc"; + + // The second parameter of Version.of() is for all-in-one JAR + public static final Version VERSION = Version.of(RpcVersion.class, + "1.0.0"); +} diff --git a/src/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java b/src/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java new file mode 100644 index 0000000000..cdbdb03b45 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java @@ -0,0 +1,58 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit; + +import java.net.URL; + +import org.junit.BeforeClass; + +import com.baidu.hugegraph.config.HugeConfig; +import com.baidu.hugegraph.config.OptionSpace; +import com.baidu.hugegraph.rpc.RpcServer; + +public class BaseUnitTest { + + @BeforeClass + public static void initEnv() { + OptionSpace.register("rpc", "com.baidu.hugegraph.config.RpcOptions"); + } + + protected static HugeConfig config(boolean server) { + return config(server ? "server" : "client"); + } + + protected static HugeConfig config(String type) { + String name = String.format("rpc-%s.properties", type); + URL conf = BaseUnitTest.class.getClassLoader().getResource(name); + return new HugeConfig(conf.getPath()); + } + + protected static void startServer(RpcServer rpcServer) { + rpcServer.config().configs().values().forEach(c -> { + c.setRepeatedExportLimit(100); + }); + + rpcServer.exportAll(); + } + + protected static void stopServer(RpcServer rpcServer) { + rpcServer.destroy(); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/ExceptionTest.java b/src/test/java/com/baidu/hugegraph/unit/ExceptionTest.java new file mode 100644 index 0000000000..ade219804b --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/ExceptionTest.java @@ -0,0 +1,58 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit; + +import org.junit.Test; + +import com.baidu.hugegraph.rpc.RpcException; +import com.baidu.hugegraph.testutil.Assert; + +public class ExceptionTest { + + @Test + public void testExceptionWithMessage() { + RpcException e = new RpcException("test"); + Assert.assertEquals("test", e.getMessage()); + Assert.assertEquals(null, e.getCause()); + } + + @Test + public void testExceptionWithMessageAndCause() { + Exception cause = new Exception(); + RpcException e = new RpcException("test", cause); + Assert.assertEquals("test", e.getMessage()); + Assert.assertEquals(cause, e.getCause()); + } + + @Test + public void testExceptionWithMessageAndArgs() { + RpcException e = new RpcException("test %s", 168); + Assert.assertEquals("test 168", e.getMessage()); + Assert.assertEquals(null, e.getCause()); + } + + @Test + public void testExceptionWithMessageAndArgsAndCause() { + Exception cause = new Exception(); + RpcException e = new RpcException("test %s", cause, 168); + Assert.assertEquals("test 168", e.getMessage()); + Assert.assertEquals(cause, e.getCause()); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/ServerClientTest.java b/src/test/java/com/baidu/hugegraph/unit/ServerClientTest.java new file mode 100644 index 0000000000..65b24c86ef --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/ServerClientTest.java @@ -0,0 +1,710 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.alipay.sofa.rpc.common.RpcOptions; +import com.alipay.sofa.rpc.core.exception.SofaRpcException; +import com.alipay.sofa.rpc.core.exception.SofaRpcRuntimeException; +import com.baidu.hugegraph.config.HugeConfig; +import com.baidu.hugegraph.rpc.RpcClientProvider; +import com.baidu.hugegraph.rpc.RpcCommonConfig; +import com.baidu.hugegraph.rpc.RpcConsumerConfig; +import com.baidu.hugegraph.rpc.RpcProviderConfig; +import com.baidu.hugegraph.rpc.RpcServer; +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.testutil.Whitebox; +import com.baidu.hugegraph.util.E; +import com.google.common.collect.ImmutableMap; + +public class ServerClientTest extends BaseUnitTest { + + private static RpcServer rpcServer; + private static RpcClientProvider rpcClient; + + @BeforeClass + public static void init() { + rpcServer = new RpcServer(config(true)); + rpcClient = new RpcClientProvider(config(false)); + } + + @AfterClass + public static void clear() throws Exception { + if (rpcClient != null) { + rpcClient.destroy(); + } + if (rpcServer != null) { + rpcServer.destroy(); + } + } + + @After + public void teardown() { + if (rpcClient != null) { + rpcClient.unreferAll(); + } + if (rpcServer != null) { + rpcServer.unexportAll(); + } + } + + @Test + public void testSimpleService() { + // Init server + RpcProviderConfig serverConfig = rpcServer.config(); + serverConfig.addService(HelloService.class, new HelloServiceImpl()); + startServer(rpcServer); + + // Init client + RpcConsumerConfig clientConfig = rpcClient.config(); + HelloService client = clientConfig.serviceProxy(HelloService.class); + + // Test call + Assert.assertEquals("hello tom!", client.hello("tom")); + Assert.assertEquals("tom", client.echo("tom")); + Assert.assertEquals(5.14, client.sum(2, 3.14), 0.00000001d); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + client.hello(""); + }, e -> { + Assert.assertContains("empty hello parameter", e.getMessage()); + }); + } + + @Test + public void testMultiService() { + // Init server + GraphHelloServiceImpl g1 = new GraphHelloServiceImpl("g1"); + GraphHelloServiceImpl g2 = new GraphHelloServiceImpl("g2"); + GraphHelloServiceImpl g3 = new GraphHelloServiceImpl("g3"); + + RpcProviderConfig serverConfig = rpcServer.config(); + serverConfig.addService(g1.graph(), HelloService.class, g1); + serverConfig.addService(g2.graph(), HelloService.class, g2); + serverConfig.addService(g3.graph(), HelloService.class, g3); + startServer(rpcServer); + + // Init client + RpcConsumerConfig clientConfig = rpcClient.config(); + HelloService c1 = clientConfig.serviceProxy("g1", HelloService.class); + HelloService c2 = clientConfig.serviceProxy("g2", HelloService.class); + HelloService c3 = clientConfig.serviceProxy("g3", HelloService.class); + + // Test call + Assert.assertEquals("g1: hello tom!", c1.hello("tom")); + Assert.assertEquals("g1: tom", c1.echo("tom")); + Assert.assertEquals(5.14, c1.sum(2, 3.14), 0.00000001d); + + Assert.assertEquals("g2: hello tom!", c2.hello("tom")); + Assert.assertEquals("g2: tom", c2.echo("tom")); + Assert.assertEquals(6.14, c2.sum(3, 3.14), 0.00000001d); + + Assert.assertEquals("g3: hello tom!", c3.hello("tom")); + Assert.assertEquals("g3: tom", c3.echo("tom")); + Assert.assertEquals(103.14, c3.sum(100, 3.14), 0.00000001d); + + Assert.assertEquals(5.14, g1.result(), 0.00000001d); + Assert.assertEquals(6.14, g2.result(), 0.00000001d); + Assert.assertEquals(103.14, g3.result(), 0.00000001d); + } + + @Test + public void testStartBothServerAndClientThroughSameConfig() { + // Init server1 + HugeConfig server1 = config("server1-client"); + RpcServer rpcServer1 = new RpcServer(server1); + RpcClientProvider rpcClient1 = new RpcClientProvider(server1); + + GraphHelloServiceImpl s1g1 = new GraphHelloServiceImpl("g1"); + GraphHelloServiceImpl s1g2 = new GraphHelloServiceImpl("g2"); + + rpcServer1.config().addService(s1g1.graph(), HelloService.class, s1g1); + rpcServer1.config().addService(s1g2.graph(), HelloService.class, s1g2); + + startServer(rpcServer1); + + // Init server2 + HugeConfig server2 = config("server2-client"); + RpcServer rpcServer2 = new RpcServer(server2); + RpcClientProvider rpcClient2 = new RpcClientProvider(server2); + + GraphHelloServiceImpl s2g1 = new GraphHelloServiceImpl("g1"); + GraphHelloServiceImpl s2g2 = new GraphHelloServiceImpl("g2"); + + rpcServer2.config().addService(s2g1.graph(), HelloService.class, s2g1); + rpcServer2.config().addService(s2g2.graph(), HelloService.class, s2g2); + + startServer(rpcServer2); + + // Init client1 + HelloService s2g1Client = rpcClient1.config().serviceProxy( + "g1", HelloService.class); + HelloService s2g2Client = rpcClient1.config().serviceProxy( + "g2", HelloService.class); + + // Init client2 + HelloService s1g1Client = rpcClient2.config().serviceProxy( + "g1", HelloService.class); + HelloService s1g2Client = rpcClient2.config().serviceProxy( + "g2", HelloService.class); + + // Test call + Assert.assertEquals(2.1, s2g1Client.sum(1, 1.1), 0.00000001d); + Assert.assertEquals(2.2, s2g2Client.sum(1, 1.2), 0.00000001d); + + Assert.assertEquals(1.1, s1g1Client.sum(1, 0.1), 0.00000001d); + Assert.assertEquals(1.2, s1g2Client.sum(0, 1.2), 0.00000001d); + + Assert.assertEquals(1.1, s1g1.result(), 0.00000001d); + Assert.assertEquals(1.2, s1g2.result(), 0.00000001d); + Assert.assertEquals(2.1, s2g1.result(), 0.00000001d); + Assert.assertEquals(2.2, s2g2.result(), 0.00000001d); + + // Destroy all + rpcClient1.destroy(); + rpcClient2.destroy(); + stopServer(rpcServer1); + stopServer(rpcServer2); + } + + @Test + public void testFanoutCallService() { + // Init 3 servers + HugeConfig server3 = config("server3"); + RpcServer rpcServer3 = new RpcServer(server3); + + HugeConfig server4 = config("server4"); + RpcServer rpcServer4 = new RpcServer(server4); + + HugeConfig server5 = config("server5"); + RpcServer rpcServer5 = new RpcServer(server5); + + GraphHelloServiceImpl s3g1 = new GraphHelloServiceImpl("g1"); + GraphHelloServiceImpl s4g1 = new GraphHelloServiceImpl("g1"); + GraphHelloServiceImpl s5g1 = new GraphHelloServiceImpl("g1"); + + rpcServer3.config().addService(s3g1.graph(), HelloService.class, s3g1); + rpcServer4.config().addService(s4g1.graph(), HelloService.class, s4g1); + rpcServer5.config().addService(s5g1.graph(), HelloService.class, s5g1); + + startServer(rpcServer3); + startServer(rpcServer4); + startServer(rpcServer5); + + // Init client + HugeConfig client345 = config("client345"); + RpcClientProvider rpcClient345 = new RpcClientProvider(client345); + + HelloService g1 = rpcClient345.config() + .serviceProxy("g1", HelloService.class); + + // Test fanout + Assert.assertEquals("g1: fanout", g1.echo("fanout")); + Assert.assertEquals(16.8, g1.sum(10, 6.8), 0.00000001d); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + g1.hello(""); + }, e -> { + Assert.assertContains("empty hello parameter", e.getMessage()); + }); + + Assert.assertEquals(16.8, s3g1.result(), 0.00000001d); + Assert.assertEquals(16.8, s4g1.result(), 0.00000001d); + Assert.assertEquals(16.8, s5g1.result(), 0.00000001d); + + // Destroy all + rpcClient345.destroy(); + + stopServer(rpcServer3); + stopServer(rpcServer4); + stopServer(rpcServer5); + } + + @Test + public void testFanoutCallServiceWithError() { + // Init 3 servers + HugeConfig server3 = config("server3"); + RpcServer rpcServer3 = new RpcServer(server3); + + HugeConfig server4 = config("server4"); + RpcServer rpcServer4 = new RpcServer(server4); + + HugeConfig server5 = config("server5"); + RpcServer rpcServer5 = new RpcServer(server5); + + GraphHelloServiceImpl s3g1 = new GraphHelloServiceImpl("g1"); + GraphHelloServiceImpl s4g1 = new GraphHelloServiceImpl("g1"); + GraphHelloServiceImpl s5g1 = new GraphHelloServiceImpl("g1"); + + rpcServer3.config().addService(s3g1.graph(), HelloService.class, s3g1); + rpcServer4.config().addService(s4g1.graph(), HelloService.class, s4g1); + rpcServer5.config().addService(s5g1.graph(), HelloService.class, s5g1); + + startServer(rpcServer3); + startServer(rpcServer4); + startServer(rpcServer5); + + // Init client with one server unavailable + HugeConfig client346 = config("client346"); + RpcClientProvider rpcClient346 = new RpcClientProvider(client346); + + HelloService g1 = rpcClient346.config() + .serviceProxy("g1", HelloService.class); + + // Test fanout with one failed + Assert.assertEquals("g1: fanout", g1.echo("fanout")); + Assert.assertEquals(16.8, g1.sum(10, 6.8), 0.00000001d); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + g1.hello(""); + }, e -> { + Assert.assertContains("empty hello parameter", e.getMessage()); + }); + + Assert.assertEquals(16.8, s3g1.result(), 0.00000001d); + Assert.assertEquals(16.8, s4g1.result(), 0.00000001d); + Assert.assertEquals(0.0, s5g1.result(), 0.00000001d); + + s3g1.resetResult(); + s4g1.resetResult(); + s5g1.resetResult(); + + // Init client with all servers unavailable + HugeConfig client67 = config("client67"); + RpcClientProvider rpcClient67 = new RpcClientProvider(client67); + + HelloService g67 = rpcClient67.config() + .serviceProxy("g1", HelloService.class); + + // Test fanout with all failed + Assert.assertThrows(SofaRpcException.class, () -> { + g67.echo("fanout"); + }, e -> { + Assert.assertContains("Failed to call", e.getMessage()); + Assert.assertContains("echo() on remote server", e.getMessage()); + }); + + Assert.assertEquals(0.0, s3g1.result(), 0.00000001d); + Assert.assertEquals(0.0, s4g1.result(), 0.00000001d); + Assert.assertEquals(0.0, s5g1.result(), 0.00000001d); + + // Init client with none service provider + RpcClientProvider rpcClient0 = new RpcClientProvider(client67); + Whitebox.setInternalState(rpcClient0, "consumerConfig.remoteUrls", + ""); + HelloService g0 = rpcClient0.config() + .serviceProxy("g1", HelloService.class); + + Assert.assertThrows(SofaRpcException.class, () -> { + g0.echo("fanout"); + }, e -> { + Assert.assertContains("No service provider for", e.getMessage()); + }); + + // Destroy all + rpcClient346.destroy(); + rpcClient67.destroy(); + + stopServer(rpcServer3); + stopServer(rpcServer4); + stopServer(rpcServer5); + } + + @Test + public void testLoadBalancer() { + // Init 3 servers + HugeConfig server3 = config("server3"); + RpcServer rpcServer3 = new RpcServer(server3); + + HugeConfig server4 = config("server4"); + RpcServer rpcServer4 = new RpcServer(server4); + + HugeConfig server5 = config("server5"); + RpcServer rpcServer5 = new RpcServer(server5); + + GraphHelloServiceImpl s3g1 = new GraphHelloServiceImpl("g1"); + GraphHelloServiceImpl s4g1 = new GraphHelloServiceImpl("g1"); + GraphHelloServiceImpl s5g1 = new GraphHelloServiceImpl("g1"); + + rpcServer3.config().addService(HelloService.class, s3g1); + rpcServer4.config().addService(HelloService.class, s4g1); + rpcServer5.config().addService(HelloService.class, s5g1); + + startServer(rpcServer3); + startServer(rpcServer4); + startServer(rpcServer5); + + // Test LB "consistentHash" + HugeConfig clientLB = config("client-lb"); + RpcClientProvider rpcClientCHash = new RpcClientProvider(clientLB); + HelloService cHash = rpcClientCHash.config() + .serviceProxy(HelloService.class); + + Assert.assertEquals("g1: load", cHash.echo("load")); + Assert.assertEquals(16.8, cHash.sum(10, 6.8), 0.00000001d); + Assert.assertEquals(16.8, s3g1.result() + s4g1.result() + s5g1.result(), + 0.00000001d); + + Assert.assertEquals("g1: load", cHash.echo("load")); + Assert.assertEquals(16.8, cHash.sum(10, 6.8), 0.00000001d); + Assert.assertEquals(16.8, s3g1.result() + s4g1.result() + s5g1.result(), + 0.00000001d); + + Assert.assertEquals("g1: load", cHash.echo("load")); + Assert.assertEquals(16.8, cHash.sum(10, 6.8), 0.00000001d); + Assert.assertEquals(16.8, s3g1.result() + s4g1.result() + s5g1.result(), + 0.00000001d); + + s3g1.resetResult(); + s4g1.resetResult(); + s5g1.resetResult(); + + // Test LB "roundRobin" + String lbKey = com.baidu.hugegraph.config + .RpcOptions.RPC_CLIENT_LOAD_BALANCER.name(); + clientLB.setProperty(lbKey, "roundRobin"); + RpcClientProvider rpcClientRound = new RpcClientProvider(clientLB); + HelloService round = rpcClientRound.config() + .serviceProxy(HelloService.class); + + Assert.assertEquals("g1: load", round.echo("load")); + Assert.assertEquals(1.1, round.sum(1, 0.1), 0.00000001d); + Assert.assertEquals(1.1, s3g1.result() + s4g1.result() + s5g1.result(), + 0.00000001d); + + Assert.assertEquals("g1: load", round.echo("load")); + Assert.assertEquals(1.1, round.sum(1, 0.1), 0.00000001d); + Assert.assertEquals(2.2, s3g1.result() + s4g1.result() + s5g1.result(), + 0.00000001d); + + Assert.assertEquals("g1: load", round.echo("load")); + Assert.assertEquals(1.1, round.sum(1, 0.1), 0.00000001d); + Assert.assertEquals(3.3, s3g1.result() + s4g1.result() + s5g1.result(), + 0.00000001d); + + s3g1.resetResult(); + s4g1.resetResult(); + s5g1.resetResult(); + + // Test LB "random" + clientLB.setProperty(lbKey, "random"); + RpcClientProvider rpcClientRandom = new RpcClientProvider(clientLB); + HelloService random = rpcClientRandom.config() + .serviceProxy(HelloService.class); + + Assert.assertEquals("g1: load", random.echo("load")); + Assert.assertEquals(1.1, random.sum(1, 0.1), 0.00000001d); + Assert.assertEquals(1.1, s3g1.result() + s4g1.result() + s5g1.result(), + 0.00000001d); + + Assert.assertEquals("g1: load", random.echo("load")); + Assert.assertEquals(1.1, random.sum(1, 0.1), 0.00000001d); + double sum = s3g1.result() + s4g1.result() + s5g1.result(); + Assert.assertTrue(2.2 == sum || 1.1 == sum); + + Assert.assertEquals("g1: load", random.echo("load")); + Assert.assertEquals(1.1, random.sum(1, 0.1), 0.00000001d); + double sum2 = s3g1.result() + s4g1.result() + s5g1.result(); + Assert.assertTrue(sum == sum2 || sum + 1.1 == sum2); + + for (int i = 0; i < 9; i++) { + Assert.assertEquals(1.1, random.sum(1, 0.1), 0.00000001d); + } + Assert.assertEquals(3.3, s3g1.result() + s4g1.result() + s5g1.result(), + 0.00000001d); + + s3g1.resetResult(); + s4g1.resetResult(); + s5g1.resetResult(); + + // Destroy all + rpcClientCHash.destroy(); + rpcClientRound.destroy(); + rpcClientRandom.destroy(); + + stopServer(rpcServer3); + stopServer(rpcServer4); + stopServer(rpcServer5); + } + + @Test + public void testServiceProxy() { + // Init server + RpcProviderConfig serverConfig = rpcServer.config(); + serverConfig.addService(HelloService.class, new HelloServiceImpl()); + serverConfig.addService("graph", HelloService.class, + new GraphHelloServiceImpl("graph")); + startServer(rpcServer); + + // Init client + RpcConsumerConfig clientConfig = rpcClient.config(); + HelloService client = clientConfig.serviceProxy(HelloService.class); + HelloService client2 = clientConfig.serviceProxy(HelloService.class); + HelloService clientG = clientConfig.serviceProxy("graph", + HelloService.class); + + // Test call + Assert.assertNotEquals(client, client2); + Assert.assertEquals("hello tom!", client.hello("tom")); + Assert.assertEquals("hello tom!", client2.hello("tom")); + Assert.assertEquals("graph: hello tom!", clientG.hello("tom")); + + // Test call after unrefer + rpcClient.unreferAll(); + + Assert.assertThrows(SofaRpcRuntimeException.class, () -> { + client.hello("tom"); + }); + Assert.assertThrows(SofaRpcRuntimeException.class, () -> { + client2.hello("tom"); + }); + Assert.assertThrows(SofaRpcRuntimeException.class, () -> { + clientG.hello("tom"); + }); + } + + @Test + public void testAddServiceMultiTimesOfSameService() { + RpcServer rpcServerExport = new RpcServer(config(true)); + + rpcServerExport.config().addService(HelloService.class, + new HelloServiceImpl()); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + rpcServerExport.config().addService(HelloService.class, + new HelloServiceImpl()); + }, e -> { + Assert.assertContains("Not allowed to add service already exist", + e.getMessage()); + }); + + rpcServerExport.exportAll(); + + stopServer(rpcServerExport); + } + + @Test + public void testExportMultiTimesOfSameServer() { + RpcServer rpcServerExport = new RpcServer(config(true)); + rpcServerExport.config().addService(HelloService.class, + new HelloServiceImpl()); + rpcServerExport.exportAll(); + rpcServerExport.exportAll(); + + stopServer(rpcServerExport); + } + + @Test + public void testExportMultiTimesOfSameService() { + RpcServer rpcServerExport = new RpcServer(config(true)); + rpcServerExport.config().addService(HelloService.class, + new HelloServiceImpl()); + rpcServerExport.exportAll(); + + rpcServerExport.config().addService("graph", HelloService.class, + new HelloServiceImpl()); + rpcServerExport.exportAll(); + + stopServer(rpcServerExport); + } + + @Test + public void testExportNoneService() { + RpcServer rpcServerNoneService = new RpcServer(config(true)); + + // Will be ignored if none service added + rpcServerNoneService.exportAll(); + + stopServer(rpcServerNoneService); + } + + @Test + public void testUnexportService() { + RpcServer rpcServerUnexport = new RpcServer(config(true)); + + RpcProviderConfig serverConfig = rpcServerUnexport.config(); + String service = serverConfig.addService(HelloService.class, + new HelloServiceImpl()); + rpcServerUnexport.exportAll(); + + RpcConsumerConfig clientConfig = rpcClient.config(); + HelloService client = clientConfig.serviceProxy(HelloService.class); + + Assert.assertEquals("hello tom!", client.hello("tom")); + + rpcServerUnexport.unexport(service); + + Assert.assertThrows(SofaRpcException.class, () -> { + client.hello("tom"); + }); + + stopServer(rpcServerUnexport); + } + + @Test + public void testUnexportAllService() { + RpcServer rpcServerUnexport = new RpcServer(config(true)); + + RpcProviderConfig serverConfig = rpcServerUnexport.config(); + serverConfig.addService(HelloService.class, new HelloServiceImpl()); + serverConfig.addService("graph", HelloService.class, + new GraphHelloServiceImpl("graph")); + rpcServerUnexport.exportAll(); + + RpcConsumerConfig clientConfig = rpcClient.config(); + HelloService client = clientConfig.serviceProxy(HelloService.class); + HelloService clientG = clientConfig.serviceProxy("graph", + HelloService.class); + + Assert.assertEquals("hello tom!", client.hello("tom")); + Assert.assertEquals("graph: hello tom!", clientG.hello("tom")); + + rpcServerUnexport.unexportAll(); + + Assert.assertThrows(SofaRpcException.class, () -> { + client.hello("tom"); + }); + Assert.assertThrows(SofaRpcException.class, () -> { + clientG.hello("tom"); + }); + + stopServer(rpcServerUnexport); + } + + @Test + public void testUnexportNotExistService() { + Assert.assertThrows(IllegalArgumentException.class, () -> { + rpcServer.unexport("fake"); + }, e -> { + Assert.assertContains("The service 'fake' doesn't exist", + e.getMessage()); + }); + } + + @Test + public void testServerDisabled() { + HugeConfig clientConf = config(false); + RpcServer rpcServerDisabled = new RpcServer(clientConf); + + Assert.assertFalse(rpcServerDisabled.enabled()); + Assert.assertThrows(IllegalArgumentException.class, () -> { + rpcServerDisabled.config(); + }, e -> { + Assert.assertContains("RpcServer is not enabled", e.getMessage()); + }); + + stopServer(rpcServerDisabled); + } + + @Test + public void testClientDisabled() { + HugeConfig serverConf = config(true); + RpcClientProvider rpcClientDisabled = new RpcClientProvider(serverConf); + + Assert.assertFalse(rpcClientDisabled.enabled()); + Assert.assertThrows(IllegalArgumentException.class, () -> { + rpcClientDisabled.config(); + }, e -> { + Assert.assertContains("RpcClient is not enabled", e.getMessage()); + }); + + rpcClientDisabled.destroy(); + } + + @Test + public void testInitRpcConfigs() { + ImmutableMap fixedOptions = ImmutableMap.of( + RpcOptions.PROVIDER_REPEATED_EXPORT_LIMIT, 1); + RpcCommonConfig.initRpcConfigs(fixedOptions); + + RpcCommonConfig.initRpcConfigs(RpcOptions.CONSUMER_RETRIES, 2); + } + + public static interface HelloService { + + public String hello(String string); + + public String echo(String string); + + public double sum(long a, double b); + } + + public static class HelloServiceImpl implements HelloService { + + @Override + public String hello(String string) { + E.checkArgument(!string.isEmpty(), "empty hello parameter"); + return "hello " + string + "!"; + } + + @Override + public String echo(String string) { + return string; + } + + @Override + public double sum(long a, double b) { + return a + b; + } + } + + public static class GraphHelloServiceImpl implements HelloService { + + private final String graph; + private double result; + + public GraphHelloServiceImpl(String graph) { + this.graph = graph; + } + + public String graph() { + return this.graph; + } + + public void resetResult() { + this.result = 0.0; + } + + public double result() { + return this.result; + } + + @Override + public String hello(String string) { + E.checkArgument(!string.isEmpty(), "empty hello parameter"); + return this.graph + ": hello " + string + "!"; + } + + @Override + public String echo(String string) { + return this.graph + ": " + string; + } + + @Override + public double sum(long a, double b) { + this.result = a + b; + return this.result; + } + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java new file mode 100644 index 0000000000..79446602a9 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -0,0 +1,32 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses({ + VersionTest.class, + ExceptionTest.class, + ServerClientTest.class +}) +public class UnitTestSuite { +} diff --git a/src/test/java/com/baidu/hugegraph/unit/VersionTest.java b/src/test/java/com/baidu/hugegraph/unit/VersionTest.java new file mode 100644 index 0000000000..e603f22ba4 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/VersionTest.java @@ -0,0 +1,38 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit; + +import org.junit.Test; + +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.util.VersionUtil; +import com.baidu.hugegraph.version.RpcVersion; + +public class VersionTest { + + @Test + public void testGetCommonVersion() { + String pomVersion = VersionUtil.getPomVersion(); + Assert.assertNotNull(pomVersion); + String version = RpcVersion.VERSION.get(); + Assert.assertNotNull(version); + Assert.assertEquals(pomVersion, version); + } +} diff --git a/src/test/resources/log4j2.xml b/src/test/resources/log4j2.xml new file mode 100644 index 0000000000..f69acfd1b7 --- /dev/null +++ b/src/test/resources/log4j2.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/rpc-client-lb.properties b/src/test/resources/rpc-client-lb.properties new file mode 100644 index 0000000000..fb8cad866d --- /dev/null +++ b/src/test/resources/rpc-client-lb.properties @@ -0,0 +1,9 @@ +#rpc.server_host=127.0.0.1 +#rpc.server_port=8090 +#rpc.server_timeout=30 +rpc.remote_url=127.0.0.1:8093,127.0.0.1:8094,127.0.0.1:8095 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +rpc.client_load_balancer=consistentHash diff --git a/src/test/resources/rpc-client.properties b/src/test/resources/rpc-client.properties new file mode 100644 index 0000000000..16b23f333f --- /dev/null +++ b/src/test/resources/rpc-client.properties @@ -0,0 +1,9 @@ +#rpc.server_host=127.0.0.1 +#rpc.server_port=8090 +#rpc.server_timeout=30 +rpc.remote_url=127.0.0.1:8090 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash diff --git a/src/test/resources/rpc-client345.properties b/src/test/resources/rpc-client345.properties new file mode 100644 index 0000000000..1a4fa00271 --- /dev/null +++ b/src/test/resources/rpc-client345.properties @@ -0,0 +1,9 @@ +#rpc.server_host=127.0.0.1 +#rpc.server_port=8090 +#rpc.server_timeout=30 +rpc.remote_url=127.0.0.1:8093,127.0.0.1:8094,127.0.0.1:8095 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash diff --git a/src/test/resources/rpc-client346.properties b/src/test/resources/rpc-client346.properties new file mode 100644 index 0000000000..dbcede57a4 --- /dev/null +++ b/src/test/resources/rpc-client346.properties @@ -0,0 +1,9 @@ +#rpc.server_host=127.0.0.1 +#rpc.server_port=8090 +#rpc.server_timeout=30 +rpc.remote_url=127.0.0.1:8093,127.0.0.1:8094,127.0.0.1:8096 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash diff --git a/src/test/resources/rpc-client67.properties b/src/test/resources/rpc-client67.properties new file mode 100644 index 0000000000..692d7cefc9 --- /dev/null +++ b/src/test/resources/rpc-client67.properties @@ -0,0 +1,9 @@ +#rpc.server_host=127.0.0.1 +#rpc.server_port=8090 +#rpc.server_timeout=30 +rpc.remote_url=127.0.0.1:8096,127.0.0.1:8097 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash diff --git a/src/test/resources/rpc-server.properties b/src/test/resources/rpc-server.properties new file mode 100644 index 0000000000..a22bf7ee1d --- /dev/null +++ b/src/test/resources/rpc-server.properties @@ -0,0 +1,9 @@ +rpc.server_host=127.0.0.1 +rpc.server_port=8090 +#rpc.server_timeout=30 +#rpc.remote_url=127.0.0.1:8090 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash diff --git a/src/test/resources/rpc-server1-client.properties b/src/test/resources/rpc-server1-client.properties new file mode 100644 index 0000000000..a3907584d9 --- /dev/null +++ b/src/test/resources/rpc-server1-client.properties @@ -0,0 +1,9 @@ +rpc.server_host=127.0.0.1 +rpc.server_port=8091 +#rpc.server_timeout=30 +rpc.remote_url=127.0.0.1:8092 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash diff --git a/src/test/resources/rpc-server2-client.properties b/src/test/resources/rpc-server2-client.properties new file mode 100644 index 0000000000..e0298ed76f --- /dev/null +++ b/src/test/resources/rpc-server2-client.properties @@ -0,0 +1,9 @@ +rpc.server_host=127.0.0.1 +rpc.server_port=8092 +#rpc.server_timeout=30 +rpc.remote_url=127.0.0.1:8091 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash diff --git a/src/test/resources/rpc-server3.properties b/src/test/resources/rpc-server3.properties new file mode 100644 index 0000000000..004757cb4b --- /dev/null +++ b/src/test/resources/rpc-server3.properties @@ -0,0 +1,9 @@ +rpc.server_host=127.0.0.1 +rpc.server_port=8093 +#rpc.server_timeout=30 +#rpc.remote_url=127.0.0.1:8090 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash diff --git a/src/test/resources/rpc-server4.properties b/src/test/resources/rpc-server4.properties new file mode 100644 index 0000000000..607b751b4d --- /dev/null +++ b/src/test/resources/rpc-server4.properties @@ -0,0 +1,9 @@ +rpc.server_host=127.0.0.1 +rpc.server_port=8094 +#rpc.server_timeout=30 +#rpc.remote_url=127.0.0.1:8090 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash diff --git a/src/test/resources/rpc-server5.properties b/src/test/resources/rpc-server5.properties new file mode 100644 index 0000000000..dbeb1e97a2 --- /dev/null +++ b/src/test/resources/rpc-server5.properties @@ -0,0 +1,9 @@ +rpc.server_host=127.0.0.1 +rpc.server_port=8095 +#rpc.server_timeout=30 +#rpc.remote_url=127.0.0.1:8090 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash From 6c800388a1f0f9b064b30ba3eca34a0153161f5d Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Thu, 25 Mar 2021 14:06:05 +0800 Subject: [PATCH 139/217] support random port to start rpc server (#2) * add rpc.server_adaptive_port option * use bolt v1.6.2 instead of v1.5.6 to get RemotingServer.port() --- pom.xml | 11 +++ .../baidu/hugegraph/config/RpcOptions.java | 13 +++- .../com/baidu/hugegraph/rpc/RpcServer.java | 21 +++++ .../hugegraph/unit/ServerClientTest.java | 77 +++++++++++++++++++ .../resources/rpc-server-adaptive.properties | 10 +++ .../resources/rpc-server-random.properties | 9 +++ 6 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 src/test/resources/rpc-server-adaptive.properties create mode 100644 src/test/resources/rpc-server-random.properties diff --git a/pom.xml b/pom.xml index c89a586cc7..23e13fb8b8 100644 --- a/pom.xml +++ b/pom.xml @@ -55,6 +55,17 @@ disruptor 3.3.7 + + com.alipay.sofa + bolt + 1.6.2 + + + org.slf4j + slf4j-api + + + com.alipay.sofa sofa-rpc-all diff --git a/src/main/java/com/baidu/hugegraph/config/RpcOptions.java b/src/main/java/com/baidu/hugegraph/config/RpcOptions.java index 482b570580..d58673cc90 100644 --- a/src/main/java/com/baidu/hugegraph/config/RpcOptions.java +++ b/src/main/java/com/baidu/hugegraph/config/RpcOptions.java @@ -52,10 +52,21 @@ public static synchronized RpcOptions instance() { new ConfigOption<>( "rpc.server_port", "The port bound by rpc server to provide services.", - rangeInt(1, Integer.MAX_VALUE), + rangeInt(0, Integer.MAX_VALUE), 8090 ); + public static final ConfigOption RPC_ADAPTIVE_PORT = + new ConfigOption<>( + "rpc.server_adaptive_port", + "Whether the bound port is adaptive, if it's enabled, " + + "when the port is in use, automatically +1 to detect " + + "the next available port. Note that this process is " + + "not atomic, so there may still be port conflicts.", + disallowEmpty(), + false + ); + public static final ConfigOption RPC_SERVER_TIMEOUT = new ConfigOption<>( "rpc.server_timeout", diff --git a/src/main/java/com/baidu/hugegraph/rpc/RpcServer.java b/src/main/java/com/baidu/hugegraph/rpc/RpcServer.java index d158aea08f..1118d37e02 100644 --- a/src/main/java/com/baidu/hugegraph/rpc/RpcServer.java +++ b/src/main/java/com/baidu/hugegraph/rpc/RpcServer.java @@ -24,11 +24,15 @@ import org.apache.commons.collections.MapUtils; import org.slf4j.Logger; +import com.alipay.remoting.RemotingServer; import com.alipay.sofa.rpc.common.utils.StringUtils; import com.alipay.sofa.rpc.config.ProviderConfig; import com.alipay.sofa.rpc.config.ServerConfig; +import com.alipay.sofa.rpc.server.Server; +import com.alipay.sofa.rpc.server.bolt.BoltServer; import com.baidu.hugegraph.config.HugeConfig; import com.baidu.hugegraph.config.RpcOptions; +import com.baidu.hugegraph.testutil.Whitebox; import com.baidu.hugegraph.util.E; import com.baidu.hugegraph.util.Log; @@ -48,9 +52,11 @@ public RpcServer(HugeConfig config) { String host = config.get(RpcOptions.RPC_SERVER_HOST); if (StringUtils.isNotBlank(host)) { int port = config.get(RpcOptions.RPC_SERVER_PORT); + boolean adaptivePort = config.get(RpcOptions.RPC_ADAPTIVE_PORT); this.serverConfig = new ServerConfig(); this.serverConfig.setProtocol(config.get(RpcOptions.RPC_PROTOCOL)) .setHost(host).setPort(port) + .setAdaptivePort(adaptivePort) .setDaemon(false); } else { this.serverConfig = null; @@ -73,6 +79,21 @@ public String host() { public int port() { this.checkEnabled(); + Server server = this.serverConfig.getServer(); + if (server instanceof BoltServer && server.isStarted()) { + /* + * When using random port 0, try to fetch the actual port + * NOTE: RemotingServer.port() would return the actual port only + * if sofa-bolt version >= 1.6.1, please see: + * https://github.com/sofastack/sofa-bolt/issues/196 + * TODO: remove this code after adding Server.port() interface: + * https://github.com/sofastack/sofa-rpc/issues/1022 + */ + RemotingServer rs = Whitebox.getInternalState(server, + "remotingServer"); + return rs.port(); + } + // When using random port 0, the returned port is not the actual port return this.serverConfig.getPort(); } diff --git a/src/test/java/com/baidu/hugegraph/unit/ServerClientTest.java b/src/test/java/com/baidu/hugegraph/unit/ServerClientTest.java index 65b24c86ef..28fe564d8b 100644 --- a/src/test/java/com/baidu/hugegraph/unit/ServerClientTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/ServerClientTest.java @@ -19,6 +19,10 @@ package com.baidu.hugegraph.unit; +import java.io.IOException; +import java.net.InetAddress; +import java.net.ServerSocket; + import org.junit.After; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -129,6 +133,79 @@ public void testMultiService() { Assert.assertEquals(103.14, g3.result(), 0.00000001d); } + @Test + public void testStartServerWithRandomPort() { + // Init server + RpcServer rpcServerRandom = new RpcServer(config("server-random")); + RpcProviderConfig serverConfig = rpcServerRandom.config(); + serverConfig.addService(HelloService.class, new HelloServiceImpl()); + startServer(rpcServerRandom); + + Assert.assertNotEquals(0, rpcServerRandom.port()); + Assert.assertNotEquals(8090, rpcServerRandom.port()); + + // Init client + HugeConfig config = config(false); + String url = rpcServerRandom.host() + ":" + rpcServerRandom.port(); + String remoteUrlKey = com.baidu.hugegraph.config + .RpcOptions.RPC_REMOTE_URL.name(); + config.setProperty(remoteUrlKey, url); + RpcClientProvider rpcClientRandom = new RpcClientProvider(config); + + RpcConsumerConfig clientConfig = rpcClientRandom.config(); + HelloService client = clientConfig.serviceProxy(HelloService.class); + + // Test call + Assert.assertEquals("hello tom!", client.hello("tom")); + Assert.assertEquals("tom", client.echo("tom")); + Assert.assertEquals(5.14, client.sum(2, 3.14), 0.00000001d); + + // Destroy all + rpcClientRandom.destroy(); + stopServer(rpcServerRandom); + } + + @Test + public void testStartServerWithAdaptivePort() throws IOException { + // Init server + RpcServer rpcServerAdaptive = new RpcServer(config("server-adaptive")); + RpcProviderConfig serverConfig = rpcServerAdaptive.config(); + serverConfig.addService(HelloService.class, new HelloServiceImpl()); + + // Start other server bound the port + int usedPort = rpcServerAdaptive.port(); + InetAddress ip = InetAddress.getByName(rpcServerAdaptive.host()); + ServerSocket inUse = new ServerSocket(usedPort,50, ip); + + // Start server after the port in use + startServer(rpcServerAdaptive); + + Assert.assertNotEquals(0, rpcServerAdaptive.port()); + Assert.assertNotEquals(usedPort, rpcServerAdaptive.port()); + + // Init client + HugeConfig config = config(false); + String url = rpcServerAdaptive.host() + ":" + rpcServerAdaptive.port(); + String remoteUrlKey = com.baidu.hugegraph.config + .RpcOptions.RPC_REMOTE_URL.name(); + config.setProperty(remoteUrlKey, url); + RpcClientProvider rpcClientAdaptive = new RpcClientProvider(config); + + RpcConsumerConfig clientConfig = rpcClientAdaptive.config(); + HelloService client = clientConfig.serviceProxy(HelloService.class); + + // Test call + Assert.assertEquals("hello tom!", client.hello("tom")); + Assert.assertEquals("tom", client.echo("tom")); + Assert.assertEquals(5.14, client.sum(2, 3.14), 0.00000001d); + + // Destroy all + rpcClientAdaptive.destroy(); + stopServer(rpcServerAdaptive); + + inUse.close(); + } + @Test public void testStartBothServerAndClientThroughSameConfig() { // Init server1 diff --git a/src/test/resources/rpc-server-adaptive.properties b/src/test/resources/rpc-server-adaptive.properties new file mode 100644 index 0000000000..ae92732d31 --- /dev/null +++ b/src/test/resources/rpc-server-adaptive.properties @@ -0,0 +1,10 @@ +rpc.server_host=127.0.0.1 +rpc.server_port=8098 +rpc.server_adaptive_port=true +#rpc.server_timeout=30 +#rpc.remote_url=127.0.0.1:8090 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash diff --git a/src/test/resources/rpc-server-random.properties b/src/test/resources/rpc-server-random.properties new file mode 100644 index 0000000000..5be8331dc7 --- /dev/null +++ b/src/test/resources/rpc-server-random.properties @@ -0,0 +1,9 @@ +rpc.server_host=127.0.0.1 +rpc.server_port=0 +#rpc.server_timeout=30 +#rpc.remote_url=127.0.0.1:8090 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash From d51efb612092bc6e5871998221008d7b9527577a Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Mon, 12 Apr 2021 16:28:18 +0800 Subject: [PATCH 140/217] add some test cases for util package (#70) * add check for CollectionUtil.subSet from > to Change-Id: I32d83f5738250eca23ae16c2ccbf52059a874bf6 --- .../baidu/hugegraph/util/CollectionUtil.java | 17 +- .../com/baidu/hugegraph/util/DateUtil.java | 11 +- .../com/baidu/hugegraph/util/NumericUtil.java | 24 ++- .../com/baidu/hugegraph/util/VersionUtil.java | 45 ++++-- .../baidu/hugegraph/unit/UnitTestSuite.java | 4 + .../unit/util/CollectionUtilTest.java | 74 ++++++++- .../hugegraph/unit/util/DateUtilTest.java | 24 ++- .../baidu/hugegraph/unit/util/EcheckTest.java | 152 ++++++++++++++++++ .../hugegraph/unit/util/HashUtilTest.java | 51 ++++++ .../baidu/hugegraph/unit/util/LogTest.java | 44 +++++ .../hugegraph/unit/util/NumericUtilTest.java | 85 +++++++++- .../hugegraph/unit/util/StringUtilTest.java | 66 ++++++++ .../hugegraph/unit/util/VersionUtilTest.java | 51 ++++++ src/test/resources/META-INF/MANIFEST.MF | 9 ++ 14 files changed, 622 insertions(+), 35 deletions(-) create mode 100644 src/test/java/com/baidu/hugegraph/unit/util/EcheckTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/util/LogTest.java create mode 100644 src/test/resources/META-INF/MANIFEST.MF diff --git a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java index 5a1c6a69df..85ab87ca37 100644 --- a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java @@ -96,7 +96,13 @@ public static Set randomSet(int min, int max, int count) { } public static boolean allUnique(Collection collection) { - return collection.stream().allMatch(new HashSet<>()::add); + HashSet set = new HashSet<>(collection.size()); + for (Object elem : collection) { + if (!set.add(elem)) { + return false; + } + } + return true; } /** @@ -108,10 +114,15 @@ public static boolean allUnique(Collection collection) { * @return sub-set of original set [from, to) */ public static Set subSet(Set original, int from, int to) { - List list = new ArrayList<>(original); - if (to == -1) { + E.checkArgument(from >= 0, + "Invalid from parameter of subSet(): %s", from); + if (to < 0) { to = original.size(); + } else { + E.checkArgument(to >= from, + "Invalid to parameter of subSet(): %s", to); } + List list = new ArrayList<>(original); return new LinkedHashSet<>(list.subList(from, to)); } diff --git a/src/main/java/com/baidu/hugegraph/util/DateUtil.java b/src/main/java/com/baidu/hugegraph/util/DateUtil.java index 2295101405..a3f117aaf0 100644 --- a/src/main/java/com/baidu/hugegraph/util/DateUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/DateUtil.java @@ -19,7 +19,6 @@ package com.baidu.hugegraph.util; -import java.text.ParseException; import java.util.Date; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -46,13 +45,7 @@ public final class DateUtil { public static Date parse(String value) { for (Map.Entry entry : VALID_DFS.entrySet()) { if (value.matches(entry.getKey())) { - try { - return parse(value, entry.getValue()); - } catch (ParseException e) { - throw new IllegalArgumentException(String.format( - "%s, expect format: %s", - e.getMessage(), entry.getValue())); - } + return parse(value, entry.getValue()); } } throw new IllegalArgumentException(String.format( @@ -60,7 +53,7 @@ public static Date parse(String value) { VALID_DFS.values(), value)); } - public static Date parse(String value, String df) throws ParseException { + public static Date parse(String value, String df) { SafeDateFormat dateFormat = getDateFormat(df); return dateFormat.parse(value); } diff --git a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java index f1b4f88ba0..b07138acba 100644 --- a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java @@ -290,6 +290,14 @@ public static boolean isNumber(Object value) { } public static boolean isNumber(Class clazz) { + if (clazz.isPrimitive()) { + if (clazz == int.class || clazz == long.class || + clazz == float.class || clazz == double.class || + clazz == short.class || clazz == byte.class) { + return true; + } + return false; + } return Number.class.isAssignableFrom(clazz); } @@ -321,11 +329,21 @@ public static Number convertToNumber(Object value) { * a negative int if first is numerically less than second; * a positive int if first is numerically greater than second. */ - @SuppressWarnings("unchecked") public static int compareNumber(Object first, Number second) { + if (first == null) { + E.checkArgument(first != null, + "The first parameter can't be null"); + } + if (second == null) { + E.checkArgument(second != null, + "The second parameter can't be null"); + } + if (first instanceof Number && first instanceof Comparable && first.getClass().equals(second.getClass())) { - return ((Comparable) first).compareTo(second); + @SuppressWarnings("unchecked") + Comparable cmpFirst = (Comparable) first; + return cmpFirst.compareTo(second); } Function toBig = (number) -> { @@ -333,7 +351,7 @@ public static int compareNumber(Object first, Number second) { return new BigDecimal(number.toString()); } catch (NumberFormatException e) { throw new IllegalArgumentException(String.format( - "Can't compare between %s and %s, " + + "Can't compare between '%s' and '%s', " + "they must be numbers", first, second)); } }; diff --git a/src/main/java/com/baidu/hugegraph/util/VersionUtil.java b/src/main/java/com/baidu/hugegraph/util/VersionUtil.java index 891cab04c6..94e4d3ade9 100644 --- a/src/main/java/com/baidu/hugegraph/util/VersionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/VersionUtil.java @@ -23,7 +23,6 @@ import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; -import java.util.Objects; import java.util.jar.Attributes; import java.util.jar.Manifest; @@ -85,11 +84,16 @@ public static String getImplementationVersion(Class clazz) { // Class not from JAR return null; } - // Get manifest int offset = classPath.lastIndexOf("!"); assert offset > 0; - String manifestPath = classPath.substring(0, offset + 1) + - "/META-INF/MANIFEST.MF"; + // Get manifest file path + String manifestPath = classPath.substring(0, offset + 1); + return getImplementationVersion(manifestPath); + } + + public static String getImplementationVersion(String manifestPath) { + manifestPath += "/META-INF/MANIFEST.MF"; + Manifest manifest = null; try { manifest = new Manifest(new URL(manifestPath).openStream()); @@ -158,13 +162,24 @@ public static Version of(String version) { /************************** Version define **************************/ - private String version; + private final String version; + private final int[] parts; public Version(String version) { E.checkArgumentNotNull(version, "The version is null"); E.checkArgument(version.matches("[0-9]+(\\.[0-9]+)*"), "Invalid version format: %s", version); this.version = version; + this.parts = parseVersion(version); + } + + private static int[] parseVersion(String version) { + String[] parts = version.split("\\."); + int[] partsNumber = new int[parts.length]; + for (int i = 0; i < parts.length; i++) { + partsNumber[i] = Integer.parseInt(parts[i]); + } + return partsNumber; } public final String get() { @@ -176,14 +191,12 @@ public int compareTo(Version that) { if (that == null) { return 1; } - String[] thisParts = this.get().split("\\."); - String[] thatParts = that.get().split("\\."); + int[] thisParts = this.parts; + int[] thatParts = that.parts; int length = Math.max(thisParts.length, thatParts.length); for (int i = 0; i < length; i++) { - int thisPart = i < thisParts.length ? - Integer.parseInt(thisParts[i]) : 0; - int thatPart = i < thatParts.length ? - Integer.parseInt(thatParts[i]) : 0; + int thisPart = i < thisParts.length ? thisParts[i] : 0; + int thatPart = i < thatParts.length ? thatParts[i] : 0; if (thisPart < thatPart) { return -1; } @@ -210,7 +223,15 @@ public boolean equals(Object that) { @Override public int hashCode() { - return Objects.hash(this.version); + int hash = 0; + for (int i = this.parts.length - 1; i >= 0; i--) { + int part = this.parts[i]; + if (part == 0 && hash == 0) { + continue; + } + hash = 31 * hash + Integer.hashCode(part); + } + return hash; } @Override diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java index f6855ec598..19b12b7938 100644 --- a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java +++ b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -54,8 +54,10 @@ import com.baidu.hugegraph.unit.util.BytesTest; import com.baidu.hugegraph.unit.util.CollectionUtilTest; import com.baidu.hugegraph.unit.util.DateUtilTest; +import com.baidu.hugegraph.unit.util.EcheckTest; import com.baidu.hugegraph.unit.util.HashUtilTest; import com.baidu.hugegraph.unit.util.InsertionOrderUtilTest; +import com.baidu.hugegraph.unit.util.LogTest; import com.baidu.hugegraph.unit.util.LongEncodingTest; import com.baidu.hugegraph.unit.util.NumericUtilTest; import com.baidu.hugegraph.unit.util.OrderLimitMapTest; @@ -96,8 +98,10 @@ BytesTest.class, CollectionUtilTest.class, + EcheckTest.class, HashUtilTest.class, InsertionOrderUtilTest.class, + LogTest.class, NumericUtilTest.class, ReflectionUtilTest.class, StringUtilTest.class, diff --git a/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java index e7e9e95ed3..a1e47501c4 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java @@ -20,9 +20,11 @@ package com.baidu.hugegraph.unit.util; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -103,6 +105,12 @@ public void testPrefixOf() { List list4 = ImmutableList.of(1, 2, 3, 4); Assert.assertFalse(CollectionUtil.prefixOf(list4, list)); + + List list5 = ImmutableList.of(1, 2, 4); + Assert.assertFalse(CollectionUtil.prefixOf(list5, list)); + + List list6 = Arrays.asList(1, 2, null); + Assert.assertFalse(CollectionUtil.prefixOf(list6, list)); } @Test @@ -158,6 +166,30 @@ public void testSubSet() { subSet = CollectionUtil.subSet(originSet, 0, 5); Assert.assertEquals(ImmutableSet.of(1, 2, 3, 4, 5), subSet); + + subSet = CollectionUtil.subSet(originSet, 2, -1); + Assert.assertEquals(ImmutableSet.of(3, 4, 5), subSet); + + subSet = CollectionUtil.subSet(originSet, 2, -100); + Assert.assertEquals(ImmutableSet.of(3, 4, 5), subSet); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + CollectionUtil.subSet(originSet, 2, 1); + }, e -> { + Assert.assertContains("Invalid to parameter ", e.getMessage()); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + CollectionUtil.subSet(originSet, -1, 2); + }, e -> { + Assert.assertContains("Invalid from parameter ", e.getMessage()); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + CollectionUtil.subSet(originSet, -10, 2); + }, e -> { + Assert.assertContains("Invalid from parameter ", e.getMessage()); + }); } @Test @@ -182,9 +214,9 @@ public void testIntersectWithoutModifying() { first.add(3); List second = new ArrayList<>(); - second.add(4); second.add(5); + Collection results = CollectionUtil.intersect(first, second); Assert.assertEquals(0, results.size()); Assert.assertEquals(3, first.size()); @@ -199,6 +231,26 @@ public void testIntersectWithoutModifying() { results = CollectionUtil.intersect(first, second); Assert.assertEquals(3, results.size()); Assert.assertEquals(3, first.size()); + + Set set = new HashSet<>(); + set.add(1); + set.add(3); + set.add(6); + + results = CollectionUtil.intersect(set, second); + Assert.assertInstanceOf(HashSet.class, results); + Assert.assertEquals(2, results.size()); + Assert.assertEquals(3, set.size()); + + set = new LinkedHashSet<>(); + set.add(1); + set.add(2); + set.add(6); + + results = CollectionUtil.intersect(set, second); + Assert.assertInstanceOf(LinkedHashSet.class, results); + Assert.assertEquals(2, results.size()); + Assert.assertEquals(3, set.size()); } @Test @@ -247,6 +299,16 @@ public void testHasIntersectionBetweenListAndSet() { second.add(1); Assert.assertTrue(CollectionUtil.hasIntersection(first, second)); + + second = new HashSet<>(); + second.add(4); + second.add(5); + second.add(6); + second.add(7); + Assert.assertFalse(CollectionUtil.hasIntersection(first, second)); + + second.add(3); + Assert.assertTrue(CollectionUtil.hasIntersection(first, second)); } @Test @@ -264,6 +326,16 @@ public void testHasIntersectionBetweenSetAndSet() { second.add(1); Assert.assertTrue(CollectionUtil.hasIntersection(first, second)); + + second = new HashSet<>(); + second.add(4); + second.add(5); + second.add(6); + second.add(7); + Assert.assertFalse(CollectionUtil.hasIntersection(first, second)); + + second.add(3); + Assert.assertTrue(CollectionUtil.hasIntersection(first, second)); } @Test diff --git a/src/test/java/com/baidu/hugegraph/unit/util/DateUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/DateUtilTest.java index 9ac0956960..5a6e54c79e 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/DateUtilTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/DateUtilTest.java @@ -19,7 +19,6 @@ package com.baidu.hugegraph.unit.util; -import java.text.ParseException; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -38,13 +37,27 @@ public class DateUtilTest extends BaseUnitTest { public void testParse() { Date date1 = DateUtil.parse("2020-06-12 12:00:00"); Date date2 = DateUtil.parse("2020-06-13"); + Assert.assertNotEquals(date1, date2); Assert.assertTrue(date1.before(date2)); + Date date3 = DateUtil.parse("2020-06-12"); + Date date4 = DateUtil.parse("2020-06-12 00:00:00.00"); + Assert.assertEquals(date3, date4); + + Date date5 = DateUtil.parse("2020-06-12 00:00:00.001"); + Assert.assertNotEquals(date3, date5); + Assert.assertTrue(date3.before(date5)); + Assert.assertThrows(IllegalArgumentException.class, () -> { DateUtil.parse("2018-"); }, e -> { - Assert.assertContains("Expected date format is:", - e.getMessage()); + Assert.assertContains("Expected date format is:", e.getMessage()); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + DateUtil.parse("2018-15-07 12:00:00.f"); + }, e -> { + Assert.assertContains("Expected date format is:", e.getMessage()); }); Assert.assertThrows(IllegalArgumentException.class, () -> { @@ -81,8 +94,9 @@ public void testParseCornerDateValue() throws InterruptedException { throw new RuntimeException(e); } try { - DateUtil.parse("0", "yyyy"); - } catch (ParseException e) { + Assert.assertEquals(new Date(-62167248343000L), + DateUtil.parse("0", "yyyy")); + } catch (Exception e) { errorCount.incrementAndGet(); } }); diff --git a/src/test/java/com/baidu/hugegraph/unit/util/EcheckTest.java b/src/test/java/com/baidu/hugegraph/unit/util/EcheckTest.java new file mode 100644 index 0000000000..46b9113bf2 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/util/EcheckTest.java @@ -0,0 +1,152 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.util; + +import org.junit.Test; + +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; +import com.baidu.hugegraph.util.E; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; + +public class EcheckTest extends BaseUnitTest { + + @Test + public void testCheckNotNull() { + E.checkNotNull(0, "test"); + E.checkNotNull(new Object(), "test"); + E.checkNotNull("1", "test"); + E.checkNotNull(ImmutableList.of(), "test"); + + Assert.assertThrows(NullPointerException.class, () -> { + E.checkNotNull(null, "test"); + }, e -> { + Assert.assertContains("The 'test' can't be null", e.getMessage()); + }); + + Assert.assertThrows(NullPointerException.class, () -> { + E.checkNotNull(null, "test2"); + }, e -> { + Assert.assertContains("The 'test2' can't be null", e.getMessage()); + }); + } + + @Test + public void testCheckNotNullWithOwner() { + E.checkNotNull(0, "test", "obj"); + E.checkNotNull(new Object(), "test", "obj"); + E.checkNotNull("1", "test", "obj"); + E.checkNotNull(ImmutableList.of(), "test", "obj"); + + Assert.assertThrows(NullPointerException.class, () -> { + E.checkNotNull(null, "test", "obj"); + }, e -> { + Assert.assertContains("The 'test' of 'obj' can't be null", + e.getMessage()); + }); + + Assert.assertThrows(NullPointerException.class, () -> { + E.checkNotNull(null, "test2", "obj2"); + }, e -> { + Assert.assertContains("The 'test2' of 'obj2' can't be null", + e.getMessage()); + }); + } + + @Test + public void testCheckNotEmpty() { + E.checkNotEmpty(ImmutableList.of(0), "test"); + E.checkNotEmpty(ImmutableList.of(""), "test"); + E.checkNotEmpty(ImmutableList.of(1, 2), "test"); + E.checkNotEmpty(ImmutableSet.of(0), "test"); + E.checkNotEmpty(ImmutableSet.of(""), "test"); + E.checkNotEmpty(ImmutableSet.of("1", "2"), "test"); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + E.checkNotEmpty(ImmutableList.of(), "test"); + }, e -> { + Assert.assertContains("The 'test' can't be empty", e.getMessage()); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + E.checkNotEmpty(ImmutableSet.of(), "test2"); + }, e -> { + Assert.assertContains("The 'test2' can't be empty", e.getMessage()); + }); + } + + @Test + public void testCheckNotEmptyWithOwner() { + E.checkNotEmpty(ImmutableList.of(0), "test", "obj"); + E.checkNotEmpty(ImmutableList.of(""), "test", "obj"); + E.checkNotEmpty(ImmutableList.of(1, 2), "test", "obj"); + E.checkNotEmpty(ImmutableSet.of(0), "test", "obj"); + E.checkNotEmpty(ImmutableSet.of(""), "test", "obj"); + E.checkNotEmpty(ImmutableSet.of("1", "2"), "test", "obj"); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + E.checkNotEmpty(ImmutableList.of(), "test", "obj"); + }, e -> { + Assert.assertContains("The 'test' of 'obj' can't be empty", + e.getMessage()); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + E.checkNotEmpty(ImmutableSet.of(), "test2", "obj2"); + }, e -> { + Assert.assertContains("The 'test2' of 'obj2' can't be empty", + e.getMessage()); + }); + } + + @Test + public void testCheckArgument() { + E.checkArgument(true, "test"); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + E.checkArgument(false, "Invalid parameter %s", 123); + }, e -> { + Assert.assertContains("Invalid parameter 123", e.getMessage()); + }); + } + + @Test + public void testCheckArgumentNotNull() { + E.checkArgumentNotNull("", "test"); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + E.checkArgumentNotNull(null, "Invalid parameter %s", "null"); + }, e -> { + Assert.assertContains("Invalid parameter null", e.getMessage()); + }); + } + + @Test + public void testCheckState() { + E.checkState(true, "test"); + + Assert.assertThrows(IllegalStateException.class, () -> { + E.checkState(false, "Invalid state '%s'", "FAIL"); + }, e -> { + Assert.assertContains("Invalid state 'FAIL'", e.getMessage()); + }); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/util/HashUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/HashUtilTest.java index 39d307662e..ada7842ebe 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/HashUtilTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/HashUtilTest.java @@ -23,6 +23,7 @@ import com.baidu.hugegraph.testutil.Assert; import com.baidu.hugegraph.unit.BaseUnitTest; +import com.baidu.hugegraph.util.Bytes; import com.baidu.hugegraph.util.HashUtil; public class HashUtilTest extends BaseUnitTest { @@ -48,6 +49,27 @@ public void testHash() { Assert.assertEquals("fcc1f9fa", h); } + @Test + public void testHashWithBytes() { + // hash 32 bits (4 bytes) + + byte[] h = HashUtil.hash(b("")); + Assert.assertEquals(4, h.length); + Assert.assertEquals("00000000", hex(h)); + + h = HashUtil.hash(b("q")); + Assert.assertEquals(4, h.length); + Assert.assertEquals("e80982ff", hex(h)); + + h = HashUtil.hash(b("qq")); + Assert.assertEquals(4, h.length); + Assert.assertEquals("252ef918", hex(h)); + + h = HashUtil.hash(b("qwertyuiop[]asdfghjkl;'zxcvbnm,./")); + Assert.assertEquals(4, h.length); + Assert.assertEquals("fcc1f9fa", hex(h)); + } + @Test public void testHash128() { // hash 128 bits (16 bytes) @@ -68,4 +90,33 @@ public void testHash128() { Assert.assertEquals(32, h.length()); Assert.assertEquals("49780e7800e613230520ed7b1116fef5", h); } + + @Test + public void testHash128WithBytes() { + // hash 128 bits (16 bytes) + + byte[] h = HashUtil.hash128(b("")); + Assert.assertEquals(16, h.length); + Assert.assertEquals("00000000000000000000000000000000", hex(h)); + + h = HashUtil.hash128(b("q")); + Assert.assertEquals(16, h.length); + Assert.assertEquals("b1aba139b20c3ebcf667a14f41c7d17c", hex(h)); + + h = HashUtil.hash128(b("qq")); + Assert.assertEquals(16, h.length); + Assert.assertEquals("2dbabe8ac8d8ce9eedc4b97add0f7c7c", hex(h)); + + h = HashUtil.hash128(b("qwertyuiop[]asdfghjkl;'zxcvbnm,./")); + Assert.assertEquals(16, h.length); + Assert.assertEquals("49780e7800e613230520ed7b1116fef5", hex(h)); + } + + private static byte[] b(String string) { + return string.getBytes(); + } + + private static String hex(byte[] bytes) { + return Bytes.toHex(bytes); + } } diff --git a/src/test/java/com/baidu/hugegraph/unit/util/LogTest.java b/src/test/java/com/baidu/hugegraph/unit/util/LogTest.java new file mode 100644 index 0000000000..9afe842cb4 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/util/LogTest.java @@ -0,0 +1,44 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.util; + +import org.junit.Test; +import org.slf4j.Logger; + +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; +import com.baidu.hugegraph.util.Log; + +public class LogTest extends BaseUnitTest { + + @Test + public void testLog() { + Logger log1 = Log.logger(LogTest.class); + Logger log2 = Log.logger("com.baidu.hugegraph.unit.util.LogTest"); + Logger log3 = Log.logger("test"); + + Assert.assertEquals(log1, log2); + Assert.assertNotEquals(log1, log3); + + log1.info("Info: testLog({})", LogTest.class); + log2.info("Info: testLog({})", "com.baidu.hugegraph.unit.util.LogTest"); + log3.info("Info: testLog({})", "test"); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java index a7221b9356..00e70ad8c6 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java @@ -20,6 +20,7 @@ package com.baidu.hugegraph.unit.util; import java.math.BigDecimal; +import java.util.Date; import org.junit.Test; @@ -382,10 +383,90 @@ public void testMaxValueOf() { NumericUtil.maxValueOf(Double.class)); Assert.assertThrows(IllegalArgumentException.class, () -> { - NumericUtil.minValueOf(null); + NumericUtil.maxValueOf(null); }); Assert.assertThrows(IllegalArgumentException.class, () -> { - NumericUtil.minValueOf(Character.class); + NumericUtil.maxValueOf(Character.class); + }); + } + + @Test + public void testIsNumber() { + Assert.assertEquals(true, NumericUtil.isNumber(byte.class)); + Assert.assertEquals(true, NumericUtil.isNumber(Byte.class)); + Assert.assertEquals(true, NumericUtil.isNumber(short.class)); + Assert.assertEquals(true, NumericUtil.isNumber(Short.class)); + Assert.assertEquals(true, NumericUtil.isNumber(int.class)); + Assert.assertEquals(true, NumericUtil.isNumber(Integer.class)); + Assert.assertEquals(true, NumericUtil.isNumber(long.class)); + Assert.assertEquals(true, NumericUtil.isNumber(Long.class)); + Assert.assertEquals(true, NumericUtil.isNumber(float.class)); + Assert.assertEquals(true, NumericUtil.isNumber(Float.class)); + Assert.assertEquals(true, NumericUtil.isNumber(double.class)); + Assert.assertEquals(true, NumericUtil.isNumber(Double.class)); + + Assert.assertEquals(false, NumericUtil.isNumber(char.class)); + Assert.assertEquals(false, NumericUtil.isNumber(Character.class)); + + Assert.assertEquals(true, NumericUtil.isNumber(1)); + Assert.assertEquals(true, NumericUtil.isNumber(1L)); + Assert.assertEquals(true, NumericUtil.isNumber(1.0f)); + Assert.assertEquals(true, NumericUtil.isNumber(1.0d)); + Assert.assertEquals(false, NumericUtil.isNumber('1')); + Assert.assertEquals(false, NumericUtil.isNumber((Object) null)); + } + + @Test + public void testConvertToNumber() { + Assert.assertEquals(1, NumericUtil.convertToNumber(1)); + Assert.assertEquals(1.2, NumericUtil.convertToNumber(1.2)); + + Assert.assertEquals(new BigDecimal(1.25), + NumericUtil.convertToNumber("1.25")); + + Date date = new Date(); + Assert.assertEquals(date.getTime(), NumericUtil.convertToNumber(date)); + + Assert.assertEquals(null, NumericUtil.convertToNumber(null)); + } + + @Test + public void testCompareNumber() { + Assert.assertEquals(0, NumericUtil.compareNumber(2, 2)); + Assert.assertEquals(1, NumericUtil.compareNumber(10, 2)); + Assert.assertEquals(-1, NumericUtil.compareNumber(1, 2)); + + Assert.assertEquals(-1, NumericUtil.compareNumber("1", 2)); + Assert.assertEquals(0, NumericUtil.compareNumber("2.0", 2)); + Assert.assertEquals(1, NumericUtil.compareNumber("2.00001", 2)); + Assert.assertEquals(1, NumericUtil.compareNumber("3.8", 2)); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + NumericUtil.compareNumber(null, 1); + }, e -> { + Assert.assertContains("The first parameter can't be null", + e.getMessage()); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + NumericUtil.compareNumber(2, null); + }, e -> { + Assert.assertContains("The second parameter can't be null", + e.getMessage()); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + NumericUtil.compareNumber("2", null); + }, e -> { + Assert.assertContains("The second parameter can't be null", + e.getMessage()); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + NumericUtil.compareNumber("f", 2); + }, e -> { + Assert.assertContains("Can't compare between 'f' and '2'", + e.getMessage()); }); } diff --git a/src/test/java/com/baidu/hugegraph/unit/util/StringUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/StringUtilTest.java index f37ba41714..6840f7c0c8 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/StringUtilTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/StringUtilTest.java @@ -83,6 +83,72 @@ public void testSplitToCharsArray() { }); } + @Test + public void testCharsCharAt() { + Chars chars = Chars.of("123"); + Assert.assertEquals('1', chars.charAt(0)); + Assert.assertEquals('2', chars.charAt(1)); + Assert.assertEquals('3', chars.charAt(2)); + + Assert.assertThrows(ArrayIndexOutOfBoundsException.class, () -> { + chars.charAt(3); + }); + Assert.assertThrows(ArrayIndexOutOfBoundsException.class, () -> { + chars.charAt(-1); + }); + } + + @Test + public void testCharsSubSequence() { + Chars chars = Chars.of("123"); + Assert.assertEquals(Chars.of("1"), chars.subSequence(0, 1)); + Assert.assertEquals(Chars.of("12"), chars.subSequence(0, 2)); + Assert.assertEquals(Chars.of("2"), chars.subSequence(1, 2)); + Assert.assertEquals(Chars.of("23"), chars.subSequence(1, 3)); + Assert.assertEquals(Chars.of("123"), chars.subSequence(0, 3)); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + chars.subSequence(2, 1); + }, e -> { + Assert.assertContains("Invalid end parameter 1", e.getMessage()); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + chars.subSequence(-1, 2); + }, e -> { + Assert.assertContains("Invalid start parameter -1", e.getMessage()); + }); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + chars.subSequence(1, -1); + }, e -> { + Assert.assertContains("Invalid end parameter -1", e.getMessage()); + }); + } + + @Test + public void testCharsEquals() { + Chars chars1 = Chars.of("123"); + Chars chars2 = Chars.of("123"); + Chars chars3 = Chars.of("12"); + + Assert.assertEquals(chars1, chars2); + Assert.assertNotEquals(chars1, chars3); + Assert.assertNotEquals(chars1, "123"); + Assert.assertNotEquals(chars1, null); + } + + @Test + public void testCharsHashCode() { + Chars chars1 = Chars.of("123"); + Chars chars2 = Chars.of("123"); + Chars chars3 = Chars.of("12"); + + Assert.assertEquals(chars1.hashCode(), chars2.hashCode()); + Assert.assertEquals(chars1.hashCode(), "123".hashCode()); + Assert.assertNotEquals(chars1.hashCode(), chars3.hashCode()); + } + private static List guavaSplit(String line, String delimiter) { return Splitter.on(delimiter).splitToList(line); } diff --git a/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java index 29e91fd83b..49fcdacc3b 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java @@ -19,6 +19,8 @@ package com.baidu.hugegraph.unit.util; +import java.net.MalformedURLException; + import org.junit.Test; import com.baidu.hugegraph.testutil.Assert; @@ -118,4 +120,53 @@ public void testVersionCheck() { VersionUtil.check(version, "0.7", "1.0", "test-component"); }); } + + @Test + public void testGetImplementationVersion() throws MalformedURLException { + // Can't mock Class: https://github.com/mockito/mockito/issues/1734 + //Class clazz = Mockito.mock(Class.class); + //Mockito.when(clazz.getSimpleName()).thenReturn("fake"); + //Mockito.when(clazz.getResource("fake.class")).thenReturn(manifest); + + String manifestPath = "file:./src/test/resources"; + Assert.assertEquals("1.8.6.0", + VersionUtil.getImplementationVersion(manifestPath)); + + manifestPath = "file:./src/test/resources2"; + Assert.assertEquals(null, + VersionUtil.getImplementationVersion(manifestPath)); + } + + @Test + public void testVersion() { + // Test equals + Version v1 = VersionUtil.Version.of("0.2.1"); + Version v2 = VersionUtil.Version.of("0.2.1"); + Assert.assertEquals(v1, v1); + Assert.assertEquals(v1, v2); + + Version v3 = VersionUtil.Version.of("0.2.0"); + Version v4 = VersionUtil.Version.of("0.2"); + Assert.assertEquals(v3, v4); + + Version v5 = VersionUtil.Version.of("0.2.3"); + Version v6 = VersionUtil.Version.of("0.3.2"); + Assert.assertNotEquals(v5, v6); + Assert.assertNotEquals(v5, null); + Assert.assertNotEquals(v5, "0.2.3"); + + // Test hashCode + Assert.assertEquals(1023, v1.hashCode()); + Assert.assertEquals(1023, v2.hashCode()); + Assert.assertEquals(62, v3.hashCode()); + Assert.assertEquals(62, v4.hashCode()); + Assert.assertEquals(2945, v5.hashCode()); + Assert.assertEquals(2015, v6.hashCode()); + + // Test compareTo + Assert.assertEquals(0, v1.compareTo(v2)); + Assert.assertEquals(1, v1.compareTo(v3)); + Assert.assertEquals(-1, v1.compareTo(v5)); + Assert.assertEquals(1, v1.compareTo(null)); + } } diff --git a/src/test/resources/META-INF/MANIFEST.MF b/src/test/resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..fe44310d0c --- /dev/null +++ b/src/test/resources/META-INF/MANIFEST.MF @@ -0,0 +1,9 @@ +Manifest-Version: 1.0 +Implementation-Version: 1.8.6.0 +Archiver-Version: Plexus Archiver +Built-By: jermy +Specification-Title: hugegraph-common +Created-By: Apache Maven 3.3.9 +Build-Jdk: 1.8.0_111 +Specification-Version: 1.8.6 + From fe190141cc6282f2e4479b3b9510ff586895ab61 Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Tue, 13 Apr 2021 14:53:42 +0800 Subject: [PATCH 141/217] improve profile performance (#69) * improve profile performance * support profile nested class * support total_wasted time * calculate totalChildrenWasted time for echarts * only profile super class in the same package * improve perf through local-tree,local-timer,local-stack * improve test case * add Stopwatch remove-child test * fix can't profile parent class with 2 class not in the same package * add totalChildrenTimes * improve LocalTimer perf * add PerfUtil.useLightStopwatch(true) * define behavior of switching light-stopwatch process * ignore other threads if profileSingleThread(true) with multi-threads * improve the empty judgment the first call in useLightStopwatch() Change-Id: Id1ae075ddffec77b95b31142d7ebcdae87371943 --- .../baidu/hugegraph/perf/LightStopwatch.java | 188 +++++++ .../baidu/hugegraph/perf/NormalStopwatch.java | 306 ++++++++++ .../com/baidu/hugegraph/perf/PerfUtil.java | 532 +++++++++++++++--- .../com/baidu/hugegraph/perf/Stopwatch.java | 177 +++--- .../com/baidu/hugegraph/testutil/Assert.java | 5 + .../baidu/hugegraph/util/ReflectionUtil.java | 27 +- .../baidu/hugegraph/unit/UnitTestSuite.java | 2 + .../hugegraph/unit/perf/PerfUtilTest.java | 415 +++++++++++++- .../hugegraph/unit/perf/StopwatchTest.java | 104 ++++ .../unit/perf/testclass/TestClass.java | 107 ++++ .../unit/perf/testclass/TestLightClass.java | 52 ++ .../unit/perf/testclass/TestPerfClass.java | 74 +++ .../perf/testclass/TestPerfLightClass.java | 74 +++ .../perf/testclass2/TestClass4Package.java} | 24 +- .../unit/util/ReflectionUtilTest.java | 52 +- 15 files changed, 1929 insertions(+), 210 deletions(-) create mode 100644 src/main/java/com/baidu/hugegraph/perf/LightStopwatch.java create mode 100644 src/main/java/com/baidu/hugegraph/perf/NormalStopwatch.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/perf/StopwatchTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestClass.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestLightClass.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfClass.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfLightClass.java rename src/test/java/com/baidu/hugegraph/{testclass/TestClass.java => unit/perf/testclass2/TestClass4Package.java} (76%) diff --git a/src/main/java/com/baidu/hugegraph/perf/LightStopwatch.java b/src/main/java/com/baidu/hugegraph/perf/LightStopwatch.java new file mode 100644 index 0000000000..b57ae378a7 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/perf/LightStopwatch.java @@ -0,0 +1,188 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.perf; + +import java.util.List; + +import com.baidu.hugegraph.perf.PerfUtil.FastMap; + +public final class LightStopwatch implements Stopwatch { + + private long lastStartTime = -1L; + + private long times = 0L; + private long totalCost = 0L; + private long totalChildrenTimes = -1L; + + private final String name; + private final Path parent; + private final Path id; + private final FastMap children; + + public LightStopwatch(String name, Stopwatch parent) { + this(name, parent.id()); + parent.child(name, this); + } + + public LightStopwatch(String name, Path parent) { + this.name = name; + this.parent = parent; + this.id = Stopwatch.id(parent, name); + this.children = new FastMap<>(); + } + + @Override + public Path id() { + return this.id; + } + + @Override + public String name() { + return this.name; + } + + @Override + public Path parent() { + return this.parent; + } + + @Override + public void lastStartTime(long startTime) { + this.lastStartTime = startTime; + } + + @Override + public void startTime(long startTime) { + this.times++; + this.lastStartTime = startTime; + } + + @Override + public void endTime(long startTime) { + this.totalCost += PerfUtil.now() - this.lastStartTime; + } + + @Override + public long times() { + return this.times; + } + + @Override + public long totalTimes() { + if (this.totalChildrenTimes > 0L) { + return this.times + this.totalChildrenTimes; + } + return this.times; + } + + @Override + public long totalChildrenTimes() { + return this.totalChildrenTimes; + } + + @Override + public long totalCost() { + return this.totalCost; + } + + @Override + public void totalCost(long totalCost) { + this.totalCost = totalCost; + } + + @Override + public long minCost() { + return -1L; + } + + @Override + public long maxCost() { + return -1L; + } + + @Override + public long totalWasted() { + return 0L; + } + + @Override + public long totalSelfWasted() { + return 0L; + } + + @Override + public long totalChildrenWasted() { + return -1L; + } + + @Override + public void fillChildrenTotal(List children) { + // Fill total times of children + this.totalChildrenTimes = children.stream().mapToLong( + c -> c.totalTimes()).sum(); + } + + @Override + public LightStopwatch copy() { + try { + return (LightStopwatch) super.clone(); + } catch (CloneNotSupportedException e) { + throw new RuntimeException(e); + } + } + + @Override + public Stopwatch child(String name) { + return this.children.get(name); + } + + @Override + public Stopwatch child(String name, Stopwatch watch) { + if (watch == null) { + return this.children.remove(name); + } + return this.children.put(name, watch); + } + + @Override + public boolean empty() { + return this.children.size() == 0; + } + + @Override + public void clear() { + this.lastStartTime = -1L; + + this.times = 0L; + this.totalCost = 0L; + this.totalChildrenTimes = -1L; + + this.children.clear(); + } + + @Override + public String toString() { + return String.format("{parent:%s,name:%s," + + "times:%s,totalChildrenTimes:%s,totalCost:%s}", + this.parent, this.name, + this.times, this.totalChildrenTimes, + this.totalCost); + } +} diff --git a/src/main/java/com/baidu/hugegraph/perf/NormalStopwatch.java b/src/main/java/com/baidu/hugegraph/perf/NormalStopwatch.java new file mode 100644 index 0000000000..c097cadceb --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/perf/NormalStopwatch.java @@ -0,0 +1,306 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.perf; + +import java.util.List; +import java.util.function.BiFunction; + +import org.slf4j.Logger; + +import com.baidu.hugegraph.perf.PerfUtil.FastMap; +import com.baidu.hugegraph.perf.PerfUtil.LocalStack; +import com.baidu.hugegraph.testutil.Whitebox; +import com.baidu.hugegraph.util.Log; + +public final class NormalStopwatch implements Stopwatch { + + private static final Logger LOG = Log.logger(Stopwatch.class); + + private static final String MULTI_THREAD_ACCESS_ERROR = + "There may be multi-threaded access, ensure " + + "not call PerfUtil.profileSingleThread(true) when " + + "multithreading."; + + private long lastStartTime = -1L; + + private long times = 0L; + private long totalCost = 0L; + private long minCost = Long.MAX_VALUE; + private long maxCost = 0L; + private long totalSelfWasted = 0L; + private long totalChildrenWasted = -1L; + private long totalChildrenTimes = -1L; + + private final String name; + private final Path parent; + private final Path id; + private final FastMap children; + + public NormalStopwatch(String name, Stopwatch parent) { + this(name, parent.id()); + parent.child(name, this); + } + + public NormalStopwatch(String name, Path parent) { + this.name = name; + this.parent = parent; + this.id = Stopwatch.id(parent, name); + this.children = new FastMap<>(); + } + + @Override + public Path id() { + return this.id; + } + + @Override + public String name() { + return this.name; + } + + @Override + public Path parent() { + return this.parent; + } + + @Override + public void lastStartTime(long startTime) { + this.lastStartTime = startTime; + } + + @Override + public void startTime(long startTime) { + assert this.lastStartTime == -1L : MULTI_THREAD_ACCESS_ERROR; + + this.times++; + this.lastStartTime = startTime; + + long endTime = PerfUtil.now(); + long wastedTime = endTime - startTime; + if (wastedTime <= 0L) { + wastedTime += eachStartWastedLost; + } + + this.totalSelfWasted += wastedTime; + } + + @Override + public void endTime(long startTime) { + assert startTime >= this.lastStartTime && this.lastStartTime != -1L : + MULTI_THREAD_ACCESS_ERROR; + + long endTime = PerfUtil.now(); + // The following code cost about 3ns~4ns + long wastedTime = endTime - startTime; + if (wastedTime <= 0L) { + wastedTime += eachEndWastedLost; + } + + long cost = endTime - this.lastStartTime; + + if (this.minCost > cost) { + this.minCost = cost; + } + if (this.maxCost < cost) { + this.maxCost = cost; + } + + this.totalCost += cost; + this.totalSelfWasted += wastedTime; + this.lastStartTime = -1L; + } + + @Override + public long times() { + return this.times; + } + + @Override + public long totalCost() { + return this.totalCost; + } + + @Override + public void totalCost(long totalCost) { + this.totalCost = totalCost; + } + + @Override + public long minCost() { + return this.minCost; + } + + @Override + public long maxCost() { + return this.maxCost; + } + + @Override + public long totalTimes() { + if (this.totalChildrenTimes > 0L) { + return this.times + this.totalChildrenTimes; + } + return this.times; + } + + @Override + public long totalChildrenTimes() { + return this.totalChildrenTimes; + } + + @Override + public long totalWasted() { + if (this.totalChildrenWasted > 0L) { + return this.totalSelfWasted + this.totalChildrenWasted; + } + return this.totalSelfWasted; + } + + @Override + public long totalSelfWasted() { + return this.totalSelfWasted; + } + + @Override + public long totalChildrenWasted() { + return this.totalChildrenWasted; + } + + @Override + public void fillChildrenTotal(List children) { + // Fill total wasted cost of children + this.totalChildrenWasted = children.stream().mapToLong( + c -> c.totalWasted()).sum(); + // Fill total times of children + this.totalChildrenTimes = children.stream().mapToLong( + c -> c.totalTimes()).sum(); + } + + @Override + public Stopwatch copy() { + try { + return (Stopwatch) super.clone(); + } catch (CloneNotSupportedException e) { + throw new RuntimeException(e); + } + } + + @Override + public Stopwatch child(String name) { + return this.children.get(name); + } + + @Override + public Stopwatch child(String name, Stopwatch watch) { + if (watch == null) { + return this.children.remove(name); + } + return this.children.put(name, watch); + } + + @Override + public boolean empty() { + return this.children.size() == 0; + } + + @Override + public void clear() { + this.lastStartTime = -1L; + + this.times = 0L; + this.totalCost = 0L; + + this.minCost = Long.MAX_VALUE; + this.maxCost = 0L; + this.totalSelfWasted = 0L; + this.totalChildrenWasted = -1L; + this.totalChildrenTimes = -1L; + + this.children.clear(); + } + + @Override + public String toString() { + return String.format("{parent:%s,name:%s," + + "times:%s,totalChildrenTimes:%s," + + "totalCost:%s,minCost:%s,maxCost:%s," + + "totalSelfWasted:%s,totalChildrenWasted:%s}", + this.parent, this.name, + this.times, this.totalChildrenTimes, + this.totalCost, this.minCost, this.maxCost, + this.totalSelfWasted, this.totalChildrenWasted); + } + + private static long eachStartWastedLost = 0L; + private static long eachEndWastedLost = 0L; + + protected static void initEachWastedLost() { + int times = 100000000; + + LocalStack callStack = Whitebox.getInternalState( + PerfUtil.instance(), "callStack"); + + long baseStart = PerfUtil.now(); + for (int i = 0; i < times; i++) { + PerfUtil.instance(); + } + long baseCost = PerfUtil.now() - baseStart; + + BiFunction testEachCost = (name, test) -> { + long start = PerfUtil.now(); + test.run(); + long end = PerfUtil.now(); + long cost = end - start - baseCost; + assert cost > 0; + long eachCost = cost / times; + + LOG.info("Wasted time test: cost={}ms, base_cost={}ms, {}={}ns", + cost / 1000000.0, baseCost / 1000000.0, name, eachCost); + return eachCost; + }; + + String startName = "each_start_cost"; + eachStartWastedLost = testEachCost.apply(startName, () -> { + Stopwatch watch = PerfUtil.instance().start(startName); + PerfUtil.instance().end(startName); + for (int i = 0; i < times; i++) { + // Test call start() + PerfUtil.instance().start(startName); + // Mock end() + watch.lastStartTime(-1L); + callStack.pop(); + } + }); + + String endName = "each_end_cost"; + eachEndWastedLost = testEachCost.apply(endName, () -> { + Stopwatch watch = PerfUtil.instance().start(endName); + PerfUtil.instance().end(endName); + for (int i = 0; i < times; i++) { + // Mock start() + callStack.push(watch); + watch.lastStartTime(0L); + // Test call start() + PerfUtil.instance().end(endName); + watch.totalCost(0L); + } + }); + } +} diff --git a/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java b/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java index 1cf22ae063..e8ea2eaadb 100644 --- a/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java +++ b/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java @@ -19,12 +19,11 @@ package com.baidu.hugegraph.perf; -import java.io.IOException; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import java.security.InvalidParameterException; +import java.util.EmptyStackException; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -32,14 +31,17 @@ import java.util.List; import java.util.Map; import java.util.Set; -import java.util.Stack; +import java.util.concurrent.CountDownLatch; import java.util.function.BiConsumer; +import java.util.function.Function; +import java.util.stream.Collectors; import java.util.stream.Stream; import org.slf4j.Logger; import com.baidu.hugegraph.func.TriFunction; -import com.baidu.hugegraph.util.E; +import com.baidu.hugegraph.perf.Stopwatch.Path; +import com.baidu.hugegraph.testutil.Assert.ThrowableConsumer; import com.baidu.hugegraph.util.Log; import com.baidu.hugegraph.util.ReflectionUtil; import com.google.common.reflect.ClassPath.ClassInfo; @@ -48,22 +50,36 @@ import javassist.ClassPool; import javassist.CtClass; import javassist.CtMethod; -import javassist.NotFoundException; -public class PerfUtil { +public final class PerfUtil { private static final Logger LOG = Log.logger(PerfUtil.class); + private static final int DEFAUL_CAPATICY = 1024; + private static final ThreadLocal INSTANCE = new ThreadLocal<>(); - private final Map stopwatches; - private final Stack callStack; + private static PerfUtil SINGLE_INSTANCE = null; + private static Thread SINGLE_THREAD = null; + private static LocalTimer LOCAL_TIMER = null; + private static boolean LIGHT_WATCH = false; + + private final Map stopwatches; + private final LocalStack callStack; + private final Stopwatch root; private PerfUtil() { - this.stopwatches = new HashMap<>(); - this.callStack = new Stack<>(); + this.stopwatches = new HashMap<>(DEFAUL_CAPATICY); + this.callStack = new LocalStack<>(DEFAUL_CAPATICY); + this.root = newStopwatch(Path.ROOT_NAME, Path.EMPTY); } public static PerfUtil instance() { + if (SINGLE_INSTANCE != null && + SINGLE_THREAD == Thread.currentThread()) { + // Return the only one instance for single thread, for performance + return SINGLE_INSTANCE; + } + PerfUtil p = INSTANCE.get(); if (p == null) { p = new PerfUtil(); @@ -72,81 +88,182 @@ public static PerfUtil instance() { return p; } - private static long now() { + public static void profileSingleThread(boolean yes) { + SINGLE_INSTANCE = yes ? PerfUtil.instance() : null; + SINGLE_THREAD = yes ? Thread.currentThread() : null; + } + + public static void useLocalTimer(boolean yes) { + if (yes) { + if (LOCAL_TIMER != null) { + return; + } + LOCAL_TIMER = new LocalTimer(); + try { + LOCAL_TIMER.startTimeUpdateLoop(); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + + if (!LIGHT_WATCH) { + NormalStopwatch.initEachWastedLost(); + } + } else { + if (LOCAL_TIMER == null) { + return; + } + try { + LOCAL_TIMER.stop(); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } finally { + LOCAL_TIMER = null; + } + } + } + + public static void useLightStopwatch(boolean yes) { + if (yes != LIGHT_WATCH) { + PerfUtil instance = INSTANCE.get(); + boolean empty = instance == null || instance.empty(); + String message = "Please call clear() before switching " + + "light-stopwatch due to there is dirty watch"; + com.baidu.hugegraph.util.E.checkArgument(empty, message); + } + LIGHT_WATCH = yes; + } + + protected static long now() { + if (LOCAL_TIMER != null) { + return LOCAL_TIMER.now(); + } + // System.nanoTime() cost about 40 ns each call return System.nanoTime(); } - public boolean start(String name) { - String parent = this.callStack.empty() ? "" : this.callStack.peek(); - Stopwatch item = this.stopwatches.get(Stopwatch.id(parent, name)); - if (item == null) { - item = new Stopwatch(name, parent); - this.stopwatches.put(item.id(), item); + protected static Stopwatch newStopwatch(String name, Path parent) { + return LIGHT_WATCH ? new LightStopwatch(name, parent) : + new NormalStopwatch(name, parent); + } + + protected static Stopwatch newStopwatch(String name, Stopwatch parent) { + return LIGHT_WATCH ? new LightStopwatch(name, parent) : + new NormalStopwatch(name, parent); + } + + public Stopwatch start(String name) { + long start = now(); + + Stopwatch parent = this.callStack.empty() ? + this.root : this.callStack.peek(); + + // Get watch by name from local tree + Stopwatch watch = parent.child(name); + if (watch == null) { + watch = newStopwatch(name, parent); + assert !this.stopwatches.containsKey(watch.id()) : watch; + this.stopwatches.put(watch.id(), watch); } - this.callStack.push(item.id()); - item.startTime(now()); + this.callStack.push(watch); - return true; // just for assert + watch.startTime(start); + + return watch; } - public boolean end(String name) { - long time = now(); - String current = this.callStack.pop(); - assert current.endsWith(name); + public Stopwatch start2(String name) { + long start = now(); // cost 70 ns with System.nanoTime() + + Path parent = this.callStack.empty() ? + Path.EMPTY : this.callStack.peek().id(); + Path id = Stopwatch.id(parent, name); // cost 130 + // Get watch by id from global map + Stopwatch watch = this.stopwatches.get(id); // cost 170 + if (watch == null) { + watch = newStopwatch(name, parent); + this.stopwatches.put(watch.id(), watch); // cost 180 + } + this.callStack.push(watch); // cost 190 - String parent = this.callStack.empty() ? "" : this.callStack.peek(); - Stopwatch item = this.stopwatches.get(Stopwatch.id(parent, name)); - if (item == null) { - throw new InvalidParameterException(name); + watch.startTime(start); + + return watch; + } + + public void end(String name) { + long start = LIGHT_WATCH ? 0L : now(); + + Stopwatch watch = this.callStack.pop(); + if (watch == null || watch.name() != name) { + throw new IllegalArgumentException("Invalid watch name: " + name); } - item.endTime(time); - return true; + watch.endTime(start); + } + + public boolean empty() { + return this.stopwatches.isEmpty() && this.root.empty(); } public void clear() { - E.checkState(this.callStack.empty(), - "Can't be cleared when the call has not ended yet"); + String error = "Can't be cleared when the call has not ended yet"; + com.baidu.hugegraph.util.E.checkState(this.callStack.empty(), error); + this.stopwatches.clear(); + this.root.clear(); } - public void profilePackage(String... packages) - throws NotFoundException, IOException, - ClassNotFoundException, CannotCompileException { + public void profilePackage(String... packages) throws Throwable { Set loadedClasses = new HashSet<>(); - Iterator classes = ReflectionUtil.classes(packages); - while (classes.hasNext()) { - String cls = classes.next().getName(); - // super class first - for (String s : ReflectionUtil.superClasses(cls)) { - if (!loadedClasses.contains(s)) { - profileClass(s); - loadedClasses.add(s); + Function inPackage = (cls) -> { + for (String pkg : packages) { + if (cls.startsWith(pkg)) { + return true; } } - // self class + return false; + }; + + ThrowableConsumer profileClassIfPresent = (cls) -> { if (!loadedClasses.contains(cls)) { + // Profile super class + for (String s : ReflectionUtil.superClasses(cls)) { + if (!loadedClasses.contains(s) && inPackage.apply(s)) { + profileClass(s); + loadedClasses.add(s); + } + } + // Profile self class profileClass(cls); loadedClasses.add(cls); } + }; + + Iterator classes = ReflectionUtil.classes(packages); + while (classes.hasNext()) { + String cls = classes.next().getName(); + // Profile self class + profileClassIfPresent.accept(cls); + // Profile nested class + for (String s : ReflectionUtil.nestedClasses(cls)) { + profileClassIfPresent.accept(s); + } } } - public void profileClass(String... classes) - throws NotFoundException, CannotCompileException, - ClassNotFoundException { + public void profileClass(String... classes) throws Throwable { ClassPool classPool = ClassPool.getDefault(); for (String cls : classes) { CtClass ctClass = classPool.get(cls); List methods = ReflectionUtil.getMethodsAnnotatedWith( - ctClass, Watched.class, false); + ctClass, Watched.class, false); for (CtMethod method : methods) { profile(method); } - // load class and make it effective + // Load class and make it effective if (!methods.isEmpty()) { ctClass.toClass(); } @@ -185,7 +302,7 @@ public String toString() { public String toJson() { StringBuilder sb = new StringBuilder(8 + this.stopwatches.size() * 96); sb.append('{'); - for (Map.Entry w : this.stopwatches.entrySet()) { + for (Map.Entry w : this.stopwatches.entrySet()) { sb.append('"'); sb.append(w.getKey()); sb.append('"'); @@ -205,9 +322,8 @@ public String toJson() { // TODO: move toECharts() method out of this class public String toECharts() { - TriFunction, String> formatLevel = ( - totalDepth, depth, items) -> { + totalDepth, depth, items) -> { float factor = 100.0f / (totalDepth + 1); float showFactor = 1 + (totalDepth - depth) / (float) depth; @@ -224,39 +340,55 @@ public String toECharts() { sb.append(String.format("radius: ['%s%%', '%s%%'],", radiusFrom, radiusTo)); sb.append(String.format( - "label: {normal: {position: 'inner', formatter:" + - "function(params) {" + - " if (params.percent > %s) return params.data.name;" + - " else return '';" + - "}}},", showFactor)); + "label: {normal: {position: 'inner', formatter:" + + "function(params) {" + + " if (params.percent > %s) return params.data.name;" + + " else return '';" + + "}}},", showFactor)); sb.append("data: ["); items.sort((i, j) -> i.id().compareTo(j.id())); for (Stopwatch w : items) { sb.append('{'); + sb.append("id:'"); + sb.append(w.id()); + sb.append("',"); + + sb.append("name:'"); + sb.append(w.name()); + sb.append("',"); + sb.append("value:"); + sb.append(w.totalCost()); // w.totalCost() - w.totalWasted() ? + sb.append(','); + + sb.append("cost:"); sb.append(w.totalCost() / 1000000.0); sb.append(','); - sb.append("min:"); + sb.append("minCost:"); sb.append(w.minCost()); sb.append(','); - sb.append("max:"); + sb.append("maxCost:"); sb.append(w.maxCost()); sb.append(','); - sb.append("id:'"); - sb.append(w.id()); - sb.append("',"); + sb.append("wasted:"); + sb.append(w.totalWasted() / 1000000.0); + sb.append(','); - sb.append("name:'"); - sb.append(w.name()); - sb.append("',"); + sb.append("selfWasted:"); + sb.append(w.totalSelfWasted() / 1000000.0); + sb.append(','); sb.append("times:"); sb.append(w.times()); + sb.append(','); + + sb.append("totalTimes:"); + sb.append(w.totalTimes()); sb.append('}'); sb.append(','); @@ -268,51 +400,88 @@ public String toECharts() { return sb.toString(); }; + BiConsumer, List> fillChildrenTotal = + (itemsOfLn, itemsOfLnParent) -> { + for (Stopwatch parent : itemsOfLnParent) { + List children = itemsOfLn.stream().filter(c -> { + return c.parent().equals(parent.id()); + }).collect(Collectors.toList()); + + parent.fillChildrenTotal(children); + } + }; + BiConsumer, List> fillOther = - (itemsOfI, parents) -> { - for (Stopwatch parent : parents) { - Stream children = itemsOfI.stream().filter(c -> { + (itemsOfLn, itemsOfLnParent) -> { + for (Stopwatch parent : itemsOfLnParent) { + Stream children = itemsOfLn.stream().filter(c -> { return c.parent().equals(parent.id()); }); - long sum = children.mapToLong(c -> c.totalCost()).sum(); - if (sum < parent.totalCost()) { - Stopwatch other = new Stopwatch("~", parent.id()); - other.totalCost(parent.totalCost() - sum); - itemsOfI.add(other); + // Fill other cost + long sumCost = children.mapToLong(c -> c.totalCost()).sum(); + long otherCost = parent.totalCost() - sumCost; + if (otherCost > 0L) { + Stopwatch other = newStopwatch("~", parent.id()); + other.totalCost(otherCost); + itemsOfLn.add(other); } } }; - Map items = this.stopwatches; + Map items = this.stopwatches; Map> levelItems = new HashMap<>(); - int maxDepth = 1; - for (Map.Entry e : items.entrySet()) { - int depth = e.getKey().split("/").length; - levelItems.putIfAbsent(depth, new LinkedList<>()); - levelItems.get(depth).add(e.getValue().copy()); + int maxDepth = 0; + for (Map.Entry e : items.entrySet()) { + int depth = e.getKey().toString().split("/").length; + List levelItem = levelItems.get(depth); + if (levelItem == null) { + levelItem = new LinkedList<>(); + levelItems.putIfAbsent(depth, levelItem); + } + levelItem.add(e.getValue().copy()); if (depth > maxDepth) { maxDepth = depth; } } + // Fill wasted cost from the outermost to innermost + for (int i = maxDepth; i > 0; i--) { + assert levelItems.containsKey(i) : i; + List itemsOfI = levelItems.get(i); + List itemsOfParent = levelItems.get(i - 1); + if (itemsOfParent != null) { + // Fill total value of children + fillChildrenTotal.accept(itemsOfI, itemsOfParent); + } + } + StringBuilder sb = new StringBuilder(8 + items.size() * 128); + // Output results header sb.append("{"); sb.append("tooltip: {trigger: 'item', " + "formatter: function(params) {" + - " return params.data.name + ' ' + params.percent + '%
'" + - " + 'cost: ' + params.data.value + ' (ms)
'" + - " + 'min: ' + params.data.min + ' (ns)
'" + - " + 'max: ' + params.data.max + ' (ns)
'" + - " + 'times: ' + params.data.times + '
'" + - " + params.data.id + '
';" + + " return params.data.name + ' ' + params.percent + '%
'" + + " + 'cost: ' + params.data.cost + ' (ms)
'" + + " + 'min cost: ' + params.data.minCost + ' (ns)
'" + + " + 'max cost: ' + params.data.maxCost + ' (ns)
'" + + " + 'wasted: ' + params.data.wasted + ' (ms)
'" + + " + 'self wasted: ' + params.data.selfWasted + ' (ms)
'" + + " + 'times: ' + params.data.times + '
'" + + " + 'total times: ' + params.data.totalTimes + '
'" + + " + 'path: ' + params.data.id + '
';" + "}"); sb.append("},"); sb.append("series: ["); - for (int i = 1; levelItems.containsKey(i); i++) { + // Output results data + for (int i = 1; i <= maxDepth; i++) { + assert levelItems.containsKey(i) : i; List itemsOfI = levelItems.get(i); - if (i > 1) { - fillOther.accept(itemsOfI, levelItems.get(i - 1)); + List itemsOfParent = levelItems.get(i - 1); + if (itemsOfParent != null) { + // Fill other cost for non-root level, ignore root level (i=1) + fillOther.accept(itemsOfI, itemsOfParent); } + // Output items of level I sb.append(formatLevel.apply(maxDepth, i, itemsOfI)); sb.append(','); } @@ -324,8 +493,193 @@ public String toECharts() { return sb.toString(); } + public static final class LocalTimer { + + // Header: 4 bytes classptr + 8 bytes markword + private volatile long padding11 = 0L; + private volatile long padding12 = 0L; + private volatile long padding13 = 0L; + private volatile long padding14 = 0L; + private volatile long padding15 = 0L; + private volatile long padding16 = 0L; // the 1st 64 bytes + + private volatile long time = 0L; + + private volatile long padding21 = 0L; + private volatile long padding22 = 0L; + private volatile long padding23 = 0L; + private volatile long padding24 = 0L; + private volatile long padding25 = 0L; + private volatile long padding26 = 0L; + private volatile long padding27 = 0L; // the 2nd 64 bytes + + private volatile boolean running = false; + private Thread thread = null; + + public long now() { + // Read current ns time (be called frequently) + return this.time; + } + + public void startTimeUpdateLoop() throws InterruptedException { + assert this.thread == null; + assert this.preventOptimizePadding() == 0L; + this.running = true; + CountDownLatch started = new CountDownLatch(1); + this.thread = new Thread(() -> { + started.countDown(); + while (this.running) { + this.time = System.nanoTime(); + // Prevent frequent updates for perf (5.2s => 3.6s for 8kw) + Thread.yield(); + } + }, "LocalTimer"); + this.thread.setDaemon(true); + this.thread.start(); + started.await(); + } + + public void stop() throws InterruptedException { + this.running = false; + if (this.thread != null) { + this.thread.join(); + } + } + + public long preventOptimizePadding() { + long p1 = this.padding11 + this.padding12 + this.padding13 + + this.padding14 + this.padding15 + this.padding16; + long p2 = this.padding21 + this.padding22 + this.padding23 + + this.padding24 + this.padding25 + this.padding26 + + this.padding27; + return p1 + p2; + } + } + + public static final class LocalStack { + + private final Object[] elementData; + private int elementCount; + + public LocalStack(int capacity) { + this.elementData = new Object[capacity]; + this.elementCount = 0; + } + + int size() { + return this.elementCount; + } + + boolean empty() { + return this.elementCount == 0; + } + + public void push(E elem) { + this.elementData[this.elementCount++] = elem; + } + + public E pop() { + if (this.elementCount == 0) { + throw new EmptyStackException(); + } + this.elementCount--; + @SuppressWarnings("unchecked") + E elem = (E) this.elementData[this.elementCount]; + this.elementData[this.elementCount] = null; + return elem; + } + + public E peek() { + if (this.elementCount == 0) { + throw new EmptyStackException(); + } + @SuppressWarnings("unchecked") + E elem = (E) this.elementData[this.elementCount - 1]; + return elem; + } + } + + public static final class FastMap { + + private final Map hashMap; + + private K key1; + private K key2; + private K key3; + + private V val1; + private V val2; + private V val3; + + public FastMap() { + this.hashMap = new HashMap<>(); + } + + public int size() { + return this.hashMap.size(); + } + + public boolean containsKey(Object key) { + return this.hashMap.containsKey(key); + } + + public V get(Object key) { + if (key == this.key1) { + return this.val1; + } else if (key == this.key2) { + return this.val2; + } else if (key == this.key3) { + return this.val3; + } + + return this.hashMap.get(key); + } + + public V put(K key, V value) { + if (this.key1 == null) { + this.key1 = key; + this.val1 = value; + } else if (this.key2 == null) { + this.key2 = key; + this.val2 = value; + } else if (this.key3 == null) { + this.key3 = key; + this.val3 = value; + } + + return this.hashMap.put(key, value); + } + + public V remove(Object key) { + if (key == this.key1) { + this.key1 = null; + this.val1 = null; + } else if (key == this.key2) { + this.key2 = null; + this.val2 = null; + } else if (key == this.key3) { + this.key3 = null; + this.val3 = null; + } + + return this.hashMap.remove(key); + } + + public void clear() { + this.key1 = null; + this.key2 = null; + this.key3 = null; + + this.val1 = null; + this.val2 = null; + this.val3 = null; + + this.hashMap.clear(); + } + } + @Retention(RetentionPolicy.RUNTIME) - @Target(ElementType.METHOD) + @Target({ ElementType.METHOD, ElementType.CONSTRUCTOR }) public static @interface Watched { public String value() default ""; public String prefix() default ""; diff --git a/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java b/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java index 500e1e8186..a015a089b2 100644 --- a/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java +++ b/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java @@ -19,114 +19,125 @@ package com.baidu.hugegraph.perf; -public class Stopwatch implements Cloneable { +import java.util.List; - private long lastStartTime = -1L; +public interface Stopwatch extends Cloneable { - private long totalCost = 0L; - private long minCost = 0L; - private long maxCost = 0L; + public Path id(); + public String name(); + public Path parent(); - private long times = 0L; + public void startTime(long startTime); + public void endTime(long startTime); - private String name; - private String parent; + public void lastStartTime(long startTime); - public Stopwatch(String name, String parent) { - this.name = name; - this.parent = parent; - } + public long times(); + public long totalTimes(); + public long totalChildrenTimes(); - public String id() { - return Stopwatch.id(this.parent, this.name); - } + public long totalCost(); + public void totalCost(long otherCost); - public static String id(String parent, String name) { - if (parent == null || parent.isEmpty()) { - return name; - } - return parent + "/" + name; - } + public long minCost(); + public long maxCost(); - public String name() { - return this.name; - } + public long totalWasted(); + public long totalSelfWasted(); + public long totalChildrenWasted(); - public String parent() { - return this.parent; - } + public void fillChildrenTotal(List children); - public void startTime(long time) { - assert this.lastStartTime == -1L; + public Stopwatch copy(); - this.lastStartTime = time; - this.times++; - } + public Stopwatch child(String name); + public Stopwatch child(String name, Stopwatch watch); - public void endTime(long time) { - assert time >= this.lastStartTime && this.lastStartTime != -1L; + public boolean empty(); + public void clear(); - long cost = time - this.lastStartTime; - this.totalCost += cost; - this.lastStartTime = -1L; - this.updateMinMax(cost); + public default String toJson() { + int len = 200 + this.name().length() + this.parent().length(); + StringBuilder sb = new StringBuilder(len); + sb.append("{"); + sb.append("\"parent\":\"").append(this.parent()).append("\""); + sb.append(",\"name\":\"").append(this.name()).append("\""); + sb.append(",\"times\":").append(this.times()); + sb.append(",\"total_cost\":").append(this.totalCost()); + sb.append(",\"min_cost\":").append(this.minCost()); + sb.append(",\"max_cost\":").append(this.maxCost()); + sb.append(",\"total_self_wasted\":").append(this.totalSelfWasted()); + sb.append(",\"total_children_wasted\":").append( + this.totalChildrenWasted()); + sb.append(",\"total_children_times\":").append( + this.totalChildrenTimes()); + sb.append("}"); + return sb.toString(); } - protected void updateMinMax(long cost) { - if (this.minCost > cost || this.minCost == 0L) { - this.minCost = cost; - } - if (this.maxCost < cost) { - this.maxCost = cost; + public static Path id(Path parent, String name) { + if (parent == Path.EMPTY && name == Path.ROOT_NAME) { + return Path.EMPTY; } + return new Path(parent, name); } - protected void totalCost(long totalCost) { - this.totalCost = totalCost; - } + public static final class Path implements Comparable { - public long totalCost() { - return this.totalCost; - } + public static final String ROOT_NAME = "root"; + public static final Path EMPTY = new Path(""); - public long minCost() { - return this.minCost; - } + private final String path; - public long maxCost() { - return this.maxCost; - } + public Path(String self) { + this.path = self; + } - public long times() { - return this.times; - } + public Path(Path parent, String name) { + if (parent == EMPTY) { + this.path = name; + } else { + int len = parent.length() + 1 + name.length(); + StringBuilder sb = new StringBuilder(len); + sb.append(parent.path).append('/').append(name); - public Stopwatch copy() { - try { - return (Stopwatch) super.clone(); - } catch (CloneNotSupportedException e) { - throw new RuntimeException(e); + this.path = sb.toString(); + } } - } - @Override - public String toString() { - return String.format( - "{totalCost:%sms, minCost:%sns, maxCost:%sns, times:%s}", - this.totalCost / 1000000.0F, - this.minCost, this.maxCost, - this.times); - } + public int length() { + return this.path.length(); + } - public String toJson() { - return String.format("{\"totalCost\":%s, " + - "\"minCost\":%s, \"maxCost\":%s, \"times\":%s, " + - "\"name\":\"%s\", \"parent\":\"%s\"}", - this.totalCost, - this.minCost, - this.maxCost, - this.times, - this.name, - this.parent); + @Override + public int hashCode() { + return this.path.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this.hashCode() != obj.hashCode()) { + return false; + } + if (!(obj instanceof Path)) { + return false; + } + Path other = (Path) obj; + return this.path.equals(other.path); + } + + @Override + public int compareTo(Path other) { + return this.path.compareTo(other.path); + } + + @Override + public String toString() { + return this.path; + } + + public boolean endsWith(String name) { + return this.path.endsWith(name); + } } } diff --git a/src/main/java/com/baidu/hugegraph/testutil/Assert.java b/src/main/java/com/baidu/hugegraph/testutil/Assert.java index 535f41e0c5..537e9d60ab 100644 --- a/src/main/java/com/baidu/hugegraph/testutil/Assert.java +++ b/src/main/java/com/baidu/hugegraph/testutil/Assert.java @@ -33,6 +33,11 @@ public interface ThrowableRunnable { void run() throws Throwable; } + @FunctionalInterface + public interface ThrowableConsumer { + void accept(T t) throws Throwable; + } + public static void assertThrows(Class throwable, ThrowableRunnable runnable) { assertThrows(throwable, runnable, e -> { diff --git a/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java b/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java index 7b0eca174b..c9092ff67c 100644 --- a/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java +++ b/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java @@ -98,13 +98,32 @@ public static Iterator classes(String... packages) public static List superClasses(String clazz) throws NotFoundException { CtClass klass = ClassPool.getDefault().get(clazz); - klass = klass.getSuperclass(); + CtClass parent = klass.getSuperclass(); List results = new LinkedList<>(); - while (klass != null) { - results.add(klass.getName()); - klass = klass.getSuperclass(); + while (parent != null) { + results.add(parent.getName()); + parent = parent.getSuperclass(); } return Lists.reverse(results); } + + public static List nestedClasses(String clazz) + throws NotFoundException { + CtClass klass = ClassPool.getDefault().get(clazz); + + List results = new LinkedList<>(); + for (CtClass nested : klass.getNestedClasses()) { + results.add(nested.getName()); + } + return results; + } + + public static String packageName(String clazz) { + int offset = clazz.lastIndexOf("."); + if (offset > 0) { + return clazz.substring(0, offset); + } + return ""; + } } diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java index 19b12b7938..e9e0732f89 100644 --- a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java +++ b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -49,6 +49,7 @@ import com.baidu.hugegraph.unit.license.LicenseVerifyParamTest; import com.baidu.hugegraph.unit.license.MachineInfoTest; import com.baidu.hugegraph.unit.perf.PerfUtilTest; +import com.baidu.hugegraph.unit.perf.StopwatchTest; import com.baidu.hugegraph.unit.rest.RestClientTest; import com.baidu.hugegraph.unit.rest.RestResultTest; import com.baidu.hugegraph.unit.util.BytesTest; @@ -83,6 +84,7 @@ BarrierEventTest.class, EventHubTest.class, PerfUtilTest.class, + StopwatchTest.class, RestClientTest.class, RestResultTest.class, VersionTest.class, diff --git a/src/test/java/com/baidu/hugegraph/unit/perf/PerfUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/perf/PerfUtilTest.java index f7a5c524ae..926d9c892e 100644 --- a/src/test/java/com/baidu/hugegraph/unit/perf/PerfUtilTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/perf/PerfUtilTest.java @@ -19,23 +19,25 @@ package com.baidu.hugegraph.unit.perf; -import java.io.IOException; import java.util.Map; import org.junit.After; import org.junit.Test; import com.baidu.hugegraph.perf.PerfUtil; -import com.baidu.hugegraph.testclass.TestClass.Foo; -import com.baidu.hugegraph.testclass.TestClass.Sub; import com.baidu.hugegraph.testutil.Assert; import com.baidu.hugegraph.unit.BaseUnitTest; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; +import com.baidu.hugegraph.unit.perf.testclass.TestClass; +import com.baidu.hugegraph.unit.perf.testclass.TestLightClass; +import com.baidu.hugegraph.unit.perf.testclass.TestPerfClass; +import com.baidu.hugegraph.unit.perf.testclass.TestPerfLightClass; +import com.baidu.hugegraph.unit.perf.testclass2.TestClass4Package; import com.fasterxml.jackson.databind.ObjectMapper; public class PerfUtilTest extends BaseUnitTest { + private static final String prefix = + "com.baidu.hugegraph.unit.perf.testclass."; private static final PerfUtil perf = PerfUtil.instance(); @After @@ -44,24 +46,42 @@ public void teardown() { } @Test - public void testPerfUtil() throws Exception { - /* - * TODO: call profilePackage("com.baidu.hugegraph.testclass") and - * remove class Foo. now exception "duplicate class definition" throws - * since JUnit loaded class TestClass before testPerfUtil() - */ - perf.profilePackage("com.baidu.hugegraph.testclass"); - perf.profileClass("com.baidu.hugegraph.testclass.TestClass$Foo"); - - Foo obj = new Foo(); + public void testPerfUtil() throws Throwable { + perf.profileClass(prefix + "TestClass$Foo"); + + TestClass.Foo obj = new TestClass.Foo(); obj.foo(); perf.toString(); perf.toECharts(); String json = perf.toJson(); - assertContains(json, "foo.times", 1); - assertContains(json, "foo/bar.times", 1); + assertContains(json, "foo.foo#times", 1); + assertContains(json, "foo.foo#name", "foo.foo"); + assertContains(json, "foo.foo#parent", ""); + assertContains(json, "foo.foo#total_cost"); + assertContains(json, "foo.foo#min_cost"); + assertContains(json, "foo.foo#max_cost"); + assertContains(json, "foo.foo#total_self_wasted"); + assertContains(json, "foo.foo#total_children_wasted", -1); + assertContains(json, "foo.foo#total_children_times", -1); + + assertContains(json, "foo.foo/foo.bar#times", 1); + assertContains(json, "foo.foo/foo.bar#name", "foo.bar"); + assertContains(json, "foo.foo/foo.bar#parent", "foo.foo"); + assertContains(json, "foo.foo/foo.bar#total_cost"); + assertContains(json, "foo.foo/foo.bar#min_cost"); + assertContains(json, "foo.foo/foo.bar#max_cost"); + assertContains(json, "foo.foo/foo.bar#total_self_wasted"); + assertContains(json, "foo.foo/foo.bar#total_children_wasted", -1); + assertContains(json, "foo.foo/foo.bar#total_children_times", -1); + + TestClass test = new TestClass(); + test.test(); + json = perf.toJson(); + assertContains(json, "foo.bar#times", 1); + assertContains(json, "foo.foo#times", 1); + assertContains(json, "foo.foo/foo.bar#times", 1); perf.clear(); @@ -72,16 +92,204 @@ public void testPerfUtil() throws Exception { perf.toECharts(); json = perf.toJson(); - assertContains(json, "foo.times", 2); - assertContains(json, "foo/bar.times", 2); + assertContains(json, "foo.foo#times", 2); + assertContains(json, "foo.foo/foo.bar#times", 2); } @Test - public void testPerfUtilWithProfileClass() throws Exception { - perf.profileClass("com.baidu.hugegraph.testclass.TestClass$Base"); - perf.profileClass("com.baidu.hugegraph.testclass.TestClass$Sub"); + public void testPerfUtil4LightStopwatch() throws Throwable { + perf.profileClass(prefix + "TestLightClass$Foo"); + + PerfUtil.useLightStopwatch(true); + + TestLightClass.Foo obj = new TestLightClass.Foo(); + obj.foo(); + + perf.toString(); + perf.toECharts(); + String json = perf.toJson(); + + assertContains(json, "foo.foo#times", 1); + assertContains(json, "foo.foo#name", "foo.foo"); + assertContains(json, "foo.foo#parent", ""); + assertContains(json, "foo.foo#total_cost"); + assertContains(json, "foo.foo#min_cost"); + assertContains(json, "foo.foo#max_cost"); + assertContains(json, "foo.foo#total_self_wasted"); + assertContains(json, "foo.foo#total_children_wasted", -1); + assertContains(json, "foo.foo#total_children_times", -1); + + assertContains(json, "foo.foo/foo.bar#times", 1); + assertContains(json, "foo.foo/foo.bar#name", "foo.bar"); + assertContains(json, "foo.foo/foo.bar#parent", "foo.foo"); + assertContains(json, "foo.foo/foo.bar#total_cost"); + assertContains(json, "foo.foo/foo.bar#min_cost"); + assertContains(json, "foo.foo/foo.bar#max_cost"); + assertContains(json, "foo.foo/foo.bar#total_self_wasted"); + assertContains(json, "foo.foo/foo.bar#total_children_wasted", -1); + assertContains(json, "foo.foo/foo.bar#total_children_times", -1); + + perf.clear(); + + obj.foo(); + obj.foo(); + + perf.toString(); + perf.toECharts(); + json = perf.toJson(); - Sub obj = new Sub(); + assertContains(json, "foo.foo#times", 2); + assertContains(json, "foo.foo/foo.bar#times", 2); + + perf.clear(); + PerfUtil.useLightStopwatch(false); + } + + @Test + public void testPerfUtil4LightStopwatcAndSwitch() throws Throwable { + perf.profileClass(prefix + "TestLightClass$Bar"); + + TestLightClass.Bar bar = new TestLightClass.Bar(); + bar.foo(); + + perf.toString(); + perf.toECharts(); + String json = perf.toJson(); + + assertContains(json, "bar.foo#times", 1); + assertContains(json, "bar.foo/bar.bar#times", 1); + + PerfUtil.useLightStopwatch(false); + bar.foo(); + json = perf.toJson(); + + assertContains(json, "bar.foo#times", 2); + assertContains(json, "bar.foo/bar.bar#times", 2); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + PerfUtil.useLightStopwatch(true); + }, e -> { + Assert.assertContains("clear() before switching light-stopwatch", + e.getMessage()); + }); + + // Test switch from normal-watch to light-watch + perf.clear(); + PerfUtil.useLightStopwatch(true); + bar.foo(); + + perf.toString(); + perf.toECharts(); + json = perf.toJson(); + + assertContains(json, "bar.foo#times", 1); + assertContains(json, "bar.foo/bar.bar#times", 1); + + bar.foo(); + json = perf.toJson(); + + assertContains(json, "bar.foo#times", 2); + assertContains(json, "bar.foo/bar.bar#times", 2); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + PerfUtil.useLightStopwatch(false); + }, e -> { + Assert.assertContains("clear() before switching light-stopwatch", + e.getMessage()); + }); + + // Test switch from light-watch to normal-watch + perf.clear(); + PerfUtil.useLightStopwatch(false); + bar.foo(); + + perf.toString(); + perf.toECharts(); + json = perf.toJson(); + + assertContains(json, "bar.foo#times", 1); + assertContains(json, "bar.foo/bar.bar#times", 1); + } + + @Test + public void testPerfUtilWithSingleThread() throws Throwable { + perf.profileClass(prefix + "TestClass$Bar"); + PerfUtil.profileSingleThread(true); + + TestClass.Bar obj = new TestClass.Bar(); + obj.foo(); + perf.toString(); + perf.toECharts(); + String json = perf.toJson(); + + assertContains(json, "bar_foo#times", 1); + assertContains(json, "bar_foo/bar_bar#times", 1); + + perf.clear(); + + obj.foo(); + obj.foo(); + + perf.toString(); + perf.toECharts(); + json = perf.toJson(); + + assertContains(json, "bar_foo#times", 2); + assertContains(json, "bar_foo/bar_bar#times", 2); + + PerfUtil.profileSingleThread(false); + + obj.foo(); + + perf.toString(); + perf.toECharts(); + json = perf.toJson(); + + assertContains(json, "bar_foo#times", 3); + assertContains(json, "bar_foo/bar_bar#times", 3); + } + + @Test + public void testPerfUtilWithProfilePackage() throws Throwable { + perf.profilePackage("com.baidu.hugegraph.unit.perf.testclass2"); + + TestClass4Package.Foo obj = new TestClass4Package.Foo(); + obj.foo(); + + perf.toString(); + perf.toECharts(); + String json = perf.toJson(); + + assertContains(json, "foo#times", 1); + assertContains(json, "foo/bar#times", 1); + + TestClass4Package test = new TestClass4Package(); + test.test(); + json = perf.toJson(); + assertContains(json, "test#times", 1); + assertContains(json, "test/bar#times", 1); + assertContains(json, "foo#times", 1); + assertContains(json, "foo/bar#times", 1); + + perf.clear(); + + obj.foo(); + obj.foo(); + + perf.toString(); + perf.toECharts(); + json = perf.toJson(); + + assertContains(json, "foo#times", 2); + assertContains(json, "foo/bar#times", 2); + } + + @Test + public void testPerfUtilWithProfileParentClass() throws Throwable { + perf.profileClass(prefix + "TestClass$Base"); + perf.profileClass(prefix + "TestClass$Sub"); + + TestClass.Sub obj = new TestClass.Sub(); obj.func(); obj.func1(); obj.func2(); @@ -89,17 +297,166 @@ public void testPerfUtilWithProfileClass() throws Exception { obj.func3(); obj.func3(); + perf.toString(); + perf.toECharts(); + String json = perf.toJson(); + assertContains(json, "func#times", 1); + assertContains(json, "func1#times", 1); + assertContains(json, "func3#times", 3); + } + + @Test + public void testPerfUtilWithProfileManually() throws Throwable { + perf.profileClass(prefix + "TestClass$ManuallyProfile"); + + TestClass.ManuallyProfile obj = new TestClass.ManuallyProfile(); + + obj.foo(); + + perf.toString(); + perf.toECharts(); + String json = perf.toJson(); + + assertContains(json, "manu-foo#times", 1); + assertContains(json, "manu-foo/manu-bar#times", 1); + assertContains(json, "manu-foo/manu-bar2#times", 1); + + obj.foo(); + obj.bar(); + + perf.toString(); + perf.toECharts(); + json = perf.toJson(); + + assertContains(json, "manu-foo#times", 2); + assertContains(json, "manu-foo/manu-bar#times", 2); + assertContains(json, "manu-bar#times", 1); + + obj.foo2(); + obj.bar2(); + + perf.toString(); + perf.toECharts(); + json = perf.toJson(); + + assertContains(json, "manu-foo2#times", 1); + assertContains(json, "manu-foo2/manu-bar#times#times", 1); + assertContains(json, "manu-foo2/manu-bar2#times#times", 1); + assertContains(json, "manu-foo#times", 2); + assertContains(json, "manu-foo/manu-bar#times", 2); + assertContains(json, "manu-bar#times", 1); + assertContains(json, "manu-bar2#times", 1); + } + + @Test + public void testPerfUtilPerf() throws Throwable { + perf.profileClass(prefix + "TestPerfClass"); + perf.profileClass(prefix + "TestPerfClass$Foo"); + + PerfUtil.profileSingleThread(true); + PerfUtil.useLocalTimer(true); + + int times = 10000000; + TestPerfClass test = new TestPerfClass(); + test.test(times); + test.testNew(); + + perf.toString(); + perf.toECharts(); + String json = perf.toJson(); + + assertContains(json, "testNew#times", 1); + assertContains(json, "test/testNew#times", times); + assertContains(json, "test/testNewAndCall#times", times); + assertContains(json, "test/testCall#times", times); + assertContains(json, "test/testCallFooThenSum#times", times); + + assertContains(json, "test/testNewAndCall/sum#times", times); + assertContains(json, "test/testCall/sum#times", times); + assertContains(json, "test/testCallFooThenSum/foo#times", times); + assertContains(json, "test/testCallFooThenSum/foo/sum#times", times); + + // Test call multi-times and Reset false + PerfUtil.profileSingleThread(true); + PerfUtil.profileSingleThread(true); + PerfUtil.profileSingleThread(false); + PerfUtil.profileSingleThread(false); + PerfUtil.useLocalTimer(true); + PerfUtil.useLocalTimer(true); + PerfUtil.useLocalTimer(false); + PerfUtil.useLocalTimer(false); + + test.testNew(); + json = perf.toJson(); + assertContains(json, "testNew#times", 2); + } + + @Test + public void testPerfUtilPerf4LightStopwatch() throws Throwable { + perf.profileClass(prefix + "TestPerfLightClass"); + perf.profileClass(prefix + "TestPerfLightClass$Foo"); + + PerfUtil.profileSingleThread(true); + PerfUtil.useLightStopwatch(true); + PerfUtil.useLocalTimer(true); + + int times = 10000000; + TestPerfLightClass test = new TestPerfLightClass(); + test.test(times); + test.testNew(); + + perf.toString(); + perf.toECharts(); String json = perf.toJson(); - assertContains(json, "func.times", 1); - assertContains(json, "func1.times", 1); - assertContains(json, "func3.times", 3); + + assertContains(json, "testNew#times", 1); + assertContains(json, "test/testNew#times", times); + assertContains(json, "test/testNewAndCall#times", times); + assertContains(json, "test/testCall#times", times); + assertContains(json, "test/testCallFooThenSum#times", times); + + assertContains(json, "test/testNewAndCall/sum#times", times); + assertContains(json, "test/testCall/sum#times", times); + assertContains(json, "test/testCallFooThenSum/foo#times", times); + assertContains(json, "test/testCallFooThenSum/foo/sum#times", times); + + // Test reset and call multi-times + PerfUtil.profileSingleThread(true); + PerfUtil.profileSingleThread(true); + PerfUtil.profileSingleThread(false); + PerfUtil.profileSingleThread(false); + + PerfUtil.useLocalTimer(true); + PerfUtil.useLocalTimer(true); + PerfUtil.useLocalTimer(false); + PerfUtil.useLocalTimer(false); + + perf.clear(); + PerfUtil.useLightStopwatch(false); + PerfUtil.useLightStopwatch(false); + + test.testNew(); + json = perf.toJson(); + assertContains(json, "testNew#times", 1); + } + + private static void assertContains(String json, String key) + throws Exception { + Assert.assertNotNull("Not exist key " + key, actualValue(json, key)); } private static void assertContains(String json, String key, Object value) - throws JsonParseException, JsonMappingException, IOException { + throws Exception { + String error = String.format("not contains key '%s' with value <%s> " + + "in json: %s.\n", key, value, json); + Assert.assertEquals(error, value, actualValue(json, key)); + } + + private static Object actualValue(String json, String key) + throws Exception { ObjectMapper mapper = new ObjectMapper(); Map map = mapper.readValue(json, Map.class); - String[] keys = key.split("\\."); + String[] keys = key.split("#"); Object actual = null; for (String k : keys) { actual = map.get(k); @@ -107,6 +464,6 @@ private static void assertContains(String json, String key, Object value) map = (Map) actual; } } - Assert.assertEquals(value, actual); + return actual; } } diff --git a/src/test/java/com/baidu/hugegraph/unit/perf/StopwatchTest.java b/src/test/java/com/baidu/hugegraph/unit/perf/StopwatchTest.java new file mode 100644 index 0000000000..53d5e60a21 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/perf/StopwatchTest.java @@ -0,0 +1,104 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.perf; + +import org.junit.Test; + +import com.baidu.hugegraph.perf.LightStopwatch; +import com.baidu.hugegraph.perf.NormalStopwatch; +import com.baidu.hugegraph.perf.Stopwatch; +import com.baidu.hugegraph.perf.Stopwatch.Path; +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.unit.BaseUnitTest; + +public class StopwatchTest extends BaseUnitTest { + + @Test + public void testNormalStopwatchChild() { + Stopwatch watch1 = new NormalStopwatch("w1", Path.EMPTY); + + Stopwatch watch2 = new NormalStopwatch("w2", watch1); + Stopwatch watch3 = new NormalStopwatch("w3", watch1); + Stopwatch watch4 = new NormalStopwatch("w4", watch1); + Stopwatch watch5 = new NormalStopwatch("w5", watch1); + + Assert.assertEquals(watch2, watch1.child("w2")); + Assert.assertEquals(watch3, watch1.child("w3")); + Assert.assertEquals(watch4, watch1.child("w4")); + Assert.assertEquals(watch5, watch1.child("w5")); + + Assert.assertEquals(watch2, watch1.child("w2", null)); + Assert.assertEquals(watch3, watch1.child("w3", null)); + Assert.assertEquals(watch4, watch1.child("w4", null)); + Assert.assertEquals(watch5, watch1.child("w5", null)); + + Assert.assertEquals(null, watch1.child("w2")); + Assert.assertEquals(null, watch1.child("w3")); + Assert.assertEquals(null, watch1.child("w4")); + Assert.assertEquals(null, watch1.child("w5")); + + Assert.assertEquals(null, watch1.child("w2", watch2)); + Assert.assertEquals(null, watch1.child("w3", watch3)); + Assert.assertEquals(null, watch1.child("w4", watch4)); + Assert.assertEquals(null, watch1.child("w5", watch5)); + + watch1.clear(); + Assert.assertEquals(null, watch1.child("w2")); + Assert.assertEquals(null, watch1.child("w3")); + Assert.assertEquals(null, watch1.child("w4")); + Assert.assertEquals(null, watch1.child("w5")); + } + + @Test + public void testLightStopwatchChild() { + Stopwatch watch1 = new LightStopwatch("w1", Path.EMPTY); + + Stopwatch watch2 = new LightStopwatch("w2", watch1); + Stopwatch watch3 = new LightStopwatch("w3", watch1); + Stopwatch watch4 = new LightStopwatch("w4", watch1); + Stopwatch watch5 = new LightStopwatch("w5", watch1); + + Assert.assertEquals(watch2, watch1.child("w2")); + Assert.assertEquals(watch3, watch1.child("w3")); + Assert.assertEquals(watch4, watch1.child("w4")); + Assert.assertEquals(watch5, watch1.child("w5")); + + Assert.assertEquals(watch2, watch1.child("w2", null)); + Assert.assertEquals(watch3, watch1.child("w3", null)); + Assert.assertEquals(watch4, watch1.child("w4", null)); + Assert.assertEquals(watch5, watch1.child("w5", null)); + + Assert.assertEquals(null, watch1.child("w2")); + Assert.assertEquals(null, watch1.child("w3")); + Assert.assertEquals(null, watch1.child("w4")); + Assert.assertEquals(null, watch1.child("w5")); + + Assert.assertEquals(null, watch1.child("w2", watch2)); + Assert.assertEquals(null, watch1.child("w3", watch3)); + Assert.assertEquals(null, watch1.child("w4", watch4)); + Assert.assertEquals(null, watch1.child("w5", watch5)); + + watch1.clear(); + Assert.assertEquals(null, watch1.child("w2")); + Assert.assertEquals(null, watch1.child("w3")); + Assert.assertEquals(null, watch1.child("w4")); + Assert.assertEquals(null, watch1.child("w5")); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestClass.java b/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestClass.java new file mode 100644 index 0000000000..4288824a9e --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestClass.java @@ -0,0 +1,107 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.perf.testclass; + +import com.baidu.hugegraph.perf.PerfUtil; +import com.baidu.hugegraph.perf.PerfUtil.Watched; + +public class TestClass { + + @Watched + public void test() { + new Foo().bar(); + } + + public static class Foo { + + @Watched(prefix="foo") + public void foo() { + this.bar(); + } + + @Watched(prefix="foo") + public void bar() {} + } + + public static class Bar { + + @Watched("bar_foo") + public void foo() { + this.bar(); + } + + @Watched("bar_bar") + public void bar() {} + } + + public static class ManuallyProfile { + + public void foo() { + PerfUtil.instance().start("manu-foo"); + this.bar(); + this.bar2(); + PerfUtil.instance().end("manu-foo"); + } + + public void bar() { + PerfUtil.instance().start("manu-bar"); + try { + Thread.sleep(0); + } catch (InterruptedException ignored) { + // pass + } + PerfUtil.instance().end("manu-bar"); + } + + public void foo2() { + PerfUtil.instance().start2("manu-foo2"); + this.bar(); + this.bar2(); + PerfUtil.instance().end("manu-foo2"); + } + + public void bar2() { + PerfUtil.instance().start2("manu-bar2"); + try { + Thread.sleep(0); + } catch (InterruptedException ignored) { + // pass + } + PerfUtil.instance().end("manu-bar2"); + } + } + + public static class Base { + + @Watched + public void func() {} + } + + public static class Sub extends Base { + + @Watched + public void func1() {} + + public void func2() {} + + @Watched + public void func3() {} + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestLightClass.java b/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestLightClass.java new file mode 100644 index 0000000000..47ec3f1b77 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestLightClass.java @@ -0,0 +1,52 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.perf.testclass; + +import com.baidu.hugegraph.perf.PerfUtil.Watched; + +public class TestLightClass { + + @Watched + public void test() { + new Foo().bar(); + } + + public static class Foo { + + @Watched(prefix="foo") + public void foo() { + this.bar(); + } + + @Watched(prefix="foo") + public void bar() {} + } + + public static class Bar { + + @Watched(prefix="bar") + public void foo() { + this.bar(); + } + + @Watched(prefix="bar") + public void bar() {} + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfClass.java b/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfClass.java new file mode 100644 index 0000000000..9ac381a4ad --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfClass.java @@ -0,0 +1,74 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.perf.testclass; + +import com.baidu.hugegraph.perf.PerfUtil.Watched; + +public class TestPerfClass { + + private Foo foo = new Foo(); + + @Watched + public void test(int times) { + for (int i = 0; i < times; i++) { + this.testNew(); + this.testNewAndCall(); + this.testCall(); + this.testCallFooThenSum(); + } + } + + @Watched + public void testNew() { + new Foo(); + } + + @Watched + public void testNewAndCall() { + new Foo().sum(1, 2); + } + + @Watched + public void testCall() { + this.foo.sum(1, 2); + } + + @Watched + public void testCallFooThenSum() { + this.foo.foo(); + } + + public static class Foo { + + @Watched + public void foo() { + this.sum(1, 2); + } + + @Watched + public int sum(int a, int b) { + int sum = a; + for (int i = 0; i < 100; i++) { + sum += i; + } + return sum + b; + } + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfLightClass.java b/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfLightClass.java new file mode 100644 index 0000000000..389ef23009 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfLightClass.java @@ -0,0 +1,74 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.perf.testclass; + +import com.baidu.hugegraph.perf.PerfUtil.Watched; + +public class TestPerfLightClass { + + private Foo foo = new Foo(); + + @Watched + public void test(int times) { + for (int i = 0; i < times; i++) { + this.testNew(); + this.testNewAndCall(); + this.testCall(); + this.testCallFooThenSum(); + } + } + + @Watched + public void testNew() { + new Foo(); + } + + @Watched + public void testNewAndCall() { + new Foo().sum(1, 2); + } + + @Watched + public void testCall() { + this.foo.sum(1, 2); + } + + @Watched + public void testCallFooThenSum() { + this.foo.foo(); + } + + public static class Foo { + + @Watched + public void foo() { + this.sum(1, 2); + } + + @Watched + public int sum(int a, int b) { + int sum = a; + for (int i = 0; i < 100; i++) { + sum += i; + } + return sum + b; + } + } +} diff --git a/src/test/java/com/baidu/hugegraph/testclass/TestClass.java b/src/test/java/com/baidu/hugegraph/unit/perf/testclass2/TestClass4Package.java similarity index 76% rename from src/test/java/com/baidu/hugegraph/testclass/TestClass.java rename to src/test/java/com/baidu/hugegraph/unit/perf/testclass2/TestClass4Package.java index 0fe47a1b6d..b86890768f 100644 --- a/src/test/java/com/baidu/hugegraph/testclass/TestClass.java +++ b/src/test/java/com/baidu/hugegraph/unit/perf/testclass2/TestClass4Package.java @@ -17,13 +17,31 @@ * under the License. */ -package com.baidu.hugegraph.testclass; +package com.baidu.hugegraph.unit.perf.testclass2; import com.baidu.hugegraph.perf.PerfUtil.Watched; -public class TestClass { +public class TestClass4Package { - public static class Foo { + @Watched + public void test() { + new Foo().bar(); + } + + public static class Foo extends FooBase { + + @Watched + public void foo() { + this.bar(); + } + + @Watched + public void bar() {} + } + + public static class FooBase {} + + public static class Bar { @Watched public void foo() { diff --git a/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java index df8afcbb77..7031a447f8 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java @@ -27,10 +27,14 @@ import org.junit.Test; import com.baidu.hugegraph.perf.PerfUtil.Watched; -import com.baidu.hugegraph.testclass.TestClass.Base; -import com.baidu.hugegraph.testclass.TestClass.Sub; import com.baidu.hugegraph.testutil.Assert; import com.baidu.hugegraph.unit.BaseUnitTest; +import com.baidu.hugegraph.unit.perf.testclass.TestClass; +import com.baidu.hugegraph.unit.perf.testclass.TestClass.Bar; +import com.baidu.hugegraph.unit.perf.testclass.TestClass.Base; +import com.baidu.hugegraph.unit.perf.testclass.TestClass.Foo; +import com.baidu.hugegraph.unit.perf.testclass.TestClass.ManuallyProfile; +import com.baidu.hugegraph.unit.perf.testclass.TestClass.Sub; import com.baidu.hugegraph.util.ReflectionUtil; import com.google.common.reflect.ClassPath.ClassInfo; @@ -111,4 +115,48 @@ public void testSuperClasses() throws NotFoundException { Assert.assertEquals(Base.class.getName(), classes.get(0)); Assert.assertEquals(Object.class.getName(), classes.get(1)); } + + @Test + public void testNestedClasses() throws NotFoundException { + List classes = ReflectionUtil.nestedClasses( + TestClass.class.getName()); + Assert.assertEquals(5, classes.size()); + classes.sort((c1, c2) -> c1.compareTo(c2)); + Assert.assertEquals(Bar.class.getName(), classes.get(0)); + Assert.assertEquals(Base.class.getName(), classes.get(1)); + Assert.assertEquals(Foo.class.getName(), classes.get(2)); + Assert.assertEquals(ManuallyProfile.class.getName(), classes.get(3)); + Assert.assertEquals(Sub.class.getName(), classes.get(4)); + } + + @Test + public void testPackageName() { + String clazz = "com.baidu.hugegraph.unit.perf.testclass2.Test"; + Assert.assertEquals("com.baidu.hugegraph.unit.perf.testclass2", + ReflectionUtil.packageName(clazz)); + + clazz = "com.baidu.hugegraph.unit.perf.testclass2.Test$Bar"; + Assert.assertEquals("com.baidu.hugegraph.unit.perf.testclass2", + ReflectionUtil.packageName(clazz)); + + clazz = "com.baidu.hugegraph.unit.perf.testclass.Test$Bar"; + Assert.assertEquals("com.baidu.hugegraph.unit.perf.testclass", + ReflectionUtil.packageName(clazz)); + + clazz = "com.baidu.hugegraph.unit.perf.testclass..Test$Bar"; + Assert.assertEquals("com.baidu.hugegraph.unit.perf.testclass.", + ReflectionUtil.packageName(clazz)); + + clazz = "com"; + Assert.assertEquals("", ReflectionUtil.packageName(clazz)); + + clazz = "com."; + Assert.assertEquals("com", ReflectionUtil.packageName(clazz)); + + clazz = "Test"; + Assert.assertEquals("", ReflectionUtil.packageName(clazz)); + + clazz = ".Test"; + Assert.assertEquals("", ReflectionUtil.packageName(clazz)); + } } From aecaf4e86ad0f140bc5a56063665fe40d5318e91 Mon Sep 17 00:00:00 2001 From: shzcore Date: Thu, 15 Apr 2021 16:54:02 +0800 Subject: [PATCH 142/217] remove inner hostname from cacerts.jks (#72) --- src/test/resources/cacerts.jks | Bin 110281 -> 939 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/test/resources/cacerts.jks b/src/test/resources/cacerts.jks index ab9a1253c3a4ec9356aa323c4f2ae9df5c69b548..d1c57e050dc7076e8df3c948016d80ec01f2e9b7 100644 GIT binary patch literal 939 zcmezO_TO6u1_mY|W(3om8Kvo|=|zbJ89!;MW#iOp^Jx3d%gD&h%3zRe$Zf#M#vIDRCd}mI1>M?ZweIbyqWsMZPS(9GyaQ{ zCao@Jy_m^=bffyo9TL-)xmf(1;E*cx`MLSEC;G?M9I;!hr~B$a^oGW#v+w=XcD<9y zZgqCPY2^p)BeO4S3YagnaL`^@D;l$>K$%yu`yBIz3Ad+4v`Np<+s&oY>h|Wq?}}r) zZ8n~ed$I2MdDgv$#Akec%jGa*na`~iIUN7*IZf0ox$WVT`9(N?Z;u~O#4|p|6M5Hr zO567*&bFDpZO##G>6faj^h=hle9gqn$iTQ*(Lmln78ud8d@N!tB3ENK*6$BJ(8089 zV*Ifdh7D5l)Vz=b5txF2fyl_<^uF%?j*C;@&iiUVfrHmhBX!4GtL&JrD)}RNM*Nd} zW-!@x6=_XTla9Jzt5#FmnR6j_$?>TZ6l2{kHvTtnX>UIGhCPj^zOzvA=Hf6oZZo8Dd=R9#-;^{VtH=db0)y@egqH(48$2Rp20 z`L^=$!!1E_8~kqHn8>boc)~gMrKusCvRON{bx%tzXnxPL-f>x!Q73D7Y)svBtFHh; CGhpNZ literal 110281 zcmeFa1yoh-);3Icce4TM+M5Om>6Y&9?naQ5kdzK-kOpaxR2o6LrAs6w3=sS`V4%-A z=XuZg-}n6Q_l@5%7`hf~uXXRe=XK3FuQ})K<=*8U1Ox;W_{aGAZvuBSXDb&g3wsk= zBNrDo3pNuYfR44PjUEI9r1~rA?qCR5O%_fdF9ZZMJTMR%8W;#=3xx^M#A-MgmX+fz zf!L_yX#2Plhzf_u5F!=w2^A6&78U{+@DhX!M1+G@gMq__Qd0rp197hokg(Cz!Ov3x zKaU9@ZEwN?;s^3w{Q?=AUG!=J05*W4o3X8x2|&@=%Ff8y3m|Id>}q9hWn$!N!_)cX?X<72z~5<` zfpXs<855Q|QzN7m(_kuj`SYX-FPI~2-j@$jULY{Ndlih$RARM_c+y)8l`ry&N#kV*@Gx_Kh!nQ6Bp5pvcP(yw|{-BmduL89G{3;c#^d&-Pv_r}iy3K|ju z^7it;h6N2?mov*3ztIm)=Utf}yY-bG-%Dw<{G3h_G_#t~`fV>~)BHUv;>p1D`vS(q zk9Q11aT#zXJyshxif56L&)5{r8w5B8`aWkl&g z%@%7dLTP_YWI&7Jk$EiL)6xUY18<-<_Yl#3)lYv!9DuInjxm*e=a6}k>&TX#H%|n3 z4~P!_m`Jf9A-}=E0-?cw0nx5bpkJMU0e?{;*Ze?=27?EK^LnJUcqIi^DMy|=H^}Qv z6e+`c@a=C6+5!S-3I(Lj4-kj4!IE`zRp_Hyb3Af$Ui1k+9Dd?#l&Oyqr={K$)Qhpj zv#m+P;)ZP_=r%?-BeU&Q@?`1=clq`du=U9ol`Bsv6`VUVB#At51pjkxuzAUWoZ zr*YH2X=+DOQB4^}KbekA3G&|5B;<+g{e6O`>Zb%-YwvXARpx4SNk(`&m zS`7Z_JG3)-nJ$VYdZQRNN~6H;P;&c79|JsqlGv!Dg2wwblC?pvea#uPS2g1C9ZXwk z_>2!AxV?qhJy+OQk1>e+LYdk=o_-Qp-DnRr4mW_1UFu#~cN1e1<|A{mw|b52CV?ZohSkrz-645<7& zki!A(;1C$$z%dIvBnpfX&>%-ITL-8G)BvjCA%X)C3o}*=D{~+PkQ@jP<|j00C?Xh~ zn2m9wkg}*~o6cc>>j^0WrU!&9Kx#ZHOIKG%K2}y+2MY(59}vBwWL9^V>vLCkx{5h& zIHlg>%t}f!O9gB4)q8k0clgm{c*5IXD;SC3uN4wP=JV(0(3?ya57rYrOa|@czWAb{ zzU^z`Y;sgEIlFUa8x$#-ao6NH?Tb5G;*%Wgkpl zH_DM}#mXGS;?a?7S74k6DDt4#4t@~mJT+OXS)=H`!@GTfYc6p@j5#9jlIJV&MPRSU zz8LR!zF~JL(C7otrb2QGgLc$4n@+5e8BM{q$_w9G=;5Y&`(s7{6Q1$!eE0ABT(EuIa23H% zpL-okg5%8_hs*J|4);H?hCryl5(m^3aX^8I0}2wNeKXd@axMxu1ZNBf(Cskywp^>Gk8I8i&pil^$ zRo@?Yptn}uub{udxdnPX7q9;|I>vvl{z=NcSg%gc-ukMpI%@(RXpE?t3GRFrSl_VI zKtYTrj-_gW!fey?FfI)CPau6LhStBF+#?N9SOB#Ms_>wv)xOwFc5>jB#E6dpD3!UF&mowjwT}=nS>2X zs!RyP5{cZ6AAaoed1d9Z>gxGae=4l8>C5kjXBEK^H*D#-XY-BtqfUl(<0# z;A;+9cSlTa)k7qj)YEk<))Z3a)7j!`(hcGp;`}#bquuGXz%eI1Q@JG;3!$wSDHSB> z3V#3$`pUSPjb?p|ZQJm>o)CBD5>7?s2wBie;xG^>yoHhd4#Mq$o@8v}!IKZ@8m7O^BF^ z(+E|K;oiYiMk4eZc|*AX;px$*rnB#9aw2f1hn` zxIo;T?Cfk;`O)pe|L({A9W&QcCVb78s(dGDgLF>ozJ4V1_^!7M6Nn))>UnV|$fn4{ zJ(#AxEIXtfyL$@`HrGFJWh*Dk^pEfCLT z81Ge=t=yG;#hkI8lfFyDM|Ox%GqQe%6F%!{ZNIYJJp4dRoz7v zPD4|BJ&HK3G!qr&2#KASk{2nN7>dEQ(vwOl&4zeA%f)}o(~AZp+7jpl;zGAvwQHmDAMU}5}A$&NrXD98Zk)@OI zQqVdV-3-|uU8sUFh#|LrG4t<9D%@WK++Pvqn$vRTOrgl^ywek#g!rA#yiuIIKVWms z%#vpdNY62!@RZBzecC`vRwWFS3RR6PF-@J(z6^ux)+|V^qEe-5uqFj)Y(N?dQfayqp8 zd|&c>>d}6;<~_oE(!wvYqTFvSwH1bUUYWWs*5b~dsHzgNl1wK%sm4an0y0z>{Yqn2 z-ve6|xeq=_*7^D{!R%UQ)JltCoH)ypm~MUDw257?^0m5vP%mgGt1oXD5QIE18M+4;LRi~!b#Rexy1@YrZ7Mz*d1IU^f0fGAkv1(5+sZa5rQ)zS>0rXsGas;s7> z`a_@veUG}4u?fCsURPS!)qA*hFxO%jDUkSv@^REu?=xTBLgMQEF)LiZ!7G;MV?7}egtL^JWj4I zA^9pimc#Y>T;R!ztyxFTv-Pdm&h)(WasE@RRFA3##AVA(lE&i%lQ3)ROJw){wiC*A zi>6W{eUF!q;1^JB+xOvmJ*~_Y?3NzCLQpFYO`$Elk&st{)yO;l)%d$4}=> zgy+Dsw68#7iI5Sk%p`Kmn|jfGd%=SFYU7u<93B_5B(g1%vP;SLqpuYD*%nf5nz_d#0{9PjUE5 z7gCE`b?D?H`1@yoB3Caahq(&`n?*KfHhT!@yQ!Ht+x~89tpCWsSiqM7>96iV4MPb8 z{E!-;p@04h0S*Z)Kfpi+aw9>*`~jQm^dEs-xr$rNbN=E@(_CUwN{O1Of1UQd1&V_1 zm&XQ7a($B8R`1^(a&n%GP#^a_%MX=lC9ZNoXr1UBsON0f3h@9975d{;U>|&~lKNsp zP0g%S&txb5GNtdax}M;^=zT#O+UOBJ*+<9*<9pVHZm&nRLs@yI^%i52-C)KpPORIH>(&y04(+$ymW>tTHFVF&by&v(=e4mt3o%>@-D`c0g8K*o*6 zO~)$bwsnlTSS5rCh;#Z|@jcNv2$zRIe}e3gNAi8X(-F{@_LHA7@XF$tvZ*$nK2au5 zSi(8yGA(g_v-;n|9|I!~tg|AgcFiU`SM$YdF zIvek;!~d?w{9R=D3|B2XuV~O7JC^YvmNCc~ zL1@zns^cQ;*&L)~;_eFy0|eZ=k8r&S5x!3LK0Q1tX2B?q+Z50gD8{qoXLX|>@T2o6 zSTVwHc((nSEOp++{sbwP!ghbIQV;TBuG>|* zRJ)Uwk5qeF5asidC?Q*@2VL;!p}tu-Y-UU%Uwpu(d_me=2bWV#pa8%|(h*6tLXwUo*R7=7?cg?@5=hub zUOAtzsM@wnf!_E{KHJ*@?LV61ttYTvkSlYdl)QZhkN{) zEOdfaH0<3EZm7-#X!I|+t(m3dIZ9&~jgqUb9rSp|OpN!`wPZy~1w#PD^T(O{M;H7a zYKHuUoxn*w$aAx|ZmBWhUcXaU5$CQ1>8nS_bebX0k-tV)^Tvp&m6`_YS{09^@$jE* zkaKQ`t@(Q;Smrl(WeKcs3;`t~R2dTs4n7H`248S)4ug8$TDKQYQz5LR=yz%(xEDXG z^k8i;Y!#ERK1lxNlK3+EUHth4s9{$F6H`1L_<<;l_oV`VA;e_w*HSxwO2-0}Wjz>r zsPos^Pey&FIv*-dW@xqv^XxRa@#D^>_saxnbByX;t`4Ba)r|47g2)lt4#y6M+R93_FAZLGmQB8V?H*` z1~^1gF+_4(HIgLJa^j4DeW|6b1;l8AqPcrfaWt4JMlO0gty^94^xQ@}WxUK5EO=9= z5J8V}2L0T-eAgRf%@3f(4Xx@?l#}9u^`GU{|Zdsjn52e5s;eru&%I+&rYr^2xW^O%)RK2wf{PB$_@lj!r$L z2h+t*;c~bZCc_h2X4jcf^bu_ll6~?7eB!?e<=_+!*Xixd&y#eyFNHO=io+%nSA3PQ zmaCLndsBfv_Hbv@_NhXEwYO9JLaCR!vFNY+gw8hER-%X<@;9SrzR*iO ze&ce$TnPOSEa9INK^F>Vn;$nKpCkKGj2*VM zxg4|W5w&oj*!bnF+;$bFp)_$}J3jQv<7J?J5+1}fu`;G_ zk?pztZ9!W?0L`F45algLwnA7kqs+XWNQlWUCt+NXVYJPgVNr^Y3QfLbvMrj&qkkBz zLX26kEj_dG%Z38-n(MqWjcUwPd|Narox9ijc2wFAAF{D8B<6l(7-Lad@#F4Mh}O@l zt7#iLJ~g!X*H%YjYUbwZVq$6LYG!L@<6w7F17*8i6QE81X?M_h;E*5-YK!vdN= z=nUv|%htriK_oz;o3H>|?E7;7sy7b;2ut2-9#Lh!It|v3zITs^g7qykXAl*T;>PfZ z{_^r4A`{!K^n(oqx-L}Sq#suuCg8*WFP8LonMEmb9_MldJx&$Qqe^~^bzTQfJ(-Gy z_eN2P(kBk4c|_oXUGY82;Ms|S4bONqOUUvjd0oCY@{q&lRVF`#R_W;+$|)N^W0~UIROez)!axy9DjOPtl)8@f z`P_=8CZx21voJp{9Ava!c}Zh@?NH`U;X7+)WsZ5i16?HC42V*rwtIqu8ncw`i*3-pn zKi+*l#7mgMw(*|AC>C5tjOM8N#L6l22xD&RF*ikN3RnWI1gGk zR`SNjUoN{}%y6v-?QWShw3}!jOH>9Va8C$FPEk#f4WC*Pi<#tVzbNF?%Gq#)O-G~B zNKHVpd%4W7+RK(`TXbp8|3P#0h{e*ypa-yj+l z;#q_jJ@^(7iX%_H+$JVqK>IChgS*jwh5X_-V)XZBG&&&76=;#M$yLnE09R_l_qDLt zo4K;unpqgxGK0Zw=W+$pn=64=jb~TA1%Tgf1@1dD|0jKC>_E^BGcbIA#lLK30N+Sl z^hSzIR1Aa7aSDG}(33 z<0`lCsOZn|Q4{0KHBllzT{E62mV_4^1YA48-vix$si`)YY!NL)Z6iEW3(8-%RuneF z6p_AdYu`J8jJ#$xL?o9;DpXSO>m5jZSK2WXMxn#p)}zAnAA3kF+8G@{ou1b%4PM^= zc3Hex2nEzhoqog(SN8znVuvwkr&PXo1u>c25TOcy8B?n4%7LcHp%9dxPeca}yQ5Hdt^n%*zf0av#JSy_@2TNE(Iqkbj*mW#g0}zQ)9oQL;ZqnIDaptB$;NsrTk{Q?>WHGtqDq{jk*W^U`bihr3f}rL(Pm zsz(LeUT3pY?sw>1ZakL|P~cV%O16u1s^!~9I%aF>bgUX#t?VuEQnv-Oe*lHw8-1_c zmgT+TqULo4J+B(rI{X?#?46!Cz2(ty>&x@Dbi4LmSUW917s+A6T(BmT$(a=1fkFZD zCz+HZA#h?VX=CyRL2^e~$n$BXe8uNUh2gXm1`J_d<*tR|LXP1S-oSn;IM*U&EOI#R~DO&HJ%bcs@x!9MU?}F^KoJ?{%3(pGhtO=I{s~Gs(D&>G85{p5X}Ri~ z{#m1B1}L+Euz{F2NJaW}#gCKF*tbqz%T-)pm%#~cjk{_11jn4e4uSu@Py0JCJ{!J+ z*2dyMmntsORVqlKnvOi~7wmY3Rr9(%)S$;NWV{-vJ9Sb1;lbOD&xT2eaTuo~DvRe2 z9=e2;DTh6fc{U*ZOuwiwQX8|yJ8-8ha=WH1i5fmxCY1r6wU*4I{V{qSln-%IV|NoD zQ_B=q(~g$!>IhtjfxfhL9j|^E$8L)!3PMV-ZPAcyZMH9pm;7NP^J|KMNn0J?m2CRp zoG;@E(y#9rKLNBXAWzN?etA!e#OU&*Cxf`G@AbRo>=V}52>J8pT*My1Hj*BPk_6)_zl2I{B#tvBa?T?X1C)bFm?|J_KaH%$ZRBdw6IHsOZ1}=vV16-v#QY zz<|`h1cra!9)uu5oy(J7`xo(pLYt*bjW*}oWeKu_f^(~G1 zmsMWJFjtO(*_rKHm%eIQ`l0{)!yEqtsHX;~gpyb$hdkL`mT442E)6K7RhW9&NFwT4 zgOc|3JrlpZ5wW~1{b?2~Db35q?H~wa@%mzf_@-iZS%S1zpF_j$&o4M}5WQ5LlMq@S zXDGE(r99;`9s)SLpbwv3c(OmPn=6>3BYe8FVJgbJJ;_@-mb=stG1B2rNFv_B9Qp1u zbH1y(bT@3B0`8){m?v*&(Zl9rFM=n{Ck`1e4IVY9=RI->j z4Dftqh&4}rFVgz!LlK^PrdXdc16JZ$ZlM0NiNVyx)$_Nu?}-P$pne|=^{duzwi~Ep zh*duKpUR_s5f0=HVflQ|=1;r}{b=1rx@p~ZHL?XPOp++hAAyL4drQ7?nWMiT=U z!>$}I0Nk>mdEL_uMmE^zUL*V3=Yp;dL06p%oZ7(u*AMtRR4-L-Co3WZY19rHn|+K8 z-0dA_vH=e0?9O)j_TGC*fD^I&j@@0FVNHlaI=<{aTBV@WYqR~Y;}qy-V+^xwF_9ae zJf34cs7ve!&nteh=fdKR0>>7V`|vRia0oMdg@LEZ3kh_g*y?Y#)SzS%)VCUD^j_8| zU{~3uDR)(th%QSiFB4@BF4({;43Vb&PaEhI)F9wGDyvtV1ZhU&-NLF#KnT`3uusg;n_v zn4He$S7c+|zIEXmJ_^V9!!)kFY#tF)IzEJMG1)$yIX7Q>P_K||Ct`LYKyPhUOKeOK zRj~E3Y_==;8;roGu0*5{Q-~H`W6Rb6#MYl|4}SG6n77`z+`L%6zt8}|SLY~Qd9<+u z^;G>b12rV;%p~+N+Xq~Y|)@udTHVA1<{MPWAxuM)qKl3EXt* z48pkPY8ZHIcyOf}oZp#(h=2q){udJ*Co704Tp>};%FYVhq6%WXuKa_rx=bN7Ot9cBbpTkD~OV;^M(lltv2dr-Wfw+&(-PWJrO_Um^o(d`> z!@UuP@Jn7ny2DQj39~OS7KNCMvh22gcJA?*;S}0XmMa2}3a=c|=|tv)PO7qWZDN=Vk2_+qEuZ*U;s_E))F04#H+agFvuHf_FLIQ~Y;#D}Lb8^=3! zZMN9obp&uK#PgfsN>7pfG+Y=Ka90Hb*lA$h7%mKt$>Qffm;e}13&H_n-Pj!RcLCu# zGrI>AygG}F!~LgjA*!fiaP?q-mA#3Bvm*<@*bCrnX3hejv%RuZ7l5smkueKBh#E+B zeFtok@56MwKQxW22mCbazvvg&zx^k(7y!DfC)3|3ogg+g4sbgic%<$s9Ry1#;6sk9 zkt48v@qgyq`a6eME-zb*6;k~^4*-vgXUf1RJKBycBOkrz?_OZh;CZjZMWoNNV_t=E zLBG*Gg)=^aD8mPv4~<->foyo=4h~sWKyj3BOKjdi+yQtB2{Kzp&;jR!>O1fn`&Bd{J#Ghqj&q?>6tZ)P$gB z_y|b<<$+YbRmd8r5Lt+xw>NI<0Yo$|r7Au|EKPh1nzZGU_Ro^z8Hpk<(d3sLXofop zD2&ZT9j7Kc;8%V*#6SJtUmWBwaI38cjAHt?&4f20pee1P3Y!Xzfi{La}uVhY-UO=p)Qg-cNCMIVZsrAm)~Aa=@G zefgZ8z=t>XA8|1g0#Wvb5-TxF(WhA#$)RI3n8^B@(}=_pcL)@okq`N5V6djcAZiEK z+0T&jtxRQ(+Is1Gk>GT%jmX8{HRIn~5@>t2kx0~8N7&h_uhaaE>cEolHC8;WE;O?P zaD=R$sBBUD(`ZQ%?Xyd-fG)38c8wQU&x@BuY~u&i7ccFCkr5&uM!la-q3Ai@;`d_J ze>y6M8?~}a$vv1Rik$q`KQ^kyBHcj>0atyv{R5+qewzEXR&2LV5GSUY5|~*aA>d4G zt-$00{-<+zf3zyNF*XP6`ZB;|c+*$H0EG#j$c2CbyTqaCuGP)^L-=;%f!P&zW(GP!5Y^BUnluBpR!?S92C&|s?Wvfy}XL9$GrgtlDCZDx>FSuH%_;qu~+vbC~5 zOoCON-4Ijel2;amH2!OGBbBi`YeVgBfJ`h*%rR?z;g{BLBu&GWb=_$vx{0v|j^}9J z;?iJ?NBUgU>h60&yZMJ~ZW9OM&hbiR)09s^|%f zAKfF*&a-JdPz=~vpb(aJgY*Ua*8fC*^wM*_BA9=0kI_e-qVn|IW2#kO=T8~9TNrX8eJQF z2fGzWb!|~?SDMp8_S$fNjFrPN0R!Raz&$(T-@P6~cf)n7fnkUgq!~1L5)<6q9SDg7 zVgfQ;xhFVmDtl`n8?%dvt%I8>vyr0}v$+|Njpgbji?NZFsoQnq-}kE#{;jLw|E;T$ z{;jK#|E;T`|4Ub2xmECxBNvbh#17)+;J$LJ-~Jdk2r7XWs=@X2tii%d;m6 zmbQT;jjtIQd4);LGKqI<{Eh2829a3_W9UaYOPYDXURGJP)F9c~z2~exvD^7c;{|#u zIy+y*Cq5E>6cX5L4&|kOb#!Oh14M6E6uL_$DfRi`xxr$CYB0!#l5KHAWuX!ZlM$61 zY7UspcIT3|VlE;>mY#C>+ z(*QiPbPdx>q-bdDwuQ@BMBOmSQ46H|*2nfMEMqSg(L)y4ygSghX8`keqV4p&62zuT zs}X}~p@J_&$2K_XB7b~{b+DWrUg#t>5M&S_hNHCjvw-D>$Cw3ESpN7L<d3u)@Zv|VcRVphrR~^6o4Wj_A4JRXHfkX>>FjEt7|mokpLu@ zAXrtW*RRh78(;8L`xo7U^$4EBnD2)`#nI||a zw>Pr=J*8@<`IS=ffm13jFx<&*oXcOEK^<R;(PF zr$wf1#MXPu_w9rYoVA@0xNE%3^0l%PxIaO#qP~iAo*UtDp2sN?@6u!NZK$2<+AkZz z7HjBdTo8qzJ~L{vveu-+Y$#-pQFqfi9ipF>Xh32#s~;C}z^!h4aDK3@r!vW*P5WJ{ ze+vwly=Cp?tts9dwKSj3x@c4npj(&kyjCUpo61>0D%d!{f_uOdU_i7#&Of?Cj!VAN zf7}AVL+1Y|y?UO${D}J16xAwv5?ow{aLUu!V6T8#G94UvDlW5_=QAG7Wx}?ShCxct zzpx2xef>y--RqB6(60S8blB4?oFZ*i4jw6lv*l<}scS5$;qAlw`;HeRygMjRN;u5X zt$52Xmn7V_?v(GIh}1rccf_!GkpagkLom+hJ*Xs-<83m!*__kO_=>9y8+EhQKV?t^oNRM+(#}=@AO3_(ShU#wPw%y#u#EIFoxAy}4w_b`3g8Y(MC!wN=rZhlNX;*G2K{LYc=&)eAh`SXG&Z-3m-QV>9KC<=(TaXH!8&xWC&Z+1~6$DZM6FhlR| z^N-sP6xq7BA%_v9T(jy2d5LqXt|SUkghvUrxT`vCcKR`9i9;QX93 z0`I@_yZ`xU_0u9?SHX$RBG~`*eAl8OFYJI{^9GcPh+9n2IH8$u1Mg}lf`G7F{s`Qu z^u4}|fQ@wD%mW|;-t5K9>xYwq$40(6@n4&kVgWMUI4A1sNvi9uu9Q`T|CJ&Q?nwl< zHvMi)zZB{JJxl$&83}(ZGkh+z&Ux^7YncYB``!@kxLmnnkkM)hKpv6V6!Gnw@T@_B z;@ywKFW-I`ubO(mO^3-SImg@6!bezZ@T}E0BhN&n-uGgb`TBQu4Q4VjqU$Jovay9zC(H)PrdufuQs{1V>e|ZQ_H@22Zn%_D-DQSo=Tvh=l%A2+B=U>n z+Ej`|JErj^k;iZ8-xZ}9X%{xQS1cxWlDef4nyE;xp;{z(;cCKKrD%q@sVTxDN+ef% zNG+*#216D^#gu^>%X{4(Is_PM-bOUW;v>0a z5_ln0<WV5)t)lV-2az_^br zpXK)nk|zNtQ4}8W+^~3`q!cSMJ59eZ#ahcQLI~l!Z&bXJ0M|4Y3*Ci|rF-?x{jZw4 zhbQ8flr=l7(POjXMzAlF9g5tYV%Qi;>TN|S9QKbD@^T&o6Fy{OH%jYWBLOr_z}ie3ErcTP_t7o{&3IGu8F zX%k3>jn-(I9r7%wDfBiMNRe4AiSGth?gm*rnn+P{t!hg35C7)pNvP{3W5^PBuR@NS zfvLaOxDQS56PM1wGBq`1?E(?}Qx6ECk++k(0uyJ=LW7T{9Q=xzmztnHohGN%an5yG zJP(yArpu&?{-#T7v+`Ww7=9muWkM_TwX$&H`xD9OeN$mIpC~P;#0BGwS55ocbgsb# z=?$^HDDX?C;ask4Q*xjvPEsO(H8-$y+(gW=E9x6F`-}3J2X&5N z6@rAr_vmK6_Qf{qrBa?MZ)$dvhk-=*!$_xlqWMLwNec-UeFgA77=IavExNdN2c$nn zAbxHKcM~hz>RpxUHv8!ppqs%yp#iKqWPSGwC|k=L_%jlhF&lqo0TWsb&0KN>Yx7`(|C#U$-jsxWVv?6IMaRTbhKhl9M;5 z0A4yxLzK_{bH%ucY)1TbRdm6RAHU5)LJ7k6j)^UMyyc~$3kqiVh@Qg6l*9GK#&6;|kKjw<&Pevz8CHTzI`o>t zps7xKu?{27B)m(lrxEUU(;sqWQ5nA>JI`erjzq_D_IRp=0&>9F5K^DC4=9D*mU26E zgiSm51$H3j9xr}IDxY)C=2`yiBtFQk;*l?9g%G4f$VWP_zN)!(4g9W$BxuiTW<)xPv(lvTJ)rbr`G<%+HzCw)04K$o~2H}wP(mGj?u<4}&)Gr6?{a$@= z2zcP#_^h zof4|{pNGvKR~+$$KjHV@EQKSo87^afr;m6??1gdK!>PQYhs&yN0N66chNmV(w!pV@ z>U>a*>DPUbMZY<}UNX@UO-cGlHFpM+&ra&Q0@W~>! z)Clfr%+ZVO+U+niXwHI<~k+d=zI6i?HLoRXScrtJ(k&2@+WQc9}Ihzy%7eN~sEkOlHT^4j7 zU2t#&B-}egal$D$?&tyL6_iwCS|e%T6k|kFd6R4-yI?2x7{|+h`;pQz{P`s4VyQ> zLL`{#NZf*RH>~}0%yT0Yj{FLMTyW3)XU-M(*`;S9&Anm>A%0x0ceLkhQE{|5TaTm{ z>dE_SP$d}zQdygIo9iY3E2#!561el0>4(R_NkPzRRB-0nPulJ7Ox}x)QPRS&6B$+>WZEQ*#`!tAw2{!x;J$FaT=P$2j5}%VH<*LlfEJ(Joaa z&X_X3MNl@$&LWEEFXlI*UUw+t+Y%Z?M&0gP6j|1l(k2<#M$>Ft~{Ny@&lTo?BX??hCcPj$dfqotW|D%ifyKJnm zr>lTIpXp$Op!>OEo`cfeEF|szS5iDkuSl{9{GQZ>Hr*3iAhje%2%2Oj3(Ni-qaI_I z3KbWNH)()i8$P{K)&h7{wH&1M*h(HEN!x+7L+oK5+WM0r&HcCMy=3B&3$#rLkXg?t zNKb{CS>-P1%9kIPQ`V}RMTe-y#Ea4|@=AE-0jXXL9r|Kxbm)x**+|KCm1g;C>+rSq z7g7rO)3WQJH9SVqgXczgZ9C>INh!wJJvhh`y}+>7;A@U*V5CH;M!Y7mwk9ybX`D7+ ziPNW(GZ;?10;KtxolYK5C`k^plgAqemz6r+KK@=o@hRbDQYaa}*~dJBJ3%2BTdIOZ zeC~G?0w}uI(4juZCrARCFDKB(Et?j)yn_SRR8+kd=AVuo!Kbs-w+QY%vOA#0JW3`K zG5REv{4Syj1OCh`pgNa#_!Iv(g7cma+7Vi-P-PF|M(*P%Xo-JB(Wf(b{!U1Ic(^j% z;XHWULp#x-EFm~^zokPaMkfBV7{w|`+(_|0#>^V0j~rp`B5ZpeTvlJ*&^q}vJ{+od zqN^IJCDB(5Vq?<`yXC~}&IEW3RGiIL*z?A$&83Ldo~?&TA62^jITYzM53v-T@PRKj zJxy9ps>{V=1T}tJQ;%xE+`b!mRP|CXBOh6gakiS^v@T2bSM>6W zwv=bW`1-Ou&G*8OAMiLP^g}^$jr=v3x!tk+4`1;+Fa9=TcTIfYiFM=$&Y>NK&!pwT zG&f1ZKH->3J)6-)LQ}xzT;e31*nw{hl`ru!{^`N9;j!XD3f$=_$LWsR6S!0wi~ zKWw+b%igK${Tipr%7{rz&Fv|tWc~bjP*V@*gS8ayw^#7>RZ-~Cx{4At0_~6~3e{Sw zl7bu$JnhuuSzO+m(|Hb&;fpoMjzIi;1p*f@7SzF!duF%BsDAFa}LEipsY9;h|jA6r3TuxPMcsMz5sPh?% zF?$6bl!uu1Rsa%zp%{x-qYzAsZg%Jjaivo9&@R*2=S#aoKA)0^b&EvM_q~Y!%`G+G zbjmcPsvR}X8@3leY*nvI<|>@}!_2NTv4H}$$hAIUdn?*PH_QY65H5$Yj2=%OQmdrg zI4c$&+jL);iSU9d5clJLiosIbp$L++sdlL`HuIN{JC0fT4m#E*o`j4lu0hYccsR)L zs_ZS&^w#-SGK!448L!DOLiH-jE?cc8*`kS=V~E9+!|r_cDtku!j+-MxrQfI|SGiKg z5ijHwUtblrBiGFE{s|Jtq>kJL{L|bQvyjfZ$MP>1(5gsKyG+{3PjJq|cXNf&PpvsZ`^&G$$|PxTd^-~Mc`)E4nuv74wA=-0LrDp!xXp2GUI2LLoS-mlY=;3Zu3 zfM5OZ6xXF*E)b9nJaWYj{C~K6>$s}gb!(XJ?gnY37TqaGC`d{p-QC@-ASoS^64FRF z(gG5a(jC$Wi26=I6n*yI&-u=~&v(vw|G*z}t?8O`F7E5P$5msnaR8-Ww%dpQuFL!# z-YQxC1E=v$s=_$=gemP|Qo{{-&TyXpa>)X}fn-y7ov=^WR*^7K?osMvEv zx&#`K<$56@QQ_1{W*sA)y_U=j7m(2RNRpXWpNLvgzq?UMOd zJ(GSM5e0S;q3JgplF`0sV&xgW%m2~vNUKPGm(r)W;Bmb5*=x@!U7-YL{+y^cM9-+F z3^U;^TNjm=u9HME_vS#71f@<^$uePnA(J4}S#GdHKYCjNKXq%>e4zCj zZvjkbzWIOTi~hlQ=PyX6LFN7;+fd%ChUc)w#YlUdcWv*}Z~3Bsc*6b58aEl#<(MfS z(EAbS0ImiO0Th@ot4}|O)*--g$bL+y*%{hc+nYLA+qp9RwBpP5J?1|w@+#3zQ@0fB zv0vOWi@UlqF?Os}>VH)KP8-_&QM#j13IF{R8r0U2-f| z3({VA%%*B@1PpxXm;3`($%7+2=RZLt>ei4P)zF7v-~_a>#Bjf0$*tv66l$l8d8}a? zz5TYeo*Qgw8#ljZrpp7|Kb=*gPJx`AnAHvbah?YiXTHFLsTMzLgnEqb;0HA5XC#bW zF+yq6PpHimCYi$au{y=VvGc2&8)tI~J{2>5k#xrWR=-_>cYIfVk0&5L&cceYoxa0C z$CauSfo5(_dzfcX+*9E9yXB?)>A@Bl^oBOr3M>SagVrn* za-`25J*Q}Q5YZ=6euec>a9&<+aGwzL7$v&YFL1)YkKCYvv4(0)DYFJ<^L2DKWkzdI zl{BWA#2^#m<2a?hfuw1(%G~m45x5{4=g(#tq85nU1LKZztkG?A^dNG{p)nC|Dy{4d zt@O@V$06~rp!j>wBMT9_g6wsqO&Mo%T*hIh%+ekRI`fiYl7kO5o22RMm~+S=TGqW3 zXo;Ekrl?SUZAT@0|7;j%x745&JZ+;l!z=-1a6;#RS*m7Pbb*@#=cwE2(P!Vs>vdU8 z6eY!9ts&&ZVT}}SKb~Qh<-0i zm)Al1?4ihKYYc z3js84UYBR-#IK+5M{p0YS^hKmqpJ-D7^47jv2d|+aIjx)FaQ(9=8W?VKr?P@|?P=y1 zAk$J-Gb}N%+#}V&mpA)G$y23iZ{4cRwVW4Gc~LF_hZR$k+2wI-TWrOF`Z7&YI^}rh z_E0jF-%@{DhxprP@oq5YchS@H5v(NntfxoO@kKvBhiyJqe3Bw~gv+pMS|rQ*P|ta@ zdVQsyy#fDeaf!Nyt-{d4Im6XQRY{!9`5{grP|8sBDZ$M^)IRq1< zq1wHTMFJKRmL+3{PN?trLb%COEn<>71e*N_4TW-1wF)j)%CUQ^UUxPK3KlP=HwM`+{x1fQ z_)UYA?6d9LV!q3x6=5rZPh3Ekg}(H5@K2H&pOJMBleB&+esYa2Z5^$hbPY`HuN@BS z@5E*^5kEZ+v;lxFbpVeedF^qq#8lWRHGD&pISvMD==n7AsP`QI;(;V@IUrG)8&xL+ zOf-2%>&KT@{W*2@i;eQt$T6<;~PyYcG~^zXaU-@(n7 z#Z=|scrz*?Lie}MN*1>$Y!{Q>>l)p8Qcyx8zhXs*Gs@^GSE}gT=)$YBXaJGy5tRIa zAma6RQf%+BI1-G$RjdH0);Z1!ob<4zp6LYkfeAKT+WQxIJ$u8IV>0k|QfCLjOZiit zFFno6d8zU(6~u~8o2gGaXksYiBXNA0eo$>5@E+Ulz)fx`?SYHi?FH#oY z-onC#y4HY?t>vjyp&(yf&A1Qvmz*t)inrQ2cUdw@xYo&d(_gVNAoar&kEBItH9SoC z^p?QHeOobi1B)YT?wwCMlH?bnqy1*-n)9(|w$fdsufK^TRrqTi1U%l&QMorj_xf3( za&yNQ4e*Z?cV4Q3MYIo@VeViqVbJ@`7_Y{azat^Hx_c@zdeDmn8y=>N(P?^I6J)}y zs9ic-aHln46|`im+?8xqg#Su8R~%-Df_Hk$Q0p!_`X1k-Udto)4%_ALVCpBD#S}V$ z_WR3dWmLsu(e;?ENb@{Xl{_j{g&YNTcli7PF^oC4J61KUaGu1hQP|RYc7sdKFB`_t z37x==;pRmU+qbZ-PP6eRGYd-=X%rsQLxeG4QJyu6LNrr%cRruD;`UTzT-iyeh|@Rm zKI1r=3wf)<5#8cpN~8;vA-84`O9Y|N#0^#DxJx7t)ZXA6@FPb;blNb1zvjmt|K*eZ z;)DKlQonrC&YHE8db7^9ltyQcbG;poZE}aeUwjgfy^EUj5xNKOW!v_7t0Lt2f_!;{ zfa4jhR(C^Uvb$EnO78-~=k@ZD^pD0YUUlFFU1lPDk)v>$e(g#PL2Ws3fuK~1DG3b@ z>5=v!-W;+L)MetV=Rl!(@zsc(PuI?VA4gLHMo9|HO%a zfCpu%?jeJZ*>#qAn7X$gbBg!tT4_IweXCu(j-vgv`SZK^otG$tY@d|yzM(eldIgx@ zTe3-*)^aRIR)Y=1rr`OoKbKF9`a!a*BA5J_jY~aFBHg_X58L|t2P^}BsbK`;JJYBf z`Z~1aOJ#BX?*el_GNY~;D_GSt2YMV!+poP9Y-zlM0WEY<4Jieo(M`3wsKkBj8vKk{ zv0OIL9frG$0Z=fq3#VFfRycwrlFXHR5<&*DI`F$!C=eg8rugMf>myY1q@WtLyC)I? z_#uqzfeUHdfpBJJ7VJI5+miHrE;~jY5w52Gv)<3Hd@{vts`Bgkx2p<{rLO7kt>BW2 zTtEFYR4#xBGXeh`_9KsXi?f`H%D5-=_Hw)8EHA$0oB?$B{~KpHCy4zT2{QgpDShv1 z((g(F^HvE+*UErQ{PM{!(cljkz^}~~T^W#C3}Yto7-oU(lCAVNNM)iM%QWZ+ zYz&m=aLtxAiF7A&%Z`49dys&A5Yyk2%^Fva^a#|Lkb(FV*sU_}pSv_mz*CiwC!cTHGcNtgA(s7LUtXb zbA@5|SCSD2y#l;mlNgehfnLWFhJB|pDzpy6?B79eKAq@+u%0n&{Rr%9LB4Npx1M+Y zwQ%yw(T4gNdv>H!+kic&l#}$B6)1+X@&u_~2JNI!@}Nf`nT!V+Qb7{87-W7nx?Tn5 z|7c16UX%nDsu#|2px(o>I#bmDzx{4!rlH--VN zIPjI7<780c%kO-^>+0yO1`5Wbzb%(+9Z?hG-1W8q#c?sSVHA0P?0S#>Og^D}C@X5{ z^+|e~e+&t+XwCf+bECav@69Dhh!qI=)`BsPR6AkF&^i|4w`e8`X>*x@Z#Cg^T~-wz zm91BgV5P<6wi_%JdD*^eNZ)`Y?EkV+#L`;gf$ad1*j_G?+s3Lp-eoOGDNplqELi!# z{ds}_PTD8OH>X1p2Zx=-v>JJPhn%<+U`nim*t1>BfvEC+Zor~=Rltr5NYzT0VEZdLo7Uiydn!Qgb3mQm}dTcSNc02 zP?+tz68G--1S_KLQSa!YOPp$o$O3YrFeNTe6r0gT(}I7Ao@VI#3rY>$ig|Q&5h7x% zy_)*d**xF6T*=OK;>MU3?rB2Ovr~^|tc<@fqLjsXA5XC4TE*^(nrPb)O&(e;KQdi786D_t{a9#Zm zACL<2O#)i+;eTieU_n5^kU)Xm0~5LJ82)8@m?-NToO7tJ-?SdMwSWEmP?%W#Udh!) z1ULqOSPBFXOJz_6-Dn(M${*ZXqgSp$QR$w@mC>X9ybo;fOC{Am=?1T&OVG|E=>=6@ z1v`zZ+$=-9+Qx|y+68HYmE>ceGh>)70rjX?XE7OUT3O&X7=57rlxEzvBBex68*AjX1xks zaaw*BJ~e706I|);SJS~n0{HNyyma~=PIh<73YUj*xY;n&ByS89IG^YkPo}(uc0gP+ zrWl612-zrp>b(Fu;_~|1$vVZDCI$joe1e@FX1^HzE`0Lf$ml+dQtkmOf<86KJo)|1 zQ;E8T+A+PM%#0&rXcszt0&A!br=1V8lFGO$!&hh@5T`M;)tEHwKzw4kvU37`UCS%U z6-!-x6J1L^puhh&bC+5<`f2X4iXcDOM?jFtb#3nOU|Cb5UfE^EQ-9j|ZyUY1GRr-X z$R(hF#pIRIHLx=^AfvSh=uH6!V+Y^}GGLg_&Ja-E)^)gIJpFY?SAWzW@6xgS5Y&Rk zgcspvtB}%R#`z5CNENem)A&$|AzVLIaV{*GM!H$2ea#mFUKeKuV5KI+oE7A~=# zS>6PsCmdsq(|yQdc7oL9kqUMCe6*_8ITe<%xrZMOkd#kO)(*(YeY6+!I^WPO_*xt^ zuXwVWDP^$Yt9>JVIxe6S6i8{kgkIq+NcMu`j(G*#qz#k7=YVL%4=AOPVPQ+b;V>hO zktmCaFA0NCrjiiq5q0HY6!z1+owoZ>he(hI6F~w*9pY%JMIT1i$5%Grg2Ot0kY9!L z4wKB0F>$QjXh@UAw>@TkkYcHWkNBlO)p4eo`rY#w7amu8Z7P&r%`ImP*ggXh3A>m= zx%Mr1Cj<6jo@ys_cw{H>j{IT)vyv)LL*`gjv~5j~60gNKc#}iPvg%TE`9_HS{GBcy zc`3w80}+Z%(6c(I<|_o#LQ4yGdgxmBw_sBg2*JhV`Q53;J605ww5VWvamZ?3FN=I~ zgZq|f?VlS3QEI`dY_{fk{9?7&_e1=CtpCPNX_+~ODM`^6t^BtM8 z;?Rfni>5%reuj|rY*R@r)1-0|u9Z%zzD13GPqD8i9>;uSeG~s9F7jHht-&jD3Z`v0;h|uce&Z{oY1emwjVg4RRV5uMdx!ZM18{+ zjdW|$@QktuwY=)owdGtVgs@{$1|kg?ALP4q3E6;I!fBB2gb&s~I_ITtWwvkG|2o_8 zyXDvZ%ohk;J~SCH&vX1(CkOFmaDcsRFaBs>%dIlx<*+qKG z=uVzTIGg-lZudvU&F;V2a`bzgSD4{pg2{H03fi-#;i06s8~HVoj^iL^jyBcx)on7(OC(iRiDyCcP0lch3-fKxc(3zqz2Byu z;K&BO5v9@PO{vr7hXb@ zINynD<@#p=cNqUKLrxlKg%v1uxQ(G$wx1vR zb*Cqb_7) z2S`5Kx&FQdvn2i8f+2kX#O(nfZi63)8?UI!?5pV;Y+ikflBx5KmwzlVkm^m=00vMx zyUjcPQ&LFEN}mY;(#+ReCGF4G<*sk#Urpx$tRF0_T)(FCH~~1$dBYd?Uw7rdL*z|0 z*zVs)Jv@zH`y04-iz+hCodm#<>3#rLGfNReFWGha8s{~j3#xbXe*)16Zq)k;JKXvu zD5ddbU|KBi;o}f6mcfZnW-lNncOajAakO09tWm~+#z{Jw*DecbF$mPemI>*quA6t< zcnvL(+7&7}Ur*Z&xd4hW&{k+svmxhD2?^VeL+~GOV6g{h-`TxyJ8us0io?!4KG|r# zkI41O1Ob!@i3G%Is?H*3JowxINAz5iahIjD8sGEO50Tih4WjI5tvqLCG=g3q!W`e0 zm%JFsoK0R%X!2ax@O}Np`eGbqYM#9mnZS8%2`*t*^*kk@nzN*Bu4woO4aUZn<3E-E zWEhhZiN}7r_ncE#L;8#PWMU6n^dF1q3N@?Scr$#gW`A@XB%e>+^q{6--xhgBw<}|l zoy5%<6^dh>=D9^=a}*BceL-p20eYMRkO{2=T2^_plF`LD&Mav_t=P&NaaOkszN_|L{?d@8Vg$MgQ)wP?bm+1T^j$At| zqwuK4C83uaKe5Ly&E?&Lq7wWJdkn^lHjz5ts3{zEmg=)gTOSO`L_2$RHN{qa1-6~M zo?#vcoAdcHQ6sv7WceMC5;@kB$wK1R<=DN`WBSjVy)O4Z)I@#FMW!df0vGhz6U~T& z)wX=s{~%jDybxo(Vpe@6!($zloLGHB?aE&9fAX&atpb;5(iC7y)i5(K*8*s;9=A#D zrv0?oKdUlmKV@XQ#i}kp?Dm&@SreB2-D3ZdjO-5%bVy8+Uox^kVD06N+>~W*Yshi~ zNS5ugJbSGndwuwCz1H6$&OAB%S)oLMQMUX0*7CZ3<@t}E8;5EIOe%gvqMaPy`(7M( z&o1$-O3NdxRdj(x&f&c;vd6pRJB9Zai(YF7SslWMk*c#cW^Tovt!pA|e@_@Lv8||7 zOqUJbjc#b%e#8n2d4Q{}(xKRP0udiRsYl;TNvan<*Iq;SK+1(bMkj>)B5{hdyDf8+ zK?%&5!^*xHLUk|u<4S2JwOj8zXAVBj@z?6zVjk2 zC!miITIus+5{;ExgfHu*q$bieAP&QpDI=Hl9zAL;d5YqI`|7=2h?yI>RDb1t*G}BB zsRR;OwR6WifrcL=9}j#f%+X2hNIg?1ecBj&_MDyqfx?OJGuuKB*rDm!gUor^2Co>N z0NBrBHeTOg)mO@j-sANjaI8p4!Sz1w5%_|N=lPVc6|+s|dCwyht_{+cC}wkdOnn?M z@~#ZsRNP1B5As4aQ-+t2d4i-JJjT?5+k|A1G!>2nJ}da`Z)O#Jm0~BLJroJy#r(8B z`#q8PNnPJM$w950P7BM3{mO1r#ts{zLlYTUhq1*T9Hg7FkN17q7kNh{f(s`T@C$4P z^!nqh+UaL4?x-%-@eMIaXDJwwE^a=-*yDB%DasBmWpxWyHc)ksGU`m)-M_Q!*$W87 z-Yr8ELCN?g6JluY%2s)+D)T3(`b(AOSF&(N48LV$59aBoZ1*P7HEN~q2u`Oz4CV?& zAs0uop5#985Oc!UC842xr>(S0)vyE?c}6#0Yy!6s3#Piu#N?%@@a&By>}E(^;#0ZU zaX+6qU3jpV*FbamK29rfE3R96zJ7P>YM_z-kOJ}r4YB%^N}je z@;rYhiv-U1w3a78jPW$@(MQSxMN0Ld$Q2BRg0jat=eOhPnJ;Q!g|<@&H2&%J73SfdWRDcz6Z-?n|@Gu zA#&XMbQ_FI3w}k`XZO5JlN%<7PW=qMzx*fHDVh#=eD(dj&C1H84-c3>M}GNZnf)Hd08r{z zPv-Sy|DxdXJ0Yo}p`DYdzM(ytn5mPgy{WYo3-=XoI-vE!e68RD;wHQONkFI0{eL3h zLJ1C}R zGCiU3(Z!uG&DqGePq4wG_%N3yi9O4N#g>~*Z~4&H$h9orFe~Tj*mE65A<_NsiAl=F zle-h!cce6vPuw=Vl{vg#n1{#2(DX&uZx#u+q_>^=3~C*z&kQ&OmK^DQdaQo>NBEuZhXe zb>gri?3#(mZ_>ktLAteX2_Y~j;AGI>tEGw*vdL$ovJ@wv<)axaXr~h;oa1}g!p5#4 z64Go=Z&*URTYlVLU^L+V_)~RvpK)tX3ISeCN4pf{z7C4qyZdhson1e_!Jg-y?qa6R zKoWAMc9^8Xm|~eCAeo^Pi6ZAW&8vqvc%w-J8F~b>nY?W0xAYRebps54L~zu`yv{ba zK(+X&e#7F;Zg78c{db<#$GRg3c^#S$b=;wysok0kE*HC^GT@iqM>FY^+>2brMJ<+?%)WUETm0 z+YQva%wMtqJSnW4Aa0=YdRYzuaNe&&(7*e7e+Tw*rV!$A=yIINwo9l&0euG$fszkGW1n>OCZ9p5+$!F#l?Uh+*0VeIvp|9^0<#kS%yQLkm%J zUIq3p==fa+mou#lUes#yn8H_EMjOGk&W^C9JzB&gr-YYJgO$s9F)ykGX}BWDmtH-( zyQ@<#P|eeh0xprLh4EYcN<#Q2z^#kn$;1M4cYks%E z1luY*W^;S+LHQIq{DEodaRn`>CRT^My^J~HK0E9*F3c+%f*iMXT)#+hAWi$zBY-2qyJpJ7J zLhvX`tlG`UdTunkKI_wy4`9@})TxHxFq}uN;pO55x{2H8o{57Vca9ho8XdN1zes8C z*lqVPf6D9XT_H6nuo#-20eTQvn-WXu`rOkzU)%(herSJ+sL!;fS4z*adq`jJqYkQS z!Sk05&^bn#gM?1y0S09cc@$beb$ibqK$O0z{ui$37r2wCdG~$A`qOFoHnS|s8C7Wn zzj^y#`onLH|KAMIfss*&a6m=23G3mvJk73Ct|gII=<}N)+3%% zl25iOBO4g=i4cp3#xhOFe4svDls#vzmu5kh4kFrGJ1ham0r>*K!JD*l*wAaOlQi&9A#|f@F)9KiqB7w2T=*6%1VJB{2%EuD76-06+eV0E_kV z;1`1XA9c6B>9@a4fT9%AHymhj4~6jc1^Ym+>Y^(iq`1lME}ybfy2^xy@@@XfE1HqY zo_P;7SsWC5C7o99lXRvH-atxh{%Hv){r0quSOWFAhi-?H_lWt?++3-qBfss*uYo>@ zfPGD;opWu9txtV}wL}p(o-Z>0Fx$11p5W=hDPNeNc#&;1SY@P0!j~sI=haMMry*R| z{snt=ibJh^@=|Yd_2K zEeH9Q{MBy$%;H$yRKdWJpmae`UTS4%fYd-LAY~kQpr&DL$ZTwC1iB>bg@u8pM}dSO zfWmsdGC~kk6dqyTKImgMDv8J7j?V<5!ntYju&_3^W^(%B=C67Iob0b&yZoeIFroq{ z>g%UmtK}*tspr8izCPP4WmUJA{I${w$mk9d9<`1-xBFw!`Me9x0Qo2~1}B+&0v*Hw z6hlQHJUCzm-kCN=B2QaLiV~v~hyps&DFTu_6g;W~*cfVNX}e=;<-`gMiMH>$=;jFT z>bl#$pFM0@LFSb%V9c8cy8DsoS|ErJ5FmFjwY0V~)OQ8iDgN3)B_;gkm+iU(cIymm zP*1LH7YYIltoF7Wz1)=4Z&|FA_)Q-K0w%oZ&6RFg8WAxO?p%*JN# zc?(7_OkdK%WG|bW^M}*z+I(nFyrL`s=(M-w)YuCbGM zd(A3{*F4@qpRLgZk7ds#+^P8j==r}JlqVB8LqqT*o(Ejzt;N2Q3dEHXs{KXha7vs( z?z~k{GJF4^d=L4raP;Li=LZfB7Ko%3v1~1GA_|@HvHlSaRRCn;XM?YdAqRM(~vO4ke{40jBn@ofXhGF~2Wl*z#SO1HIth4!>0OSVkf9%1(G~E9<@tUpo zrwQ`_y-SyzyMUz8RoC^^;f)FZH{I61f`f6W8E^LFQr6wNLf(DEMPVw99U>G!If-ov zi|vBxj*RcFF(7dBvfx)-;G(tH@h*>7giTjGvs8^8E(x~`G4@&ADUTbpW9iKyva8dC zSThh^JIiPIz>8cIE?Phd&a;{#1Rkh@tQstSIuckAV@e%pBk3cAf!*a=Nea!(ryZn;QOBo)yv-X)-kbweU3Q<6B{c+fQG2znO*=6U1 zyB)@BJ!g)bls%L6mGCz9HV-w+CZCFu)V9RQ)}4> zMvaTv?TejABTdx|wCpM94@*^&G+l&UF2uv9qKs#FTu{ugI|o2CdCJ1`WUnKIZ~ zh?sEs;DxKdB<8@a4doxceJduqO1c1>h58=R(5T#?h}UXOs%N{+kT&Ocs|YvdSxNLU zb|(I6@irx@yoFX0F8?>N#c#wVAvfciwo=S0xim?cM$G+u?`a?ip)2bboqNDRaAolG zK(T#`XYE#4nWT~_?fhgyYExi8paMDLiGa*@Fswd@V8PdqE+0>jeJ3-J17h5Vd^n)| zw57nLd2Fko9kKAG2mR+`zTgEVm2GIsT~|@r!>1JurVtNdNp ziPMc=>wO6QaB@L2%SzK1Fy$P0=OxCSE7SZlDEmWZ*=+QeVZs202>}?UIRu*L50+T}h}T$nc)0)L@!H=7gIB2v zZU8u5NjqQT$g6(ZpT(yC2cGd??P&el@6ok1O@|6cYRw)dlBy+uB5(r9?psO-jRukh zELc{YX73>Flst<88YC6IMJxCATPyBU>a15@48WMZPwN1Dce+0lOF zGUR36HEH%G;HO}hgY&pB$)FnB*d%tMsmEq3$|zaVmmq5iKQ$N`|1|qpH~L9#2Qiv1 z=LiE0|2iFfExLh2f0cbYkz{^@F8HTK++3t3VK_dNwJkCGyGi?|(Yv--?L0-cc~S7z z%eF8Tb!sZqu3#sp$eC;)+R*~ljMP-qsB3Ow@?UL`Kby>dbYcI#vq=sAG$5!}U|Oyb zFru96o$W6@{2=dJRs*zT{{U48m?VF+f&&EeQuoPz^^E@jRfw1bKYBGU_&i7mTAwYtI1c9gh)y53Ec~BesKTU&K-^Tv; zhc$7qw79*_ZsJQMk@z-(pcZnE^e>Tz1n(isb}`THJb_A?>d6VGv3L<2)g%%LZWpsg z;`!txv{Nfj7+#=AN?d$~DI8={4qx}Bow>gbaZbqD{k|tJ24%#H=lswJ*2A&1#Fj`c zOd;fB6NAKfauCLRPP-Hg&SfI*^!rd}X3hA^1tpbJAxW!O^YyQ>9_joyhru zp@atRDtrE?r!!ZO0n6Un%Fs^tDvSFETzH}I)7wE(0-lZxfD3RxydCi$Unq#@mbbev zb*t8(c=h==%ngv3XxA@X=TljKlo5cc0Xv}5$HfYa$6aIhUx)uUAN_ZLJrY-%Bei!A z`9+u5IS$u_WMiYZ4QpC5$o~1g9Q0Wkga4gi$U`-I;E`2JC?Q_-p%@z07)0<~l z;A~4%!#}V~uts(oQhv^m_JFc~&SQ=H%&w~OLATqfyMH^aYzq9Qu~4}&6k$8o)ajZO zWz-O{*|{#yuKC&>M;O=%jLJJ?Hlnt^Q~XJsO}QG#W)?}LQSN7FyP|cnvT6ND;juH5 z;wjqOqH_AhM_L_a7&Ep0#(!9}f4rKX%1RpAvOSISAZ0nOEDa@0qLmYyUNS@TDF`gGH($Ca83C28xgL_7jNkKGf z_L{sd5uC}=u&;^INSX41uvi)4_(EG?%PblohFEj4zfYk!(`*=TJ$WW<8}8W{H#*Ri zp-n?E`!#on8U>7Qi~s(ffKIcJ-0%#wh(O0 zWdaUar+cqV!05(#ISUSr=> zyE6vvHf~U3!1JzWr)1{=q-0)3BDl|tVHRhxp_=3)zX#oh`zpjMYD@@178CD}SKuox zl)wusDHE^2Fo}~mTYS0%C6&__XrM*C&12}Wy;iOEWtaAlzV5Rc1mL` z(bts$%j@}`LCXT4*Qm<#Ym~KLSrc5$G?v7ECRdku8h@8_iNULwxf4@=Kb-?9QT82m zFr`2u9L{JY&GX#X&C^#_Nao;RXkiEp;ND77{ez~chra+lWEWtF?SLT`{@CJv(|o(k zRQdYd+T+B;S%8t>%WxL~iCl?M(be9;(9-@=58luY=UM>DPgH6c~eYBM8f%X z@^yOa9x!8SXm=wn4~ayi#Ha+^J1|gAcAeq6?wY*rsJa66+?OT{v`_JHZ~~hp8{3sd z-*ip>Pq@jyv;RiNm_0pmYs%tzH>V=c#!1Stn(B*pd!qAOE+LP#larK)Wst&7Mh0z; z6sjg-pqB0j*@{Th@7-lkhWsGeKF`CwbD+sDB-Rikpj#;W4!LQMj7Akj%o~azIA{C? z7H8y;l>1A^F9hcHWv2uA@C*lvW9?XCH9%mS$s~R8hP$|` zJH~-Ht+sMSCzbi}`}r+xjfWUENETvbh3FGU_$R|D3S4XFZ`xS+q(`w5Uw084YdtxK zt?@u6{oqeh@yq`I(p&zgf&X$4Rgj;Z_;mfuFbeP#w;=DtHh&xFy^X?dGGUJec4NmH zr|ipBn~Eb}C(y)y11~F80IQK%CcNW7=+*K`+w?9~iRK65sbSZi!+5&+px{|3HPn5z zQG>t-i6vA}Bt7@@<7fTK32o9-PD*T9KDtBaFpSjpN}Ti_oUFaBl@w~gscyAA+JrCJ zKCD`UPRk_;QxmHS71uY zEU97_O<;A)`h7RKL|^|PI7{>--V%8eJPCoIdik??fLMI#3o~?wXab^FQE_Ohl z%C+(Tw)aYDfB(7nLa_reJP0s*ylaz3lZ&<3#@ifAkr|8Mb$p)j`u5j*xd;E|0f0^T z2j>_fCiZ2Fes#&KnSWCUV6@WO@*$!z?;8(12Emj0+0t>`VmM> z%ImX!|n0t^PDa< zh;T9mIlR!8LupoyE(CzUokR4q*ixCPwS0CrJMLE^{rs`$o?G3y z&#Hs^dfE6U1-PDmaT5$;ShF8TP$@D<#@{+Zg@Ow!g2cr)I8vt~4`*j6KQST3up9{^ z!J6uLp1Vj9IOc}jXg0sGy^UKhN@!d_wIl9-=c2X8V@yx*{NOF)$k$QBYYzZq?0i%H z?^r21A7u)_=m)^34CpOG6@_b7ZM-48YTO4B1I!>`X=MPs6hTxs@iM?l@t0-FtSa$O zcqx9{0&nm|6gCeeIHB=Ok&`yx&gobc>#FiGSdJeI2_MWM{_)E!cpMAy`X zL7H^5WTFt{(l7%NmKqd`NXqPFP21;n^61Yxg`eCwQy!!w=XKJ4VqKV7|f!pz(d`czCo;<00DS;Ncer z-%|-m)o|rs@c%Lq`#bMpzuqq|1Ekp@zX8Bv^@o?iF0zWnFL!+)azc~ej)zKm+sj;LmuUA8{0I})i>xh`3p931do$xOvG=4E?{rn#{GaCQI?EoM4 zADP+spL^?n=aFU>we?hq*;IH~+0M86f}iD$N`Hh2*))h?Nyy=jBuN-#(x>0M-yl{V z`m%)YzAsDf-o-I2x&t(?cFGRYlw6J3K z(d4FikRcYS`rQgs2{dbP4{Zc1doWtx8vARp9YUgSn++*0zOUodiS?-mQZX91UUR~+ zB!$RrcW7-wzJH*$u+V{`l2!Kd+-;7PoUJDQXcG?oBqS&KpzYJ6jdo2E`6%%iHPZVABRq3d?4zykWPSHgp*kol*k5$!7J%kVbnVB_ zA_7BqQMBV|rSH-_M~h(c25wT7}<^W8$dWbyb^!ces`LgPVAUi@c1*Yo*e>*!$)W5$u7CJjev6DJ_gF zxb3UEN;%y-kHQFBF8FvR{8%IqRx%k0u}@0KbG!O$U$}87LE%n4NfsC!9PV8|O%|>D zVT`Cj$qtj^Uq*$?+zLz>gUS=h7h37NQce$_yz;}?!biVWWhee?nE^&%{yw|k7M?5*Tt2z9Iu#vZ_?{!wc zSRQim9c-amH;rh=iEIq+Q2elJpW#JT>&GckA41R&D;x}>9dr&)2Js&0lv50K@eSxc zNPOOgG$dS}FoXO`Hmeq)SSRDPxPpG2QKQNHSrfr4-+B@e7srv-Z(z!$!Ak2iksQPi z*q@H4Cmf zof`rkB`Axl$}Jz z>6aAw;-@x^H0ic2=0%>7M(g8RyvU_vZQ*0xsj01&LqpB-%S)&2+?>T9@*G!70`6(W zL?fBO&hil_kbfv@<(SUOp!#lCpb#)59z8&`vcg6@1I#yM75MQbaWT() z%rMwk{n%K1VGu~npVtF38}QwH-JF2`ZDxh&m#6T8Pv8`~^g2eNZJRp`mQP>$uM1)% zzakmslwr0#38y{r&&M3rZH=mzY+-*c^6bIGX;X~va&GUb24r2QhR%v~~T!&44mG?EUYND*5}&a|Fod=N>3TQk1SV6ZZ?O>C_ZLY%n%I3LGaZDp@b+WWIv0-QH63 z=;YX+!Q0q3UMZ;)pNF6A6+>;qMRAT2cVm0<yW8gl*J?hRj9t9Rz5ZAuJv3;^4z2 z^*cK$RH9?FIaJgp1_V}2~Lh`1p%PWxjJlm{lN+0xoH-@X+h}jeR^IG+T zgjkN2NnX0v)N(mCV(EPK+#bl?oujo^R$-MY0bAKZL!Sx?f;IHlV;0R{jn>$?m=o^s zENk^87X*(zk_G!VX_n5z@oej1|AN&t%ZHfa#Ee}kGy8;44PGY9 z5R&GW=va2bC7SA|B-Wze*EYD4<%k(G&mcbasjBkYHkd3Gw3ZOjl4j0O7z+7r7AKBO zfCe#pih8G}^e*kxm3u?{DfJZ$7)B-BW#p91}cX5M!18!}?0BZjyio-*gZ~+~`A>!gGRIQ<+~ZRB62;2 z&lctB`1X9Wr?qKR=6kwZ+G3eU((Ak+c>Cb@Ye`FPIR#c<>MCqnj6*UxMgdO2udmy7 zS!1HxW^dxnE$e*A)!;a0r#f)#6KdL9T6{_Pc_t?x-8ryhbTWV)sEJ0Q#k_D!@x^AqZ2RYR7U4AJTQqc*vM3rSG8I6GWyG!(P%^w zsdS1ySf-MGjc$(y+oO9P6FW}ZLNP0(oYw+|4D05sMQ z{tFHbL)FrZSWQJtSyfq0MfFF*iRF5x%?-0far4~uSQ26}5kLv??`L*=&rSgv0RO6A z=6}zv{)+{STdJyE{MC}|gVzMPy-K(CluSwYM9sSmXUDSn^hpGx%h~L3@H$BJU5%kV zy$35Kl|!G$BRrRKgM1m1M~pfTQsyY)O-lTjbE_OydUDv(k6IaZRmu%2eOUb>?yq`! z-Yno>{sPZ3Z0PtfPRCO>7b&;7CH8I;lhnUdZv2H~hJ%8k4V4_?hX4ov-h9Ggk%I{{ zx0VbdL?GX?YyvvW`$8DSG&>`a8w|x$*PGzXw0;j$xUw~(1GaN_ty~URzgx6M5>d+1 zGV<6Cr<0g;~r`095_dB192Ryds5r0>lCf8>)^G;908vADb5}E*?yo0Ul z_YQT3?^+nYuVmBhpDP(W1>jDSfR*fXyOL2rT6Je@4)N{UKHf3ss4jX$Q2HTw1^U>cAPr4p zcJGvtpkD6mRadn)HtlfTlO&Dru^+8-;%)G2i?*$8l5i%W4f$3&N&OsWBH5a!zVxBk z?uOi(*&@9zy})Os(%LUJ=wJ|#U7Czfd88oBr5)fuJxV^4q5t#10V)#7%B<+t6mB8 zrXLWXMFBB6W`=Bl7!9TRPK(}D*nM9gH;r5(%Cby1B{6J@H?>lKlV+uOu}mu1k>}4> z`&=(2n#fC-oy!~xWwH6y1qRA99JUQe;b7GwnVr`evz#-S%7Q2^maSWT70AK01fn3G zRQM;FP*~Wk>^02ECfxyTXP0oZ-%11O_!iz@TDHXMqE1b zSYCHMHSR+77dVF(Lko)h;Qq5ykGmwH*1(6S@@c}Mf*qsndp?2&(~pVF=v7iu^d;dstNTYHP#j(&%)KFh5m^F=sXDX8}nfK%+>ehO^QfU&*vu25Au!; zGO_v21iE(5%D^?sxHv_au=t63hb)oXJ<4#v>5$LpJ%dg+>n-cm4k1JfxxZdOL=ql6 zm!tY>^tt z{SB`qZQwnUw7S6}_BX+JL6rh6c}Z5FJmDZ75Yv6fDL5tSzB-Yi+!*nB$n>zR{)Uwa zZL~Gm@EN|*QisUWeqSfVnQ)%urW8_^Hb(JnAT>!q&p9g{IG8fQe65loV73+Arr`{E zVrkwK#C7G(%{Zp`iRfJ4u%@`+j7sPr4cqDPB-ll|&!SVcOwx2Q>Yd$df@SDf7{Ziv z$1T~Z{Ld1oL@w`?GDD9#o|6f}JI~4#d~k+}YR}$k*D4i1+hF=K?3gb8u)Y%`n#&Vh zOme?d?>)?37&mEX1>!wTkJwW9_>(Uh=WmS_FMQm zZW{GqR{79I{!ZHI_e4&6S4uggLgkKNCb)sGjZ5@3P>B`?=3TSf^gQFD@Rk%e7Fe#H zc{>>7$4$Nb0#;)`W;ib>L)yjvlE*6x7gr+QldU0ej@1hMsU4BbC&#N*3#aVzR^7<8 zvlP;v;Cj4hvg8LJDVB!K8c&QM_U8#Jw1r5ubF%d4H+A|R79${dyfExmj|J66uxzrz z@$4k>O@?gk+9FrdAD@s>`8Z9c%>izf+YbIxi1|nyFC^}jS@lHu8m5kiD?zf?L#<-k zSnq{5Vd2OrQqCT|{LM=2F0>N|zE*g&jl9hib*b9?PDXL&VS5OZa^om2@YYxG;1{`S z8sS&c17$i`kiCb|WGpINqYTy$0_&q;tUv1ux!Aoy@r5p>F^qq})vtk!*v!n-lfNO9 zJyQl5mYSVsW-AMe5Z+KXR^OHo!F(3Io@#>uDsS;(##mh-7{+|Glf$P_0Quta(zyRR zNb`#$d8k}3>#xR6tFQ_?X-J@C2U(4e=H_fsk|`<Gp=d3lf=-6Ep{G)<33u1v z8fj&BU=6v4`i-X;?QS3+*XUP$n}d_tLo3&Zzq@aTm%lJy8o+#Uz=dPHb>CnfMxl$B z7r^b^_1X{s%onM z5$91Ciw&-X=I2j<$y}$U%X}WGO;exzyt3J7=c0*q${6fFBusNSSX&OqDCLIeSU_YW zliTZ22ev0`Oi9w9)hxHf%Poc=s9>iOl0R37{q#Hpe&CqKZ!}MHk5aDhMUi*v^cmNJ zs0PORm#E%p$rVIQDgwgZpb(1Mh8Jo=gW#kx4Dr#C8{x0ad$zvOZSj@Pj8?u`woDKI z;sv6fi@BGk^&^yAay@=03*Cf4lL{(U zdWr^(xw{bw3p68zR0j6p-VvQ+RCNP4w3PeBKI4-($Y=&8ckg|XR`$l!sjtq3^oJuF zd(`rj2C;FLuuOGd=AgD1Qw5X?-;s906>>@1R(}2FQxdAN+Ata7;ocy!E$MeU)k5}= zu=O2>t)}k5ULKAr?g{v)+s1NKGhgMHq|8e17r!S(ZsO^}W&(MH?a<)b;tX}kN3|0b zY9#v&bFv`G=jcgPY^|Fj65^vUDVT=5slKBdAGx-7K?(UJ)umv2WH~`HA0xFnFWZ}M zIY}@JAg{xN_oWJh*mfoQ8g)i2`UT>`YjtX|x>q(CTB&niRzZ2wPnvQ}H%opDCi2ZE zjis#jO z-Ke8IUucM9O`Is7){1Vzh_+$}kHY)E?Lxf-QG+xJ6Pl|g&*bZz>OFVJWb$|#M9i`9 z=$;kY<9t_+XD|ibi={)Wnv=Bx3k^p*_XVe(2b_33V4BFkn0`L44}pXQjBfk1Ug2~m z8ptNR$)NdJJ<9k&gYfHg1YKW7GfG_*1&|64-yFmghUhwinCG3ZFAYbS^J01-jEg%z zvM+cge?;Qaf5MdDkYAi`U+9BI;M)x&S*~xfqXa{-wLxK{OcS3z%IyrJv5*2)rIUdS zwcG(xREIAO28TY#ZKZA$aPq(8jr)CkoeG=r>kP5F+4P3Gp+9)PoY;`&Lyr7C?-`WY~}p2!et50C6Bz>o}A!Z;*<5a+(XePt=`YSt%j$(IwL(-t+w zP6^u#=G7H-Yy5l_`?68nJJ78q?5S#@P1pt1Mfz1iwl-FRV_9((Ummk6&AG}a> zgY)w7!pc#5DxAUsJ8y^*4aw}g5hMOC1AV3kYYp;gR3~{g-Y`0Jh2WRmOrg*wh!LBo zy|n)KFI)Gaa_2R>Lihz@uQF+tYU*GuaqzK4Zon7ywxa1;SLk=p4d3|*y5ODw;JN}a zv)(P}!b1Qr1p&p7(SDP77k96HZH+s)D=hY-NFNxlc$>nz8RTu}#^7wkf_y_O0L2E- z-$fjM%(ehWL%nnI_b0E>7-;(Dz8}!!f_bh*tPAKOUusfxoY~*U9+#VoUij-e>9I1Uqw#zKHXo(AI?YYDGAYIyaX+ z6yIYj9a_1rLe)Ck@WHgNeEsW};U}nkPduJZ&binnh#I|%?h&tWMGD=-iI{k3JK=$u z^n9xqj%(+T98JMlH32Pz2d|0nesv^dRK0s-`79A}d`%pQ{FClLDSDOFNl*?ae zqF({Fp|?4%7-DjNxFVAe#M}Et-!3ly4BKuL8z!AUJW_BQiEiC(c;0fqi<-6i(S>a~ zJzXS3n9OMQn2icjq*w}AW7=b>3Ux)wh%l(rnj#Wqxdr9oOrjecTFik3og|qW? z+st0gf>;(Ufuj&`D#B#RNn0keSE{^AG$|xjf3=|Gu}jN;Bq^yV0JkWv7D@H+4YC|! zyt2qt*pi++M>R>m0kURD)o_VI+ay5sl)oA4&ax+qKSj+QyaWDR)zaff?ZqsW4bd0$;gXl1hi_9eoEU; z8-zsdq{JD;)PryNbmlC1eO%d#1VnYPj7No=7Rn__L`&iVQ+aRtwYymSHziZE60NRq z=BJz=1@u2%i1}E_3TYO6e`DiP1G(D3t(ECDGGf=QDF%Y#0*PVFzxo8f% zfuxyGnERr{giLDbAowpVZ@?J9hXCwWzyNbVFLQu@wr}>MP%m3kBL^NPCQ~aw?#JbN zio7Yq&FW+XT2q)roo&>yWvEE?`+pU3jzPJUVj0rhhE|Om@e*_+(VMYFYXc3~FD7Rr7Q%72GqyL)Y5J{HsWV*@AP(grv7 zV!&o#Vr0N-aDBl)iMJoMM1IM$%)N_w={_W0{tiRvs8)~BlMF>cODndR719(t%%^;# znX4UGwpOfqjvQu*F+xWWKed#Cx&{yVX34eI8uF$e^%JbB(Dn^j&hJ(ja1cP z&A8c#ZSC-}3=$lV=^in6%;(VvL(f6!(0 zOX2@+EXK^ie8aqbkHu~d|4+J%?p)=c@Z}Uw!2+5t2jc{abbtu7V%1p;N>qxzQHlb6 za_CKM3B5wM5No2w8ET;p(n>55VJJ@Fi)w~?1H_1qS0U`4tPG9##+--cI@0|8ZygP` zgj*6fdl$ZvN}6`BmvqxTdzXKADb}*B7=2b^9sFtHkY-)ZxR4 z=k;PAR|T<9#$7(av#iijTBpfsl$8<-G>CaY9yO;~VU+pE6Pt9hyYWDS^>JSINbGGM zxDhyG946;g_j-9w3%{WA)4dv^RLC_CV1Fgrph}3(%xadg!Iz+~DDSn(Gj2DCd;WEl zvy7a!L<5|Z8d1vCuaeoytkf`)I@%o82eY~ z`O`JHLx2CULe0`+2&A`dh~MBY#~UyWXqvq(Q#7SUs|Yyd{HT1yq4Y$$Lm35}D=2*w z5{hd&X;Vu`lF`c-qQ*+XF{W(D#}6>ert);h{gh%pVuO|^m^3$iG4fB%EFThfSSj{_ zqVS>0xw7A_BqX0%l~Kb5;bpJloqn&!d>Mcie%Jv;_tBy=rcb0o*9IdTtjYL7{;-=s-)BYgs0V2c(*z8q)|GsxcnRQW2vRD_61SCinzyqy*a7pqZXLMKb}hlocK7h#f5CrZOI~i0J0GKS9;Ic{ zX;9;bwanEna>Yg2@oi{idwh27cz$(aZFdTyKs~!)8EPwU1N;JC7l1AeD zj*YKD@?_p~v9j(P>H$frOnXGAqm{I|xoxa3pF`_Q8d9jEwYClavK5)w+7#bJ@T@V3 z0VH!CG^St(R(dV9ZFz9Eo956{ARydy`a=2!m zBRQ25q&0zmm4ciKn1`&QofO(C1$9e;yEnBs(TqyO&P0u6JNm4>2-eiyPJ**xs8mbe zGQ-blGQ0~)h(UPl;4<+rCMm1g(H9(Kc)s1a!vH&qlVjv$mz;aU+>(ZG}%x#~vPeFv&!+~ zNvjw+pYuNU(HrESe=DU1V{Ccv-MH%L9fvsvtuLi9fxzx4L(I2AO;y#dNohzn$+KNw9 zVN^b~^G!o|%2TJz@L*DB`5dMr_=>zJH+-hldKsIxyhy}IXN+i$H`?uxVKdrw5sS^1 zU*+6;K*-?R-18A5uH~n7rFxN^?_DR@+EP%;GKAWlT!UM{goF(&$R!isrBSs&Kd7%$ z2yjta_Nx7uLAKJeG(io4#>WDlIqzi~+YOD~?YAHi^ME=N0%|y4^}c)aZg|=jmdK*c ztie?bp~myKf*HQXq%#ZHR5$Sav)b#1rFI4;TmYkx?z%{l1I|Ao8k`4!XAXci$-0GT zWDZo)r(LUD`NTP+2D0yARqrmdo2u)fI}rV^wV1yTNP2w6?`|JzH-S{x#gSy>vV4zPazj7}( zQpcw@NQKEj*QjQLQ2^s1QTtvwy_uu%&6A74%3lieTTazpHk>mh;}d3-yRkMDU=7)u z+8Y@e{bplQ#b`fm3>Zuq2*C>28Sbr(0cpuQuI05+dEc=q3E>|cBMbtngp-*O;P?>B z8QGaw-e{fwpd_IYpjC`)&F!5`S#X)LuMGzd0R;#XfP1;-K4h&PTDh2+vivX=1Z*K8 zKyv9<*!r^>^M)U}o=fqo{Op>rWc#US{{QOD{Zq8lBA9V(x4i8ZhA$^38q*@)8w8cn zPJ4w-6tf0)c2uIL7=g(Gp9(e7S<%fn}J;=xosZmp|>?DUcP(57aAZIZ8x;=dYY zxe+TC#rK$3?|2x4tAC2XMcZb{CCpB_brF(0@|1Zn(q{FW~0E72|PW3-d%Y` zvmco62P7z}{z9Gn#ozG0rBYm&otU|@IkNAEvfk;Ryj|udMmL2*z*@Sqlzss84Rry$ zE}J#efn>Y8t>3yEgYj+?O!lkrBMwTEj9qIB6+j6SGhApTF+G_4! z)RdUnL7d{v@hxd%bZ1TYm@02?Z#FGfbAA76)| zEFn!c{1T_{GX6YOrTMVfa_PBU$9voI+9}}c1FCI8-nTG(e1Kb9 zVX|^!OdmLI4I-p?z#Wv8w8ioC*=^$aZ(1&Y<5q{C|HK)v3Sb{E1HRb5@8x_I$C7X$ zD_1+@y!wU$Z)|=qfc@__Epih7?4G=C$o#kWTmC1ix&Qax`oAcU#VFsr1ji6rFWm{_ zL^0kU4dPJt5z~N|j`mjN<*_rs0Bch$7^YzI>6fhQQ8dA)C4qUA$}t6h^^UR&2x6%z zj`Z|$>uU0=o_w^W&)S(634hKfBNX~@`2@?Wj+#xP*lP*OXmsCWr(bpe`t z)`Froad&lqTYxZ|f-##u)hgJ8U5IQr(|-K;6H)w_c+sJ>ESSl;tpV38qfkOI(niJ{ z3w}j*AvV6}at{X>GmrYKR2SRR^PnZRF&KlK^bVaY@yVKjcqo(SP#@Sz1&RVtM+O>3 zp1{{+K79dkFXCnoMgNuGbNXX`)5C?I%NyJT*g_3}kmym8KT`wOyU5JB;^i)J-Kp2n@Fv=_&28u5$mmma4IM~jc zzS}vW&%GDOk3d(J{JsV~6xp+p7tP;23T9bq)Y_PdNdN4qE|Pjttb2- z%TR2afpldm1w5F}QS(Ab#5`?Pg*jUl3UQ3AhFcl~^$<@iE!Vjy4P7g;+`q-6@0Srv zUAz>;kbDQmVuYh#m%RVdz1B3%SF2 z$9|IWD`FHQFOyR|Gf9nHSeeIb`eV`D>^U-mvu%nmu6hynKR;C!lWKel0xMKni5414 z4b9eXv*A+T0K!m~2RC+daBwf8)!9Nis7KV>W9gNhtvxtR3>&xDo0zqF4ciwNs84rQ zx*68UZR-W0}#-t<{s4b60@ycmp&*!rX=9+fojrAdv;M6mD{gi|Q? zqv*r;D%8ooM-~u-81EyVR*fylQsv3wIXk-@W2JNuc_FPbz`TURr~k%RqK0%Y-j`$N zjfPaqG9$wy!^k&6N@!#mL!Vh~5H z!pb#MPdN>Z87rC*?mS5jVwtY2?w8PfU~prPIJe=^_cHbCJjL(6Z8Y>xql5q?@*n_- zJn-)ldC2$WCp3sBKJH2#GYxUh(mlNUN4|+4i|_cl|GHu5KOYSKrL~CTKigXLLpBTz z^Y;DzEQr5NB;HiTUk}p;^j`i6RZ6ozo%?Hzr}yLyXXI!(!y=0z zAky1e9@y$gT1shgUcj^Abh!HsA~Pi2$KTkIgDu1#t?NtX0ILljCpUm<8x&1Uj0Q8d z-_f2&iKb4~4UR(wwl3x2X-))!vq2BiOTOUyhUabO zOgWk%<|=vbHI0%QBG&6A=5wRONnVi!;K4Qeo|tr&d-=zol{O4{NAv_9pc^y($&-TrWko=a0qnbc^idtR%q>UgrSWF(FQ=-@0OhXcX#g z2m2~&LYx^eBs@0xfZlD)BwcGhwqO}4n^EX9W0J&h(wki$n7={2Kg6h zZm~NMA}n{Oen-jGUj6zCKf_-h2 z%pBKB!T+Yq{8L6?P(v6~HGSjR*qGej)yJMJ5pHR-%1zA2_h%8c;$4QH)IkWo1e0MY zX^M`woFYcT1zo}QmdDatiKu;$g8O#IsHDTJfT*^%xiZxz@1b#yuLh zZ{_NqVsu2AUaFh9H0+jnpbGc$7&-UxT32I{i=0X{H9n|@_Vyj=%+Sy1#n|!X3e21b zuFoIpRzR}ZM{o>{pvix0l}5NPTkwXYSrI~Qr@S%aT#V2ZV?hlx3e2r~Am@RwRTERQ zr3j{aI4!3UFs!{yzHI>AERj>@3DiEsNN@V%S$OY&SLOV)on|~9HG6aZ<)dRM={$Qj z+BTKZwG%_>9WD7XOqk`Fmb_5*Wj*H=7cTW$R%f!Y3nD6 zQu0+Vr9(P%NtrKTKU$JH7d%E#BhlKlBj660nF)?#+0f?pVrCS_|R1{#>G%|6q0)C5%3&2%91a$ovnHhfG6euRiomz+=5OC}8-*5?l zaPhzDa5`*5TM85rINxKkV13H2J6ksZHo|Oo%~Fs-STLLUqyOCrIZ}BN|0dH7{44g{ zq*)YRX4A`_wH?}jHdiYlyTA8=X6B7f&Fi4)k&zXW^CQDTUOht5}TC<(j z)5)z_%HzDKW`j|}sS4b+x!$*yhF__mG@P#>=)4`f2}aaMsJmkpv}} z(K_Z>)0oGR{-g6>D%{>&aG||GSP-_NvpeG3@u!+SDG)`>(pJ-gpFmWW>?+GTWb*IY zW>sWIO=fIg{&qn2Scxm^&|KZ^!#$?k5A^@{1 zNAwqMFB>D{G-wQYME8Vo(>FhIK4rO;%AP^*g?HE$+`P<1%n9Y1orAC)+b&C{cS8GG zpA{~Dn~gl_!@Uwsx$Y66cDii^)G+-Wu_@b=XJBL5Q)&@VDLBuw-QO{1mJYh^1)aP$ z<{q}ySdkr#hevXy#!GFz#1%Q{cR%NiHLA0s#uSFocc8^5nTlO*CevYX5qvUjf`jNh zZ`EWh(X`}3SFz*MB7|4nCf=1pI$$8*PW@y7yJ3Qsx)CK3E8$s+VWKYCur^h)K0G8; z0w*D_6~|6-rV&9b>r4#7q>F$zEcpzmyF@4N+xt-|C;iJ5Mr;*Ycq?}AIW=k!i&1B8 zwlgeXCZvCAFq7Tz zxoG%+McrP4Sk=tL(#{^3vu0)XV+;{cEp&YvJQ~ff({AdRfWo(5Hh*oQKj-s(=XyDS z0ys`KZkC%86+m+O=i&e0o&2K;K5OsQmSX`#$V&ti)5RgV{a$eFum?FM=X?cOpWfum zj8ECosl=U==LrOV%G@;AU8fQ~p)Ppfy|6_4srQu%Q)WLTXaZrZIX-ux+?jTbGX#bC zj=SFnt#0WQ3Ut*S%AO-XoC#)!*jKN`X}`VPq51ee>jgwu?)ca6{QCy8BJqJ7)8>5T zb@hRl={y3+y}bKSX69aLIN1E(9F_Q(84X(a-JL7+plsiesi)F~P(Hyg1gl(ofcOf= zGq8?>e>;7Qy|T%w|70*@^U^dL%b(3oUs^Avk1(t%1GjC$4vn2me=*H~e}D3`TgSFQ zqX#0su!Rl8)R)N_`^ZDlY|xTx75r;>@3=$jwi?vF8=5ByJ=RexoqLbmfmHnX19QNW zTR;RlM+3tA(f{t89NRqW|GAGg5Eu%9aD7id2jTn;w+or^;Bm&gK3uh&QmdmQt(i2? zFkA(V;v7#{+S$)c6@-I5`qooHVL8eBQtSfmP(qrH9qe-xsMeyjUsq_K~F1(;a6y^$4D^-0#A%fVEGlR?zlPfBemAN9A+d| zP;Z4<4+Ef?&;%5l&1>ZKe<2ovxBPT`?$V;J=jD0wl^|r5A*toWF-~MKnkW?nE{tYN zjZ_naY3z0bS*C1{f`o90&dx!*PmxH{xuYk~KX zR>h`I=+nN>uNjAX_@!15MLd&D^0*2%M*PsUcF4Wxm z(RUI`KT+maA1e2CE&Q+Gne%R1>3`oH|5J$E{IMPU;xzUGtlVBFOL98HbLDw0xRE;c z8;P3t{rv2V;Ub@NtkM=Da4*q_)2pQ1S!vWS>vyB(Nza_-sEm^LPPKz~?QrVD>F0uV zCS1;K47$Sek(I;6)sE|2@i+X|RLf+(s5xnX;e5ez)Y>7WhIZ-7kZiH7I?j82WXkFJ zq-|GR-*5S$imdUgw?yzJjXW9W7oH%`j9i8(0|iZvDx9ow5L5cckz5Bk&m+UzwGNE^ z3@Q!Gn7ffdFYj&h94pJC_~9i3lrJ_fq;%hNrC}*eyT8HXx zi2S3n4n^yXLIK=9F@-mkC@_S3+zm2Of0;Vrp|KupM|RQpYgev=`_>t2SrMU>N*na= zx*6<}h^3!^?$$+Ec(bfnFh(VTQ!C*i0a3h2nE0w$xc?sh4(xKn@3%GB>1e_le*G;uhiQT!zSOvHO zT%S6hS;m$R3=wtho~8Q^`<5R-Gt^wP_UE;ZBtuF!ZDUh|#WkyXz>+wQz4IZM#(Z6D z#6JQDLVD5TJpgMe2G1)P@Y&}P>&dfz%@`lry*Mpr)2|#Z`V=`Q=8%kj+!)2Q=ZcXr zAy&sXfPnd9uIi0T@dp)7==~E9zytv--~-}?d@y9bc$NX8(-AzR)VdMTR@9cef81;5 z!r*sc_?MG~IhomS-3i89CxVUmKR5IDdjSO?uK&}}fupXl%VX{C8dEU*zi$nf387GQdZ2 zJlSh`_?~$6W8l9vK1!$5h2~#ZJnp*DvPr(bG68?`kaq=bZu50mut#B!6}4aWwh6aN7@XKzhc0zexvX)iyodC|yT97a zRM`*9$C>f|L!J1+WzLEt7_+cen8>)&V#63LtM<@iUk(0r17VvJXol)ffeBx=?8{8g zG}j{uS4~=~1K!$$MS0%Bl!cl7O+UqL7;kd7xJ)WR_$N$(YXWYI>NQl|x-H;f_tpQf z1!m#j;ptzg{{ABJekPx9vvxqS%S}|n%FGVbZQZ}dpzHkH-NS#&HU7ytm>I-2VZJ=Z zBEtp58y5L&xz-$OJ>tika;9Xz6p7S;Z^@BB!#tkRWHRTbX@>NO%;4IDthM%a%-iTR zEO@=|zZOn?FOy>OW6;sdg7}_ieZtu6=ov4ci9caf=syS(X~#^`U{Kr-XYlvZczL*I zU^5C5U61|+9fN(kO+44zsW-m0PmS*FNU}gWrRm_}P!Nt|zx>Adgm*E{TeXGW-BEom zm33W(D26LVGL8%Lje(dvZXA%>Brt9uzP{pOd`AG8dMYPie-E1A6+L0BA@|A|hYA|^ zxIQJ_EPoMtGwTjEIJGi_<9Z1j|1wu2G)J&;y5}|~^RYo2-KL|>+Sgm>K!sW9uj}>~ zU*6{R%rZLsyadt|0mbKqk6B&+p!{#z4u5;X--HkBt2EZ@OnRy@G>VB?DY)osu^zO> ziO;DlGDn7S^(D62EAoctg>WI|(`5Ff?bVbk$#Xd2c1+!98R?HMd0pdL&m5j3l_rpIlQ^tC6h}Fh+`QG`VcxQQp7-dhESA9Ntg1sYcM2XO}F(GTs}hz^h78l z%wkkEKTKQiE?2cIUbTv=NzK1kSO0+6r%bxKE`5!lreq^Azr82uth~ej2Ol-Kr9uzU$`1$ehCcj~$Ta{y761Y&T|zaU(+ml-Jx6>c5qRAUOQALP#KR zfSd*_vHjKxkqI-YHzg0(_uo8{Ce+5ZsJUyB*Rh1@9g{S%Wcei~b)z{0T<=HN0FQ<* zYGq;NVq|-VaQHO>?*(Es|7otg9I@PFto z{)wDV5|$6nP}&%S-E`6>vzqmAh`~Idi$w$tQs@{@#I|>J@%QlErQM@uja0 zPi4PZYd)*RTEkOb_k{)_Fqqj8NP?)fdd!_8WJqBolf-Rlj9(598Q#Vbh)(jLY&Pez z$sXS@v_>USs-8}~O96zgHK%dl!BUR~zQ*RH)t7d1<&4K_^BrM~E@UIjJ%rdV+iMPn0 zEe$4k(b-nB#exe%y>9r1s534G+1OANaTl&d4cn1E|G1(F!}uHiY74;(p++U2@7q9v z_*I!5dgc4CBQ8Y%W}0QmQ=TCaB>}+q`K9UIFhP@;C#br^EeqYO2O@ z-5Hv$Wde^yUh)WDN^K~sjN#PK{s@9!QkH#~LRdtM0nDQpIv3h4Iq_L)KJu^Otp;Bw z78Qmaj!7%d892ShbR`_9!ZuEQUC8|+Ez5i=y1@1+#_Go5mxCZ<+eWo5ql8@klX8tn z1+v#^>xtG(i&2Y7N;HN!@HA_>YMQl07b$xba6<>kyXJ$dcUr}i5&j$ zUB)&blsO>ij{>^TTVjR;0@$(ueOqY55EoDtFwmbr{Eg-<^c^loj*^%(TxM({4=%@k zVFfjy>wu5(Hz@qu6YfCaP2dCu3c?Ckk%u?n(-No=UT^JpbllE};!}qs;8|N#m(^2m1x9Taa3g>w_TE~h8sgnWxi4)J>l*)^CS(nwSW*SZm z2x`IwF>#08R}CIW5wt@fo^x#mI2QCaGW(X6@FJ_F?Z&YC1@mS`*{_1tB;%FwyD8#n zN7_lrjI>^fp@a~ClHZRVuKb4OM2yzq|AK_xksE0wR=0iZT@0y{xGcfbG6l!-Wk{N* zTE~rHDpgXT3APXApzD)QFb`F@JkiH|8vEv^AFdLRMIKMUZ7#E zeR%7!!re}Xnpu#E*R_E(%`$zn6(Aeg+y2ciP?h&<7bpUDfjnRri26<;{iO)m`Q#M`HRav`K@M zc2XihLo`rbr8yKG6#l}`B~QETpaG>iO;g*yiqiv@?GdX4xNc{DkmRw3x?KPV6}G}| z8g<8b)%!;X0tj@A{SfcFW41Nri}LcZ@omMP>OG$ za63j&j4<5-SJ$3oqn3rxxpB$aX4+P1wV6#H#q%nEth&TjQ2yN=$uzhoty9=bbr`gu->C2YVKd*(qytgUXe4UXR+|K= zpE`Glb}Okza`>q|!4rz!?(X(>1jtg#&QaIVWm=0iex3Z(ondd>q6~Dg^?TW=W(!Qz z%|rHy=0TD)Q`=@yuM(zBv(z*wTkQupSyFNh8}VO;-)A+h6Cr_eLdem5DBg8OGt9gY zKIf=2U&AS|sCZHbO+mTdRDHzay+ zb-e(x<|eynVFOifAjV58!&bS0XQL%gI#^$uN6}Z<`APLDyy;Q7rh>lGMMbhVm08Dn z{|7__3UA}pv#hGHS~2lgLHWs&QTfdWm~?4w^j_?SwkZC|gT+sjH|RF3J{EuBV4!zz zHIjU10$;DA{1N-Lh%jkExqI1yRoB}d{G9T9eB^WN7F>t<_9rqeG};*t*jv_pl)k7f zQMi(Y5$eu0WV|k|w3@{V>ifKa&;&CVpIJ2W9)r_4pS|wFw@XwI>dnpFZlwTr#$NP}5ev{kZMJSlkx% zlSFSz?_^py3x*IdF61?EqwyIEjvg3IhMYpBSIlryCk0kv&KXQw^x<64J0s_b_0;8kBHvcX$a83XH0jS^mLEzA^ueFOM z?1@FMuX5W%OMeUPfKccy5lH>>>03tdKb2MlT=?q%ob7vB@#gS<<|h6rqqvaqep>@u zDo1DMy@6!tcFX*?wS5cxV>8Q24aaPK_r{NDQdw(#`C$qG6de5&OFTpSPtw&=l?+oxvte`$eW0;D0Wq`_`4Fd^NqnmHW1tFF~m}_Y0 z(j}DdWQ=FrMPzS)E8GI6WL8v0hHZV}0bVTU=l|xcMEfE~Fs~m6^QxkEU*8#V&%HVI z)bm+WIkd%d48-|t&2CX|I00j7g9agJ70qE3UoMxfFW;)I;$nkcwv+K*-DDL1XcQUk zd_5XJE{oz=X*9r}b2VRNJ-*5u5PhA!112wo08`cc(f{t89E&`&|B+AiKb1^ml{u>D z7l^+=?aqOYigC|ogF@GhBgFm;Q@{_0^EJ#L#m;K&DHij$`|&1DTziA~pt%Hz)OjqY zUY)A%PuE#A!JiKf8P6t)Iajxe^^sRk1cJRJ^R$YttC1TTmhERF+r)qTA|q1B4zrJV zJv{R*?~KD|-xNw>bXAHHJLiy%G?ENB+d!nEFC7SH$b_~}_rnl7?-@nD+zX;h`V#Xb z*ok|GcsuB0(A#7?n5G?h${J_7wXsv#D@w-|BNP|uZyLB^_gp0zhn1|bvcXV|k|y2> zRv^pnb(SKF6y#^ZO(YqoA`U+e>|#Y&qstQ8K+K{}FR!Q7)_BQz?-haHY;)Fch;i)( z{*g+QhI{rCF~Iu(AFvBRjF*3h7&ocJpx+(A|70rhM;96ziiG_Qs9aa~{0=GLXulxk z4?ofDSCPVhGJW{J;x7M*6>N1hhB-LXy8juk4?Fj>zm(<{X%JdL7qJK^Z}7oJh*TEU z_GvJle0J5W!?PY%&~iutX!*V4GX*9sX3`HOIO;Yl{?Hdkn6CcZO5W>V*=t1NJu$XYqJT8Q6%B}@FBW-9wphv&kcvdpgs=4RUR5;>pTePhV!OGyDCRgx`XP-2H*zpf4Nd;r5 zMn0a3>w$0<{OClHU7WR>Sz?KrqR}0T$^)C%EP4rr!P%a+#+v()Yjeu7Y(w;)m}FmmF8?s3P}G?w ztqRrU=Q9CwZw3F#7ptyR|8yL)LIf5;?zGURDka#g-|O+pifD`O=WYCx8?(p$J!NRY z4g_jC)}}UkfcTwyhm`X2Ps@jR5BLgWfb}ijiQzZWEnU%oebs=;H4VX_IyrdR%Mz|fx=H(@K)5pYOTAicd96(4RjeQvF)0A(ZQMv3OZKCpqyQY*JGqCf3R_qp_O~ zN^Toz+B{D+&Nr}z zW4^tm$Q{ne-Q)MAho_(TU(LJ5v*8fn3l6xDr&yowIvyZ#`{xsDBPSnt98u%{7wDw`DFCy@tKFay)0{;}Nu z;g4EYPy`4gW`i8PY#nATW({UFOjxUjMiypF7FOoWfM3lF4FySu1P+D^fgZa)h8tQM z9b@xm*x!0w5}V!|hmn~Alk9sXEKtU0&-lY`Z;D{uoNpex{!PEKC4OUOg&p&|jh~od zk3_i7z+SPju>E19H{AsZ=5(?46ek&*RPMBXv0_$BTfrEwBtjxo7#Yi7sRgr(*ALAR_Mjj zQ{uk2rWjlSeTjR|gK6N=>|M95P+)Oa&-#4` zHlt07XbxS_55Np!KptGUEDEH3NKJ$Y-?{z)ml9|B7{wmBI_ctrFeK~jP==B|bxmf- zn9hE_kC>oSOf8ZP64W^xyQE`X232IInE_&`Te_&%Y102g-CKrL)pqT|bc1wvH;WDl z>23s(?(PohZcrK&X{4p3K}xzo0cns1k*$?JnV^aBS4A^zjX1l*r;p&;`keF2At`q-|NhQ`n3|Mm6%$*c#;TNy{?J^LvJu=(ZNBW!%k z9X@C%o}`Y<)Prc2XIwae@A&S8?2sv~uVS!97BRqfIG@sS`-CnhO2_2nyPh}*dt~dC zeSFflU}@}?_6=71u|dFi{_eMOMu2HWJMYIL>&WD%F>-7(94XPhAqq8C2|}>nCgc4P z1*OZ(Elw^Tc%odWS;mjWu`E@^hw7;u-dvXSo`s zJ<0-$NSz6)DAvd8#s!ogz2lX);Q~YIdE^Q$twdEc#9>TmZHLkWox6biV?{Eoow?Rbo02?y69Av zEG`iZZ|#!?`}+iHKadNdPpDn2QVJIktoXzXfU8jR9}A40$Zng%@jORMeTYtmW{@T@ z98Bf5BBQtjS{$f_`>=f60Xchgzrot@@TqD{eixFA;{!&!hsPhp56o;Z_EEI`3DZ24 zN-n{sQ1jJIu%{brKc|+PZTk#_K9Vp;V(+0b#vpk?zotu@8YuPXn?)G;78EAE!(G(y zqay!r*kjmVGBJ?#K=!x>XhGj)V!$9_|1_R|OSjCA@f9~+I9x#Exup{BnsT^USXo*B zO-(sKF%B@&`(FU`mV0|}!=%80`2n*kDcC*IFAzZ(O2KKu_8$0tD3QSlB!GEUNFx&X zjmfu|g)l~}IV*?~m+;C9ADc%rO&5!n$I+h^@JvqyrFXk(Igmy9N%P;c}gS z7p}7cd41-+7}kl_W%ktdOUb8ctE{W!3C99;8g%&X?C&Q`t_qD6!mX%v>2@b|+q#}N zL~_J_^FEnIL2FNQac(WC0WDXpTQ1=<^cL(D^P&=KQ+tvTiqRd=fz?>SM-n6x74>4sGB z59eQGO%aq0my@Z?i8xzr3w~^UOIodrKgUim^V)@$d70sGWo7!q{Pl{@B)mb!HS6mK zb@Uh*8;KPonN>~u5ebC2(FB&+dYrXE4y==j2`|Z>`DM%aF1{YFGtr5M&Z0uu!9@0G z5S5a73o%l-JAR3vIG|t-!+aV$g%EA13EsvNPAp&@X~M@darI0iq+9#EPj4oi)n!zK zg&kHOA`TPz<4Y>>^M@o$Cz}KscTnP62JkKZE11CF@FNc(Ai#m?zI*R$+yMOs2^m%j zh_RiaBk*<{vEdgMzqPCU-3kA`b`=(2yUL$dc}pns!(qz4g3`z@vD0FLWHMPr6ZLQB zIQrH?iGWxoZm4xqY2PiD1CCAgIMnr-^F{)j4;Jyv7ypyU3+Q)KIuE1x(+Lko&0Ae_(pQ9gehaYag`Yvif(g|gz9B_>H>jMMJ%Q5=cualG5v z2?J%Yu`0kNm(!J13HeEhfL_$TdHF83mz26ePh_U*cpg)OD$yW!>*6_FJ_h|WS$Bg@ z%R~|05t}wCEVz@H5w%Pl#TTixbkcPpP{@D}*z1;-s#cb($~fc2bH|i<044W4_HcR86VRg&T};vUbTh z8siNeOG_}}r5Wg-T*d_>u&#Z|4!zv1Z>{E?rx1T!_aSvPDigG0!noN@?;9`vLam>s zRz}$gF8ru-6|xFI!K3EF90yHxrxi?KMGBVS2A*I^0yCEEEaGZ(x% zdZyoOzmWBupf8N_DJ<8}z$Bs%W~FNmPq0j6SkAau;yyicZG#GF3#fvb@XLd@yH+P# zQ(u?LcjscGRcPTUS}Aebm5?Eg#{G~t-ZS^#&CtWUEf%?vP`9-Ns?}OMS^Ys0NesCE zbe1521kugpBJhGcX9-5`ErSFR5 zG&vIyns7FVFWD@$Ck_)857KuHnjq$;JSfS!B>R$+Rz*sJQ^Wb3v_%0p&T(uULPWE- z^8Ks0Ci0ISCZvmIIxCQ_W5J*7Y*{IkD}x`>#87jjJQe|%X8R|4BNC=LUt^@}CW1tU z1%hw+G;PpZBP+)Bd5veWew>h;eL`D$gt;m05yO<bKUi>xr5q1YxEYlC?~Q zDR>csd|9#sy`D$)X&Gm*17!Md*Aa;p?Wv<*6`2x0vw4^w$PDWZ-?e76zT}DoYXS&o z^E=m??@RZ!(%*q0grJv8-MT7}*SR!v-GwE3UDZczEKCdC8r(9W) z1zSfwwdEa;gayfa(@@6DY4srholv7u)PUGR+A*SWng^+M@F`|=PSU<}=vy?@hwv^g zMfEGZG*WT)J$krw+A@p&jxJ~H67GSrktxdUbFMv!u@ZEmbfCxhxS8A7b#RUTXEqIy zYR?~zjpYsye$6N!D7>VjPLao(Y_p%vZg19-IsELAV76oGv-%~ej-%$vdYi71_{0cj z>M^Vr#mtqSzWu2eHrTE~<@W%(vA8^*^qexCw-`A`YJk>0oAu)}eAk5Tm<6XYN*|An#eS%0 zArPIJpvUcMA-$5DaiTn@i2Pjtix1P{@O(oQhnNfN*1Pkl6#7tEW|Rk%FCpq{AR^)S zYcHOrKg6tI`jAw36{euhnDy|2Mk~Bkx_dDUji9`_UWh>Hv)o5?ZRAd7=v_OiV?1uy z8NZG2iufSy%fl%x=G=Ma>KCgbl8zmiE5}6Odej{sdQmfkq)#nEU?MA7u)jIIYWD__ zhm23l!UAinP)>bA%uPdQe3o9ST@g1@mAim@${=Xwi(Xk-wH?Yga9)tkE+kTpkM7_* zNDIoI!aU9pZ51%*BdfL~&=KG?71{}?-;C}hg~=#+^A+5ZM_Lv(2g$xu)q+Gwj*J4` zw8RGA#i?#(67!Vf*MR4CvO4Fw zPlnIiTdhJf>xqfd?P7abQqlPMpT#M$7sb8E9L0X`*|kyX42k*KgzCK)J~S!Gw?}Yz zY|tWT?*q)E=5U@idv6jf;&KgZmWsz&_*4OMx+6apGW!zEy*K6@eO?e4W0WkA$V`c4pHd}uTh*DQUP2%^0VHPVp&#~uS{ z-$Q>DHRkUy4~Kv&{QZ`|wna-LU>bl}*oKjwSjN$ik(m}iee*7WM<6j$ke2*j5BRf- z=(lo_Th5M+8Cc5;xRImdyiF_KTmHA-|DWCy3ltA_BBw)GolN?RiJtMuS*4FMp?@=Q z>;)w;=iCTTfR?7zfEBhRd1?M(9Q;t%EV^%xbeZVOu{kMo4L!#G{1u3~@O7|JXBBR1 zo{SZ#ElC*jexhS2EGi}b%briDnen_+>n6=G8HP&}LN%hhi3dlAlT}g}U{9VUJ(1RJ z=$}MPL1R@O);o0{pLDHAVLb*38X%B;!Bv{S<*H~KritvYNOFwA#}=f$BGI4d>&GsG zvt@K-(E<5-M;vXUf`sY?GTbNfhjmRNXkq|?MBa~+ljb`Qxt8e05|L{0zCcTQbJCu= zxDKjpYlx+1`5?s#w@zs2px3?1jU*R;q~2`L^_Ihu^E!E03rQWW(CoP7Erh7M3P?$l z@=?{7g%jQ^=8=Lc5+%cqT$4Q~Xs8$HzK=VpmO-PjTFvbyo21WQJbC7Y!dfnLtZ#`u zF$inQ?`?TR7_DENV=xVyM?@+lNNAHB#y@!~@W|b*EC)1hB%KciBL^9jp@PLZKOV8d zJ>?u4*%ifRA-b#X0R^rj?FxR9VDcPE@LD{SIb4OgxUbo@tELkGUCL1canA z|7eHghJrAmg$B8s$O()!0kGeRL!d(ib&J=CqwTQLdd&6?3BI6Ef|(bm$6&@8Z-#!{S&v$kc%b7SSZCMz z$UgYWEYi=lw}#Y5H4BZ`bAEsZc35iUw>2@|PBqXbcU57<3YOSsM8 z^>rT+b3~V(bL=p{ND;hiPSrfw$id5S$o+U?J7apOxkwik~w>+!CWEs zr@Ga3sSSm&2YSy57a4FC0Wa9&w2-QyOL2Un#bXqu8D&2QE{?z{!C|Fb;Fc+Xt$=13 zaFWP~w5KX2qaZn?K}D-D=22^la0jb0a5e^tyjVbxrcY~&3uM#leef<-N?7TNjpy0B zb($IHf)9WbbUU9;LJkQ>QbEmNzcp;TaKTWKFJ4bH^4~?Gt>;;`iEmfnrt6nP`fa>; z`B@#gt@!hz>=N^M*Vfv8*;O1NCLHd?r*9`z)!j`5m6nDv-UrL=8k3wQLP(#pacw+9 zR5~!N7u-!5Pk5RUvw1@wy5`9l_(PDum_+XTNe*dTmiIsK4;bSo4m_6Pqf5J_g@cvd z@I66Ey9Ify-)S6Hli$=;KFs~Xctaq@>jE)e;tu1{84pvzsPm@Xug9|rb{fGm22srk z?r*c3jIhK#od4H)D}(_2J5L|uZ?q)DZzWfNvygxyE5Ifm4ptT*qO;v!{u}S~PuN}2 zi-c?vwSk_P$3hFI%HeG)(^X-^LxvuEjpLouQ?ygzobJ9Jj#p^GJbebQEK}N%gX_i{ zCUadhM=>k+$&UqIWVUBIqA1H6)Bj2|!cS-mYR-$1#Eh4I*jl`G13I-Z;P@ncp|i@l!R2!-7ieg`QQ7IdgC-h^iZN`hQ_ zSujG~gUk)vgT^tKR$TnZ(TxsFfbIH>*zDQpj^1Hi#TUR3Cs~lao+yokx~YvzE~9S~ zw5(0(K)WbfEV?aJG|{V*V6$?h-L_Di%?*6L3wO(~nF(kt$<#8zYBJ^3o>vJWvMGMP`lR+4 zVb6oEyv3HL?U6piLkY7PGG2*I4_LPXtEqfI(x8t$cu1~>Sc$!xCk!}=QAy1Leoi@U zCiAQ@#Bqz`n%(R*pL$;cC2DwJyc%wyg%i989||?EhhEKMw2A!67O#x1kC_@5A*e>= z6~hS_aFMs!Fp@A)g@P4+J+MWh32e6!sED`fD%{;$^&m{qNB z`9myqy<_C#kB=CNLAjwJ&YXOnHA^aN?{>F);&1wRO;-vTk0vDnSR*Z{vm3pZRIZ5>$)IF}qomUT1Ud~0_!EX;7<&$%tbFsRkxYLpz8)#tkpzbBnhx zb_|Nt1dJ#K-v&hw!Cb#{Mz@|_q1q~Rtx~S77FZ)b9m#Lf6YB|%2>5pTHN!NOl+c$l z6&WJdt_6x{CS$Z#HE$`2!P`H5E`lzNC5q+69w;vnVz{<7FVDfwke#-{c(EynP?&;S{gIux@;@dd!a`cKp zwH0Gvi83975&0Y{8UQhyS7}grU7l9LTk2A++EG=Qxo*b8hs5f}B4Fzmm#k+M34n>V z6UdcN!#Satkv7)Mag0tX`Ec3-Mf#=4VJ?U9Txq5p!-)8d-Pmk)j{d8417Mn-9Cdn= zo!vC17o;qagwK(L%!rMy-c>zoV!@d^C0jBo!m-pkJ0Ij!+Y9@A{6Inph=AtaC zT@>!#`;#t$%wq6F`jbJ5&ZBqa%;g4Jaoz@d6y3^28-mNU4ducuvvOMI+qF!#o|vW%|1Q$_n=RJzE-Cf$?9BL zFPM34;PaG3n`BT~Wv|XAbUOb{{9yQ!T^}JHu?S3yd-bEs_GR`30!;j&2D+#TySw%d z^xxgP`|Q-Wp;t!YaUj+3)fB|amaRC#0tT!lgv*i4~{GWfof5M+;y{dTSI<hMQD(xb4j6`Dylr`9o=}*74{@BQBo!A-=~Pa&vBK z%(R3b)r};d5GQ#R>Uh0cpOD@1cP!|#{J29S6-Wz(eyXxMI%NbMZor8;IkeU0K`bbe zwcVS6wP0s7Kw!*#>Uc?lTvW=nP6X%qCF9-=tz62Tl|G$DlRQu=q|6?b zj&k>S0y{z}nlSJgbJ5mp9Bmtp{dk*j&`*9DTB7tugu5Y`Nk)_$4kexM9^X@M~c0YHb5wX4-u^vz#&sNXg z5%@O;2Pdn)Rl);a#F|*o))pvur>AdeL=4pWvNqJSHzam6vbO?C=UE%xNa-1xIRb6L z;YMi>D7Z&Yd{csQHx=;4L~Ot7;sN!#ZqEPhxo&DkzRwRNzLV8s1d#sxR-l-ef1{bl zsBd)-@5807wnu4dp>VdixeN9Z1I&AO=K#JX-w{0*;G5-x{&(lR_6^AP_5B~WGQT@; z`qS0^n=*~CG4!gdgOs>DoUv>#d+g{>rk+aVpG|DI-P_-2^DRCpleJ9>&|AY>GQ&n1 zI2TvQkh|U^Cu)2V@*K<@+LoG zajkI?FLzASxo5J9wytUftb~_f$!Q4vaFFs{^-K2fl$wQ0DzS6Z!;?lUN^ zLlau9HRHuB$>2O;eJT{(%)TCIq>6Q7mapqyothKEy#5 zCgsR+dK=%983OyPZ?>1InThGmwza?6?ncgk<#REtf4&d?EcHePE7GJihkukB4ez#J zB1Ylz=exo3-n-#9Y37?Q@0%@q(;)IgZWSI4*~P_$@yCPRSTi#nfadO9K>G7vNB|$0 zSn$Ua6N{?;XaWCGk@;O8>PMx=&n4hL`!xTA`kj3%4y)&5^(zbvEV*+lz5?C-6q40; zv~A-r*i16v@XK_}avznq*Sw7$O3E$}ROcC;c`?B|?Z}la)hA2gcPy2ojLNn1P14FP z*2|!}FjuE7JK#iKU$N<=V{4i#ZV74yCKjQcTJZ6C@6%8WFS|ANW?6e!z9t?n1q~Nw zyvT|!a?zB$A}bK|rw}!DXq$>~NrHl;az=W=zJdz5ZknO9I8tikjH_Ds%Jg1I{kTw= z*`^LdY!GOgukA*kdOn`kHeBEg2B<=;pj6WMpni4Z4#@;V@uV`Y38``2?}5wbDugq9 z-)yWEAJF=mf-qPMR{@?FwNJ3#8eWm>opkRV>fiLl{cf{Ce}(X06^!NlZD!yn&ElYA zNtC!Sz#N+)UE6ONvA;dxZ$JPa7beY0tt{rPO= zW~pQ!Ub>Rf*$OW`76+=&?*gZfGsyvtGMF*RK73g;!es4j#>LCvJL%C5XAake31vWl z(p0KxKZQ#g#?X0%+T_V$z||;{?Y&G%2iKlxhPWQF*n+I~?t?RG?Bjh2vyTn5U>XlZ z#)z4x59(|wwPJK%Hb`T^GFA2x3Y&IAQ?-r&tGG#OO;OW$)0$si_-LjY^lyp3p`bF! z;QR*S_e^E7;AEW;h+hq0I*M|z19nw<@ex+-DJ z==pu)|F@BR%*6LeK4wl9PN0zT50dZu^4~-9-QMY+NWP3F1>~spealCc5NUz6%sn#< z%P0j9ym*gWzdQjDkXN?t2F^y%FSPQ_`K`(qiw9e7X-Kw8jn_wS1s8eyr37v9fhQ}0 zjZ?Ny|v{PoKEeHS?iRHz< z*)dm-l-3d%ycEI}XmZBiRXC5928o?C`24UuuJVFxba1?#N^<@sZz@byxE3wR`~~+L z<*8?0gSfED4O);8gRiBc!=3#QU!RP0p}T0ra6tQ}@0(;vex`U2Zv6Qh#PFj*29=a0AKrVzF7lTYIb(Qu>O=; z3ur<~Z@VJf2Evpf| z7K{siyq4Z@Z)loMrc`XoF3B57Oql#eJ!J56exV=5rBHN#MnO)Vn$2-<1E4NWQGZiErAO$P0y{uXwQxd3Qi< zfoc4Em~`8I0!-UrpJ_N<@Vj^ExODZ*4eGR^wm;GuV|nw=d~zHELoA6bXEjCxJ6UF_ zSSZVnnIois{k$C_K_VQqD-v{2gB2=4%-E4Ye!I20wh~dV&%kSv(Ip}QpO(zjB2dlQ zmKE)4K|Ytv1^Wy)Vy)4rdr;t@8*65>tDyygkwJ{f%(x9N`f7`RwC6>$GaLnCfd?3V z!O%k;_!eItKEs9PJO;T&+4he#out@99YywFegbcJGI>Z7nLooAv^k;I>QXakn9gGs z82gba9&RdsWKQ*1uSu8Q48a^c)#3`11VnFt-NZR?!DYslHBqr-vN1ZH=G!9K(mpr{ z@6k0<8MZS#IL*!SW#wSC+sk&v5$68IuF~WM{9XJpI%ZQ zBt>n*xKruYAH&*K;e2+uXPFKfbM`XkD9wIQe5#FTnVnd9UuAes&p#Jzk%DVBkcC0p zAx23{sC|G>df^l&fM7gRp-=E!5WTH&qWfu@BU=6+j8Bq z_8X0Xb|w8D1K;*jqxk}jNAD$)eXU*+LDBM}R)#-F%_QH;jht|wm##KUFo+L$FV&CF zNFL0pyV7=x$pkk}nXRRh!!60j@_l5+Z(N_Gf7efB22TL;d~v|Q$^9-wM*#_Jl>YW{ zYRT;A#iUMKjtJTPopuwi^WF2w#FXxd@!a@hH#h!KrVdouxg+#ge$KJDlg8ra25y?+>h{2*bQV^2?i+Ew|I5q&lh-t(kT8UL!af4y>Rzp6dug*XSc}rD<+8A~ z?gbG!(P!fztfpJU3MaA!u7mGG9=nnstBUG(JWqEpU82VriX3TSSyutpIL^@_!AZ8b z_moqK6$^E7SXZ`*Nf2e}2#W$CJhlZd*&|sMv2-iQJXk z+|wq(;v$$1Y^2>0_YZVjTZoi?$npD#}tL?G-;wv71Pd79 zB(6!}1-Y_%H61fEd7wWLZmacW1wx|0)U*4m&^Jr(4tGxi#gMuYIDRUvSq4S9Q8Yud zWyYn^FR8G}x%2U<1GtmkO}qn26(|_353u^d>(eMO>N1@}FQC3+4?UMg^7O08IXKd} z+J2Oq9^lAbJ3|2c=WLj z65JL#JK_3Lf)#FICdW4>Rrd3&mxn4d|jXYkT*qj+vsd8(}7#2ou)@bE#NcF18zSyEiwt1N43t5yOx>rbP@(k~U}$>q?V;iD zb%w&Oi~K{m1p#=&z?8ZtUL$S#qlOfjV{a3AU9=2nS>rDH{SZ@C;)4&XHY55qhI;@^ z-63LC{fH=)*wH(~ulcnw)~E;P+G0{I`-TxjT`G7s!(s^5OAXCKJqq}Q9nY3cNME1N z$hIHqclS_KcKhhE7JT-|0BcU5fYa{Qq4B81@(s80#TokKuL&6~XohPh?DHzWbbdV| zHk^tslTx?;!G3lYn12+u?|ZB;VT@C&Zv@EMPt!#7$Vl8jo)3RF@!Q6F)EkpT1Df|w zD~I?aT!I3q-I=WdKn@_2A(bH!B=+5G?{Y=J@d-xu3(aY(M*FWO`ueWP2GF4B-uf8IIc1z+l^6CY^N*kx1K+H}&%V

$ z6Vi;IoM8_ywv%6AO9=b9B{+GQ^(nClou^eHTQ@B!E8^s{=$#P`L!l4sDb_f8y^$t+ zrg=l;kgIK2b)qGn!c{)5;IhOHkQc(p>Fj1gPA@3@=yD&%V9&M|lzwA~Z;sC!#7}`ze#-JqQofHZ?HcN%CZxwru(`9LHVd49PS9^!w zC%j60_%*Wzat6q}e+0rp%N-;j%e*=5nKrPQCpwnI`TpS7-^lwLD7jHt1^NU(yJCTpkb$i? z-`#`%zdYwZ1$wb-Dsdxls^vw9mCgMVy2Y2Yiogs%cjr>On8~e6#IrQZ zv$--*h>jO8Ao7apUa%x6QZ<;g^)OajY>0Jr5oeSW8O=(- z)Md*R?E8yx25heN`AP_z$l24TYBtK?QHN=gdQ=uBecG8<^lyU|le6MaK8wei@?=#L z(tD85^& z506GO7d2|$LXaxO`#d*Wi;^+=8Vk-~>j<_HZh}E$rUX_$Ij3O$SgbiCi(1dycBn1$ z4L!*l@d4^IC{gETKWwVX@si43g;k3KnIJpBdhQ%%(EP{iN1xA!ghITtSa}#V2?bGn z4F<67EagRCNT=5$UzEuRu51(VX;Y`C^)**0 zPUVTO1l$YsexYD}sTUaES?*WffT-dfuB5F`EG%PxLF2z9Mem^?&`@uyIpDsIiv`q_ zDArrPl@&w>c`lRIyV9aEm_ZQ*c6wQsiFiny#EZsIq?%ba;e`^n&RF-7F~z>T5l6&Q zk3BP`5);+zX~e=Le>UzK6Zk=i9sx2QZFabO#}#DmLd(R5tCuCwbai~mCm$VPpNLuK zrX5UDjmA%L`rG4=I?QK^CxdfojZ3=JiLRN2$5LC&d<@JoxEkjrNs=cK-eDHwzk#2 z{+w&O2vH%}u|obxuy#o@Z@+h@&PR&dWFa)w%}37UB1USv*MTf)B&^E@N| z*1o*bkC@*Z8&~cbxK)L2W{l+brGMZ9L$0DXNh`Z@Ae5BWtKxb*9mm_Zz%PY8=KFqO z&9`5EAy8otJR9g2{!c3GG2eQJe=6(&J1DtX0Bo!`eKdavLj8Bh{4oQQc7JWJ1ifjm z1O>KN0v(HdrnPJ{C~)z%b=stBoJ`x4PKCE#Idi76c%Bcc6HT8nl&p=tAxCl=#b)WMqg5Yyn<8d_@NS#TN5*9F&=UrwM0EUlhyPIe(o4X&Bs@hGj@eu zDb1--tPe;pi5R~?bL{GKcYN-xqd+H{Md;+?9q@x$HRhjEe2B@D1?inJ6Fi=FVPBB( z%yqej`7xnU{g_@EiS9Nsi+x8N1>s4I6t=7QoELzTUjc6#f7Bu+NEy0pw+PDhBp~^U zBvQtw8o}?#*wzhqR6c9)>!4Vf^aK9SA^Ptk3Sg-px_2cm5Uw1&YH2AU&-n2A(}M{Q zNwzr?O5Q=%IAwUDKp4A`7*x@9)+K8D!qkF z%Cw>FP-&!S)G7H8v>`^{TG80LE@_L6nFxaxK|GJg$RplMxC{b_*EkT(YQZf7l`Cv) zA+t6R@R90(-kw>s>1x&gx@12A@xjpq{w$>MHRuPMJ@nF%61`en+*q?uf+jKEMH`$eES$0}d$9w5miL&+t(WhZF--jo8+o?~?tRD&(@5=*a*PFcyo|ZU(d|Y>Bi?~UkH^I<# zP4>z-KdOy-mTiZBfqF3Lm0+m(XXxkKc+b-lmSg^*ri1`3WMpP;W^MB02=uQb^Z?qM zG#VTN+5g5fGJiiC{(tZ6ALSYd6tuTr_8)$M8#n<*mmEMD19srds9Txln!>-0ivbxJ8%r&5pjSaP54l;7vBSbc~QZkT4*xsZLHtzsQQ4ZRltzHF; zPmb2J#Y4{26HlMd@zAKpOeQk7+NQYtY?B}khuyxuIuFa7n-LiaV;33n>J2?2X)IxD zaWk8UqVI;80ND(8r;{`oJCPI$<2z>k8lmy2HlbA#I42)!m=T(K9&H9Fy{w`hQv zK1h3AZykrsDL_WO1c5DLiW&?bCze}5rYq9m3!=07iNV_5|^Jd zqcimSHoW~~Q{NV5g=ZFZ$H@t6z!%2RY7cdJ=+a3qN`H$EF+>x3H9Eip-haFo)u*=M z8W(!4$b6NbJI3t>d*w8=}!Oib!JM-Rcg{87Ios?beSs)Jk`3> zkE18m7Dm3Tk~Mdfk-n3gEifN{$F3RNFY%P*Ecyu=kXpd_P#x$V2;RkqpkROeq5!#j zRwO6?qnHy80bS_s2E>BO4BWt?Ob%977S12T&4J@Heti6c`n@aFy5)$NfpwffQV6K7 z4!EhZ0*=r4wfwi=@1Fv+$u8~VR_HO8b77K$gG00B9Tw2(tRSLgb;Pey^LpDyq|e`evD~oZ1zf0F>?_E+XPC=d)%^0wt{tDZ&RyjJ?R03NI9Tl4*LyyEX<{*{RMKo(_((WIja}JwPx(Yo2->i7 z(k4}g3(=rRzmy|9(*X|gkfhP^jqHX!xa4$~4uQTw*X8HfE!Lewt4eEt>FkFI$}%Ty zk4k9bq}R?Y?_@3I|3xP5SH#xs<1()w=XWTU_O0$%rfv3JRx$TqBDQ<}%#Tc*vJS~% zT^WxOH+@{0B}n(~0P!x=e!|Q3Y)5Z*%!``C>T?V{fx_GtdoAR0yPXF4rQ#xRD@HrU z()Oj|tVRTsyvl2-w;ssIM0sk0Z(B+Z=+!60kwdrdRD!@hg-)MeCFPOm6EQG1ATi3`%F6z7g8dV;LF@hz5;mN!Mm z!|t-1W6+Bd$D~nZ*{{q8qTasMJ;)**BHMiN)ZOg!gXTwSMHcD`pR$q{tgj+L-KfYg zX5-R5U}c|vk(K~F#a@N8T8*9`sb8J*v?lRuHRYDAOnPFh-zOEL-F8L=QSOG}nB3P? zOgu}ei@&L=n47h+oF$NVtvB=asjMXnnea|g{?3jRDlD&--TNlDv-iQK1n`%dW_?gY zDbG}rX}h^`aZ06Wg})hSJ$3m1x--dDCaP?aEkXTCL$EXW9;4n^6AfZNlS8uQE z<^UXZ3!JSh&qyz$BErZ_1)#Wb+2GL#m5mIX?9G7Hg~B#gR!-Ky0>Yaj!P}}QVZl3n zn;Y^T_y+*E(}=pi{O`W~Ke;e->VEB7N+mqPMn2MA`w0!x9ElUTh7tMN zdrNTm$8(8%(j`Y)TO?J2h5fZ&&aawI`8n7!9=0Aaqlh{_=Tr0PI1NqiSt&FhtC|vw zL2jLx5DIpS+24~gHA70pCP7+;8A#ck0Ve%AFAt-+> z9w#re09R;b;Klqb!bXMbbp8vce!&u4V1bJfWRmA2-;)Q4^ju%zws;5s0!#mjNV>%- zVALzalOJAyvo;P z^+)8ddaKIlVJq)$Mc6L3S$&?_%5r}%e`SlEIr(bRf z0`>94%JS!Pen`(n0`1PchD3Q&p2KxUIN|D2HBEg}&zj4uuz-vr{U$otV75JT(E3yw zRo*KQ&OtKEuX1my9mP;BV|Uobw^Cxih&078+mB0v9f7SJ5N&#XN_bpwy%lzvEPl=Y z6zmN|ZHJxieck)LZuHqpRaR#aNv z#~KV3PrDR#3bR>q^@6Ld9|Vm6z!Fa;&D36Fb8DF!x^;r87x6Mnae0nFj7U?j5$imJ z&g_$QnEqBG-=#YKG%q3a>|3Gf7+H`y)gUZYLy@(;KR&>IZa#B;WWmu1r;+xh2Zjm+ z-lQ;h@nhmgN#IN!C8+z*pSBNp~;zQ6m&jJeL`~4~uj*F<+H44A=F=3c1Ko zbjNVnOz-ubM-e8f^N;JwtwK_7OS+*+*GWt>o!XCb_goQuWV1i4d^E@m+O{=|!hoek z^iE+|8z;|f7Mhj1MtgKNpnFD4xT<;%^w)*q5c57)LYa}`;d!7qiqB$GI6q;0Q#3{i!g6-hM< z?`JTyGmF6KCa6LBwk$qR4)**`Fy9}adVHT`oYGOcp>TDyoCg+PJpaD*rf!bvJ1VySB zyuFf^mLUOao?E3sV$_)`J%s@(w|k3wq;UFG3Op4UJ5Bkc_%EkxX^%s2#3pLk4!s7r zQ$BHhRXmobzqR>4MQZ<;Y^kyJ)7~Knf%FP4(B{FwP(V_>pd_>S^=rp>VkGQncGdng z{QoY2T4ru;?*Fhr?QLr`H}_34?pG@AKO#{3Kk{Y&36gs2(v&V-iEs&R@HibBPr5B$ zpaSIgIK&T!V&M+4KIG`NVm^{R57UcTaVBm>fqGU*Z=HLHA{ceXP)w_*o^3)YGql#A zq+v@8@nqP&JKL9GQ45v$v|Yp;pU!@Bz$@zl?jXWLdkOseA@k6GKaJ_6ouMr!;R#Ktg8@z0yzh%@DjCGMdvUcHB- zQ(Sdktr4qPM9l5WZ3x@Ol#E=|H8WbfD;t-gx111m}3E^?zdOV zPhT0%PLs$7C9^qmsC^#7VCpFL#vtO z5JA_bs-=pIlo1-fx4^Miyq=(SGRLBiX+-E!@^fD3pmN<5$W!WOzqyk-Gy;Vnzso2< zG>uppAs_n`mp&%8RPk!HqUCI<{wC-UA^DYiG%7Bt>AQ2|WOQ^<&5|!AW>~&-PdU4_ zX%9LVUu&wQ=Bj`U?tN|TN&?_M4d(93s)VYb;TC7aPD&Q(g8ctU!Q$OxrGxHV3CBq6VL;9{>^WY z*!eYj5+WXmBe6gnal7*yAVe(`RQ`e=W%oP>V8g?&;gh0wH~21J53HEGbM65*9S`4c z&Ioi}n1mISiOn2{&8!V<>}_rA^&Eko0kFl$-pJU<-U!&C!Td`a`=|2t@7HDk(A``c z9F6?@@qd=Y0V>L}Z~_GsSlMm_6j;75*>9Er-~ac%(m!EAb$qq3&{?Myt&POo3mI-T z$elJf6hTvt?X9a6(CF7()ECFdV#bWJgt+Cna-G91@gZg1*UaIp;L|n!9{j`s+S_kc zsq;?eYaiKhcJzuPCDNLJTM_n%+V zs;7{}W6_JgB(fHEvqI2Jx{}E2AQRWrzO?>ASb1bBIvnJ$kr@_QzC`15MPV0G+|&?V zq?922Mlo_3jTvW6PWIJwQHA+<1GkD@kGs2f%;#qWKA(K+)hXYjT&+G|JoZ^OI%nfV zqVchnE#(SgeCe%L`Vy;T6Tg?5M5h}6Wg5*O&; z^my3Ijg?OiC7i1~#i2)lIeyy^n4j)#^-!sTcKXX$K!m~3gI-F|SOv=i9rVTLjxA^} z0XzyzmAW1Hd!!cr{)8k7mQa-+1|GF$3 zxridd(_GrUX7JDuA5M0-;Z4yi+M#Q2@2O`S<=X&?)_^It5e-*=)vYv+ zHp)emBNIu2xWb6@&1?6aK&dwWA2sK)WLJep<nH|>fJHr7V=dUtGv^RJw; zPE*D5^iOvP5;)`=k_!l9#CI@;0utYZnQ_c0_SJ*i&;BgDKjDvG8Cd9hGmY>zdjtgw~dG@zwi=? z>LQRCBd0A|S)JD4Lt-O3-+XcYP_lRcW{mfm8nnb0oRVfylX6ZxDB7#p)1qho=h}74 z(TOHa(ovCy&}v+d&Dc2j&?I){7e|c=vj=f&v^iMEDxn&&K`&hb6hK4|Bed4Y8oaL9 z7q%5V3ILHfqp(q?CR)wBiP*~ZH2NJq+V-to31ia?8I?q4;9DDu3SSX;_lmwLGwk6X zZd-D5JNRIJP%0zqpXZB6vW<8v%ouMAnQW!g3N!3k3!^lA7pmiU;=*O5>+ep$Yxe7#v7!jThg@cGtm{D{#= z+0l583QipZgH%@ZJqAh(WzWzEmiN|Md?X;;-LFj-75o{?c<8=yWE3$i+vvSlgyrTB zSFWu$nVM0qbynv{7hWNr=VQ?gBvq{GVy*v-!IbTq3+>@6#sLxZ*^Rv`p8jE378d)8 z15u@>`tH;QvXO`TkoT*KN?Oi`w&AH7wRAOGZxvA!m1&-i?V%#i$b;3R#xd!S3783c zB2HX9aRLoVe}XAJTNiUJ4jKw&ex&m@#=HV77c8W?Lfnh?)A*UGEBkjn0|5ZvU(xKp z5Zc{~R_6k#IE+q7Kp5XV^LT@`hKBlw9o!b~G%aiD%aI=-z+CT*BA6~emn0Psp|YvB zn)Npx$nQhEI81?BaY2vWOc(S>rVUuRz94DU+FK@4t8prLtpi4RJ=t|EH!FW~j4#&W zF8_$0lzk7Ue8|FtzAS&fAO z!YY-@k}RCAy?%cz^h8echh&TGcAV8h85FJ#8|Fo8$qxd~K9t~;H1ixsN5slYShj3f z=?12R7F%tyLGRE2Oj=@y;=<#2Z`6@$H6x)UiXDS>x-OVi1ko0|NRVF66Cy6OcnAl^ zbc8+WG=g(g+wUZM0Q!kodiKG2T%Z%JrbDEa2Ssepj%W##G)UiQxw^s>Psl?WVKMDQ zI+X!sn@FiI31`iANJ8PBm(&?U52>=)+Aee_l_m?cD~N{o%6lta}IOw zoI7)$dp!T&e|dh-@9)|f?N@X-r3OoNZ9RdpC{4XPd(&FUi?fz#runPzf}~o^)nmR! z45crYR-EYUB-isEJoHe&9A|BKYGSx%i|G2odXV9(OO&ZLR z)P{w3bh0QQ^k5q{V?$*FBLibYqur{K@Qzx`0SMzhPCxh*xVRUjChP$^gu&QI2MT_L z3iyOjwVg)5&hYIWXMkGsBe)N33Y(0xSFa4UgOucq0Ho7?I+bQ`$42A6PE( zUI3p|0{P^Y<iXnNn z7R&jCEXzrdT=WJXmCB*Z9qMBDob(^Bl5{$j+H2Lx-GM)*h&k9gB0C#Qq?JWs>5|wt zi<#k#FVT*U_3lFEcd;|X(T(~k5r*2{`OvAJ`Rv+KiO5a0U2*bS80!B1O(ZRU2hbn& ztD9a{JS@Cvipl3mfy^@{OY`LuWtb8e03IQdg-OFC(c! zb7AmXxQRez&mF;9Lj1iW;=Lo1y(7|Jj0hJRsxloK_Gw8^E!!yNwe(GxhC0mZ1PQ#R z+*%%PH_oLP)iOdPS-a%WW|mrppO`*(xA6mX3D1`8L8I#;R{fE7k~_(53a$!u8#0}( z)>gWT7>4uX_#bGKKPrn=#yLI4Rz+U%)z1!*l8~ZPqitC)kYtVofBQ@aW`jAdH>GG-zVr&E)qKA*Cz=Jn=i>U zSmei)sayVqar_vDYIQ!odOU`|*Hkb0$h3oUKpAub+)teI;$_K^saflF9xkYsJ102UaW&uI@H)S5T%KVY{=G<#lo&;ZSW! ze-EpG76xGiK)nncG%X`~^I4X5zWeE9iO@Fo zi0STZ^=r}Bqba2#HSBY;%#yTI;UrNSd7w_*A9JrC#wPoTPwmDO>2ppc4W41-@XPS7 z9JBrZ3qnUc7=l0;@1qlK8}dzy@I&&`qp2(F-!sNSXxnCj?RwgYx#LU*(Bqcpbq<7Q zn)~sg$$2=PZ3tkVFRQOuOi7PkAdf8cy(Zmi@m+0>%7?3vYz+BK{RM`yt^n?|@J)J@ zzkOBUi~ZH@C6~kdbjX0xs|dnx-;C10OWm7MM5=)IQv|%9!1jzHBoANOZ>!+?sNOz* zr=%=Q4};)l3nirz6t_0Qq3UL%wkz{XNXZGjjdN|=%oJCEEW;rR?pF{2wIG00LlT@u zFiD_i4j}b@5@?(Q)-?8?{txc>CkK3oOXV2m8!gG1y!Vnd=|ZMsK0 znI>l$b+t_Ij=83IC9t7r9I}7(n2nKrz}33i}WbvV=^I)v{q|Q4II4O>fN_b`HM~1jTn^EV7vo6C9|7LFMDz>o^vT1kuG9hA|1a%~jhFWDhY$l`&lA9_m2BhB&ysK;`k=yohM%3? zP85_}M$lbS22e;vcmX@Hy%8LS2roZCH^+M$ly-};Kn-N?;%&@Q1d6%{uU)bSAtkF3 z6eyD*04@i|wiDckUfUcFAf^Uf9SmUA;W)9P;OXA3ssD#T{t4rXtp-`FCcG0r4q7bb zep3DT#nITBn2jL6@`l+L_Df}Ar5jYu18PjOPFLDEHaLq(nP%=;+(BThW(b0Vf}t#Z z4{I+rGlnrltl8fqYcV>C`p{XcF2Agc6j$SwIP|Q3+|lE^WUBT{Oj@E|@l&PBqal*2 zlLj_@v`LmV!YOBn*Zm6E^S(B3Oa?x4E%MZzYQIotU4|K68fdToOY|1L^c5=(&?K9VHXiaDXp9d= zeev?hcHd-97_d6oQsFKZT(71(c24qjf7XTUoG3X$OQtxb++NJTS@r$Z)BkYn4Q3pt z@B+|iE|<%_i}05ZPPB*p)HZY1{)Gv1;RlZROn9AYaa+~SUgIhpMVVkbALUGyBr-{q z6$jI6f4QF*e`_gWS*fUCf-|{P4$p=mW}e{T2K?wJ(HpQpms2)Dr9?*~Oc7&m1TKwp z8;aW)TGb8W+wkSyKJNKRitDc?ceZ2?4h>SVk*O{Eiyt4p4(vDg4JHocQ~gV!P#EIh zsUTgYuNo*w^Inx^ILp2(uGh$ZE!=o2xS21OWzxO!#Tao!n~>avNE>9ERnrAqAJaxP zM#^-_>HH4n>VR|c^qKv1RLg;+XE9vi#88l*&c#yBft-5@*g)W{{J2NpP-_bQtB!H zs?ONgdZtvXgc!r}Bl7Lo91e&ZpH%Ci5Sec-eiF6=r>qNaSX$s+tPnB_U5;MmR*V{V zVll|LI_mkpA4;X;zTB!laQ_Rl$z6f_K6KOAb)NUk57|-#ouy5$$Euoaaifzw48sQ_ zeCVDyWD_|`jU*_XW7E*VDke&goAlv%v>VI@h1``IuM=KXUT(I=Ld*yRE_R5ij?@lc zMYs`QPbA*HJw6=Cs2*&ulPBd?R6Q#u_>hY5f#`_pbh%4B_rQ%8sBUEykra>UVSmbYkx`>DN3oD$MeLYZB~jK9zTSov%huke$FtYmMSK<$!-O7(oe3=Eui*&M zt_w7#ZKj`k{LML8(A6gg%UZSg3_mZj%S*1*yX3$PUrIOSnuP0jQpBs#U03K;55AuW zAG-2=?liuC$MGVYNYO=cvN=zzKgn<_6I+Y|HbjMOiybriV(aLembG|eog#v9RT>q! zrSFe}_;?-_!EMBO??d^QsiW-LJPKZx*6?`*Ovwz|a_4+^tbu*@SoghD<7Vwp!QNUs z*76|2@NZlV~?KoiU+qiIe?-Scm!EWM=OJRVu zwjJ)q-?i-ifg$|Kh{vQyX}pFD^Lz5n7VG6+IpBY_E%(+e?TZw1d~%Ks{GOH;i;jd#a4}*<*++{f;wS3CdU&h5QNgFkh{2L5v7K%o+~sYsD8 zV{dnEz3SL;=cNqM6?HP}xK~zHQV|U|i#4=D3W$L1ChyZxsxSS`<2@ zg)TGtg%|jjx2J`n?DG zW~Ww6deY@YkFk!xBR3gQLoF z{I#bHu~K>@-vlR~o>g~+b29c4m0plJA$8HEV7iQ+Zn8hNsaC>uEYbDSmR+qs_gPpY z%dx!Cx055P!PQmA$cSN|p^pzVC^zWU7JZpc!>286jcG{}vx=vXX_@RzPIeo{Svk|L zBD$w9+!e^l5O%gd8F{(Go{!imtyqG_Xbi z`h1*i@93b5iQyJT!39!LfT)E#{pSYqCky|;p0W9s{9JT?j%q!PRau1C8ylH`3pJCl z>d%y{{7)IS-hK9*zVwv_IipLJ_>z_ps!osJoX-Wp(AaHp(Pq>pSO}3}J)J8Z@XZ#^ zt9-e4;nwoOGlB0zSvtDrYk0r&Pi0r$t0gM_zKp3Vf54AkH(g*tyL)i|CFi6OdWfrk zu9S=>gD-uwSV=j9)>1CZ&0u33E$b*WujvsCktnUB=U(W0QIgvz+$WUtZi~)rBO+-a zI#>&69G=q+rCDK=k{ae7_|~H^lTSkXRC+YA$>iib-CM*da%4$9DduE%Gok1yb6*~} zGYhmXitd`8*Vn|@W+2Gt7emv8Tx${iliL=KdIdvu?-RFa>)Nr%GcFfGPZ(bT`t?qoab|1e)`u1}P*%>&k%hX-s4!14DvtPdtlCFq zo^bp+d3Z&*lJRMuTF6l?$ELp?;nTT48$b>}B0A%|vTPCZad0hqn(Cy1LsxdHA90d= zG6w&Xld(i7H9WoTz18jKa$&Y=#bab@a>a`kkv6xh3I-mFXF66xO+xO~$fL_i`zCeY z4l8@YL_%2v$yXZ;Zq7Delq0baG*)P0`Rbv3@9p`uWv_GoFKs)qrm=WuY~=$ayOi#Q zAx|?+483cLIoHkZnRMhB%;zI};jqkc@zC(Q+5XshSoxM_`b5jk`(6=MUi~a29W?5` N4}_GjK}DoK{|jio=q3OF From 185a926a94c732c1ecd3480c357a57a751c09267 Mon Sep 17 00:00:00 2001 From: Linary Date: Thu, 15 Apr 2021 18:05:21 +0800 Subject: [PATCH 143/217] Fix senstive mail address (#71) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 10a7e8893b..23b7f4b734 100644 --- a/pom.xml +++ b/pom.xml @@ -39,7 +39,7 @@ lizhangmei - lizhangmei@baidu.com + javaloveme@gmail.com zhoney From f72fac400f1dd750163d56770e1ca68b37912b51 Mon Sep 17 00:00:00 2001 From: Linary Date: Fri, 16 Apr 2021 14:58:22 +0800 Subject: [PATCH 144/217] Improve some license params (#73) --- pom.xml | 4 ++-- .../hugegraph/license/LicenseCreateParam.java | 3 +++ .../hugegraph/license/LicenseVerifyParam.java | 2 ++ .../hugegraph/version/CommonVersion.java | 2 +- .../unit/license/LicenseCreateParamTest.java | 8 ++++---- .../unit/license/LicenseVerifyParamTest.java | 4 ++-- .../hugegraph/unit/util/VersionUtilTest.java | 2 +- src/test/resources/META-INF/MANIFEST.MF | 4 ++-- src/test/resources/create-license.json | 4 ++-- src/test/resources/privateKeys.store | Bin 1281 -> 1280 bytes src/test/resources/publicCerts.store | Bin 874 -> 873 bytes src/test/resources/verify-license.json | 2 +- 12 files changed, 20 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index 23b7f4b734..993ae37ec1 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.8.6 + 1.8.7 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -287,7 +287,7 @@ - 1.8.6.0 + 1.8.7.0 diff --git a/src/main/java/com/baidu/hugegraph/license/LicenseCreateParam.java b/src/main/java/com/baidu/hugegraph/license/LicenseCreateParam.java index 00f0bdc96f..cd7c504d23 100644 --- a/src/main/java/com/baidu/hugegraph/license/LicenseCreateParam.java +++ b/src/main/java/com/baidu/hugegraph/license/LicenseCreateParam.java @@ -24,6 +24,7 @@ import org.apache.commons.lang3.time.DateUtils; +import com.fasterxml.jackson.annotation.JsonAlias; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonProperty; @@ -35,9 +36,11 @@ public class LicenseCreateParam { @JsonProperty("private_alias") private String privateAlias; + @JsonAlias("key_ticket") @JsonProperty("key_password") private String keyPassword; + @JsonAlias("store_ticket") @JsonProperty("store_password") private String storePassword; diff --git a/src/main/java/com/baidu/hugegraph/license/LicenseVerifyParam.java b/src/main/java/com/baidu/hugegraph/license/LicenseVerifyParam.java index f2359bffde..97c200f51e 100644 --- a/src/main/java/com/baidu/hugegraph/license/LicenseVerifyParam.java +++ b/src/main/java/com/baidu/hugegraph/license/LicenseVerifyParam.java @@ -19,6 +19,7 @@ package com.baidu.hugegraph.license; +import com.fasterxml.jackson.annotation.JsonAlias; import com.fasterxml.jackson.annotation.JsonProperty; public class LicenseVerifyParam { @@ -29,6 +30,7 @@ public class LicenseVerifyParam { @JsonProperty("public_alias") private String publicAlias; + @JsonAlias("store_ticket") @JsonProperty("store_password") private String storePassword; diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 0013e08d0f..0ae81e5314 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.8.6"); + "1.8.7"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java b/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java index 76f6847676..fb5a16fc6c 100644 --- a/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java @@ -37,8 +37,8 @@ public void testDeserializeLicenseCreateParam() String json = "{" + "\"subject\":\"hugegraph-evaluation\"," + "\"private_alias\":\"privatekey\"," - + "\"key_password\":\"123456\"," - + "\"store_password\":\"123456\"," + + "\"key_ticket\":\"a123456\"," + + "\"store_ticket\":\"a123456\"," + "\"privatekey_path\":\"./privateKeys.store\"," + "\"license_path\":\"./hugegraph-evaluation.license\"," + "\"issued_time\":\"2019-08-10 00:00:00\"," @@ -85,8 +85,8 @@ public void testDeserializeLicenseCreateParam() LicenseCreateParam.class); Assert.assertEquals("hugegraph-evaluation", param.subject()); Assert.assertEquals("privatekey", param.privateAlias()); - Assert.assertEquals("123456", param.keyPassword()); - Assert.assertEquals("123456", param.storePassword()); + Assert.assertEquals("a123456", param.keyPassword()); + Assert.assertEquals("a123456", param.storePassword()); Assert.assertEquals("./privateKeys.store", param.privateKeyPath()); Assert.assertEquals("./hugegraph-evaluation.license", param.licensePath()); diff --git a/src/test/java/com/baidu/hugegraph/unit/license/LicenseVerifyParamTest.java b/src/test/java/com/baidu/hugegraph/unit/license/LicenseVerifyParamTest.java index f1126ce771..5172f7df91 100644 --- a/src/test/java/com/baidu/hugegraph/unit/license/LicenseVerifyParamTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/license/LicenseVerifyParamTest.java @@ -34,7 +34,7 @@ public void testDeserializeLicenseVerifyParam() throws IOException { String json = "{" + "\"subject\":\"hugegraph-evaluation\"," + "\"public_alias\":\"publiccert\"," - + "\"store_password\":\"123456\"," + + "\"store_ticket\":\"a123456\"," + "\"publickey_path\":\"./publicCerts.store\"," + "\"license_path\":\"./hugegraph-evaluation.license\"" + "}"; @@ -43,7 +43,7 @@ public void testDeserializeLicenseVerifyParam() throws IOException { LicenseVerifyParam.class); Assert.assertEquals("hugegraph-evaluation", param.subject()); Assert.assertEquals("publiccert", param.publicAlias()); - Assert.assertEquals("123456", param.storePassword()); + Assert.assertEquals("a123456", param.storePassword()); Assert.assertEquals("./publicCerts.store", param.publicKeyPath()); Assert.assertEquals("./hugegraph-evaluation.license", param.licensePath()); diff --git a/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java index 49fcdacc3b..70a40c881c 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java @@ -129,7 +129,7 @@ public void testGetImplementationVersion() throws MalformedURLException { //Mockito.when(clazz.getResource("fake.class")).thenReturn(manifest); String manifestPath = "file:./src/test/resources"; - Assert.assertEquals("1.8.6.0", + Assert.assertEquals("1.8.7.0", VersionUtil.getImplementationVersion(manifestPath)); manifestPath = "file:./src/test/resources2"; diff --git a/src/test/resources/META-INF/MANIFEST.MF b/src/test/resources/META-INF/MANIFEST.MF index fe44310d0c..252019b379 100644 --- a/src/test/resources/META-INF/MANIFEST.MF +++ b/src/test/resources/META-INF/MANIFEST.MF @@ -1,9 +1,9 @@ Manifest-Version: 1.0 -Implementation-Version: 1.8.6.0 +Implementation-Version: 1.8.7.0 Archiver-Version: Plexus Archiver Built-By: jermy Specification-Title: hugegraph-common Created-By: Apache Maven 3.3.9 Build-Jdk: 1.8.0_111 -Specification-Version: 1.8.6 +Specification-Version: 1.8.7 diff --git a/src/test/resources/create-license.json b/src/test/resources/create-license.json index 26b3bd501e..c1131312c9 100644 --- a/src/test/resources/create-license.json +++ b/src/test/resources/create-license.json @@ -1,8 +1,8 @@ { "subject": "hugegraph-evaluation", "private_alias": "privatekey", - "key_password": "private_password123456", - "store_password": "public_password123456", + "key_ticket": "a123456", + "store_ticket": "a123456", "privatekey_path": "src/test/resources/privateKeys.store", "license_path": "src/test/resources/hugegraph-evaluation.license", "issued_time": "2019-08-01 00:00:00", diff --git a/src/test/resources/privateKeys.store b/src/test/resources/privateKeys.store index 836e413a7c76c1fae94922c567efd74e4d00008c..4982719687f2c84d2ad914ab34f86051832c1936 100644 GIT binary patch delta 735 zcmV<50wDc?3V;fbAAfk*xUEY700ECMf&qh9M<1_1;CDgqG!0R;dAf&q6C1?rYF zpk7R`9tXvW&{OR6VG6k{HdmK+yJot{fAqYUZVA%M&0MYWKxoOops*j$-<;CmSL#a& zXq|gZ<|)aQ#Wu?iH*DChM zhs*NKncMQgj>@Ozj6FQYE3-O5QY1x_58d9xf2sPlkJ-5=cDmHg=Mk8-DDej&%a zTCHhdU80I;Yk#`<9Uf_eshvNo|8_CGj5p~Id zgpQ`;u=8a#5MG8XI_XT^H7&?i%Ty{kAvA0zdSTsup#@_?9L)p2!yo`oH?e`shbXi4 zDv=^+s4BoJeTwOSVEvl>7eG8L{b}D*`6esSW~BVMH9bpgP{EesX&5iHNhW-prUxAe zwMgF#aUJ(k1poj50RRP9E;TSY0009fFoFXjFoFW$paTK{0s;hMxWXut*#UMMGBGeT zF*YzWGB_|aS{Ds7F)%bSG%zzVI54wm0-^zbea?q2alj6%AZ7M{@krLo$e9PV=CWL< z@A+Ni_*@#>CM~?HGf(CXg-9e?1h`W<0;$51 RE^z?To9y+9zQpS<>Z5I6P5%G@ delta 736 zcmV<60w4W=3V{lcAAfAut~LJv00ECMf&qh9M<1_1;CDgqG!0R;dAf&q7H>TN}- z9PQ2Y7A7bKSU<5ZL?DuBYpw-+<^BRgO>s)ST2NqaAYI__gN@?5lmw=`PfK{FtnpLC zgWIEVDg#M6G;F?`P85O_(mZq^KsuzGg7E_i{yZ;qqB^=29)CL6Ui8n_$%)>2_ye81 zx9IK@LHW&-w)IKD_z90=GRC_QQO3^{NN&%Qt)ibwQ<8(!V={%=n35RIV_Bt{ZKOr| z85gBj_?+0IQf?(QcI>Hpxr~&=40HH>8p64$>N0?w+b%Tswj9wBR1!4<_MRIYcQ>XA z7d4WEIa*&eH-8jUVSvZoP~;$*Ld-4Mz6LB1xrAUcA3h1}jOnruWcOxBYT3}_fFw}@ zt#pqvZ6;6}slKCENV2}Pm|kD<76pqaP}A3AVV;2xkeCUKQeW6QB4@%31)hU{Mu1U-Th9_+s%^=Kk1C$|E6_a`k` z$J98FF8R0wc>n+a0RRP9E;TSY0009gFoFXkFoFW$paTK{0s;gvQHeT}*#UMMF*z_e zGB`0XFf%hWS{Ds6IWRafH8C(SGc&Vk0-^zb2fis%*gkuRPdz)qFf5qMA^X@jzrmk0 z?9YF>?=~ZDC#`a;8nZFpw9aGC3_t7N>mjVpP0^Wotp-u6wZdOj8}FS6GAQ_tr10da z6g||yRY_`6^RI@E*CiJ|y|`jw!FFI9~4WJ!?v_*oLtsuFo4{`V37S;f(bUk$d diff --git a/src/test/resources/publicCerts.store b/src/test/resources/publicCerts.store index 7eee045ffe85cb2de952e13da2248a5002b767b4..e6624be937cb1506763c8ac0d6b432c12529e958 100644 GIT binary patch delta 329 zcmV-P0k;0?2I&TnA0v3!xrqG$1z0XMFgXAK112zn10pbj0^pzn0s#U71Y@|uD3L;T z95OL5G%+?XGcq_ZG+Gx8GchnUF*GnUGB_|aT9Hp?vpNAf0e^kYhc0oz4yzz#_J8q6 z*2~D52esz1T&VB)UF7&&8rvogy?zurqTz0*qAut~>9R>qc9S#H*1QacjbFJ7Jo*a5$>IP!Ws_>;k*O4#_1_vsJ zNX|F}0|fvBF90ws0u)MoSg-;+(e~v-quYy;yMomKG}i(Y1XA|~$k^%o{|F|KEzf^F b6x3!!;d1bH?*n=Km;L5ZklTuNXs0FbC^wF_ delta 330 zcmV-Q0k!_=2I>ZoA0uqnuCY)61z0XMFgXAK11B(o10yhk0^pzn0s#U71Tj&GI*~$l z95FdCI5IdfFfcPSG+Gx8GC43fGBq(UFf%hWT9Hp?vpNAf0e=U+DN@)zdx%dxJHaq4 zn9Cvi*f+nypET^xf4T2ABW@?Ha;qA%G2XP!W6umf>)-1ktjQFToG@QoOy%lY$ZTt;30vctt59 z!v+4Z)SC2@jCXCLAut~>9R>qc9S#H*1Qapt+YN=*Z+(7%jFyrJHp&5wei$$d1_vsJ zNX|F}0|fvBFaR(u0u&y|z0f^tO0n36u_dn08(LAQhY|u60F-cn{YliYOX431$b^#2 cxw$ Date: Mon, 26 Apr 2021 16:16:31 +0800 Subject: [PATCH 145/217] disable delimiter parsing when construct from MapConfiguration (#74) --- pom.xml | 4 ++-- .../com/baidu/hugegraph/config/HugeConfig.java | 7 +++++-- .../baidu/hugegraph/version/CommonVersion.java | 2 +- .../hugegraph/unit/config/HugeConfigTest.java | 15 +++++++++++++++ .../hugegraph/unit/util/VersionUtilTest.java | 2 +- src/test/resources/META-INF/MANIFEST.MF | 4 ++-- 6 files changed, 26 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 993ae37ec1..8fa8847df1 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.8.7 + 1.8.8 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -287,7 +287,7 @@ - 1.8.7.0 + 1.8.8.0 diff --git a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java index ed5da5a518..2593be611e 100644 --- a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java +++ b/src/main/java/com/baidu/hugegraph/config/HugeConfig.java @@ -25,6 +25,7 @@ import java.util.List; import java.util.Map; +import org.apache.commons.configuration.AbstractConfiguration; import org.apache.commons.configuration.AbstractFileConfiguration; import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.ConfigurationException; @@ -42,7 +43,6 @@ public HugeConfig(Configuration config) { if (config == null) { throw new ConfigException("The config object is null"); } - this.reloadIfNeed(config); this.setLayoutIfNeeded(config); @@ -60,9 +60,12 @@ public HugeConfig(String configFile) { private void reloadIfNeed(Configuration conf) { if (!(conf instanceof AbstractFileConfiguration)) { + if (conf instanceof AbstractConfiguration) { + AbstractConfiguration config = (AbstractConfiguration) conf; + config.setDelimiterParsingDisabled(true); + } return; } - AbstractFileConfiguration fileConfig = (AbstractFileConfiguration) conf; File file = fileConfig.getFile(); diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 0ae81e5314..679ccff821 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.8.7"); + "1.8.8"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java b/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java index e6c8ac8bec..75a47bbbbb 100644 --- a/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java @@ -30,11 +30,14 @@ import java.io.File; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; +import java.util.Map; import org.apache.commons.collections.IteratorUtils; import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.ConfigurationException; +import org.apache.commons.configuration.MapConfiguration; import org.apache.commons.configuration.PropertiesConfiguration; import org.apache.commons.io.FileUtils; import org.junit.BeforeClass; @@ -409,6 +412,18 @@ public void testSaveHugeConfig() throws ConfigurationException, } } + @Test + public void testFromMapConfigurationWithList() { + Map options = new HashMap<>(); + options.put(TestOptions.list.name(), "[a, b]"); + MapConfiguration mapConfiguration = new MapConfiguration(options); + HugeConfig hugeConfig = new HugeConfig(mapConfiguration); + List values = hugeConfig.get(TestOptions.list); + Assert.assertEquals(2, values.size()); + Assert.assertTrue(values.contains("a")); + Assert.assertTrue(values.contains("b")); + } + public static class TestOptions extends OptionHolder { private static volatile TestOptions instance; diff --git a/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java b/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java index 70a40c881c..9ee1862a40 100644 --- a/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java @@ -129,7 +129,7 @@ public void testGetImplementationVersion() throws MalformedURLException { //Mockito.when(clazz.getResource("fake.class")).thenReturn(manifest); String manifestPath = "file:./src/test/resources"; - Assert.assertEquals("1.8.7.0", + Assert.assertEquals("1.8.8.0", VersionUtil.getImplementationVersion(manifestPath)); manifestPath = "file:./src/test/resources2"; diff --git a/src/test/resources/META-INF/MANIFEST.MF b/src/test/resources/META-INF/MANIFEST.MF index 252019b379..8ea4eeefb9 100644 --- a/src/test/resources/META-INF/MANIFEST.MF +++ b/src/test/resources/META-INF/MANIFEST.MF @@ -1,9 +1,9 @@ Manifest-Version: 1.0 -Implementation-Version: 1.8.7.0 +Implementation-Version: 1.8.8.0 Archiver-Version: Plexus Archiver Built-By: jermy Specification-Title: hugegraph-common Created-By: Apache Maven 3.3.9 Build-Jdk: 1.8.0_111 -Specification-Version: 1.8.7 +Specification-Version: 1.8.8 From 27dfd9d5a2a48e128550fad6f96372a06998b077 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 3 Jun 2021 15:50:56 +0800 Subject: [PATCH 146/217] Bump commons-io from 2.4 to 2.7 (#75) Bumps commons-io from 2.4 to 2.7. Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8fa8847df1..9fbf905387 100644 --- a/pom.xml +++ b/pom.xml @@ -60,7 +60,7 @@ 1.10 2.1.1 3.2.2 - 2.4 + 2.7 1.11 25.1-jre 1.0 From 91018422003a837e3e5edf39c05d1081079ffe96 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 3 Jun 2021 16:06:27 +0800 Subject: [PATCH 147/217] Bump jackson.version from 2.10.2 to 2.12.1 (#63) Bumps `jackson.version` from 2.10.2 to 2.12.1. Updates `jackson-annotations` from 2.10.2 to 2.12.1 - [Release notes](https://github.com/FasterXML/jackson/releases) - [Commits](https://github.com/FasterXML/jackson/commits) Updates `jackson-core` from 2.10.2 to 2.12.1 - [Release notes](https://github.com/FasterXML/jackson-core/releases) - [Commits](https://github.com/FasterXML/jackson-core/compare/jackson-core-2.10.2...jackson-core-2.12.1) Updates `jackson-databind` from 2.10.2 to 2.12.1 - [Release notes](https://github.com/FasterXML/jackson/releases) - [Commits](https://github.com/FasterXML/jackson/commits) Updates `jackson-module-jaxb-annotations` from 2.10.2 to 2.12.1 - [Release notes](https://github.com/FasterXML/jackson-modules-base/releases) - [Commits](https://github.com/FasterXML/jackson-modules-base/compare/jackson-modules-base-2.10.2...jackson-modules-base-2.12.1) Updates `jackson-jaxrs-base` from 2.10.2 to 2.12.1 - [Release notes](https://github.com/FasterXML/jackson-jaxrs-providers/releases) - [Commits](https://github.com/FasterXML/jackson-jaxrs-providers/compare/jackson-jaxrs-providers-2.10.2...jackson-jaxrs-providers-2.12.1) Updates `jackson-jaxrs-json-provider` from 2.10.2 to 2.12.1 Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9fbf905387..244ce6458e 100644 --- a/pom.xml +++ b/pom.xml @@ -68,7 +68,7 @@ 3.21.0-GA 2.22 2.27 - 2.10.2 + 2.12.1 4.12 2.25.1 From efa8e97c4ff3d676299e34f0b77dc2834d188e50 Mon Sep 17 00:00:00 2001 From: Linary Date: Wed, 23 Jun 2021 16:57:12 +0800 Subject: [PATCH 148/217] chore: use github action to run ci (#77) --- .github/workflows/ci.yml | 49 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..e7792c8d27 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,49 @@ +name: hugegraph-common ci + +on: + push: + branches: + - master + - /^release-.*$/ + - /^test-.*$/ + pull_request: + branches: + - master + - /^release-.*$/ + - /^test-.*$/ + +jobs: + build: + runs-on: ubuntu-16.04 + steps: + - name: Install JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + + - name: Cache Maven packages + uses: actions/cache@v2 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 2 + + - name: Compile + run: | + mvn compile -Dmaven.javadoc.skip=true | grep -v "Downloading\|Downloaded" + + - name: Run test + run: | + mvn test -Dtest=UnitTestSuite + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1.0.2 + with: + token: ${{secrets.CODECOV_TOKEN}} + file: target/jacoco.xml From 535ae072f4196d1b3d8e4296ae8052239b23ca0c Mon Sep 17 00:00:00 2001 From: ShouJing <1075185785@qq.com> Date: Thu, 24 Jun 2021 16:00:29 +0800 Subject: [PATCH 149/217] add Auth Context to store request header(Authorization) (#76) --- pom.xml | 4 +- .../hugegraph/rest/AbstractRestClient.java | 81 ++++++--- .../hugegraph/version/CommonVersion.java | 2 +- .../unit/concurrent/RowLockTest.java | 17 ++ .../hugegraph/unit/rest/RestClientTest.java | 162 ++++++++++++++++++ 5 files changed, 240 insertions(+), 26 deletions(-) diff --git a/pom.xml b/pom.xml index 244ce6458e..e2a8639282 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.8.8 + 1.8.9 hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -287,7 +287,7 @@ - 1.8.8.0 + 1.8.9.0 diff --git a/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java b/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java index 3507169d36..1048fc1dea 100644 --- a/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java +++ b/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java @@ -46,7 +46,9 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.Variant; +import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.tuple.Pair; +import org.apache.http.HttpHeaders; import org.apache.http.config.Registry; import org.apache.http.config.RegistryBuilder; import org.apache.http.conn.socket.ConnectionSocketFactory; @@ -234,15 +236,20 @@ public RestResult put(String path, String id, Object object, @Override public RestResult get(String path) { - Response response = this.request(() -> { - return this.target.path(path).request().get(); - }); - checkStatus(response, Response.Status.OK); - return new RestResult(response); + return this.get(path, null, ImmutableMap.of()); } @Override public RestResult get(String path, Map params) { + return this.get(path, null, params); + } + + @Override + public RestResult get(String path, String id) { + return this.get(path, id, ImmutableMap.of()); + } + + private RestResult get(String path, String id, Map params) { Ref target = Refs.of(this.target); for (String key : params.keySet()) { Object value = params.get(key); @@ -254,41 +261,44 @@ public RestResult get(String path, Map params) { target.set(target.get().queryParam(key, value)); } } + Response response = this.request(() -> { - return target.get().path(path).request().get(); + WebTarget webTarget = target.get(); + Builder builder = id == null ? webTarget.path(path).request() : + webTarget.path(path).path(encode(id)).request(); + this.attachAuthToRequest(builder); + return builder.get(); }); + checkStatus(response, Response.Status.OK); return new RestResult(response); } @Override - public RestResult get(String path, String id) { - Response response = this.request(() -> { - return this.target.path(path).path(encode(id)).request().get(); - }); - checkStatus(response, Response.Status.OK); - return new RestResult(response); + public RestResult delete(String path, Map params) { + return this.delete(path, null, params); } @Override - public RestResult delete(String path, Map params) { + public RestResult delete(String path, String id) { + return this.delete(path, id, ImmutableMap.of()); + } + + private RestResult delete(String path, String id, + Map params) { Ref target = Refs.of(this.target); for (String key : params.keySet()) { target.set(target.get().queryParam(key, params.get(key))); } - Response response = this.request(() -> { - return target.get().path(path).request().delete(); - }); - checkStatus(response, Response.Status.NO_CONTENT, - Response.Status.ACCEPTED); - return new RestResult(response); - } - @Override - public RestResult delete(String path, String id) { Response response = this.request(() -> { - return this.target.path(path).path(encode(id)).request().delete(); + WebTarget webTarget = target.get(); + Builder builder = id == null ? webTarget.path(path).request() : + webTarget.path(path).path(encode(id)).request(); + this.attachAuthToRequest(builder); + return builder.delete(); }); + checkStatus(response, Response.Status.NO_CONTENT, Response.Status.ACCEPTED); return new RestResult(response); @@ -303,6 +313,29 @@ public void close() { this.client.close(); } + private final ThreadLocal authContext = + new InheritableThreadLocal<>(); + + public void setAuthContext(String auth) { + this.authContext.set(auth); + } + + public void resetAuthContext() { + this.authContext.remove(); + } + + public String getAuthContext() { + return this.authContext.get(); + } + + private void attachAuthToRequest(Builder builder) { + // Add auth header + String auth = this.getAuthContext(); + if (StringUtils.isNotEmpty(auth)) { + builder.header(HttpHeaders.AUTHORIZATION, auth); + } + } + private Pair> buildRequest( String path, String id, Object object, MultivaluedMap headers, @@ -323,6 +356,8 @@ private Pair> buildRequest( builder = builder.headers(headers); encoding = (String) headers.getFirst("Content-Encoding"); } + // Add auth header + this.attachAuthToRequest(builder); /* * We should specify the encoding of the entity object manually, diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 679ccff821..773eb3670a 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.8.8"); + "1.8.9"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java b/src/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java index 536ee94513..4821f1d0a4 100644 --- a/src/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java @@ -121,6 +121,23 @@ public void testRowLockWithMultiThreads() { Assert.assertEquals(THREADS_NUM, names.size()); } + @Test + public void testRowLockWithMultiThreadsLockOneKey() { + RowLock lock = new RowLock<>(); + Set names = new HashSet<>(THREADS_NUM); + + Assert.assertEquals(0, names.size()); + + Integer key = 1; + runWithThreads(THREADS_NUM, () -> { + lock.lock(key); + names.add(Thread.currentThread().getName()); + lock.unlock(key); + }); + + Assert.assertEquals(THREADS_NUM, names.size()); + } + @Test public void testRowLockWithMultiThreadsWithRandomKey() { RowLock lock = new RowLock<>(); diff --git a/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java b/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java index ab3c419d26..a9f4d972b3 100644 --- a/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java @@ -22,6 +22,7 @@ import java.security.NoSuchAlgorithmException; import java.util.HashMap; import java.util.Map; +import java.util.UUID; import java.util.concurrent.Callable; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; @@ -31,15 +32,20 @@ import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSessionContext; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.client.Invocation.Builder; import javax.ws.rs.core.MultivaluedHashMap; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; import org.apache.http.HttpClientConnection; +import org.apache.http.HttpHeaders; import org.apache.http.HttpHost; import org.apache.http.conn.routing.HttpRoute; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.pool.PoolStats; +import org.glassfish.jersey.client.ClientRequest; import org.glassfish.jersey.internal.util.collection.ImmutableMultivaluedMap; import org.junit.Test; import org.mockito.Mockito; @@ -404,4 +410,160 @@ public void testClose() { Assert.assertNotNull(cleanExecutor); Assert.assertTrue(cleanExecutor.isShutdown()); } + + @Test + public void testAuthContext() { + RestClientImpl client = new RestClientImpl("/test", 1000, 10, 5, 200); + Assert.assertNull(client.getAuthContext()); + + String token = UUID.randomUUID().toString(); + client.setAuthContext(token); + Assert.assertEquals(token, client.getAuthContext()); + + client.resetAuthContext(); + Assert.assertNull(client.getAuthContext()); + } + + private static class MockRestClientImpl extends AbstractRestClient { + + public MockRestClientImpl(String url, int timeout) { + super(url, timeout); + } + + @Override + protected void checkStatus(Response response, + Response.Status... statuses) { + // pass + } + } + + @Test + public void testRequest() { + MockRestClientImpl client = new MockRestClientImpl("test", 1000); + + WebTarget target = Mockito.mock(WebTarget.class); + Builder builder = Mockito.mock(Builder.class); + + Mockito.when(target.path("test")).thenReturn(target); + Mockito.when(target.path("test") + .path(AbstractRestClient.encode("id"))) + .thenReturn(target); + Mockito.when(target.path("test").request()).thenReturn(builder); + Mockito.when(target.path("test") + .path(AbstractRestClient.encode("id")) + .request()) + .thenReturn(builder); + + Response response = Mockito.mock(Response.class); + Mockito.when(response.getStatus()).thenReturn(200); + Mockito.when(response.getHeaders()) + .thenReturn(new MultivaluedHashMap<>()); + Mockito.when(response.readEntity(String.class)).thenReturn("content"); + + Mockito.when(builder.delete()).thenReturn(response); + Mockito.when(builder.get()).thenReturn(response); + Mockito.when(builder.put(Mockito.any())).thenReturn(response); + Mockito.when(builder.post(Mockito.any())).thenReturn(response); + + Whitebox.setInternalState(client, "target", target); + + RestResult result; + + // Test delete + client.setAuthContext("token1"); + result = client.delete("test", ImmutableMap.of()); + Assert.assertEquals(200, result.status()); + Mockito.verify(builder).header(HttpHeaders.AUTHORIZATION, + "token1"); + client.resetAuthContext(); + + client.setAuthContext("token2"); + result = client.delete("test", "id"); + Assert.assertEquals(200, result.status()); + Mockito.verify(builder).header(HttpHeaders.AUTHORIZATION, + "token2"); + client.resetAuthContext(); + + // Test get + client.setAuthContext("token3"); + result = client.get("test"); + Assert.assertEquals(200, result.status()); + Mockito.verify(builder).header(HttpHeaders.AUTHORIZATION, + "token3"); + client.resetAuthContext(); + + client.setAuthContext("token4"); + result = client.get("test", ImmutableMap.of()); + Assert.assertEquals(200, result.status()); + Mockito.verify(builder).header(HttpHeaders.AUTHORIZATION, + "token4"); + client.resetAuthContext(); + + client.setAuthContext("token5"); + result = client.get("test", "id"); + Assert.assertEquals(200, result.status()); + Mockito.verify(builder).header(HttpHeaders.AUTHORIZATION, + "token5"); + client.resetAuthContext(); + + // Test put + client.setAuthContext("token6"); + result = client.post("test", new Object()); + Assert.assertEquals(200, result.status()); + Mockito.verify(builder).header(HttpHeaders.AUTHORIZATION, + "token6"); + client.resetAuthContext(); + + client.setAuthContext("token7"); + result = client.post("test", new Object(), new MultivaluedHashMap<>()); + Assert.assertEquals(200, result.status()); + Mockito.verify(builder).header(HttpHeaders.AUTHORIZATION, + "token7"); + client.resetAuthContext(); + + client.setAuthContext("token8"); + result = client.post("test", new Object(), ImmutableMap.of()); + Assert.assertEquals(200, result.status()); + Mockito.verify(builder).header(HttpHeaders.AUTHORIZATION, + "token8"); + client.resetAuthContext(); + + client.setAuthContext("token9"); + result = client.post("test", new Object(), new MultivaluedHashMap<>(), + ImmutableMap.of()); + Assert.assertEquals(200, result.status()); + Mockito.verify(builder).header(HttpHeaders.AUTHORIZATION, + "token9"); + client.resetAuthContext(); + + // Test post + client.setAuthContext("token10"); + result = client.post("test", new Object()); + Assert.assertEquals(200, result.status()); + Mockito.verify(builder).header(HttpHeaders.AUTHORIZATION, + "token10"); + client.resetAuthContext(); + + client.setAuthContext("token11"); + result = client.post("test", new Object(), new MultivaluedHashMap<>()); + Assert.assertEquals(200, result.status()); + Mockito.verify(builder).header(HttpHeaders.AUTHORIZATION, + "token11"); + client.resetAuthContext(); + + client.setAuthContext("token12"); + result = client.post("test", new Object(), ImmutableMap.of()); + Assert.assertEquals(200, result.status()); + Mockito.verify(builder).header(HttpHeaders.AUTHORIZATION, + "token12"); + client.resetAuthContext(); + + client.setAuthContext("token13"); + result = client.post("test", new Object(), new MultivaluedHashMap<>(), + ImmutableMap.of()); + Assert.assertEquals(200, result.status()); + Mockito.verify(builder).header(HttpHeaders.AUTHORIZATION, + "token13"); + client.resetAuthContext(); + } } From 49e8599d8f46182cac00fb4a7e5ec6a3b13801ff Mon Sep 17 00:00:00 2001 From: imbajin Date: Fri, 2 Jul 2021 16:35:24 +0800 Subject: [PATCH 150/217] chore: add issue template & auto stale issues and pr (#78) --- .github/ISSUE_TEMPLATE/bug_report.yml | 96 ++++++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 7 ++ .github/ISSUE_TEMPLATE/feature_request.yml | 15 ++++ .github/ISSUE_TEMPLATE/question_ask.yml | 94 +++++++++++++++++++++ .github/workflows/ci.yml | 3 +- .github/workflows/stale.yml | 36 ++++++++ 6 files changed, 249 insertions(+), 2 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml create mode 100644 .github/ISSUE_TEMPLATE/question_ask.yml create mode 100644 .github/workflows/stale.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000000..780d51efd9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,96 @@ +name: Bug report (反馈 Bug) +description: Create a bug report to help HugeGraph improve +title: '[Bug] describe the main problem' +labels: + - bug + +body: + - type: markdown + attributes: + value: >- + ### Note (特别注意) : + + > 1. 请先**搜索**现有的[Server-Issues](https://github.com/hugegraph/hugegraph/issues) 与 + [Common-Issues](https://github.com/hugegraph/hugegraph-common/issues) 中没有与您相同 + / 相关的问题 (请勿重复提交) + + > 2. 我们需要尽可能**详细**的信息来**复现**问题, 越详细的信息 (包括**日志 / 截图 / 配置**等) + 会**越快**被响应和处理 + + > 3. Issue 标题请保持原有模板分类(例如:`[Bug]`), 长段描述之间可以增加`空行`或使用`序号`标记, 保持排版清晰 + + > 4. 请在对应的模块提交 issue, 缺乏有效信息 / 长时间 (> 14 天) 没有回复的 issue 可能会被 **关闭** + (更新时会再开启) + + - type: dropdown + attributes: + label: Bug Type (问题类型) + options: + - exception / error (异常报错) + - logic (逻辑设计问题) + - performence (性能下降) + - others (please edit later) + + - type: checkboxes + attributes: + label: Before submit + options: + - label: 我已经确认现有的 [Server-Issues](https://github.com/hugegraph/hugegraph/issues) 与 [Common-Issues](https://github.com/hugegraph/hugegraph-common/issues) 中没有相同 / 重复问题 + required: true + + - type: textarea + attributes: + label: Environment (环境信息) + description: | + > server version could get from [rest-api](https://hugegraph.github.io/hugegraph-doc/clients/restful-api/other.html) (http://localhost:8080/versions) + value: | + - Server Version: v0.11.x + - Common Version: v1.x + validations: + required: true + + - type: textarea + attributes: + label: Expected & Actual behavior (期望与实际表现) + description: | + > we can refer [How to create a minimal reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) (如何提供最简的可复现用例) + > if possible, please provide screenshots or GIF (请提供清晰的截图, 动图录屏更佳) + placeholder: | + type the main problem here + + ```java + // Exception / Error info (尽可能详细的日志 + 完整异常栈) + + ``` + validations: + required: true + + - type: textarea + attributes: + label: Vertex/Edge example (问题点 / 边数据举例) + description: | + > 如果问题与具体的点 / 边数据相关, 请提供完整的`查询语句 + 返回 JSON 结果` + placeholder: | + // Query URL + GET http://localhost:8080/gremlin?gremlin=hugegraph.traversal().V('1:tom') + + // JSON of Vertex / Edge + { + "vertex": { "id": "xxx" } + } + render: javascript + + - type: textarea + attributes: + label: Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构) + description: | + > 如果问题与具体的点类型 / 边类型 / 索引类型相关, 请提供完整的 `Schema 返回 JSON 结果` + placeholder: | + // Query URL + GET http://localhost:8080/graphs/hugegraph/schema/vertexlabels + + // JSON of GraphSchema + { + "vertex": { "id": "xxx" } + } + render: javascript diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000000..10783233d4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,7 @@ +blank_issues_enabled: false + +# 设置提 issue 前的参考文档 +contact_links: + - name: HugeGraph API Doc + url: https://hugegraph.github.io/hugegraph-doc/clients/hugegraph-api.html + about: Please search usage here before opening a new issue diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000000..4012606e4a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,15 @@ +name: Feature request (新需求 / 功能) +description: Give an idea for HugeGraph +title: '[Feature] describe the new feature' +labels: + - feature + +body: + - type: textarea + attributes: + label: Feature Description (功能描述) + description: | + > 请简要描述新功能 / 需求的使用场景或上下文, 最好能给个具体的例子说明 + placeholder: type the feature description here + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/question_ask.yml b/.github/ISSUE_TEMPLATE/question_ask.yml new file mode 100644 index 0000000000..6a57883ee2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question_ask.yml @@ -0,0 +1,94 @@ +name: Ask question (提问) +description: Question about usage or configs in HugeGraph +title: '[Question] describe your problem' + +body: + - type: markdown + attributes: + value: >- + ### Note (特别注意) : + + > 1. 请先**搜索**现有的[Server-Issues](https://github.com/hugegraph/hugegraph/issues) 与 + [Common-Issues](https://github.com/hugegraph/hugegraph-common/issues) 中没有与您相同 + / 相关的问题 (请勿重复提交) + + > 2. 我们需要尽可能**详细**的信息来**复现**问题, 越详细的信息 (包括**日志 / 截图 / 配置**等) + 会**越快**被响应和处理 + + > 3. Issue 标题请保持原有模板分类(例如:`[Bug]`), 长段描述之间可以增加`空行`或使用`序号`标记, 保持排版清晰 + + > 4. 请在对应的模块提交 issue, 缺乏有效信息 / 长时间 (> 14 天) 没有回复的 issue 可能会被 **关闭** + (更新时会再开启) + + - type: dropdown + attributes: + label: Problem Type (问题类型) + options: + - struct / logic (架构 / 逻辑设计问题) + - performence (性能优化) + - exception / error (异常报错) + - others (please edit later) + + - type: checkboxes + attributes: + label: Before submit + options: + - label: 我已经确认现有的 [Server-Issues](https://github.com/hugegraph/hugegraph/issues) 与 [Common-Issues](https://github.com/hugegraph/hugegraph-common/issues) 中没有相同 / 重复问题 + required: true + + - type: textarea + attributes: + label: Environment (环境信息) + description: | + > server version could get from [rest-api](https://hugegraph.github.io/hugegraph-doc/clients/restful-api/other.html) (http://localhost:8080/versions) + value: | + - Server Version: v0.11.x + - Common Version: v1.x + validations: + required: true + + - type: textarea + attributes: + label: Your Question (问题描述) + description: | + > 图使用 / 配置相关问题,请优先参考 [REST-API 文档](https://hugegraph.github.io/hugegraph-doc/clients/hugegraph-api.html), 以及 [Server 配置文档](https://hugegraph.github.io/hugegraph-doc/config/config-option.html) + > if possible, please provide screenshots or GIF (请提供清晰的截图, 动图录屏更佳) + placeholder: | + type the main problem here + + ```java + // Exception / Error info (尽可能详细的日志 + 完整异常栈) + + ``` + validations: + required: true + + - type: textarea + attributes: + label: Vertex/Edge example (问题点 / 边数据举例) + description: | + > 如果问题与具体的点 / 边数据相关, 请提供完整的`查询语句 + 返回 JSON 结果` + placeholder: | + // Query URL + GET http://localhost:8080/gremlin?gremlin=hugegraph.traversal().V('1:tom') + + // JSON of Vertex / Edge + { + "vertex": { "id": "xxx" } + } + render: javascript + + - type: textarea + attributes: + label: Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构) + description: | + > 如果问题与具体的点类型 / 边类型 / 索引类型相关, 请提供完整的 `Schema 返回 JSON 结果` + placeholder: | + // Query URL + GET http://localhost:8080/graphs/hugegraph/schema/vertexlabels + + // JSON of GraphSchema + { + "vertex": { "id": "xxx" } + } + render: javascript diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e7792c8d27..dbf462b564 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,7 +43,6 @@ jobs: mvn test -Dtest=UnitTestSuite - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1.0.2 + uses: codecov/codecov-action@v1 with: - token: ${{secrets.CODECOV_TOKEN}} file: target/jacoco.xml diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000000..1813bd3cb2 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,36 @@ +name: Mark stale issues and pull requests + +on: + schedule: + - cron: "0 21 * * *" + +jobs: + stale: + + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + + steps: + - uses: actions/stale@v3 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: 'Due to the lack of activity, the current issue is marked as stale and will be closed after 20 days, any update will remove the stale label' + stale-pr-message: 'Due to the lack of activity, the current pr is marked as stale and will be closed after 180 days, any update will remove the stale label' + stale-issue-label: 'inactive' + stale-pr-label: 'inactive' + exempt-issue-labels: 'feature,bug,enhancement,improvement,wontfix,todo' + + days-before-issue-stale: 15 + days-before-issue-close: 20 + days-before-pr-stale: 30 + days-before-pr-close: 180 + operations-per-run: 10 + start-date: '2018-12-01T00:00:00Z' + + exempt-all-assignees: true + remove-stale-when-updated: true + exempt-all-pr-milestones: true + delete-branch: false + enable-statistics: true From 3881b866977e4464ec018709a2a78cd3a5bda091 Mon Sep 17 00:00:00 2001 From: coderzc Date: Wed, 28 Jul 2021 11:23:55 +0800 Subject: [PATCH 151/217] fix: unable to close the rpc thread pool at destroy (#3) --- pom.xml | 2 +- src/main/java/com/baidu/hugegraph/rpc/RpcServer.java | 2 +- src/main/java/com/baidu/hugegraph/version/RpcVersion.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 23e13fb8b8..f650d64406 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-rpc - 1.0.0 + 1.0.1 hugegraph-rpc https://github.com/hugegraph/hugegraph-rpc diff --git a/src/main/java/com/baidu/hugegraph/rpc/RpcServer.java b/src/main/java/com/baidu/hugegraph/rpc/RpcServer.java index 1118d37e02..a7e0ba9115 100644 --- a/src/main/java/com/baidu/hugegraph/rpc/RpcServer.java +++ b/src/main/java/com/baidu/hugegraph/rpc/RpcServer.java @@ -137,8 +137,8 @@ public void destroy() { } } } - this.configs.removeAllService(); this.serverConfig.destroy(); + this.configs.removeAllService(); } private void checkEnabled() { diff --git a/src/main/java/com/baidu/hugegraph/version/RpcVersion.java b/src/main/java/com/baidu/hugegraph/version/RpcVersion.java index 884cc260e2..cd41fe55be 100644 --- a/src/main/java/com/baidu/hugegraph/version/RpcVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/RpcVersion.java @@ -27,5 +27,5 @@ public class RpcVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(RpcVersion.class, - "1.0.0"); + "1.0.1"); } From 53c6503cdefeb6d3ca7afe0ac7d349aefedacea6 Mon Sep 17 00:00:00 2001 From: imbajin Date: Sat, 9 Oct 2021 11:40:54 +0800 Subject: [PATCH 152/217] chore: update ubuntu version for ci actions (#79) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dbf462b564..5dda16800a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ on: jobs: build: - runs-on: ubuntu-16.04 + runs-on: ubuntu-20.04 steps: - name: Install JDK 8 uses: actions/setup-java@v2 From 1d274529946e3d8e33fa29555fd968da3fbc7c1f Mon Sep 17 00:00:00 2001 From: guoygang Date: Tue, 2 Nov 2021 19:43:38 +0800 Subject: [PATCH 153/217] add bearer token support (#81) --- pom.xml | 2 +- .../baidu/hugegraph/perf/NormalStopwatch.java | 4 +- .../hugegraph/rest/AbstractRestClient.java | 48 +++++++++++++++++ .../hugegraph/version/CommonVersion.java | 2 +- .../hugegraph/unit/rest/RestClientTest.java | 53 +++++++++++++++++++ 5 files changed, 106 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index e2a8639282..7b9e61c712 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-common - 1.8.9 + 1.8.10 hugegraph-common https://github.com/hugegraph/hugegraph-common diff --git a/src/main/java/com/baidu/hugegraph/perf/NormalStopwatch.java b/src/main/java/com/baidu/hugegraph/perf/NormalStopwatch.java index c097cadceb..7011bcab70 100644 --- a/src/main/java/com/baidu/hugegraph/perf/NormalStopwatch.java +++ b/src/main/java/com/baidu/hugegraph/perf/NormalStopwatch.java @@ -268,7 +268,9 @@ protected static void initEachWastedLost() { test.run(); long end = PerfUtil.now(); long cost = end - start - baseCost; - assert cost > 0; + if (cost < 0L) { + cost = 0L; + } long eachCost = cost / times; LOG.info("Wasted time test: cost={}ms, base_cost={}ms, {}={}ns", diff --git a/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java b/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java index 1048fc1dea..5c96196491 100644 --- a/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java +++ b/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java @@ -19,6 +19,7 @@ package com.baidu.hugegraph.rest; +import java.io.IOException; import java.net.URI; import java.security.KeyManagementException; import java.security.SecureRandom; @@ -38,6 +39,8 @@ import javax.net.ssl.X509TrustManager; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.ClientRequestContext; +import javax.ws.rs.client.ClientRequestFilter; import javax.ws.rs.client.Entity; import javax.ws.rs.client.Invocation.Builder; import javax.ws.rs.client.WebTarget; @@ -78,6 +81,8 @@ public abstract class AbstractRestClient implements RestClient { // Time unit: ms private static final long IDLE_TIME = 40L * 1000L; + private static final String TOKEN_KEY = "tokenKey"; + private final Client client; private final WebTarget target; @@ -130,6 +135,32 @@ public AbstractRestClient(String url, String user, String password, .build()); } + public AbstractRestClient(String url, String token, int timeout) { + this(url, new ConfigBuilder().configTimeout(timeout) + .configToken(token) + .build()); + } + + public AbstractRestClient(String url, String token, int timeout, + int maxTotal, int maxPerRoute) { + this(url, new ConfigBuilder().configTimeout(timeout) + .configToken(token) + .configPool(maxTotal, maxPerRoute) + .build()); + } + + public AbstractRestClient(String url, String token, int timeout, + int maxTotal, int maxPerRoute, + String trustStoreFile, + String trustStorePassword) { + this(url, new ConfigBuilder().configTimeout(timeout) + .configToken(token) + .configPool(maxTotal, maxPerRoute) + .configSSL(trustStoreFile, + trustStorePassword) + .build()); + } + public AbstractRestClient(String url, ClientConfig config) { configConnectionManager(url, config); this.client = ClientBuilder.newClient(config); @@ -519,6 +550,12 @@ public ConfigBuilder configUser(String username, String password) { return this; } + public ConfigBuilder configToken(String token) { + this.config.property(TOKEN_KEY, token); + this.config.register(BearerRequestFilter.class); + return this; + } + public ConfigBuilder configPool(int maxTotal, int maxPerRoute) { this.config.property("maxTotal", maxTotal); this.config.property("maxPerRoute", maxPerRoute); @@ -547,4 +584,15 @@ public ClientConfig build() { return this.config; } } + + public static class BearerRequestFilter implements ClientRequestFilter { + + @Override + public void filter(ClientRequestContext context) throws IOException { + String token = context.getClient().getConfiguration() + .getProperty(TOKEN_KEY).toString(); + context.getHeaders().add(HttpHeaders.AUTHORIZATION, + "Bearer " + token); + } + } } diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 773eb3670a..81a9756d03 100644 --- a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.8.9"); + "1.8.10"); } diff --git a/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java b/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java index a9f4d972b3..d682025fc4 100644 --- a/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java @@ -111,6 +111,33 @@ public RestClientImpl(String url, String user, String password, this.content = ""; } + public RestClientImpl(String url, String token, + int timeout, int status) { + super(url, token, timeout); + this.status = status; + this.headers = ImmutableMultivaluedMap.empty(); + this.content = ""; + } + + public RestClientImpl(String url, String token, int timeout, + int maxTotal, int maxPerRoute, int status) { + super(url, token, timeout, maxTotal, maxPerRoute); + this.status = status; + this.headers = ImmutableMultivaluedMap.empty(); + this.content = ""; + } + + public RestClientImpl(String url, String token, int timeout, + int maxTotal, int maxPerRoute, + String trustStoreFile, + String trustStorePassword, int status) { + super(url, token, timeout, maxTotal, maxPerRoute, + trustStoreFile, trustStorePassword); + this.status = status; + this.headers = ImmutableMultivaluedMap.empty(); + this.content = ""; + } + public RestClientImpl(String url, int timeout, int status) { this(url, timeout, status, ImmutableMultivaluedMap.empty(), ""); } @@ -218,6 +245,13 @@ public void testPostWithUserAndPassword() { Assert.assertEquals(200, restResult.status()); } + @Test + public void testPostWithToken() { + RestClient client = new RestClientImpl("/test", "token", 1000, 200); + RestResult restResult = client.post("path", "body"); + Assert.assertEquals(200, restResult.status()); + } + @Test public void testPostWithAllParams() { RestClient client = new RestClientImpl("/test", "user", "", 1000, @@ -226,6 +260,14 @@ public void testPostWithAllParams() { Assert.assertEquals(200, restResult.status()); } + @Test + public void testPostWithTokenAndAllParams() { + RestClient client = new RestClientImpl("/test", "token", 1000, + 10, 5, 200); + RestResult restResult = client.post("path", "body"); + Assert.assertEquals(200, restResult.status()); + } + @Test public void testPostHttpsWithAllParams() { String trustStoreFile = "src/test/resources/cacerts.jks"; @@ -237,6 +279,17 @@ public void testPostHttpsWithAllParams() { Assert.assertEquals(200, restResult.status()); } + @Test + public void testPostHttpsWithTokenAndAllParams() { + String trustStoreFile = "src/test/resources/cacerts.jks"; + String trustStorePassword = "changeit"; + RestClient client = new RestClientImpl("/test", "token", 1000, + 10, 5, trustStoreFile, + trustStorePassword, 200); + RestResult restResult = client.post("path", "body"); + Assert.assertEquals(200, restResult.status()); + } + @Test public void testHostNameVerifier() { BiFunction verifer = (url, hostname) -> { From c572c2bedd2285925e02decc9515c81e80b705da Mon Sep 17 00:00:00 2001 From: imbajin Date: Tue, 30 Nov 2021 15:29:35 +0800 Subject: [PATCH 154/217] first rename --- hugegraph-common/BCLOUD | 1 + LICENSE => hugegraph-common/LICENSE | 0 README.md => hugegraph-common/README.md | 0 build.sh => hugegraph-common/build.sh | 0 checkstyle.xml => hugegraph-common/checkstyle.xml | 0 pom.xml => hugegraph-common/pom.xml | 0 .../com/baidu/hugegraph/concurrent/AtomicLock.java | 0 .../baidu/hugegraph/concurrent/BarrierEvent.java | 0 .../com/baidu/hugegraph/concurrent/KeyLock.java | 0 .../com/baidu/hugegraph/concurrent/LockGroup.java | 0 .../com/baidu/hugegraph/concurrent/LockManager.java | 0 .../concurrent/PausableScheduledThreadPool.java | 0 .../com/baidu/hugegraph/concurrent/RowLock.java | 0 .../baidu/hugegraph/config/ConfigConvOption.java | 0 .../com/baidu/hugegraph/config/ConfigException.java | 0 .../hugegraph/config/ConfigListConvOption.java | 0 .../baidu/hugegraph/config/ConfigListOption.java | 0 .../com/baidu/hugegraph/config/ConfigOption.java | 0 .../java/com/baidu/hugegraph/config/HugeConfig.java | 0 .../com/baidu/hugegraph/config/OptionChecker.java | 0 .../com/baidu/hugegraph/config/OptionHolder.java | 0 .../com/baidu/hugegraph/config/OptionSpace.java | 0 .../com/baidu/hugegraph/config/TypedOption.java | 0 .../com/baidu/hugegraph/date/SafeDateFormat.java | 0 .../main/java/com/baidu/hugegraph/event/Event.java | 0 .../java/com/baidu/hugegraph/event/EventHub.java | 0 .../com/baidu/hugegraph/event/EventListener.java | 0 .../java/com/baidu/hugegraph/func/TriFunction.java | 0 .../hugegraph/iterator/BatchMapperIterator.java | 0 .../java/com/baidu/hugegraph/iterator/CIter.java | 0 .../hugegraph/iterator/ExtendableIterator.java | 0 .../baidu/hugegraph/iterator/FilterIterator.java | 0 .../iterator/FlatMapperFilterIterator.java | 0 .../hugegraph/iterator/FlatMapperIterator.java | 0 .../com/baidu/hugegraph/iterator/LimitIterator.java | 0 .../com/baidu/hugegraph/iterator/ListIterator.java | 0 .../baidu/hugegraph/iterator/MapperIterator.java | 0 .../com/baidu/hugegraph/iterator/Metadatable.java | 0 .../baidu/hugegraph/iterator/WrappedIterator.java | 0 .../hugegraph/license/CommonLicenseManager.java | 0 .../com/baidu/hugegraph/license/ExtraParam.java | 0 .../baidu/hugegraph/license/FileKeyStoreParam.java | 0 .../baidu/hugegraph/license/LicenseCreateParam.java | 0 .../baidu/hugegraph/license/LicenseVerifyParam.java | 0 .../com/baidu/hugegraph/license/MachineInfo.java | 0 .../com/baidu/hugegraph/perf/LightStopwatch.java | 0 .../com/baidu/hugegraph/perf/NormalStopwatch.java | 0 .../java/com/baidu/hugegraph/perf/PerfUtil.java | 0 .../java/com/baidu/hugegraph/perf/Stopwatch.java | 0 .../baidu/hugegraph/rest/AbstractRestClient.java | 0 .../com/baidu/hugegraph/rest/ClientException.java | 0 .../java/com/baidu/hugegraph/rest/RestClient.java | 0 .../java/com/baidu/hugegraph/rest/RestResult.java | 0 .../baidu/hugegraph/rest/SerializeException.java | 0 .../java/com/baidu/hugegraph/testutil/Assert.java | 0 .../java/com/baidu/hugegraph/testutil/Whitebox.java | 0 .../main/java/com/baidu/hugegraph/util/Bytes.java | 0 .../java/com/baidu/hugegraph/util/CheckSocket.java | 0 .../com/baidu/hugegraph/util/CollectionUtil.java | 0 .../java/com/baidu/hugegraph/util/DateUtil.java | 0 .../src}/main/java/com/baidu/hugegraph/util/E.java | 0 .../java/com/baidu/hugegraph/util/ExecutorUtil.java | 0 .../java/com/baidu/hugegraph/util/HashUtil.java | 0 .../baidu/hugegraph/util/InsertionOrderUtil.java | 0 .../main/java/com/baidu/hugegraph/util/Log.java | 0 .../java/com/baidu/hugegraph/util/LongEncoding.java | 0 .../java/com/baidu/hugegraph/util/NumericUtil.java | 0 .../com/baidu/hugegraph/util/OrderLimitMap.java | 0 .../com/baidu/hugegraph/util/ReflectionUtil.java | 0 .../java/com/baidu/hugegraph/util/StringUtil.java | 0 .../java/com/baidu/hugegraph/util/TimeUtil.java | 0 .../java/com/baidu/hugegraph/util/UnitUtil.java | 0 .../java/com/baidu/hugegraph/util/VersionUtil.java | 0 .../com/baidu/hugegraph/version/CommonVersion.java | 0 .../com/baidu/hugegraph/testutil/AssertTest.java | 0 .../com/baidu/hugegraph/testutil/WhiteboxTest.java | 0 .../java/com/baidu/hugegraph/unit/BaseUnitTest.java | 0 .../com/baidu/hugegraph/unit/UnitTestSuite.java | 0 .../hugegraph/unit/concurrent/AtomicLockTest.java | 0 .../hugegraph/unit/concurrent/BarrierEventTest.java | 0 .../hugegraph/unit/concurrent/KeyLockTest.java | 0 .../hugegraph/unit/concurrent/LockGroupTest.java | 0 .../hugegraph/unit/concurrent/LockManagerTest.java | 0 .../concurrent/PausableScheduledThreadPoolTest.java | 0 .../hugegraph/unit/concurrent/RowLockTest.java | 0 .../baidu/hugegraph/unit/config/HugeConfigTest.java | 0 .../hugegraph/unit/config/OptionSpaceTest.java | 0 .../hugegraph/unit/config/test-check-error.conf | 0 .../hugegraph/unit/config/test-list-error.conf | 0 .../hugegraph/unit/config/test-type-error.conf | 0 .../java/com/baidu/hugegraph/unit/config/test.conf | 0 .../hugegraph/unit/date/SafeDateFormatTest.java | 0 .../baidu/hugegraph/unit/event/EventHubTest.java | 0 .../unit/iterator/BatchMapperIteratorTest.java | 0 .../unit/iterator/ExtendableIteratorTest.java | 0 .../hugegraph/unit/iterator/FilterIteratorTest.java | 0 .../unit/iterator/FlatMapperFilterIteratorTest.java | 0 .../unit/iterator/FlatMapperIteratorTest.java | 0 .../hugegraph/unit/iterator/LimitIteratorTest.java | 0 .../hugegraph/unit/iterator/ListIteratorTest.java | 0 .../hugegraph/unit/iterator/MapperIteratorTest.java | 0 .../hugegraph/unit/license/ExtraParamTest.java | 0 .../unit/license/LicenseCreateParamTest.java | 0 .../hugegraph/unit/license/LicenseManagerTest.java | 0 .../unit/license/LicenseVerifyParamTest.java | 0 .../hugegraph/unit/license/MachineInfoTest.java | 0 .../com/baidu/hugegraph/unit/perf/PerfUtilTest.java | 0 .../baidu/hugegraph/unit/perf/StopwatchTest.java | 0 .../hugegraph/unit/perf/testclass/TestClass.java | 0 .../unit/perf/testclass/TestLightClass.java | 0 .../unit/perf/testclass/TestPerfClass.java | 0 .../unit/perf/testclass/TestPerfLightClass.java | 0 .../unit/perf/testclass2/TestClass4Package.java | 0 .../baidu/hugegraph/unit/rest/RestClientTest.java | 0 .../baidu/hugegraph/unit/rest/RestResultTest.java | 0 .../com/baidu/hugegraph/unit/util/BytesTest.java | 0 .../hugegraph/unit/util/CollectionUtilTest.java | 0 .../com/baidu/hugegraph/unit/util/DateUtilTest.java | 0 .../com/baidu/hugegraph/unit/util/EcheckTest.java | 0 .../com/baidu/hugegraph/unit/util/HashUtilTest.java | 0 .../hugegraph/unit/util/InsertionOrderUtilTest.java | 0 .../java/com/baidu/hugegraph/unit/util/LogTest.java | 0 .../baidu/hugegraph/unit/util/LongEncodingTest.java | 0 .../baidu/hugegraph/unit/util/NumericUtilTest.java | 0 .../hugegraph/unit/util/OrderLimitMapTest.java | 0 .../hugegraph/unit/util/ReflectionUtilTest.java | 0 .../baidu/hugegraph/unit/util/StringUtilTest.java | 0 .../com/baidu/hugegraph/unit/util/TimeUtilTest.java | 0 .../com/baidu/hugegraph/unit/util/UnitUtilTest.java | 0 .../baidu/hugegraph/unit/util/VersionUtilTest.java | 0 .../baidu/hugegraph/unit/version/VersionTest.java | 0 .../src}/test/resources/META-INF/MANIFEST.MF | 0 .../src}/test/resources/cacerts.jks | Bin .../src}/test/resources/create-license.json | 0 .../src}/test/resources/log4j2.xml | 0 .../src}/test/resources/privateKeys.store | Bin .../src}/test/resources/publicCerts.store | Bin .../src}/test/resources/verify-license.json | 0 138 files changed, 1 insertion(+) create mode 100644 hugegraph-common/BCLOUD rename LICENSE => hugegraph-common/LICENSE (100%) rename README.md => hugegraph-common/README.md (100%) rename build.sh => hugegraph-common/build.sh (100%) rename checkstyle.xml => hugegraph-common/checkstyle.xml (100%) rename pom.xml => hugegraph-common/pom.xml (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/concurrent/BarrierEvent.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/concurrent/KeyLock.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/concurrent/LockGroup.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/concurrent/LockManager.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/concurrent/PausableScheduledThreadPool.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/concurrent/RowLock.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/config/ConfigConvOption.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/config/ConfigException.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/config/ConfigListConvOption.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/config/ConfigListOption.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/config/ConfigOption.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/config/HugeConfig.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/config/OptionChecker.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/config/OptionHolder.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/config/OptionSpace.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/config/TypedOption.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/date/SafeDateFormat.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/event/Event.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/event/EventHub.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/event/EventListener.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/func/TriFunction.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/iterator/BatchMapperIterator.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/iterator/CIter.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/iterator/FilterIterator.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/iterator/FlatMapperFilterIterator.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/iterator/LimitIterator.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/iterator/ListIterator.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/iterator/MapperIterator.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/iterator/Metadatable.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/license/CommonLicenseManager.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/license/ExtraParam.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/license/FileKeyStoreParam.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/license/LicenseCreateParam.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/license/LicenseVerifyParam.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/license/MachineInfo.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/perf/LightStopwatch.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/perf/NormalStopwatch.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/perf/PerfUtil.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/perf/Stopwatch.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/rest/ClientException.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/rest/RestClient.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/rest/RestResult.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/rest/SerializeException.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/testutil/Assert.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/testutil/Whitebox.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/Bytes.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/CheckSocket.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/CollectionUtil.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/DateUtil.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/E.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/ExecutorUtil.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/HashUtil.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/InsertionOrderUtil.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/Log.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/LongEncoding.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/NumericUtil.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/OrderLimitMap.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/ReflectionUtil.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/StringUtil.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/TimeUtil.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/UnitUtil.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/VersionUtil.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/version/CommonVersion.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/testutil/AssertTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/concurrent/AtomicLockTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/concurrent/BarrierEventTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/concurrent/KeyLockTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/concurrent/LockManagerTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/config/OptionSpaceTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/config/test-check-error.conf (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/config/test-list-error.conf (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/config/test-type-error.conf (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/config/test.conf (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/date/SafeDateFormatTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/event/EventHubTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/iterator/BatchMapperIteratorTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/iterator/ExtendableIteratorTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/iterator/FilterIteratorTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperIteratorTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/iterator/LimitIteratorTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/iterator/ListIteratorTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/iterator/MapperIteratorTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/license/ExtraParamTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/license/LicenseManagerTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/license/LicenseVerifyParamTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/license/MachineInfoTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/perf/PerfUtilTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/perf/StopwatchTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/perf/testclass/TestClass.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/perf/testclass/TestLightClass.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfClass.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfLightClass.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/perf/testclass2/TestClass4Package.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/rest/RestResultTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/BytesTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/DateUtilTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/EcheckTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/HashUtilTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/InsertionOrderUtilTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/LogTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/LongEncodingTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/OrderLimitMapTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/StringUtilTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/TimeUtilTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/UnitUtilTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/version/VersionTest.java (100%) rename {src => hugegraph-common/src}/test/resources/META-INF/MANIFEST.MF (100%) rename {src => hugegraph-common/src}/test/resources/cacerts.jks (100%) rename {src => hugegraph-common/src}/test/resources/create-license.json (100%) rename {src => hugegraph-common/src}/test/resources/log4j2.xml (100%) rename {src => hugegraph-common/src}/test/resources/privateKeys.store (100%) rename {src => hugegraph-common/src}/test/resources/publicCerts.store (100%) rename {src => hugegraph-common/src}/test/resources/verify-license.json (100%) diff --git a/hugegraph-common/BCLOUD b/hugegraph-common/BCLOUD new file mode 100644 index 0000000000..df3f342be8 --- /dev/null +++ b/hugegraph-common/BCLOUD @@ -0,0 +1 @@ +BUILD_SUBMITTER -x -u ./ -e CENTOS6U3 -m baidu/xbu-data/hugegraph-common -c "export MAVEN_HOME=/home/scmtools/buildkit/maven/apache-maven-3.3.9/ && export JAVA_HOME=/home/scmtools/buildkit/java/jdk1.8.0_25/ && export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH && cd baidu/xbu-data/hugegraph-common && mkdir output && sh build.sh" -o output \ No newline at end of file diff --git a/LICENSE b/hugegraph-common/LICENSE similarity index 100% rename from LICENSE rename to hugegraph-common/LICENSE diff --git a/README.md b/hugegraph-common/README.md similarity index 100% rename from README.md rename to hugegraph-common/README.md diff --git a/build.sh b/hugegraph-common/build.sh similarity index 100% rename from build.sh rename to hugegraph-common/build.sh diff --git a/checkstyle.xml b/hugegraph-common/checkstyle.xml similarity index 100% rename from checkstyle.xml rename to hugegraph-common/checkstyle.xml diff --git a/pom.xml b/hugegraph-common/pom.xml similarity index 100% rename from pom.xml rename to hugegraph-common/pom.xml diff --git a/src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java diff --git a/src/main/java/com/baidu/hugegraph/concurrent/BarrierEvent.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/BarrierEvent.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/concurrent/BarrierEvent.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/BarrierEvent.java diff --git a/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java diff --git a/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java diff --git a/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/concurrent/LockManager.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java diff --git a/src/main/java/com/baidu/hugegraph/concurrent/PausableScheduledThreadPool.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/PausableScheduledThreadPool.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/concurrent/PausableScheduledThreadPool.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/PausableScheduledThreadPool.java diff --git a/src/main/java/com/baidu/hugegraph/concurrent/RowLock.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/RowLock.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/concurrent/RowLock.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/RowLock.java diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigConvOption.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigConvOption.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/config/ConfigConvOption.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigConvOption.java diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigException.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigException.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/config/ConfigException.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigException.java diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigListConvOption.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigListConvOption.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/config/ConfigListConvOption.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigListConvOption.java diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/config/ConfigListOption.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigOption.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/config/ConfigOption.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigOption.java diff --git a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/HugeConfig.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/config/HugeConfig.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/config/HugeConfig.java diff --git a/src/main/java/com/baidu/hugegraph/config/OptionChecker.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/OptionChecker.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/config/OptionChecker.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/config/OptionChecker.java diff --git a/src/main/java/com/baidu/hugegraph/config/OptionHolder.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/OptionHolder.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/config/OptionHolder.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/config/OptionHolder.java diff --git a/src/main/java/com/baidu/hugegraph/config/OptionSpace.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/OptionSpace.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/config/OptionSpace.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/config/OptionSpace.java diff --git a/src/main/java/com/baidu/hugegraph/config/TypedOption.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/TypedOption.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/config/TypedOption.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/config/TypedOption.java diff --git a/src/main/java/com/baidu/hugegraph/date/SafeDateFormat.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/date/SafeDateFormat.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/date/SafeDateFormat.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/date/SafeDateFormat.java diff --git a/src/main/java/com/baidu/hugegraph/event/Event.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/event/Event.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/event/Event.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/event/Event.java diff --git a/src/main/java/com/baidu/hugegraph/event/EventHub.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/event/EventHub.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/event/EventHub.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/event/EventHub.java diff --git a/src/main/java/com/baidu/hugegraph/event/EventListener.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/event/EventListener.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/event/EventListener.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/event/EventListener.java diff --git a/src/main/java/com/baidu/hugegraph/func/TriFunction.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/func/TriFunction.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/func/TriFunction.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/func/TriFunction.java diff --git a/src/main/java/com/baidu/hugegraph/iterator/BatchMapperIterator.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/BatchMapperIterator.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/iterator/BatchMapperIterator.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/BatchMapperIterator.java diff --git a/src/main/java/com/baidu/hugegraph/iterator/CIter.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/CIter.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/iterator/CIter.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/CIter.java diff --git a/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java diff --git a/src/main/java/com/baidu/hugegraph/iterator/FilterIterator.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/FilterIterator.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/iterator/FilterIterator.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/FilterIterator.java diff --git a/src/main/java/com/baidu/hugegraph/iterator/FlatMapperFilterIterator.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/FlatMapperFilterIterator.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/iterator/FlatMapperFilterIterator.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/FlatMapperFilterIterator.java diff --git a/src/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java diff --git a/src/main/java/com/baidu/hugegraph/iterator/LimitIterator.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/LimitIterator.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/iterator/LimitIterator.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/LimitIterator.java diff --git a/src/main/java/com/baidu/hugegraph/iterator/ListIterator.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/ListIterator.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/iterator/ListIterator.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/ListIterator.java diff --git a/src/main/java/com/baidu/hugegraph/iterator/MapperIterator.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/MapperIterator.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/iterator/MapperIterator.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/MapperIterator.java diff --git a/src/main/java/com/baidu/hugegraph/iterator/Metadatable.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/Metadatable.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/iterator/Metadatable.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/Metadatable.java diff --git a/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java diff --git a/src/main/java/com/baidu/hugegraph/license/CommonLicenseManager.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/CommonLicenseManager.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/license/CommonLicenseManager.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/license/CommonLicenseManager.java diff --git a/src/main/java/com/baidu/hugegraph/license/ExtraParam.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/ExtraParam.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/license/ExtraParam.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/license/ExtraParam.java diff --git a/src/main/java/com/baidu/hugegraph/license/FileKeyStoreParam.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/FileKeyStoreParam.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/license/FileKeyStoreParam.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/license/FileKeyStoreParam.java diff --git a/src/main/java/com/baidu/hugegraph/license/LicenseCreateParam.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseCreateParam.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/license/LicenseCreateParam.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseCreateParam.java diff --git a/src/main/java/com/baidu/hugegraph/license/LicenseVerifyParam.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseVerifyParam.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/license/LicenseVerifyParam.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseVerifyParam.java diff --git a/src/main/java/com/baidu/hugegraph/license/MachineInfo.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/MachineInfo.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/license/MachineInfo.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/license/MachineInfo.java diff --git a/src/main/java/com/baidu/hugegraph/perf/LightStopwatch.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/perf/LightStopwatch.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/perf/LightStopwatch.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/perf/LightStopwatch.java diff --git a/src/main/java/com/baidu/hugegraph/perf/NormalStopwatch.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/perf/NormalStopwatch.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/perf/NormalStopwatch.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/perf/NormalStopwatch.java diff --git a/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/perf/PerfUtil.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java diff --git a/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/perf/Stopwatch.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java diff --git a/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java diff --git a/src/main/java/com/baidu/hugegraph/rest/ClientException.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/ClientException.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/rest/ClientException.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/rest/ClientException.java diff --git a/src/main/java/com/baidu/hugegraph/rest/RestClient.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/RestClient.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/rest/RestClient.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/rest/RestClient.java diff --git a/src/main/java/com/baidu/hugegraph/rest/RestResult.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/RestResult.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/rest/RestResult.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/rest/RestResult.java diff --git a/src/main/java/com/baidu/hugegraph/rest/SerializeException.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/SerializeException.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/rest/SerializeException.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/rest/SerializeException.java diff --git a/src/main/java/com/baidu/hugegraph/testutil/Assert.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/testutil/Assert.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/testutil/Assert.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/testutil/Assert.java diff --git a/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/testutil/Whitebox.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java diff --git a/src/main/java/com/baidu/hugegraph/util/Bytes.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/Bytes.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/Bytes.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/Bytes.java diff --git a/src/main/java/com/baidu/hugegraph/util/CheckSocket.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/CheckSocket.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/CheckSocket.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/CheckSocket.java diff --git a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/CollectionUtil.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java diff --git a/src/main/java/com/baidu/hugegraph/util/DateUtil.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/DateUtil.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/DateUtil.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/DateUtil.java diff --git a/src/main/java/com/baidu/hugegraph/util/E.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/E.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/E.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/E.java diff --git a/src/main/java/com/baidu/hugegraph/util/ExecutorUtil.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/ExecutorUtil.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/ExecutorUtil.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/ExecutorUtil.java diff --git a/src/main/java/com/baidu/hugegraph/util/HashUtil.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/HashUtil.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/HashUtil.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/HashUtil.java diff --git a/src/main/java/com/baidu/hugegraph/util/InsertionOrderUtil.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/InsertionOrderUtil.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/InsertionOrderUtil.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/InsertionOrderUtil.java diff --git a/src/main/java/com/baidu/hugegraph/util/Log.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/Log.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/Log.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/Log.java diff --git a/src/main/java/com/baidu/hugegraph/util/LongEncoding.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/LongEncoding.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/LongEncoding.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/LongEncoding.java diff --git a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/NumericUtil.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/NumericUtil.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/NumericUtil.java diff --git a/src/main/java/com/baidu/hugegraph/util/OrderLimitMap.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/OrderLimitMap.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/OrderLimitMap.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/OrderLimitMap.java diff --git a/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java diff --git a/src/main/java/com/baidu/hugegraph/util/StringUtil.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/StringUtil.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/StringUtil.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/StringUtil.java diff --git a/src/main/java/com/baidu/hugegraph/util/TimeUtil.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/TimeUtil.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/TimeUtil.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/TimeUtil.java diff --git a/src/main/java/com/baidu/hugegraph/util/UnitUtil.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/UnitUtil.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/UnitUtil.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/UnitUtil.java diff --git a/src/main/java/com/baidu/hugegraph/util/VersionUtil.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/VersionUtil.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/VersionUtil.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/VersionUtil.java diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/version/CommonVersion.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/version/CommonVersion.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/version/CommonVersion.java diff --git a/src/test/java/com/baidu/hugegraph/testutil/AssertTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/testutil/AssertTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/testutil/AssertTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/testutil/AssertTest.java diff --git a/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java diff --git a/src/test/java/com/baidu/hugegraph/unit/concurrent/AtomicLockTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/AtomicLockTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/concurrent/AtomicLockTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/AtomicLockTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/concurrent/BarrierEventTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/BarrierEventTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/concurrent/BarrierEventTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/BarrierEventTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/concurrent/KeyLockTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/KeyLockTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/concurrent/KeyLockTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/KeyLockTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/concurrent/LockManagerTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/LockManagerTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/concurrent/LockManagerTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/LockManagerTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/config/OptionSpaceTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/OptionSpaceTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/config/OptionSpaceTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/OptionSpaceTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/config/test-check-error.conf b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/test-check-error.conf similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/config/test-check-error.conf rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/test-check-error.conf diff --git a/src/test/java/com/baidu/hugegraph/unit/config/test-list-error.conf b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/test-list-error.conf similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/config/test-list-error.conf rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/test-list-error.conf diff --git a/src/test/java/com/baidu/hugegraph/unit/config/test-type-error.conf b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/test-type-error.conf similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/config/test-type-error.conf rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/test-type-error.conf diff --git a/src/test/java/com/baidu/hugegraph/unit/config/test.conf b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/test.conf similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/config/test.conf rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/test.conf diff --git a/src/test/java/com/baidu/hugegraph/unit/date/SafeDateFormatTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/date/SafeDateFormatTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/date/SafeDateFormatTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/date/SafeDateFormatTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/event/EventHubTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/event/EventHubTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/event/EventHubTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/event/EventHubTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/BatchMapperIteratorTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/BatchMapperIteratorTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/iterator/BatchMapperIteratorTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/BatchMapperIteratorTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/ExtendableIteratorTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/ExtendableIteratorTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/iterator/ExtendableIteratorTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/ExtendableIteratorTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/FilterIteratorTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/FilterIteratorTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/iterator/FilterIteratorTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/FilterIteratorTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperIteratorTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperIteratorTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperIteratorTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperIteratorTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/LimitIteratorTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/LimitIteratorTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/iterator/LimitIteratorTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/LimitIteratorTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/ListIteratorTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/ListIteratorTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/iterator/ListIteratorTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/ListIteratorTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/MapperIteratorTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/MapperIteratorTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/iterator/MapperIteratorTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/MapperIteratorTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/license/ExtraParamTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/ExtraParamTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/license/ExtraParamTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/ExtraParamTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/license/LicenseManagerTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseManagerTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/license/LicenseManagerTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseManagerTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/license/LicenseVerifyParamTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseVerifyParamTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/license/LicenseVerifyParamTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseVerifyParamTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/license/MachineInfoTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/MachineInfoTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/license/MachineInfoTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/MachineInfoTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/perf/PerfUtilTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/PerfUtilTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/perf/PerfUtilTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/PerfUtilTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/perf/StopwatchTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/StopwatchTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/perf/StopwatchTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/StopwatchTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestClass.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestClass.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestClass.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestClass.java diff --git a/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestLightClass.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestLightClass.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestLightClass.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestLightClass.java diff --git a/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfClass.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfClass.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfClass.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfClass.java diff --git a/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfLightClass.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfLightClass.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfLightClass.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfLightClass.java diff --git a/src/test/java/com/baidu/hugegraph/unit/perf/testclass2/TestClass4Package.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass2/TestClass4Package.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/perf/testclass2/TestClass4Package.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass2/TestClass4Package.java diff --git a/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/rest/RestResultTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/rest/RestResultTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/rest/RestResultTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/rest/RestResultTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/BytesTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/BytesTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/BytesTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/BytesTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/DateUtilTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/DateUtilTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/DateUtilTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/DateUtilTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/EcheckTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/EcheckTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/EcheckTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/EcheckTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/HashUtilTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/HashUtilTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/HashUtilTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/HashUtilTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/InsertionOrderUtilTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/InsertionOrderUtilTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/InsertionOrderUtilTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/InsertionOrderUtilTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/LogTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/LogTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/LogTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/LogTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/LongEncodingTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/LongEncodingTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/LongEncodingTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/LongEncodingTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/OrderLimitMapTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/OrderLimitMapTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/OrderLimitMapTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/OrderLimitMapTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/StringUtilTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/StringUtilTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/StringUtilTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/StringUtilTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/TimeUtilTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/TimeUtilTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/TimeUtilTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/TimeUtilTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/UnitUtilTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/UnitUtilTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/UnitUtilTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/UnitUtilTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/version/VersionTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/version/VersionTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/version/VersionTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/version/VersionTest.java diff --git a/src/test/resources/META-INF/MANIFEST.MF b/hugegraph-common/src/test/resources/META-INF/MANIFEST.MF similarity index 100% rename from src/test/resources/META-INF/MANIFEST.MF rename to hugegraph-common/src/test/resources/META-INF/MANIFEST.MF diff --git a/src/test/resources/cacerts.jks b/hugegraph-common/src/test/resources/cacerts.jks similarity index 100% rename from src/test/resources/cacerts.jks rename to hugegraph-common/src/test/resources/cacerts.jks diff --git a/src/test/resources/create-license.json b/hugegraph-common/src/test/resources/create-license.json similarity index 100% rename from src/test/resources/create-license.json rename to hugegraph-common/src/test/resources/create-license.json diff --git a/src/test/resources/log4j2.xml b/hugegraph-common/src/test/resources/log4j2.xml similarity index 100% rename from src/test/resources/log4j2.xml rename to hugegraph-common/src/test/resources/log4j2.xml diff --git a/src/test/resources/privateKeys.store b/hugegraph-common/src/test/resources/privateKeys.store similarity index 100% rename from src/test/resources/privateKeys.store rename to hugegraph-common/src/test/resources/privateKeys.store diff --git a/src/test/resources/publicCerts.store b/hugegraph-common/src/test/resources/publicCerts.store similarity index 100% rename from src/test/resources/publicCerts.store rename to hugegraph-common/src/test/resources/publicCerts.store diff --git a/src/test/resources/verify-license.json b/hugegraph-common/src/test/resources/verify-license.json similarity index 100% rename from src/test/resources/verify-license.json rename to hugegraph-common/src/test/resources/verify-license.json From 24c3390379a284d1da9fc291645d35b9e107810c Mon Sep 17 00:00:00 2001 From: imbajin Date: Wed, 1 Dec 2021 20:38:09 +0800 Subject: [PATCH 155/217] chore: merge license & checkstyle & ci 1. root pom.xml, license, checkstyle, ci, --- .github/ISSUE_TEMPLATE/bug_report.yml | 4 +- .github/ISSUE_TEMPLATE/question_ask.yml | 4 +- .travis.yml => .github/outdated/.travis.yml | 0 .github/workflows/ci.yml | 2 +- .github/workflows/stale.yml | 8 +- LICENSE | 202 ++++++++++++++++++++ checkstyle.xml | 89 +++++++++ hugegraph-common/BCLOUD | 1 - 8 files changed, 301 insertions(+), 9 deletions(-) rename .travis.yml => .github/outdated/.travis.yml (100%) create mode 100644 LICENSE create mode 100644 checkstyle.xml delete mode 100644 hugegraph-common/BCLOUD diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 780d51efd9..8445d0a52c 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -11,7 +11,7 @@ body: ### Note (特别注意) : > 1. 请先**搜索**现有的[Server-Issues](https://github.com/hugegraph/hugegraph/issues) 与 - [Common-Issues](https://github.com/hugegraph/hugegraph-common/issues) 中没有与您相同 + [Commons-Issues](https://github.com/hugegraph/hugegraph-commons/issues) 中没有与您相同 / 相关的问题 (请勿重复提交) > 2. 我们需要尽可能**详细**的信息来**复现**问题, 越详细的信息 (包括**日志 / 截图 / 配置**等) @@ -35,7 +35,7 @@ body: attributes: label: Before submit options: - - label: 我已经确认现有的 [Server-Issues](https://github.com/hugegraph/hugegraph/issues) 与 [Common-Issues](https://github.com/hugegraph/hugegraph-common/issues) 中没有相同 / 重复问题 + - label: 我已经确认现有的 [Server-Issues](https://github.com/hugegraph/hugegraph/issues) 与 [Commons-Issues](https://github.com/hugegraph/hugegraph-commons/issues) 中没有相同 / 重复问题 required: true - type: textarea diff --git a/.github/ISSUE_TEMPLATE/question_ask.yml b/.github/ISSUE_TEMPLATE/question_ask.yml index 6a57883ee2..9724e66c47 100644 --- a/.github/ISSUE_TEMPLATE/question_ask.yml +++ b/.github/ISSUE_TEMPLATE/question_ask.yml @@ -9,7 +9,7 @@ body: ### Note (特别注意) : > 1. 请先**搜索**现有的[Server-Issues](https://github.com/hugegraph/hugegraph/issues) 与 - [Common-Issues](https://github.com/hugegraph/hugegraph-common/issues) 中没有与您相同 + [Commons-Issues](https://github.com/hugegraph/hugegraph-commons/issues) 中没有与您相同 / 相关的问题 (请勿重复提交) > 2. 我们需要尽可能**详细**的信息来**复现**问题, 越详细的信息 (包括**日志 / 截图 / 配置**等) @@ -33,7 +33,7 @@ body: attributes: label: Before submit options: - - label: 我已经确认现有的 [Server-Issues](https://github.com/hugegraph/hugegraph/issues) 与 [Common-Issues](https://github.com/hugegraph/hugegraph-common/issues) 中没有相同 / 重复问题 + - label: 我已经确认现有的 [Server-Issues](https://github.com/hugegraph/hugegraph/issues) 与 [Commons-Issues](https://github.com/hugegraph/hugegraph-commons/issues) 中没有相同 / 重复问题 required: true - type: textarea diff --git a/.travis.yml b/.github/outdated/.travis.yml similarity index 100% rename from .travis.yml rename to .github/outdated/.travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5dda16800a..a09093a164 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: hugegraph-common ci +name: hugegraph-commons ci on: push: diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 1813bd3cb2..5829cb61a9 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -20,17 +20,19 @@ jobs: stale-pr-message: 'Due to the lack of activity, the current pr is marked as stale and will be closed after 180 days, any update will remove the stale label' stale-issue-label: 'inactive' stale-pr-label: 'inactive' - exempt-issue-labels: 'feature,bug,enhancement,improvement,wontfix,todo' + exempt-issue-labels: 'feature,bug,enhancement,improvement,wontfix,todo,help wanted' + exempt-pr-labels: 'feature,bug,enhancement,improvement,wontfix,todo,help wanted' + exempt-all-milestones: true days-before-issue-stale: 15 days-before-issue-close: 20 days-before-pr-stale: 30 days-before-pr-close: 180 operations-per-run: 10 - start-date: '2018-12-01T00:00:00Z' + start-date: '2018-10-01T00:00:00Z' exempt-all-assignees: true remove-stale-when-updated: true exempt-all-pr-milestones: true delete-branch: false - enable-statistics: true + enable-statistics: true \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000..e06d208186 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed 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. + diff --git a/checkstyle.xml b/checkstyle.xml new file mode 100644 index 0000000000..9373a70d91 --- /dev/null +++ b/checkstyle.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hugegraph-common/BCLOUD b/hugegraph-common/BCLOUD deleted file mode 100644 index df3f342be8..0000000000 --- a/hugegraph-common/BCLOUD +++ /dev/null @@ -1 +0,0 @@ -BUILD_SUBMITTER -x -u ./ -e CENTOS6U3 -m baidu/xbu-data/hugegraph-common -c "export MAVEN_HOME=/home/scmtools/buildkit/maven/apache-maven-3.3.9/ && export JAVA_HOME=/home/scmtools/buildkit/java/jdk1.8.0_25/ && export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH && cd baidu/xbu-data/hugegraph-common && mkdir output && sh build.sh" -o output \ No newline at end of file From ee087121208ba1f80d3ae4bd5c3a3fd7674aa147 Mon Sep 17 00:00:00 2001 From: imbajin Date: Wed, 1 Dec 2021 20:40:26 +0800 Subject: [PATCH 156/217] chore: new pom & README for module --- .github/workflows/stale.yml | 2 +- README.md | 23 ++++ hugegraph-common/pom.xml | 66 ++--------- hugegraph-rpc/pom.xml | 40 ++----- pom.xml | 219 ++++++++++++++++++++++++++++++++++++ 5 files changed, 261 insertions(+), 89 deletions(-) create mode 100644 README.md create mode 100644 pom.xml diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 5829cb61a9..93e1bd1c5e 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -35,4 +35,4 @@ jobs: remove-stale-when-updated: true exempt-all-pr-milestones: true delete-branch: false - enable-statistics: true \ No newline at end of file + enable-statistics: true diff --git a/README.md b/README.md new file mode 100644 index 0000000000..3d669ebad8 --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +# hugegraph-commons + +[![License](https://img.shields.io/badge/license-Apache%202-0E78BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) +[![codecov](https://codecov.io/gh/hugegraph/hugegraph-common/branch/master/graph/badge.svg)](https://codecov.io/gh/hugegraph/hugegraph-common) +[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.baidu.hugegraph/hugegraph-common/badge.svg)](https://mvnrepository.com/artifact/com.baidu.hugegraph/hugegraph-common) + +hugegraph-commons is a common module for [HugeGraph](https://github.com/hugegraph/hugegraph) and its peripheral components. +hugegraph-commons encapsulates locks, configurations, events, iterators, rest and some +numeric or collection util classes to simplify the development of HugeGraph and +its components. + +## Components + +- Lock: atomic lock, key lock, lock group and lock manger +- Config: register and load config option with security check +- Event: listening and notification, do something asynchronously +- Iterator: some iterators with extra functions, map, filter, extend etc. +- Rest: RESTful client implemented on Jersey, POST, PUT, GET and DELETE +- Util: performance analyzer, version checker, numeric and Collection utils, log and exception utils etc. +- Rpc: rpc component for inner module communication, currently it's based on [Sofa-RPC](https://github.com/sofastack/sofa-rpc) + +## Licence +The same as HugeGraph, hugegraph-commons is also licensed under Apache 2.0 License. diff --git a/hugegraph-common/pom.xml b/hugegraph-common/pom.xml index 7b9e61c712..4b355920d6 100644 --- a/hugegraph-common/pom.xml +++ b/hugegraph-common/pom.xml @@ -3,11 +3,14 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + + com.baidu.hugegraph + hugegraph-commons + 1.8.10 + ../pom.xml + - com.baidu.hugegraph hugegraph-common - 1.8.10 - hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -16,61 +19,8 @@ numeric or collection util classes to simplify the development of HugeGraph and its components. - - org.sonatype.oss - oss-parent - 7 - - - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - - https://github.com/hugegraph/hugegraph-common - https://github.com/hugegraph/hugegraph-common - https://github.com/hugegraph/hugegraph-common - - - - - lizhangmei - javaloveme@gmail.com - - - zhoney - zhangyi89817@126.com - - - liningrui - liningrui@vip.qq.com - - - - UTF-8 - ${project.basedir}/.. - 1.8 - 1.8 - 2.13.3 - 1.10 - 2.1.1 - 3.2.2 - 2.7 - 1.11 - 25.1-jre - 1.0 - 3.0.1 - 3.21.0-GA - 2.22 - 2.27 - 2.12.1 - 4.12 - 2.25.1 + @@ -311,7 +261,7 @@ report - ${project.build.directory} + ${project.parent.build.directory} diff --git a/hugegraph-rpc/pom.xml b/hugegraph-rpc/pom.xml index f650d64406..b06fc89b6e 100644 --- a/hugegraph-rpc/pom.xml +++ b/hugegraph-rpc/pom.xml @@ -3,42 +3,21 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + + com.baidu.hugegraph + hugegraph-commons + 1.8.10 + ../pom.xml + - com.baidu.hugegraph hugegraph-rpc 1.0.1 hugegraph-rpc - https://github.com/hugegraph/hugegraph-rpc - - HugeGraph Database RPC component - - - - org.sonatype.oss - oss-parent - 7 - - - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - - https://github.com/hugegraph/hugegraph-rpc - https://github.com/hugegraph/hugegraph-rpc - https://github.com/hugegraph/hugegraph-rpc - + HugeGraph Database RPC component - UTF-8 - ${project.basedir}/.. - 1.8 - 1.8 + @@ -46,6 +25,7 @@ com.baidu.hugegraph hugegraph-common + 1.8.5 @@ -189,7 +169,7 @@ report - ${project.build.directory} + ${project.parent.build.directory} diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000000..771e80737e --- /dev/null +++ b/pom.xml @@ -0,0 +1,219 @@ + + + 4.0.0 + + com.baidu.hugegraph + hugegraph-commons + 1.8.10 + pom + + hugegraph-commons + https://github.com/hugegraph/hugegraph-commons + + hugegraph-commons is a common module for HugeGraph-Common and HugeGraph-Rpc with their peripheral components. + It includes rpc frame, locks, configurations, events, iterators, rest and some + numeric or collection util classes to simplify the development of HugeGraph and its components. + + + + org.sonatype.oss + oss-parent + 7 + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + https://github.com/hugegraph/hugegraph-commons + https://github.com/hugegraph/hugegraph-commons + https://github.com/hugegraph/hugegraph-commons + + + + + lizhangmei + javaloveme@gmail.com + + + zhoney + zhangyi89817@126.com + + + liningrui + liningrui@vip.qq.com + + + + + UTF-8 + ${project.basedir}/.. + 1.8 + 1.8 + 2.13.3 + 1.10 + 2.1.1 + 3.2.2 + 2.7 + 1.11 + 25.1-jre + 1.0 + 3.0.1 + 3.21.0-GA + 2.22 + 2.27 + 2.12.1 + 4.12 + 2.25.1 + + + + hugegraph-common + hugegraph-rpc + + + + + + maven-compiler-plugin + 3.1 + + ${compiler.source} + ${compiler.target} + + 500 + + + -Xlint:unchecked + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.1.0 + + checkstyle.xml + UTF-8 + true + true + false + false + + + + validate + validate + + check + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.6 + + + true + + + false + + + true + + + + + 1.8.9.0 + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.2 + + + pre-unit-test + + prepare-agent + + + + post-unit-test + test + + report + + + ${project.build.directory} + + + + + + + + + + release + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9.1 + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + + + + From 3b8933c3d3832db49a824341c912f8d1346983a1 Mon Sep 17 00:00:00 2001 From: zhoney Date: Wed, 15 Dec 2021 20:30:27 +0800 Subject: [PATCH 157/217] fix log4j error (#85) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 771e80737e..7a9623a8b6 100644 --- a/pom.xml +++ b/pom.xml @@ -57,7 +57,7 @@ ${project.basedir}/.. 1.8 1.8 - 2.13.3 + 2.16.0 1.10 2.1.1 3.2.2 From fbb743afeb7e9ec48e673e34fac938e019d00edd Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Fri, 17 Dec 2021 10:57:40 +0800 Subject: [PATCH 158/217] bump up version to 2.0.0 (#86) * refactor license module Change-Id: Ia4041f88994490c1bc0519e0f8ff01d27577bafb --- hugegraph-common/pom.xml | 10 +- .../license/CommonLicenseManager.java | 130 -------- .../hugegraph/license/FileKeyStoreParam.java | 68 ---- .../hugegraph/license/LicenseCommonParam.java | 108 +++++++ .../hugegraph/license/LicenseCreateParam.java | 67 +--- ...ExtraParam.java => LicenseExtraParam.java} | 4 +- ...ifyParam.java => LicenseInstallParam.java} | 2 +- .../hugegraph/license/LicenseManager.java | 34 ++ .../license/LicenseManagerFactory.java | 32 ++ .../hugegraph/license/LicenseParams.java | 47 +++ .../hugegraph/version/CommonVersion.java | 2 +- .../baidu/hugegraph/unit/UnitTestSuite.java | 8 +- .../unit/license/ExtraParamTest.java | 4 +- .../unit/license/LicenseCreateParamTest.java | 2 +- ...Test.java => LicenseInstallParamTest.java} | 8 +- .../unit/license/LicenseManagerTest.java | 305 ------------------ .../unit/license/LicenseParamsTest.java | 88 +++++ hugegraph-rpc/pom.xml | 9 +- .../baidu/hugegraph/version/RpcVersion.java | 2 +- pom.xml | 4 +- 20 files changed, 335 insertions(+), 599 deletions(-) delete mode 100644 hugegraph-common/src/main/java/com/baidu/hugegraph/license/CommonLicenseManager.java delete mode 100755 hugegraph-common/src/main/java/com/baidu/hugegraph/license/FileKeyStoreParam.java create mode 100644 hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseCommonParam.java rename hugegraph-common/src/main/java/com/baidu/hugegraph/license/{ExtraParam.java => LicenseExtraParam.java} (96%) rename hugegraph-common/src/main/java/com/baidu/hugegraph/license/{LicenseVerifyParam.java => LicenseInstallParam.java} (98%) create mode 100644 hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseManager.java create mode 100644 hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseManagerFactory.java create mode 100644 hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseParams.java rename hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/{LicenseVerifyParamTest.java => LicenseInstallParamTest.java} (89%) delete mode 100644 hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseManagerTest.java create mode 100644 hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseParamsTest.java diff --git a/hugegraph-common/pom.xml b/hugegraph-common/pom.xml index 4b355920d6..0ddd612bc9 100644 --- a/hugegraph-common/pom.xml +++ b/hugegraph-common/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-commons - 1.8.10 + 2.0.0 ../pom.xml @@ -173,12 +173,6 @@ jersey-hk2 ${jersey.hk2.version} - - - de.schlichtherle.truelicense - truelicense-core - 1.33 - @@ -237,7 +231,7 @@ - 1.8.9.0 + 2.0.0.0 diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/CommonLicenseManager.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/CommonLicenseManager.java deleted file mode 100644 index ede39d0764..0000000000 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/CommonLicenseManager.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright 2017 HugeGraph Authors - * - * 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 com.baidu.hugegraph.license; - -import java.beans.XMLDecoder; -import java.io.BufferedInputStream; -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; - -import org.slf4j.Logger; - -import com.baidu.hugegraph.util.Log; - -import de.schlichtherle.license.LicenseContent; -import de.schlichtherle.license.LicenseContentException; -import de.schlichtherle.license.LicenseManager; -import de.schlichtherle.license.LicenseNotary; -import de.schlichtherle.license.LicenseParam; -import de.schlichtherle.license.NoLicenseInstalledException; -import de.schlichtherle.xml.GenericCertificate; - -public class CommonLicenseManager extends LicenseManager { - - private static final Logger LOG = Log.logger(CommonLicenseManager.class); - - private static final String CHARSET = "UTF-8"; - private static final int BUF_SIZE = 8 * 1024; - - public CommonLicenseManager(LicenseParam param) { - super(param); - } - - @Override - protected synchronized byte[] create(LicenseContent content, - LicenseNotary notary) - throws Exception { - super.initialize(content); - this.validateCreate(content); - GenericCertificate certificate = notary.sign(content); - return super.getPrivacyGuard().cert2key(certificate); - } - - @Override - protected synchronized LicenseContent install(byte[] key, - LicenseNotary notary) - throws Exception { - GenericCertificate certificate = super.getPrivacyGuard().key2cert(key); - notary.verify(certificate); - String encodedText = certificate.getEncoded(); - LicenseContent content = (LicenseContent) this.load(encodedText); - this.validate(content); - super.setLicenseKey(key); - super.setCertificate(certificate); - return content; - } - - @Override - protected synchronized LicenseContent verify(LicenseNotary notary) - throws Exception { - // Load license key from preferences - byte[] key = super.getLicenseKey(); - if (key == null) { - String subject = super.getLicenseParam().getSubject(); - throw new NoLicenseInstalledException(subject); - } - - GenericCertificate certificate = super.getPrivacyGuard().key2cert(key); - notary.verify(certificate); - String encodedText = certificate.getEncoded(); - LicenseContent content = (LicenseContent) this.load(encodedText); - this.validate(content); - super.setCertificate(certificate); - return content; - } - - @Override - protected synchronized void validate(LicenseContent content) - throws LicenseContentException { - // Call super validate, expected to be overwritten - super.validate(content); - } - - protected synchronized void validateCreate(LicenseContent content) - throws LicenseContentException { - // Just call super validate is ok - super.validate(content); - } - - private Object load(String text) throws Exception { - InputStream bis = null; - XMLDecoder decoder = null; - try { - bis = new ByteArrayInputStream(text.getBytes(CHARSET)); - decoder = new XMLDecoder(new BufferedInputStream(bis, BUF_SIZE)); - return decoder.readObject(); - } catch (UnsupportedEncodingException e) { - throw new LicenseContentException(String.format( - "Unsupported charset: %s", CHARSET)); - } finally { - if (decoder != null) { - decoder.close(); - } - try { - if (bis != null) { - bis.close(); - } - } catch (Exception e) { - LOG.warn("Failed to close stream", e); - } - } - } -} diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/FileKeyStoreParam.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/FileKeyStoreParam.java deleted file mode 100755 index 4065513e7d..0000000000 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/FileKeyStoreParam.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2017 HugeGraph Authors - * - * 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 com.baidu.hugegraph.license; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; - -import de.schlichtherle.license.AbstractKeyStoreParam; - -/** - * Custom KeyStoreParam to store public and private key storage files to - * other disk locations instead of projects - */ -public class FileKeyStoreParam extends AbstractKeyStoreParam { - - private String storePath; - private String alias; - private String keyPwd; - private String storePwd; - - public FileKeyStoreParam(Class clazz, String resource, String alias, - String storePwd, String keyPwd) { - super(clazz, resource); - this.storePath = resource; - this.alias = alias; - this.storePwd = storePwd; - this.keyPwd = keyPwd; - } - - @Override - public String getAlias() { - return this.alias; - } - - @Override - public String getStorePwd() { - return this.storePwd; - } - - @Override - public String getKeyPwd() { - return this.keyPwd; - } - - @Override - public InputStream getStream() throws IOException { - return new FileInputStream(new File(this.storePath)); - } -} diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseCommonParam.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseCommonParam.java new file mode 100644 index 0000000000..2d1f45c612 --- /dev/null +++ b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseCommonParam.java @@ -0,0 +1,108 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.license; + +import java.util.Date; +import java.util.List; + +import org.apache.commons.lang3.time.DateUtils; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class LicenseCommonParam { + + @JsonProperty("subject") + private String subject; + + @JsonProperty("issued_time") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date issuedTime = new Date(); + + @JsonProperty("not_before") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date notBefore = this.issuedTime; + + @JsonProperty("not_after") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date notAfter = DateUtils.addDays(this.notBefore, 30); + + @JsonProperty("consumer_type") + private String consumerType = "user"; + + @JsonProperty("consumer_amount") + private Integer consumerAmount = 1; + + @JsonProperty("description") + private String description = ""; + + @JsonProperty("extra_params") + private List extraParams; + + public LicenseCommonParam() { + // pass + } + + public LicenseCommonParam(String subject, String description, + Date issued, Date notBefore, Date notAfter, + String consumerType, int consumerAmount, + List extraParams) { + this.subject = subject; + this.description = description; + this.issuedTime = issued; + this.notBefore = notBefore; + this.notAfter = notAfter; + this.consumerType = consumerType; + this.consumerAmount = consumerAmount; + this.extraParams = extraParams; + } + + public String subject() { + return this.subject; + } + + public Date issuedTime() { + return this.issuedTime; + } + + public Date notBefore() { + return this.notBefore; + } + + public Date notAfter() { + return this.notAfter; + } + + public String consumerType() { + return this.consumerType; + } + + public Integer consumerAmount() { + return this.consumerAmount; + } + + public String description() { + return this.description; + } + + public List extraParams() { + return this.extraParams; + } +} diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseCreateParam.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseCreateParam.java index cd7c504d23..7cf69f8380 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseCreateParam.java +++ b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseCreateParam.java @@ -19,19 +19,10 @@ package com.baidu.hugegraph.license; -import java.util.Date; -import java.util.List; - -import org.apache.commons.lang3.time.DateUtils; - import com.fasterxml.jackson.annotation.JsonAlias; -import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonProperty; -public class LicenseCreateParam { - - @JsonProperty("subject") - private String subject; +public class LicenseCreateParam extends LicenseCommonParam { @JsonProperty("private_alias") private String privateAlias; @@ -50,34 +41,6 @@ public class LicenseCreateParam { @JsonProperty("license_path") private String licensePath; - @JsonProperty("issued_time") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - private Date issuedTime = new Date(); - - @JsonProperty("not_before") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - private Date notBefore = this.issuedTime; - - @JsonProperty("not_after") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - private Date notAfter = DateUtils.addDays(this.notBefore, 30); - - @JsonProperty("consumer_type") - private String consumerType = "user"; - - @JsonProperty("consumer_amount") - private Integer consumerAmount = 1; - - @JsonProperty("description") - private String description = ""; - - @JsonProperty("extra_params") - private List extraParams; - - public String subject() { - return this.subject; - } - public String privateAlias() { return this.privateAlias; } @@ -97,32 +60,4 @@ public String privateKeyPath() { public String licensePath() { return this.licensePath; } - - public Date issuedTime() { - return this.issuedTime; - } - - public Date notBefore() { - return this.notBefore; - } - - public Date notAfter() { - return this.notAfter; - } - - public String consumerType() { - return this.consumerType; - } - - public Integer consumerAmount() { - return this.consumerAmount; - } - - public String description() { - return this.description; - } - - public List extraParams() { - return this.extraParams; - } } diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/ExtraParam.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseExtraParam.java similarity index 96% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/license/ExtraParam.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseExtraParam.java index ebd2f949f8..0c3337f1ad 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/ExtraParam.java +++ b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseExtraParam.java @@ -21,7 +21,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; -public class ExtraParam { +public class LicenseExtraParam { + + public static final int NO_LIMIT = -1; @JsonProperty("id") private String id; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseVerifyParam.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseInstallParam.java similarity index 98% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseVerifyParam.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseInstallParam.java index 97c200f51e..4a5237bd7c 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseVerifyParam.java +++ b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseInstallParam.java @@ -22,7 +22,7 @@ import com.fasterxml.jackson.annotation.JsonAlias; import com.fasterxml.jackson.annotation.JsonProperty; -public class LicenseVerifyParam { +public class LicenseInstallParam { @JsonProperty("subject") private String subject; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseManager.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseManager.java new file mode 100644 index 0000000000..892919c80c --- /dev/null +++ b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseManager.java @@ -0,0 +1,34 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.license; + +public interface LicenseManager { + + public LicenseParams installLicense() throws Exception; + + public void uninstallLicense() throws Exception; + + public LicenseParams verifyLicense() throws Exception; + + public interface VerifyCallback { + + public void onVerifyLicense(LicenseParams params) throws Exception; + } +} diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseManagerFactory.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseManagerFactory.java new file mode 100644 index 0000000000..cf38c773e5 --- /dev/null +++ b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseManagerFactory.java @@ -0,0 +1,32 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.license; + +import org.apache.commons.lang.NotImplementedException; + +import com.baidu.hugegraph.license.LicenseManager.VerifyCallback; + +public class LicenseManagerFactory { + + public static LicenseManager create(LicenseInstallParam param, + VerifyCallback veryfyCallback) { + throw new NotImplementedException("No LicenseManager available"); + } +} diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseParams.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseParams.java new file mode 100644 index 0000000000..dad9cf7cb9 --- /dev/null +++ b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseParams.java @@ -0,0 +1,47 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.license; + +import java.util.Date; +import java.util.List; + +public class LicenseParams extends LicenseCommonParam { + + public LicenseParams() { + super(); + } + + public LicenseParams(String subject, String description, + Date issued, Date notBefore, Date notAfter, + String consumerType, int consumerAmount, + List extraParams) { + super(subject, description, issued, notBefore, notAfter, + consumerType, consumerAmount, extraParams); + } + + public LicenseExtraParam matchParam(String id) { + for (LicenseExtraParam param : this.extraParams()) { + if (param.id().equals(id)) { + return param; + } + } + return null; + } +} diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 81a9756d03..ac91e09d16 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/hugegraph-common/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "1.8.10"); + "2.0.0"); } diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java index e9e0732f89..b823a56e32 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java +++ b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -45,8 +45,8 @@ import com.baidu.hugegraph.unit.iterator.MapperIteratorTest; import com.baidu.hugegraph.unit.license.ExtraParamTest; import com.baidu.hugegraph.unit.license.LicenseCreateParamTest; -import com.baidu.hugegraph.unit.license.LicenseManagerTest; -import com.baidu.hugegraph.unit.license.LicenseVerifyParamTest; +import com.baidu.hugegraph.unit.license.LicenseInstallParamTest; +import com.baidu.hugegraph.unit.license.LicenseParamsTest; import com.baidu.hugegraph.unit.license.MachineInfoTest; import com.baidu.hugegraph.unit.perf.PerfUtilTest; import com.baidu.hugegraph.unit.perf.StopwatchTest; @@ -116,9 +116,9 @@ ExtraParamTest.class, LicenseCreateParamTest.class, - LicenseVerifyParamTest.class, + LicenseInstallParamTest.class, + LicenseParamsTest.class, MachineInfoTest.class, - LicenseManagerTest.class, AssertTest.class, WhiteboxTest.class diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/ExtraParamTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/ExtraParamTest.java index 9655019484..8b79e04f13 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/ExtraParamTest.java +++ b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/ExtraParamTest.java @@ -23,7 +23,7 @@ import org.junit.Test; -import com.baidu.hugegraph.license.ExtraParam; +import com.baidu.hugegraph.license.LicenseExtraParam; import com.baidu.hugegraph.testutil.Assert; import com.fasterxml.jackson.databind.ObjectMapper; @@ -47,7 +47,7 @@ public void testDeserializeExtraParam() throws IOException { + "\"edges\":2000" + "}"; ObjectMapper mapper = new ObjectMapper(); - ExtraParam param = mapper.readValue(json, ExtraParam.class); + LicenseExtraParam param = mapper.readValue(json, LicenseExtraParam.class); Assert.assertEquals("server-1", param.id()); Assert.assertEquals("0.10.2", param.version()); Assert.assertEquals(3, param.graphs()); diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java index fb5a16fc6c..cb67ce91f4 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java +++ b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java @@ -33,7 +33,7 @@ public class LicenseCreateParamTest { @Test public void testDeserializeLicenseCreateParam() - throws IOException, ParseException { + throws IOException, ParseException { String json = "{" + "\"subject\":\"hugegraph-evaluation\"," + "\"private_alias\":\"privatekey\"," diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseVerifyParamTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseInstallParamTest.java similarity index 89% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseVerifyParamTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseInstallParamTest.java index 5172f7df91..8fc360421c 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseVerifyParamTest.java +++ b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseInstallParamTest.java @@ -23,11 +23,11 @@ import org.junit.Test; -import com.baidu.hugegraph.license.LicenseVerifyParam; +import com.baidu.hugegraph.license.LicenseInstallParam; import com.baidu.hugegraph.testutil.Assert; import com.fasterxml.jackson.databind.ObjectMapper; -public class LicenseVerifyParamTest { +public class LicenseInstallParamTest { @Test public void testDeserializeLicenseVerifyParam() throws IOException { @@ -39,8 +39,8 @@ public void testDeserializeLicenseVerifyParam() throws IOException { + "\"license_path\":\"./hugegraph-evaluation.license\"" + "}"; ObjectMapper mapper = new ObjectMapper(); - LicenseVerifyParam param = mapper.readValue(json, - LicenseVerifyParam.class); + LicenseInstallParam param = mapper.readValue(json, + LicenseInstallParam.class); Assert.assertEquals("hugegraph-evaluation", param.subject()); Assert.assertEquals("publiccert", param.publicAlias()); Assert.assertEquals("a123456", param.storePassword()); diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseManagerTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseManagerTest.java deleted file mode 100644 index 555d66527a..0000000000 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseManagerTest.java +++ /dev/null @@ -1,305 +0,0 @@ -/* - * Copyright 2017 HugeGraph Authors - * - * 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 com.baidu.hugegraph.unit.license; - -import java.io.File; -import java.io.IOException; -import java.nio.charset.Charset; -import java.util.List; -import java.util.prefs.Preferences; - -import javax.security.auth.x500.X500Principal; - -import org.apache.commons.codec.Charsets; -import org.apache.commons.io.FileUtils; -import org.junit.After; -import org.junit.Test; - -import com.baidu.hugegraph.license.CommonLicenseManager; -import com.baidu.hugegraph.license.ExtraParam; -import com.baidu.hugegraph.license.FileKeyStoreParam; -import com.baidu.hugegraph.license.LicenseCreateParam; -import com.baidu.hugegraph.license.LicenseVerifyParam; -import com.baidu.hugegraph.testutil.Assert; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; - -import de.schlichtherle.license.CipherParam; -import de.schlichtherle.license.DefaultCipherParam; -import de.schlichtherle.license.DefaultLicenseParam; -import de.schlichtherle.license.KeyStoreParam; -import de.schlichtherle.license.LicenseContent; -import de.schlichtherle.license.LicenseContentException; -import de.schlichtherle.license.LicenseManager; -import de.schlichtherle.license.LicenseParam; -import de.schlichtherle.license.NoLicenseInstalledException; - -public class LicenseManagerTest { - - private static final Charset CHARSET = Charsets.UTF_8; - private static final ObjectMapper MAPPER = new ObjectMapper(); - - @After - public void teardown() throws IOException { - File lic = new File("src/test/resources/hugegraph-evaluation.license"); - FileUtils.forceDelete(lic); - } - - @Test - public void testCreateInstallVerifyLicense() throws IOException { - String createConfigPath = "src/test/resources/create-license.json"; - LicenseCreator creator = LicenseCreator.build(createConfigPath); - creator.create(); - - String verifyConfigPath = "src/test/resources/verify-license.json"; - LicenseVerifier verifier = LicenseVerifier.build(verifyConfigPath); - verifier.install(); - verifier.verify(); - } - - @Test - public void testCreateVerifyLicenseWithoutInstall() throws IOException { - String createConfigPath = "src/test/resources/create-license.json"; - LicenseCreator creator = LicenseCreator.build(createConfigPath); - creator.create(); - - String verifyConfigPath = "src/test/resources/verify-license.json"; - LicenseVerifier verifier = LicenseVerifier.build(verifyConfigPath); - verifier.uninstall(); - Assert.assertThrows(RuntimeException.class, () -> { - verifier.verify(); - }, e -> { - Assert.assertEquals(NoLicenseInstalledException.class, - e.getCause().getClass()); - }); - } - - private static class LicenseCreator { - - private static final X500Principal DEFAULT_ISSUER = new X500Principal( - "CN=localhost, OU=localhost, O=localhost, L=SH, ST=SH, C=CN"); - - private final LicenseCreateParam param; - - public LicenseCreator(LicenseCreateParam param) { - this.param = param; - } - - public static LicenseCreator build(String path) throws IOException { - File file = FileUtils.getFile(path); - String json; - try { - json = FileUtils.readFileToString(file, CHARSET); - } catch (IOException e) { - throw new RuntimeException(String.format( - "Failed to read file '%s'", path)); - } - LicenseCreateParam param = MAPPER.readValue( - json, LicenseCreateParam.class); - return new LicenseCreator(param); - } - - public void create(){ - try { - LicenseParam licenseParam = this.initLicenseParam(); - LicenseManager manager = new LicenseCreateManager(licenseParam); - LicenseContent licenseContent = this.initLicenseContent(); - File licenseFile = new File(this.param.licensePath()); - manager.store(licenseContent, licenseFile); - } catch (Exception e){ - throw new RuntimeException("Generate license failed", e); - } - } - - private LicenseParam initLicenseParam(){ - Preferences preferences = Preferences.userNodeForPackage( - LicenseCreator.class); - CipherParam cipherParam = new DefaultCipherParam( - this.param.storePassword()); - KeyStoreParam keyStoreParam; - keyStoreParam = new FileKeyStoreParam(LicenseCreator.class, - this.param.privateKeyPath(), - this.param.privateAlias(), - this.param.storePassword(), - this.param.keyPassword()); - return new DefaultLicenseParam(this.param.subject(), preferences, - keyStoreParam, cipherParam); - } - - private LicenseContent initLicenseContent(){ - LicenseContent content = new LicenseContent(); - content.setHolder(DEFAULT_ISSUER); - content.setIssuer(DEFAULT_ISSUER); - content.setSubject(this.param.subject()); - content.setIssued(this.param.issuedTime()); - content.setNotBefore(this.param.notBefore()); - content.setNotAfter(this.param.notAfter()); - content.setConsumerType(this.param.consumerType()); - content.setConsumerAmount(this.param.consumerAmount()); - content.setInfo(this.param.description()); - // Customized verification params - String json; - try { - json = MAPPER.writeValueAsString(this.param.extraParams()); - } catch (JsonProcessingException e) { - throw new RuntimeException("Failed to write extra params", e); - } - content.setExtra(json); - return content; - } - } - - private static class LicenseCreateManager extends CommonLicenseManager { - - public LicenseCreateManager(LicenseParam param) { - super(param); - } - - @Override - protected synchronized void validateCreate(LicenseContent content) - throws LicenseContentException { - super.validateCreate(content); - } - } - - private static class LicenseVerifier { - - private final LicenseVerifyParam param; - private final LicenseVerifyManager manager; - - public LicenseVerifier(LicenseVerifyParam param) { - this.param = param; - LicenseParam licenseParam = this.initLicenseParam(param); - this.manager = new LicenseVerifyManager(licenseParam); - } - - public static LicenseVerifier build(String path) throws IOException { - File file = FileUtils.getFile(path); - String json; - try { - json = FileUtils.readFileToString(file, CHARSET); - } catch (IOException e) { - throw new RuntimeException(String.format( - "Failed to read file '%s'", path)); - } - LicenseVerifyParam param = MAPPER.readValue( - json, LicenseVerifyParam.class); - return new LicenseVerifier(param); - } - - public synchronized void install() { - try { - this.manager.uninstall(); - File licenseFile = new File(this.param.licensePath()); - this.manager.install(licenseFile); - } catch (Exception e) { - throw new RuntimeException("Failed to install license", e); - } - } - - public synchronized void uninstall() { - try { - this.manager.uninstall(); - } catch (Exception e) { - throw new RuntimeException("Failed to uninstall license", e); - } - } - - public void verify() { - try { - this.manager.verify(); - } catch (Exception e) { - throw new RuntimeException("The license verify failed", e); - } - } - - private LicenseParam initLicenseParam(LicenseVerifyParam param) { - Preferences preferences = Preferences.userNodeForPackage( - LicenseVerifier.class); - CipherParam cipherParam = new DefaultCipherParam( - param.storePassword()); - KeyStoreParam keyStoreParam = new FileKeyStoreParam( - LicenseVerifier.class, - param.publicKeyPath(), - param.publicAlias(), - param.storePassword(), - null); - return new DefaultLicenseParam(param.subject(), preferences, - keyStoreParam, cipherParam); - } - } - - private static class LicenseVerifyManager extends CommonLicenseManager { - - private final String serverId = "server-1"; - - public LicenseVerifyManager(LicenseParam param) { - super(param); - } - - @Override - protected synchronized void validate(LicenseContent content) - throws LicenseContentException { - // Call super validate firstly, will verify expired - super.validate(content); - - // Verify the customized license parameters - String extra = (String) content.getExtra(); - List extraParams; - try { - TypeReference> type; - type = new TypeReference>() {}; - extraParams = MAPPER.readValue(extra, type); - } catch (IOException e) { - throw new RuntimeException("Failed to read extra params", e); - } - ExtraParam param = this.matchParam(this.serverId, extraParams); - if (param == null) { - throw newLicenseException("The current server's id '%s' " + - "is not authorized"); - } - if (this.usingGraphs() > param.graphs()) { - throw newLicenseException("The using graphs exceeded '%s'" + - "authorized limit '%s'", - this.usingGraphs(), param.graphs()); - } - } - - private int usingGraphs() { - // Assume - return 2; - } - - private ExtraParam matchParam(String id, List extraParams) { - for (ExtraParam param : extraParams) { - if (param.id().equals(id)) { - return param; - } - } - return null; - } - - private LicenseContentException newLicenseException(String message, - Object... args) { - return new LicenseContentException(String.format(message, args)); - } - } -} diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseParamsTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseParamsTest.java new file mode 100644 index 0000000000..8dec1df609 --- /dev/null +++ b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseParamsTest.java @@ -0,0 +1,88 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.unit.license; + +import java.io.IOException; + +import org.junit.Test; + +import com.baidu.hugegraph.license.LicenseExtraParam; +import com.baidu.hugegraph.license.LicenseParams; +import com.baidu.hugegraph.testutil.Assert; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class LicenseParamsTest { + + @Test + public void testLicenseParams() throws IOException { + String json = "{" + + "\"subject\":\"hugegraph-evaluation\"," + + "\"issued_time\":\"2019-08-10 00:00:00\"," + + "\"not_before\":\"2019-08-10 00:00:00\"," + + "\"not_after\":\"2020-08-10 00:00:00\"," + + "\"consumer_type\":\"user\"," + + "\"consumer_amount\":1," + + "\"description\":\"hugegraph license\"," + + "\"extra_params\":[" + + "{" + + "\"id\":\"server-1\"," + + "\"version\":\"0.9.2\"," + + "\"graphs\":3," + + "\"ip\":\"127.0.0.1\"," + + "\"mac\":\"00-01-6C-06-A6-29\"," + + "\"cpus\":32," + + "\"ram\":65536," + + "\"threads\":96," + + "\"memory\":32768," + + "\"nodes\":3," + + "\"data_size\":1024," + + "\"vertices\":1000," + + "\"edges\":2000" + + "}," + + "{" + + "\"id\":\"server-2\"," + + "\"version\":\"0.10.2\"," + + "\"graphs\":3," + + "\"ip\":\"127.0.0.1\"," + + "\"mac\":\"00-02-6C-06-A6-29\"," + + "\"cpus\":64," + + "\"ram\":65536," + + "\"threads\":96," + + "\"memory\":65536," + + "\"nodes\":30," + + "\"data_size\":10240," + + "\"vertices\":10000," + + "\"edges\":20000" + + "}" + + "]" + + "}"; + ObjectMapper mapper = new ObjectMapper(); + LicenseParams param = mapper.readValue(json, LicenseParams.class); + + LicenseExtraParam extraParam = param.matchParam("server-not-exist"); + Assert.assertNull(extraParam); + + extraParam = param.matchParam("server-1"); + Assert.assertEquals("00-01-6C-06-A6-29", extraParam.mac()); + + extraParam = param.matchParam("server-2"); + Assert.assertEquals("00-02-6C-06-A6-29", extraParam.mac()); + } +} diff --git a/hugegraph-rpc/pom.xml b/hugegraph-rpc/pom.xml index b06fc89b6e..8fca5a4500 100644 --- a/hugegraph-rpc/pom.xml +++ b/hugegraph-rpc/pom.xml @@ -6,12 +6,12 @@ com.baidu.hugegraph hugegraph-commons - 1.8.10 + 2.0.0 ../pom.xml hugegraph-rpc - 1.0.1 + 2.0.0 hugegraph-rpc HugeGraph Database RPC component @@ -25,8 +25,7 @@ com.baidu.hugegraph hugegraph-common - - 1.8.5 + 2.0.0 @@ -145,7 +144,7 @@ - 1.0.0.0 + 2.0.0.0 diff --git a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/version/RpcVersion.java b/hugegraph-rpc/src/main/java/com/baidu/hugegraph/version/RpcVersion.java index cd41fe55be..e192c6c9f5 100644 --- a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/version/RpcVersion.java +++ b/hugegraph-rpc/src/main/java/com/baidu/hugegraph/version/RpcVersion.java @@ -27,5 +27,5 @@ public class RpcVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(RpcVersion.class, - "1.0.1"); + "2.0.0"); } diff --git a/pom.xml b/pom.xml index 7a9623a8b6..c6607ca3c0 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-commons - 1.8.10 + 2.0.0 pom hugegraph-commons @@ -135,7 +135,7 @@ - 1.8.9.0 + 2.0.0.0 From 4a1926fe40e0bc2798ee303419511c5410050bba Mon Sep 17 00:00:00 2001 From: zhoney Date: Fri, 17 Dec 2021 17:43:29 +0800 Subject: [PATCH 159/217] improve java doc (#87) --- .../main/java/com/baidu/hugegraph/concurrent/BarrierEvent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/BarrierEvent.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/BarrierEvent.java index ece4c7a4ed..b6ccab932a 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/BarrierEvent.java +++ b/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/BarrierEvent.java @@ -35,7 +35,6 @@ public class BarrierEvent { /** * Wait forever until the signal is received. - * @return true if signal is received * @throws InterruptedException if interrupted. */ public void await() throws InterruptedException { @@ -53,6 +52,7 @@ public void await() throws InterruptedException { * Wait specified time in milliseconds. * @param timeout: the time in millisecond to wait. * @return true if signal is received, false if time out. + * @throws InterruptedException if interrupted. */ public boolean await(long timeout) throws InterruptedException { E.checkArgument(timeout >= 0L, From 8f0f2ba012e06b67b8084938e545a6b12c78309a Mon Sep 17 00:00:00 2001 From: coderzc Date: Tue, 21 Dec 2021 14:12:35 +0800 Subject: [PATCH 160/217] release maven package by actions (#88) --- .github/workflows/release.yml | 39 +++++++++++++++++++++++++++++++++++ pom.xml | 7 +++++++ 2 files changed, 46 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..b0c20d26c1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,39 @@ +name: release maven package + +on: + release: + types: [ published ] + +jobs: + build: + runs-on: ubuntu-20.04 + steps: + - name: Install JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'zulu' + + - name: Cache Maven packages + uses: actions/cache@v2 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 2 + + - name: Release Maven package + uses: samuelmeuli/action-maven-publish@v1 + with: + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }} + nexus_username: ${{ secrets.NEXUS_USERNAME }} + nexus_password: ${{ secrets.NEXUS_PASSWORD }} + server_id: sonatype-nexus-staging + maven_profiles: "release" + maven_args: > + -Dmaven.test.skip=true diff --git a/pom.xml b/pom.xml index c6607ca3c0..717e0bb644 100644 --- a/pom.xml +++ b/pom.xml @@ -211,6 +211,13 @@ + + + + --pinentry-mode + loopback + + From 922a4f6334416edc573450b7156ca09cc21b5899 Mon Sep 17 00:00:00 2001 From: zhoney Date: Tue, 21 Dec 2021 17:51:38 +0800 Subject: [PATCH 161/217] upgrade log4j to version 2.17.0 (#89) --- hugegraph-common/pom.xml | 4 ++-- .../java/com/baidu/hugegraph/version/CommonVersion.java | 2 +- hugegraph-rpc/pom.xml | 8 ++++---- .../main/java/com/baidu/hugegraph/version/RpcVersion.java | 2 +- pom.xml | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/hugegraph-common/pom.xml b/hugegraph-common/pom.xml index 0ddd612bc9..1092890ca2 100644 --- a/hugegraph-common/pom.xml +++ b/hugegraph-common/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-commons - 2.0.0 + 2.0.1 ../pom.xml @@ -231,7 +231,7 @@ - 2.0.0.0 + 2.0.1.0 diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index ac91e09d16..32e2025cb7 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/hugegraph-common/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "2.0.0"); + "2.0.1"); } diff --git a/hugegraph-rpc/pom.xml b/hugegraph-rpc/pom.xml index 8fca5a4500..07c2522f73 100644 --- a/hugegraph-rpc/pom.xml +++ b/hugegraph-rpc/pom.xml @@ -6,12 +6,12 @@ com.baidu.hugegraph hugegraph-commons - 2.0.0 + 2.0.1 ../pom.xml hugegraph-rpc - 2.0.0 + 2.0.1 hugegraph-rpc HugeGraph Database RPC component @@ -25,7 +25,7 @@ com.baidu.hugegraph hugegraph-common - 2.0.0 + 2.0.1 @@ -144,7 +144,7 @@ - 2.0.0.0 + 2.0.1.0 diff --git a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/version/RpcVersion.java b/hugegraph-rpc/src/main/java/com/baidu/hugegraph/version/RpcVersion.java index e192c6c9f5..c9992cce93 100644 --- a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/version/RpcVersion.java +++ b/hugegraph-rpc/src/main/java/com/baidu/hugegraph/version/RpcVersion.java @@ -27,5 +27,5 @@ public class RpcVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(RpcVersion.class, - "2.0.0"); + "2.0.1"); } diff --git a/pom.xml b/pom.xml index 717e0bb644..9e3c3458c7 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-commons - 2.0.0 + 2.0.1 pom hugegraph-commons @@ -57,7 +57,7 @@ ${project.basedir}/.. 1.8 1.8 - 2.16.0 + 2.17.0 1.10 2.1.1 3.2.2 @@ -135,7 +135,7 @@ - 2.0.0.0 + 2.0.1.0 From d695bd494da6b4a4cd76bbca8294fda498067d82 Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Tue, 21 Dec 2021 20:59:44 +0800 Subject: [PATCH 162/217] fix some test cases naming (#90) Change-Id: I89eaf2b7ff13e6909e057970542fff60ab552785 --- .../src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java | 4 ++-- .../{ExtraParamTest.java => LicenseExtraParamTest.java} | 2 +- .../baidu/hugegraph/unit/license/LicenseInstallParamTest.java | 2 +- .../src/test/java/com/baidu/hugegraph/unit/VersionTest.java | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) rename hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/{ExtraParamTest.java => LicenseExtraParamTest.java} (98%) diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java index b823a56e32..012038ecd2 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java +++ b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -43,7 +43,7 @@ import com.baidu.hugegraph.unit.iterator.LimitIteratorTest; import com.baidu.hugegraph.unit.iterator.ListIteratorTest; import com.baidu.hugegraph.unit.iterator.MapperIteratorTest; -import com.baidu.hugegraph.unit.license.ExtraParamTest; +import com.baidu.hugegraph.unit.license.LicenseExtraParamTest; import com.baidu.hugegraph.unit.license.LicenseCreateParamTest; import com.baidu.hugegraph.unit.license.LicenseInstallParamTest; import com.baidu.hugegraph.unit.license.LicenseParamsTest; @@ -114,7 +114,7 @@ DateUtilTest.class, UnitUtilTest.class, - ExtraParamTest.class, + LicenseExtraParamTest.class, LicenseCreateParamTest.class, LicenseInstallParamTest.class, LicenseParamsTest.class, diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/ExtraParamTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseExtraParamTest.java similarity index 98% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/ExtraParamTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseExtraParamTest.java index 8b79e04f13..7d613c535a 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/ExtraParamTest.java +++ b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseExtraParamTest.java @@ -27,7 +27,7 @@ import com.baidu.hugegraph.testutil.Assert; import com.fasterxml.jackson.databind.ObjectMapper; -public class ExtraParamTest { +public class LicenseExtraParamTest { @Test public void testDeserializeExtraParam() throws IOException { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseInstallParamTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseInstallParamTest.java index 8fc360421c..a16b02f72f 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseInstallParamTest.java +++ b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseInstallParamTest.java @@ -40,7 +40,7 @@ public void testDeserializeLicenseVerifyParam() throws IOException { + "}"; ObjectMapper mapper = new ObjectMapper(); LicenseInstallParam param = mapper.readValue(json, - LicenseInstallParam.class); + LicenseInstallParam.class); Assert.assertEquals("hugegraph-evaluation", param.subject()); Assert.assertEquals("publiccert", param.publicAlias()); Assert.assertEquals("a123456", param.storePassword()); diff --git a/hugegraph-rpc/src/test/java/com/baidu/hugegraph/unit/VersionTest.java b/hugegraph-rpc/src/test/java/com/baidu/hugegraph/unit/VersionTest.java index e603f22ba4..1430bda5ea 100644 --- a/hugegraph-rpc/src/test/java/com/baidu/hugegraph/unit/VersionTest.java +++ b/hugegraph-rpc/src/test/java/com/baidu/hugegraph/unit/VersionTest.java @@ -28,7 +28,7 @@ public class VersionTest { @Test - public void testGetCommonVersion() { + public void testGetRpcVersion() { String pomVersion = VersionUtil.getPomVersion(); Assert.assertNotNull(pomVersion); String version = RpcVersion.VERSION.get(); From 4b21e94ad23e1cae376e5675dc8cb6b38d2b8c53 Mon Sep 17 00:00:00 2001 From: zyxxoo <1318247699@qq.com> Date: Fri, 14 Jan 2022 10:55:34 +0800 Subject: [PATCH 163/217] chore: support java 11 (#83) * chore: support java 17 * fix: unitest * fix: server JAX-B API not found warning * chore: improve code * fix: hugeconfig test * chore: resolve conflict * fix: version unit test * chore: improve code * chore: improve impl version * chore: improve code * refactor: hugeconfig get * chore: improve code --- .github/workflows/ci.yml | 11 +- hugegraph-common/pom.xml | 20 +- .../hugegraph/config/ConfigListOption.java | 4 - .../baidu/hugegraph/config/HugeConfig.java | 182 +++++++++++------- .../baidu/hugegraph/config/TypedOption.java | 3 + .../hugegraph/rest/AbstractRestClient.java | 39 ++-- .../com/baidu/hugegraph/rest/RestClient.java | 2 +- .../com/baidu/hugegraph/rest/RestResult.java | 4 +- .../hugegraph/version/CommonVersion.java | 2 +- .../hugegraph/unit/config/HugeConfigTest.java | 22 ++- .../hugegraph/unit/rest/RestClientTest.java | 12 +- .../hugegraph/unit/rest/RestResultTest.java | 7 +- hugegraph-rpc/pom.xml | 8 +- .../baidu/hugegraph/version/RpcVersion.java | 2 +- pom.xml | 19 +- 15 files changed, 204 insertions(+), 133 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a09093a164..e319c49df8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,12 +15,17 @@ on: jobs: build: runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + JAVA_VERSION: ['8', '11'] + steps: - - name: Install JDK 8 + - name: Install JDK ${{ matrix.JAVA_VERSION }} uses: actions/setup-java@v2 with: - java-version: '8' - distribution: 'adopt' + java-version: ${{ matrix.JAVA_VERSION }} + distribution: 'zulu' - name: Cache Maven packages uses: actions/cache@v2 diff --git a/hugegraph-common/pom.xml b/hugegraph-common/pom.xml index 1092890ca2..9fb054bbae 100644 --- a/hugegraph-common/pom.xml +++ b/hugegraph-common/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-commons - 2.0.1 + 2.1.0 ../pom.xml @@ -70,6 +70,11 @@ commons-configuration2 ${commons.configuration2.version} + + commons-beanutils + commons-beanutils + ${commons.beanutils.version} + commons-io commons-io @@ -173,6 +178,17 @@ jersey-hk2 ${jersey.hk2.version} + + jakarta.xml.bind + jakarta.xml.bind-api + ${jakarta.xml.version} + + + com.sun.xml.bind + jaxb-impl + ${sun.xml.version} + runtime + @@ -231,7 +247,7 @@ - 2.0.1.0 + 2.1.0.0 diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java index ef6e3249e2..ff114ccb77 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java +++ b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java @@ -69,10 +69,6 @@ public static List convert(Object value, Function conv) { String str = (String) value; if (str.startsWith("[") && str.endsWith("]")) { str = str.substring(1, str.length() - 1); - } else { - throw new ConfigException( - "The list type config option expected " + - "to be wrapped in [], actual '%s'", str); } String[] parts = str.split(","); diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/HugeConfig.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/HugeConfig.java index 2593be611e..22974f81ba 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/HugeConfig.java +++ b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/HugeConfig.java @@ -21,73 +21,50 @@ import java.io.File; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; -import org.apache.commons.configuration.AbstractConfiguration; -import org.apache.commons.configuration.AbstractFileConfiguration; -import org.apache.commons.configuration.Configuration; -import org.apache.commons.configuration.ConfigurationException; -import org.apache.commons.configuration.PropertiesConfiguration; -import org.slf4j.Logger; - import com.baidu.hugegraph.util.E; import com.baidu.hugegraph.util.Log; +import org.apache.commons.configuration2.Configuration; +import org.apache.commons.configuration2.FileBasedConfiguration; +import org.apache.commons.configuration2.PropertiesConfiguration; +import org.apache.commons.configuration2.YAMLConfiguration; +import org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder; +import org.apache.commons.configuration2.builder.fluent.Configurations; +import org.apache.commons.configuration2.builder.fluent.Parameters; +import org.apache.commons.configuration2.ex.ConfigurationException; +import org.apache.commons.configuration2.io.FileHandler; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; + +import javax.annotation.Nullable; public class HugeConfig extends PropertiesConfiguration { private static final Logger LOG = Log.logger(HugeConfig.class); - public HugeConfig(Configuration config) { - if (config == null) { - throw new ConfigException("The config object is null"); - } - this.reloadIfNeed(config); - this.setLayoutIfNeeded(config); + private final String path; - Iterator keys = config.getKeys(); - while (keys.hasNext()) { - String key = keys.next(); - this.addProperty(key, config.getProperty(key)); - } - this.checkRequiredOptions(); + public HugeConfig(Configuration config) { + loadConfig(config); + this.path = null; } public HugeConfig(String configFile) { - this(loadConfigFile(configFile)); + loadConfig(loadConfigFile(configFile)); + this.path = configFile; } - private void reloadIfNeed(Configuration conf) { - if (!(conf instanceof AbstractFileConfiguration)) { - if (conf instanceof AbstractConfiguration) { - AbstractConfiguration config = (AbstractConfiguration) conf; - config.setDelimiterParsingDisabled(true); - } - return; - } - AbstractFileConfiguration fileConfig = (AbstractFileConfiguration) conf; - - File file = fileConfig.getFile(); - if (file != null) { - // May need to use the original file - this.setFile(file); + private void loadConfig(Configuration config) { + if (config == null) { + throw new ConfigException("The config object is null"); } + this.setLayoutIfNeeded(config); - if (!fileConfig.isDelimiterParsingDisabled()) { - /* - * PropertiesConfiguration will parse the containing comma - * config options into list directly, but we want to do - * this work by ourselves, so reload it and parse into `String` - */ - fileConfig.setDelimiterParsingDisabled(true); - try { - fileConfig.refresh(); - } catch (ConfigurationException e) { - throw new ConfigException("Unable to load config file: %s", - e, file); - } - } + this.append(config); + this.checkRequiredOptions(); } private void setLayoutIfNeeded(Configuration conf) { @@ -98,30 +75,22 @@ private void setLayoutIfNeeded(Configuration conf) { this.setLayout(propConf.getLayout()); } - private static PropertiesConfiguration loadConfigFile(String path) { + private static Configuration loadConfigFile(String path) { E.checkNotNull(path, "config path"); E.checkArgument(!path.isEmpty(), "The config path can't be empty"); File file = new File(path); - E.checkArgument(file.exists() && file.isFile() && file.canRead(), - "Need to specify a readable config, but got: %s", - file.toString()); - - PropertiesConfiguration config = new PropertiesConfiguration(); - config.setDelimiterParsingDisabled(true); - try { - config.load(file); - } catch (ConfigurationException e) { - throw new ConfigException("Unable to load config: %s", e, path); - } - return config; + return loadConfigFile(file); } @SuppressWarnings("unchecked") public R get(TypedOption option) { Object value = this.getProperty(option.name()); - return value != null ? (R) value : option.defaultValue(); + if (value == null) { + return option.defaultValue(); + } + return (R) value; } public Map getMap(ConfigListOption option) { @@ -138,26 +107,99 @@ public Map getMap(ConfigListOption option) { } @Override - public void addProperty(String key, Object value) { - if (!OptionSpace.containKey(key)) { + public void addPropertyDirect(String key, Object value) { + TypedOption option = OptionSpace.get(key); + if (option == null) { LOG.warn("The config option '{}' is redundant, " + "please ensure it has been registered", key); } else { // The input value is String(parsed by PropertiesConfiguration) value = this.validateOption(key, value); } - super.addPropertyDirect(key, value); + if (this.containsKey(key) && value instanceof List) { + for (Object item : (List) value) { + super.addPropertyDirect(key, item); + } + } else { + super.addPropertyDirect(key, value); + } } - private Object validateOption(String key, Object value) { - E.checkArgument(value instanceof String, - "Invalid value for key '%s': %s", key, value); + @Override + protected void addPropertyInternal(String key, Object value) { + this.addPropertyDirect(key, value); + } + private Object validateOption(String key, Object value) { TypedOption option = OptionSpace.get(key); - return option.parseConvert((String) value); + + if (value instanceof String) { + return option.parseConvert((String) value); + } + + Class dataType = option.dataType(); + if (dataType.isInstance(value)) { + return value; + } + + throw new IllegalArgumentException( + String.format("Invalid value for key '%s': '%s'", key, value)); } private void checkRequiredOptions() { // TODO: Check required options must be contained in this map } + + public void save(File copiedFile) throws ConfigurationException { + FileHandler fileHandler = new FileHandler(this); + fileHandler.save(copiedFile); + } + + @Nullable + public File getFile() { + if (StringUtils.isEmpty(this.path)) { + return null; + } + + return new File(this.path); + } + + private static Configuration loadConfigFile(File configFile) { + E.checkArgument(configFile.exists() && + configFile.isFile() && + configFile.canRead(), + "Please specify a proper config file rather than: '%s'", + configFile.toString()); + + try { + String fileName = configFile.getName(); + String fileExtension = FilenameUtils.getExtension(fileName); + + Configuration config; + Configurations configs = new Configurations(); + + switch (fileExtension) { + case "yml": + case "yaml": + Parameters params = new Parameters(); + FileBasedConfigurationBuilder + builder = new FileBasedConfigurationBuilder( + YAMLConfiguration.class) + .configure(params.fileBased() + .setFile(configFile)); + config = builder.getConfiguration(); + break; + case "xml": + config = configs.xml(configFile); + break; + default: + config = configs.properties(configFile); + break; + } + return config; + } catch (ConfigurationException e) { + throw new ConfigException("Unable to load config: '%s'", + e, configFile); + } + } } diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/TypedOption.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/TypedOption.java index 2aa50e3f72..cd5841bf70 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/TypedOption.java +++ b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/TypedOption.java @@ -129,6 +129,9 @@ protected Object parse(String value, Class dataType) { return value; } else if (dataType.equals(Class.class)) { try { + if (value.startsWith("class")) { + value = value.substring("class".length()).trim(); + } return Class.forName(value); } catch (ClassNotFoundException e) { throw new ConfigException( diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java index 5c96196491..d6b1b71251 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java +++ b/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java @@ -31,24 +31,16 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSession; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.ClientRequestContext; -import javax.ws.rs.client.ClientRequestFilter; -import javax.ws.rs.client.Entity; -import javax.ws.rs.client.Invocation.Builder; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Variant; - +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.client.ClientRequestContext; +import jakarta.ws.rs.client.ClientRequestFilter; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.client.WebTarget; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Variant; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.tuple.Pair; import org.apache.http.HttpHeaders; @@ -64,6 +56,7 @@ import org.glassfish.jersey.apache.connector.ApacheConnectorProvider; import org.glassfish.jersey.client.ClientConfig; import org.glassfish.jersey.client.ClientProperties; +import org.glassfish.jersey.client.JerseyClientBuilder; import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; import org.glassfish.jersey.internal.util.collection.Ref; import org.glassfish.jersey.internal.util.collection.Refs; @@ -74,6 +67,13 @@ import com.baidu.hugegraph.util.ExecutorUtil; import com.google.common.collect.ImmutableMap; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + public abstract class AbstractRestClient implements RestClient { // Time unit: hours @@ -163,7 +163,8 @@ public AbstractRestClient(String url, String token, int timeout, public AbstractRestClient(String url, ClientConfig config) { configConnectionManager(url, config); - this.client = ClientBuilder.newClient(config); + + this.client = JerseyClientBuilder.newClient(config); this.client.register(GZipEncoder.class); this.target = this.client.target(url); this.pool = (PoolingHttpClientConnectionManager) config.getProperty( diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/RestClient.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/RestClient.java index 54a6df3147..a60aeeee7b 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/RestClient.java +++ b/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/RestClient.java @@ -21,7 +21,7 @@ import java.util.Map; -import javax.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.MultivaluedMap; public interface RestClient { diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/RestResult.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/RestResult.java index dc78f18715..88ba49edb1 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/RestResult.java +++ b/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/RestResult.java @@ -23,8 +23,8 @@ import java.util.ArrayList; import java.util.List; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.Response; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonNode; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 32e2025cb7..e10b092509 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/hugegraph-common/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "2.0.1"); + "2.1.0"); } diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java index 75a47bbbbb..f522d56fee 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java +++ b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java @@ -35,10 +35,13 @@ import java.util.Map; import org.apache.commons.collections.IteratorUtils; -import org.apache.commons.configuration.Configuration; -import org.apache.commons.configuration.ConfigurationException; -import org.apache.commons.configuration.MapConfiguration; -import org.apache.commons.configuration.PropertiesConfiguration; +import org.apache.commons.configuration2.AbstractConfiguration; +import org.apache.commons.configuration2.Configuration; +import org.apache.commons.configuration2.MapConfiguration; +import org.apache.commons.configuration2.PropertiesConfiguration; +import org.apache.commons.configuration2.convert.DisabledListDelimiterHandler; +import org.apache.commons.configuration2.ex.ConfigurationException; +import org.apache.commons.configuration2.io.FileHandler; import org.apache.commons.io.FileUtils; import org.junit.BeforeClass; import org.junit.Test; @@ -262,7 +265,8 @@ public void testOptionWithError() { @Test public void testHugeConfig() throws Exception { Configuration conf = new PropertiesConfiguration(); - Whitebox.setInternalState(conf, "delimiterParsingDisabled", true); + Assert.assertEquals(DisabledListDelimiterHandler.INSTANCE, + ((AbstractConfiguration) conf).getListDelimiterHandler()); HugeConfig config = new HugeConfig(conf); @@ -338,7 +342,10 @@ public void testHugeConfigWithFile() throws Exception { @Test public void testHugeConfigWithConfiguration() throws Exception { - HugeConfig config = new HugeConfig(new PropertiesConfiguration(CONF)); + PropertiesConfiguration configuration = new PropertiesConfiguration(); + FileHandler fileHandler = new FileHandler(configuration); + fileHandler.load(CONF); + HugeConfig config = new HugeConfig(configuration); Assert.assertEquals("file-text1-value", config.get(TestOptions.text1)); Assert.assertEquals("file-text2-value", config.get(TestOptions.text2)); @@ -348,7 +355,8 @@ public void testHugeConfigWithConfiguration() throws Exception { @Test public void testHugeConfigWithOverride() throws Exception { Configuration conf = new PropertiesConfiguration(); - Whitebox.setInternalState(conf, "delimiterParsingDisabled", true); + Assert.assertEquals(DisabledListDelimiterHandler.INSTANCE, + ((AbstractConfiguration) conf).getListDelimiterHandler()); HugeConfig config = new HugeConfig(conf); diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java index d682025fc4..bd48a0c40c 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java +++ b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java @@ -32,20 +32,18 @@ import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSessionContext; -import javax.ws.rs.client.Entity; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.client.Invocation.Builder; -import javax.ws.rs.core.MultivaluedHashMap; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.client.WebTarget; +import jakarta.ws.rs.core.MultivaluedHashMap; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.Response; import org.apache.http.HttpClientConnection; import org.apache.http.HttpHeaders; import org.apache.http.HttpHost; import org.apache.http.conn.routing.HttpRoute; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.pool.PoolStats; -import org.glassfish.jersey.client.ClientRequest; import org.glassfish.jersey.internal.util.collection.ImmutableMultivaluedMap; import org.junit.Test; import org.mockito.Mockito; diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/rest/RestResultTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/rest/RestResultTest.java index 357c4a06d7..02832fd586 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/rest/RestResultTest.java +++ b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/rest/RestResultTest.java @@ -21,10 +21,9 @@ import java.util.Map; -import javax.ws.rs.core.MultivaluedHashMap; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; - +import jakarta.ws.rs.core.MultivaluedHashMap; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.Response; import org.glassfish.jersey.internal.util.collection.ImmutableMultivaluedMap; import org.junit.Test; import org.mockito.Mockito; diff --git a/hugegraph-rpc/pom.xml b/hugegraph-rpc/pom.xml index 07c2522f73..564e66802c 100644 --- a/hugegraph-rpc/pom.xml +++ b/hugegraph-rpc/pom.xml @@ -6,12 +6,12 @@ com.baidu.hugegraph hugegraph-commons - 2.0.1 + 2.1.0 ../pom.xml hugegraph-rpc - 2.0.1 + 2.1.0 hugegraph-rpc HugeGraph Database RPC component @@ -25,7 +25,7 @@ com.baidu.hugegraph hugegraph-common - 2.0.1 + 2.1.0 @@ -144,7 +144,7 @@ - 2.0.1.0 + 2.1.0.0 diff --git a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/version/RpcVersion.java b/hugegraph-rpc/src/main/java/com/baidu/hugegraph/version/RpcVersion.java index c9992cce93..d64af44004 100644 --- a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/version/RpcVersion.java +++ b/hugegraph-rpc/src/main/java/com/baidu/hugegraph/version/RpcVersion.java @@ -27,5 +27,5 @@ public class RpcVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(RpcVersion.class, - "2.0.1"); + "2.1.0"); } diff --git a/pom.xml b/pom.xml index 9e3c3458c7..f276f3fa47 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-commons - 2.0.1 + 2.1.0 pom hugegraph-commons @@ -59,19 +59,22 @@ 1.8 2.17.0 1.10 - 2.1.1 + 2.3 + 1.9.4 3.2.2 2.7 1.11 25.1-jre 1.0 3.0.1 - 3.21.0-GA - 2.22 - 2.27 + 3.28.0-GA + 3.0.3 + 3.0.3 2.12.1 4.12 - 2.25.1 + 4.1.0 + 4.0.0-RC2 + 3.0.2 @@ -135,7 +138,7 @@ - 2.0.1.0 + 2.1.0.0 @@ -144,7 +147,7 @@ org.jacoco jacoco-maven-plugin - 0.8.2 + 0.8.7 pre-unit-test From 05fe7a4c92b4f6a3651ca58efbcd4dbed4b039d7 Mon Sep 17 00:00:00 2001 From: imbajin <17706099+imbajin@users.noreply.github.com> Date: Thu, 3 Mar 2022 19:27:08 +0800 Subject: [PATCH 164/217] chore: use cla assistant to support robot pr (#92) Co-authored-by: imbajin --- .github/workflows/cla.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/cla.yml diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml new file mode 100644 index 0000000000..a182b9515b --- /dev/null +++ b/.github/workflows/cla.yml @@ -0,0 +1,35 @@ +name: "CLA Assistant" +on: + issue_comment: + types: [created] + pull_request_target: + types: [opened,closed,synchronize] + +jobs: + CLAssistant: + runs-on: ubuntu-latest + steps: + - name: "CLA Assistant" + if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target' + uses: cla-assistant/github-action@v2.1.3-beta + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # the below token should have repo scope and must be manually added by you in the repository's secret + PERSONAL_ACCESS_TOKEN : ${{ secrets.PERSONAL_ACCESS_TOKEN }} + with: + path-to-signatures: '.github/cla-signatures/cla.json' + path-to-document: 'https://github.com/hugegraph/hugegraph-doc/blob/master/CLA.md' # e.g. a CLA or a DCO document + custom-allsigned-prcomment: '**Good**! All Contributors have signed the [CLA](https://github.com/hugegraph/hugegraph-doc/blob/master/CLA.md).' + # branch should not be protected + branch: 'cla-assist' + allowlist: bot* + lock-pullrequest-aftermerge: false + + # the following are the optional inputs - If the optional inputs are not given, then default values will be taken + #remote-organization-name: enter the remote organization name where the signatures should be stored (Default is storing the signatures in the same repository) + #remote-repository-name: enter the remote repository name where the signatures should be stored (Default is storing the signatures in the same repository) + #create-file-commit-message: 'For example: Creating file for storing CLA Signatures' + #signed-commit-message: 'For example: $contributorName has signed the CLA in #$pullRequestNo' + #custom-notsigned-prcomment: 'pull request comment with Introductory message to ask new contributors to sign' + #custom-pr-sign-comment: 'The signature to be committed in order to sign the CLA' + #use-dco-flag: true - If you are using DCO instead of CLA From 88d2f897edb5209674c1fa5504be8e249cef6e10 Mon Sep 17 00:00:00 2001 From: imbajin <17706099+imbajin@users.noreply.github.com> Date: Mon, 21 Mar 2022 17:24:35 +0800 Subject: [PATCH 165/217] chore: support code security check with codeQL (#94) --- .github/workflows/codeql-analysis.yml | 59 +++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/codeql-analysis.yml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000000..df4d6117cb --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,59 @@ +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +name: "CodeQL" + +on: + push: + branches: [ master, release-* ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ master ] + schedule: + - cron: '33 15 * * 5' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'java' ] + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + # ℹ️ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 From d0e5971c7e49077411dd6c4f933c830b0a5fba4f Mon Sep 17 00:00:00 2001 From: zyxxoo Date: Mon, 21 Mar 2022 19:47:40 +0800 Subject: [PATCH 166/217] fix: can't delete conf file when drop graph (#93) --- hugegraph-common/pom.xml | 4 +-- .../baidu/hugegraph/config/HugeConfig.java | 34 +++++++++++-------- .../hugegraph/version/CommonVersion.java | 2 +- hugegraph-rpc/pom.xml | 2 +- pom.xml | 4 +-- 5 files changed, 25 insertions(+), 21 deletions(-) diff --git a/hugegraph-common/pom.xml b/hugegraph-common/pom.xml index 9fb054bbae..d6abc74de9 100644 --- a/hugegraph-common/pom.xml +++ b/hugegraph-common/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-commons - 2.1.0 + 2.1.1 ../pom.xml @@ -247,7 +247,7 @@ - 2.1.0.0 + 2.1.1.0 diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/HugeConfig.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/HugeConfig.java index 22974f81ba..69f78744f3 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/HugeConfig.java +++ b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/HugeConfig.java @@ -45,16 +45,16 @@ public class HugeConfig extends PropertiesConfiguration { private static final Logger LOG = Log.logger(HugeConfig.class); - private final String path; + private String configPath; public HugeConfig(Configuration config) { loadConfig(config); - this.path = null; + this.configPath = null; } public HugeConfig(String configFile) { loadConfig(loadConfigFile(configFile)); - this.path = configFile; + this.configPath = configFile; } private void loadConfig(Configuration config) { @@ -75,15 +75,6 @@ private void setLayoutIfNeeded(Configuration conf) { this.setLayout(propConf.getLayout()); } - private static Configuration loadConfigFile(String path) { - E.checkNotNull(path, "config path"); - E.checkArgument(!path.isEmpty(), - "The config path can't be empty"); - - File file = new File(path); - return loadConfigFile(file); - } - @SuppressWarnings("unchecked") public R get(TypedOption option) { Object value = this.getProperty(option.name()); @@ -156,12 +147,25 @@ public void save(File copiedFile) throws ConfigurationException { } @Nullable - public File getFile() { - if (StringUtils.isEmpty(this.path)) { + public File file() { + if (StringUtils.isEmpty(this.configPath)) { return null; } - return new File(this.path); + return new File(this.configPath); + } + + public void file(String path) { + this.configPath = path; + } + + private static Configuration loadConfigFile(String path) { + E.checkNotNull(path, "config path"); + E.checkArgument(!path.isEmpty(), + "The config path can't be empty"); + + File file = new File(path); + return loadConfigFile(file); } private static Configuration loadConfigFile(File configFile) { diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index e10b092509..5aa53b9c1b 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/hugegraph-common/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "2.1.0"); + "2.1.1"); } diff --git a/hugegraph-rpc/pom.xml b/hugegraph-rpc/pom.xml index 564e66802c..682faa1e56 100644 --- a/hugegraph-rpc/pom.xml +++ b/hugegraph-rpc/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-commons - 2.1.0 + 2.1.1 ../pom.xml diff --git a/pom.xml b/pom.xml index f276f3fa47..4970361632 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-commons - 2.1.0 + 2.1.1 pom hugegraph-commons @@ -138,7 +138,7 @@ - 2.1.0.0 + 2.1.1.0 From f2e838443de26d21619708f90988abcf332ef36e Mon Sep 17 00:00:00 2001 From: zyxxoo Date: Mon, 11 Apr 2022 16:11:14 +0800 Subject: [PATCH 167/217] version 2.1.2 (#96) --- hugegraph-common/pom.xml | 4 ++-- .../java/com/baidu/hugegraph/version/CommonVersion.java | 2 +- hugegraph-rpc/pom.xml | 7 +++---- .../main/java/com/baidu/hugegraph/version/RpcVersion.java | 2 +- pom.xml | 5 +++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hugegraph-common/pom.xml b/hugegraph-common/pom.xml index d6abc74de9..2f6a818c44 100644 --- a/hugegraph-common/pom.xml +++ b/hugegraph-common/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-commons - 2.1.1 + 2.1.2 ../pom.xml @@ -247,7 +247,7 @@ - 2.1.1.0 + ${implementation.version} diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/version/CommonVersion.java index 5aa53b9c1b..e75c1838eb 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/hugegraph-common/src/main/java/com/baidu/hugegraph/version/CommonVersion.java @@ -27,5 +27,5 @@ public class CommonVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(CommonVersion.class, - "2.1.1"); + "2.1.2"); } diff --git a/hugegraph-rpc/pom.xml b/hugegraph-rpc/pom.xml index 682faa1e56..06dded64ce 100644 --- a/hugegraph-rpc/pom.xml +++ b/hugegraph-rpc/pom.xml @@ -6,12 +6,11 @@ com.baidu.hugegraph hugegraph-commons - 2.1.1 + 2.1.2 ../pom.xml hugegraph-rpc - 2.1.0 hugegraph-rpc HugeGraph Database RPC component @@ -25,7 +24,7 @@ com.baidu.hugegraph hugegraph-common - 2.1.0 + ${project.version} @@ -144,7 +143,7 @@ - 2.1.0.0 + ${implementation.version} diff --git a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/version/RpcVersion.java b/hugegraph-rpc/src/main/java/com/baidu/hugegraph/version/RpcVersion.java index d64af44004..5faee27abc 100644 --- a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/version/RpcVersion.java +++ b/hugegraph-rpc/src/main/java/com/baidu/hugegraph/version/RpcVersion.java @@ -27,5 +27,5 @@ public class RpcVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(RpcVersion.class, - "2.1.0"); + "2.1.2"); } diff --git a/pom.xml b/pom.xml index 4970361632..cee98a5545 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-commons - 2.1.1 + 2.1.2 pom hugegraph-commons @@ -75,6 +75,7 @@ 4.1.0 4.0.0-RC2 3.0.2 + 2.1.2.0 @@ -138,7 +139,7 @@ - 2.1.1.0 + ${implementation.version} From deac513c43858a144f0e7171d9f2ff33196b1e1a Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Wed, 27 Apr 2022 10:27:59 +0800 Subject: [PATCH 168/217] improve Whitebox.setInternalState() (#99) * add Whitebox.setInternalFinalState() * delete Whitebox.setInternalFinalState() method since ineffective --- .../baidu/hugegraph/testutil/Whitebox.java | 11 +++-- .../hugegraph/testutil/WhiteboxTest.java | 48 +++++++++++++++---- 2 files changed, 48 insertions(+), 11 deletions(-) diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java index 0d7c7c4266..826ab01e86 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java +++ b/hugegraph-common/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java @@ -32,13 +32,18 @@ public class Whitebox { public static final char SEPARATOR = '.'; - public static void setInternalState(Object target, String fieldName, - Object value) { + public static void setInternalState(Object target, + String fieldName, Object value) { assert target != null; assert fieldName != null; int sep = fieldName.lastIndexOf(SEPARATOR); if (sep > 0) { - target = getInternalState(target, fieldName.substring(0, sep)); + String prefix = fieldName.substring(0, sep); + Object result = getInternalState(target, prefix); + E.checkArgument(result != null, + "Can't set value on null field: `%s.%s`", + target, prefix); + target = result; fieldName = fieldName.substring(sep + 1); } diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java index 92ab1aff12..6375c0dcca 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java +++ b/hugegraph-common/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java @@ -56,7 +56,7 @@ public void testGetInternalState() { Test1 test1 = newTest(); Assert.assertEquals(1, Whitebox.getInternalState(test1, "ivalue")); Assert.assertEquals(2f, Whitebox.getInternalState(test1, - "test2.fvalue")); + "test2.finalValue")); Assert.assertEquals("3", Whitebox.getInternalState(test1, "test2.test3.str")); @@ -65,7 +65,7 @@ public void testGetInternalState() { }); Assert.assertThrows(RuntimeException.class, () -> { - Whitebox.getInternalState(test1, "test2.fvalue2"); + Whitebox.getInternalState(test1, "test2.valueNotExist"); }); } @@ -75,10 +75,11 @@ public void testSetInternalState() { Whitebox.setInternalState(test1, "ivalue", 11); Assert.assertEquals(11, Whitebox.getInternalState(test1, "ivalue")); + Assert.assertEquals(11, test1.ivalue); - Whitebox.setInternalState(test1, "test2.fvalue", 22f); + Whitebox.setInternalState(test1, "test2.finalValue", 22f); Assert.assertEquals(22f, Whitebox.getInternalState(test1, - "test2.fvalue")); + "test2.finalValue")); Whitebox.setInternalState(test1, "test2.test3.str", "33"); Assert.assertEquals("33", Whitebox.getInternalState(test1, @@ -89,12 +90,40 @@ public void testSetInternalState() { }); Assert.assertThrows(RuntimeException.class, () -> { - Whitebox.setInternalState(test1, "test2.fvalue2", 22f); + Whitebox.setInternalState(test1, "test2.valueNotExist", 22f); }); Assert.assertThrows(RuntimeException.class, () -> { - Whitebox.setInternalState(test1, "test2.fvalue", 22d); + Whitebox.setInternalState(test1, "test2.finalValue", 22d); }); + + Assert.assertThrows(RuntimeException.class, () -> { + test1.test2 = null; + Whitebox.setInternalState(test1, "test2.finalValue", 22f); + }, e -> { + Assert.assertContains("Can't set value on null field", + e.getMessage()); + }); + } + + @Test + public void testSetInternalFinalState() { + Test1 test1 = newTest(); + Assert.assertEquals(1, test1.finalValue); + + Whitebox.setInternalState(test1, "finalValue", 2); + Assert.assertEquals(2, Whitebox.getInternalState(test1, "finalValue")); + + Whitebox.setInternalState(test1, "finalValue", 3); + Assert.assertEquals(3, Whitebox.getInternalState(test1, "finalValue")); + + Whitebox.setInternalState(test1, "test2.finalValue", 22f); + Assert.assertEquals(22f, Whitebox.getInternalState(test1, + "test2.finalValue")); + + // FIXME: seems don't take effect!!! + Assert.assertEquals(1, test1.finalValue); + Assert.assertEquals(2f, test1.test2.finalValue, 0f); } @Test @@ -159,7 +188,10 @@ private static Test1 newTest() { private static class Test1 { private static int staticValue = 1; + private int ivalue = 1; + private final int finalValue = 1; + private Test2 test2; private TestSubClass test4; @@ -196,11 +228,11 @@ private static int throwfunc2() throws Exception { private static class Test2 { private static int staticValue = 2; - private final float fvalue = 2; + private final float finalValue = 2f; private Test3 test3; private float value() { - return this.fvalue; + return this.finalValue; } private T value(T o) { From db84121d5d39eae0f2db3c45851a1c4942970299 Mon Sep 17 00:00:00 2001 From: imbajin Date: Fri, 29 Apr 2022 12:33:19 +0800 Subject: [PATCH 169/217] refact: unify pom & remove useless file (#100) --- hugegraph-common/LICENSE | 202 ------------------ hugegraph-common/checkstyle.xml | 89 -------- hugegraph-common/pom.xml | 10 +- .../com/baidu/hugegraph/util/UnitUtil.java | 2 +- hugegraph-rpc/LICENSE | 202 ------------------ hugegraph-rpc/checkstyle.xml | 89 -------- hugegraph-rpc/pom.xml | 9 +- pom.xml | 24 +-- 8 files changed, 15 insertions(+), 612 deletions(-) delete mode 100644 hugegraph-common/LICENSE delete mode 100644 hugegraph-common/checkstyle.xml delete mode 100644 hugegraph-rpc/LICENSE delete mode 100644 hugegraph-rpc/checkstyle.xml diff --git a/hugegraph-common/LICENSE b/hugegraph-common/LICENSE deleted file mode 100644 index e06d208186..0000000000 --- a/hugegraph-common/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed 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. - diff --git a/hugegraph-common/checkstyle.xml b/hugegraph-common/checkstyle.xml deleted file mode 100644 index 9373a70d91..0000000000 --- a/hugegraph-common/checkstyle.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hugegraph-common/pom.xml b/hugegraph-common/pom.xml index 2f6a818c44..871b98e34c 100644 --- a/hugegraph-common/pom.xml +++ b/hugegraph-common/pom.xml @@ -4,15 +4,15 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.baidu.hugegraph + org.apache.hugegraph hugegraph-commons - 2.1.2 + ${revision} ../pom.xml hugegraph-common - hugegraph-common - https://github.com/hugegraph/hugegraph-common + ${artifactId} + https://github.com/apache/incubator-hugegraph-commons/tree/master/hugegraph-common hugegraph-common is a common module for HugeGraph and its peripheral components. hugegraph-common encapsulates locks, configurations, events, iterators, rest and some @@ -212,7 +212,7 @@ maven-checkstyle-plugin 3.1.0 - checkstyle.xml + ../checkstyle.xml UTF-8 true true diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/UnitUtil.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/UnitUtil.java index 60c626f85b..069ab0007b 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/UnitUtil.java +++ b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/UnitUtil.java @@ -62,7 +62,7 @@ public static long bytesFromReadableString(String valueWithUnit) { "expect format like '10 MB'", valueWithUnit); String unit = valueWithUnit.substring(spacePos + 1); - long factor = 0L; + long factor; switch (unit.trim().toUpperCase()) { case "B": case "BYTE": diff --git a/hugegraph-rpc/LICENSE b/hugegraph-rpc/LICENSE deleted file mode 100644 index e06d208186..0000000000 --- a/hugegraph-rpc/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed 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. - diff --git a/hugegraph-rpc/checkstyle.xml b/hugegraph-rpc/checkstyle.xml deleted file mode 100644 index 9373a70d91..0000000000 --- a/hugegraph-rpc/checkstyle.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hugegraph-rpc/pom.xml b/hugegraph-rpc/pom.xml index 06dded64ce..43fcff4d12 100644 --- a/hugegraph-rpc/pom.xml +++ b/hugegraph-rpc/pom.xml @@ -4,15 +4,14 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.baidu.hugegraph + org.apache.hugegraph hugegraph-commons - 2.1.2 + ${revision} ../pom.xml hugegraph-rpc - - hugegraph-rpc + ${artifactId} HugeGraph Database RPC component @@ -107,7 +106,7 @@ maven-checkstyle-plugin 3.1.0 - checkstyle.xml + ../checkstyle.xml UTF-8 true true diff --git a/pom.xml b/pom.xml index cee98a5545..7bb8fc4cce 100644 --- a/pom.xml +++ b/pom.xml @@ -4,13 +4,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.baidu.hugegraph + org.apache.hugegraph hugegraph-commons - 2.1.2 + ${revision} pom - hugegraph-commons - https://github.com/hugegraph/hugegraph-commons + ${project.artifactId} + https://github.com/apache/incubator-hugegraph-commons hugegraph-commons is a common module for HugeGraph-Common and HugeGraph-Rpc with their peripheral components. It includes rpc frame, locks, configurations, events, iterators, rest and some @@ -37,22 +37,8 @@ https://github.com/hugegraph/hugegraph-commons - - - lizhangmei - javaloveme@gmail.com - - - zhoney - zhangyi89817@126.com - - - liningrui - liningrui@vip.qq.com - - - + 2.1.2 UTF-8 ${project.basedir}/.. 1.8 From 589ee2ca10d97f36f3f3ccd1e00b538268489a55 Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Fri, 27 May 2022 14:19:10 +0800 Subject: [PATCH 170/217] support assert-throws return future (#102) Change-Id: I8fe115a7518dd84e22c9e28f777515e74e48d5d2 --- .../com/baidu/hugegraph/testutil/Assert.java | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/testutil/Assert.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/testutil/Assert.java index 537e9d60ab..333002d609 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/testutil/Assert.java +++ b/hugegraph-common/src/main/java/com/baidu/hugegraph/testutil/Assert.java @@ -19,6 +19,7 @@ package com.baidu.hugegraph.testutil; +import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; import java.util.function.Function; @@ -40,7 +41,8 @@ public interface ThrowableConsumer { public static void assertThrows(Class throwable, ThrowableRunnable runnable) { - assertThrows(throwable, runnable, e -> { + CompletableFuture future = assertThrowsFuture(throwable, runnable); + future.thenAccept(e -> { System.err.println(e); }); } @@ -48,23 +50,34 @@ public static void assertThrows(Class throwable, public static void assertThrows(Class throwable, ThrowableRunnable runnable, Consumer exceptionConsumer) { + CompletableFuture future = assertThrowsFuture(throwable, + runnable); + future.thenAccept(exceptionConsumer); + } + + public static CompletableFuture assertThrowsFuture( + Class clazz, + ThrowableRunnable runnable) { + CompletableFuture future = new CompletableFuture<>(); boolean fail = false; try { runnable.run(); fail = true; } catch (Throwable e) { - if (!throwable.isInstance(e)) { + if (!clazz.isInstance(e)) { Assert.fail(String.format( "Bad exception type %s(expected %s)", - e.getClass().getName(), throwable.getName())); + e.getClass().getName(), clazz.getName())); } - exceptionConsumer.accept(e); + future.complete(e); } if (fail) { - Assert.fail(String.format( - "No exception was thrown(expected %s)", - throwable.getName())); + String msg = String.format("No exception was thrown(expected %s)", + clazz.getName()); + future.completeExceptionally(new AssertionError(msg)); + Assert.fail(msg); } + return future; } public static void assertEquals(byte expected, Object actual) { From 4af14a99987526e413a795dde045597c15eb7a65 Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Fri, 27 May 2022 14:21:09 +0800 Subject: [PATCH 171/217] add Cnm and Anm to CollectionUtil (#101) * add Cmn to CollectionUtil Change-Id: I873e5c41229a8743ca5753d11c3b5e608b2e9298 * add Anm function Change-Id: Idcb24ba80c61fb53c9744d7ab5d2a379e16a4ad3 --- .../baidu/hugegraph/util/CollectionUtil.java | 215 ++++++++++++++++++ .../unit/util/CollectionUtilTest.java | 154 +++++++++++++ 2 files changed, 369 insertions(+) diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java index 85ab87ca37..6b6d638452 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java +++ b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java @@ -20,9 +20,11 @@ package com.baidu.hugegraph.util; import java.lang.reflect.Array; +import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.Deque; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedHashSet; @@ -30,6 +32,7 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.ThreadLocalRandom; +import java.util.function.Function; public final class CollectionUtil { @@ -236,4 +239,216 @@ public static > Map sortByValue( } return result; } + + /** + * Cross combine the A(n, n) combinations of each part in parts + * @param parts a list of part, like [{a,b}, {1,2}, {x,y}] + * @return List> all combinations like + * [{a,b,1,2,x,y}, {a,b,1,2,y,x}, {a,b,2,1,x,y}, {a,b,2,1,y,x}...] + */ + public static List> crossCombineParts(List> parts) { + List> results = new ArrayList<>(); + Deque> selected = new ArrayDeque<>(); + crossCombineParts(parts, 0, selected, results); + return results; + } + + private static void crossCombineParts(List> parts, + int level, + Deque> selected, + List> results) { + assert level < parts.size(); + List part = parts.get(level); + for (List combination : anm(part)) { + selected.addLast(combination); + + if (level < parts.size() - 1) { + crossCombineParts(parts, level + 1, selected, results); + } else if (level == parts.size() - 1) { + results.add(flatToList(selected)); + } + + selected.removeLast(); + } + } + + private static List flatToList(Deque> parts) { + List list = new ArrayList<>(); + for (List part : parts) { + list.addAll(part); + } + return list; + } + + /** + * Traverse C(n, m) combinations of a list + * @param all list to contain all items for combination + * @param n m of C(n, m) + * @param m n of C(n, m) + * @return List> all combinations + */ + public static List> cnm(List all, int n, int m) { + List> combs = new ArrayList<>(); + cnm(all, n, m, comb -> { + combs.add(comb); + return false; + }); + return combs; + } + + /** + * Traverse C(n, m) combinations of a list to find first matched + * result combination and call back with the result. + * @param all list to contain all items for combination + * @param n m of C(n, m) + * @param m n of C(n, m) + * @return true if matched any kind of items combination else false, the + * callback can always return false if want to traverse all combinations + */ + public static boolean cnm(List all, int n, int m, + Function, Boolean> callback) { + return cnm(all, n, m, 0, null, callback); + } + + /** + * Traverse C(n, m) combinations of a list to find first matched + * result combination and call back with the result. + * @param all list to contain all items for combination + * @param n n of C(n, m) + * @param m m of C(n, m) + * @param current current position in list + * @param selected list to contains selected items + * @return true if matched any kind of items combination else false, the + * callback can always return false if want to traverse all combinations + */ + private static boolean cnm(List all, int n, int m, + int current, List selected, + Function, Boolean> callback) { + assert n <= all.size(); + assert m <= n; + assert current <= all.size(); + if (selected == null) { + selected = new ArrayList<>(m); + } + + if (m == 0) { + assert selected.size() > 0 : selected; + // All n items are selected + List tmpResult = Collections.unmodifiableList(selected); + return callback.apply(tmpResult); + } + if (n == m) { + // No choice, select all n items, we don't update the `result` here + List tmpResult = new ArrayList<>(selected); + tmpResult.addAll(all.subList(current, all.size())); + return callback.apply(tmpResult); + } + + if (current >= all.size()) { + // Reach the end of items + return false; + } + + // Select current item, continue to select C(m-1, n-1) + int index = selected.size(); + selected.add(all.get(current)); + ++current; + if (cnm(all, n - 1, m - 1, current, selected, callback)) { + // NOTE: we can pop the tailing items if want to keep result clear + return true; + } + // Not select current item, pop it and continue to select C(m-1, n) + selected.remove(index); + assert selected.size() == index : selected; + if (cnm(all, n - 1, m, current, selected, callback)) { + return true; + } + + return false; + } + + /** + * Traverse A(n, m) combinations of a list with n = m = all.size() + * @param all list to contain all items for combination + * @return List> all combinations + */ + public static List> anm(List all) { + return anm(all, all.size(), all.size()); + } + + /** + * Traverse A(n, m) combinations of a list + * @param all list to contain all items for combination + * @param n m of A(n, m) + * @param m n of A(n, m) + * @return List> all combinations + */ + public static List> anm(List all, int n, int m) { + List> combs = new ArrayList<>(); + anm(all, n, m, comb -> { + combs.add(comb); + return false; + }); + return combs; + } + + /** + * Traverse A(n, m) combinations of a list to find first matched + * result combination and call back with the result. + * @param all list to contain all items for combination + * @param n m of A(n, m) + * @param m n of A(n, m) + * @return true if matched any kind of items combination else false, the + * callback can always return false if want to traverse all combinations + */ + public static boolean anm(List all, int n, int m, + Function, Boolean> callback) { + return anm(all, n, m, null, callback); + } + + /** + * Traverse A(n, m) combinations of a list to find first matched + * result combination and call back with the result. + * @param all list to contain all items for combination + * @param n m of A(n, m) + * @param m n of A(n, m) + * @param selected list to contains selected items + * @return true if matched any kind of items combination else false, the + * callback can always return false if want to traverse all combinations + */ + private static boolean anm(List all, int n, int m, + List selected, + Function, Boolean> callback) { + assert n <= all.size(); + assert m <= n; + if (selected == null) { + selected = new ArrayList<>(m); + } + + if (m == 0) { + // All n items are selected + List tmpResult = new ArrayList<>(); + for (int i : selected) { + tmpResult.add(all.get(i)); + } + return callback.apply(tmpResult); + } + + for (int i = 0; i < all.size(); i++) { + if (selected.contains(i)) { + continue; + } + int index = selected.size(); + selected.add(i); + + // Select current item, continue to select A(m-1, n-1) + if (anm(all, n - 1, m - 1, selected, callback)) { + return true; + } + + selected.remove(index); + assert selected.size() == index : selected; + } + return false; + } } diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java index a1e47501c4..72fc01e716 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java +++ b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java @@ -417,4 +417,158 @@ public void testMapSortByStringValue() { Assert.assertEquals(ImmutableList.of("E", "D", "C", "B", "A"), ImmutableList.copyOf(decrOrdered.values())); } + + @Test + public void testCrossCombineParts() { + List> parts; + + parts = ImmutableList.of(ImmutableList.of("a", "b"), + ImmutableList.of(1, 2), + ImmutableList.of('x', 'y')); + List> combs = CollectionUtil.crossCombineParts(parts); + Assert.assertEquals(8, combs.size()); + Assert.assertEquals(ImmutableList.of( + ImmutableList.of("a", "b", 1, 2, 'x', 'y'), + ImmutableList.of("a", "b", 1, 2, 'y', 'x'), + ImmutableList.of("a", "b", 2, 1, 'x', 'y'), + ImmutableList.of("a", "b", 2, 1, 'y', 'x'), + ImmutableList.of("b", "a", 1, 2, 'x', 'y'), + ImmutableList.of("b", "a", 1, 2, 'y', 'x'), + ImmutableList.of("b", "a", 2, 1, 'x', 'y'), + ImmutableList.of("b", "a", 2, 1, 'y', 'x')), + combs); + + parts = ImmutableList.of(ImmutableList.of("a", "b", "c"), + ImmutableList.of(1, 2), + ImmutableList.of('x', 'y')); + Assert.assertEquals(24, + CollectionUtil.crossCombineParts(parts).size()); + + parts = ImmutableList.of(ImmutableList.of("a", "b", "c"), + ImmutableList.of(1, 2, 3), + ImmutableList.of('x', 'y')); + Assert.assertEquals(72, + CollectionUtil.crossCombineParts(parts).size()); + + parts = ImmutableList.of(ImmutableList.of("a", "b", "c"), + ImmutableList.of(1, 2, 3), + ImmutableList.of('x', 'y', 'z')); + Assert.assertEquals(216, + CollectionUtil.crossCombineParts(parts).size()); + } + + @Test + public void testCnm() { + List list = ImmutableList.of(1, 2, 3, 4, 5); + + // Test C(5, 2) with all combinations + List> tuples = new ArrayList<>(); + boolean found; + found = CollectionUtil.cnm(list, list.size(), 2, tuple -> { + tuples.add(new ArrayList<>(tuple)); + return false; + }); + Assert.assertFalse(found); + Assert.assertEquals(10, tuples.size()); + + Assert.assertEquals(10, + CollectionUtil.cnm(list, list.size(), 2).size()); + + // Test C(5, 2) with one combination + tuples.clear(); + found = CollectionUtil.cnm(list, list.size(), 2, tuple -> { + if (tuple.equals(ImmutableList.of(2, 3))) { + tuples.add(new ArrayList<>(tuple)); + return true; + } + return false; + }); + Assert.assertTrue(found); + Assert.assertEquals(1, tuples.size()); + Assert.assertEquals(ImmutableList.of(2, 3), tuples.get(0)); + + // Test C(5, 3) with all combinations + List> triples = new ArrayList<>(); + found = CollectionUtil.cnm(list, list.size(), 3, triple -> { + triples.add(new ArrayList<>(triple)); + return false; + }); + Assert.assertFalse(found); + Assert.assertEquals(10, triples.size()); + + Assert.assertEquals(10, + CollectionUtil.cnm(list, list.size(), 3).size()); + + // Test C(5, 3) with one combination + triples.clear(); + found = CollectionUtil.cnm(list, list.size(), 3, triple -> { + if (triple.equals(ImmutableList.of(2, 3, 5))) { + triples.add(new ArrayList<>(triple)); + return true; + } + return false; + }); + Assert.assertTrue(found); + Assert.assertEquals(1, triples.size()); + Assert.assertEquals(ImmutableList.of(2, 3, 5), triples.get(0)); + } + + @Test + public void testAnm() { + List list = ImmutableList.of(1, 2, 3, 4, 5); + + // Test A(5, 5) with all combinations + Assert.assertEquals(120, CollectionUtil.anm(list).size()); + + // Test A(5, 2) with all combinations + List> tuples = new ArrayList<>(); + boolean found; + found = CollectionUtil.anm(list, list.size(), 2, tuple -> { + tuples.add(new ArrayList<>(tuple)); + return false; + }); + Assert.assertFalse(found); + Assert.assertEquals(20, tuples.size()); + + Assert.assertEquals(20, + CollectionUtil.anm(list, list.size(), 2).size()); + + // Test A(5, 2) with one combination + tuples.clear(); + found = CollectionUtil.anm(list, list.size(), 2, tuple -> { + if (tuple.equals(ImmutableList.of(2, 3))) { + tuples.add(new ArrayList<>(tuple)); + return true; + } + return false; + }); + Assert.assertTrue(found); + Assert.assertEquals(1, tuples.size()); + Assert.assertEquals(ImmutableList.of(2, 3), tuples.get(0)); + + // Test A(5, 3) with all combinations + List> triples = new ArrayList<>(); + found = CollectionUtil.anm(list, list.size(), 3, triple -> { + triples.add(new ArrayList<>(triple)); + return false; + }); + Assert.assertFalse(found); + Assert.assertEquals(60, triples.size()); + + Assert.assertEquals(60, + CollectionUtil.anm(list, list.size(), 3).size()); + + // Test A(5, 3) with one combination + triples.clear(); + found = CollectionUtil.anm(list, list.size(), 3, triple -> { + if (triple.equals(ImmutableList.of(2, 3, 5))) { + triples.add(new ArrayList<>(triple)); + return true; + } + return false; + }); + Assert.assertTrue(found); + Assert.assertEquals(1, triples.size()); + Assert.assertEquals(ImmutableList.of(2, 3, 5), triples.get(0)); + } } From 745bd861af737abe553703bd988f5f0438e26174 Mon Sep 17 00:00:00 2001 From: imbajin Date: Tue, 7 Jun 2022 09:54:42 +0800 Subject: [PATCH 172/217] chore: use .asf.yaml for apache workflow rule (#98) * add asf.yaml file * Update .asf.yaml * add required --- .asf.yaml | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .asf.yaml diff --git a/.asf.yaml b/.asf.yaml new file mode 100644 index 0000000000..a254285792 --- /dev/null +++ b/.asf.yaml @@ -0,0 +1,51 @@ +# +# 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. +# + +github: + features: + # Enable issue management + issues: true + # Enable wiki for documentation + wiki: false + # Enable projects for project management boards + projects: false + description: HugeGraph Commons - include common library & RPC module + homepage: https://hugegraph.apache.org/ + del_branch_on_merge: true + #labels: + + enabled_merge_buttons: + merge: false + squash: true + rebase: false + protected_branches: + master: + required_status_checks: + # strict means "Require branches to be up to date before merging". + strict: true + # contexts are the names of checks that must pass + contexts: + - build (8) + - build (11) + required_pull_request_reviews: + dismiss_stale_reviews: true + require_code_owner_reviews: false + required_approving_review_count: 2 + +notifications: + issues: dev@hugegraph.apache.org + pullrequests: commits@hugegraph.apache.org From 09b18191edef50dc24079bc3a61aaee06a0f3993 Mon Sep 17 00:00:00 2001 From: seagle Date: Mon, 13 Jun 2022 20:37:54 +0800 Subject: [PATCH 173/217] update checkstyle (#97) Co-authored-by: yuanbingze Co-authored-by: imbajin --- checkstyle.xml | 89 ---------------- hugegraph-common/pom.xml | 22 ---- hugegraph-rpc/pom.xml | 24 ----- pom.xml | 13 ++- style/checkstyle.xml | 218 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 229 insertions(+), 137 deletions(-) delete mode 100644 checkstyle.xml create mode 100644 style/checkstyle.xml diff --git a/checkstyle.xml b/checkstyle.xml deleted file mode 100644 index 9373a70d91..0000000000 --- a/checkstyle.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hugegraph-common/pom.xml b/hugegraph-common/pom.xml index 871b98e34c..1c3637bfba 100644 --- a/hugegraph-common/pom.xml +++ b/hugegraph-common/pom.xml @@ -207,28 +207,6 @@ - - org.apache.maven.plugins - maven-checkstyle-plugin - 3.1.0 - - ../checkstyle.xml - UTF-8 - true - true - false - false - - - - validate - validate - - check - - - - org.apache.maven.plugins maven-jar-plugin diff --git a/hugegraph-rpc/pom.xml b/hugegraph-rpc/pom.xml index 43fcff4d12..2c2d1c1b1a 100644 --- a/hugegraph-rpc/pom.xml +++ b/hugegraph-rpc/pom.xml @@ -100,30 +100,6 @@ - - - org.apache.maven.plugins - maven-checkstyle-plugin - 3.1.0 - - ../checkstyle.xml - UTF-8 - true - true - false - false - - - - validate - validate - - check - - - - - org.apache.maven.plugins maven-jar-plugin diff --git a/pom.xml b/pom.xml index 7bb8fc4cce..2a5c1e9a0c 100644 --- a/pom.xml +++ b/pom.xml @@ -61,6 +61,8 @@ 4.1.0 4.0.0-RC2 3.0.2 + 3.1.2 + 8.45 2.1.2.0 @@ -88,9 +90,16 @@ org.apache.maven.plugins maven-checkstyle-plugin - 3.1.0 + ${checkstyle.plugin.version} + + + com.puppycrawl.tools + checkstyle + ${checkstyle.version} + + - checkstyle.xml + style/checkstyle.xml UTF-8 true true diff --git a/style/checkstyle.xml b/style/checkstyle.xml new file mode 100644 index 0000000000..c2429281af --- /dev/null +++ b/style/checkstyle.xml @@ -0,0 +1,218 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 42ef9c4d955d7634e9381c1552cc4766a3cf6a5e Mon Sep 17 00:00:00 2001 From: "DamonXue(Fibonacci)" Date: Tue, 6 Sep 2022 19:14:59 +0800 Subject: [PATCH 174/217] chore: upgrade CodeQL version to v2 (#106) --- .github/workflows/codeql-analysis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index df4d6117cb..be695d8142 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -31,7 +31,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v2 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -42,7 +42,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v1 + uses: github/codeql-action/autobuild@v2 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -56,4 +56,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v2 From 3b1bcb1a99851b85adf56575420de153889ba482 Mon Sep 17 00:00:00 2001 From: ShouJing Date: Thu, 8 Sep 2022 17:28:03 +0800 Subject: [PATCH 175/217] rename package name `com.baidu` to `org.apache` (#104) --- README.md | 2 +- hugegraph-common/README.md | 2 +- .../hugegraph/concurrent/AtomicLock.java | 5 +- .../hugegraph/concurrent/BarrierEvent.java | 4 +- .../apache}/hugegraph/concurrent/KeyLock.java | 4 +- .../hugegraph/concurrent/LockGroup.java | 2 +- .../hugegraph/concurrent/LockManager.java | 2 +- .../PausableScheduledThreadPool.java | 5 +- .../apache}/hugegraph/concurrent/RowLock.java | 4 +- .../hugegraph/config/ConfigConvOption.java | 4 +- .../hugegraph/config/ConfigException.java | 2 +- .../config/ConfigListConvOption.java | 4 +- .../hugegraph/config/ConfigListOption.java | 4 +- .../hugegraph/config/ConfigOption.java | 2 +- .../apache}/hugegraph/config/HugeConfig.java | 6 +- .../hugegraph/config/OptionChecker.java | 2 +- .../hugegraph/config/OptionHolder.java | 5 +- .../apache}/hugegraph/config/OptionSpace.java | 7 +- .../apache}/hugegraph/config/TypedOption.java | 6 +- .../hugegraph/date/SafeDateFormat.java | 2 +- .../apache}/hugegraph/event/Event.java | 4 +- .../apache}/hugegraph/event/EventHub.java | 10 +- .../hugegraph/event/EventListener.java | 2 +- .../apache}/hugegraph/func/TriFunction.java | 2 +- .../iterator/BatchMapperIterator.java | 6 +- .../apache}/hugegraph/iterator/CIter.java | 2 +- .../iterator/ExtendableIterator.java | 4 +- .../hugegraph/iterator/FilterIterator.java | 2 +- .../iterator/FlatMapperFilterIterator.java | 4 +- .../iterator/FlatMapperIterator.java | 4 +- .../hugegraph/iterator/LimitIterator.java | 2 +- .../hugegraph/iterator/ListIterator.java | 4 +- .../hugegraph/iterator/MapperIterator.java | 2 +- .../hugegraph/iterator/Metadatable.java | 2 +- .../hugegraph/iterator/WrappedIterator.java | 2 +- .../hugegraph/license/LicenseCommonParam.java | 2 +- .../hugegraph/license/LicenseCreateParam.java | 2 +- .../hugegraph/license/LicenseExtraParam.java | 2 +- .../license/LicenseInstallParam.java | 2 +- .../hugegraph/license/LicenseManager.java | 2 +- .../license/LicenseManagerFactory.java | 4 +- .../hugegraph/license/LicenseParams.java | 2 +- .../hugegraph/license/MachineInfo.java | 2 +- .../hugegraph/perf/LightStopwatch.java | 4 +- .../hugegraph/perf/NormalStopwatch.java | 14 +- .../apache}/hugegraph/perf/PerfUtil.java | 21 +-- .../apache}/hugegraph/perf/Stopwatch.java | 2 +- .../hugegraph/rest/AbstractRestClient.java | 6 +- .../hugegraph/rest/ClientException.java | 2 +- .../apache}/hugegraph/rest/RestClient.java | 2 +- .../apache}/hugegraph/rest/RestResult.java | 2 +- .../hugegraph/rest/SerializeException.java | 2 +- .../apache}/hugegraph/testutil/Assert.java | 2 +- .../apache}/hugegraph/testutil/Whitebox.java | 4 +- .../apache}/hugegraph/util/Bytes.java | 2 +- .../apache}/hugegraph/util/CheckSocket.java | 2 +- .../hugegraph/util/CollectionUtil.java | 2 +- .../apache}/hugegraph/util/DateUtil.java | 4 +- .../apache}/hugegraph/util/E.java | 2 +- .../apache}/hugegraph/util/ExecutorUtil.java | 4 +- .../apache}/hugegraph/util/HashUtil.java | 2 +- .../hugegraph/util/InsertionOrderUtil.java | 2 +- .../apache}/hugegraph/util/Log.java | 2 +- .../apache}/hugegraph/util/LongEncoding.java | 2 +- .../apache}/hugegraph/util/NumericUtil.java | 2 +- .../apache}/hugegraph/util/OrderLimitMap.java | 2 +- .../hugegraph/util/ReflectionUtil.java | 4 +- .../apache}/hugegraph/util/StringUtil.java | 2 +- .../apache}/hugegraph/util/TimeUtil.java | 2 +- .../apache}/hugegraph/util/UnitUtil.java | 2 +- .../apache}/hugegraph/util/VersionUtil.java | 2 +- .../hugegraph/version/CommonVersion.java | 7 +- .../baidu/hugegraph/unit/UnitTestSuite.java | 127 ------------------ .../hugegraph/testutil/AssertTest.java | 4 +- .../hugegraph/testutil/WhiteboxTest.java | 2 +- .../apache}/hugegraph/unit/BaseUnitTest.java | 5 +- .../apache/hugegraph/unit/UnitTestSuite.java | 127 ++++++++++++++++++ .../unit/concurrent/AtomicLockTest.java | 8 +- .../unit/concurrent/BarrierEventTest.java | 6 +- .../unit/concurrent/KeyLockTest.java | 8 +- .../unit/concurrent/LockGroupTest.java | 14 +- .../unit/concurrent/LockManagerTest.java | 10 +- .../PausableScheduledThreadPoolTest.java | 6 +- .../unit/concurrent/RowLockTest.java | 8 +- .../hugegraph/unit/config/HugeConfigTest.java | 41 +++--- .../unit/config/OptionSpaceTest.java | 16 +-- .../unit/config/test-check-error.conf | 0 .../unit/config/test-list-error.conf | 0 .../unit/config/test-type-error.conf | 0 .../apache}/hugegraph/unit/config/test.conf | 0 .../unit/date/SafeDateFormatTest.java | 6 +- .../hugegraph/unit/event/EventHubTest.java | 13 +- .../iterator/BatchMapperIteratorTest.java | 10 +- .../unit/iterator/ExtendableIteratorTest.java | 8 +- .../unit/iterator/FilterIteratorTest.java | 10 +- .../FlatMapperFilterIteratorTest.java | 10 +- .../unit/iterator/FlatMapperIteratorTest.java | 10 +- .../unit/iterator/LimitIteratorTest.java | 10 +- .../unit/iterator/ListIteratorTest.java | 10 +- .../unit/iterator/MapperIteratorTest.java | 10 +- .../unit/license/LicenseCreateParamTest.java | 8 +- .../unit/license/LicenseExtraParamTest.java | 6 +- .../unit/license/LicenseInstallParamTest.java | 6 +- .../unit/license/LicenseParamsTest.java | 8 +- .../unit/license/MachineInfoTest.java | 6 +- .../hugegraph/unit/perf/PerfUtilTest.java | 23 ++-- .../hugegraph/unit/perf/StopwatchTest.java | 14 +- .../unit/perf/testclass/TestClass.java | 6 +- .../unit/perf/testclass/TestLightClass.java | 4 +- .../unit/perf/testclass/TestPerfClass.java | 4 +- .../perf/testclass/TestPerfLightClass.java | 6 +- .../perf/testclass2/TestClass4Package.java | 4 +- .../hugegraph/unit/rest/RestClientTest.java | 27 ++-- .../hugegraph/unit/rest/RestResultTest.java | 9 +- .../hugegraph/unit/util/BytesTest.java | 10 +- .../unit/util/CollectionUtilTest.java | 8 +- .../hugegraph/unit/util/DateUtilTest.java | 8 +- .../hugegraph/unit/util/EcheckTest.java | 8 +- .../hugegraph/unit/util/HashUtilTest.java | 10 +- .../unit/util/InsertionOrderUtilTest.java | 8 +- .../apache}/hugegraph/unit/util/LogTest.java | 12 +- .../hugegraph/unit/util/LongEncodingTest.java | 12 +- .../hugegraph/unit/util/NumericUtilTest.java | 10 +- .../unit/util/OrderLimitMapTest.java | 6 +- .../unit/util/ReflectionUtilTest.java | 63 ++++----- .../hugegraph/unit/util/StringUtilTest.java | 8 +- .../hugegraph/unit/util/TimeUtilTest.java | 8 +- .../hugegraph/unit/util/UnitUtilTest.java | 8 +- .../hugegraph/unit/util/VersionUtilTest.java | 22 +-- .../hugegraph/unit/version/VersionTest.java | 8 +- .../src/test/resources/log4j2.xml | 2 +- hugegraph-rpc/pom.xml | 6 +- .../apache}/hugegraph/config/RpcOptions.java | 11 +- .../hugegraph/rpc/RpcClientProvider.java | 8 +- .../hugegraph/rpc/RpcCommonConfig.java | 6 +- .../hugegraph/rpc/RpcConsumerConfig.java | 8 +- .../apache}/hugegraph/rpc/RpcException.java | 2 +- .../hugegraph/rpc/RpcProviderConfig.java | 4 +- .../apache}/hugegraph/rpc/RpcServer.java | 14 +- .../rpc/RpcServiceConfig4Client.java | 2 +- .../rpc/RpcServiceConfig4Server.java | 2 +- .../apache}/hugegraph/version/RpcVersion.java | 7 +- .../apache}/hugegraph/unit/BaseUnitTest.java | 10 +- .../apache}/hugegraph/unit/ExceptionTest.java | 6 +- .../hugegraph/unit/ServerClientTest.java | 29 ++-- .../apache}/hugegraph/unit/UnitTestSuite.java | 2 +- .../apache}/hugegraph/unit/VersionTest.java | 8 +- hugegraph-rpc/src/test/resources/log4j2.xml | 2 +- pom.xml | 3 +- 149 files changed, 601 insertions(+), 602 deletions(-) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/concurrent/AtomicLock.java (97%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/concurrent/BarrierEvent.java (97%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/concurrent/KeyLock.java (98%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/concurrent/LockGroup.java (98%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/concurrent/LockManager.java (98%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/concurrent/PausableScheduledThreadPool.java (96%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/concurrent/RowLock.java (97%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/config/ConfigConvOption.java (95%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/config/ConfigException.java (97%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/config/ConfigListConvOption.java (97%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/config/ConfigListOption.java (97%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/config/ConfigOption.java (97%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/config/HugeConfig.java (98%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/config/OptionChecker.java (99%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/config/OptionHolder.java (96%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/config/OptionSpace.java (97%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/config/TypedOption.java (98%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/date/SafeDateFormat.java (98%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/event/Event.java (96%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/event/EventHub.java (96%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/event/EventListener.java (96%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/func/TriFunction.java (96%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/iterator/BatchMapperIterator.java (96%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/iterator/CIter.java (96%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/iterator/ExtendableIterator.java (97%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/iterator/FilterIterator.java (97%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/iterator/FlatMapperFilterIterator.java (96%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/iterator/FlatMapperIterator.java (97%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/iterator/LimitIterator.java (98%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/iterator/ListIterator.java (96%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/iterator/MapperIterator.java (97%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/iterator/Metadatable.java (95%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/iterator/WrappedIterator.java (98%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/license/LicenseCommonParam.java (98%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/license/LicenseCreateParam.java (97%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/license/LicenseExtraParam.java (98%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/license/LicenseInstallParam.java (97%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/license/LicenseManager.java (96%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/license/LicenseManagerFactory.java (91%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/license/LicenseParams.java (97%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/license/MachineInfo.java (99%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/perf/LightStopwatch.java (98%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/perf/NormalStopwatch.java (95%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/perf/PerfUtil.java (97%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/perf/Stopwatch.java (99%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/rest/AbstractRestClient.java (99%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/rest/ClientException.java (97%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/rest/RestClient.java (98%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/rest/RestResult.java (99%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/rest/SerializeException.java (97%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/testutil/Assert.java (99%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/testutil/Whitebox.java (98%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/util/Bytes.java (98%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/util/CheckSocket.java (98%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/util/CollectionUtil.java (99%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/util/DateUtil.java (97%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/util/E.java (98%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/util/ExecutorUtil.java (96%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/util/HashUtil.java (97%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/util/InsertionOrderUtil.java (98%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/util/Log.java (96%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/util/LongEncoding.java (99%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/util/NumericUtil.java (99%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/util/OrderLimitMap.java (98%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/util/ReflectionUtil.java (98%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/util/StringUtil.java (99%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/util/TimeUtil.java (98%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/util/UnitUtil.java (99%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/util/VersionUtil.java (99%) rename hugegraph-common/src/main/java/{com/baidu => org/apache}/hugegraph/version/CommonVersion.java (86%) delete mode 100644 hugegraph-common/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/testutil/AssertTest.java (99%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/testutil/WhiteboxTest.java (99%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/BaseUnitTest.java (96%) create mode 100644 hugegraph-common/src/test/java/org/apache/hugegraph/unit/UnitTestSuite.java rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/concurrent/AtomicLockTest.java (91%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/concurrent/BarrierEventTest.java (98%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/concurrent/KeyLockTest.java (95%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/concurrent/LockGroupTest.java (90%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/concurrent/LockManagerTest.java (94%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java (95%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/concurrent/RowLockTest.java (96%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/config/HugeConfigTest.java (95%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/config/OptionSpaceTest.java (94%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/config/test-check-error.conf (100%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/config/test-list-error.conf (100%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/config/test-type-error.conf (100%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/config/test.conf (100%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/date/SafeDateFormatTest.java (97%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/event/EventHubTest.java (98%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/iterator/BatchMapperIteratorTest.java (97%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/iterator/ExtendableIteratorTest.java (97%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/iterator/FilterIteratorTest.java (95%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java (95%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/iterator/FlatMapperIteratorTest.java (95%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/iterator/LimitIteratorTest.java (95%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/iterator/ListIteratorTest.java (97%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/iterator/MapperIteratorTest.java (94%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/license/LicenseCreateParamTest.java (95%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/license/LicenseExtraParamTest.java (94%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/license/LicenseInstallParamTest.java (93%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/license/LicenseParamsTest.java (94%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/license/MachineInfoTest.java (95%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/perf/PerfUtilTest.java (95%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/perf/StopwatchTest.java (92%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/perf/testclass/TestClass.java (94%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/perf/testclass/TestLightClass.java (92%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/perf/testclass/TestPerfClass.java (94%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/perf/testclass/TestPerfLightClass.java (92%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/perf/testclass2/TestClass4Package.java (93%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/rest/RestClientTest.java (98%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/rest/RestResultTest.java (96%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/util/BytesTest.java (96%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/util/CollectionUtilTest.java (99%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/util/DateUtilTest.java (96%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/util/EcheckTest.java (96%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/util/HashUtilTest.java (94%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/util/InsertionOrderUtilTest.java (96%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/util/LogTest.java (79%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/util/LongEncodingTest.java (98%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/util/NumericUtilTest.java (98%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/util/OrderLimitMapTest.java (98%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/util/ReflectionUtilTest.java (74%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/util/StringUtilTest.java (97%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/util/TimeUtilTest.java (95%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/util/UnitUtilTest.java (99%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/util/VersionUtilTest.java (92%) rename hugegraph-common/src/test/java/{com/baidu => org/apache}/hugegraph/unit/version/VersionTest.java (86%) rename hugegraph-rpc/src/main/java/{com/baidu => org/apache}/hugegraph/config/RpcOptions.java (94%) rename hugegraph-rpc/src/main/java/{com/baidu => org/apache}/hugegraph/rpc/RpcClientProvider.java (94%) rename hugegraph-rpc/src/main/java/{com/baidu => org/apache}/hugegraph/rpc/RpcCommonConfig.java (92%) rename hugegraph-rpc/src/main/java/{com/baidu => org/apache}/hugegraph/rpc/RpcConsumerConfig.java (98%) rename hugegraph-rpc/src/main/java/{com/baidu => org/apache}/hugegraph/rpc/RpcException.java (97%) rename hugegraph-rpc/src/main/java/{com/baidu => org/apache}/hugegraph/rpc/RpcProviderConfig.java (97%) rename hugegraph-rpc/src/main/java/{com/baidu => org/apache}/hugegraph/rpc/RpcServer.java (95%) rename hugegraph-rpc/src/main/java/{com/baidu => org/apache}/hugegraph/rpc/RpcServiceConfig4Client.java (97%) rename hugegraph-rpc/src/main/java/{com/baidu => org/apache}/hugegraph/rpc/RpcServiceConfig4Server.java (97%) rename hugegraph-rpc/src/main/java/{com/baidu => org/apache}/hugegraph/version/RpcVersion.java (86%) rename hugegraph-rpc/src/test/java/{com/baidu => org/apache}/hugegraph/unit/BaseUnitTest.java (86%) rename hugegraph-rpc/src/test/java/{com/baidu => org/apache}/hugegraph/unit/ExceptionTest.java (93%) rename hugegraph-rpc/src/test/java/{com/baidu => org/apache}/hugegraph/unit/ServerClientTest.java (97%) rename hugegraph-rpc/src/test/java/{com/baidu => org/apache}/hugegraph/unit/UnitTestSuite.java (96%) rename hugegraph-rpc/src/test/java/{com/baidu => org/apache}/hugegraph/unit/VersionTest.java (87%) diff --git a/README.md b/README.md index 3d669ebad8..5196b4328a 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![License](https://img.shields.io/badge/license-Apache%202-0E78BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) [![codecov](https://codecov.io/gh/hugegraph/hugegraph-common/branch/master/graph/badge.svg)](https://codecov.io/gh/hugegraph/hugegraph-common) -[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.baidu.hugegraph/hugegraph-common/badge.svg)](https://mvnrepository.com/artifact/com.baidu.hugegraph/hugegraph-common) +[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.apache.hugegraph/hugegraph-common/badge.svg)](https://mvnrepository.com/artifact/org.apache.hugegraph/hugegraph-common) hugegraph-commons is a common module for [HugeGraph](https://github.com/hugegraph/hugegraph) and its peripheral components. hugegraph-commons encapsulates locks, configurations, events, iterators, rest and some diff --git a/hugegraph-common/README.md b/hugegraph-common/README.md index d3115240d7..ca2f80d752 100644 --- a/hugegraph-common/README.md +++ b/hugegraph-common/README.md @@ -3,7 +3,7 @@ [![License](https://img.shields.io/badge/license-Apache%202-0E78BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) [![Build Status](https://travis-ci.org/hugegraph/hugegraph-common.svg?branch=master)](https://travis-ci.org/hugegraph/hugegraph-common) [![codecov](https://codecov.io/gh/hugegraph/hugegraph-common/branch/master/graph/badge.svg)](https://codecov.io/gh/hugegraph/hugegraph-common) -[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.baidu.hugegraph/hugegraph-common/badge.svg)](https://mvnrepository.com/artifact/com.baidu.hugegraph/hugegraph-common) +[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.apache.hugegraph/hugegraph-common/badge.svg)](https://mvnrepository.com/artifact/org.apache.hugegraph/hugegraph-common) hugegraph-common is a common module for [HugeGraph](https://github.com/hugegraph/hugegraph) and its peripheral components. hugegraph-common encapsulates locks, configurations, events, iterators, rest and some diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/AtomicLock.java similarity index 97% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/AtomicLock.java index 8316065158..7c9a4c0aac 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/AtomicLock.java @@ -17,14 +17,13 @@ * under the License. */ -package com.baidu.hugegraph.concurrent; +package org.apache.hugegraph.concurrent; import java.util.concurrent.atomic.AtomicReference; +import org.apache.hugegraph.util.Log; import org.slf4j.Logger; -import com.baidu.hugegraph.util.Log; - public class AtomicLock { private static final Logger LOG = Log.logger(LockManager.class); diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/BarrierEvent.java b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/BarrierEvent.java similarity index 97% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/BarrierEvent.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/BarrierEvent.java index b6ccab932a..1c89d11d04 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/BarrierEvent.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/BarrierEvent.java @@ -18,14 +18,14 @@ * under the License. */ -package com.baidu.hugegraph.concurrent; +package org.apache.hugegraph.concurrent; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; -import com.baidu.hugegraph.util.E; +import org.apache.hugegraph.util.E; public class BarrierEvent { diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/KeyLock.java similarity index 98% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/KeyLock.java index dd8781b47a..eda012b878 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/KeyLock.java @@ -17,14 +17,14 @@ * under the License. */ -package com.baidu.hugegraph.concurrent; +package org.apache.hugegraph.concurrent; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.concurrent.locks.Lock; -import com.baidu.hugegraph.util.E; +import org.apache.hugegraph.util.E; import com.google.common.collect.ImmutableList; import com.google.common.util.concurrent.Striped; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/LockGroup.java similarity index 98% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/LockGroup.java index 7d29c98ed6..17b7347cdf 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/LockGroup.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.concurrent; +package org.apache.hugegraph.concurrent; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/LockManager.java similarity index 98% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/LockManager.java index 299b0011a0..d2c60980da 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/LockManager.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.concurrent; +package org.apache.hugegraph.concurrent; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/PausableScheduledThreadPool.java b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/PausableScheduledThreadPool.java similarity index 96% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/PausableScheduledThreadPool.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/PausableScheduledThreadPool.java index fb5a5f131d..e5dba9fee2 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/PausableScheduledThreadPool.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/PausableScheduledThreadPool.java @@ -17,16 +17,15 @@ * under the License. */ -package com.baidu.hugegraph.concurrent; +package org.apache.hugegraph.concurrent; import java.util.List; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ThreadFactory; +import org.apache.hugegraph.util.Log; import org.slf4j.Logger; -import com.baidu.hugegraph.util.Log; - public class PausableScheduledThreadPool extends ScheduledThreadPoolExecutor { private static final Logger LOG = Log.logger( diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/RowLock.java b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/RowLock.java similarity index 97% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/RowLock.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/RowLock.java index d70d3b5735..1eb18f649c 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/RowLock.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/RowLock.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.concurrent; +package org.apache.hugegraph.concurrent; import java.util.ArrayList; import java.util.Collections; @@ -29,7 +29,7 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; -import com.baidu.hugegraph.util.E; +import org.apache.hugegraph.util.E; public class RowLock> { diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigConvOption.java b/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigConvOption.java similarity index 95% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigConvOption.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigConvOption.java index f67d0e478e..5966176c29 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigConvOption.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigConvOption.java @@ -17,11 +17,11 @@ * under the License. */ -package com.baidu.hugegraph.config; +package org.apache.hugegraph.config; import java.util.function.Function; -import com.baidu.hugegraph.util.E; +import org.apache.hugegraph.util.E; import com.google.common.base.Predicate; public class ConfigConvOption extends TypedOption { diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigException.java b/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigException.java similarity index 97% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigException.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigException.java index aab2efb394..cd7981368c 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigException.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigException.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.config; +package org.apache.hugegraph.config; public class ConfigException extends RuntimeException { diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigListConvOption.java b/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigListConvOption.java similarity index 97% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigListConvOption.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigListConvOption.java index 151fbf92c4..32351b4fa0 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigListConvOption.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigListConvOption.java @@ -17,14 +17,14 @@ * under the License. */ -package com.baidu.hugegraph.config; +package org.apache.hugegraph.config; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.function.Function; -import com.baidu.hugegraph.util.E; +import org.apache.hugegraph.util.E; import com.google.common.base.Predicate; public class ConfigListConvOption extends TypedOption, List> { diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java b/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigListOption.java similarity index 97% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigListOption.java index ff114ccb77..7bba7ec2fd 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigListOption.java @@ -17,14 +17,14 @@ * under the License. */ -package com.baidu.hugegraph.config; +package org.apache.hugegraph.config; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.function.Function; -import com.baidu.hugegraph.util.E; +import org.apache.hugegraph.util.E; import com.google.common.base.Predicate; public class ConfigListOption extends ConfigOption> { diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigOption.java b/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigOption.java similarity index 97% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigOption.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigOption.java index cb958744b4..d85d508aff 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigOption.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigOption.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.config; +package org.apache.hugegraph.config; import com.google.common.base.Predicate; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/HugeConfig.java b/hugegraph-common/src/main/java/org/apache/hugegraph/config/HugeConfig.java similarity index 98% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/config/HugeConfig.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/config/HugeConfig.java index 69f78744f3..b25153d4fc 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/HugeConfig.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/config/HugeConfig.java @@ -17,15 +17,15 @@ * under the License. */ -package com.baidu.hugegraph.config; +package org.apache.hugegraph.config; import java.io.File; import java.util.HashMap; import java.util.List; import java.util.Map; -import com.baidu.hugegraph.util.E; -import com.baidu.hugegraph.util.Log; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.Log; import org.apache.commons.configuration2.Configuration; import org.apache.commons.configuration2.FileBasedConfiguration; import org.apache.commons.configuration2.PropertiesConfiguration; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/OptionChecker.java b/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionChecker.java similarity index 99% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/config/OptionChecker.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionChecker.java index f3e116f419..551fe93c8a 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/OptionChecker.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionChecker.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.config; +package org.apache.hugegraph.config; import java.lang.reflect.Array; import java.util.Arrays; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/OptionHolder.java b/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionHolder.java similarity index 96% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/config/OptionHolder.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionHolder.java index e5c5be6a60..39c0dad94b 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/OptionHolder.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionHolder.java @@ -17,17 +17,16 @@ * under the License. */ -package com.baidu.hugegraph.config; +package org.apache.hugegraph.config; import java.lang.reflect.Field; import java.util.Collections; import java.util.HashMap; import java.util.Map; +import org.apache.hugegraph.util.Log; import org.slf4j.Logger; -import com.baidu.hugegraph.util.Log; - public class OptionHolder { private static final Logger LOG = Log.logger(HugeConfig.class); diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/OptionSpace.java b/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionSpace.java similarity index 97% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/config/OptionSpace.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionSpace.java index 8c1128c1f6..0c4d94aaa3 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/OptionSpace.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionSpace.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.config; +package org.apache.hugegraph.config; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -27,11 +27,10 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.Log; import org.slf4j.Logger; -import com.baidu.hugegraph.util.E; -import com.baidu.hugegraph.util.Log; - public final class OptionSpace { private static final Logger LOG = Log.logger(OptionSpace.class); diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/TypedOption.java b/hugegraph-common/src/main/java/org/apache/hugegraph/config/TypedOption.java similarity index 98% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/config/TypedOption.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/config/TypedOption.java index cd5841bf70..59ed9da3ac 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/config/TypedOption.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/config/TypedOption.java @@ -17,17 +17,17 @@ * under the License. */ -package com.baidu.hugegraph.config; +package org.apache.hugegraph.config; import java.lang.reflect.Method; import java.util.List; import java.util.Set; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.Log; import org.apache.commons.configuration.PropertyConverter; import org.slf4j.Logger; -import com.baidu.hugegraph.util.E; -import com.baidu.hugegraph.util.Log; import com.google.common.base.Joiner; import com.google.common.base.Predicate; import com.google.common.collect.ImmutableSet; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/date/SafeDateFormat.java b/hugegraph-common/src/main/java/org/apache/hugegraph/date/SafeDateFormat.java similarity index 98% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/date/SafeDateFormat.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/date/SafeDateFormat.java index 68cd0089ed..0deba51e62 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/date/SafeDateFormat.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/date/SafeDateFormat.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.date; +package org.apache.hugegraph.date; import java.util.Date; import java.util.TimeZone; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/event/Event.java b/hugegraph-common/src/main/java/org/apache/hugegraph/event/Event.java similarity index 96% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/event/Event.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/event/Event.java index 733fd204e1..fccc1cd8e3 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/event/Event.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/event/Event.java @@ -17,12 +17,12 @@ * under the License. */ -package com.baidu.hugegraph.event; +package org.apache.hugegraph.event; import java.util.Arrays; import java.util.Collections; -import com.baidu.hugegraph.util.E; +import org.apache.hugegraph.util.E; public class Event extends java.util.EventObject { diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/event/EventHub.java b/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventHub.java similarity index 96% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/event/EventHub.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/event/EventHub.java index 5bd08706a2..0e426fcb81 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/event/EventHub.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventHub.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.event; +package org.apache.hugegraph.event; import java.util.Collections; import java.util.List; @@ -31,12 +31,12 @@ import javax.annotation.Nullable; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.ExecutorUtil; +import org.apache.hugegraph.util.Log; import org.slf4j.Logger; -import com.baidu.hugegraph.iterator.ExtendableIterator; -import com.baidu.hugegraph.util.E; -import com.baidu.hugegraph.util.ExecutorUtil; -import com.baidu.hugegraph.util.Log; +import org.apache.hugegraph.iterator.ExtendableIterator; import com.google.common.collect.ImmutableList; public class EventHub { diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/event/EventListener.java b/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventListener.java similarity index 96% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/event/EventListener.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/event/EventListener.java index 71148b24ac..a0deb4c030 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/event/EventListener.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventListener.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.event; +package org.apache.hugegraph.event; public interface EventListener extends java.util.EventListener { /** diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/func/TriFunction.java b/hugegraph-common/src/main/java/org/apache/hugegraph/func/TriFunction.java similarity index 96% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/func/TriFunction.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/func/TriFunction.java index 555a0ee467..b381d42e74 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/func/TriFunction.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/func/TriFunction.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.func; +package org.apache.hugegraph.func; public interface TriFunction { public R apply(T1 v1, T2 v2, T3 v3); diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/BatchMapperIterator.java b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/BatchMapperIterator.java similarity index 96% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/BatchMapperIterator.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/iterator/BatchMapperIterator.java index 283fc45043..79f9e87bda 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/BatchMapperIterator.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/BatchMapperIterator.java @@ -17,14 +17,14 @@ * under the License. */ -package com.baidu.hugegraph.iterator; +package org.apache.hugegraph.iterator; import java.util.Iterator; import java.util.List; import java.util.function.Function; -import com.baidu.hugegraph.util.E; -import com.baidu.hugegraph.util.InsertionOrderUtil; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.InsertionOrderUtil; import com.google.common.collect.ImmutableList; public class BatchMapperIterator extends WrappedIterator { diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/CIter.java b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/CIter.java similarity index 96% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/CIter.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/iterator/CIter.java index 35eda45272..fdaa8dc61c 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/CIter.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/CIter.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.iterator; +package org.apache.hugegraph.iterator; import java.util.Iterator; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/ExtendableIterator.java similarity index 97% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/iterator/ExtendableIterator.java index d9985edc53..d4e690f838 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/ExtendableIterator.java @@ -17,13 +17,13 @@ * under the License. */ -package com.baidu.hugegraph.iterator; +package org.apache.hugegraph.iterator; import java.util.Deque; import java.util.Iterator; import java.util.concurrent.ConcurrentLinkedDeque; -import com.baidu.hugegraph.util.E; +import org.apache.hugegraph.util.E; public class ExtendableIterator extends WrappedIterator { diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/FilterIterator.java b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FilterIterator.java similarity index 97% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/FilterIterator.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FilterIterator.java index 1dfc3abe78..8b546efea3 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/FilterIterator.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FilterIterator.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.iterator; +package org.apache.hugegraph.iterator; import java.util.Iterator; import java.util.function.Function; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/FlatMapperFilterIterator.java b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FlatMapperFilterIterator.java similarity index 96% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/FlatMapperFilterIterator.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FlatMapperFilterIterator.java index a222319b13..fe552326a3 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/FlatMapperFilterIterator.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FlatMapperFilterIterator.java @@ -17,12 +17,12 @@ * under the License. */ -package com.baidu.hugegraph.iterator; +package org.apache.hugegraph.iterator; import java.util.Iterator; import java.util.function.Function; -import com.baidu.hugegraph.util.E; +import org.apache.hugegraph.util.E; public class FlatMapperFilterIterator extends FlatMapperIterator { diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FlatMapperIterator.java similarity index 97% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FlatMapperIterator.java index 6b4cd9855b..92cd451e98 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FlatMapperIterator.java @@ -17,12 +17,12 @@ * under the License. */ -package com.baidu.hugegraph.iterator; +package org.apache.hugegraph.iterator; import java.util.Iterator; import java.util.function.Function; -import com.baidu.hugegraph.util.E; +import org.apache.hugegraph.util.E; public class FlatMapperIterator extends WrappedIterator { diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/LimitIterator.java b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/LimitIterator.java similarity index 98% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/LimitIterator.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/iterator/LimitIterator.java index 671168bbb2..6a166af79d 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/LimitIterator.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/LimitIterator.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.iterator; +package org.apache.hugegraph.iterator; import java.util.Iterator; import java.util.function.Function; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/ListIterator.java b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/ListIterator.java similarity index 96% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/ListIterator.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/iterator/ListIterator.java index f21a436461..9ca190f125 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/ListIterator.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/ListIterator.java @@ -17,14 +17,14 @@ * under the License. */ -package com.baidu.hugegraph.iterator; +package org.apache.hugegraph.iterator; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.List; -import com.baidu.hugegraph.util.InsertionOrderUtil; +import org.apache.hugegraph.util.InsertionOrderUtil; public class ListIterator extends WrappedIterator { diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/MapperIterator.java b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/MapperIterator.java similarity index 97% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/MapperIterator.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/iterator/MapperIterator.java index c02d17c27b..9d523b5fb4 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/MapperIterator.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/MapperIterator.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.iterator; +package org.apache.hugegraph.iterator; import java.util.Iterator; import java.util.function.Function; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/Metadatable.java b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/Metadatable.java similarity index 95% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/Metadatable.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/iterator/Metadatable.java index 4b6d2071c8..2f7d81f3fd 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/Metadatable.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/Metadatable.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.iterator; +package org.apache.hugegraph.iterator; public interface Metadatable { diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/WrappedIterator.java similarity index 98% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/iterator/WrappedIterator.java index 21c4e9ee7e..6eb2f59f05 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/WrappedIterator.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.iterator; +package org.apache.hugegraph.iterator; import java.util.Iterator; import java.util.NoSuchElementException; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseCommonParam.java b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseCommonParam.java similarity index 98% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseCommonParam.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseCommonParam.java index 2d1f45c612..6cb5b8940d 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseCommonParam.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseCommonParam.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.license; +package org.apache.hugegraph.license; import java.util.Date; import java.util.List; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseCreateParam.java b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseCreateParam.java similarity index 97% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseCreateParam.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseCreateParam.java index 7cf69f8380..c14b2403ba 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseCreateParam.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseCreateParam.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.license; +package org.apache.hugegraph.license; import com.fasterxml.jackson.annotation.JsonAlias; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseExtraParam.java b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseExtraParam.java similarity index 98% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseExtraParam.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseExtraParam.java index 0c3337f1ad..361acb5de4 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseExtraParam.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseExtraParam.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.license; +package org.apache.hugegraph.license; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseInstallParam.java b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseInstallParam.java similarity index 97% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseInstallParam.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseInstallParam.java index 4a5237bd7c..462029f342 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseInstallParam.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseInstallParam.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.license; +package org.apache.hugegraph.license; import com.fasterxml.jackson.annotation.JsonAlias; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseManager.java b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseManager.java similarity index 96% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseManager.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseManager.java index 892919c80c..7378899983 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseManager.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseManager.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.license; +package org.apache.hugegraph.license; public interface LicenseManager { diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseManagerFactory.java b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseManagerFactory.java similarity index 91% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseManagerFactory.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseManagerFactory.java index cf38c773e5..c14ddca232 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseManagerFactory.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseManagerFactory.java @@ -17,11 +17,11 @@ * under the License. */ -package com.baidu.hugegraph.license; +package org.apache.hugegraph.license; import org.apache.commons.lang.NotImplementedException; -import com.baidu.hugegraph.license.LicenseManager.VerifyCallback; +import org.apache.hugegraph.license.LicenseManager.VerifyCallback; public class LicenseManagerFactory { diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseParams.java b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseParams.java similarity index 97% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseParams.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseParams.java index dad9cf7cb9..dcc4146d6a 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseParams.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseParams.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.license; +package org.apache.hugegraph.license; import java.util.Date; import java.util.List; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/MachineInfo.java b/hugegraph-common/src/main/java/org/apache/hugegraph/license/MachineInfo.java similarity index 99% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/license/MachineInfo.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/license/MachineInfo.java index 9b9a96ca65..63d09de9a1 100755 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/license/MachineInfo.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/license/MachineInfo.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.license; +package org.apache.hugegraph.license; import java.net.InetAddress; import java.net.NetworkInterface; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/perf/LightStopwatch.java b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/LightStopwatch.java similarity index 98% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/perf/LightStopwatch.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/perf/LightStopwatch.java index b57ae378a7..1f63de73c0 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/perf/LightStopwatch.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/LightStopwatch.java @@ -17,11 +17,11 @@ * under the License. */ -package com.baidu.hugegraph.perf; +package org.apache.hugegraph.perf; import java.util.List; -import com.baidu.hugegraph.perf.PerfUtil.FastMap; +import org.apache.hugegraph.perf.PerfUtil.FastMap; public final class LightStopwatch implements Stopwatch { diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/perf/NormalStopwatch.java b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/NormalStopwatch.java similarity index 95% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/perf/NormalStopwatch.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/perf/NormalStopwatch.java index 7011bcab70..8b8aa06932 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/perf/NormalStopwatch.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/NormalStopwatch.java @@ -17,17 +17,15 @@ * under the License. */ -package com.baidu.hugegraph.perf; +package org.apache.hugegraph.perf; import java.util.List; import java.util.function.BiFunction; +import org.apache.hugegraph.util.Log; import org.slf4j.Logger; -import com.baidu.hugegraph.perf.PerfUtil.FastMap; -import com.baidu.hugegraph.perf.PerfUtil.LocalStack; -import com.baidu.hugegraph.testutil.Whitebox; -import com.baidu.hugegraph.util.Log; +import org.apache.hugegraph.testutil.Whitebox; public final class NormalStopwatch implements Stopwatch { @@ -51,7 +49,7 @@ public final class NormalStopwatch implements Stopwatch { private final String name; private final Path parent; private final Path id; - private final FastMap children; + private final PerfUtil.FastMap children; public NormalStopwatch(String name, Stopwatch parent) { this(name, parent.id()); @@ -62,7 +60,7 @@ public NormalStopwatch(String name, Path parent) { this.name = name; this.parent = parent; this.id = Stopwatch.id(parent, name); - this.children = new FastMap<>(); + this.children = new PerfUtil.FastMap<>(); } @Override @@ -254,7 +252,7 @@ public String toString() { protected static void initEachWastedLost() { int times = 100000000; - LocalStack callStack = Whitebox.getInternalState( + PerfUtil.LocalStack callStack = Whitebox.getInternalState( PerfUtil.instance(), "callStack"); long baseStart = PerfUtil.now(); diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java similarity index 97% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java index e8ea2eaadb..62bd713e8d 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.perf; +package org.apache.hugegraph.perf; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; @@ -39,11 +39,12 @@ import org.slf4j.Logger; -import com.baidu.hugegraph.func.TriFunction; -import com.baidu.hugegraph.perf.Stopwatch.Path; -import com.baidu.hugegraph.testutil.Assert.ThrowableConsumer; -import com.baidu.hugegraph.util.Log; -import com.baidu.hugegraph.util.ReflectionUtil; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.Log; +import org.apache.hugegraph.util.ReflectionUtil; +import org.apache.hugegraph.func.TriFunction; +import org.apache.hugegraph.testutil.Assert.ThrowableConsumer; +import org.apache.hugegraph.perf.Stopwatch.Path; import com.google.common.reflect.ClassPath.ClassInfo; import javassist.CannotCompileException; @@ -128,7 +129,7 @@ public static void useLightStopwatch(boolean yes) { boolean empty = instance == null || instance.empty(); String message = "Please call clear() before switching " + "light-stopwatch due to there is dirty watch"; - com.baidu.hugegraph.util.E.checkArgument(empty, message); + E.checkArgument(empty, message); } LIGHT_WATCH = yes; } @@ -207,7 +208,7 @@ public boolean empty() { public void clear() { String error = "Can't be cleared when the call has not ended yet"; - com.baidu.hugegraph.util.E.checkState(this.callStack.empty(), error); + E.checkState(this.callStack.empty(), error); this.stopwatches.clear(); this.root.clear(); @@ -273,9 +274,9 @@ public void profileClass(String... classes) throws Throwable { private void profile(CtMethod ctMethod) throws CannotCompileException, ClassNotFoundException { final String START = - "com.baidu.hugegraph.perf.PerfUtil.instance().start(\"%s\");"; + "org.apache.hugegraph.perf.PerfUtil.instance().start(\"%s\");"; final String END = - "com.baidu.hugegraph.perf.PerfUtil.instance().end(\"%s\");"; + "org.apache.hugegraph.perf.PerfUtil.instance().end(\"%s\");"; Watched annotation = (Watched) ctMethod.getAnnotation(Watched.class); diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/Stopwatch.java similarity index 99% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/perf/Stopwatch.java index a015a089b2..074869d9ad 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/Stopwatch.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.perf; +package org.apache.hugegraph.perf; import java.util.List; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java similarity index 99% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java index d6b1b71251..bf156b8ef7 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.rest; +package org.apache.hugegraph.rest; import java.io.IOException; import java.net.URI; @@ -31,6 +31,8 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.ExecutorUtil; import jakarta.ws.rs.client.Client; import jakarta.ws.rs.client.ClientRequestContext; import jakarta.ws.rs.client.ClientRequestFilter; @@ -63,8 +65,6 @@ import org.glassfish.jersey.message.GZipEncoder; import org.glassfish.jersey.uri.UriComponent; -import com.baidu.hugegraph.util.E; -import com.baidu.hugegraph.util.ExecutorUtil; import com.google.common.collect.ImmutableMap; import javax.net.ssl.HostnameVerifier; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/ClientException.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/ClientException.java similarity index 97% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/rest/ClientException.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/rest/ClientException.java index d5fd2075d6..0188a3a26a 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/ClientException.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/ClientException.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.rest; +package org.apache.hugegraph.rest; public class ClientException extends RuntimeException { diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/RestClient.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClient.java similarity index 98% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/rest/RestClient.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClient.java index a60aeeee7b..3e095d5354 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/RestClient.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClient.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.rest; +package org.apache.hugegraph.rest; import java.util.Map; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/RestResult.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestResult.java similarity index 99% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/rest/RestResult.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestResult.java index 88ba49edb1..440deabe43 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/RestResult.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestResult.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.rest; +package org.apache.hugegraph.rest; import java.io.IOException; import java.util.ArrayList; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/SerializeException.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/SerializeException.java similarity index 97% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/rest/SerializeException.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/rest/SerializeException.java index 65bfa95bf4..eedac9074c 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/SerializeException.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/SerializeException.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.rest; +package org.apache.hugegraph.rest; public class SerializeException extends ClientException { diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/testutil/Assert.java b/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Assert.java similarity index 99% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/testutil/Assert.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Assert.java index 333002d609..284c5721ff 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/testutil/Assert.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Assert.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.testutil; +package org.apache.hugegraph.testutil; import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java b/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Whitebox.java similarity index 98% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Whitebox.java index 826ab01e86..db92f6241a 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Whitebox.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.testutil; +package org.apache.hugegraph.testutil; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; @@ -25,7 +25,7 @@ import java.util.Arrays; import java.util.Objects; -import com.baidu.hugegraph.util.E; +import org.apache.hugegraph.util.E; import com.google.common.primitives.Primitives; public class Whitebox { diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/Bytes.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/Bytes.java similarity index 98% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/util/Bytes.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/util/Bytes.java index df19c22be0..43f091cb89 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/Bytes.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/Bytes.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.util; +package org.apache.hugegraph.util; import java.util.Arrays; import java.util.Comparator; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/CheckSocket.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/CheckSocket.java similarity index 98% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/util/CheckSocket.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/util/CheckSocket.java index c0dfc89849..9924388205 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/CheckSocket.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/CheckSocket.java @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package com.baidu.hugegraph.util; +package org.apache.hugegraph.util; import java.io.IOException; import java.net.InetAddress; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/CollectionUtil.java similarity index 99% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/util/CollectionUtil.java index 6b6d638452..c1f3404ede 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/CollectionUtil.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.util; +package org.apache.hugegraph.util; import java.lang.reflect.Array; import java.util.ArrayDeque; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/DateUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/DateUtil.java similarity index 97% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/util/DateUtil.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/util/DateUtil.java index a3f117aaf0..b34ebb15ae 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/DateUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/DateUtil.java @@ -17,13 +17,13 @@ * under the License. */ -package com.baidu.hugegraph.util; +package org.apache.hugegraph.util; import java.util.Date; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import com.baidu.hugegraph.date.SafeDateFormat; +import org.apache.hugegraph.date.SafeDateFormat; import com.google.common.collect.ImmutableMap; public final class DateUtil { diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/E.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/E.java similarity index 98% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/util/E.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/util/E.java index 340b7bc7a1..52acdd3870 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/E.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/E.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.util; +package org.apache.hugegraph.util; import java.util.Collection; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/ExecutorUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/ExecutorUtil.java similarity index 96% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/util/ExecutorUtil.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/util/ExecutorUtil.java index 087f8d00f5..1058c9861a 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/ExecutorUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/ExecutorUtil.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.util; +package org.apache.hugegraph.util; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -26,7 +26,7 @@ import org.apache.commons.lang3.concurrent.BasicThreadFactory; -import com.baidu.hugegraph.concurrent.PausableScheduledThreadPool; +import org.apache.hugegraph.concurrent.PausableScheduledThreadPool; public final class ExecutorUtil { diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/HashUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/HashUtil.java similarity index 97% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/util/HashUtil.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/util/HashUtil.java index b2091bee9c..443295e12c 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/HashUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/HashUtil.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.util; +package org.apache.hugegraph.util; import java.nio.charset.Charset; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/InsertionOrderUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/InsertionOrderUtil.java similarity index 98% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/util/InsertionOrderUtil.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/util/InsertionOrderUtil.java index bfe911468d..929cd6c85a 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/InsertionOrderUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/InsertionOrderUtil.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.util; +package org.apache.hugegraph.util; import java.util.ArrayList; import java.util.LinkedHashMap; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/Log.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/Log.java similarity index 96% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/util/Log.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/util/Log.java index 6507cf0188..1192e9db1d 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/Log.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/Log.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.util; +package org.apache.hugegraph.util; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/LongEncoding.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/LongEncoding.java similarity index 99% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/util/LongEncoding.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/util/LongEncoding.java index 0383cd79e2..3488445f7e 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/LongEncoding.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/LongEncoding.java @@ -15,7 +15,7 @@ * under the License. */ -package com.baidu.hugegraph.util; +package org.apache.hugegraph.util; /** * Utility class for encoding longs in strings based on: diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/NumericUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/NumericUtil.java similarity index 99% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/util/NumericUtil.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/util/NumericUtil.java index b07138acba..d9dd190459 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/NumericUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/NumericUtil.java @@ -15,7 +15,7 @@ * under the License. */ -package com.baidu.hugegraph.util; +package org.apache.hugegraph.util; import java.math.BigDecimal; import java.nio.ByteBuffer; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/OrderLimitMap.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/OrderLimitMap.java similarity index 98% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/util/OrderLimitMap.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/util/OrderLimitMap.java index 0c22f459f1..e286ca934e 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/OrderLimitMap.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/OrderLimitMap.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.util; +package org.apache.hugegraph.util; import java.util.HashMap; import java.util.Map; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/ReflectionUtil.java similarity index 98% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/util/ReflectionUtil.java index c9092ff67c..853086912e 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/ReflectionUtil.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.util; +package org.apache.hugegraph.util; import java.io.IOException; import java.lang.annotation.Annotation; @@ -26,7 +26,7 @@ import java.util.LinkedList; import java.util.List; -import com.baidu.hugegraph.iterator.ExtendableIterator; +import org.apache.hugegraph.iterator.ExtendableIterator; import com.google.common.collect.Lists; import com.google.common.reflect.ClassPath; import com.google.common.reflect.ClassPath.ClassInfo; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/StringUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/StringUtil.java similarity index 99% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/util/StringUtil.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/util/StringUtil.java index f7dcbb98a5..d717510052 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/StringUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/StringUtil.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.util; +package org.apache.hugegraph.util; public final class StringUtil { diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/TimeUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/TimeUtil.java similarity index 98% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/util/TimeUtil.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/util/TimeUtil.java index 35696f0de1..69394df87d 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/TimeUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/TimeUtil.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.util; +package org.apache.hugegraph.util; import java.time.Duration; import java.util.Date; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/UnitUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/UnitUtil.java similarity index 99% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/util/UnitUtil.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/util/UnitUtil.java index 069ab0007b..e21ed9e60f 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/UnitUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/UnitUtil.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.util; +package org.apache.hugegraph.util; import java.math.BigDecimal; import java.time.Duration; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/VersionUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java similarity index 99% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/util/VersionUtil.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java index 94e4d3ade9..57c9eb7cc7 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/util/VersionUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.util; +package org.apache.hugegraph.util; import java.io.BufferedReader; import java.io.IOException; diff --git a/hugegraph-common/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/hugegraph-common/src/main/java/org/apache/hugegraph/version/CommonVersion.java similarity index 86% rename from hugegraph-common/src/main/java/com/baidu/hugegraph/version/CommonVersion.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/version/CommonVersion.java index e75c1838eb..8dfbc13e04 100644 --- a/hugegraph-common/src/main/java/com/baidu/hugegraph/version/CommonVersion.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/version/CommonVersion.java @@ -17,15 +17,14 @@ * under the License. */ -package com.baidu.hugegraph.version; +package org.apache.hugegraph.version; -import com.baidu.hugegraph.util.VersionUtil.Version; +import org.apache.hugegraph.util.VersionUtil.Version; public class CommonVersion { public static final String NAME = "hugegraph-common"; // The second parameter of Version.of() is for all-in-one JAR - public static final Version VERSION = Version.of(CommonVersion.class, - "2.1.2"); + public static final Version VERSION = Version.of(CommonVersion.class, "1.0.0"); } diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java deleted file mode 100644 index 012038ecd2..0000000000 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright 2017 HugeGraph Authors - * - * 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 com.baidu.hugegraph.unit; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -import com.baidu.hugegraph.testutil.AssertTest; -import com.baidu.hugegraph.testutil.WhiteboxTest; -import com.baidu.hugegraph.unit.concurrent.AtomicLockTest; -import com.baidu.hugegraph.unit.concurrent.BarrierEventTest; -import com.baidu.hugegraph.unit.concurrent.KeyLockTest; -import com.baidu.hugegraph.unit.concurrent.LockGroupTest; -import com.baidu.hugegraph.unit.concurrent.LockManagerTest; -import com.baidu.hugegraph.unit.concurrent.PausableScheduledThreadPoolTest; -import com.baidu.hugegraph.unit.concurrent.RowLockTest; -import com.baidu.hugegraph.unit.config.HugeConfigTest; -import com.baidu.hugegraph.unit.config.OptionSpaceTest; -import com.baidu.hugegraph.unit.date.SafeDateFormatTest; -import com.baidu.hugegraph.unit.event.EventHubTest; -import com.baidu.hugegraph.unit.iterator.BatchMapperIteratorTest; -import com.baidu.hugegraph.unit.iterator.ExtendableIteratorTest; -import com.baidu.hugegraph.unit.iterator.FilterIteratorTest; -import com.baidu.hugegraph.unit.iterator.FlatMapperFilterIteratorTest; -import com.baidu.hugegraph.unit.iterator.FlatMapperIteratorTest; -import com.baidu.hugegraph.unit.iterator.LimitIteratorTest; -import com.baidu.hugegraph.unit.iterator.ListIteratorTest; -import com.baidu.hugegraph.unit.iterator.MapperIteratorTest; -import com.baidu.hugegraph.unit.license.LicenseExtraParamTest; -import com.baidu.hugegraph.unit.license.LicenseCreateParamTest; -import com.baidu.hugegraph.unit.license.LicenseInstallParamTest; -import com.baidu.hugegraph.unit.license.LicenseParamsTest; -import com.baidu.hugegraph.unit.license.MachineInfoTest; -import com.baidu.hugegraph.unit.perf.PerfUtilTest; -import com.baidu.hugegraph.unit.perf.StopwatchTest; -import com.baidu.hugegraph.unit.rest.RestClientTest; -import com.baidu.hugegraph.unit.rest.RestResultTest; -import com.baidu.hugegraph.unit.util.BytesTest; -import com.baidu.hugegraph.unit.util.CollectionUtilTest; -import com.baidu.hugegraph.unit.util.DateUtilTest; -import com.baidu.hugegraph.unit.util.EcheckTest; -import com.baidu.hugegraph.unit.util.HashUtilTest; -import com.baidu.hugegraph.unit.util.InsertionOrderUtilTest; -import com.baidu.hugegraph.unit.util.LogTest; -import com.baidu.hugegraph.unit.util.LongEncodingTest; -import com.baidu.hugegraph.unit.util.NumericUtilTest; -import com.baidu.hugegraph.unit.util.OrderLimitMapTest; -import com.baidu.hugegraph.unit.util.ReflectionUtilTest; -import com.baidu.hugegraph.unit.util.StringUtilTest; -import com.baidu.hugegraph.unit.util.TimeUtilTest; -import com.baidu.hugegraph.unit.util.UnitUtilTest; -import com.baidu.hugegraph.unit.util.VersionUtilTest; -import com.baidu.hugegraph.unit.version.VersionTest; - -@RunWith(Suite.class) -@Suite.SuiteClasses({ - LockManagerTest.class, - LockGroupTest.class, - AtomicLockTest.class, - KeyLockTest.class, - RowLockTest.class, - PausableScheduledThreadPoolTest.class, - - HugeConfigTest.class, - OptionSpaceTest.class, - SafeDateFormatTest.class, - BarrierEventTest.class, - EventHubTest.class, - PerfUtilTest.class, - StopwatchTest.class, - RestClientTest.class, - RestResultTest.class, - VersionTest.class, - - ExtendableIteratorTest.class, - FilterIteratorTest.class, - LimitIteratorTest.class, - MapperIteratorTest.class, - FlatMapperIteratorTest.class, - FlatMapperFilterIteratorTest.class, - ListIteratorTest.class, - BatchMapperIteratorTest.class, - - BytesTest.class, - CollectionUtilTest.class, - EcheckTest.class, - HashUtilTest.class, - InsertionOrderUtilTest.class, - LogTest.class, - NumericUtilTest.class, - ReflectionUtilTest.class, - StringUtilTest.class, - TimeUtilTest.class, - VersionUtilTest.class, - LongEncodingTest.class, - OrderLimitMapTest.class, - DateUtilTest.class, - UnitUtilTest.class, - - LicenseExtraParamTest.class, - LicenseCreateParamTest.class, - LicenseInstallParamTest.class, - LicenseParamsTest.class, - MachineInfoTest.class, - - AssertTest.class, - WhiteboxTest.class -}) -public class UnitTestSuite { -} diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/testutil/AssertTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/testutil/AssertTest.java similarity index 99% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/testutil/AssertTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/testutil/AssertTest.java index 91b7ee4bf9..7116adc8b0 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/testutil/AssertTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/testutil/AssertTest.java @@ -17,11 +17,11 @@ * under the License. */ -package com.baidu.hugegraph.testutil; +package org.apache.hugegraph.testutil; import org.junit.Test; -import com.baidu.hugegraph.unit.BaseUnitTest; +import org.apache.hugegraph.unit.BaseUnitTest; public class AssertTest extends BaseUnitTest { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/testutil/WhiteboxTest.java similarity index 99% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/testutil/WhiteboxTest.java index 6375c0dcca..f6ebf6dd4a 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/testutil/WhiteboxTest.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.testutil; +package org.apache.hugegraph.testutil; import org.junit.Test; diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java similarity index 96% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java index 707b619197..cd09b8006e 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.unit; +package org.apache.hugegraph.unit; import java.util.ArrayList; import java.util.List; @@ -26,11 +26,10 @@ import java.util.concurrent.Executors; import java.util.concurrent.Future; +import org.apache.hugegraph.util.TimeUtil; import org.junit.AfterClass; import org.junit.BeforeClass; -import com.baidu.hugegraph.util.TimeUtil; - public class BaseUnitTest { @BeforeClass diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/UnitTestSuite.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/UnitTestSuite.java new file mode 100644 index 0000000000..05219878ca --- /dev/null +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/UnitTestSuite.java @@ -0,0 +1,127 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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.unit; + +import org.apache.hugegraph.testutil.AssertTest; +import org.apache.hugegraph.testutil.WhiteboxTest; +import org.apache.hugegraph.unit.config.HugeConfigTest; +import org.apache.hugegraph.unit.config.OptionSpaceTest; +import org.apache.hugegraph.unit.event.EventHubTest; +import org.apache.hugegraph.unit.version.VersionTest; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +import org.apache.hugegraph.unit.concurrent.AtomicLockTest; +import org.apache.hugegraph.unit.concurrent.BarrierEventTest; +import org.apache.hugegraph.unit.concurrent.KeyLockTest; +import org.apache.hugegraph.unit.concurrent.LockGroupTest; +import org.apache.hugegraph.unit.concurrent.LockManagerTest; +import org.apache.hugegraph.unit.concurrent.PausableScheduledThreadPoolTest; +import org.apache.hugegraph.unit.concurrent.RowLockTest; +import org.apache.hugegraph.unit.date.SafeDateFormatTest; +import org.apache.hugegraph.unit.iterator.BatchMapperIteratorTest; +import org.apache.hugegraph.unit.iterator.ExtendableIteratorTest; +import org.apache.hugegraph.unit.iterator.FilterIteratorTest; +import org.apache.hugegraph.unit.iterator.FlatMapperFilterIteratorTest; +import org.apache.hugegraph.unit.iterator.FlatMapperIteratorTest; +import org.apache.hugegraph.unit.iterator.LimitIteratorTest; +import org.apache.hugegraph.unit.iterator.ListIteratorTest; +import org.apache.hugegraph.unit.iterator.MapperIteratorTest; +import org.apache.hugegraph.unit.license.LicenseExtraParamTest; +import org.apache.hugegraph.unit.license.LicenseCreateParamTest; +import org.apache.hugegraph.unit.license.LicenseInstallParamTest; +import org.apache.hugegraph.unit.license.LicenseParamsTest; +import org.apache.hugegraph.unit.license.MachineInfoTest; +import org.apache.hugegraph.unit.perf.PerfUtilTest; +import org.apache.hugegraph.unit.perf.StopwatchTest; +import org.apache.hugegraph.unit.rest.RestClientTest; +import org.apache.hugegraph.unit.rest.RestResultTest; +import org.apache.hugegraph.unit.util.BytesTest; +import org.apache.hugegraph.unit.util.CollectionUtilTest; +import org.apache.hugegraph.unit.util.DateUtilTest; +import org.apache.hugegraph.unit.util.EcheckTest; +import org.apache.hugegraph.unit.util.HashUtilTest; +import org.apache.hugegraph.unit.util.InsertionOrderUtilTest; +import org.apache.hugegraph.unit.util.LogTest; +import org.apache.hugegraph.unit.util.LongEncodingTest; +import org.apache.hugegraph.unit.util.NumericUtilTest; +import org.apache.hugegraph.unit.util.OrderLimitMapTest; +import org.apache.hugegraph.unit.util.ReflectionUtilTest; +import org.apache.hugegraph.unit.util.StringUtilTest; +import org.apache.hugegraph.unit.util.TimeUtilTest; +import org.apache.hugegraph.unit.util.UnitUtilTest; +import org.apache.hugegraph.unit.util.VersionUtilTest; + +@RunWith(Suite.class) +@Suite.SuiteClasses({ + LockManagerTest.class, + LockGroupTest.class, + AtomicLockTest.class, + KeyLockTest.class, + RowLockTest.class, + PausableScheduledThreadPoolTest.class, + + HugeConfigTest.class, + OptionSpaceTest.class, + SafeDateFormatTest.class, + BarrierEventTest.class, + EventHubTest.class, + PerfUtilTest.class, + StopwatchTest.class, + RestClientTest.class, + RestResultTest.class, + VersionTest.class, + + ExtendableIteratorTest.class, + FilterIteratorTest.class, + LimitIteratorTest.class, + MapperIteratorTest.class, + FlatMapperIteratorTest.class, + FlatMapperFilterIteratorTest.class, + ListIteratorTest.class, + BatchMapperIteratorTest.class, + + BytesTest.class, + CollectionUtilTest.class, + EcheckTest.class, + HashUtilTest.class, + InsertionOrderUtilTest.class, + LogTest.class, + NumericUtilTest.class, + ReflectionUtilTest.class, + StringUtilTest.class, + TimeUtilTest.class, + VersionUtilTest.class, + LongEncodingTest.class, + OrderLimitMapTest.class, + DateUtilTest.class, + UnitUtilTest.class, + + LicenseExtraParamTest.class, + LicenseCreateParamTest.class, + LicenseInstallParamTest.class, + LicenseParamsTest.class, + MachineInfoTest.class, + + AssertTest.class, + WhiteboxTest.class +}) +public class UnitTestSuite { +} diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/AtomicLockTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/AtomicLockTest.java similarity index 91% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/AtomicLockTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/AtomicLockTest.java index 225fe4296c..02265ad191 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/AtomicLockTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/AtomicLockTest.java @@ -17,13 +17,13 @@ * under the License. */ -package com.baidu.hugegraph.unit.concurrent; +package org.apache.hugegraph.unit.concurrent; import org.junit.Test; -import com.baidu.hugegraph.concurrent.AtomicLock; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; +import org.apache.hugegraph.concurrent.AtomicLock; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.unit.BaseUnitTest; public class AtomicLockTest extends BaseUnitTest { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/BarrierEventTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/BarrierEventTest.java similarity index 98% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/BarrierEventTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/BarrierEventTest.java index c81aa3d1fa..c40a2f2ea3 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/BarrierEventTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/BarrierEventTest.java @@ -1,4 +1,4 @@ -package com.baidu.hugegraph.unit.concurrent; +package org.apache.hugegraph.unit.concurrent; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; @@ -8,8 +8,8 @@ import org.junit.Test; -import com.baidu.hugegraph.concurrent.BarrierEvent; -import com.baidu.hugegraph.testutil.Assert; +import org.apache.hugegraph.concurrent.BarrierEvent; +import org.apache.hugegraph.testutil.Assert; public class BarrierEventTest { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/KeyLockTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/KeyLockTest.java similarity index 95% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/KeyLockTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/KeyLockTest.java index 60a946abc1..e431853e08 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/KeyLockTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/KeyLockTest.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.unit.concurrent; +package org.apache.hugegraph.unit.concurrent; import java.util.Arrays; import java.util.List; @@ -25,9 +25,9 @@ import org.junit.Test; -import com.baidu.hugegraph.concurrent.KeyLock; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; +import org.apache.hugegraph.concurrent.KeyLock; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.unit.BaseUnitTest; public class KeyLockTest extends BaseUnitTest { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/LockGroupTest.java similarity index 90% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/LockGroupTest.java index 1f252917e5..3309a43b20 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/LockGroupTest.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.unit.concurrent; +package org.apache.hugegraph.unit.concurrent; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReadWriteLock; @@ -26,12 +26,12 @@ import org.junit.Test; -import com.baidu.hugegraph.concurrent.AtomicLock; -import com.baidu.hugegraph.concurrent.KeyLock; -import com.baidu.hugegraph.concurrent.LockGroup; -import com.baidu.hugegraph.concurrent.RowLock; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; +import org.apache.hugegraph.concurrent.AtomicLock; +import org.apache.hugegraph.concurrent.KeyLock; +import org.apache.hugegraph.concurrent.LockGroup; +import org.apache.hugegraph.concurrent.RowLock; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.unit.BaseUnitTest; public class LockGroupTest extends BaseUnitTest { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/LockManagerTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/LockManagerTest.java similarity index 94% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/LockManagerTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/LockManagerTest.java index 4eb5abded1..edb628b273 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/LockManagerTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/LockManagerTest.java @@ -17,15 +17,15 @@ * under the License. */ -package com.baidu.hugegraph.unit.concurrent; +package org.apache.hugegraph.unit.concurrent; import org.junit.After; import org.junit.Test; -import com.baidu.hugegraph.concurrent.LockGroup; -import com.baidu.hugegraph.concurrent.LockManager; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; +import org.apache.hugegraph.concurrent.LockGroup; +import org.apache.hugegraph.concurrent.LockManager; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.unit.BaseUnitTest; public class LockManagerTest extends BaseUnitTest { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java similarity index 95% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java index b4feff6ae5..fb66741d3c 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java @@ -17,16 +17,16 @@ * under the License. */ -package com.baidu.hugegraph.unit.concurrent; +package org.apache.hugegraph.unit.concurrent; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import org.apache.hugegraph.util.ExecutorUtil; import org.junit.Assert; import org.junit.Test; -import com.baidu.hugegraph.concurrent.PausableScheduledThreadPool; -import com.baidu.hugegraph.util.ExecutorUtil; +import org.apache.hugegraph.concurrent.PausableScheduledThreadPool; public class PausableScheduledThreadPoolTest { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/RowLockTest.java similarity index 96% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/RowLockTest.java index 4821f1d0a4..0fd666146f 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/RowLockTest.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.unit.concurrent; +package org.apache.hugegraph.unit.concurrent; import java.util.ArrayList; import java.util.HashSet; @@ -27,9 +27,9 @@ import org.junit.Test; -import com.baidu.hugegraph.concurrent.RowLock; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; +import org.apache.hugegraph.concurrent.RowLock; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.unit.BaseUnitTest; import com.google.common.collect.ImmutableSet; public class RowLockTest extends BaseUnitTest { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/HugeConfigTest.java similarity index 95% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/HugeConfigTest.java index f522d56fee..01ffb316b3 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/HugeConfigTest.java @@ -17,15 +17,15 @@ * under the License. */ -package com.baidu.hugegraph.unit.config; +package org.apache.hugegraph.unit.config; -import static com.baidu.hugegraph.config.OptionChecker.allowValues; -import static com.baidu.hugegraph.config.OptionChecker.disallowEmpty; -import static com.baidu.hugegraph.config.OptionChecker.inValues; -import static com.baidu.hugegraph.config.OptionChecker.nonNegativeInt; -import static com.baidu.hugegraph.config.OptionChecker.positiveInt; -import static com.baidu.hugegraph.config.OptionChecker.rangeDouble; -import static com.baidu.hugegraph.config.OptionChecker.rangeInt; +import static org.apache.hugegraph.config.OptionChecker.allowValues; +import static org.apache.hugegraph.config.OptionChecker.disallowEmpty; +import static org.apache.hugegraph.config.OptionChecker.inValues; +import static org.apache.hugegraph.config.OptionChecker.nonNegativeInt; +import static org.apache.hugegraph.config.OptionChecker.positiveInt; +import static org.apache.hugegraph.config.OptionChecker.rangeDouble; +import static org.apache.hugegraph.config.OptionChecker.rangeInt; import java.io.File; import java.io.IOException; @@ -34,6 +34,16 @@ import java.util.List; import java.util.Map; +import org.apache.hugegraph.config.ConfigConvOption; +import org.apache.hugegraph.config.ConfigException; +import org.apache.hugegraph.config.ConfigListConvOption; +import org.apache.hugegraph.config.ConfigListOption; +import org.apache.hugegraph.config.ConfigOption; +import org.apache.hugegraph.config.HugeConfig; +import org.apache.hugegraph.config.OptionHolder; +import org.apache.hugegraph.config.OptionSpace; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.unit.BaseUnitTest; import org.apache.commons.collections.IteratorUtils; import org.apache.commons.configuration2.AbstractConfiguration; import org.apache.commons.configuration2.Configuration; @@ -46,17 +56,6 @@ import org.junit.BeforeClass; import org.junit.Test; -import com.baidu.hugegraph.config.ConfigConvOption; -import com.baidu.hugegraph.config.ConfigException; -import com.baidu.hugegraph.config.ConfigListConvOption; -import com.baidu.hugegraph.config.ConfigListOption; -import com.baidu.hugegraph.config.ConfigOption; -import com.baidu.hugegraph.config.HugeConfig; -import com.baidu.hugegraph.config.OptionHolder; -import com.baidu.hugegraph.config.OptionSpace; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.testutil.Whitebox; -import com.baidu.hugegraph.unit.BaseUnitTest; import com.google.common.base.Predicate; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; @@ -64,7 +63,7 @@ public class HugeConfigTest extends BaseUnitTest { private static final String PATH = - "src/test/java/com/baidu/hugegraph/unit/config/"; + "src/test/java/org/apache/hugegraph/unit/config/"; private static final String CONF = PATH + "test.conf"; @BeforeClass @@ -288,7 +287,7 @@ public void testHugeConfig() throws Exception { Assert.assertEquals(Object.class, config.get(TestOptions.clazz)); Assert.assertThrows(ConfigException.class, () -> { config.setProperty(TestOptions.clazz.name(), - "com.baidu.hugegraph.HugeGraph"); + "org.apache.hugegraph.HugeGraph"); }, e -> { Assert.assertTrue(e.getCause() instanceof ClassNotFoundException); }); diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/OptionSpaceTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/OptionSpaceTest.java similarity index 94% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/OptionSpaceTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/OptionSpaceTest.java index 3ff2c0512e..cfb35e5cf5 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/OptionSpaceTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/OptionSpaceTest.java @@ -17,18 +17,18 @@ * under the License. */ -package com.baidu.hugegraph.unit.config; +package org.apache.hugegraph.unit.config; -import static com.baidu.hugegraph.config.OptionChecker.disallowEmpty; +import static org.apache.hugegraph.config.OptionChecker.disallowEmpty; import org.junit.Test; -import com.baidu.hugegraph.config.ConfigException; -import com.baidu.hugegraph.config.ConfigOption; -import com.baidu.hugegraph.config.OptionHolder; -import com.baidu.hugegraph.config.OptionSpace; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; +import org.apache.hugegraph.config.OptionSpace; +import org.apache.hugegraph.config.OptionHolder; +import org.apache.hugegraph.config.ConfigException; +import org.apache.hugegraph.config.ConfigOption; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.unit.BaseUnitTest; import com.google.common.base.Predicate; public class OptionSpaceTest extends BaseUnitTest { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/test-check-error.conf b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/test-check-error.conf similarity index 100% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/test-check-error.conf rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/test-check-error.conf diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/test-list-error.conf b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/test-list-error.conf similarity index 100% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/test-list-error.conf rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/test-list-error.conf diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/test-type-error.conf b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/test-type-error.conf similarity index 100% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/test-type-error.conf rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/test-type-error.conf diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/test.conf b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/test.conf similarity index 100% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/test.conf rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/test.conf diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/date/SafeDateFormatTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/date/SafeDateFormatTest.java similarity index 97% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/date/SafeDateFormatTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/date/SafeDateFormatTest.java index cf0036ba16..6c9e89edb2 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/date/SafeDateFormatTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/date/SafeDateFormatTest.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.unit.date; +package org.apache.hugegraph.unit.date; import java.text.DateFormat; import java.text.ParseException; @@ -28,10 +28,10 @@ import java.util.TimeZone; import java.util.concurrent.CountDownLatch; +import org.apache.hugegraph.date.SafeDateFormat; import org.junit.Test; -import com.baidu.hugegraph.date.SafeDateFormat; -import com.baidu.hugegraph.testutil.Assert; +import org.apache.hugegraph.testutil.Assert; import com.google.common.collect.ImmutableList; public class SafeDateFormatTest { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/event/EventHubTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/event/EventHubTest.java similarity index 98% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/event/EventHubTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/event/EventHubTest.java index ee572833ad..c8743e99aa 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/event/EventHubTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/event/EventHubTest.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.unit.event; +package org.apache.hugegraph.unit.event; import java.util.concurrent.atomic.AtomicInteger; @@ -27,13 +27,14 @@ import org.junit.BeforeClass; import org.junit.Test; -import com.baidu.hugegraph.event.Event; -import com.baidu.hugegraph.event.EventHub; -import com.baidu.hugegraph.event.EventListener; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; import com.google.common.collect.ImmutableList; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.unit.BaseUnitTest; +import org.apache.hugegraph.event.Event; +import org.apache.hugegraph.event.EventHub; +import org.apache.hugegraph.event.EventListener; + public class EventHubTest extends BaseUnitTest { private static final int THREADS_NUM = 8; diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/BatchMapperIteratorTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/BatchMapperIteratorTest.java similarity index 97% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/BatchMapperIteratorTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/BatchMapperIteratorTest.java index a5d33d7413..40a39a2178 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/BatchMapperIteratorTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/BatchMapperIteratorTest.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.unit.iterator; +package org.apache.hugegraph.unit.iterator; import java.util.ArrayList; import java.util.Collections; @@ -29,10 +29,10 @@ import org.junit.Test; -import com.baidu.hugegraph.iterator.BatchMapperIterator; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; -import com.baidu.hugegraph.unit.iterator.ExtendableIteratorTest.CloseableItor; +import org.apache.hugegraph.iterator.BatchMapperIterator; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.unit.BaseUnitTest; +import org.apache.hugegraph.unit.iterator.ExtendableIteratorTest.CloseableItor; import com.google.common.collect.ImmutableList; @SuppressWarnings("resource") diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/ExtendableIteratorTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ExtendableIteratorTest.java similarity index 97% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/ExtendableIteratorTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ExtendableIteratorTest.java index 4c7ba31b82..e753ea8eae 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/ExtendableIteratorTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ExtendableIteratorTest.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.unit.iterator; +package org.apache.hugegraph.unit.iterator; import java.util.ArrayList; import java.util.Iterator; @@ -26,9 +26,9 @@ import org.junit.Test; -import com.baidu.hugegraph.iterator.ExtendableIterator; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; +import org.apache.hugegraph.iterator.ExtendableIterator; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.unit.BaseUnitTest; import com.google.common.collect.ImmutableList; @SuppressWarnings("resource") diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/FilterIteratorTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FilterIteratorTest.java similarity index 95% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/FilterIteratorTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FilterIteratorTest.java index 9024673166..f6c0e1758d 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/FilterIteratorTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FilterIteratorTest.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.unit.iterator; +package org.apache.hugegraph.unit.iterator; import java.util.ArrayList; import java.util.Iterator; @@ -28,10 +28,10 @@ import org.junit.Test; -import com.baidu.hugegraph.iterator.FilterIterator; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; -import com.baidu.hugegraph.unit.iterator.ExtendableIteratorTest.CloseableItor; +import org.apache.hugegraph.iterator.FilterIterator; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.unit.BaseUnitTest; +import org.apache.hugegraph.unit.iterator.ExtendableIteratorTest.CloseableItor; import com.google.common.collect.ImmutableList; @SuppressWarnings("resource") diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java similarity index 95% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java index bc69bf55ed..536f38a3e0 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.unit.iterator; +package org.apache.hugegraph.unit.iterator; import java.util.ArrayList; import java.util.Iterator; @@ -29,10 +29,10 @@ import org.junit.Test; -import com.baidu.hugegraph.iterator.FlatMapperFilterIterator; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; -import com.baidu.hugegraph.unit.iterator.ExtendableIteratorTest.CloseableItor; +import org.apache.hugegraph.iterator.FlatMapperFilterIterator; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.unit.BaseUnitTest; +import org.apache.hugegraph.unit.iterator.ExtendableIteratorTest.CloseableItor; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperIteratorTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperIteratorTest.java similarity index 95% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperIteratorTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperIteratorTest.java index 9745029642..5e5baf4616 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperIteratorTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperIteratorTest.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.unit.iterator; +package org.apache.hugegraph.unit.iterator; import java.util.ArrayList; import java.util.Iterator; @@ -29,10 +29,10 @@ import org.junit.Test; -import com.baidu.hugegraph.iterator.FlatMapperIterator; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; -import com.baidu.hugegraph.unit.iterator.ExtendableIteratorTest.CloseableItor; +import org.apache.hugegraph.iterator.FlatMapperIterator; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.unit.BaseUnitTest; +import org.apache.hugegraph.unit.iterator.ExtendableIteratorTest.CloseableItor; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/LimitIteratorTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/LimitIteratorTest.java similarity index 95% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/LimitIteratorTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/LimitIteratorTest.java index acd4fc1c6c..f806b5e623 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/LimitIteratorTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/LimitIteratorTest.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.unit.iterator; +package org.apache.hugegraph.unit.iterator; import java.util.ArrayList; import java.util.Iterator; @@ -28,10 +28,10 @@ import org.junit.Test; -import com.baidu.hugegraph.iterator.LimitIterator; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; -import com.baidu.hugegraph.unit.iterator.ExtendableIteratorTest.CloseableItor; +import org.apache.hugegraph.iterator.LimitIterator; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.unit.BaseUnitTest; +import org.apache.hugegraph.unit.iterator.ExtendableIteratorTest.CloseableItor; import com.google.common.collect.ImmutableList; @SuppressWarnings("resource") diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/ListIteratorTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ListIteratorTest.java similarity index 97% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/ListIteratorTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ListIteratorTest.java index 8ddd995ba0..d8334344ae 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/ListIteratorTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ListIteratorTest.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.unit.iterator; +package org.apache.hugegraph.unit.iterator; import java.util.ArrayList; import java.util.Collections; @@ -27,10 +27,10 @@ import org.junit.Test; -import com.baidu.hugegraph.iterator.ListIterator; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; -import com.baidu.hugegraph.unit.iterator.ExtendableIteratorTest.CloseableItor; +import org.apache.hugegraph.iterator.ListIterator; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.unit.BaseUnitTest; +import org.apache.hugegraph.unit.iterator.ExtendableIteratorTest.CloseableItor; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterators; diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/MapperIteratorTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/MapperIteratorTest.java similarity index 94% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/MapperIteratorTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/MapperIteratorTest.java index e2c63ed657..23b2ab07e7 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/MapperIteratorTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/MapperIteratorTest.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.unit.iterator; +package org.apache.hugegraph.unit.iterator; import java.util.ArrayList; import java.util.Iterator; @@ -29,10 +29,10 @@ import org.junit.Test; -import com.baidu.hugegraph.iterator.MapperIterator; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; -import com.baidu.hugegraph.unit.iterator.ExtendableIteratorTest.CloseableItor; +import org.apache.hugegraph.iterator.MapperIterator; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.unit.BaseUnitTest; +import org.apache.hugegraph.unit.iterator.ExtendableIteratorTest.CloseableItor; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseCreateParamTest.java similarity index 95% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseCreateParamTest.java index cb67ce91f4..92b902f02a 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseCreateParamTest.java @@ -17,16 +17,16 @@ * under the License. */ -package com.baidu.hugegraph.unit.license; +package org.apache.hugegraph.unit.license; import java.io.IOException; import java.text.ParseException; +import org.apache.hugegraph.date.SafeDateFormat; import org.junit.Test; -import com.baidu.hugegraph.date.SafeDateFormat; -import com.baidu.hugegraph.license.LicenseCreateParam; -import com.baidu.hugegraph.testutil.Assert; +import org.apache.hugegraph.license.LicenseCreateParam; +import org.apache.hugegraph.testutil.Assert; import com.fasterxml.jackson.databind.ObjectMapper; public class LicenseCreateParamTest { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseExtraParamTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseExtraParamTest.java similarity index 94% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseExtraParamTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseExtraParamTest.java index 7d613c535a..65f9defd5b 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseExtraParamTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseExtraParamTest.java @@ -17,14 +17,14 @@ * under the License. */ -package com.baidu.hugegraph.unit.license; +package org.apache.hugegraph.unit.license; import java.io.IOException; +import org.apache.hugegraph.license.LicenseExtraParam; import org.junit.Test; -import com.baidu.hugegraph.license.LicenseExtraParam; -import com.baidu.hugegraph.testutil.Assert; +import org.apache.hugegraph.testutil.Assert; import com.fasterxml.jackson.databind.ObjectMapper; public class LicenseExtraParamTest { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseInstallParamTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseInstallParamTest.java similarity index 93% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseInstallParamTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseInstallParamTest.java index a16b02f72f..8b3bbc47ef 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseInstallParamTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseInstallParamTest.java @@ -17,14 +17,14 @@ * under the License. */ -package com.baidu.hugegraph.unit.license; +package org.apache.hugegraph.unit.license; import java.io.IOException; import org.junit.Test; -import com.baidu.hugegraph.license.LicenseInstallParam; -import com.baidu.hugegraph.testutil.Assert; +import org.apache.hugegraph.license.LicenseInstallParam; +import org.apache.hugegraph.testutil.Assert; import com.fasterxml.jackson.databind.ObjectMapper; public class LicenseInstallParamTest { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseParamsTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseParamsTest.java similarity index 94% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseParamsTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseParamsTest.java index 8dec1df609..75e74f2600 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseParamsTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseParamsTest.java @@ -17,15 +17,15 @@ * under the License. */ -package com.baidu.hugegraph.unit.license; +package org.apache.hugegraph.unit.license; import java.io.IOException; +import org.apache.hugegraph.license.LicenseExtraParam; +import org.apache.hugegraph.license.LicenseParams; import org.junit.Test; -import com.baidu.hugegraph.license.LicenseExtraParam; -import com.baidu.hugegraph.license.LicenseParams; -import com.baidu.hugegraph.testutil.Assert; +import org.apache.hugegraph.testutil.Assert; import com.fasterxml.jackson.databind.ObjectMapper; public class LicenseParamsTest { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/MachineInfoTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/MachineInfoTest.java similarity index 95% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/MachineInfoTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/MachineInfoTest.java index c436943e98..dfe3dc74ad 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/MachineInfoTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/MachineInfoTest.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.unit.license; +package org.apache.hugegraph.unit.license; import java.net.InetAddress; import java.net.UnknownHostException; @@ -26,8 +26,8 @@ import org.junit.Test; -import com.baidu.hugegraph.license.MachineInfo; -import com.baidu.hugegraph.testutil.Assert; +import org.apache.hugegraph.license.MachineInfo; +import org.apache.hugegraph.testutil.Assert; public class MachineInfoTest { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/PerfUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/PerfUtilTest.java similarity index 95% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/PerfUtilTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/PerfUtilTest.java index 926d9c892e..218afbcf11 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/PerfUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/PerfUtilTest.java @@ -17,27 +17,28 @@ * under the License. */ -package com.baidu.hugegraph.unit.perf; +package org.apache.hugegraph.unit.perf; import java.util.Map; import org.junit.After; import org.junit.Test; -import com.baidu.hugegraph.perf.PerfUtil; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; -import com.baidu.hugegraph.unit.perf.testclass.TestClass; -import com.baidu.hugegraph.unit.perf.testclass.TestLightClass; -import com.baidu.hugegraph.unit.perf.testclass.TestPerfClass; -import com.baidu.hugegraph.unit.perf.testclass.TestPerfLightClass; -import com.baidu.hugegraph.unit.perf.testclass2.TestClass4Package; import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.unit.perf.testclass.TestClass; +import org.apache.hugegraph.unit.perf.testclass.TestPerfLightClass; +import org.apache.hugegraph.unit.perf.testclass2.TestClass4Package; +import org.apache.hugegraph.perf.PerfUtil; +import org.apache.hugegraph.unit.BaseUnitTest; +import org.apache.hugegraph.unit.perf.testclass.TestLightClass; +import org.apache.hugegraph.unit.perf.testclass.TestPerfClass; + public class PerfUtilTest extends BaseUnitTest { private static final String prefix = - "com.baidu.hugegraph.unit.perf.testclass."; + "org.apache.hugegraph.unit.perf.testclass."; private static final PerfUtil perf = PerfUtil.instance(); @After @@ -251,7 +252,7 @@ public void testPerfUtilWithSingleThread() throws Throwable { @Test public void testPerfUtilWithProfilePackage() throws Throwable { - perf.profilePackage("com.baidu.hugegraph.unit.perf.testclass2"); + perf.profilePackage("org.apache.hugegraph.unit.perf.testclass2"); TestClass4Package.Foo obj = new TestClass4Package.Foo(); obj.foo(); diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/StopwatchTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/StopwatchTest.java similarity index 92% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/StopwatchTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/StopwatchTest.java index 53d5e60a21..dbbe4823fa 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/StopwatchTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/StopwatchTest.java @@ -17,16 +17,16 @@ * under the License. */ -package com.baidu.hugegraph.unit.perf; +package org.apache.hugegraph.unit.perf; import org.junit.Test; -import com.baidu.hugegraph.perf.LightStopwatch; -import com.baidu.hugegraph.perf.NormalStopwatch; -import com.baidu.hugegraph.perf.Stopwatch; -import com.baidu.hugegraph.perf.Stopwatch.Path; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.perf.LightStopwatch; +import org.apache.hugegraph.perf.NormalStopwatch; +import org.apache.hugegraph.perf.Stopwatch; +import org.apache.hugegraph.perf.Stopwatch.Path; +import org.apache.hugegraph.unit.BaseUnitTest; public class StopwatchTest extends BaseUnitTest { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestClass.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestClass.java similarity index 94% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestClass.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestClass.java index 4288824a9e..455c1707f0 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestClass.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestClass.java @@ -17,10 +17,10 @@ * under the License. */ -package com.baidu.hugegraph.unit.perf.testclass; +package org.apache.hugegraph.unit.perf.testclass; -import com.baidu.hugegraph.perf.PerfUtil; -import com.baidu.hugegraph.perf.PerfUtil.Watched; +import org.apache.hugegraph.perf.PerfUtil; +import org.apache.hugegraph.perf.PerfUtil.Watched; public class TestClass { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestLightClass.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestLightClass.java similarity index 92% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestLightClass.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestLightClass.java index 47ec3f1b77..658b654bc3 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestLightClass.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestLightClass.java @@ -17,9 +17,9 @@ * under the License. */ -package com.baidu.hugegraph.unit.perf.testclass; +package org.apache.hugegraph.unit.perf.testclass; -import com.baidu.hugegraph.perf.PerfUtil.Watched; +import org.apache.hugegraph.perf.PerfUtil.Watched; public class TestLightClass { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfClass.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestPerfClass.java similarity index 94% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfClass.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestPerfClass.java index 9ac381a4ad..9e53fa6a50 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfClass.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestPerfClass.java @@ -17,9 +17,9 @@ * under the License. */ -package com.baidu.hugegraph.unit.perf.testclass; +package org.apache.hugegraph.unit.perf.testclass; -import com.baidu.hugegraph.perf.PerfUtil.Watched; +import org.apache.hugegraph.perf.PerfUtil.Watched; public class TestPerfClass { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfLightClass.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestPerfLightClass.java similarity index 92% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfLightClass.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestPerfLightClass.java index 389ef23009..4f5939ed77 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfLightClass.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestPerfLightClass.java @@ -17,13 +17,13 @@ * under the License. */ -package com.baidu.hugegraph.unit.perf.testclass; +package org.apache.hugegraph.unit.perf.testclass; -import com.baidu.hugegraph.perf.PerfUtil.Watched; +import org.apache.hugegraph.perf.PerfUtil.Watched; public class TestPerfLightClass { - private Foo foo = new Foo(); + private final Foo foo = new Foo(); @Watched public void test(int times) { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass2/TestClass4Package.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass2/TestClass4Package.java similarity index 93% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass2/TestClass4Package.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass2/TestClass4Package.java index b86890768f..ffd76cdb19 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass2/TestClass4Package.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass2/TestClass4Package.java @@ -17,9 +17,9 @@ * under the License. */ -package com.baidu.hugegraph.unit.perf.testclass2; +package org.apache.hugegraph.unit.perf.testclass2; -import com.baidu.hugegraph.perf.PerfUtil.Watched; +import org.apache.hugegraph.perf.PerfUtil.Watched; public class TestClass4Package { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestClientTest.java similarity index 98% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestClientTest.java index bd48a0c40c..71fa1cd639 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestClientTest.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.unit.rest; +package org.apache.hugegraph.unit.rest; import java.security.NoSuchAlgorithmException; import java.util.HashMap; @@ -38,24 +38,27 @@ import jakarta.ws.rs.core.MultivaluedHashMap; import jakarta.ws.rs.core.MultivaluedMap; import jakarta.ws.rs.core.Response; + +import org.junit.Test; +import org.mockito.Mockito; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import org.glassfish.jersey.internal.util.collection.ImmutableMultivaluedMap; + import org.apache.http.HttpClientConnection; import org.apache.http.HttpHeaders; import org.apache.http.HttpHost; import org.apache.http.conn.routing.HttpRoute; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.pool.PoolStats; -import org.glassfish.jersey.internal.util.collection.ImmutableMultivaluedMap; -import org.junit.Test; -import org.mockito.Mockito; -import com.baidu.hugegraph.rest.AbstractRestClient; -import com.baidu.hugegraph.rest.ClientException; -import com.baidu.hugegraph.rest.RestClient; -import com.baidu.hugegraph.rest.RestResult; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.testutil.Whitebox; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; +import org.apache.hugegraph.rest.AbstractRestClient; +import org.apache.hugegraph.rest.ClientException; +import org.apache.hugegraph.rest.RestClient; +import org.apache.hugegraph.rest.RestResult; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.testutil.Whitebox; public class RestClientTest { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/rest/RestResultTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestResultTest.java similarity index 96% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/rest/RestResultTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestResultTest.java index 02832fd586..141b5f5081 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/rest/RestResultTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestResultTest.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.unit.rest; +package org.apache.hugegraph.unit.rest; import java.util.Map; @@ -28,12 +28,13 @@ import org.junit.Test; import org.mockito.Mockito; -import com.baidu.hugegraph.rest.RestResult; -import com.baidu.hugegraph.rest.SerializeException; -import com.baidu.hugegraph.testutil.Assert; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import org.apache.hugegraph.rest.RestResult; +import org.apache.hugegraph.rest.SerializeException; +import org.apache.hugegraph.testutil.Assert; + public class RestResultTest { @Test diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/BytesTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/BytesTest.java similarity index 96% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/BytesTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/BytesTest.java index c3d2cb1dd0..0d184a5b68 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/BytesTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/BytesTest.java @@ -17,14 +17,14 @@ * under the License. */ -package com.baidu.hugegraph.unit.util; +package org.apache.hugegraph.unit.util; import org.junit.Test; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; -import com.baidu.hugegraph.util.Bytes; -import com.baidu.hugegraph.util.NumericUtil; +import org.apache.hugegraph.unit.BaseUnitTest; +import org.apache.hugegraph.util.Bytes; +import org.apache.hugegraph.util.NumericUtil; +import org.apache.hugegraph.testutil.Assert; public class BytesTest extends BaseUnitTest { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/CollectionUtilTest.java similarity index 99% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/CollectionUtilTest.java index 72fc01e716..23ffff74c9 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/CollectionUtilTest.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.unit.util; +package org.apache.hugegraph.unit.util; import java.util.ArrayList; import java.util.Arrays; @@ -31,9 +31,9 @@ import org.junit.Test; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; -import com.baidu.hugegraph.util.CollectionUtil; +import org.apache.hugegraph.unit.BaseUnitTest; +import org.apache.hugegraph.util.CollectionUtil; +import org.apache.hugegraph.testutil.Assert; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/DateUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/DateUtilTest.java similarity index 96% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/DateUtilTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/DateUtilTest.java index 5a6e54c79e..051253f5f0 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/DateUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/DateUtilTest.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.unit.util; +package org.apache.hugegraph.unit.util; import java.util.ArrayList; import java.util.Date; @@ -27,9 +27,9 @@ import org.junit.Test; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; -import com.baidu.hugegraph.util.DateUtil; +import org.apache.hugegraph.util.DateUtil; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.unit.BaseUnitTest; public class DateUtilTest extends BaseUnitTest { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/EcheckTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/EcheckTest.java similarity index 96% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/EcheckTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/EcheckTest.java index 46b9113bf2..59f70f51d3 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/EcheckTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/EcheckTest.java @@ -17,13 +17,13 @@ * under the License. */ -package com.baidu.hugegraph.unit.util; +package org.apache.hugegraph.unit.util; import org.junit.Test; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; -import com.baidu.hugegraph.util.E; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.unit.BaseUnitTest; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/HashUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/HashUtilTest.java similarity index 94% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/HashUtilTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/HashUtilTest.java index ada7842ebe..6ba5d4a915 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/HashUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/HashUtilTest.java @@ -17,14 +17,14 @@ * under the License. */ -package com.baidu.hugegraph.unit.util; +package org.apache.hugegraph.unit.util; import org.junit.Test; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; -import com.baidu.hugegraph.util.Bytes; -import com.baidu.hugegraph.util.HashUtil; +import org.apache.hugegraph.util.Bytes; +import org.apache.hugegraph.util.HashUtil; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.unit.BaseUnitTest; public class HashUtilTest extends BaseUnitTest { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/InsertionOrderUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/InsertionOrderUtilTest.java similarity index 96% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/InsertionOrderUtilTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/InsertionOrderUtilTest.java index a8d9fa5d7c..9dc49a402b 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/InsertionOrderUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/InsertionOrderUtilTest.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.unit.util; +package org.apache.hugegraph.unit.util; import java.util.List; import java.util.Map; @@ -25,9 +25,9 @@ import org.junit.Test; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; -import com.baidu.hugegraph.util.InsertionOrderUtil; +import org.apache.hugegraph.unit.BaseUnitTest; +import org.apache.hugegraph.util.InsertionOrderUtil; +import org.apache.hugegraph.testutil.Assert; import com.google.common.collect.ImmutableList; public class InsertionOrderUtilTest extends BaseUnitTest { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/LogTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/LogTest.java similarity index 79% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/LogTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/LogTest.java index 9afe842cb4..dac5ece0f4 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/LogTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/LogTest.java @@ -17,28 +17,28 @@ * under the License. */ -package com.baidu.hugegraph.unit.util; +package org.apache.hugegraph.unit.util; import org.junit.Test; import org.slf4j.Logger; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; -import com.baidu.hugegraph.util.Log; +import org.apache.hugegraph.unit.BaseUnitTest; +import org.apache.hugegraph.util.Log; +import org.apache.hugegraph.testutil.Assert; public class LogTest extends BaseUnitTest { @Test public void testLog() { Logger log1 = Log.logger(LogTest.class); - Logger log2 = Log.logger("com.baidu.hugegraph.unit.util.LogTest"); + Logger log2 = Log.logger("org.apache.hugegraph.unit.util.LogTest"); Logger log3 = Log.logger("test"); Assert.assertEquals(log1, log2); Assert.assertNotEquals(log1, log3); log1.info("Info: testLog({})", LogTest.class); - log2.info("Info: testLog({})", "com.baidu.hugegraph.unit.util.LogTest"); + log2.info("Info: testLog({})", "org.apache.hugegraph.unit.util.LogTest"); log3.info("Info: testLog({})", "test"); } } diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/LongEncodingTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/LongEncodingTest.java similarity index 98% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/LongEncodingTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/LongEncodingTest.java index 5a245a3977..7f44340e6f 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/LongEncodingTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/LongEncodingTest.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.unit.util; +package org.apache.hugegraph.unit.util; import java.math.BigDecimal; import java.text.ParseException; @@ -28,11 +28,11 @@ import org.junit.Test; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; -import com.baidu.hugegraph.util.Bytes; -import com.baidu.hugegraph.util.LongEncoding; -import com.baidu.hugegraph.util.NumericUtil; +import org.apache.hugegraph.unit.BaseUnitTest; +import org.apache.hugegraph.util.Bytes; +import org.apache.hugegraph.util.LongEncoding; +import org.apache.hugegraph.util.NumericUtil; +import org.apache.hugegraph.testutil.Assert; public class LongEncodingTest extends BaseUnitTest { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/NumericUtilTest.java similarity index 98% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/NumericUtilTest.java index 00e70ad8c6..c6b94b1bf7 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/NumericUtilTest.java @@ -17,17 +17,17 @@ * under the License. */ -package com.baidu.hugegraph.unit.util; +package org.apache.hugegraph.unit.util; import java.math.BigDecimal; import java.util.Date; import org.junit.Test; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; -import com.baidu.hugegraph.util.Bytes; -import com.baidu.hugegraph.util.NumericUtil; +import org.apache.hugegraph.unit.BaseUnitTest; +import org.apache.hugegraph.util.Bytes; +import org.apache.hugegraph.util.NumericUtil; +import org.apache.hugegraph.testutil.Assert; public class NumericUtilTest extends BaseUnitTest { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/OrderLimitMapTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/OrderLimitMapTest.java similarity index 98% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/OrderLimitMapTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/OrderLimitMapTest.java index 75137d56ad..048cd1360c 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/OrderLimitMapTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/OrderLimitMapTest.java @@ -17,14 +17,14 @@ * under the License. */ -package com.baidu.hugegraph.unit.util; +package org.apache.hugegraph.unit.util; import java.util.Map; import org.junit.Test; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.util.OrderLimitMap; +import org.apache.hugegraph.util.OrderLimitMap; +import org.apache.hugegraph.testutil.Assert; import com.google.common.collect.ImmutableList; public class OrderLimitMapTest { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/ReflectionUtilTest.java similarity index 74% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/ReflectionUtilTest.java index 7031a447f8..b400f5297b 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/ReflectionUtilTest.java @@ -17,25 +17,26 @@ * under the License. */ -package com.baidu.hugegraph.unit.util; +package org.apache.hugegraph.unit.util; import java.io.IOException; import java.lang.reflect.Method; +import java.util.Comparator; import java.util.List; -import org.apache.commons.collections.IteratorUtils; import org.junit.Test; -import com.baidu.hugegraph.perf.PerfUtil.Watched; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; -import com.baidu.hugegraph.unit.perf.testclass.TestClass; -import com.baidu.hugegraph.unit.perf.testclass.TestClass.Bar; -import com.baidu.hugegraph.unit.perf.testclass.TestClass.Base; -import com.baidu.hugegraph.unit.perf.testclass.TestClass.Foo; -import com.baidu.hugegraph.unit.perf.testclass.TestClass.ManuallyProfile; -import com.baidu.hugegraph.unit.perf.testclass.TestClass.Sub; -import com.baidu.hugegraph.util.ReflectionUtil; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.unit.perf.testclass.TestClass; +import org.apache.hugegraph.unit.perf.testclass.TestClass.Bar; +import org.apache.hugegraph.unit.perf.testclass.TestClass.Base; +import org.apache.hugegraph.unit.perf.testclass.TestClass.Foo; +import org.apache.hugegraph.unit.perf.testclass.TestClass.ManuallyProfile; +import org.apache.hugegraph.unit.perf.testclass.TestClass.Sub; +import org.apache.hugegraph.perf.PerfUtil; +import org.apache.hugegraph.unit.BaseUnitTest; +import org.apache.hugegraph.util.ReflectionUtil; +import org.apache.commons.collections.IteratorUtils; import com.google.common.reflect.ClassPath.ClassInfo; import javassist.NotFoundException; @@ -72,7 +73,7 @@ public void testGetMethodsAnnotatedWith() { List methods; methods = ReflectionUtil.getMethodsAnnotatedWith(Sub.class, - Watched.class, + PerfUtil.Watched.class, false); methods.sort((m1, m2) -> m1.getName().compareTo(m2.getName())); Assert.assertEquals(2, methods.size()); @@ -81,7 +82,7 @@ public void testGetMethodsAnnotatedWith() { methods = ReflectionUtil.getMethodsAnnotatedWith(Sub.class, - Watched.class, + PerfUtil.Watched.class, true); methods.sort((m1, m2) -> m1.getName().compareTo(m2.getName())); Assert.assertEquals(3, methods.size()); @@ -94,16 +95,16 @@ public void testGetMethodsAnnotatedWith() { public void testClasses() throws IOException { @SuppressWarnings("unchecked") List classes = IteratorUtils.toList(ReflectionUtil.classes( - "com.baidu.hugegraph.util")); + "org.apache.hugegraph.util")); Assert.assertEquals(17, classes.size()); - classes.sort((c1, c2) -> c1.getName().compareTo(c2.getName())); - Assert.assertEquals("com.baidu.hugegraph.util.Bytes", + classes.sort(Comparator.comparing(ClassInfo::getName)); + Assert.assertEquals("org.apache.hugegraph.util.Bytes", classes.get(0).getName()); - Assert.assertEquals("com.baidu.hugegraph.util.CheckSocket", + Assert.assertEquals("org.apache.hugegraph.util.CheckSocket", classes.get(1).getName()); - Assert.assertEquals("com.baidu.hugegraph.util.CollectionUtil", + Assert.assertEquals("org.apache.hugegraph.util.CollectionUtil", classes.get(2).getName()); - Assert.assertEquals("com.baidu.hugegraph.util.VersionUtil", + Assert.assertEquals("org.apache.hugegraph.util.VersionUtil", classes.get(16).getName()); } @@ -111,9 +112,9 @@ public void testClasses() throws IOException { public void testSuperClasses() throws NotFoundException { List classes = ReflectionUtil.superClasses(Sub.class.getName()); Assert.assertEquals(2, classes.size()); - classes.sort((c1, c2) -> c1.compareTo(c2)); - Assert.assertEquals(Base.class.getName(), classes.get(0)); - Assert.assertEquals(Object.class.getName(), classes.get(1)); + classes.sort(String::compareTo); + Assert.assertEquals(Object.class.getName(), classes.get(0)); + Assert.assertEquals(Base.class.getName(), classes.get(1)); } @Test @@ -131,20 +132,20 @@ public void testNestedClasses() throws NotFoundException { @Test public void testPackageName() { - String clazz = "com.baidu.hugegraph.unit.perf.testclass2.Test"; - Assert.assertEquals("com.baidu.hugegraph.unit.perf.testclass2", + String clazz = "org.apache.hugegraph.unit.perf.testclass2.Test"; + Assert.assertEquals("org.apache.hugegraph.unit.perf.testclass2", ReflectionUtil.packageName(clazz)); - clazz = "com.baidu.hugegraph.unit.perf.testclass2.Test$Bar"; - Assert.assertEquals("com.baidu.hugegraph.unit.perf.testclass2", + clazz = "org.apache.hugegraph.unit.perf.testclass2.Test$Bar"; + Assert.assertEquals("org.apache.hugegraph.unit.perf.testclass2", ReflectionUtil.packageName(clazz)); - clazz = "com.baidu.hugegraph.unit.perf.testclass.Test$Bar"; - Assert.assertEquals("com.baidu.hugegraph.unit.perf.testclass", + clazz = "org.apache.hugegraph.unit.perf.testclass.Test$Bar"; + Assert.assertEquals("org.apache.hugegraph.unit.perf.testclass", ReflectionUtil.packageName(clazz)); - clazz = "com.baidu.hugegraph.unit.perf.testclass..Test$Bar"; - Assert.assertEquals("com.baidu.hugegraph.unit.perf.testclass.", + clazz = "org.apache.hugegraph.unit.perf.testclass..Test$Bar"; + Assert.assertEquals("org.apache.hugegraph.unit.perf.testclass.", ReflectionUtil.packageName(clazz)); clazz = "com"; diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/StringUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/StringUtilTest.java similarity index 97% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/StringUtilTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/StringUtilTest.java index 6840f7c0c8..bd4e962e2a 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/StringUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/StringUtilTest.java @@ -17,16 +17,16 @@ * under the License. */ -package com.baidu.hugegraph.unit.util; +package org.apache.hugegraph.unit.util; import java.util.ArrayList; import java.util.List; import org.junit.Test; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.util.StringUtil; -import com.baidu.hugegraph.util.StringUtil.Chars; +import org.apache.hugegraph.util.StringUtil; +import org.apache.hugegraph.util.StringUtil.Chars; +import org.apache.hugegraph.testutil.Assert; import com.google.common.base.Splitter; public class StringUtilTest { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/TimeUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/TimeUtilTest.java similarity index 95% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/TimeUtilTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/TimeUtilTest.java index 13f831af55..453de2f106 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/TimeUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/TimeUtilTest.java @@ -17,15 +17,15 @@ * under the License. */ -package com.baidu.hugegraph.unit.util; +package org.apache.hugegraph.unit.util; import java.util.Date; import org.junit.Test; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; -import com.baidu.hugegraph.util.TimeUtil; +import org.apache.hugegraph.util.TimeUtil; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.unit.BaseUnitTest; public class TimeUtilTest extends BaseUnitTest { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/UnitUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/UnitUtilTest.java similarity index 99% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/UnitUtilTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/UnitUtilTest.java index a7e31e98d1..fd146b8fc8 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/UnitUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/UnitUtilTest.java @@ -17,13 +17,13 @@ * under the License. */ -package com.baidu.hugegraph.unit.util; +package org.apache.hugegraph.unit.util; import org.junit.Test; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.util.Bytes; -import com.baidu.hugegraph.util.UnitUtil; +import org.apache.hugegraph.util.Bytes; +import org.apache.hugegraph.util.UnitUtil; +import org.apache.hugegraph.testutil.Assert; public class UnitUtilTest { diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/VersionUtilTest.java similarity index 92% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/VersionUtilTest.java index 9ee1862a40..6ed04505af 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/VersionUtilTest.java @@ -17,16 +17,16 @@ * under the License. */ -package com.baidu.hugegraph.unit.util; +package org.apache.hugegraph.unit.util; import java.net.MalformedURLException; import org.junit.Test; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.unit.BaseUnitTest; -import com.baidu.hugegraph.util.VersionUtil; -import com.baidu.hugegraph.util.VersionUtil.Version; +import org.apache.hugegraph.util.VersionUtil; +import org.apache.hugegraph.util.VersionUtil.Version; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.unit.BaseUnitTest; public class VersionUtilTest extends BaseUnitTest { @@ -140,17 +140,17 @@ public void testGetImplementationVersion() throws MalformedURLException { @Test public void testVersion() { // Test equals - Version v1 = VersionUtil.Version.of("0.2.1"); - Version v2 = VersionUtil.Version.of("0.2.1"); + Version v1 = Version.of("0.2.1"); + Version v2 = Version.of("0.2.1"); Assert.assertEquals(v1, v1); Assert.assertEquals(v1, v2); - Version v3 = VersionUtil.Version.of("0.2.0"); - Version v4 = VersionUtil.Version.of("0.2"); + Version v3 = Version.of("0.2.0"); + Version v4 = Version.of("0.2"); Assert.assertEquals(v3, v4); - Version v5 = VersionUtil.Version.of("0.2.3"); - Version v6 = VersionUtil.Version.of("0.3.2"); + Version v5 = Version.of("0.2.3"); + Version v6 = Version.of("0.3.2"); Assert.assertNotEquals(v5, v6); Assert.assertNotEquals(v5, null); Assert.assertNotEquals(v5, "0.2.3"); diff --git a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/version/VersionTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/version/VersionTest.java similarity index 86% rename from hugegraph-common/src/test/java/com/baidu/hugegraph/unit/version/VersionTest.java rename to hugegraph-common/src/test/java/org/apache/hugegraph/unit/version/VersionTest.java index 6d92e1176a..12e3c659bb 100644 --- a/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/version/VersionTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/version/VersionTest.java @@ -17,13 +17,13 @@ * under the License. */ -package com.baidu.hugegraph.unit.version; +package org.apache.hugegraph.unit.version; +import org.apache.hugegraph.util.VersionUtil; import org.junit.Test; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.util.VersionUtil; -import com.baidu.hugegraph.version.CommonVersion; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.version.CommonVersion; public class VersionTest { diff --git a/hugegraph-common/src/test/resources/log4j2.xml b/hugegraph-common/src/test/resources/log4j2.xml index 7ef111d207..15600fcad9 100644 --- a/hugegraph-common/src/test/resources/log4j2.xml +++ b/hugegraph-common/src/test/resources/log4j2.xml @@ -18,7 +18,7 @@ - + diff --git a/hugegraph-rpc/pom.xml b/hugegraph-rpc/pom.xml index 2c2d1c1b1a..924c5dee0a 100644 --- a/hugegraph-rpc/pom.xml +++ b/hugegraph-rpc/pom.xml @@ -12,7 +12,7 @@ hugegraph-rpc ${artifactId} - HugeGraph Database RPC component + HugeGraph RPC component @@ -21,9 +21,9 @@ - com.baidu.hugegraph + org.apache.hugegraph hugegraph-common - ${project.version} + ${revision} diff --git a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/config/RpcOptions.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/config/RpcOptions.java similarity index 94% rename from hugegraph-rpc/src/main/java/com/baidu/hugegraph/config/RpcOptions.java rename to hugegraph-rpc/src/main/java/org/apache/hugegraph/config/RpcOptions.java index d58673cc90..782643eac8 100644 --- a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/config/RpcOptions.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/config/RpcOptions.java @@ -17,11 +17,14 @@ * under the License. */ -package com.baidu.hugegraph.config; +package org.apache.hugegraph.config; -import static com.baidu.hugegraph.config.OptionChecker.allowValues; -import static com.baidu.hugegraph.config.OptionChecker.disallowEmpty; -import static com.baidu.hugegraph.config.OptionChecker.rangeInt; +import org.apache.hugegraph.config.ConfigOption; +import org.apache.hugegraph.config.OptionHolder; + +import static org.apache.hugegraph.config.OptionChecker.allowValues; +import static org.apache.hugegraph.config.OptionChecker.disallowEmpty; +import static org.apache.hugegraph.config.OptionChecker.rangeInt; public class RpcOptions extends OptionHolder { diff --git a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/rpc/RpcClientProvider.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcClientProvider.java similarity index 94% rename from hugegraph-rpc/src/main/java/com/baidu/hugegraph/rpc/RpcClientProvider.java rename to hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcClientProvider.java index 6f0eba5a6c..b17191a6d4 100644 --- a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/rpc/RpcClientProvider.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcClientProvider.java @@ -17,16 +17,16 @@ * under the License. */ -package com.baidu.hugegraph.rpc; +package org.apache.hugegraph.rpc; import java.util.Arrays; import java.util.LinkedHashSet; import java.util.Set; import com.alipay.sofa.rpc.common.utils.StringUtils; -import com.baidu.hugegraph.config.HugeConfig; -import com.baidu.hugegraph.config.RpcOptions; -import com.baidu.hugegraph.util.E; +import org.apache.hugegraph.config.RpcOptions; +import org.apache.hugegraph.config.HugeConfig; +import org.apache.hugegraph.util.E; public class RpcClientProvider { diff --git a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/rpc/RpcCommonConfig.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcCommonConfig.java similarity index 92% rename from hugegraph-rpc/src/main/java/com/baidu/hugegraph/rpc/RpcCommonConfig.java rename to hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcCommonConfig.java index 4ee50b6826..475a82a916 100644 --- a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/rpc/RpcCommonConfig.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcCommonConfig.java @@ -17,13 +17,13 @@ * under the License. */ -package com.baidu.hugegraph.rpc; +package org.apache.hugegraph.rpc; import java.util.Map; import com.alipay.sofa.rpc.common.RpcConfigs; -import com.baidu.hugegraph.config.HugeConfig; -import com.baidu.hugegraph.config.RpcOptions; +import org.apache.hugegraph.config.HugeConfig; +import org.apache.hugegraph.config.RpcOptions; public class RpcCommonConfig { diff --git a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/rpc/RpcConsumerConfig.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcConsumerConfig.java similarity index 98% rename from hugegraph-rpc/src/main/java/com/baidu/hugegraph/rpc/RpcConsumerConfig.java rename to hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcConsumerConfig.java index c9b28f98e7..f2c9b920eb 100644 --- a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/rpc/RpcConsumerConfig.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcConsumerConfig.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.rpc; +package org.apache.hugegraph.rpc; import java.util.ArrayList; import java.util.List; @@ -38,9 +38,9 @@ import com.alipay.sofa.rpc.core.response.SofaResponse; import com.alipay.sofa.rpc.ext.Extension; import com.alipay.sofa.rpc.ext.ExtensionLoaderFactory; -import com.baidu.hugegraph.config.HugeConfig; -import com.baidu.hugegraph.config.RpcOptions; -import com.baidu.hugegraph.util.Log; +import org.apache.hugegraph.config.HugeConfig; +import org.apache.hugegraph.config.RpcOptions; +import org.apache.hugegraph.util.Log; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; diff --git a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/rpc/RpcException.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcException.java similarity index 97% rename from hugegraph-rpc/src/main/java/com/baidu/hugegraph/rpc/RpcException.java rename to hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcException.java index 2a2675ce43..6fc2f2493d 100644 --- a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/rpc/RpcException.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcException.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.rpc; +package org.apache.hugegraph.rpc; public class RpcException extends RuntimeException { diff --git a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/rpc/RpcProviderConfig.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcProviderConfig.java similarity index 97% rename from hugegraph-rpc/src/main/java/com/baidu/hugegraph/rpc/RpcProviderConfig.java rename to hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcProviderConfig.java index 8bf0aea3a4..bc6d322d2d 100644 --- a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/rpc/RpcProviderConfig.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcProviderConfig.java @@ -17,12 +17,12 @@ * under the License. */ -package com.baidu.hugegraph.rpc; +package org.apache.hugegraph.rpc; import java.util.Map; import com.alipay.sofa.rpc.config.ProviderConfig; -import com.baidu.hugegraph.util.E; +import org.apache.hugegraph.util.E; import com.google.common.collect.Maps; public class RpcProviderConfig implements RpcServiceConfig4Server { diff --git a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/rpc/RpcServer.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServer.java similarity index 95% rename from hugegraph-rpc/src/main/java/com/baidu/hugegraph/rpc/RpcServer.java rename to hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServer.java index a7e0ba9115..576ad8180b 100644 --- a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/rpc/RpcServer.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServer.java @@ -17,11 +17,10 @@ * under the License. */ -package com.baidu.hugegraph.rpc; +package org.apache.hugegraph.rpc; import java.util.Map; -import org.apache.commons.collections.MapUtils; import org.slf4j.Logger; import com.alipay.remoting.RemotingServer; @@ -30,11 +29,12 @@ import com.alipay.sofa.rpc.config.ServerConfig; import com.alipay.sofa.rpc.server.Server; import com.alipay.sofa.rpc.server.bolt.BoltServer; -import com.baidu.hugegraph.config.HugeConfig; -import com.baidu.hugegraph.config.RpcOptions; -import com.baidu.hugegraph.testutil.Whitebox; -import com.baidu.hugegraph.util.E; -import com.baidu.hugegraph.util.Log; +import org.apache.hugegraph.config.RpcOptions; +import org.apache.commons.collections.MapUtils; +import org.apache.hugegraph.config.HugeConfig; +import org.apache.hugegraph.testutil.Whitebox; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.Log; public class RpcServer { diff --git a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Client.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Client.java similarity index 97% rename from hugegraph-rpc/src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Client.java rename to hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Client.java index 13cfca96f0..51b59c4aa1 100644 --- a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Client.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Client.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.rpc; +package org.apache.hugegraph.rpc; public interface RpcServiceConfig4Client { diff --git a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Server.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Server.java similarity index 97% rename from hugegraph-rpc/src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Server.java rename to hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Server.java index 7139073cf3..9c0a0e510d 100644 --- a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Server.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Server.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.rpc; +package org.apache.hugegraph.rpc; public interface RpcServiceConfig4Server { diff --git a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/version/RpcVersion.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/version/RpcVersion.java similarity index 86% rename from hugegraph-rpc/src/main/java/com/baidu/hugegraph/version/RpcVersion.java rename to hugegraph-rpc/src/main/java/org/apache/hugegraph/version/RpcVersion.java index 5faee27abc..753ef2fb19 100644 --- a/hugegraph-rpc/src/main/java/com/baidu/hugegraph/version/RpcVersion.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/version/RpcVersion.java @@ -17,15 +17,14 @@ * under the License. */ -package com.baidu.hugegraph.version; +package org.apache.hugegraph.version; -import com.baidu.hugegraph.util.VersionUtil.Version; +import org.apache.hugegraph.util.VersionUtil.Version; public class RpcVersion { public static final String NAME = "hugegraph-rpc"; // The second parameter of Version.of() is for all-in-one JAR - public static final Version VERSION = Version.of(RpcVersion.class, - "2.1.2"); + public static final Version VERSION = Version.of(RpcVersion.class, "1.0.0"); } diff --git a/hugegraph-rpc/src/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java b/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java similarity index 86% rename from hugegraph-rpc/src/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java rename to hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java index cdbdb03b45..9d1e0d7731 100644 --- a/hugegraph-rpc/src/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java +++ b/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java @@ -17,21 +17,21 @@ * under the License. */ -package com.baidu.hugegraph.unit; +package org.apache.hugegraph.unit; import java.net.URL; import org.junit.BeforeClass; -import com.baidu.hugegraph.config.HugeConfig; -import com.baidu.hugegraph.config.OptionSpace; -import com.baidu.hugegraph.rpc.RpcServer; +import org.apache.hugegraph.config.HugeConfig; +import org.apache.hugegraph.config.OptionSpace; +import org.apache.hugegraph.rpc.RpcServer; public class BaseUnitTest { @BeforeClass public static void initEnv() { - OptionSpace.register("rpc", "com.baidu.hugegraph.config.RpcOptions"); + OptionSpace.register("rpc", "org.apache.hugegraph.config.RpcOptions"); } protected static HugeConfig config(boolean server) { diff --git a/hugegraph-rpc/src/test/java/com/baidu/hugegraph/unit/ExceptionTest.java b/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ExceptionTest.java similarity index 93% rename from hugegraph-rpc/src/test/java/com/baidu/hugegraph/unit/ExceptionTest.java rename to hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ExceptionTest.java index ade219804b..9ca812a59d 100644 --- a/hugegraph-rpc/src/test/java/com/baidu/hugegraph/unit/ExceptionTest.java +++ b/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ExceptionTest.java @@ -17,12 +17,12 @@ * under the License. */ -package com.baidu.hugegraph.unit; +package org.apache.hugegraph.unit; import org.junit.Test; -import com.baidu.hugegraph.rpc.RpcException; -import com.baidu.hugegraph.testutil.Assert; +import org.apache.hugegraph.rpc.RpcException; +import org.apache.hugegraph.testutil.Assert; public class ExceptionTest { diff --git a/hugegraph-rpc/src/test/java/com/baidu/hugegraph/unit/ServerClientTest.java b/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ServerClientTest.java similarity index 97% rename from hugegraph-rpc/src/test/java/com/baidu/hugegraph/unit/ServerClientTest.java rename to hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ServerClientTest.java index 28fe564d8b..590749e1e0 100644 --- a/hugegraph-rpc/src/test/java/com/baidu/hugegraph/unit/ServerClientTest.java +++ b/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ServerClientTest.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.unit; +package org.apache.hugegraph.unit; import java.io.IOException; import java.net.InetAddress; @@ -31,15 +31,15 @@ import com.alipay.sofa.rpc.common.RpcOptions; import com.alipay.sofa.rpc.core.exception.SofaRpcException; import com.alipay.sofa.rpc.core.exception.SofaRpcRuntimeException; -import com.baidu.hugegraph.config.HugeConfig; -import com.baidu.hugegraph.rpc.RpcClientProvider; -import com.baidu.hugegraph.rpc.RpcCommonConfig; -import com.baidu.hugegraph.rpc.RpcConsumerConfig; -import com.baidu.hugegraph.rpc.RpcProviderConfig; -import com.baidu.hugegraph.rpc.RpcServer; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.testutil.Whitebox; -import com.baidu.hugegraph.util.E; +import org.apache.hugegraph.config.HugeConfig; +import org.apache.hugegraph.rpc.RpcClientProvider; +import org.apache.hugegraph.rpc.RpcCommonConfig; +import org.apache.hugegraph.rpc.RpcConsumerConfig; +import org.apache.hugegraph.rpc.RpcProviderConfig; +import org.apache.hugegraph.rpc.RpcServer; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.testutil.Whitebox; +import org.apache.hugegraph.util.E; import com.google.common.collect.ImmutableMap; public class ServerClientTest extends BaseUnitTest { @@ -147,8 +147,7 @@ public void testStartServerWithRandomPort() { // Init client HugeConfig config = config(false); String url = rpcServerRandom.host() + ":" + rpcServerRandom.port(); - String remoteUrlKey = com.baidu.hugegraph.config - .RpcOptions.RPC_REMOTE_URL.name(); + String remoteUrlKey = org.apache.hugegraph.config.RpcOptions.RPC_REMOTE_URL.name(); config.setProperty(remoteUrlKey, url); RpcClientProvider rpcClientRandom = new RpcClientProvider(config); @@ -186,8 +185,7 @@ public void testStartServerWithAdaptivePort() throws IOException { // Init client HugeConfig config = config(false); String url = rpcServerAdaptive.host() + ":" + rpcServerAdaptive.port(); - String remoteUrlKey = com.baidu.hugegraph.config - .RpcOptions.RPC_REMOTE_URL.name(); + String remoteUrlKey = org.apache.hugegraph.config.RpcOptions.RPC_REMOTE_URL.name(); config.setProperty(remoteUrlKey, url); RpcClientProvider rpcClientAdaptive = new RpcClientProvider(config); @@ -458,8 +456,7 @@ public void testLoadBalancer() { s5g1.resetResult(); // Test LB "roundRobin" - String lbKey = com.baidu.hugegraph.config - .RpcOptions.RPC_CLIENT_LOAD_BALANCER.name(); + String lbKey = org.apache.hugegraph.config.RpcOptions.RPC_CLIENT_LOAD_BALANCER.name(); clientLB.setProperty(lbKey, "roundRobin"); RpcClientProvider rpcClientRound = new RpcClientProvider(clientLB); HelloService round = rpcClientRound.config() diff --git a/hugegraph-rpc/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/UnitTestSuite.java similarity index 96% rename from hugegraph-rpc/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java rename to hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/UnitTestSuite.java index 79446602a9..ed422950d1 100644 --- a/hugegraph-rpc/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java +++ b/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/UnitTestSuite.java @@ -17,7 +17,7 @@ * under the License. */ -package com.baidu.hugegraph.unit; +package org.apache.hugegraph.unit; import org.junit.runner.RunWith; import org.junit.runners.Suite; diff --git a/hugegraph-rpc/src/test/java/com/baidu/hugegraph/unit/VersionTest.java b/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/VersionTest.java similarity index 87% rename from hugegraph-rpc/src/test/java/com/baidu/hugegraph/unit/VersionTest.java rename to hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/VersionTest.java index 1430bda5ea..fae9fb84f1 100644 --- a/hugegraph-rpc/src/test/java/com/baidu/hugegraph/unit/VersionTest.java +++ b/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/VersionTest.java @@ -17,13 +17,13 @@ * under the License. */ -package com.baidu.hugegraph.unit; +package org.apache.hugegraph.unit; import org.junit.Test; -import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.util.VersionUtil; -import com.baidu.hugegraph.version.RpcVersion; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.util.VersionUtil; +import org.apache.hugegraph.version.RpcVersion; public class VersionTest { diff --git a/hugegraph-rpc/src/test/resources/log4j2.xml b/hugegraph-rpc/src/test/resources/log4j2.xml index f69acfd1b7..033c5b887e 100644 --- a/hugegraph-rpc/src/test/resources/log4j2.xml +++ b/hugegraph-rpc/src/test/resources/log4j2.xml @@ -18,7 +18,7 @@ - + diff --git a/pom.xml b/pom.xml index 2a5c1e9a0c..a80d987bec 100644 --- a/pom.xml +++ b/pom.xml @@ -31,6 +31,7 @@ + https://github.com/hugegraph/hugegraph-commons https://github.com/hugegraph/hugegraph-commons @@ -38,7 +39,7 @@ - 2.1.2 + 1.0.0 UTF-8 ${project.basedir}/.. 1.8 From e85ab38c6b8bebfe2734df37ef06d8978fbe3b71 Mon Sep 17 00:00:00 2001 From: imbajin Date: Thu, 15 Sep 2022 16:36:13 +0800 Subject: [PATCH 176/217] refact: clean code & typo & update the name of getTimeZone (#105) * refact: clean code & typo & update the name of getTimeZone Typo: getTimeZome() -> getTimeZone() And we need check/update the class used it later * Update RestClient.java --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- .github/ISSUE_TEMPLATE/question_ask.yml | 2 +- .../apache/hugegraph/concurrent/KeyLock.java | 10 +-- .../PausableScheduledThreadPool.java | 3 +- .../hugegraph/config/OptionChecker.java | 82 ++++++------------- .../apache/hugegraph/date/SafeDateFormat.java | 2 +- .../org/apache/hugegraph/event/EventHub.java | 4 +- .../apache/hugegraph/event/EventListener.java | 2 +- .../apache/hugegraph/func/TriFunction.java | 3 +- .../iterator/ExtendableIterator.java | 2 +- .../hugegraph/iterator/Metadatable.java | 2 +- .../hugegraph/license/LicenseManager.java | 10 +-- .../apache/hugegraph/perf/LightStopwatch.java | 3 +- .../hugegraph/perf/NormalStopwatch.java | 6 +- .../org/apache/hugegraph/perf/PerfUtil.java | 6 +- .../org/apache/hugegraph/perf/Stopwatch.java | 50 +++++------ .../hugegraph/rest/AbstractRestClient.java | 4 +- .../org/apache/hugegraph/rest/RestClient.java | 66 +++++++++------ .../org/apache/hugegraph/testutil/Assert.java | 4 +- .../apache/hugegraph/util/CheckSocket.java | 4 +- .../apache/hugegraph/util/CollectionUtil.java | 20 ++--- .../apache/hugegraph/util/NumericUtil.java | 6 +- .../org/apache/hugegraph/util/UnitUtil.java | 2 +- .../apache/hugegraph/util/VersionUtil.java | 2 +- .../unit/date/SafeDateFormatTest.java | 4 +- .../rpc/RpcServiceConfig4Client.java | 10 +-- .../rpc/RpcServiceConfig4Server.java | 8 +- .../apache/hugegraph/unit/ExceptionTest.java | 4 +- .../hugegraph/unit/ServerClientTest.java | 8 +- 29 files changed, 150 insertions(+), 181 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 8445d0a52c..685c72dea7 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -28,7 +28,7 @@ body: options: - exception / error (异常报错) - logic (逻辑设计问题) - - performence (性能下降) + - performance (性能下降) - others (please edit later) - type: checkboxes diff --git a/.github/ISSUE_TEMPLATE/question_ask.yml b/.github/ISSUE_TEMPLATE/question_ask.yml index 9724e66c47..6fb2d4eb81 100644 --- a/.github/ISSUE_TEMPLATE/question_ask.yml +++ b/.github/ISSUE_TEMPLATE/question_ask.yml @@ -25,7 +25,7 @@ body: label: Problem Type (问题类型) options: - struct / logic (架构 / 逻辑设计问题) - - performence (性能优化) + - performance (性能优化) - exception / error (异常报错) - others (please edit later) diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/KeyLock.java b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/KeyLock.java index eda012b878..351f50cf0b 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/KeyLock.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/KeyLock.java @@ -88,7 +88,7 @@ public final List lockAll(Object... keys) { Lock lock = this.locks.get(key); locks.add(lock); } - Collections.sort(locks, (a, b) -> { + locks.sort((a, b) -> { int diff = a.hashCode() - b.hashCode(); if (diff == 0 && a != b) { diff = this.indexOf(a) - this.indexOf(b); @@ -96,8 +96,8 @@ public final List lockAll(Object... keys) { } return diff; }); - for (int i = 0; i < locks.size(); i++) { - locks.get(i).lock(); + for (Lock lock : locks) { + lock.lock(); } return Collections.unmodifiableList(locks); } @@ -125,8 +125,8 @@ public List lockAll(Object key1, Object key2) { ImmutableList.of(lock2, lock1) : ImmutableList.of(lock1, lock2); - for (int i = 0; i < locks.size(); i++) { - locks.get(i).lock(); + for (Lock lock : locks) { + lock.lock(); } return locks; diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/PausableScheduledThreadPool.java b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/PausableScheduledThreadPool.java index e5dba9fee2..ddfc8b72f5 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/PausableScheduledThreadPool.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/PausableScheduledThreadPool.java @@ -28,8 +28,7 @@ public class PausableScheduledThreadPool extends ScheduledThreadPoolExecutor { - private static final Logger LOG = Log.logger( - PausableScheduledThreadPool.class); + private static final Logger LOG = Log.logger(PausableScheduledThreadPool.class); private volatile boolean paused = false; diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionChecker.java b/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionChecker.java index 551fe93c8a..8676702a03 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionChecker.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionChecker.java @@ -21,6 +21,7 @@ import java.lang.reflect.Array; import java.util.Arrays; +import java.util.HashSet; import java.util.List; import javax.annotation.Nullable; @@ -32,88 +33,55 @@ public final class OptionChecker { public static Predicate disallowEmpty() { - return new Predicate() { - @Override - public boolean apply(@Nullable O o) { - if (o == null) { - return false; - } - if (o instanceof String) { - return StringUtils.isNotBlank((String) o); - } - if (o.getClass().isArray() && (Array.getLength(o) == 0)) { - return false; - } - if (o instanceof Iterable && - !((Iterable) o).iterator().hasNext()) { - return false; - } - return true; + return o -> { + if (o == null) { + return false; } + if (o instanceof String) { + return StringUtils.isNotBlank((String) o); + } + if (o.getClass().isArray() && (Array.getLength(o) == 0)) { + return false; + } + return !(o instanceof Iterable) || ((Iterable) o).iterator().hasNext(); }; } @SuppressWarnings("unchecked") public static Predicate allowValues(O... values) { - return new Predicate() { - @Override - public boolean apply(@Nullable O o) { - return o != null && Arrays.asList(values).contains(o); - } - }; + return o -> o != null && Arrays.asList(values).contains(o); } @SuppressWarnings("unchecked") public static Predicate> inValues(O... values) { - return new Predicate>() { - @Override - public boolean apply(@Nullable List o) { - return o != null && Arrays.asList(values).containsAll(o); - } - }; + return o -> o != null && new HashSet<>(Arrays.asList(values)).containsAll(o); } public static Predicate positiveInt() { - return new Predicate() { - @Override - public boolean apply(@Nullable N number) { - return number != null && number.longValue() > 0; - } - }; + return number -> number != null && number.longValue() > 0; } public static Predicate nonNegativeInt() { - return new Predicate() { - @Override - public boolean apply(@Nullable N number) { - return number != null && number.longValue() >= 0; - } - }; + return number -> number != null && number.longValue() >= 0; } public static Predicate rangeInt(N min, N max) { - return new Predicate() { - @Override - public boolean apply(@Nullable N number) { - if (number == null) { - return false; - } - long value = number.longValue(); - return value >= min.longValue() && value <= max.longValue(); + return number -> { + if (number == null) { + return false; } + long value = number.longValue(); + return value >= min.longValue() && value <= max.longValue(); }; } public static Predicate rangeDouble(N min, N max) { - return new Predicate() { - @Override - public boolean apply(@Nullable N number) { - if (number == null) { - return false; - } - double value = number.doubleValue(); - return value >= min.doubleValue() && value <= max.doubleValue(); + return number -> { + if (number == null) { + return false; } + double value = number.doubleValue(); + return value >= min.doubleValue() && value <= max.doubleValue(); }; } } diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/date/SafeDateFormat.java b/hugegraph-common/src/main/java/org/apache/hugegraph/date/SafeDateFormat.java index 0deba51e62..9f9a665f5b 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/date/SafeDateFormat.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/date/SafeDateFormat.java @@ -48,7 +48,7 @@ public synchronized void setTimeZone(String zoneId) { this.formatter = this.formatter.withZone(zone); } - public TimeZone getTimeZome() { + public TimeZone getTimeZone() { return this.formatter.getZone().toTimeZone(); } diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventHub.java b/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventHub.java index 0e426fcb81..2db8347429 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventHub.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventHub.java @@ -159,8 +159,8 @@ public Future notify(String event, @Nullable Object... args) { try { all.next().event(ev); count++; - } catch (Throwable ignored) { - LOG.warn("Failed to handle event: {}", ev, ignored); + } catch (Throwable e) { + LOG.warn("Failed to handle event: {}", ev, e); } } return count; diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventListener.java b/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventListener.java index a0deb4c030..3810926f02 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventListener.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventListener.java @@ -25,5 +25,5 @@ public interface EventListener extends java.util.EventListener { * @param event object * @return event result */ - public Object event(Event event); + Object event(Event event); } diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/func/TriFunction.java b/hugegraph-common/src/main/java/org/apache/hugegraph/func/TriFunction.java index b381d42e74..d84c26f3bd 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/func/TriFunction.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/func/TriFunction.java @@ -20,5 +20,6 @@ package org.apache.hugegraph.func; public interface TriFunction { - public R apply(T1 v1, T2 v2, T3 v3); + + R apply(T1 v1, T2 v2, T3 v3); } diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/ExtendableIterator.java b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/ExtendableIterator.java index d4e690f838..a07f3e47b2 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/ExtendableIterator.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/ExtendableIterator.java @@ -82,7 +82,7 @@ protected boolean fetch() { return true; } - Iterator first = null; + Iterator first; while ((first = this.itors.peekFirst()) != null && !first.hasNext()) { if (first == this.itors.peekLast() && this.itors.size() == 1) { this.currentIterator = first; diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/Metadatable.java b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/Metadatable.java index 2f7d81f3fd..777e46801c 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/Metadatable.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/Metadatable.java @@ -21,5 +21,5 @@ public interface Metadatable { - public Object metadata(String meta, Object... args); + Object metadata(String meta, Object... args); } diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseManager.java b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseManager.java index 7378899983..f87b9ebb9a 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseManager.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseManager.java @@ -21,14 +21,14 @@ public interface LicenseManager { - public LicenseParams installLicense() throws Exception; + LicenseParams installLicense() throws Exception; - public void uninstallLicense() throws Exception; + void uninstallLicense() throws Exception; - public LicenseParams verifyLicense() throws Exception; + LicenseParams verifyLicense() throws Exception; - public interface VerifyCallback { + interface VerifyCallback { - public void onVerifyLicense(LicenseParams params) throws Exception; + void onVerifyLicense(LicenseParams params) throws Exception; } } diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/LightStopwatch.java b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/LightStopwatch.java index 1f63de73c0..ca81082e6f 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/LightStopwatch.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/LightStopwatch.java @@ -135,8 +135,7 @@ public long totalChildrenWasted() { @Override public void fillChildrenTotal(List children) { // Fill total times of children - this.totalChildrenTimes = children.stream().mapToLong( - c -> c.totalTimes()).sum(); + this.totalChildrenTimes = children.stream().mapToLong(Stopwatch::totalTimes).sum(); } @Override diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/NormalStopwatch.java b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/NormalStopwatch.java index 8b8aa06932..c595a34395 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/NormalStopwatch.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/NormalStopwatch.java @@ -184,11 +184,9 @@ public long totalChildrenWasted() { @Override public void fillChildrenTotal(List children) { // Fill total wasted cost of children - this.totalChildrenWasted = children.stream().mapToLong( - c -> c.totalWasted()).sum(); + this.totalChildrenWasted = children.stream().mapToLong(Stopwatch::totalWasted).sum(); // Fill total times of children - this.totalChildrenTimes = children.stream().mapToLong( - c -> c.totalTimes()).sum(); + this.totalChildrenTimes = children.stream().mapToLong(Stopwatch::totalTimes).sum(); } @Override diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java index 62bd713e8d..1918f26921 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java @@ -681,8 +681,8 @@ public void clear() { @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.METHOD, ElementType.CONSTRUCTOR }) - public static @interface Watched { - public String value() default ""; - public String prefix() default ""; + public @interface Watched { + String value() default ""; + String prefix() default ""; } } diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/Stopwatch.java b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/Stopwatch.java index 074869d9ad..9d095c924a 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/Stopwatch.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/Stopwatch.java @@ -23,40 +23,40 @@ public interface Stopwatch extends Cloneable { - public Path id(); - public String name(); - public Path parent(); + Path id(); + String name(); + Path parent(); - public void startTime(long startTime); - public void endTime(long startTime); + void startTime(long startTime); + void endTime(long startTime); - public void lastStartTime(long startTime); + void lastStartTime(long startTime); - public long times(); - public long totalTimes(); - public long totalChildrenTimes(); + long times(); + long totalTimes(); + long totalChildrenTimes(); - public long totalCost(); - public void totalCost(long otherCost); + long totalCost(); + void totalCost(long otherCost); - public long minCost(); - public long maxCost(); + long minCost(); + long maxCost(); - public long totalWasted(); - public long totalSelfWasted(); - public long totalChildrenWasted(); + long totalWasted(); + long totalSelfWasted(); + long totalChildrenWasted(); - public void fillChildrenTotal(List children); + void fillChildrenTotal(List children); - public Stopwatch copy(); + Stopwatch copy(); - public Stopwatch child(String name); - public Stopwatch child(String name, Stopwatch watch); + Stopwatch child(String name); + Stopwatch child(String name, Stopwatch watch); - public boolean empty(); - public void clear(); + boolean empty(); + void clear(); - public default String toJson() { + default String toJson() { int len = 200 + this.name().length() + this.parent().length(); StringBuilder sb = new StringBuilder(len); sb.append("{"); @@ -75,14 +75,14 @@ public default String toJson() { return sb.toString(); } - public static Path id(Path parent, String name) { + static Path id(Path parent, String name) { if (parent == Path.EMPTY && name == Path.ROOT_NAME) { return Path.EMPTY; } return new Path(parent, name); } - public static final class Path implements Comparable { + final class Path implements Comparable { public static final String ROOT_NAME = "root"; public static final Path EMPTY = new Path(""); diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java index bf156b8ef7..276a8fe0a8 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java @@ -435,11 +435,11 @@ private static PoolingHttpClientConnectionManager connectionManager( String url, ClientConfig conf) { String protocol = (String) conf.getProperty("protocol"); - if (protocol == null || protocol.equals("http")) { + if (protocol == null || "http".equals(protocol)) { return new PoolingHttpClientConnectionManager(TTL, TimeUnit.HOURS); } - assert protocol.equals("https"); + assert "https".equals(protocol); String trustStoreFile = (String) conf.getProperty("trustStoreFile"); E.checkArgument(trustStoreFile != null && !trustStoreFile.isEmpty(), "The trust store file must be set when use https"); diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClient.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClient.java index 3e095d5354..06347b3b06 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClient.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClient.java @@ -24,31 +24,45 @@ import jakarta.ws.rs.core.MultivaluedMap; public interface RestClient { + /** + * Post method + */ + RestResult post(String path, Object object); - public RestResult post(String path, Object object); - public RestResult post(String path, Object object, - MultivaluedMap headers); - public RestResult post(String path, Object object, - Map params); - public RestResult post(String path, Object object, - MultivaluedMap headers, - Map params); - - public RestResult put(String path, String id, Object object); - public RestResult put(String path, String id, Object object, - MultivaluedMap headers); - public RestResult put(String path, String id, Object object, - Map params); - public RestResult put(String path, String id, Object object, - MultivaluedMap headers, - Map params); - - public RestResult get(String path); - public RestResult get(String path, Map params); - public RestResult get(String path, String id); - - public RestResult delete(String path, Map params); - public RestResult delete(String path, String id); - - public void close(); + RestResult post(String path, Object object, MultivaluedMap headers); + + RestResult post(String path, Object object, Map params); + + RestResult post(String path, Object object, MultivaluedMap headers, + Map params); + + /** + * Put method + */ + RestResult put(String path, String id, Object object); + + RestResult put(String path, String id, Object object, MultivaluedMap headers); + + RestResult put(String path, String id, Object object, Map params); + + RestResult put(String path, String id, Object object, MultivaluedMap headers, + Map params); + + /** + * Get method + */ + RestResult get(String path); + + RestResult get(String path, Map params); + + RestResult get(String path, String id); + + /** + * Delete method + */ + RestResult delete(String path, Map params); + + RestResult delete(String path, String id); + + void close(); } diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Assert.java b/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Assert.java index 284c5721ff..519d20530a 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Assert.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Assert.java @@ -42,9 +42,7 @@ public interface ThrowableConsumer { public static void assertThrows(Class throwable, ThrowableRunnable runnable) { CompletableFuture future = assertThrowsFuture(throwable, runnable); - future.thenAccept(e -> { - System.err.println(e); - }); + future.thenAccept(System.err::println); } public static void assertThrows(Class throwable, diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/CheckSocket.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/CheckSocket.java index 9924388205..96d83e38ec 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/CheckSocket.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/CheckSocket.java @@ -47,8 +47,8 @@ public static void main(String[] args) { Integer.parseInt(args[1])); s.close(); System.exit(0); - } catch (IOException ignored) { - System.err.println(ignored.toString()); + } catch (IOException e) { + System.err.println(e); System.exit(E_FAILED); } } diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/CollectionUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/CollectionUtil.java index c1f3404ede..6e04858be7 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/CollectionUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/CollectionUtil.java @@ -150,7 +150,7 @@ public static Collection intersect(Collection first, E.checkNotNull(first, "first"); E.checkNotNull(second, "second"); - HashSet results = null; + HashSet results; if (first instanceof HashSet) { @SuppressWarnings("unchecked") HashSet clone = (HashSet) ((HashSet) first).clone(); @@ -303,7 +303,7 @@ public static List> cnm(List all, int n, int m) { * @param n m of C(n, m) * @param m n of C(n, m) * @return true if matched any kind of items combination else false, the - * callback can always return false if want to traverse all combinations + * callback can always return false if you want to traverse all combinations */ public static boolean cnm(List all, int n, int m, Function, Boolean> callback) { @@ -317,9 +317,9 @@ public static boolean cnm(List all, int n, int m, * @param n n of C(n, m) * @param m m of C(n, m) * @param current current position in list - * @param selected list to contains selected items + * @param selected list to contain selected items * @return true if matched any kind of items combination else false, the - * callback can always return false if want to traverse all combinations + * callback can always return false if you want to traverse all combinations */ private static boolean cnm(List all, int n, int m, int current, List selected, @@ -360,11 +360,7 @@ private static boolean cnm(List all, int n, int m, // Not select current item, pop it and continue to select C(m-1, n) selected.remove(index); assert selected.size() == index : selected; - if (cnm(all, n - 1, m, current, selected, callback)) { - return true; - } - - return false; + return cnm(all, n - 1, m, current, selected, callback); } /** @@ -399,7 +395,7 @@ public static List> anm(List all, int n, int m) { * @param n m of A(n, m) * @param m n of A(n, m) * @return true if matched any kind of items combination else false, the - * callback can always return false if want to traverse all combinations + * callback can always return false if you want to traverse all combinations */ public static boolean anm(List all, int n, int m, Function, Boolean> callback) { @@ -412,9 +408,9 @@ public static boolean anm(List all, int n, int m, * @param all list to contain all items for combination * @param n m of A(n, m) * @param m n of A(n, m) - * @param selected list to contains selected items + * @param selected list to contain selected items * @return true if matched any kind of items combination else false, the - * callback can always return false if want to traverse all combinations + * callback can always return false if you want to traverse all combinations */ private static boolean anm(List all, int n, int m, List selected, diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/NumericUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/NumericUtil.java index d9dd190459..f567a89593 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/NumericUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/NumericUtil.java @@ -40,7 +40,7 @@ private NumericUtil() { * long. The value is converted by getting their IEEE 754 * floating-point "double format" bit layout and then some bits * are swapped, to be able to compare the result as long. By this the - * precision is not reduced, but the value can easily used as a long. The + * precision is not reduced, but the value can be easily used as a long. The * sort order (including {@link Double#NaN}) is defined by * {@link Double#compareTo}; {@code NaN} is greater than positive infinity. * @param value input double value @@ -66,7 +66,7 @@ public static double sortableLongToDouble(long value) { * int. The value is converted by getting their IEEE 754 * floating-point "float format" bit layout and then some bits are * swapped, to be able to compare the result as int. By this the precision - * is not reduced, but the value can easily used as an int. The sort order + * is not reduced, but the value can be easily used as an int. The sort order * (including {@link Float#NaN}) is defined by {@link Float#compareTo}; * {@code NaN} is greater than positive infinity. * @param value input float value @@ -100,7 +100,7 @@ public static long sortableDoubleBits(long bits) { /** * Converts IEEE 754 representation of a float to sortable order (or back to * the original) - * @param bits The int format of an float value + * @param bits The int format of a float value * @return The sortable int value */ public static int sortableFloatBits(int bits) { diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/UnitUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/UnitUtil.java index e21ed9e60f..138fed9cda 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/UnitUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/UnitUtil.java @@ -156,7 +156,7 @@ public static long timestampFromReadableString(String valueWithUnit) { } else { // Not exists days int msPos = formatDuration.indexOf("MS"); - // If contains ms, rmove the ms part + // If contains ms, remove the ms part if (msPos >= 0) { int sPos = formatDuration.indexOf("S"); if (0 <= sPos && sPos < msPos) { diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java index 57c9eb7cc7..4bd76f7710 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java @@ -94,7 +94,7 @@ public static String getImplementationVersion(Class clazz) { public static String getImplementationVersion(String manifestPath) { manifestPath += "/META-INF/MANIFEST.MF"; - Manifest manifest = null; + Manifest manifest; try { manifest = new Manifest(new URL(manifestPath).openStream()); } catch (IOException ignored) { diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/date/SafeDateFormatTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/date/SafeDateFormatTest.java index 6c9e89edb2..68bad8c330 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/date/SafeDateFormatTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/date/SafeDateFormatTest.java @@ -109,7 +109,7 @@ public void testTimeZone() throws ParseException { SafeDateFormat sdf = new SafeDateFormat("yyyy-MM-dd HH:mm:ss"); sdf.setTimeZone("GMT+10"); - Assert.assertEquals(df.getTimeZone(), sdf.getTimeZome()); + Assert.assertEquals(df.getTimeZone(), sdf.getTimeZone()); Assert.assertEquals(df.parse("2019-08-10 00:00:00"), sdf.parse("2019-08-10 00:00:00")); Assert.assertEquals("2019-08-10 00:00:00", @@ -118,7 +118,7 @@ public void testTimeZone() throws ParseException { sdf.format(sdf.parse("2019-08-10 00:00:00"))); sdf.setTimeZone("GMT+11"); - Assert.assertNotEquals(df.getTimeZone(), sdf.getTimeZome()); + Assert.assertNotEquals(df.getTimeZone(), sdf.getTimeZone()); Assert.assertNotEquals(df.parse("2019-08-10 00:00:00"), sdf.parse("2019-08-10 00:00:00")); Assert.assertEquals("2019-08-10 00:00:00", diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Client.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Client.java index 51b59c4aa1..333f0abc8a 100644 --- a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Client.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Client.java @@ -21,17 +21,17 @@ public interface RpcServiceConfig4Client { - public T serviceProxy(String interfaceId); + T serviceProxy(String interfaceId); - public T serviceProxy(String graph, String interfaceId); + T serviceProxy(String graph, String interfaceId); - public default T serviceProxy(Class clazz) { + default T serviceProxy(Class clazz) { return this.serviceProxy(clazz.getName()); } - public default T serviceProxy(String graph, Class clazz) { + default T serviceProxy(String graph, Class clazz) { return this.serviceProxy(graph, clazz.getName()); } - public void removeAllServiceProxy(); + void removeAllServiceProxy(); } diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Server.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Server.java index 9c0a0e510d..0359350474 100644 --- a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Server.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Server.java @@ -21,12 +21,12 @@ public interface RpcServiceConfig4Server { - public String addService(Class clazz, S serviceImpl); + String addService(Class clazz, S serviceImpl); - public String addService(String graph, + String addService(String graph, Class clazz, S serviceImpl); - public void removeService(String serviceId); + void removeService(String serviceId); - public void removeAllService(); + void removeAllService(); } diff --git a/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ExceptionTest.java b/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ExceptionTest.java index 9ca812a59d..c70d00b71a 100644 --- a/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ExceptionTest.java +++ b/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ExceptionTest.java @@ -30,7 +30,7 @@ public class ExceptionTest { public void testExceptionWithMessage() { RpcException e = new RpcException("test"); Assert.assertEquals("test", e.getMessage()); - Assert.assertEquals(null, e.getCause()); + Assert.assertNull(e.getCause()); } @Test @@ -45,7 +45,7 @@ public void testExceptionWithMessageAndCause() { public void testExceptionWithMessageAndArgs() { RpcException e = new RpcException("test %s", 168); Assert.assertEquals("test 168", e.getMessage()); - Assert.assertEquals(null, e.getCause()); + Assert.assertNull(e.getCause()); } @Test diff --git a/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ServerClientTest.java b/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ServerClientTest.java index 590749e1e0..7f73a9afea 100644 --- a/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ServerClientTest.java +++ b/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ServerClientTest.java @@ -682,9 +682,7 @@ public void testServerDisabled() { RpcServer rpcServerDisabled = new RpcServer(clientConf); Assert.assertFalse(rpcServerDisabled.enabled()); - Assert.assertThrows(IllegalArgumentException.class, () -> { - rpcServerDisabled.config(); - }, e -> { + Assert.assertThrows(IllegalArgumentException.class, rpcServerDisabled::config, e -> { Assert.assertContains("RpcServer is not enabled", e.getMessage()); }); @@ -697,9 +695,7 @@ public void testClientDisabled() { RpcClientProvider rpcClientDisabled = new RpcClientProvider(serverConf); Assert.assertFalse(rpcClientDisabled.enabled()); - Assert.assertThrows(IllegalArgumentException.class, () -> { - rpcClientDisabled.config(); - }, e -> { + Assert.assertThrows(IllegalArgumentException.class, rpcClientDisabled::config, e -> { Assert.assertContains("RpcClient is not enabled", e.getMessage()); }); From be72d20f8a06e7f5de240159fb1c0867b35165b0 Mon Sep 17 00:00:00 2001 From: imbajin Date: Wed, 19 Oct 2022 23:42:31 +0800 Subject: [PATCH 177/217] chore: setup for apache maven release (#107) --- pom.xml | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index a80d987bec..6b4a837038 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ pom ${project.artifactId} - https://github.com/apache/incubator-hugegraph-commons + https://github.com/apache/hugegraph-commons hugegraph-commons is a common module for HugeGraph-Common and HugeGraph-Rpc with their peripheral components. It includes rpc frame, locks, configurations, events, iterators, rest and some @@ -18,9 +18,9 @@ - org.sonatype.oss - oss-parent - 7 + org.apache + apache + 23 @@ -33,9 +33,9 @@ - https://github.com/hugegraph/hugegraph-commons - https://github.com/hugegraph/hugegraph-commons - https://github.com/hugegraph/hugegraph-commons + https://github.com/apache/hugegraph-commons + https://github.com/apache/hugegraph-commons + https://github.com/apache/hugegraph-commons @@ -188,7 +188,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.9.1 + 2.10.1 attach-javadocs @@ -197,6 +197,11 @@ + + + -Xdoclint:none + + org.apache.maven.plugins From b783da5bdeb0c22999a2245c9b8b70a2e63d27f9 Mon Sep 17 00:00:00 2001 From: imbajin Date: Thu, 20 Oct 2022 12:18:49 +0800 Subject: [PATCH 178/217] feat(apache): support check license header with RAT (#108) use "mvn apache-rat:check" to see the report, and use find ./ -name rat.txt -print0 | xargs -0 -I file cat file > merged-rat.txt --- .github/workflows/ci.yml | 5 ++ hugegraph-common/build.sh | 16 ++++++ hugegraph-common/pom.xml | 16 ++++++ .../unit/concurrent/BarrierEventTest.java | 19 +++++++ .../src/test/resources/log4j2.xml | 16 ++++++ hugegraph-rpc/pom.xml | 16 ++++++ hugegraph-rpc/src/test/resources/log4j2.xml | 16 ++++++ pom.xml | 53 +++++++++++++++++++ 8 files changed, 157 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e319c49df8..755f1c23c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,6 +39,11 @@ jobs: with: fetch-depth: 2 + - name: License check(RAT) + run: | + mvn apache-rat:check | grep -v "Downloading\|Downloaded\|Progress" + find ./ -name rat.txt -print0 | xargs -0 -I file cat file > merged-rat.txt && cat merged-rat.txt + - name: Compile run: | mvn compile -Dmaven.javadoc.skip=true | grep -v "Downloading\|Downloaded" diff --git a/hugegraph-common/build.sh b/hugegraph-common/build.sh index e6479e3f43..b0eef45966 100644 --- a/hugegraph-common/build.sh +++ b/hugegraph-common/build.sh @@ -1,4 +1,20 @@ #!/usr/bin/env bash +# +# 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. +# export MAVEN_HOME=/home/scmtools/buildkit/maven/apache-maven-3.3.9/ export JAVA_HOME=/home/scmtools/buildkit/java/jdk1.8.0_25/ diff --git a/hugegraph-common/pom.xml b/hugegraph-common/pom.xml index 1c3637bfba..a188f9faa5 100644 --- a/hugegraph-common/pom.xml +++ b/hugegraph-common/pom.xml @@ -1,4 +1,20 @@ + diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/BarrierEventTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/BarrierEventTest.java index c40a2f2ea3..64a0d49be7 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/BarrierEventTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/BarrierEventTest.java @@ -1,3 +1,22 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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.unit.concurrent; import java.util.concurrent.CountDownLatch; diff --git a/hugegraph-common/src/test/resources/log4j2.xml b/hugegraph-common/src/test/resources/log4j2.xml index 15600fcad9..5ada1de623 100644 --- a/hugegraph-common/src/test/resources/log4j2.xml +++ b/hugegraph-common/src/test/resources/log4j2.xml @@ -1,4 +1,20 @@ + diff --git a/hugegraph-rpc/pom.xml b/hugegraph-rpc/pom.xml index 924c5dee0a..ba61ba637b 100644 --- a/hugegraph-rpc/pom.xml +++ b/hugegraph-rpc/pom.xml @@ -1,4 +1,20 @@ + diff --git a/hugegraph-rpc/src/test/resources/log4j2.xml b/hugegraph-rpc/src/test/resources/log4j2.xml index 033c5b887e..e84e39584f 100644 --- a/hugegraph-rpc/src/test/resources/log4j2.xml +++ b/hugegraph-rpc/src/test/resources/log4j2.xml @@ -1,4 +1,20 @@ + diff --git a/pom.xml b/pom.xml index 6b4a837038..c49e83ec26 100644 --- a/pom.xml +++ b/pom.xml @@ -1,4 +1,20 @@ + @@ -164,6 +180,43 @@ + + + org.apache.rat + apache-rat-plugin + + + **/*.versionsBackup + **/*.log + **/*.txt + **/*.json + **/*.conf + **/*.properties + dist/**/* + docs/**/* + scripts/dev/reviewers + **/*.md + **/dependency-reduced-pom.xml + **/logs/*.log + **/target/* + style/* + ChangeLog + CONFIG.ini + GROUPS + OWNERS + + .github/**/* + + **/*.iml + **/*.iws + **/*.ipr + **/META-INF/MANIFEST.MF + + .repository/** + + true + + From ae54f283086a03c68650c5934e94a2bbff2f3e80 Mon Sep 17 00:00:00 2001 From: imbajin Date: Wed, 26 Oct 2022 19:02:36 +0800 Subject: [PATCH 179/217] refact: upgrade a string of dependencies to address CVEs report & clean code (#110) Note: after use junit-2.13, some assert-api's error messages has changed, check it in other repos (and avoid use long & fixed error message) --- .gitignore | 1 + hugegraph-common/pom.xml | 7 +- .../iterator/BatchMapperIterator.java | 1 + .../org/apache/hugegraph/perf/PerfUtil.java | 5 +- .../hugegraph/rest/AbstractRestClient.java | 2 +- .../apache/hugegraph/util/LongEncoding.java | 6 +- .../apache/hugegraph/util/OrderLimitMap.java | 3 +- .../apache/hugegraph/util/ReflectionUtil.java | 13 +- .../org/apache/hugegraph/util/UnitUtil.java | 3 +- .../apache/hugegraph/util/VersionUtil.java | 3 +- .../apache/hugegraph/testutil/AssertTest.java | 20 ++-- .../unit/concurrent/BarrierEventTest.java | 2 +- .../unit/concurrent/LockGroupTest.java | 2 +- .../PausableScheduledThreadPoolTest.java | 4 +- .../hugegraph/unit/config/HugeConfigTest.java | 6 +- .../hugegraph/unit/event/EventHubTest.java | 113 ++++-------------- .../iterator/BatchMapperIteratorTest.java | 20 +--- .../unit/iterator/ExtendableIteratorTest.java | 20 +--- .../unit/iterator/FilterIteratorTest.java | 20 +--- .../FlatMapperFilterIteratorTest.java | 28 ++--- .../unit/iterator/FlatMapperIteratorTest.java | 20 +--- .../unit/iterator/LimitIteratorTest.java | 20 +--- .../unit/iterator/ListIteratorTest.java | 56 +++------ .../unit/iterator/MapperIteratorTest.java | 23 +--- .../hugegraph/unit/perf/StopwatchTest.java | 48 ++++---- .../apache/hugegraph/unit/util/BytesTest.java | 6 +- .../hugegraph/unit/util/LongEncodingTest.java | 4 +- .../hugegraph/unit/util/NumericUtilTest.java | 64 +++++----- .../unit/util/ReflectionUtilTest.java | 2 +- .../hugegraph/unit/util/StringUtilTest.java | 11 +- .../hugegraph/unit/util/UnitUtilTest.java | 4 +- .../hugegraph/unit/util/VersionUtilTest.java | 3 +- hugegraph-rpc/pom.xml | 7 +- .../rpc/RpcServiceConfig4Server.java | 3 +- .../hugegraph/unit/ServerClientTest.java | 10 +- pom.xml | 12 +- 36 files changed, 197 insertions(+), 375 deletions(-) diff --git a/.gitignore b/.gitignore index fa22f58767..8053b45a7b 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ target gen-java build node* +*.versionsBackup diff --git a/hugegraph-common/pom.xml b/hugegraph-common/pom.xml index a188f9faa5..862c3d775b 100644 --- a/hugegraph-common/pom.xml +++ b/hugegraph-common/pom.xml @@ -27,7 +27,7 @@ hugegraph-common - ${artifactId} + ${project.artifactId} https://github.com/apache/incubator-hugegraph-commons/tree/master/hugegraph-common hugegraph-common is a common module for HugeGraph and its peripheral components. @@ -211,7 +211,6 @@ maven-compiler-plugin - 3.1 ${compiler.source} ${compiler.target} @@ -226,7 +225,6 @@ org.apache.maven.plugins maven-jar-plugin - 2.6 true @@ -281,7 +279,6 @@ org.apache.maven.plugins maven-source-plugin - 2.2.1 attach-sources @@ -294,7 +291,6 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.9.1 attach-javadocs @@ -307,7 +303,6 @@ org.apache.maven.plugins maven-gpg-plugin - 1.5 sign-artifacts diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/BatchMapperIterator.java b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/BatchMapperIterator.java index 79f9e87bda..39be041e52 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/BatchMapperIterator.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/BatchMapperIterator.java @@ -25,6 +25,7 @@ import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.InsertionOrderUtil; + import com.google.common.collect.ImmutableList; public class BatchMapperIterator extends WrappedIterator { diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java index 1918f26921..39cface3df 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java @@ -361,7 +361,8 @@ public String toECharts() { sb.append("',"); sb.append("value:"); - sb.append(w.totalCost()); // w.totalCost() - w.totalWasted() ? + // w.totalCost() - w.totalWasted() ? + sb.append(w.totalCost()); sb.append(','); sb.append("cost:"); @@ -419,7 +420,7 @@ public String toECharts() { return c.parent().equals(parent.id()); }); // Fill other cost - long sumCost = children.mapToLong(c -> c.totalCost()).sum(); + long sumCost = children.mapToLong(Stopwatch::totalCost).sum(); long otherCost = parent.totalCost() - sumCost; if (otherCost > 0L) { Stopwatch other = newStopwatch("~", parent.id()); diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java index 276a8fe0a8..fd9fdaba26 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java @@ -589,7 +589,7 @@ public ClientConfig build() { public static class BearerRequestFilter implements ClientRequestFilter { @Override - public void filter(ClientRequestContext context) throws IOException { + public void filter(ClientRequestContext context) { String token = context.getClient().getConfiguration() .getProperty(TOKEN_KEY).toString(); context.getHeaders().add(HttpHeaders.AUTHORIZATION, diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/LongEncoding.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/LongEncoding.java index 3488445f7e..24c857fd03 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/LongEncoding.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/LongEncoding.java @@ -40,8 +40,7 @@ public static String encodeNumber(Object number) { public static Number decodeNumber(String str, Class clazz) { long value = decodeSortable(str); - Number number = NumericUtil.sortableLongToNumber(value, clazz); - return number; + return NumericUtil.sortableLongToNumber(value, clazz); } public static String encodeSortable(long num) { @@ -130,10 +129,11 @@ public static long decode(String encoded, String symbols) { for (char ch : encoded.toCharArray()) { num *= B; int pos = symbols.indexOf(ch); - if (pos < 0) + if (pos < 0) { throw new NumberFormatException(String.format( "Can't decode symbol '%s' in string '%s'", ch, encoded)); + } num += pos; } return num; diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/OrderLimitMap.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/OrderLimitMap.java index e286ca934e..d8b0cc6ffc 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/OrderLimitMap.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/OrderLimitMap.java @@ -27,7 +27,8 @@ import com.google.common.collect.Ordering; /** - * Reference: https://stackoverflow.com/questions/109383/sort-a-mapkey-value-by-values + * Reference: + * ... */ public class OrderLimitMap, V extends Comparable> extends TreeMap { diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/ReflectionUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/ReflectionUtil.java index 853086912e..812a962ae5 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/ReflectionUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/ReflectionUtil.java @@ -39,14 +39,11 @@ public final class ReflectionUtil { public static boolean isSimpleType(Class type) { - if (type.isPrimitive() || - type.equals(String.class) || - type.equals(Boolean.class) || - type.equals(Character.class) || - NumericUtil.isNumber(type)) { - return true; - } - return false; + return type.isPrimitive() || + type.equals(String.class) || + type.equals(Boolean.class) || + type.equals(Character.class) || + NumericUtil.isNumber(type); } public static List getMethodsAnnotatedWith( diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/UnitUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/UnitUtil.java index 138fed9cda..30c1beee05 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/UnitUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/UnitUtil.java @@ -20,6 +20,7 @@ package org.apache.hugegraph.util; import java.math.BigDecimal; +import java.math.RoundingMode; import java.time.Duration; public final class UnitUtil { @@ -34,7 +35,7 @@ public static double bytesToGB(long bytes) { public static double doubleWith2Scale(double value) { BigDecimal decimal = new BigDecimal(value); - return decimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + return decimal.setScale(2, RoundingMode.HALF_UP).doubleValue(); } public static String bytesToReadableString(long bytes) { diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java index 4bd76f7710..cc98fa1c5d 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java @@ -23,6 +23,7 @@ import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; +import java.util.Objects; import java.util.jar.Attributes; import java.util.jar.Manifest; @@ -79,7 +80,7 @@ public static String getImplementationVersion(Class clazz) { * https://stackoverflow.com/questions/1272648/reading-my-own-jars-manifest */ String className = clazz.getSimpleName() + ".class"; - String classPath = clazz.getResource(className).toString(); + String classPath = Objects.requireNonNull(clazz.getResource(className)).toString(); if (!classPath.startsWith("jar:file:")) { // Class not from JAR return null; diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/testutil/AssertTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/testutil/AssertTest.java index 7116adc8b0..0f30bbd2c6 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/testutil/AssertTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/testutil/AssertTest.java @@ -126,7 +126,7 @@ public void testAssertEqualsOfIntWithError() { }); Assert.assertThrows(AssertionError.class, () -> { - Assert.assertEquals(1, (Long) 1l); + Assert.assertEquals(1, (Long) 1L); }, e -> { Assert.assertContains("expected: java.lang.Integer", e.getMessage()); @@ -192,9 +192,7 @@ public void testAssertThrowsWithError() { }); Assert.fail("Expect error"); } catch (AssertionError e) { - Assert.assertEquals("No exception was thrown" + - "(expected java.lang.NullPointerException)", - e.getMessage()); + Assert.assertContains("java.lang.NullPointerException", e.getMessage()); } try { @@ -203,10 +201,8 @@ public void testAssertThrowsWithError() { }); Assert.fail("Expect error"); } catch (AssertionError e) { - Assert.assertEquals("Bad exception type " + - "java.lang.RuntimeException" + - "(expected java.lang.NullPointerException)", - e.getMessage()); + Assert.assertContains("java.lang.NullPointerException", e.getMessage()); + Assert.assertContains("java.lang.RuntimeException", e.getMessage()); } } @@ -254,7 +250,7 @@ public void testAssertGt() { }); Assert.assertThrows(AssertionError.class, () -> { - Assert.assertGt(1, Character.valueOf('2')); + Assert.assertGt(1, '2'); }, e -> { Assert.assertContains("Expected: an instance of java.lang.Integer", e.getMessage()); @@ -312,7 +308,7 @@ public void testAssertGte() { }); Assert.assertThrows(AssertionError.class, () -> { - Assert.assertGte(1, Character.valueOf('2')); + Assert.assertGte(1, '2'); }, e -> { Assert.assertContains("Expected: an instance of java.lang.Integer", e.getMessage()); @@ -342,7 +338,7 @@ public void testAssertLt() { }); Assert.assertThrows(AssertionError.class, () -> { - Assert.assertGt(1, Character.valueOf('0')); + Assert.assertGt(1, '0'); }, e -> { Assert.assertContains("Expected: an instance of java.lang.Integer", e.getMessage()); @@ -379,7 +375,7 @@ public void testAssertLte() { }); Assert.assertThrows(AssertionError.class, () -> { - Assert.assertLte(1, Character.valueOf('0')); + Assert.assertLte(1, '0'); }, e -> { Assert.assertContains("Expected: an instance of java.lang.Integer", e.getMessage()); diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/BarrierEventTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/BarrierEventTest.java index 64a0d49be7..bc69386a33 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/BarrierEventTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/BarrierEventTest.java @@ -32,7 +32,7 @@ public class BarrierEventTest { - private static int WAIT_THREADS_COUNT = 10; + private static final int WAIT_THREADS_COUNT = 10; @Test(timeout = 5000) public void testAWait() throws InterruptedException { diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/LockGroupTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/LockGroupTest.java index 3309a43b20..0d0d064300 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/LockGroupTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/LockGroupTest.java @@ -37,7 +37,7 @@ public class LockGroupTest extends BaseUnitTest { private static final String GROUP = "LockGroupTest-test-group"; - private LockGroup group = new LockGroup(GROUP); + private final LockGroup group = new LockGroup(GROUP); @Test public void testLock() { diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java index fb66741d3c..a477344deb 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java @@ -31,7 +31,7 @@ public class PausableScheduledThreadPoolTest { @Test - public void testscheduleWithFixedDelay() throws InterruptedException { + public void testScheduleWithFixedDelay() throws InterruptedException { PausableScheduledThreadPool executor = ExecutorUtil.newPausableScheduledThreadPool("test"); long period = 500L; @@ -64,7 +64,7 @@ public void testscheduleWithFixedDelay() throws InterruptedException { } @Test - public void testscheduleWithFixedRate() throws InterruptedException { + public void testScheduleWithFixedRate() throws InterruptedException { PausableScheduledThreadPool executor = ExecutorUtil.newPausableScheduledThreadPool(2, "test"); long period = 500L; diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/HugeConfigTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/HugeConfigTest.java index 01ffb316b3..7664f7847d 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/HugeConfigTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/HugeConfigTest.java @@ -99,8 +99,8 @@ public void testOptionDesc() { @Test public void testOptionRequired() { - Assert.assertEquals(false, TestOptions.text1.required()); - Assert.assertEquals(true, TestSubOptions.text2.required()); + Assert.assertFalse(TestOptions.text1.required()); + Assert.assertTrue(TestSubOptions.text2.required()); } @Test @@ -670,6 +670,6 @@ protected boolean forList() { public enum WeekDay { - SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY; + SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY } } diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/event/EventHubTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/event/EventHubTest.java index c8743e99aa..b5b1591956 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/event/EventHubTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/event/EventHubTest.java @@ -80,12 +80,7 @@ public void testEventGetListenerNonResult() { public void testEventAddListener() { final String event = "event-test"; - EventListener listener = new EventListener() { - @Override - public Object event(Event arg0) { - return null; - } - }; + EventListener listener = (Event e) -> null; this.eventHub.listen(event, listener); @@ -98,12 +93,7 @@ public Object event(Event arg0) { public void testEventAddListenerTwice() { final String event = "event-test"; - EventListener listener = new EventListener() { - @Override - public Object event(Event arg0) { - return null; - } - }; + EventListener listener = (Event e) -> null; this.eventHub.listen(event, listener); this.eventHub.listen(event, listener); @@ -118,12 +108,7 @@ public Object event(Event arg0) { public void testEventRemoveListener() { final String event = "event-test"; - EventListener listener = new EventListener() { - @Override - public Object event(Event arg0) { - return null; - } - }; + EventListener listener = (Event e) -> null; this.eventHub.listen(event, listener); @@ -141,12 +126,7 @@ public Object event(Event arg0) { public void testEventRemoveListenerButNonResult() { final String event = "event-test"; - EventListener listener = new EventListener() { - @Override - public Object event(Event arg0) { - return null; - } - }; + EventListener listener = (Event e) -> null; this.eventHub.listen(event, listener); @@ -167,12 +147,7 @@ public void testEventRemoveListenerOfOneInTwo() { final String event1 = "event-test1"; final String event2 = "event-test2"; - EventListener listener = new EventListener() { - @Override - public Object event(Event arg0) { - return null; - } - }; + EventListener listener = (Event e) -> null; this.eventHub.listen(event1, listener); this.eventHub.listen(event2, listener); @@ -200,19 +175,8 @@ public Object event(Event arg0) { public void testEventRemoveListenerByEvent() { final String event = "event-test"; - EventListener listener1 = new EventListener() { - @Override - public Object event(Event arg0) { - return null; - } - }; - - EventListener listener2 = new EventListener() { - @Override - public Object event(Event arg0) { - return null; - } - }; + EventListener listener1 = (Event e) -> null; + EventListener listener2 = (Event e) -> null; this.eventHub.listen(event, listener1); this.eventHub.listen(event, listener2); @@ -232,19 +196,8 @@ public Object event(Event arg0) { public void testEventRemoveListenerByEventButNonResult() { final String event = "event-test"; - EventListener listener1 = new EventListener() { - @Override - public Object event(Event arg0) { - return null; - } - }; - - EventListener listener2 = new EventListener() { - @Override - public Object event(Event arg0) { - return null; - } - }; + EventListener listener1 = (Event e) -> null; + EventListener listener2 = (Event e) -> null; this.eventHub.listen(event, listener1); this.eventHub.listen(event, listener2); @@ -263,12 +216,7 @@ public Object event(Event arg0) { public void testEventRemoveListenerByEventOf2SameListener() { final String event = "event-test"; - EventListener listener = new EventListener() { - @Override - public Object event(Event arg0) { - return null; - } - }; + EventListener listener = (Event e) -> null; this.eventHub.listen(event, listener); this.eventHub.listen(event, listener); @@ -446,27 +394,21 @@ public void testEventNotifyWithArg2() { public void testEventNotifyWithMultiThreads() throws InterruptedException { final String notify = "event-notify"; - EventListener listener1 = new EventListener() { - @Override - public Object event(Event event) { - Assert.assertEquals(notify, event.name()); - event.checkArgs(Integer.class); - return null; - } + EventListener listener1 = event -> { + Assert.assertEquals(notify, event.name()); + event.checkArgs(Integer.class); + return null; }; - EventListener listener2 = new EventListener() { - @Override - public Object event(Event event) { - Assert.assertEquals(notify, event.name()); + EventListener listener2 = event -> { + Assert.assertEquals(notify, event.name()); - event.checkArgs(Integer.class); - int i = (int) event.args()[0]; - if (i % 10000 == 0) { - System.out.println("On event '" + notify + "': " + i); - } - return null; + event.checkArgs(Integer.class); + int i = (int) event.args()[0]; + if (i % 10000 == 0) { + System.out.println("On event '" + notify + "': " + i); } + return null; }; Thread listenerUpdateThread = new Thread(() -> { @@ -503,15 +445,12 @@ public Object event(Event event) { public void testEventCallWithMultiThreads() { final String call = "event-call"; - EventListener listener = new EventListener() { - @Override - public Object event(Event event) { - Assert.assertEquals(call, event.name()); + EventListener listener = event -> { + Assert.assertEquals(call, event.name()); - event.checkArgs(Integer.class); - int i = (int) event.args()[0]; - return i; - } + event.checkArgs(Integer.class); + int i = (int) event.args()[0]; + return i; }; this.eventHub.listen(call, listener); diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/BatchMapperIteratorTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/BatchMapperIteratorTest.java index 40a39a2178..78bd08cb0b 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/BatchMapperIteratorTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/BatchMapperIteratorTest.java @@ -123,12 +123,8 @@ public void testHasNextAndNextWithMultiTimes() { Assert.assertFalse(results.hasNext()); Assert.assertFalse(results.hasNext()); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results::next); + Assert.assertThrows(NoSuchElementException.class, results::next); } @Test @@ -159,9 +155,7 @@ public void testNextWithMultiTimes() { for (int i = 0; i < 2; i++) { results.next(); } - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results::next); } @Test @@ -281,12 +275,8 @@ public void testMapperReturnNullThenNext() { results = new BatchMapperIterator<>(1, DATA3.iterator(), batch -> { return null; }); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results::next); + Assert.assertThrows(NoSuchElementException.class, results::next); } @Test diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ExtendableIteratorTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ExtendableIteratorTest.java index e753ea8eae..fc1e9f3bae 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ExtendableIteratorTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ExtendableIteratorTest.java @@ -89,9 +89,7 @@ public void testExtendAfterHasNext() { public void testNext() { Iterator results = new ExtendableIterator<>(DATA1.iterator()); Assert.assertEquals(1, (int) results.next()); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results::next); } @Test @@ -101,9 +99,7 @@ public void testNextWithMultiTimes() { Assert.assertEquals(1, (int) results.next()); Assert.assertEquals(2, (int) results.next()); Assert.assertEquals(3, (int) results.next()); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results::next); } @Test @@ -114,9 +110,7 @@ public void testHasNextAndNext() { Assert.assertEquals(1, (int) results.next()); Assert.assertFalse(results.hasNext()); Assert.assertFalse(results.hasNext()); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results::next); } @Test @@ -143,15 +137,11 @@ public void testRemove() { @Test public void testRemoveWithoutResult() { Iterator results = new ExtendableIterator<>(); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.remove(); - }); + Assert.assertThrows(NoSuchElementException.class, results::remove); List list = new ArrayList<>(); Iterator results2 = new ExtendableIterator<>(list.iterator()); - Assert.assertThrows(NoSuchElementException.class, () -> { - results2.remove(); - }); + Assert.assertThrows(NoSuchElementException.class, results2::remove); } @Test diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FilterIteratorTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FilterIteratorTest.java index f6c0e1758d..845c5c642f 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FilterIteratorTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FilterIteratorTest.java @@ -95,12 +95,8 @@ public void testHasNextAndNextWithMultiTimes() { Assert.assertFalse(results.hasNext()); Assert.assertFalse(results.hasNext()); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results::next); + Assert.assertThrows(NoSuchElementException.class, results::next); } @Test @@ -120,9 +116,7 @@ public void testNextWithMultiTimes() { for (int i = 0; i < 4; i++) { results.next(); } - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results::next); } @Test @@ -130,12 +124,8 @@ public void testNextWithMultiTimesWithoutAnyResult() { Iterator vals = DATA.iterator(); Iterator results = new FilterIterator<>(vals, val -> false); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results::next); + Assert.assertThrows(NoSuchElementException.class, results::next); } @Test diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java index 536f38a3e0..5370fe3359 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java @@ -94,9 +94,7 @@ public void testHasNext() { key -> DATA.get(key).iterator(), val -> false); Assert.assertFalse(results2.hasNext()); - Assert.assertThrows(NoSuchElementException.class, () -> { - results2.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results2::next); } @Test @@ -113,12 +111,8 @@ public void testHasNextWithMultiTimes() { results.next(); } Assert.assertFalse(results.hasNext()); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results::next); + Assert.assertThrows(NoSuchElementException.class, results::next); Iterator results2 = new FlatMapperFilterIterator<>(keys, key -> DATA.get(key).iterator(), @@ -140,9 +134,7 @@ public void testNext() { Iterator results2 = new FlatMapperFilterIterator<>(keys, key -> DATA.get(key).iterator(), val -> false); - Assert.assertThrows(NoSuchElementException.class, () -> { - results2.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results2::next); } @Test @@ -155,19 +147,13 @@ public void testNextWithMultiTimes() { for (int i = 0; i < 10; i++) { results.next(); } - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results::next); Iterator results2 = new FlatMapperFilterIterator<>(keys, key -> DATA.get(key).iterator(), val -> false); - Assert.assertThrows(NoSuchElementException.class, () -> { - results2.next(); - }); - Assert.assertThrows(NoSuchElementException.class, () -> { - results2.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results2::next); + Assert.assertThrows(NoSuchElementException.class, results2::next); } @Test diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperIteratorTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperIteratorTest.java index 5e5baf4616..f286dd47b7 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperIteratorTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperIteratorTest.java @@ -107,12 +107,8 @@ public void testHasNextAndNextWithMultiTimes() { Assert.assertFalse(results.hasNext()); Assert.assertFalse(results.hasNext()); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results::next); + Assert.assertThrows(NoSuchElementException.class, results::next); } @Test @@ -132,9 +128,7 @@ public void testNextWithMultiTimes() { for (int i = 0; i < 10; i++) { results.next(); } - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results::next); } @Test @@ -157,12 +151,8 @@ public void testMapperReturnNullThenNext() { Assert.assertNull(DATA.get(key)); return null; }); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results::next); + Assert.assertThrows(NoSuchElementException.class, results::next); } @Test diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/LimitIteratorTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/LimitIteratorTest.java index f806b5e623..9a9f7ca0d9 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/LimitIteratorTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/LimitIteratorTest.java @@ -95,12 +95,8 @@ public void testHasNextAndNextWithMultiTimes() { Assert.assertFalse(results.hasNext()); Assert.assertFalse(results.hasNext()); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results::next); + Assert.assertThrows(NoSuchElementException.class, results::next); Iterator results2 = new LimitIterator<>(vals, val -> false); Assert.assertFalse(results2.hasNext()); @@ -123,9 +119,7 @@ public void testNextWithMultiTimes() { for (int i = 0; i < 4; i++) { results.next(); } - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results::next); } @Test @@ -133,12 +127,8 @@ public void testNextWithMultiTimesWithoutAnyResult() { Iterator vals = DATA.iterator(); Iterator results = new LimitIterator<>(vals, val -> true); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results::next); + Assert.assertThrows(NoSuchElementException.class, results::next); } @Test diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ListIteratorTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ListIteratorTest.java index d8334344ae..d6949bf5f5 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ListIteratorTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ListIteratorTest.java @@ -100,9 +100,7 @@ public void testHasNext() { public void testNext() { Iterator results = new ListIterator<>(-1, DATA1.iterator()); Assert.assertEquals(1, (int) results.next()); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results::next); } @Test @@ -111,9 +109,7 @@ public void testNextAfterList() { Assert.assertEquals(ImmutableList.of(1), ((ListIterator) results).list()); Assert.assertEquals(1, (int) results.next()); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results::next); } @Test @@ -121,9 +117,7 @@ public void testNextWithMultiTimes() { Iterator results = new ListIterator<>(-1, DATA2.iterator()); Assert.assertEquals(2, (int) results.next()); Assert.assertEquals(3, (int) results.next()); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results::next); } @Test @@ -134,9 +128,7 @@ public void testHasNextAndNext() { Assert.assertEquals(1, (int) results.next()); Assert.assertFalse(results.hasNext()); Assert.assertFalse(results.hasNext()); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results::next); } @Test @@ -147,13 +139,9 @@ public void testRemove() { Assert.assertEquals(ImmutableList.of(4, 5, 6), list); Assert.assertEquals(ImmutableList.of(4, 5, 6), results.list()); - Assert.assertThrows(UnsupportedOperationException.class, () -> { - results.remove(); - }); + Assert.assertThrows(UnsupportedOperationException.class, results::remove); results.next(); - Assert.assertThrows(UnsupportedOperationException.class, () -> { - results.remove(); - }); + Assert.assertThrows(UnsupportedOperationException.class, results::remove); Assert.assertEquals(ImmutableList.of(4, 5, 6), list); Assert.assertEquals(ImmutableList.of(4, 5, 6), results.list()); @@ -162,15 +150,11 @@ public void testRemove() { @Test public void testRemoveWithoutResult() { Iterator results = new ListIterator<>(-1, EMPTY); - Assert.assertThrows(UnsupportedOperationException.class, () -> { - results.remove(); - }); + Assert.assertThrows(UnsupportedOperationException.class, results::remove); List list0 = new ArrayList<>(); Iterator results2 = new ListIterator<>(-1, list0.iterator()); - Assert.assertThrows(UnsupportedOperationException.class, () -> { - results2.remove(); - }); + Assert.assertThrows(UnsupportedOperationException.class, results2::remove); } @Test @@ -207,17 +191,13 @@ public void testListWithConstructFromList() { public void testHasNextAndNextWithConstructFromList() { ListIterator results0 = new ListIterator<>(ImmutableList.of()); Assert.assertFalse(results0.hasNext()); - Assert.assertThrows(NoSuchElementException.class, () -> { - results0.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results0::next); ListIterator results1 = new ListIterator<>(DATA1); Assert.assertTrue(results1.hasNext()); Assert.assertEquals(1, results1.next()); Assert.assertFalse(results1.hasNext()); - Assert.assertThrows(NoSuchElementException.class, () -> { - results1.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results1::next); ListIterator results3 = new ListIterator<>(DATA3); Assert.assertTrue(results3.hasNext()); @@ -227,25 +207,19 @@ public void testHasNextAndNextWithConstructFromList() { Assert.assertTrue(results3.hasNext()); Assert.assertEquals(6, results3.next()); Assert.assertFalse(results3.hasNext()); - Assert.assertThrows(NoSuchElementException.class, () -> { - results3.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results3::next); } @Test public void testNextWithConstructFromList() { ListIterator results0 = new ListIterator<>(ImmutableList.of()); - Assert.assertThrows(NoSuchElementException.class, () -> { - results0.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results0::next); ListIterator results3 = new ListIterator<>(DATA3); Assert.assertEquals(4, results3.next()); Assert.assertEquals(5, results3.next()); Assert.assertEquals(6, results3.next()); - Assert.assertThrows(NoSuchElementException.class, () -> { - results3.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results3::next); } @Test @@ -255,8 +229,6 @@ public void testNextAfterListWithConstructFromList() { Assert.assertEquals(4, results3.next()); Assert.assertEquals(5, results3.next()); Assert.assertEquals(6, results3.next()); - Assert.assertThrows(NoSuchElementException.class, () -> { - results3.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results3::next); } } diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/MapperIteratorTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/MapperIteratorTest.java index 23b2ab07e7..c8878cab4f 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/MapperIteratorTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/MapperIteratorTest.java @@ -46,9 +46,7 @@ public class MapperIteratorTest extends BaseUnitTest { "forth", 4 ); - private static final Function MAPPER = key -> { - return DATA.get(key); - }; + private static final Function MAPPER = DATA::get; @Test public void testMapper() { @@ -100,12 +98,8 @@ public void testHasNextAndNextWithMultiTimes() { Assert.assertFalse(results.hasNext()); Assert.assertFalse(results.hasNext()); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results::next); + Assert.assertThrows(NoSuchElementException.class, results::next); } @Test @@ -125,9 +119,7 @@ public void testNextWithMultiTimes() { for (int i = 0; i < 4; i++) { results.next(); } - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results::next); } @Test @@ -147,9 +139,7 @@ public void testMapperReturnNullThenNext() { Iterator results = new MapperIterator<>(keys, key -> { return null; }); - Assert.assertThrows(NoSuchElementException.class, () -> { - results.next(); - }); + Assert.assertThrows(NoSuchElementException.class, results::next); } @Test @@ -157,8 +147,7 @@ public void testClose() throws Exception { CloseableItor keys = new CloseableItor<>( ImmutableList.of("fifth").iterator()); - MapperIterator results = - new MapperIterator<>(keys, k -> null); + MapperIterator results = new MapperIterator<>(keys, k -> null); Assert.assertFalse(keys.closed()); results.close(); diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/StopwatchTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/StopwatchTest.java index dbbe4823fa..63ef77d084 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/StopwatchTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/StopwatchTest.java @@ -49,21 +49,21 @@ public void testNormalStopwatchChild() { Assert.assertEquals(watch4, watch1.child("w4", null)); Assert.assertEquals(watch5, watch1.child("w5", null)); - Assert.assertEquals(null, watch1.child("w2")); - Assert.assertEquals(null, watch1.child("w3")); - Assert.assertEquals(null, watch1.child("w4")); - Assert.assertEquals(null, watch1.child("w5")); + Assert.assertNull(watch1.child("w2")); + Assert.assertNull(watch1.child("w3")); + Assert.assertNull(watch1.child("w4")); + Assert.assertNull(watch1.child("w5")); - Assert.assertEquals(null, watch1.child("w2", watch2)); - Assert.assertEquals(null, watch1.child("w3", watch3)); - Assert.assertEquals(null, watch1.child("w4", watch4)); - Assert.assertEquals(null, watch1.child("w5", watch5)); + Assert.assertNull(watch1.child("w2", watch2)); + Assert.assertNull(watch1.child("w3", watch3)); + Assert.assertNull(watch1.child("w4", watch4)); + Assert.assertNull(watch1.child("w5", watch5)); watch1.clear(); - Assert.assertEquals(null, watch1.child("w2")); - Assert.assertEquals(null, watch1.child("w3")); - Assert.assertEquals(null, watch1.child("w4")); - Assert.assertEquals(null, watch1.child("w5")); + Assert.assertNull(watch1.child("w2")); + Assert.assertNull(watch1.child("w3")); + Assert.assertNull(watch1.child("w4")); + Assert.assertNull(watch1.child("w5")); } @Test @@ -85,20 +85,20 @@ public void testLightStopwatchChild() { Assert.assertEquals(watch4, watch1.child("w4", null)); Assert.assertEquals(watch5, watch1.child("w5", null)); - Assert.assertEquals(null, watch1.child("w2")); - Assert.assertEquals(null, watch1.child("w3")); - Assert.assertEquals(null, watch1.child("w4")); - Assert.assertEquals(null, watch1.child("w5")); + Assert.assertNull(watch1.child("w2")); + Assert.assertNull(watch1.child("w3")); + Assert.assertNull(watch1.child("w4")); + Assert.assertNull(watch1.child("w5")); - Assert.assertEquals(null, watch1.child("w2", watch2)); - Assert.assertEquals(null, watch1.child("w3", watch3)); - Assert.assertEquals(null, watch1.child("w4", watch4)); - Assert.assertEquals(null, watch1.child("w5", watch5)); + Assert.assertNull(watch1.child("w2", watch2)); + Assert.assertNull(watch1.child("w3", watch3)); + Assert.assertNull(watch1.child("w4", watch4)); + Assert.assertNull(watch1.child("w5", watch5)); watch1.clear(); - Assert.assertEquals(null, watch1.child("w2")); - Assert.assertEquals(null, watch1.child("w3")); - Assert.assertEquals(null, watch1.child("w4")); - Assert.assertEquals(null, watch1.child("w5")); + Assert.assertNull(watch1.child("w2")); + Assert.assertNull(watch1.child("w3")); + Assert.assertNull(watch1.child("w4")); + Assert.assertNull(watch1.child("w5")); } } diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/BytesTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/BytesTest.java index 0d184a5b68..0867a7f7c1 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/BytesTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/BytesTest.java @@ -63,12 +63,12 @@ public void testBytesPrefixWith() { @Test public void testBytesCompare() { - Assert.assertTrue(Bytes.compare(b("12345678"), b("12345678")) == 0); + Assert.assertEquals(0, Bytes.compare(b("12345678"), b("12345678"))); Assert.assertTrue(Bytes.compare(b("12345678"), b("1234567")) > 0); Assert.assertTrue(Bytes.compare(b("12345678"), b("12345679")) < 0); - Assert.assertTrue(Bytes.compare(new byte[]{1, 3, 5, 7}, - new byte[]{1, 3, 5, 7}) == 0); + Assert.assertEquals(0, + Bytes.compare(new byte[]{1, 3, 5, 7}, new byte[]{1, 3, 5, 7})); Assert.assertTrue(Bytes.compare(new byte[]{1, 3, 5, 7}, new byte[]{1, 3, 5, 6}) > 0); diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/LongEncodingTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/LongEncodingTest.java index 7f44340e6f..a3f1518ef8 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/LongEncodingTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/LongEncodingTest.java @@ -629,7 +629,7 @@ public void testEncodeSortableThenCompare() { int cmp = Bytes.compare(encoded1.getBytes(), encoded2.getBytes()); if (num1 == num2) { - Assert.assertTrue(cmp == 0); + Assert.assertEquals(0, cmp); } else if (num1 > num2) { Assert.assertTrue(cmp > 0); } else { @@ -675,7 +675,7 @@ private static void compareEncodedNumber(Number num1, Number num2) { int cmp = Bytes.compare(encoded1.getBytes(), encoded2.getBytes()); if (cmpExpected == 0) { - Assert.assertTrue(cmp == 0); + Assert.assertEquals(0, cmp); } else if (cmpExpected > 0) { Assert.assertTrue(cmp > 0); } else { diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/NumericUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/NumericUtilTest.java index c6b94b1bf7..5278427d05 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/NumericUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/NumericUtilTest.java @@ -140,7 +140,7 @@ public void testSortableBytesToNumber() { public void testIntToSortableBytesAndCompare() { byte[] bytes1 = NumericUtil.numberToSortableBytes(123456); byte[] bytes2 = NumericUtil.numberToSortableBytes(123456); - Assert.assertTrue(Bytes.compare(bytes1, bytes2) == 0); + Assert.assertEquals(0, Bytes.compare(bytes1, bytes2)); bytes1 = NumericUtil.numberToSortableBytes(1); bytes2 = NumericUtil.numberToSortableBytes(2); @@ -156,7 +156,7 @@ public void testIntToSortableBytesAndCompare() { bytes1 = NumericUtil.numberToSortableBytes(-123456); bytes2 = NumericUtil.numberToSortableBytes(-123456); - Assert.assertTrue(Bytes.compare(bytes1, bytes2) == 0); + Assert.assertEquals(0, Bytes.compare(bytes1, bytes2)); bytes1 = NumericUtil.numberToSortableBytes(-1); bytes2 = NumericUtil.numberToSortableBytes(-2); @@ -191,7 +191,7 @@ public void testIntToSortableBytesAndCompare() { public void testLongToSortableBytesAndCompare() { byte[] bytes1 = NumericUtil.numberToSortableBytes(123456L); byte[] bytes2 = NumericUtil.numberToSortableBytes(123456L); - Assert.assertTrue(Bytes.compare(bytes1, bytes2) == 0); + Assert.assertEquals(0, Bytes.compare(bytes1, bytes2)); bytes1 = NumericUtil.numberToSortableBytes(1L); bytes2 = NumericUtil.numberToSortableBytes(2L); @@ -207,7 +207,7 @@ public void testLongToSortableBytesAndCompare() { bytes1 = NumericUtil.numberToSortableBytes(-123456L); bytes2 = NumericUtil.numberToSortableBytes(-123456L); - Assert.assertTrue(Bytes.compare(bytes1, bytes2) == 0); + Assert.assertEquals(0, Bytes.compare(bytes1, bytes2)); bytes1 = NumericUtil.numberToSortableBytes(-1L); bytes2 = NumericUtil.numberToSortableBytes(-2L); @@ -242,7 +242,7 @@ public void testLongToSortableBytesAndCompare() { public void testFloatToSortableBytesAndCompare() { byte[] bytes1 = NumericUtil.numberToSortableBytes(123456F); byte[] bytes2 = NumericUtil.numberToSortableBytes(123456F); - Assert.assertTrue(Bytes.compare(bytes1, bytes2) == 0); + Assert.assertEquals(0, Bytes.compare(bytes1, bytes2)); bytes1 = NumericUtil.numberToSortableBytes(1F); bytes2 = NumericUtil.numberToSortableBytes(2F); @@ -258,7 +258,7 @@ public void testFloatToSortableBytesAndCompare() { bytes1 = NumericUtil.numberToSortableBytes(-123456F); bytes2 = NumericUtil.numberToSortableBytes(-123456F); - Assert.assertTrue(Bytes.compare(bytes1, bytes2) == 0); + Assert.assertEquals(0, Bytes.compare(bytes1, bytes2)); bytes1 = NumericUtil.numberToSortableBytes(-1F); bytes2 = NumericUtil.numberToSortableBytes(-2F); @@ -293,7 +293,7 @@ public void testFloatToSortableBytesAndCompare() { public void testDoubleToSortableBytesAndCompare() { byte[] bytes1 = NumericUtil.numberToSortableBytes(123456D); byte[] bytes2 = NumericUtil.numberToSortableBytes(123456D); - Assert.assertTrue(Bytes.compare(bytes1, bytes2) == 0); + Assert.assertEquals(0, Bytes.compare(bytes1, bytes2)); bytes1 = NumericUtil.numberToSortableBytes(1D); bytes2 = NumericUtil.numberToSortableBytes(2D); @@ -309,7 +309,7 @@ public void testDoubleToSortableBytesAndCompare() { bytes1 = NumericUtil.numberToSortableBytes(-123456D); bytes2 = NumericUtil.numberToSortableBytes(-123456D); - Assert.assertTrue(Bytes.compare(bytes1, bytes2) == 0); + Assert.assertEquals(0, Bytes.compare(bytes1, bytes2)); bytes1 = NumericUtil.numberToSortableBytes(-1D); bytes2 = NumericUtil.numberToSortableBytes(-2D); @@ -392,28 +392,28 @@ public void testMaxValueOf() { @Test public void testIsNumber() { - Assert.assertEquals(true, NumericUtil.isNumber(byte.class)); - Assert.assertEquals(true, NumericUtil.isNumber(Byte.class)); - Assert.assertEquals(true, NumericUtil.isNumber(short.class)); - Assert.assertEquals(true, NumericUtil.isNumber(Short.class)); - Assert.assertEquals(true, NumericUtil.isNumber(int.class)); - Assert.assertEquals(true, NumericUtil.isNumber(Integer.class)); - Assert.assertEquals(true, NumericUtil.isNumber(long.class)); - Assert.assertEquals(true, NumericUtil.isNumber(Long.class)); - Assert.assertEquals(true, NumericUtil.isNumber(float.class)); - Assert.assertEquals(true, NumericUtil.isNumber(Float.class)); - Assert.assertEquals(true, NumericUtil.isNumber(double.class)); - Assert.assertEquals(true, NumericUtil.isNumber(Double.class)); - - Assert.assertEquals(false, NumericUtil.isNumber(char.class)); - Assert.assertEquals(false, NumericUtil.isNumber(Character.class)); - - Assert.assertEquals(true, NumericUtil.isNumber(1)); - Assert.assertEquals(true, NumericUtil.isNumber(1L)); - Assert.assertEquals(true, NumericUtil.isNumber(1.0f)); - Assert.assertEquals(true, NumericUtil.isNumber(1.0d)); - Assert.assertEquals(false, NumericUtil.isNumber('1')); - Assert.assertEquals(false, NumericUtil.isNumber((Object) null)); + Assert.assertTrue(NumericUtil.isNumber(byte.class)); + Assert.assertTrue(NumericUtil.isNumber(Byte.class)); + Assert.assertTrue(NumericUtil.isNumber(short.class)); + Assert.assertTrue(NumericUtil.isNumber(Short.class)); + Assert.assertTrue(NumericUtil.isNumber(int.class)); + Assert.assertTrue(NumericUtil.isNumber(Integer.class)); + Assert.assertTrue(NumericUtil.isNumber(long.class)); + Assert.assertTrue(NumericUtil.isNumber(Long.class)); + Assert.assertTrue(NumericUtil.isNumber(float.class)); + Assert.assertTrue(NumericUtil.isNumber(Float.class)); + Assert.assertTrue(NumericUtil.isNumber(double.class)); + Assert.assertTrue(NumericUtil.isNumber(Double.class)); + + Assert.assertFalse(NumericUtil.isNumber(char.class)); + Assert.assertFalse(NumericUtil.isNumber(Character.class)); + + Assert.assertTrue(NumericUtil.isNumber(1)); + Assert.assertTrue(NumericUtil.isNumber(1L)); + Assert.assertTrue(NumericUtil.isNumber(1.0f)); + Assert.assertTrue(NumericUtil.isNumber(1.0d)); + Assert.assertFalse(NumericUtil.isNumber('1')); + Assert.assertFalse(NumericUtil.isNumber((Object) null)); } @Test @@ -421,13 +421,13 @@ public void testConvertToNumber() { Assert.assertEquals(1, NumericUtil.convertToNumber(1)); Assert.assertEquals(1.2, NumericUtil.convertToNumber(1.2)); - Assert.assertEquals(new BigDecimal(1.25), + Assert.assertEquals(new BigDecimal("1.25"), NumericUtil.convertToNumber("1.25")); Date date = new Date(); Assert.assertEquals(date.getTime(), NumericUtil.convertToNumber(date)); - Assert.assertEquals(null, NumericUtil.convertToNumber(null)); + Assert.assertNull(NumericUtil.convertToNumber(null)); } @Test diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/ReflectionUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/ReflectionUtilTest.java index b400f5297b..6c5e62098a 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/ReflectionUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/ReflectionUtilTest.java @@ -122,7 +122,7 @@ public void testNestedClasses() throws NotFoundException { List classes = ReflectionUtil.nestedClasses( TestClass.class.getName()); Assert.assertEquals(5, classes.size()); - classes.sort((c1, c2) -> c1.compareTo(c2)); + classes.sort(String::compareTo); Assert.assertEquals(Bar.class.getName(), classes.get(0)); Assert.assertEquals(Base.class.getName(), classes.get(1)); Assert.assertEquals(Foo.class.getName(), classes.get(2)); diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/StringUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/StringUtilTest.java index bd4e962e2a..d271ae93b1 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/StringUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/StringUtilTest.java @@ -20,13 +20,14 @@ package org.apache.hugegraph.unit.util; import java.util.ArrayList; +import java.util.Collections; import java.util.List; -import org.junit.Test; - +import org.apache.hugegraph.testutil.Assert; import org.apache.hugegraph.util.StringUtil; import org.apache.hugegraph.util.StringUtil.Chars; -import org.apache.hugegraph.testutil.Assert; +import org.junit.Test; + import com.google.common.base.Splitter; public class StringUtilTest { @@ -155,9 +156,7 @@ private static List guavaSplit(String line, String delimiter) { private static List toStringList(String[] stringArray) { List results = new ArrayList<>(stringArray.length); - for (String str : stringArray) { - results.add(str); - } + Collections.addAll(results, stringArray); return results; } } diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/UnitUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/UnitUtilTest.java index fd146b8fc8..8b383034de 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/UnitUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/UnitUtilTest.java @@ -33,7 +33,7 @@ public void testBytesToMB() { Assert.assertEquals(0d, value, 0d); // KB - value = UnitUtil.bytesToMB(Bytes.KB * 1); + value = UnitUtil.bytesToMB(1 * Bytes.KB); Assert.assertEquals(0d, value, 0d); value = UnitUtil.bytesToMB(Bytes.KB * 10); @@ -86,7 +86,7 @@ public void testBytesToGB() { Assert.assertEquals(0d, value, 0d); // MB - value = UnitUtil.bytesToGB(Bytes.MB * 1); + value = UnitUtil.bytesToGB(1 * Bytes.MB); Assert.assertEquals(0d, value, 0d); value = UnitUtil.bytesToGB(Bytes.MB * 10); diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/VersionUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/VersionUtilTest.java index 6ed04505af..b405e7daf6 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/VersionUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/VersionUtilTest.java @@ -133,8 +133,7 @@ public void testGetImplementationVersion() throws MalformedURLException { VersionUtil.getImplementationVersion(manifestPath)); manifestPath = "file:./src/test/resources2"; - Assert.assertEquals(null, - VersionUtil.getImplementationVersion(manifestPath)); + Assert.assertNull(VersionUtil.getImplementationVersion(manifestPath)); } @Test diff --git a/hugegraph-rpc/pom.xml b/hugegraph-rpc/pom.xml index ba61ba637b..2a29065cbb 100644 --- a/hugegraph-rpc/pom.xml +++ b/hugegraph-rpc/pom.xml @@ -27,7 +27,7 @@ hugegraph-rpc - ${artifactId} + ${project.artifactId} HugeGraph RPC component @@ -104,7 +104,6 @@ maven-compiler-plugin - 3.1 ${compiler.source} ${compiler.target} @@ -119,7 +118,6 @@ org.apache.maven.plugins maven-jar-plugin - 2.6 true @@ -174,7 +172,6 @@ org.apache.maven.plugins maven-source-plugin - 2.2.1 attach-sources @@ -187,7 +184,6 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.9.1 attach-javadocs @@ -200,7 +196,6 @@ org.apache.maven.plugins maven-gpg-plugin - 1.5 sign-artifacts diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Server.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Server.java index 0359350474..0deabfd227 100644 --- a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Server.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Server.java @@ -23,8 +23,7 @@ public interface RpcServiceConfig4Server { String addService(Class clazz, S serviceImpl); - String addService(String graph, - Class clazz, S serviceImpl); + String addService(String graph, Class clazz, S serviceImpl); void removeService(String serviceId); diff --git a/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ServerClientTest.java b/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ServerClientTest.java index 7f73a9afea..8daa37e1f8 100644 --- a/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ServerClientTest.java +++ b/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ServerClientTest.java @@ -54,7 +54,7 @@ public static void init() { } @AfterClass - public static void clear() throws Exception { + public static void clear() { if (rpcClient != null) { rpcClient.destroy(); } @@ -711,13 +711,13 @@ public void testInitRpcConfigs() { RpcCommonConfig.initRpcConfigs(RpcOptions.CONSUMER_RETRIES, 2); } - public static interface HelloService { + public interface HelloService { - public String hello(String string); + String hello(String string); - public String echo(String string); + String echo(String string); - public double sum(long a, double b); + double sum(long a, double b); } public static class HelloServiceImpl implements HelloService { diff --git a/pom.xml b/pom.xml index c49e83ec26..0f405cff58 100644 --- a/pom.xml +++ b/pom.xml @@ -60,21 +60,21 @@ ${project.basedir}/.. 1.8 1.8 - 2.17.0 + 2.18.0 1.10 - 2.3 + 2.8.0 1.9.4 3.2.2 2.7 - 1.11 - 25.1-jre + 1.13 + 30.0-jre 1.0 3.0.1 3.28.0-GA 3.0.3 3.0.3 - 2.12.1 - 4.12 + 2.14.0-rc1 + 4.13.1 4.1.0 4.0.0-RC2 3.0.2 From dc3e9e2bbdddf068338e8c8beda0b6e36d5f9258 Mon Sep 17 00:00:00 2001 From: imbajin Date: Wed, 26 Oct 2022 19:38:51 +0800 Subject: [PATCH 180/217] chore: enable ci in all prs (#111) --- .asf.yaml | 8 +++++--- .github/{workflows => outdated}/cla.yml | 0 .github/workflows/ci.yml | 4 ---- .github/workflows/codeql-analysis.yml | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) rename .github/{workflows => outdated}/cla.yml (100%) diff --git a/.asf.yaml b/.asf.yaml index a254285792..727bb43db3 100644 --- a/.asf.yaml +++ b/.asf.yaml @@ -35,7 +35,7 @@ github: protected_branches: master: required_status_checks: - # strict means "Require branches to be up to date before merging". + # strict means "Require branches to be up-to-date before merging". strict: true # contexts are the names of checks that must pass contexts: @@ -47,5 +47,7 @@ github: required_approving_review_count: 2 notifications: - issues: dev@hugegraph.apache.org - pullrequests: commits@hugegraph.apache.org + issues: issues@hugegraph.apache.org + discussions: issues@hugegraph.apache.org + pullrequests_status: dev@hugegraph.apache.org + #pullrequests_comment: issues@foo.apache.org diff --git a/.github/workflows/cla.yml b/.github/outdated/cla.yml similarity index 100% rename from .github/workflows/cla.yml rename to .github/outdated/cla.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 755f1c23c9..1301d30657 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,10 +7,6 @@ on: - /^release-.*$/ - /^test-.*$/ pull_request: - branches: - - master - - /^release-.*$/ - - /^test-.*$/ jobs: build: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index be695d8142..11d620f3d2 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -7,7 +7,7 @@ on: branches: [ master, release-* ] pull_request: # The branches below must be a subset of the branches above - branches: [ master ] + # branches: [ master ] # enable in all PRs schedule: - cron: '33 15 * * 5' From 4361a51d9d18b82c2e9020cd21eaddce799b4078 Mon Sep 17 00:00:00 2001 From: imbajin Date: Thu, 27 Oct 2022 00:39:09 +0800 Subject: [PATCH 181/217] chore: fix missing mail address & other configs (#112) --- .asf.yaml | 11 ++-- .github/ISSUE_TEMPLATE/bug_report.yml | 8 +-- .github/ISSUE_TEMPLATE/config.yml | 2 +- .github/ISSUE_TEMPLATE/question_ask.yml | 10 +-- .github/workflows/ci.yml | 8 +-- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/release.yml | 6 +- .gitignore | 83 +++++++++++++++++++++---- README.md | 24 +++++-- 9 files changed, 116 insertions(+), 38 deletions(-) diff --git a/.asf.yaml b/.asf.yaml index 727bb43db3..1b320bf16e 100644 --- a/.asf.yaml +++ b/.asf.yaml @@ -20,9 +20,9 @@ github: # Enable issue management issues: true # Enable wiki for documentation - wiki: false + wiki: true # Enable projects for project management boards - projects: false + projects: true description: HugeGraph Commons - include common library & RPC module homepage: https://hugegraph.apache.org/ del_branch_on_merge: true @@ -47,7 +47,8 @@ github: required_approving_review_count: 2 notifications: - issues: issues@hugegraph.apache.org - discussions: issues@hugegraph.apache.org pullrequests_status: dev@hugegraph.apache.org - #pullrequests_comment: issues@foo.apache.org + # Note: before use the config, we should ensure the "mail" address has set well (exist) + #pullrequests_comment: issues@hugegraph.apache.org + #issues: issues@hugegraph.apache.org + #discussions: issues@hugegraph.apache.org diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 685c72dea7..43f22140f5 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -10,8 +10,8 @@ body: value: >- ### Note (特别注意) : - > 1. 请先**搜索**现有的[Server-Issues](https://github.com/hugegraph/hugegraph/issues) 与 - [Commons-Issues](https://github.com/hugegraph/hugegraph-commons/issues) 中没有与您相同 + > 1. 请先**搜索**现有的[Server-Issues](https://github.com/apache/hugegraph/issues) 与 + [Commons-Issues](https://github.com/apache/hugegraph-commons/issues) 中没有与您相同 / 相关的问题 (请勿重复提交) > 2. 我们需要尽可能**详细**的信息来**复现**问题, 越详细的信息 (包括**日志 / 截图 / 配置**等) @@ -35,14 +35,14 @@ body: attributes: label: Before submit options: - - label: 我已经确认现有的 [Server-Issues](https://github.com/hugegraph/hugegraph/issues) 与 [Commons-Issues](https://github.com/hugegraph/hugegraph-commons/issues) 中没有相同 / 重复问题 + - label: 我已经确认现有的 [Server-Issues](https://github.com/apache/hugegraph/issues) 与 [Commons-Issues](https://github.com/apache/hugegraph-commons/issues) 中没有相同 / 重复问题 required: true - type: textarea attributes: label: Environment (环境信息) description: | - > server version could get from [rest-api](https://hugegraph.github.io/hugegraph-doc/clients/restful-api/other.html) (http://localhost:8080/versions) + > server version could get from [rest-api](https://hugegraph.apache.org/docs/clients/restful-api/) (http://localhost:8080/versions) value: | - Server Version: v0.11.x - Common Version: v1.x diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 10783233d4..df4d7459c0 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -3,5 +3,5 @@ blank_issues_enabled: false # 设置提 issue 前的参考文档 contact_links: - name: HugeGraph API Doc - url: https://hugegraph.github.io/hugegraph-doc/clients/hugegraph-api.html + url: https://hugegraph.apache.org/docs/clients/ about: Please search usage here before opening a new issue diff --git a/.github/ISSUE_TEMPLATE/question_ask.yml b/.github/ISSUE_TEMPLATE/question_ask.yml index 6fb2d4eb81..2b2d0bc524 100644 --- a/.github/ISSUE_TEMPLATE/question_ask.yml +++ b/.github/ISSUE_TEMPLATE/question_ask.yml @@ -8,8 +8,8 @@ body: value: >- ### Note (特别注意) : - > 1. 请先**搜索**现有的[Server-Issues](https://github.com/hugegraph/hugegraph/issues) 与 - [Commons-Issues](https://github.com/hugegraph/hugegraph-commons/issues) 中没有与您相同 + > 1. 请先**搜索**现有的[Server-Issues](https://github.com/apache/hugegraph/issues) 与 + [Commons-Issues](https://github.com/apache/hugegraph-commons/issues) 中没有与您相同 / 相关的问题 (请勿重复提交) > 2. 我们需要尽可能**详细**的信息来**复现**问题, 越详细的信息 (包括**日志 / 截图 / 配置**等) @@ -33,14 +33,14 @@ body: attributes: label: Before submit options: - - label: 我已经确认现有的 [Server-Issues](https://github.com/hugegraph/hugegraph/issues) 与 [Commons-Issues](https://github.com/hugegraph/hugegraph-commons/issues) 中没有相同 / 重复问题 + - label: 我已经确认现有的 [Server-Issues](https://github.com/apache/hugegraph/issues) 与 [Commons-Issues](https://github.com/apache/hugegraph-commons/issues) 中没有相同 / 重复问题 required: true - type: textarea attributes: label: Environment (环境信息) description: | - > server version could get from [rest-api](https://hugegraph.github.io/hugegraph-doc/clients/restful-api/other.html) (http://localhost:8080/versions) + > server version could get from [rest-api](https://hugegraph.apache.org/docs/clients/restful-api/) (http://localhost:8080/versions) value: | - Server Version: v0.11.x - Common Version: v1.x @@ -51,7 +51,7 @@ body: attributes: label: Your Question (问题描述) description: | - > 图使用 / 配置相关问题,请优先参考 [REST-API 文档](https://hugegraph.github.io/hugegraph-doc/clients/hugegraph-api.html), 以及 [Server 配置文档](https://hugegraph.github.io/hugegraph-doc/config/config-option.html) + > 图使用 / 配置相关问题,请优先参考 [REST-API 文档](https://hugegraph.apache.org/docs/clients/restful-api/), 以及 [Server 配置文档](https://hugegraph.apache.org/docs/config/config-option/) > if possible, please provide screenshots or GIF (请提供清晰的截图, 动图录屏更佳) placeholder: | type the main problem here diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1301d30657..4b7f08d93b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,20 +18,20 @@ jobs: steps: - name: Install JDK ${{ matrix.JAVA_VERSION }} - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: java-version: ${{ matrix.JAVA_VERSION }} distribution: 'zulu' - name: Cache Maven packages - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.m2 key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ runner.os }}-m2 - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 2 @@ -49,6 +49,6 @@ jobs: mvn test -Dtest=UnitTestSuite - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v3.0.0 with: file: target/jacoco.xml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 11d620f3d2..aa71513dc4 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -27,7 +27,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b0c20d26c1..7c1e641fa1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,20 +9,20 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Install JDK 8 - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: java-version: '8' distribution: 'zulu' - name: Cache Maven packages - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.m2 key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ runner.os }}-m2 - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 2 diff --git a/.gitignore b/.gitignore index 8053b45a7b..f7bcdbf5ac 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,51 @@ -.DS_Store -*.iml +target/ +**.db +logs/ +ui +node_modules +upload-files/ +demo* +gen-java +build +*.class + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +.svn + +### IntelliJ IDEA ### +.idea +.idea/ *.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ + +### VS Code ### +.vscode/ + +# misc +.DS_Store +*/.DS_Store +**/*.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + *.orig *.rej **/.keep @@ -10,13 +55,29 @@ *.swp *.log *.pyc -.idea -.svn -.classpath -.project -.settings -target -gen-java -build -node* + +# maven ignore +output/ +*.war +*.zip +*.tar +*.tar.gz +tree.txt *.versionsBackup + +# eclipse ignore +.settings/ + +# temp ignore +*.cache +*.diff +*.patch +*.tmp + +# system ignore +Thumbs.db +hs_err_pid* +# mobile Tools for Java (J2ME) +.mtj.tmp/ +# blueJ files +*.ctxt diff --git a/README.md b/README.md index 5196b4328a..556a3a33cf 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,9 @@ [![codecov](https://codecov.io/gh/hugegraph/hugegraph-common/branch/master/graph/badge.svg)](https://codecov.io/gh/hugegraph/hugegraph-common) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.apache.hugegraph/hugegraph-common/badge.svg)](https://mvnrepository.com/artifact/org.apache.hugegraph/hugegraph-common) -hugegraph-commons is a common module for [HugeGraph](https://github.com/hugegraph/hugegraph) and its peripheral components. +hugegraph-commons is a common module for [HugeGraph](https://github.com/apache/hugegraph) and its peripheral components. hugegraph-commons encapsulates locks, configurations, events, iterators, rest and some -numeric or collection util classes to simplify the development of HugeGraph and -its components. +numeric or collection util classes to simplify the development of HugeGraph and its components. ## Components @@ -19,5 +18,22 @@ its components. - Util: performance analyzer, version checker, numeric and Collection utils, log and exception utils etc. - Rpc: rpc component for inner module communication, currently it's based on [Sofa-RPC](https://github.com/sofastack/sofa-rpc) +## Learn More + +The [doc page](https://hugegraph.apache.org/docs/) contains more information about hugegraph modules. + +And here are links of other repositories: +1. [hugegraph-server](https://github.com/apache/hugegraph) (graph's core component - OLTP server) +2. [hugegraph-toolchain](https://github.com/apache/hugegraph-toolchain) (include loader/dashboard/tool/client) +3. [hugegraph-computer](https://github.com/apache/hugegraph-computer) (graph processing system - OLAP) +4. [hugegraph-website/doc](https://github.com/apache/hugegraph-doc) (include doc & website code) + +## Contributing + +Welcome to contribute, please see [`How to Contribute`](https://github.com/apache/hugegraph/blob/master/CONTRIBUTING.md) for more information + +Note: It's recommended to use [GitHub Desktop](https://desktop.github.com/) to **greatly simplify** the PR and commit process. + ## Licence -The same as HugeGraph, hugegraph-commons is also licensed under Apache 2.0 License. + +Same as HugeGraph, hugegraph-commons is also licensed under `Apache 2.0` License. From 16602cc8394ac9c2e3ee194cd48ea26f0061e784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9D=92=E5=B9=B4?= <1043706593@qq.com> Date: Tue, 1 Nov 2022 18:16:44 +0800 Subject: [PATCH 182/217] support custom content-type (#113) * support custom content-type * support custom content-type v2 --- .../hugegraph/rest/AbstractRestClient.java | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java index fd9fdaba26..0ccf1ad618 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java @@ -26,11 +26,13 @@ import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import java.util.Collection; +import java.util.List; import java.util.Map; import java.util.concurrent.Callable; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; +import org.apache.commons.collections.MapUtils; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.ExecutorUtil; import jakarta.ws.rs.client.Client; @@ -396,17 +398,35 @@ private Pair> buildRequest( * because Entity.json() method will reset "content encoding = * null" that has been set up by headers before. */ + MediaType customContentType = parseCustomContentType(headers); Entity entity; if (encoding == null) { - entity = Entity.json(object); + entity = Entity.entity(object, customContentType); } else { - Variant variant = new Variant(MediaType.APPLICATION_JSON_TYPE, + Variant variant = new Variant(customContentType, (String) null, encoding); entity = Entity.entity(object, variant); } return Pair.of(builder, entity); } + /** + * parse user custom content-type, returns MediaType.APPLICATION_JSON_TYPE default. + * @param headers + * @return + */ + public static MediaType parseCustomContentType(MultivaluedMap headers) { + String customContentType = null; + if (MapUtils.isNotEmpty(headers) && headers.get("Content-Type") != null) { + Object contentTypeObj = headers.get("Content-Type"); + if (contentTypeObj instanceof List) { + customContentType = ((List) contentTypeObj).get(0).toString(); + } + return MediaType.valueOf(customContentType); + } + return MediaType.APPLICATION_JSON_TYPE; + } + private static void configConnectionManager(String url, ClientConfig conf) { /* * Using httpclient with connection pooling, and configuring the From 7347b17a47cb55f43422bab785a6eb0cce2b1fe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9D=92=E5=B9=B4?= <1043706593@qq.com> Date: Fri, 4 Nov 2022 20:56:00 +0800 Subject: [PATCH 183/217] fix apache revision (#114) --- pom.xml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/pom.xml b/pom.xml index 0f405cff58..b10167e0d2 100644 --- a/pom.xml +++ b/pom.xml @@ -197,6 +197,7 @@ scripts/dev/reviewers **/*.md **/dependency-reduced-pom.xml + **/.flattened-pom.xml **/logs/*.log **/target/* style/* @@ -217,6 +218,32 @@ true + + + org.codehaus.mojo + flatten-maven-plugin + 1.2.7 + + true + resolveCiFriendliesOnly + + + + flatten + process-resources + + flatten + + + + flatten.clean + clean + + clean + + + + From 952975a3c74cffe1e5fc0427dfd43641b70fd9bd Mon Sep 17 00:00:00 2001 From: Simon Cheung Date: Tue, 8 Nov 2022 21:13:45 +0800 Subject: [PATCH 184/217] add dep check ci (#116) --- .github/workflows/check-dependencies.yml | 26 ++++++ .../scripts/dependency/check_dependencies.sh | 32 +++++++ .../scripts/dependency/known-dependencies.txt | 86 +++++++++++++++++++ .../regenerate_known_dependencies.sh | 33 +++++++ 4 files changed, 177 insertions(+) create mode 100644 .github/workflows/check-dependencies.yml create mode 100644 hugegraph-dist/scripts/dependency/check_dependencies.sh create mode 100644 hugegraph-dist/scripts/dependency/known-dependencies.txt create mode 100644 hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh diff --git a/.github/workflows/check-dependencies.yml b/.github/workflows/check-dependencies.yml new file mode 100644 index 0000000000..f6b35c4160 --- /dev/null +++ b/.github/workflows/check-dependencies.yml @@ -0,0 +1,26 @@ +name: third-party dependencies check + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + env: + SCRIPT_DEPENDENCY: hugegraph-dist/scripts/dependency + steps: + - name: Checkout source + uses: actions/checkout@v3 + - name: Set up JDK 8 + uses: actions/setup-java@v3 + with: + java-version: '8' + distribution: 'adopt' + - name: mvn install + run: | + mvn install -DskipTests=true + - name: generate current dependencies + run: | + bash $SCRIPT_DEPENDENCY/regenerate_known_dependencies.sh current-dependencies.txt + - name: check third dependencies + run: | + bash $SCRIPT_DEPENDENCY/check_dependencies.sh diff --git a/hugegraph-dist/scripts/dependency/check_dependencies.sh b/hugegraph-dist/scripts/dependency/check_dependencies.sh new file mode 100644 index 0000000000..29f9031078 --- /dev/null +++ b/hugegraph-dist/scripts/dependency/check_dependencies.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +# +# 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. +# + +BASE_PATH=$(cd $(dirname $0); pwd) + +# check whether there are new third-party dependencies by diff command, +# diff generated 'current-dependencies.txt' file with 'known-dependencies.txt' file. +diff -w -B -U0 <(sort < ${BASE_PATH}/known-dependencies.txt) \ +<(sort < ${BASE_PATH}/current-dependencies.txt) > ${BASE_PATH}/result.txt + +# if has new third-party,the Action will fail and print diff +if [ -s ${BASE_PATH}/result.txt ]; then + cat ${BASE_PATH}/result.txt + exit 1 +else + echo 'All third dependencies is known!' +fi diff --git a/hugegraph-dist/scripts/dependency/known-dependencies.txt b/hugegraph-dist/scripts/dependency/known-dependencies.txt new file mode 100644 index 0000000000..40d65bff8b --- /dev/null +++ b/hugegraph-dist/scripts/dependency/known-dependencies.txt @@ -0,0 +1,86 @@ +animal-sniffer-annotations-1.18.jar +annotations-4.1.1.4.jar +aopalliance-repackaged-3.0.1.jar +bolt-1.6.2.jar +checker-qual-3.5.0.jar +commons-beanutils-1.9.4.jar +commons-codec-1.13.jar +commons-collections-3.2.2.jar +commons-configuration-1.10.jar +commons-configuration2-2.8.0.jar +commons-io-2.7.jar +commons-lang-2.6.jar +commons-lang3-3.12.0.jar +commons-logging-1.1.1.jar +commons-text-1.9.jar +disruptor-3.3.7.jar +error_prone_annotations-2.3.4.jar +failureaccess-1.0.1.jar +grpc-api-1.28.0.jar +grpc-context-1.28.0.jar +grpc-core-1.28.0.jar +grpc-netty-shaded-1.28.0.jar +grpc-protobuf-1.28.0.jar +grpc-protobuf-lite-1.28.0.jar +grpc-stub-1.28.0.jar +gson-2.8.6.jar +guava-30.0-jre.jar +hamcrest-core-1.3.jar +hessian-3.3.7.jar +hk2-api-3.0.1.jar +hk2-locator-3.0.1.jar +hk2-utils-3.0.1.jar +httpclient-4.5.13.jar +httpcore-4.4.13.jar +j2objc-annotations-1.3.jar +jackson-annotations-2.14.0-rc1.jar +jackson-core-2.14.0-rc1.jar +jackson-databind-2.14.0-rc1.jar +jackson-dataformat-yaml-2.9.3.jar +jackson-jaxrs-base-2.14.0-rc1.jar +jackson-jaxrs-json-provider-2.14.0-rc1.jar +jackson-module-jaxb-annotations-2.14.0-rc1.jar +jakarta.activation-2.0.1.jar +jakarta.activation-api-1.2.2.jar +jakarta.annotation-api-2.0.0.jar +jakarta.inject-api-2.0.0.jar +jakarta.ws.rs-api-3.0.0.jar +jakarta.xml.bind-api-4.0.0-RC2.jar +javassist-3.28.0-GA.jar +javax.activation-api-1.2.0.jar +javax.json-1.0.jar +jaxb-api-2.3.1.jar +jaxb-core-3.0.2.jar +jaxb-impl-3.0.2.jar +jersey-apache-connector-3.0.3.jar +jersey-client-3.0.3.jar +jersey-common-3.0.3.jar +jersey-entity-filtering-3.0.3.jar +jersey-hk2-3.0.3.jar +jersey-media-json-jackson-3.0.3.jar +joda-time-2.10.8.jar +jsr305-3.0.1.jar +junit-4.13.1.jar +listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar +log4j-api-2.18.0.jar +log4j-core-2.18.0.jar +log4j-slf4j-impl-2.18.0.jar +lookout-api-1.4.1.jar +netty-all-4.1.42.Final.jar +opentracing-api-0.22.0.jar +opentracing-mock-0.22.0.jar +opentracing-noop-0.22.0.jar +opentracing-util-0.22.0.jar +osgi-resource-locator-1.0.3.jar +perfmark-api-0.19.0.jar +proto-google-common-protos-1.17.0.jar +protobuf-java-3.11.0.jar +slf4j-api-1.7.25.jar +snakeyaml-1.18.jar +sofa-common-tools-1.0.12.jar +sofa-rpc-all-5.7.6.jar +swagger-annotations-1.5.18.jar +swagger-core-1.5.18.jar +swagger-models-1.5.18.jar +tracer-core-3.0.8.jar +validation-api-1.1.0.Final.jar diff --git a/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh b/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh new file mode 100644 index 0000000000..1c27c9f025 --- /dev/null +++ b/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# +# 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. +# + +BASE_PATH=$(cd $(dirname $0); pwd) +DEP_PATH=$BASE_PATH/all_dependencies +FILE_NAME=${1:-known-dependencies.txt} + +if [[ -d $DEP_PATH ]];then + echo "rm -r -f DEP_PATH" + rm -r -f $DEP_PATH +fi + +cd $BASE_PATH/../../../ + +mvn dependency:copy-dependencies -DincludeScope=runtime -DoutputDirectory=$DEP_PATH + +ls $DEP_PATH | egrep -v "^hugegraph|hubble" | sort -n > $BASE_PATH/$FILE_NAME +rm -r -f $DEP_PATH From caa4b26a985fd2c8529673d0865b2cb05ab6ff8f Mon Sep 17 00:00:00 2001 From: imbajin Date: Wed, 9 Nov 2022 17:50:27 +0800 Subject: [PATCH 185/217] refact: address some code alert (#115) --- .gitignore | 1 + .../apache/hugegraph/config/HugeConfig.java | 8 ++- .../hugegraph/config/OptionChecker.java | 2 - .../apache/hugegraph/func/TriFunction.java | 2 +- .../org/apache/hugegraph/perf/PerfUtil.java | 52 +++++++++---------- .../org/apache/hugegraph/perf/Stopwatch.java | 17 ++++-- .../hugegraph/rest/AbstractRestClient.java | 51 +++++++++--------- .../org/apache/hugegraph/testutil/Assert.java | 3 +- .../apache/hugegraph/util/VersionUtil.java | 4 +- .../apache/hugegraph/config/RpcOptions.java | 5 +- .../hugegraph/rpc/RpcClientProvider.java | 1 + .../hugegraph/rpc/RpcConsumerConfig.java | 6 +-- pom.xml | 7 +-- 13 files changed, 77 insertions(+), 82 deletions(-) diff --git a/.gitignore b/.gitignore index f7bcdbf5ac..05e7e3ad2a 100644 --- a/.gitignore +++ b/.gitignore @@ -81,3 +81,4 @@ hs_err_pid* .mtj.tmp/ # blueJ files *.ctxt +.flattened-pom.xml diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/config/HugeConfig.java b/hugegraph-common/src/main/java/org/apache/hugegraph/config/HugeConfig.java index b25153d4fc..17088ea3c8 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/config/HugeConfig.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/config/HugeConfig.java @@ -186,11 +186,9 @@ private static Configuration loadConfigFile(File configFile) { case "yml": case "yaml": Parameters params = new Parameters(); - FileBasedConfigurationBuilder - builder = new FileBasedConfigurationBuilder( - YAMLConfiguration.class) - .configure(params.fileBased() - .setFile(configFile)); + FileBasedConfigurationBuilder builder = + new FileBasedConfigurationBuilder(YAMLConfiguration.class) + .configure(params.fileBased().setFile(configFile)); config = builder.getConfiguration(); break; case "xml": diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionChecker.java b/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionChecker.java index 8676702a03..0e795ff15d 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionChecker.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionChecker.java @@ -24,8 +24,6 @@ import java.util.HashSet; import java.util.List; -import javax.annotation.Nullable; - import org.apache.commons.lang3.StringUtils; import com.google.common.base.Predicate; diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/func/TriFunction.java b/hugegraph-common/src/main/java/org/apache/hugegraph/func/TriFunction.java index d84c26f3bd..0e5fbb4682 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/func/TriFunction.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/func/TriFunction.java @@ -19,7 +19,7 @@ package org.apache.hugegraph.func; -public interface TriFunction { +public interface TriFunction { R apply(T1 v1, T2 v2, T3 v3); } diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java index 39cface3df..36b5c05157 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java @@ -55,7 +55,7 @@ public final class PerfUtil { private static final Logger LOG = Log.logger(PerfUtil.class); - private static final int DEFAUL_CAPATICY = 1024; + private static final int DEFAULT_CAPACITY = 1024; private static final ThreadLocal INSTANCE = new ThreadLocal<>(); @@ -69,8 +69,8 @@ public final class PerfUtil { private final Stopwatch root; private PerfUtil() { - this.stopwatches = new HashMap<>(DEFAUL_CAPATICY); - this.callStack = new LocalStack<>(DEFAUL_CAPATICY); + this.stopwatches = new HashMap<>(DEFAULT_CAPACITY); + this.callStack = new LocalStack<>(DEFAULT_CAPACITY); this.root = newStopwatch(Path.ROOT_NAME, Path.EMPTY); } @@ -403,32 +403,32 @@ public String toECharts() { }; BiConsumer, List> fillChildrenTotal = - (itemsOfLn, itemsOfLnParent) -> { - for (Stopwatch parent : itemsOfLnParent) { - List children = itemsOfLn.stream().filter(c -> { - return c.parent().equals(parent.id()); - }).collect(Collectors.toList()); + (itemsOfLn, itemsOfLnParent) -> { + for (Stopwatch parent : itemsOfLnParent) { + List children = itemsOfLn.stream().filter(c -> { + return c.parent().equals(parent.id()); + }).collect(Collectors.toList()); - parent.fillChildrenTotal(children); - } - }; + parent.fillChildrenTotal(children); + } + }; BiConsumer, List> fillOther = - (itemsOfLn, itemsOfLnParent) -> { - for (Stopwatch parent : itemsOfLnParent) { - Stream children = itemsOfLn.stream().filter(c -> { - return c.parent().equals(parent.id()); - }); - // Fill other cost - long sumCost = children.mapToLong(Stopwatch::totalCost).sum(); - long otherCost = parent.totalCost() - sumCost; - if (otherCost > 0L) { - Stopwatch other = newStopwatch("~", parent.id()); - other.totalCost(otherCost); - itemsOfLn.add(other); - } - } - }; + (itemsOfLn, itemsOfLnParent) -> { + for (Stopwatch parent : itemsOfLnParent) { + Stream children = itemsOfLn.stream().filter(c -> { + return c.parent().equals(parent.id()); + }); + // Fill other cost + long sumCost = children.mapToLong(Stopwatch::totalCost).sum(); + long otherCost = parent.totalCost() - sumCost; + if (otherCost > 0L) { + Stopwatch other = newStopwatch("~", parent.id()); + other.totalCost(otherCost); + itemsOfLn.add(other); + } + } + }; Map items = this.stopwatches; Map> levelItems = new HashMap<>(); diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/Stopwatch.java b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/Stopwatch.java index 9d095c924a..15f7a234f7 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/Stopwatch.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/Stopwatch.java @@ -24,26 +24,35 @@ public interface Stopwatch extends Cloneable { Path id(); + String name(); + Path parent(); void startTime(long startTime); + void endTime(long startTime); void lastStartTime(long startTime); long times(); + long totalTimes(); + long totalChildrenTimes(); long totalCost(); + void totalCost(long otherCost); long minCost(); + long maxCost(); long totalWasted(); + long totalSelfWasted(); + long totalChildrenWasted(); void fillChildrenTotal(List children); @@ -51,9 +60,11 @@ public interface Stopwatch extends Cloneable { Stopwatch copy(); Stopwatch child(String name); + Stopwatch child(String name, Stopwatch watch); boolean empty(); + void clear(); default String toJson() { @@ -97,11 +108,7 @@ public Path(Path parent, String name) { if (parent == EMPTY) { this.path = name; } else { - int len = parent.length() + 1 + name.length(); - StringBuilder sb = new StringBuilder(len); - sb.append(parent.path).append('/').append(name); - - this.path = sb.toString(); + this.path = parent.path + '/' + name; } } diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java index 0ccf1ad618..e6708c5c0f 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java @@ -19,7 +19,6 @@ package org.apache.hugegraph.rest; -import java.io.IOException; import java.net.URI; import java.security.KeyManagementException; import java.security.SecureRandom; @@ -32,19 +31,14 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + import org.apache.commons.collections.MapUtils; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.ExecutorUtil; -import jakarta.ws.rs.client.Client; -import jakarta.ws.rs.client.ClientRequestContext; -import jakarta.ws.rs.client.ClientRequestFilter; -import jakarta.ws.rs.client.Entity; -import jakarta.ws.rs.client.Invocation.Builder; -import jakarta.ws.rs.client.WebTarget; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.MultivaluedMap; -import jakarta.ws.rs.core.Response; -import jakarta.ws.rs.core.Variant; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.tuple.Pair; import org.apache.http.HttpHeaders; @@ -55,6 +49,8 @@ import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.pool.PoolStats; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.ExecutorUtil; import org.glassfish.jersey.SslConfigurator; import org.glassfish.jersey.apache.connector.ApacheClientProperties; import org.glassfish.jersey.apache.connector.ApacheConnectorProvider; @@ -69,12 +65,16 @@ import com.google.common.collect.ImmutableMap; -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSession; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.client.ClientRequestContext; +import jakarta.ws.rs.client.ClientRequestFilter; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.client.WebTarget; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Variant; public abstract class AbstractRestClient implements RestClient { @@ -412,15 +412,14 @@ private Pair> buildRequest( /** * parse user custom content-type, returns MediaType.APPLICATION_JSON_TYPE default. - * @param headers - * @return + * @param headers custom http header */ - public static MediaType parseCustomContentType(MultivaluedMap headers) { + private static MediaType parseCustomContentType(MultivaluedMap headers) { String customContentType = null; if (MapUtils.isNotEmpty(headers) && headers.get("Content-Type") != null) { - Object contentTypeObj = headers.get("Content-Type"); - if (contentTypeObj instanceof List) { - customContentType = ((List) contentTypeObj).get(0).toString(); + List contentTypeObj = headers.get("Content-Type"); + if (contentTypeObj != null && !contentTypeObj.isEmpty()) { + customContentType = contentTypeObj.get(0).toString(); } return MediaType.valueOf(customContentType); } @@ -546,7 +545,7 @@ private static class ConfigBuilder { private final ClientConfig config; - public ConfigBuilder() { + ConfigBuilder() { this.config = new ClientConfig(); } diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Assert.java b/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Assert.java index 519d20530a..5e09cb83d0 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Assert.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Assert.java @@ -144,8 +144,7 @@ private static class NumberMatcher extends BaseMatcher { private final Number expected; private final Function cmp; - public NumberMatcher(Number expected, Function cmp, - String symbol) { + NumberMatcher(Number expected, Function cmp, String symbol) { this.expected = expected; this.cmp = cmp; this.symbol = symbol; diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java index cc98fa1c5d..8d633f02d1 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java @@ -82,8 +82,8 @@ public static String getImplementationVersion(Class clazz) { String className = clazz.getSimpleName() + ".class"; String classPath = Objects.requireNonNull(clazz.getResource(className)).toString(); if (!classPath.startsWith("jar:file:")) { - // Class not from JAR - return null; + // Class not from JAR + return null; } int offset = classPath.lastIndexOf("!"); assert offset > 0; diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/config/RpcOptions.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/config/RpcOptions.java index 782643eac8..e4c9730fad 100644 --- a/hugegraph-rpc/src/main/java/org/apache/hugegraph/config/RpcOptions.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/config/RpcOptions.java @@ -19,9 +19,6 @@ package org.apache.hugegraph.config; -import org.apache.hugegraph.config.ConfigOption; -import org.apache.hugegraph.config.OptionHolder; - import static org.apache.hugegraph.config.OptionChecker.allowValues; import static org.apache.hugegraph.config.OptionChecker.disallowEmpty; import static org.apache.hugegraph.config.OptionChecker.rangeInt; @@ -128,7 +125,7 @@ public static synchronized RpcOptions instance() { "rpc.client_load_balancer", "The rpc client uses a load-balancing algorithm to " + "access multiple rpc servers in one cluster. Default " + - "value is 'consistentHash', means forwording by request " + + "value is 'consistentHash', means forwarding by request " + "parameters.", allowValues("random", "localPref", "roundRobin", "consistentHash", "weightRoundRobin"), diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcClientProvider.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcClientProvider.java index b17191a6d4..826c013a26 100644 --- a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcClientProvider.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcClientProvider.java @@ -41,6 +41,7 @@ public RpcClientProvider(HugeConfig config) { this.consumerConfig = StringUtils.isNotBlank(rpcUrl) ? new RpcConsumerConfig(config, rpcUrl) : null; } + public boolean enabled() { return this.consumerConfig != null; } diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcConsumerConfig.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcConsumerConfig.java index f2c9b920eb..796f8fbe2b 100644 --- a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcConsumerConfig.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcConsumerConfig.java @@ -53,8 +53,8 @@ public class RpcConsumerConfig implements RpcServiceConfig4Client { private final List> bootstraps; static { - ExtensionLoaderFactory.getExtensionLoader(Cluster.class) - .loadExtension(FanoutCluster.class); + ExtensionLoaderFactory.getExtensionLoader(Cluster.class) + .loadExtension(FanoutCluster.class); } public RpcConsumerConfig(HugeConfig config, String remoteUrls) { @@ -148,7 +148,7 @@ private static class FanoutCluster extends AbstractCluster { private static final Logger LOG = Log.logger(FanoutCluster.class); - public FanoutCluster(ConsumerBootstrap consumerBootstrap) { + FanoutCluster(ConsumerBootstrap consumerBootstrap) { super(consumerBootstrap); } diff --git a/pom.xml b/pom.xml index b10167e0d2..ad7e3a4c9f 100644 --- a/pom.xml +++ b/pom.xml @@ -92,7 +92,6 @@ maven-compiler-plugin - 3.1 ${compiler.source} ${compiler.target} @@ -136,7 +135,6 @@ org.apache.maven.plugins maven-jar-plugin - 2.6 true @@ -222,7 +220,7 @@ org.codehaus.mojo flatten-maven-plugin - 1.2.7 + 1.3.0 true resolveCiFriendliesOnly @@ -255,7 +253,6 @@ org.apache.maven.plugins maven-source-plugin - 2.2.1 attach-sources @@ -268,7 +265,6 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.10.1 attach-javadocs @@ -286,7 +282,6 @@ org.apache.maven.plugins maven-gpg-plugin - 1.5 sign-artifacts From 4dbe157ecb31429231ea2d7ec40c883362cd2892 Mon Sep 17 00:00:00 2001 From: Simon Cheung Date: Wed, 9 Nov 2022 21:58:18 +0800 Subject: [PATCH 186/217] Add thrid-party dependency licenses (#117) * add dep licenses * Update LICENSE-JavaHamcrest.txt Co-authored-by: imbajin --- hugegraph-dist/release-docs/LICENSE | 346 +++++++ hugegraph-dist/release-docs/NOTICE | 922 ++++++++++++++++++ .../licenses/LICENSE-JavaHamcrest.txt | 27 + .../licenses/LICENSE-animal-sniffer.txt | 21 + .../LICENSE-aopalliance-repackaged.txt | 759 ++++++++++++++ .../licenses/LICENSE-api-client-staging.txt | 25 + .../licenses/LICENSE-checker-qual.txt | 22 + .../licenses/LICENSE-commons-beanutils.txt | 202 ++++ .../licenses/LICENSE-commons-codec.txt | 202 ++++ .../licenses/LICENSE-commons-collections.txt | 202 ++++ .../LICENSE-commons-configuration.txt | 202 ++++ .../LICENSE-commons-configuration2.txt | 202 ++++ .../licenses/LICENSE-commons-io.txt | 202 ++++ .../licenses/LICENSE-commons-lang.txt | 202 ++++ .../licenses/LICENSE-commons-lang3.txt | 202 ++++ .../licenses/LICENSE-commons-logging.txt | 202 ++++ .../licenses/LICENSE-commons-text.txt | 202 ++++ .../licenses/LICENSE-failureaccess.txt | 202 ++++ .../licenses/LICENSE-glassfish-hk2.txt | 637 ++++++++++++ .../licenses/LICENSE-grpc-java.txt | 202 ++++ .../release-docs/licenses/LICENSE-gson.txt | 202 ++++ .../licenses/LICENSE-httpclient.txt | 202 ++++ .../licenses/LICENSE-httpcore.txt | 202 ++++ .../release-docs/licenses/LICENSE-j2objc.txt | 232 +++++ .../LICENSE-jackson-annotations-2.14.0.txt | 202 ++++ .../licenses/LICENSE-jackson-annotations.txt | 202 ++++ .../licenses/LICENSE-jackson-core-2.14.0.txt | 202 ++++ .../licenses/LICENSE-jackson-core.txt | 202 ++++ .../LICENSE-jackson-databind-2.14.0.txt | 202 ++++ .../licenses/LICENSE-jackson-databind.txt | 202 ++++ .../LICENSE-jackson-dataformat-yaml.txt | 8 + .../LICENSE-jackson-jaxrs-base-2.14.0.txt | 8 + .../licenses/LICENSE-jackson-jaxrs-base.txt | 8 + ...NSE-jackson-jaxrs-json-provider-2.14.0.txt | 8 + .../LICENSE-jackson-jaxrs-json-provider.txt | 8 + ...jackson-module-jaxb-annotations-2.14.0.txt | 8 + ...ICENSE-jackson-module-jaxb-annotations.txt | 8 + .../release-docs/licenses/LICENSE-jaf-api.txt | 29 + .../LICENSE-jakarta.activation-api.txt | 29 + .../LICENSE-jakarta.annotation-api.txt | 637 ++++++++++++ .../licenses/LICENSE-jakarta.xml.bind-api.txt | 29 + .../licenses/LICENSE-javassist.txt | 381 ++++++++ ...NSE-javax.activation-api-1.2.0-sources.txt | 759 ++++++++++++++ .../release-docs/licenses/LICENSE-jaxb-ri.txt | 11 + .../release-docs/licenses/LICENSE-jersey.txt | 759 ++++++++++++++ .../licenses/LICENSE-joda-time.txt | 202 ++++ .../release-docs/licenses/LICENSE-jsonp.txt | 759 ++++++++++++++ .../release-docs/licenses/LICENSE-junit5.txt | 98 ++ .../licenses/LICENSE-log4j-api.txt | 202 ++++ .../licenses/LICENSE-log4j-core.txt | 202 ++++ .../licenses/LICENSE-log4j-slf4j-impl.txt | 202 ++++ .../release-docs/licenses/LICENSE-netty.txt | 202 ++++ .../licenses/LICENSE-opentracing-java.txt | 201 ++++ .../licenses/LICENSE-perfmark.txt | 201 ++++ .../licenses/LICENSE-protobuf.txt | 32 + .../release-docs/licenses/LICENSE-slf4j.txt | 23 + .../licenses/LICENSE-sofa-bolt.txt | 201 ++++ .../licenses/LICENSE-sofa-boot.txt | 201 ++++ .../licenses/LICENSE-sofa-common-tools.txt | 201 ++++ .../licenses/LICENSE-sofa-hessian.txt | 201 ++++ .../licenses/LICENSE-sofa-lookout.txt | 201 ++++ .../licenses/LICENSE-sofa-rpc.txt | 201 ++++ .../licenses/LICENSE-swagger-annotations.txt | 11 + .../licenses/LICENSE-swagger-core.txt | 202 ++++ .../licenses/LICENSE-swagger-models.txt | 11 + 65 files changed, 13677 insertions(+) create mode 100644 hugegraph-dist/release-docs/LICENSE create mode 100644 hugegraph-dist/release-docs/NOTICE create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-JavaHamcrest.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-animal-sniffer.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-aopalliance-repackaged.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-api-client-staging.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-checker-qual.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-commons-beanutils.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-commons-codec.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-commons-collections.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-commons-configuration.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-commons-configuration2.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-commons-io.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-commons-lang.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-commons-lang3.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-commons-logging.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-commons-text.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-failureaccess.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-glassfish-hk2.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-grpc-java.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-gson.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-httpclient.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-httpcore.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-j2objc.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-jackson-annotations-2.14.0.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-jackson-annotations.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-jackson-core-2.14.0.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-jackson-core.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-jackson-databind-2.14.0.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-jackson-databind.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-jackson-dataformat-yaml.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-base-2.14.0.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-base.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider-2.14.0.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-jackson-module-jaxb-annotations-2.14.0.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-jackson-module-jaxb-annotations.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-jaf-api.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-jakarta.activation-api.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-jakarta.annotation-api.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-jakarta.xml.bind-api.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-javassist.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-javax.activation-api-1.2.0-sources.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-jaxb-ri.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-jersey.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-joda-time.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-jsonp.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-junit5.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-log4j-api.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-log4j-core.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-log4j-slf4j-impl.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-netty.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-opentracing-java.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-perfmark.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-protobuf.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-slf4j.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-sofa-bolt.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-sofa-boot.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-sofa-common-tools.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-sofa-hessian.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-sofa-lookout.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-sofa-rpc.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-swagger-annotations.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-swagger-core.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-swagger-models.txt diff --git a/hugegraph-dist/release-docs/LICENSE b/hugegraph-dist/release-docs/LICENSE new file mode 100644 index 0000000000..5da8cae26e --- /dev/null +++ b/hugegraph-dist/release-docs/LICENSE @@ -0,0 +1,346 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. + + + +============================================================================ + APACHE HUGEGRAPH (Incubating) SUBCOMPONENTS: + + The Apache HugeGraph(Incubating) project contains subcomponents with separate copyright + notices and license terms. Your use of the source code for the these + subcomponents is subject to the terms and conditions of the following + licenses. + + +======================================================================== +Third party Apache 2.0 licenses +======================================================================== + +The following components are provided under the Apache 2.0 License. +See licenses/ for text of these licenses. + + (Apache License, 2.0) (LGPL 2.1) (MPL 1.1) Javassist (org.javassist:javassist:3.28.0-GA - http://www.javassist.org/) + (Apache License, 2.0) (BSD 2-Clause) (EDL 1.0) (EPL 2.0) (GPL2 w/ CPE) (MIT license) (Modified BSD) (Public Domain) (W3C license) (jQuery license) jersey-connectors-apache (org.glassfish.jersey.connectors:jersey-apache-connector:3.0.3 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-apache-connector) + (Apache License, 2.0) (BSD 2-Clause) (EDL 1.0) (EPL 2.0) (GPL2 w/ CPE) (MIT license) (Modified BSD) (Public Domain) (W3C license) (jQuery license) jersey-core-client (org.glassfish.jersey.core:jersey-client:3.0.3 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-client) + (Apache License, 2.0) (EPL 2.0) (Public Domain) (The GNU General Public License (GPL), Version 2, With Classpath Exception) jersey-core-common (org.glassfish.jersey.core:jersey-common:3.0.3 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-common) + (Apache License, 2.0) (BSD 2-Clause) (EDL 1.0) (EPL 2.0) (GPL2 w/ CPE) (MIT license) (Modified BSD) (Public Domain) (W3C license) (jQuery license) jersey-ext-entity-filtering (org.glassfish.jersey.ext:jersey-entity-filtering:3.0.3 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-entity-filtering) + (Apache License, 2.0) (BSD 2-Clause) (EDL 1.0) (EPL 2.0) (GPL2 w/ CPE) (MIT license) (Modified BSD) (Public Domain) (W3C license) (jQuery license) jersey-inject-hk2 (org.glassfish.jersey.inject:jersey-hk2:3.0.3 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-hk2) + (Apache License, 2.0) (EPL 2.0) (The GNU General Public License (GPL), Version 2, With Classpath Exception) jersey-media-json-jackson (org.glassfish.jersey.media:jersey-media-json-jackson:3.0.3 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-media-json-jackson) + (Apache License, Version 2.0) * Apache Commons BeanUtils:- commons-beanutils:commons-beanutils:1.9.4 (https://commons.apache.org/proper/commons-beanutils/) + (Apache License, Version 2.0) * Apache Commons Codec:- commons-codec:commons-codec:1.13 (https://commons.apache.org/proper/commons-codec/) + (Apache License, Version 2.0) * Apache Commons Collections:- commons-collections:commons-collections:3.2.2 (http://commons.apache.org/collections/) + (Apache License, Version 2.0) * Apache Commons Configuration:- commons-configuration:commons-configuration:1.10 (http://commons.apache.org/configuration/)- org.apache.commons:commons-configuration2:2.8.0 (https://commons.apache.org/proper/commons-configuration/) + (Apache License, Version 2.0) * Apache Commons IO:- commons-io:commons-io:2.7 (https://commons.apache.org/proper/commons-io/) + (Apache License, Version 2.0) * Apache Commons Lang:- org.apache.commons:commons-lang3:3.12.0 (https://commons.apache.org/proper/commons-lang/) + (Apache License, Version 2.0) * Apache Commons Text:- org.apache.commons:commons-text:1.9 (https://commons.apache.org/proper/commons-text) + (Apache License, Version 2.0) * Apache HttpClient:- org.apache.httpcomponents:httpclient:4.5.13 (http://hc.apache.org/httpcomponents-client) + (Apache License, Version 2.0) * Apache HttpCore:- org.apache.httpcomponents:httpcore:4.4.13 (http://hc.apache.org/httpcomponents-core-ga) + (Apache License, Version 2.0) * Apache Log4j API:- org.apache.logging.log4j:log4j-api:2.18.0 (https://logging.apache.org/log4j/2.x/log4j-api/) + (Apache License, Version 2.0) * Apache Log4j Core:- org.apache.logging.log4j:log4j-core:2.18.0 (https://logging.apache.org/log4j/2.x/log4j-core/) + (Apache License, Version 2.0) * Apache Log4j SLF4J Binding:- org.apache.logging.log4j:log4j-slf4j-impl:2.18.0 (https://logging.apache.org/log4j/2.x/log4j-slf4j-impl/) + (Apache License, Version 2.0) * Bean Validation API:- javax.validation:validation-api:1.1.0.Final (http://beanvalidation.org) + (Apache License, Version 2.0) * Byte Buddy (without dependencies):- net.bytebuddy:byte-buddy:1.12.1 (https://bytebuddy.net/byte-buddy) + (Apache License, Version 2.0) * Byte Buddy agent:- net.bytebuddy:byte-buddy-agent:1.12.1 (https://bytebuddy.net/byte-buddy-agent) + (Apache License, Version 2.0) * Commons Lang:- commons-lang:commons-lang:2.6 (http://commons.apache.org/lang/) + (Apache License, Version 2.0) * Commons Logging:- commons-logging:commons-logging:1.1.1 (http://commons.apache.org/logging) + (Apache License, Version 2.0) * Disruptor Framework:- com.lmax:disruptor:3.3.7 (http://lmax-exchange.github.com/disruptor) + (Apache License, Version 2.0) * FindBugs-jsr305:- com.google.code.findbugs:jsr305:3.0.1 (http://findbugs.sourceforge.net/) + (Apache License, Version 2.0) * Google Android Annotations Library:- com.google.android:annotations:4.1.1.4 (http://source.android.com/) + (Apache License, Version 2.0) * Gson:- com.google.code.gson:gson:2.8.6 (https://github.com/google/gson/gson) + (Apache License, Version 2.0) * Guava InternalFutureFailureAccess and InternalFutures:- com.google.guava:failureaccess:1.0.1 (https://github.com/google/guava/failureaccess) + (Apache License, Version 2.0) * Guava ListenableFuture only:- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava (https://github.com/google/guava/listenablefuture) + (Apache License, Version 2.0) * Guava: Google Core Libraries for Java:- com.google.guava:guava:30.0-jre (https://github.com/google/guava/guava) + (Apache License, Version 2.0) * J2ObjC Annotations:- com.google.j2objc:j2objc-annotations:1.3 (https://github.com/google/j2objc/) + (Apache License, Version 2.0) * Jackson module: Old JAXB Annotations (javax.xml.bind):- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.14.0-rc1 (https://github.com/FasterXML/jackson-modules-base) + (Apache License, Version 2.0) * Jackson-JAXRS: JSON:- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.14.0-rc1 (https://github.com/FasterXML/jackson-jaxrs-providers/jackson-jaxrs-json-provider) + (Apache License, Version 2.0) * Jackson-JAXRS: base:- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:2.14.0-rc1 (https://github.com/FasterXML/jackson-jaxrs-providers/jackson-jaxrs-base) + (Apache License, Version 2.0) * Jackson-annotations:- com.fasterxml.jackson.core:jackson-annotations:2.14.0-rc1 (https://github.com/FasterXML/jackson) + (Apache License, Version 2.0) * Jackson-core:- com.fasterxml.jackson.core:jackson-core:2.14.0-rc1 (https://github.com/FasterXML/jackson-core) + (Apache License, Version 2.0) * Jackson-dataformat-YAML:- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.9.3 (https://github.com/FasterXML/jackson-dataformats-text) + (Apache License, Version 2.0) * Jakarta Dependency Injection:- jakarta.inject:jakarta.inject-api:2.0.0 (https://github.com/eclipse-ee4j/injection-api) + (Apache License, Version 2.0) * Joda-Time:- joda-time:joda-time:2.10.8 (https://www.joda.org/joda-time/) + (Apache License, Version 2.0) * Netty/All-in-One:- io.netty:netty-all:4.1.42.Final (https://netty.io/netty-all/) + (Apache License, Version 2.0) * Objenesis:- org.objenesis:objenesis:3.2 (http://objenesis.org/objenesis) + (Apache License, Version 2.0) * OpenTracing API:- io.opentracing:opentracing-api:0.22.0 (https://github.com/opentracing/opentracing-java/opentracing-api) + (Apache License, Version 2.0) * OpenTracing-mock:- io.opentracing:opentracing-mock:0.22.0 (https://github.com/opentracing/opentracing-java/opentracing-mock) + (Apache License, Version 2.0) * OpenTracing-noop:- io.opentracing:opentracing-noop:0.22.0 (https://github.com/opentracing/opentracing-java/opentracing-noop) + (Apache License, Version 2.0) * OpenTracing-util:- io.opentracing:opentracing-util:0.22.0 (https://github.com/opentracing/opentracing-java/opentracing-util) + (Apache License, Version 2.0) * SnakeYAML:- org.yaml:snakeyaml:1.18 (http://www.snakeyaml.org) + (Apache License, Version 2.0) * com.alipay.sofa.common:sofa-common-tools:- com.alipay.sofa.common:sofa-common-tools:1.0.12 (https://github.com/sofastack/sofa-common-tools) + (Apache License, Version 2.0) * com.alipay.sofa:bolt:- com.alipay.sofa:bolt:1.6.2 (https://github.com/alipay/sofa-bolt) + (Apache License, Version 2.0) * com.alipay.sofa:hessian:- com.alipay.sofa:hessian:3.3.7 (http://github.com/alipay/sofa-hessian) + (Apache License, Version 2.0) * com.alipay.sofa:sofa-rpc-all:- com.alipay.sofa:sofa-rpc-all:5.7.6 (http://github.com/sofastack/sofa-rpc) + (Apache License, Version 2.0) * error-prone annotations:- com.google.errorprone:error_prone_annotations:2.3.4 (http://nexus.sonatype.org/oss-repository-hosting.html/error_prone_parent/error_prone_annotations) + (Apache License, Version 2.0) * io.grpc:grpc-api:- io.grpc:grpc-api:1.28.0 (https://github.com/grpc/grpc-java) + (Apache License, Version 2.0) * io.grpc:grpc-context:- io.grpc:grpc-context:1.28.0 (https://github.com/grpc/grpc-java) + (Apache License, Version 2.0) * io.grpc:grpc-core:- io.grpc:grpc-core:1.28.0 (https://github.com/grpc/grpc-java) + (Apache License, Version 2.0) * io.grpc:grpc-netty-shaded:- io.grpc:grpc-netty-shaded:1.28.0 (https://github.com/grpc/grpc-java) + (Apache License, Version 2.0) * io.grpc:grpc-protobuf:- io.grpc:grpc-protobuf:1.28.0 (https://github.com/grpc/grpc-java) + (Apache License, Version 2.0) * io.grpc:grpc-protobuf-lite:- io.grpc:grpc-protobuf-lite:1.28.0 (https://github.com/grpc/grpc-java) + (Apache License, Version 2.0) * io.grpc:grpc-stub:- io.grpc:grpc-stub:1.28.0 (https://github.com/grpc/grpc-java) + (Apache License, Version 2.0) * jackson-databind:- com.fasterxml.jackson.core:jackson-databind:2.14.0-rc1 (https://github.com/FasterXML/jackson) + (Apache License, Version 2.0) * lookout-api:- com.alipay.sofa.lookout:lookout-api:1.4.1 (https://github.com/sofastack/sofa-lookout/lookout-api) + (Apache License, Version 2.0) * perfmark:perfmark-api:- io.perfmark:perfmark-api:0.19.0 (https://github.com/perfmark/perfmark) + (Apache License, Version 2.0) * proto-google-common-protos:- com.google.api.grpc:proto-google-common-protos:1.17.0 (https://github.com/googleapis/api-client-staging) + (Apache License, Version 2.0) * swagger-annotations:- io.swagger:swagger-annotations:1.5.18 (https://github.com/swagger-api/swagger-core/modules/swagger-annotations) + (Apache License, Version 2.0) * swagger-core:- io.swagger:swagger-core:1.5.18 (https://github.com/swagger-api/swagger-core/modules/swagger-core) + (Apache License, Version 2.0) * swagger-models:- io.swagger:swagger-models:1.5.18 (https://github.com/swagger-api/swagger-core/modules/swagger-models) + (Apache License, Version 2.0) * tracer-core:- com.alipay.sofa:tracer-core:3.0.8 (https://projects.spring.io/spring-boot/#/spring-boot-starter-parent/sofaboot-dependencies/tracer-all-parent/tracer-core) + +======================================================================== +Third party CDDL licenses +======================================================================== + +The following components are provided under the CDDL License. +See licenses/ for text of these licenses. + (CDDL + GPLv2 with classpath exception) * JavaBeans Activation Framework API jar:- javax.activation:javax.activation-api:1.2.0 (http://java.net/all/javax.activation-api/) + (CDDL 1.1, GPL2 w/ CPE) * jaxb-api:- javax.xml.bind:jaxb-api:2.3.1 (https://github.com/javaee/jaxb-spec/jaxb-api) + (Dual license consisting of the CDDL v1.1 and GPL v2) * Default Provider:- org.glassfish:javax.json:1.0 (http://jsonp.java.net) + + +======================================================================== +Third party EPL licenses +======================================================================== + +The following components are provided under the EPL License. +See licenses/ for text of these licenses. + (Eclipse Public License - v2.0, GPL2 w/ CPE) * HK2 API module:- org.glassfish.hk2:hk2-api:3.0.1 (https://github.com/eclipse-ee4j/glassfish-hk2/hk2-api) + (Eclipse Public License - v2.0, GPL2 w/ CPE) * HK2 Implementation Utilities:- org.glassfish.hk2:hk2-utils:3.0.1 (https://github.com/eclipse-ee4j/glassfish-hk2/hk2-utils) + (Eclipse Public License - v2.0, GPL2 w/ CPE) * Jakarta Annotations API:- jakarta.annotation:jakarta.annotation-api:2.0.0 (https://projects.eclipse.org/projects/ee4j.ca) + (Eclipse Public License - v2.0, GPL2 w/ CPE) * OSGi resource locator:- org.glassfish.hk2:osgi-resource-locator:1.0.3 (https://projects.eclipse.org/projects/ee4j/osgi-resource-locator) + (Eclipse Public License - v2.0, GPL2 w/ CPE) * ServiceLocator Default Implementation:- org.glassfish.hk2:hk2-locator:3.0.1 (https://github.com/eclipse-ee4j/glassfish-hk2/hk2-locator) + (Eclipse Public License - v2.0, GPL2 w/ CPE) * aopalliance version 1.0 repackaged as a module:- org.glassfish.hk2.external:aopalliance-repackaged:3.0.1 (https://github.com/eclipse-ee4j/glassfish-hk2/external/aopalliance-repackaged) + (Eclipse Public License - v2.0, GPL2 w/ CPE) * jakarta.ws.rs-api:- jakarta.ws.rs:jakarta.ws.rs-api:3.0.0 (https://github.com/eclipse-ee4j/jaxrs-api) + (Eclipse Public License - v2.0) * JUnit:- junit:junit:4.13.1 (http://junit.org) + +======================================================================== +Third party EDL licenses +======================================================================== + +The following components are provided under the EDL License. +See licenses/ for text of these licenses. + (Eclipse Distribution License - v1.0) * Jakarta Activation:- com.sun.activation:jakarta.activation:2.0.1 (https://github.com/eclipse-ee4j/jaf/jakarta.activation) + (Eclipse Distribution License - v1.0) * Jakarta Activation API jar:- jakarta.activation:jakarta.activation-api:1.2.2 (https://github.com/eclipse-ee4j/jaf/jakarta.activation-api) + (Eclipse Distribution License - v1.0) * Jakarta XML Binding API:- jakarta.xml.bind:jakarta.xml.bind-api:4.0.0-RC2 (https://github.com/eclipse-ee4j/jaxb-api/jakarta.xml.bind-api) + (Eclipse Distribution License - v1.0) * Old JAXB Core:- com.sun.xml.bind:jaxb-core:3.0.2 (https://eclipse-ee4j.github.io/jaxb-ri/) + (Eclipse Distribution License - v1.0) * Old JAXB Runtime:- com.sun.xml.bind:jaxb-impl:3.0.2 (https://eclipse-ee4j.github.io/jaxb-ri/) + + +======================================================================== +Third party BSD licenses +======================================================================== + +The following components are provided under the BSD License. +See licenses/ for text of these licenses. + (The 3-Clause BSD License) * Hamcrest Core:- org.hamcrest:hamcrest-core:1.3 (https://github.com/hamcrest/JavaHamcrest/hamcrest-core) + (The 3-Clause BSD License) * Protocol Buffers [Core]:- com.google.protobuf:protobuf-java:3.11.0 (https://developers.google.com/protocol-buffers/protobuf-java/) + +======================================================================== +Third party MIT licenses +======================================================================== + +The following components are provided under the MIT License. +See licenses/ for text of these licenses. + (The MIT License)* Animal Sniffer Annotations:- org.codehaus.mojo:animal-sniffer-annotations:1.18 (http://www.mojohaus.org/animal-sniffer/animal-sniffer-annotations) + (The MIT License)* Checker Qual:- org.checkerframework:checker-qual:3.5.0 (https://checkerframework.org) + (The MIT License)* SLF4J API Module:- org.slf4j:slf4j-api:1.7.25 (http://www.slf4j.org) + (The MIT License)* mockito-core:- org.mockito:mockito-core:4.1.0 (https://github.com/mockito/mockito) diff --git a/hugegraph-dist/release-docs/NOTICE b/hugegraph-dist/release-docs/NOTICE new file mode 100644 index 0000000000..eddc8b226c --- /dev/null +++ b/hugegraph-dist/release-docs/NOTICE @@ -0,0 +1,922 @@ +Apache HugeGraph +Copyright 2021-2022 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +======================================================================== + +commons-logging NOTICE + +======================================================================== +// ------------------------------------------------------------------ +// NOTICE file corresponding to the section 4d of The Apache License, +// Version 2.0, in this case for Commons Logging +// ------------------------------------------------------------------ + +Commons Logging +Copyright 2001-2007 The Apache Software Foundation + +This product includes/uses software(s) developed by 'an unknown organization' + - Unnamed - avalon-framework:avalon-framework:jar:4.1.3 + - Unnamed - log4j:log4j:jar:1.2.12 + - Unnamed - logkit:logkit:jar:1.0.1 + + +======================================================================== + +httpclient NOTICE + +======================================================================== + +Apache HttpClient +Copyright 1999-2020 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + + +======================================================================== + +httpcore NOTICE + +======================================================================== + +Apache HttpCore +Copyright 2005-2020 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + + +======================================================================== + +jackson-core-2.14.0 NOTICE + +======================================================================== +# Jackson JSON processor + +Jackson is a high-performance, Free/Open Source JSON processing library. +It was originally written by Tatu Saloranta (tatu.saloranta@iki.fi), and has +been in development since 2007. +It is currently developed by a community of developers. + +## Licensing + +Jackson 2.x core and extension components are licensed under Apache License 2.0 +To find the details that apply to this artifact see the accompanying LICENSE file. + +## Credits + +A list of contributors may be found from CREDITS(-2.x) file, which is included +in some artifacts (usually source distributions); but is always available +from the source code management (SCM) system project uses. +======================================================================== + +jackson-databind-2.14.0 NOTICE + +======================================================================== +# Jackson JSON processor + +Jackson is a high-performance, Free/Open Source JSON processing library. +It was originally written by Tatu Saloranta (tatu.saloranta@iki.fi), and has +been in development since 2007. +It is currently developed by a community of developers. + +## Licensing + +Jackson 2.x core and extension components are licensed under Apache License 2.0 +To find the details that apply to this artifact see the accompanying LICENSE file. + +## Credits + +A list of contributors may be found from CREDITS(-2.x) file, which is included +in some artifacts (usually source distributions); but is always available +from the source code management (SCM) system project uses. +======================================================================== + +jackson-dataformat-yaml NOTICE + +======================================================================== +# Jackson JSON processor + +Jackson is a high-performance, Free/Open Source JSON processing library. +It was originally written by Tatu Saloranta (tatu.saloranta@iki.fi), and has +been in development since 2007. +It is currently developed by a community of developers, as well as supported +commercially by FasterXML.com. + +## Licensing + +Jackson core and extension components may be licensed under different licenses. +To find the details that apply to this artifact see the accompanying LICENSE file. +For more information, including possible other licensing options, contact +FasterXML.com (http://fasterxml.com). + +## Credits + +A list of contributors may be found from CREDITS file, which is included +in some artifacts (usually source distributions); but is always available +from the source code management (SCM) system project uses. +======================================================================== + +jackson-jaxrs-json-provider-2.14.0 NOTICE + +======================================================================== +# Jackson JSON processor + +Jackson is a high-performance, Free/Open Source JSON processing library. +It was originally written by Tatu Saloranta (tatu.saloranta@iki.fi), and has +been in development since 2007. +It is currently developed by a community of developers, as well as supported +commercially by FasterXML.com. + +## Licensing + +Jackson core and extension components may be licensed under different licenses. +To find the details that apply to this artifact see the accompanying LICENSE file. +For more information, including possible other licensing options, contact +FasterXML.com (http://fasterxml.com). + +## Credits + +A list of contributors may be found from CREDITS file, which is included +in some artifacts (usually source distributions); but is always available +from the source code management (SCM) system project uses. +======================================================================== + +jackson-module-jaxb-annotations-2.14.0 NOTICE + +======================================================================== +# Jackson JSON processor + +Jackson is a high-performance, Free/Open Source JSON processing library. +It was originally written by Tatu Saloranta (tatu.saloranta@iki.fi), and has +been in development since 2007. +It is currently developed by a community of developers, as well as supported +commercially by FasterXML.com. + +## Licensing + +Jackson core and extension components may licensed under different licenses. +To find the details that apply to this artifact see the accompanying LICENSE file. +For more information, including possible other licensing options, contact +FasterXML.com (http://fasterxml.com). + +## Credits + +A list of contributors may be found from CREDITS file, which is included +in some artifacts (usually source distributions); but is always available +from the source code management (SCM) system project uses. +======================================================================== + +log4j-api NOTICE + +======================================================================== + +Apache Log4j API +Copyright 1999-2022 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + + +======================================================================== + +log4j-core NOTICE + +======================================================================== +Apache Log4j Core +Copyright 1999-2012 Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +ResolverUtil.java +Copyright 2005-2006 Tim Fennell + +======================================================================== + +log4j-slf4j-impl NOTICE + +======================================================================== + +Apache Log4j SLF4J Binding +Copyright 1999-2022 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + + +======================================================================== + +gRPC NOTICE + +======================================================================== + + +Copyright 2014 The gRPC Authors + +Licensed 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. + +----------------------------------------------------------------------- + +This product contains a modified portion of 'OkHttp', an open source +HTTP & SPDY client for Android and Java applications, which can be obtained +at: + + * LICENSE: + * okhttp/third_party/okhttp/LICENSE (Apache License 2.0) + * HOMEPAGE: + * https://github.com/square/okhttp + * LOCATION_IN_GRPC: + * okhttp/third_party/okhttp + +This product contains a modified portion of 'Envoy', an open source +cloud-native high-performance edge/middle/service proxy, which can be +obtained at: + + * LICENSE: + * xds/third_party/envoy/LICENSE (Apache License 2.0) + * NOTICE: + * xds/third_party/envoy/NOTICE + * HOMEPAGE: + * https://www.envoyproxy.io + * LOCATION_IN_GRPC: + * xds/third_party/envoy + +This product contains a modified portion of 'protoc-gen-validate (PGV)', +an open source protoc plugin to generate polyglot message validators, +which can be obtained at: + + * LICENSE: + * xds/third_party/protoc-gen-validate/LICENSE (Apache License 2.0) + * NOTICE: + * xds/third_party/protoc-gen-validate/NOTICE + * HOMEPAGE: + * https://github.com/envoyproxy/protoc-gen-validate + * LOCATION_IN_GRPC: + * xds/third_party/protoc-gen-validate + +This product contains a modified portion of 'udpa', +an open source universal data plane API, which can be obtained at: + + * LICENSE: + * xds/third_party/udpa/LICENSE (Apache License 2.0) + * HOMEPAGE: + * https://github.com/cncf/udpa + * LOCATION_IN_GRPC: + * xds/third_party/udpa + +======================================================================== + +jaxb-ri NOTICE + +======================================================================== +# Notices for Eclipse Implementation of JAXB + +This content is produced and maintained by the Eclipse Implementation of JAXB +project. + +* Project home: https://projects.eclipse.org/projects/ee4j.jaxb-impl + +## Trademarks + +Eclipse Implementation of JAXB is a trademark of the Eclipse Foundation. + +## Copyright + +All content is the property of the respective authors or their employers. For +more information regarding authorship of content, please consult the listed +source code repository logs. + +## Declared Project Licenses + +This program and the accompanying materials are made available under the terms +of the Eclipse Distribution License v. 1.0 which is available at +http://www.eclipse.org/org/documents/edl-v10.php. + +SPDX-License-Identifier: BSD-3-Clause + +## Source Code + +The project maintains the following source code repositories: + +* https://github.com/eclipse-ee4j/jaxb-ri +* https://github.com/eclipse-ee4j/jaxb-istack-commons +* https://github.com/eclipse-ee4j/jaxb-dtd-parser +* https://github.com/eclipse-ee4j/jaxb-fi +* https://github.com/eclipse-ee4j/jaxb-stax-ex +* https://github.com/eclipse-ee4j/jax-rpc-ri + +## Third-party Content + +This project leverages the following third party content. + +Apache Ant (1.10.2) + +* License: Apache-2.0 AND W3C AND LicenseRef-Public-Domain + +Apache Ant (1.10.2) + +* License: Apache-2.0 AND W3C AND LicenseRef-Public-Domain + +Apache Felix (1.2.0) + +* License: Apache License, 2.0 + +args4j (2.33) + +* License: MIT License + +dom4j (1.6.1) + +* License: Custom license based on Apache 1.1 + +file-management (3.0.0) + +* License: Apache-2.0 +* Project: https://maven.apache.org/shared/file-management/ +* Source: + https://svn.apache.org/viewvc/maven/shared/tags/file-management-3.0.0/ + +JUnit (4.12) + +* License: Eclipse Public License + +JUnit (4.12) + +* License: Eclipse Public License + +maven-compat (3.5.2) + +* License: Apache-2.0 +* Project: https://maven.apache.org/ref/3.5.2/maven-compat/ +* Source: + https://mvnrepository.com/artifact/org.apache.maven/maven-compat/3.5.2 + +maven-core (3.5.2) + +* License: Apache-2.0 +* Project: https://maven.apache.org/ref/3.5.2/maven-core/index.html +* Source: https://mvnrepository.com/artifact/org.apache.maven/maven-core/3.5.2 + +maven-plugin-annotations (3.5) + +* License: Apache-2.0 +* Project: https://maven.apache.org/plugin-tools/maven-plugin-annotations/ +* Source: + https://github.com/apache/maven-plugin-tools/tree/master/maven-plugin-annotations + +maven-plugin-api (3.5.2) + +* License: Apache-2.0 + +maven-resolver-api (1.1.1) + +* License: Apache-2.0 + +maven-resolver-api (1.1.1) + +* License: Apache-2.0 + +maven-resolver-connector-basic (1.1.1) + +* License: Apache-2.0 + +maven-resolver-impl (1.1.1) + +* License: Apache-2.0 + +maven-resolver-spi (1.1.1) + +* License: Apache-2.0 + +maven-resolver-transport-file (1.1.1) + +* License: Apache-2.0 +* Project: https://maven.apache.org/resolver/maven-resolver-transport-file/ +* Source: + https://github.com/apache/maven-resolver/tree/master/maven-resolver-transport-file + +maven-resolver-util (1.1.1) + +* License: Apache-2.0 + +maven-settings (3.5.2) + +* License: Apache-2.0 +* Source: + https://mvnrepository.com/artifact/org.apache.maven/maven-settings/3.5.2 + +OSGi Service Platform Core Companion Code (6.0) + +* License: Apache License, 2.0 + +plexus-archiver (3.5) + +* License: Apache-2.0 +* Project: https://codehaus-plexus.github.io/plexus-archiver/ +* Source: https://github.com/codehaus-plexus/plexus-archiver + +plexus-io (3.0.0) + +* License: Apache-2.0 + +plexus-utils (3.1.0) + +* License: Apache- 2.0 or Apache- 1.1 or BSD or Public Domain or Indiana + University Extreme! Lab Software License V1.1.1 (Apache 1.1 style) + +relaxng-datatype (1.0) + +* License: New BSD license + +Sax (0.2) + +* License: SAX-PD +* Project: http://www.megginson.com/downloads/SAX/ +* Source: http://sourceforge.net/project/showfiles.php?group_id=29449 + +testng (6.14.2) + +* License: Apache-2.0 AND (MIT OR GPL-1.0+) +* Project: https://testng.org/doc/index.html +* Source: https://github.com/cbeust/testng + +wagon-http-lightweight (3.0.0) + +* License: Pending +* Project: https://maven.apache.org/wagon/ +* Source: + https://mvnrepository.com/artifact/org.apache.maven.wagon/wagon-http-lightweight/3.0.0 + +xz for java (1.8) + +* License: LicenseRef-Public-Domain + +## Cryptography + +Content may contain encryption software. The country in which you are currently +may have restrictions on the import, possession, and use, and/or re-export to +another country, of encryption software. BEFORE using any encryption software, +please check the country's laws, regulations and policies concerning the import, +possession, or use, and re-export of encryption software, to see if this is +permitted. + + +======================================================================== + +Swagger Core NOTICE + +======================================================================== +Swagger Core - ${pom.name} +Copyright (c) 2015. SmartBear Software Inc. +Swagger Core - ${pom.name} is licensed under Apache 2.0 license. +Copy of the Apache 2.0 license can be found in `LICENSE` file. + + +======================================================================== + +Joda time NOTICE + +======================================================================== + +============================================================================= += NOTICE file corresponding to section 4d of the Apache License Version 2.0 = +============================================================================= +This product includes software developed by +Joda.org (https://www.joda.org/). + +======================================================================== + +Eclipse GlassFish NOTICE + +======================================================================== + +# Notices for Eclipse GlassFish + +This content is produced and maintained by the Eclipse GlassFish project. + +* Project home: https://projects.eclipse.org/projects/ee4j.glassfish + +## Trademarks + +Eclipse GlassFish, and GlassFish are trademarks of the Eclipse Foundation. + +## Copyright + +All content is the property of the respective authors or their employers. For +more information regarding authorship of content, please consult the listed +source code repository logs. + +## Declared Project Licenses + +This program and the accompanying materials are made available under the terms +of the Eclipse Public License v. 2.0 which is available at +http://www.eclipse.org/legal/epl-2.0. This Source Code may also be made +available under the following Secondary Licenses when the conditions for such +availability set forth in the Eclipse Public License v. 2.0 are satisfied: GNU +General Public License, version 2 with the GNU Classpath Exception which is +available at https://www.gnu.org/software/classpath/license.html. + +SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + +## Source Code + +The project maintains the following source code repositories: + +* https://github.com/eclipse-ee4j/glassfish-ha-api +* https://github.com/eclipse-ee4j/glassfish-logging-annotation-processor +* https://github.com/eclipse-ee4j/glassfish-shoal +* https://github.com/eclipse-ee4j/glassfish-cdi-porting-tck +* https://github.com/eclipse-ee4j/glassfish-jsftemplating +* https://github.com/eclipse-ee4j/glassfish-hk2-extra +* https://github.com/eclipse-ee4j/glassfish-hk2 +* https://github.com/eclipse-ee4j/glassfish-fighterfish + +## Third-party Content + +This project leverages the following third party content. + +None + +## Cryptography + +Content may contain encryption software. The country in which you are currently +may have restrictions on the import, possession, and use, and/or re-export to +another country, of encryption software. BEFORE using any encryption software, +please check the country's laws, regulations and policies concerning the import, +possession, or use, and re-export of encryption software, to see if this is +permitted. + + +======================================================================== + +netty NOTICE + +======================================================================== + + The Netty Project + ================= + +Please visit the Netty web site for more information: + + * https://netty.io/ + +Copyright 2014 The Netty Project + +The Netty Project 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: + + https://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. + +Also, please refer to each LICENSE..txt file, which is located in +the 'license' directory of the distribution file, for the license terms of the +components that this product depends on. + +------------------------------------------------------------------------------- +This product contains the extensions to Java Collections Framework which has +been derived from the works by JSR-166 EG, Doug Lea, and Jason T. Greene: + + * LICENSE: + * license/LICENSE.jsr166y.txt (Public Domain) + * HOMEPAGE: + * http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/ + * http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbosscache/experimental/jsr166/ + +This product contains a modified version of Robert Harder's Public Domain +Base64 Encoder and Decoder, which can be obtained at: + + * LICENSE: + * license/LICENSE.base64.txt (Public Domain) + * HOMEPAGE: + * http://iharder.sourceforge.net/current/java/base64/ + +This product contains a modified portion of 'Webbit', an event based +WebSocket and HTTP server, which can be obtained at: + + * LICENSE: + * license/LICENSE.webbit.txt (BSD License) + * HOMEPAGE: + * https://github.com/joewalnes/webbit + +This product contains a modified portion of 'SLF4J', a simple logging +facade for Java, which can be obtained at: + + * LICENSE: + * license/LICENSE.slf4j.txt (MIT License) + * HOMEPAGE: + * https://www.slf4j.org/ + +This product contains a modified portion of 'Apache Harmony', an open source +Java SE, which can be obtained at: + + * NOTICE: + * license/NOTICE.harmony.txt + * LICENSE: + * license/LICENSE.harmony.txt (Apache License 2.0) + * HOMEPAGE: + * https://archive.apache.org/dist/harmony/ + +This product contains a modified portion of 'jbzip2', a Java bzip2 compression +and decompression library written by Matthew J. Francis. It can be obtained at: + + * LICENSE: + * license/LICENSE.jbzip2.txt (MIT License) + * HOMEPAGE: + * https://code.google.com/p/jbzip2/ + +This product contains a modified portion of 'libdivsufsort', a C API library to construct +the suffix array and the Burrows-Wheeler transformed string for any input string of +a constant-size alphabet written by Yuta Mori. It can be obtained at: + + * LICENSE: + * license/LICENSE.libdivsufsort.txt (MIT License) + * HOMEPAGE: + * https://github.com/y-256/libdivsufsort + +This product contains a modified portion of Nitsan Wakart's 'JCTools', Java Concurrency Tools for the JVM, + which can be obtained at: + + * LICENSE: + * license/LICENSE.jctools.txt (ASL2 License) + * HOMEPAGE: + * https://github.com/JCTools/JCTools + +This product optionally depends on 'JZlib', a re-implementation of zlib in +pure Java, which can be obtained at: + + * LICENSE: + * license/LICENSE.jzlib.txt (BSD style License) + * HOMEPAGE: + * http://www.jcraft.com/jzlib/ + +This product optionally depends on 'Compress-LZF', a Java library for encoding and +decoding data in LZF format, written by Tatu Saloranta. It can be obtained at: + + * LICENSE: + * license/LICENSE.compress-lzf.txt (Apache License 2.0) + * HOMEPAGE: + * https://github.com/ning/compress + +This product optionally depends on 'lz4', a LZ4 Java compression +and decompression library written by Adrien Grand. It can be obtained at: + + * LICENSE: + * license/LICENSE.lz4.txt (Apache License 2.0) + * HOMEPAGE: + * https://github.com/jpountz/lz4-java + +This product optionally depends on 'lzma-java', a LZMA Java compression +and decompression library, which can be obtained at: + + * LICENSE: + * license/LICENSE.lzma-java.txt (Apache License 2.0) + * HOMEPAGE: + * https://github.com/jponge/lzma-java + +This product optionally depends on 'zstd-jni', a zstd-jni Java compression +and decompression library, which can be obtained at: + + * LICENSE: + * license/LICENSE.zstd-jni.txt (Apache License 2.0) + * HOMEPAGE: + * https://github.com/luben/zstd-jni + +This product contains a modified portion of 'jfastlz', a Java port of FastLZ compression +and decompression library written by William Kinney. It can be obtained at: + + * LICENSE: + * license/LICENSE.jfastlz.txt (MIT License) + * HOMEPAGE: + * https://code.google.com/p/jfastlz/ + +This product contains a modified portion of and optionally depends on 'Protocol Buffers', Google's data +interchange format, which can be obtained at: + + * LICENSE: + * license/LICENSE.protobuf.txt (New BSD License) + * HOMEPAGE: + * https://github.com/google/protobuf + +This product optionally depends on 'Bouncy Castle Crypto APIs' to generate +a temporary self-signed X.509 certificate when the JVM does not provide the +equivalent functionality. It can be obtained at: + + * LICENSE: + * license/LICENSE.bouncycastle.txt (MIT License) + * HOMEPAGE: + * https://www.bouncycastle.org/ + +This product optionally depends on 'Snappy', a compression library produced +by Google Inc, which can be obtained at: + + * LICENSE: + * license/LICENSE.snappy.txt (New BSD License) + * HOMEPAGE: + * https://github.com/google/snappy + +This product optionally depends on 'JBoss Marshalling', an alternative Java +serialization API, which can be obtained at: + + * LICENSE: + * license/LICENSE.jboss-marshalling.txt (Apache License 2.0) + * HOMEPAGE: + * https://github.com/jboss-remoting/jboss-marshalling + +This product optionally depends on 'Caliper', Google's micro- +benchmarking framework, which can be obtained at: + + * LICENSE: + * license/LICENSE.caliper.txt (Apache License 2.0) + * HOMEPAGE: + * https://github.com/google/caliper + +This product optionally depends on 'Apache Commons Logging', a logging +framework, which can be obtained at: + + * LICENSE: + * license/LICENSE.commons-logging.txt (Apache License 2.0) + * HOMEPAGE: + * https://commons.apache.org/logging/ + +This product optionally depends on 'Apache Log4J', a logging framework, which +can be obtained at: + + * LICENSE: + * license/LICENSE.log4j.txt (Apache License 2.0) + * HOMEPAGE: + * https://logging.apache.org/log4j/ + +This product optionally depends on 'Aalto XML', an ultra-high performance +non-blocking XML processor, which can be obtained at: + + * LICENSE: + * license/LICENSE.aalto-xml.txt (Apache License 2.0) + * HOMEPAGE: + * https://wiki.fasterxml.com/AaltoHome + +This product contains a modified version of 'HPACK', a Java implementation of +the HTTP/2 HPACK algorithm written by Twitter. It can be obtained at: + + * LICENSE: + * license/LICENSE.hpack.txt (Apache License 2.0) + * HOMEPAGE: + * https://github.com/twitter/hpack + +This product contains a modified version of 'HPACK', a Java implementation of +the HTTP/2 HPACK algorithm written by Cory Benfield. It can be obtained at: + + * LICENSE: + * license/LICENSE.hyper-hpack.txt (MIT License) + * HOMEPAGE: + * https://github.com/python-hyper/hpack/ + +This product contains a modified version of 'HPACK', a Java implementation of +the HTTP/2 HPACK algorithm written by Tatsuhiro Tsujikawa. It can be obtained at: + + * LICENSE: + * license/LICENSE.nghttp2-hpack.txt (MIT License) + * HOMEPAGE: + * https://github.com/nghttp2/nghttp2/ + +This product contains a modified portion of 'Apache Commons Lang', a Java library +provides utilities for the java.lang API, which can be obtained at: + + * LICENSE: + * license/LICENSE.commons-lang.txt (Apache License 2.0) + * HOMEPAGE: + * https://commons.apache.org/proper/commons-lang/ + + +This product contains the Maven wrapper scripts from 'Maven Wrapper', that provides an easy way to ensure a user has everything necessary to run the Maven build. + + * LICENSE: + * license/LICENSE.mvn-wrapper.txt (Apache License 2.0) + * HOMEPAGE: + * https://github.com/takari/maven-wrapper + +This product contains the dnsinfo.h header file, that provides a way to retrieve the system DNS configuration on MacOS. +This private header is also used by Apple's open source + mDNSResponder (https://opensource.apple.com/tarballs/mDNSResponder/). + + * LICENSE: + * license/LICENSE.dnsinfo.txt (Apple Public Source License 2.0) + * HOMEPAGE: + * https://www.opensource.apple.com/source/configd/configd-453.19/dnsinfo/dnsinfo.h + +This product optionally depends on 'Brotli4j', Brotli compression and +decompression for Java., which can be obtained at: + + * LICENSE: + * license/LICENSE.brotli4j.txt (Apache License 2.0) + * HOMEPAGE: + * https://github.com/hyperxpro/Brotli4j +======================================================================== + +perfmark NOTICE + +======================================================================== + +Copyright 2019 Google LLC + +Licensed 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. + +----------------------------------------------------------------------- + +This product contains a modified portion of 'Catapult', an open source +Trace Event viewer for Chome, Linux, and Android applications, which can +be obtained at: + + * LICENSE: + * traceviewer/src/main/resources/io/perfmark/traceviewer/third_party/catapult/LICENSE (New BSD License) + * HOMEPAGE: + * https://github.com/catapult-project/catapult + +This product contains a modified portion of 'Polymer', a library for Web +Components, which can be obtained at: + * LICENSE: + * traceviewer/src/main/resources/io/perfmark/traceviewer/third_party/polymer/LICENSE (New BSD License) + * HOMEPAGE: + * https://github.com/Polymer/polymer + + +This product contains a modified portion of 'ASM', an open source +Java Bytecode library, which can be obtained at: + + * LICENSE: + * agent/src/main/resources/io/perfmark/agent/third_party/asm/LICENSE (BSD style License) + * HOMEPAGE: + * https://asm.ow2.io/ +======================================================================== + +junit5 NOTICE + +======================================================================== +Open Source Licenses +==================== + +This product may include a number of subcomponents with separate +copyright notices and license terms. Your use of the source code for +these subcomponents is subject to the terms and conditions of the +subcomponent's license, as noted in the LICENSE-.md +files. +======================================================================== + +jaf-api NOTICE + +======================================================================== + +# Notices for Jakarta Activation + +This content is produced and maintained by Jakarta Activation project. + +* Project home: https://projects.eclipse.org/projects/ee4j.jaf + +## Copyright + +All content is the property of the respective authors or their employers. For +more information regarding authorship of content, please consult the listed +source code repository logs. + +## Declared Project Licenses + +This program and the accompanying materials are made available under the terms +of the Eclipse Distribution License v. 1.0, +which is available at http://www.eclipse.org/org/documents/edl-v10.php. + +SPDX-License-Identifier: BSD-3-Clause + +## Source Code + +The project maintains the following source code repositories: + +* https://github.com/eclipse-ee4j/jaf \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-JavaHamcrest.txt b/hugegraph-dist/release-docs/licenses/LICENSE-JavaHamcrest.txt new file mode 100644 index 0000000000..4933bda5ba --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-JavaHamcrest.txt @@ -0,0 +1,27 @@ +BSD License + +Copyright (c) 2000-2015 www.hamcrest.org +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of +conditions and the following disclaimer. Redistributions in binary form must reproduce +the above copyright notice, this list of conditions and the following disclaimer in +the documentation and/or other materials provided with the distribution. + +Neither the name of Hamcrest nor the names of its contributors may be used to endorse +or promote products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY +WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-animal-sniffer.txt b/hugegraph-dist/release-docs/licenses/LICENSE-animal-sniffer.txt new file mode 100644 index 0000000000..370fb559bb --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-animal-sniffer.txt @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2009 codehaus.org. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-aopalliance-repackaged.txt b/hugegraph-dist/release-docs/licenses/LICENSE-aopalliance-repackaged.txt new file mode 100644 index 0000000000..b1c74f95ed --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-aopalliance-repackaged.txt @@ -0,0 +1,759 @@ +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1 + +1. Definitions. + + 1.1. "Contributor" means each individual or entity that creates or + contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original + Software, prior Modifications used by a Contributor (if any), and + the Modifications made by that particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or (b) + Modifications, or (c) the combination of files containing Original + Software with files containing Modifications, in each case including + portions thereof. + + 1.4. "Executable" means the Covered Software in any form other than + Source Code. + + 1.5. "Initial Developer" means the individual or entity that first + makes Original Software available under this License. + + 1.6. "Larger Work" means a work which combines Covered Software or + portions thereof with code not governed by the terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable form of + any of the following: + + A. Any file that results from an addition to, deletion from or + modification of the contents of a file containing Original Software + or previous Modifications; + + B. Any new file that contains any part of the Original Software or + previous Modification; or + + C. Any new file that is contributed or otherwise made available + under the terms of this License. + + 1.10. "Original Software" means the Source Code and Executable form + of computer software code that is originally released under this + License. + + 1.11. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, process, + and apparatus claims, in any patent Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer software + code in which modifications are made and (b) associated + documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms of, + this License. For legal entities, "You" includes any entity which + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and subject + to third party intellectual property claims, the Initial Developer + hereby grants You a world-wide, royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer, to use, reproduce, + modify, display, perform, sublicense and distribute the Original + Software (or portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using or selling of + Original Software, to make, have made, use, practice, sell, and + offer for sale, and/or otherwise dispose of the Original Software + (or portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) are effective on + the date Initial Developer first distributes or otherwise makes the + Original Software available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: (1) for code that You delete from the Original Software, or + (2) for infringements caused by: (i) the modification of the + Original Software, or (ii) the combination of the Original Software + with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and subject + to third party intellectual property claims, each Contributor hereby + grants You a world-wide, royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor to use, reproduce, modify, + display, perform, sublicense and distribute the Modifications + created by such Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as Covered Software + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling + of Modifications made by that Contributor either alone and/or in + combination with its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, have made, and/or + otherwise dispose of: (1) Modifications made by that Contributor (or + portions thereof); and (2) the combination of Modifications made by + that Contributor with its Contributor Version (or portions of such + combination). + + (c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective + on the date Contributor first distributes or otherwise makes the + Modifications available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: (1) for any code that Contributor has deleted from the + Contributor Version; (2) for infringements caused by: (i) third + party modifications of Contributor Version, or (ii) the combination + of Modifications made by that Contributor with other software + (except as part of the Contributor Version) or other devices; or (3) + under Patent Claims infringed by Covered Software in the absence of + Modifications made by that Contributor. + +3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make available + in Executable form must also be made available in Source Code form + and that Source Code form must be distributed only under the terms + of this License. You must include a copy of this License with every + copy of the Source Code form of the Covered Software You distribute + or otherwise make available. You must inform recipients of any such + Covered Software in Executable form as to how they can obtain such + Covered Software in Source Code form in a reasonable manner on or + through a medium customarily used for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You contribute are + governed by the terms of this License. You represent that You + believe Your Modifications are Your original creation(s) and/or You + have sufficient rights to grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications that + identifies You as the Contributor of the Modification. You may not + remove or alter any copyright, patent or trademark notices contained + within the Covered Software, or any notices of licensing or any + descriptive text giving attribution to any Contributor or the + Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered Software in + Source Code form that alters or restricts the applicable version of + this License or the recipients' rights hereunder. You may choose to + offer, and to charge a fee for, warranty, support, indemnity or + liability obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on behalf of + the Initial Developer or any Contributor. You must make it + absolutely clear that any such warranty, support, indemnity or + liability obligation is offered by You alone, and You hereby agree + to indemnify the Initial Developer and every Contributor for any + liability incurred by the Initial Developer or such Contributor as a + result of warranty, support, indemnity or liability terms You offer. + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered Software under + the terms of this License or under the terms of a license of Your + choice, which may contain terms different from this License, + provided that You are in compliance with the terms of this License + and that the license for the Executable form does not attempt to + limit or alter the recipient's rights in the Source Code form from + the rights set forth in this License. If You distribute the Covered + Software in Executable form under a different license, You must make + it absolutely clear that any terms which differ from this License + are offered by You alone, not by the Initial Developer or + Contributor. You hereby agree to indemnify the Initial Developer and + every Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software with + other code not governed by the terms of this License and distribute + the Larger Work as a single product. In such a case, You must make + sure the requirements of this License are fulfilled for the Covered + Software. + +4. Versions of the License. + + 4.1. New Versions. + + Oracle is the initial license steward and may publish revised and/or + new versions of this License from time to time. Each version will be + given a distinguishing version number. Except as provided in Section + 4.3, no one other than the license steward has the right to modify + this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise make the + Covered Software available under the terms of the version of the + License under which You originally received the Covered Software. If + the Initial Developer includes a notice in the Original Software + prohibiting it from being distributed or otherwise made available + under any subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the version + of the License under which You originally received the Covered + Software. Otherwise, You may also choose to use, distribute or + otherwise make the Covered Software available under the terms of any + subsequent version of the License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a new + license for Your Original Software, You may create and use a + modified version of this License if You: (a) rename the license and + remove any references to the name of the license steward (except to + note that the license differs from this License); and (b) otherwise + make it clear that the license contains terms which differ from this + License. + +5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE + IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR + NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF + THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE + DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY + OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, + REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN + ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS + AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +6. TERMINATION. + + 6.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to + cure such breach within 30 days of becoming aware of the breach. + Provisions which, by their nature, must remain in effect beyond the + termination of this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or a + Contributor (the Initial Developer or Contributor against whom You + assert such claim is referred to as "Participant") alleging that the + Participant Software (meaning the Contributor Version where the + Participant is a Contributor or the Original Software where the + Participant is the Initial Developer) directly or indirectly + infringes any patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial Developer (if the + Initial Developer is not the Participant) and all Contributors under + Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice + from Participant terminate prospectively and automatically at the + expiration of such 60 day notice period, unless if within such 60 + day period You withdraw Your claim with respect to the Participant + Software against such Participant either unilaterally or pursuant to + a written agreement with Participant. + + 6.3. If You assert a patent infringement claim against Participant + alleging that the Participant Software directly or indirectly + infringes any patent where such claim is resolved (such as by + license or settlement) prior to the initiation of patent + infringement litigation, then the reasonable value of the licenses + granted by such Participant under Sections 2.1 or 2.2 shall be taken + into account in determining the amount or value of any payment or + license. + + 6.4. In the event of termination under Sections 6.1 or 6.2 above, + all end user licenses that have been validly granted by You or any + distributor hereunder prior to termination (excluding licenses + granted to You by any distributor) shall survive termination. + +7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE + TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER + FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR + LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE + POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT + APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH + PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH + LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR + LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION + AND LIMITATION MAY NOT APPLY TO YOU. + +8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is defined + in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer + software" (as that term is defined at 48 C.F.R. § + 252.227-7014(a)(1)) and "commercial computer software documentation" + as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent + with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 + (June 1995), all U.S. Government End Users acquire Covered Software + with only those rights set forth herein. This U.S. Government Rights + clause is in lieu of, and supersedes, any other FAR, DFAR, or other + clause or provision that addresses Government rights in computer + software under this License. + +9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed by + the law of the jurisdiction specified in a notice contained within + the Original Software (except to the extent applicable law, if any, + provides otherwise), excluding such jurisdiction's conflict-of-law + provisions. Any litigation relating to this License shall be subject + to the jurisdiction of the courts located in the jurisdiction and + venue specified in a notice contained within the Original Software, + with the losing party responsible for costs, including, without + limitation, court costs and reasonable attorneys' fees and expenses. + The application of the United Nations Convention on Contracts for + the International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall be + construed against the drafter shall not apply to this License. You + agree that You alone are responsible for compliance with the United + States export administration regulations (and the export control + laws and regulation of any other countries) when You use, distribute + or otherwise make available any Covered Software. + +10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or indirectly, + out of its utilization of rights under this License and You agree to + work with Initial Developer and Contributors to distribute such + responsibility on an equitable basis. Nothing herein is intended or + shall be deemed to constitute any admission of liability. + +------------------------------------------------------------------------ + +NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION +LICENSE (CDDL) + +The code released under the CDDL shall be governed by the laws of the +State of California (excluding conflict-of-law provisions). Any +litigation relating to this License shall be subject to the jurisdiction +of the Federal Courts of the Northern District of California and the +state courts of the State of California, with venue lying in Santa Clara +County, California. + + + + The GNU General Public License (GPL) Version 2, June 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +51 Franklin Street, Fifth Floor +Boston, MA 02110-1335 +USA + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your freedom to +share and change it. By contrast, the GNU General Public License is +intended to guarantee your freedom to share and change free software--to +make sure the software is free for all its users. This General Public +License applies to most of the Free Software Foundation's software and +to any other program whose authors commit to using it. (Some other Free +Software Foundation software is covered by the GNU Library General +Public License instead.) You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. +Our General Public Licenses are designed to make sure that you have the +freedom to distribute copies of free software (and charge for this +service if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs; and that you know you can do these things. + +To protect your rights, we need to make restrictions that forbid anyone +to deny you these rights or to ask you to surrender the rights. These +restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis +or for a fee, you must give the recipients all the rights that you have. +You must make sure that they, too, receive or can get the source code. +And you must show them these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + +Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + +Finally, any free program is threatened constantly by software patents. +We wish to avoid the danger that redistributors of a free program will +individually obtain patent licenses, in effect making the program +proprietary. To prevent this, we have made it clear that any patent must +be licensed for everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and +modification follow. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License applies to any program or other work which contains a +notice placed by the copyright holder saying it may be distributed under +the terms of this General Public License. The "Program", below, refers +to any such program or work, and a "work based on the Program" means +either the Program or any derivative work under copyright law: that is +to say, a work containing the Program or a portion of it, either +verbatim or with modifications and/or translated into another language. +(Hereinafter, translation is included without limitation in the term +"modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of running +the Program is not restricted, and the output from the Program is +covered only if its contents constitute a work based on the Program +(independent of having been made by running the Program). Whether that +is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's source +code as you receive it, in any medium, provided that you conspicuously +and appropriately publish on each copy an appropriate copyright notice +and disclaimer of warranty; keep intact all the notices that refer to +this License and to the absence of any warranty; and give any other +recipients of the Program a copy of this License along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion of +it, thus forming a work based on the Program, and copy and distribute +such modifications or work under the terms of Section 1 above, provided +that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any part + thereof, to be licensed as a whole at no charge to all third parties + under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a notice + that there is no warranty (or else, saying that you provide a + warranty) and that users may redistribute the program under these + conditions, and telling the user how to view a copy of this License. + (Exception: if the Program itself is interactive but does not + normally print such an announcement, your work based on the Program + is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, and +can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based on +the Program, the distribution of the whole must be on the terms of this +License, whose permissions for other licensees extend to the entire +whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of a +storage or distribution medium does not bring the other work under the +scope of this License. + +3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections 1 + and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your cost + of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer to + distribute corresponding source code. (This alternative is allowed + only for noncommercial distribution and only if you received the + program in object code or executable form with such an offer, in + accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source code +means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to control +compilation and installation of the executable. However, as a special +exception, the source code distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies the +executable. + +If distribution of executable or object code is made by offering access +to copy from a designated place, then offering equivalent access to copy +the source code from the same place counts as distribution of the source +code, even though third parties are not compelled to copy the source +along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt otherwise +to copy, modify, sublicense or distribute the Program is void, and will +automatically terminate your rights under this License. However, parties +who have received copies, or rights, from you under this License will +not have their licenses terminated so long as such parties remain in +full compliance. + +5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and all +its terms and conditions for copying, distributing or modifying the +Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further restrictions +on the recipients' exercise of the rights granted herein. You are not +responsible for enforcing compliance by third parties to this License. + +7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot distribute +so as to satisfy simultaneously your obligations under this License and +any other pertinent obligations, then as a consequence you may not +distribute the Program at all. For example, if a patent license would +not permit royalty-free redistribution of the Program by all those who +receive copies directly or indirectly through you, then the only way you +could satisfy both it and this License would be to refrain entirely from +distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is implemented +by public license practices. Many people have made generous +contributions to the wide range of software distributed through that +system in reliance on consistent application of that system; it is up to +the author/donor to decide if he or she is willing to distribute +software through any other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be +a consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License may +add an explicit geographical distribution limitation excluding those +countries, so that distribution is permitted only in or among countries +not thus excluded. In such case, this License incorporates the +limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new +versions of the General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Program does not specify a version +number of this License, you may choose any version ever published by the +Free Software Foundation. + +10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the +author to ask for permission. For software which is copyrighted by the +Free Software Foundation, write to the Free Software Foundation; we +sometimes make exceptions for this. Our decision will be guided by the +two goals of preserving the free status of all derivatives of our free +software and of promoting the sharing and reuse of software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, +EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE +ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH +YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL +NECESSARY SERVICING, REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR +DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL +DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM +(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED +INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF +THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR +OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to +attach them to the start of each source file to most effectively convey +the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + One line to give the program's name and a brief idea of what it does. + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type + `show w'. This is free software, and you are welcome to redistribute + it under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the +appropriate parts of the General Public License. Of course, the commands +you use may be called something other than `show w' and `show c'; they +could even be mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + program `Gnomovision' (which makes passes at compilers) written by + James Hacker. + + signature of Ty Coon, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications +with the library. If this is what you want to do, use the GNU Library +General Public License instead of this License. + +# + +Certain source files distributed by Oracle America, Inc. and/or its +affiliates are subject to the following clarification and special +exception to the GPLv2, based on the GNU Project exception for its +Classpath libraries, known as the GNU Classpath Exception, but only +where Oracle has expressly included in the particular source file's +header the words "Oracle designates this particular file as subject to +the "Classpath" exception as provided by Oracle in the LICENSE file +that accompanied this code." + +You should also note that Oracle includes multiple, independent +programs in this software package. Some of those programs are provided +under licenses deemed incompatible with the GPLv2 by the Free Software +Foundation and others. For example, the package includes programs +licensed under the Apache License, Version 2.0. Such programs are +licensed to you under their original licenses. + +Oracle facilitates your further distribution of this package by adding +the Classpath Exception to the necessary parts of its GPLv2 code, which +permits you to use that code in combination with other independent +modules not licensed under the GPLv2. However, note that this would +not permit you to commingle code under an incompatible license with +Oracle's GPLv2 licensed code by, for example, cutting and pasting such +code into a file also containing Oracle's GPLv2 licensed code and then +distributing the result. Additionally, if you were to remove the +Classpath Exception from any of the files to which it applies and +distribute the result, you would likely be required to license some or +all of the other code in that distribution under the GPLv2 as well, and +since the GPLv2 is incompatible with the license terms of some items +included in the distribution by Oracle, removing the Classpath +Exception could therefore effectively compromise your ability to +further distribute the package. + +Proceed with caution and we recommend that you obtain the advice of a +lawyer skilled in open source matters before removing the Classpath +Exception or making modifications to this package which may +subsequently be redistributed and/or involve the use of third party +software. + +CLASSPATH EXCEPTION +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License version 2 cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from or +based on this library. If you modify this library, you may extend this +exception to your version of the library, but you are not obligated to +do so. If you do not wish to do so, delete this exception statement +from your version. diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-api-client-staging.txt b/hugegraph-dist/release-docs/licenses/LICENSE-api-client-staging.txt new file mode 100644 index 0000000000..97ee06a0a4 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-api-client-staging.txt @@ -0,0 +1,25 @@ +Copyright 2016, Google Inc. +All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-checker-qual.txt b/hugegraph-dist/release-docs/licenses/LICENSE-checker-qual.txt new file mode 100644 index 0000000000..9837c6b69f --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-checker-qual.txt @@ -0,0 +1,22 @@ +Checker Framework qualifiers +Copyright 2004-present by the Checker Framework developers + +MIT License: + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-beanutils.txt b/hugegraph-dist/release-docs/licenses/LICENSE-commons-beanutils.txt new file mode 100644 index 0000000000..7a4a3ea242 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-commons-beanutils.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-codec.txt b/hugegraph-dist/release-docs/licenses/LICENSE-commons-codec.txt new file mode 100644 index 0000000000..7a4a3ea242 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-commons-codec.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-collections.txt b/hugegraph-dist/release-docs/licenses/LICENSE-commons-collections.txt new file mode 100644 index 0000000000..7a4a3ea242 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-commons-collections.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-configuration.txt b/hugegraph-dist/release-docs/licenses/LICENSE-commons-configuration.txt new file mode 100644 index 0000000000..7a4a3ea242 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-commons-configuration.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-configuration2.txt b/hugegraph-dist/release-docs/licenses/LICENSE-commons-configuration2.txt new file mode 100644 index 0000000000..7a4a3ea242 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-commons-configuration2.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-io.txt b/hugegraph-dist/release-docs/licenses/LICENSE-commons-io.txt new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-commons-io.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-lang.txt b/hugegraph-dist/release-docs/licenses/LICENSE-commons-lang.txt new file mode 100644 index 0000000000..7a4a3ea242 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-commons-lang.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-lang3.txt b/hugegraph-dist/release-docs/licenses/LICENSE-commons-lang3.txt new file mode 100644 index 0000000000..7a4a3ea242 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-commons-lang3.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-logging.txt b/hugegraph-dist/release-docs/licenses/LICENSE-commons-logging.txt new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-commons-logging.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-text.txt b/hugegraph-dist/release-docs/licenses/LICENSE-commons-text.txt new file mode 100644 index 0000000000..7a4a3ea242 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-commons-text.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-failureaccess.txt b/hugegraph-dist/release-docs/licenses/LICENSE-failureaccess.txt new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-failureaccess.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-glassfish-hk2.txt b/hugegraph-dist/release-docs/licenses/LICENSE-glassfish-hk2.txt new file mode 100644 index 0000000000..3b7ae66064 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-glassfish-hk2.txt @@ -0,0 +1,637 @@ +# Eclipse Public License - v 2.0 + + THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE + PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION + OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + + 1. DEFINITIONS + + "Contribution" means: + + a) in the case of the initial Contributor, the initial content + Distributed under this Agreement, and + + b) in the case of each subsequent Contributor: + i) changes to the Program, and + ii) additions to the Program; + where such changes and/or additions to the Program originate from + and are Distributed by that particular Contributor. A Contribution + "originates" from a Contributor if it was added to the Program by + such Contributor itself or anyone acting on such Contributor's behalf. + Contributions do not include changes or additions to the Program that + are not Modified Works. + + "Contributor" means any person or entity that Distributes the Program. + + "Licensed Patents" mean patent claims licensable by a Contributor which + are necessarily infringed by the use or sale of its Contribution alone + or when combined with the Program. + + "Program" means the Contributions Distributed in accordance with this + Agreement. + + "Recipient" means anyone who receives the Program under this Agreement + or any Secondary License (as applicable), including Contributors. + + "Derivative Works" shall mean any work, whether in Source Code or other + form, that is based on (or derived from) the Program and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. + + "Modified Works" shall mean any work in Source Code or other form that + results from an addition to, deletion from, or modification of the + contents of the Program, including, for purposes of clarity any new file + in Source Code form that contains any contents of the Program. Modified + Works shall not include works that contain only declarations, + interfaces, types, classes, structures, or files of the Program solely + in each case in order to link to, bind by name, or subclass the Program + or Modified Works thereof. + + "Distribute" means the acts of a) distributing or b) making available + in any manner that enables the transfer of a copy. + + "Source Code" means the form of a Program preferred for making + modifications, including but not limited to software source code, + documentation source, and configuration files. + + "Secondary License" means either the GNU General Public License, + Version 2.0, or any later versions of that license, including any + exceptions or additional permissions as identified by the initial + Contributor. + + 2. GRANT OF RIGHTS + + a) Subject to the terms of this Agreement, each Contributor hereby + grants Recipient a non-exclusive, worldwide, royalty-free copyright + license to reproduce, prepare Derivative Works of, publicly display, + publicly perform, Distribute and sublicense the Contribution of such + Contributor, if any, and such Derivative Works. + + b) Subject to the terms of this Agreement, each Contributor hereby + grants Recipient a non-exclusive, worldwide, royalty-free patent + license under Licensed Patents to make, use, sell, offer to sell, + import and otherwise transfer the Contribution of such Contributor, + if any, in Source Code or other form. This patent license shall + apply to the combination of the Contribution and the Program if, at + the time the Contribution is added by the Contributor, such addition + of the Contribution causes such combination to be covered by the + Licensed Patents. The patent license shall not apply to any other + combinations which include the Contribution. No hardware per se is + licensed hereunder. + + c) Recipient understands that although each Contributor grants the + licenses to its Contributions set forth herein, no assurances are + provided by any Contributor that the Program does not infringe the + patent or other intellectual property rights of any other entity. + Each Contributor disclaims any liability to Recipient for claims + brought by any other entity based on infringement of intellectual + property rights or otherwise. As a condition to exercising the + rights and licenses granted hereunder, each Recipient hereby + assumes sole responsibility to secure any other intellectual + property rights needed, if any. For example, if a third party + patent license is required to allow Recipient to Distribute the + Program, it is Recipient's responsibility to acquire that license + before distributing the Program. + + d) Each Contributor represents that to its knowledge it has + sufficient copyright rights in its Contribution, if any, to grant + the copyright license set forth in this Agreement. + + e) Notwithstanding the terms of any Secondary License, no + Contributor makes additional grants to any Recipient (other than + those set forth in this Agreement) as a result of such Recipient's + receipt of the Program under the terms of a Secondary License + (if permitted under the terms of Section 3). + + 3. REQUIREMENTS + + 3.1 If a Contributor Distributes the Program in any form, then: + + a) the Program must also be made available as Source Code, in + accordance with section 3.2, and the Contributor must accompany + the Program with a statement that the Source Code for the Program + is available under this Agreement, and informs Recipients how to + obtain it in a reasonable manner on or through a medium customarily + used for software exchange; and + + b) the Contributor may Distribute the Program under a license + different than this Agreement, provided that such license: + i) effectively disclaims on behalf of all other Contributors all + warranties and conditions, express and implied, including + warranties or conditions of title and non-infringement, and + implied warranties or conditions of merchantability and fitness + for a particular purpose; + + ii) effectively excludes on behalf of all other Contributors all + liability for damages, including direct, indirect, special, + incidental and consequential damages, such as lost profits; + + iii) does not attempt to limit or alter the recipients' rights + in the Source Code under section 3.2; and + + iv) requires any subsequent distribution of the Program by any + party to be under a license that satisfies the requirements + of this section 3. + + 3.2 When the Program is Distributed as Source Code: + + a) it must be made available under this Agreement, or if the + Program (i) is combined with other material in a separate file or + files made available under a Secondary License, and (ii) the initial + Contributor attached to the Source Code the notice described in + Exhibit A of this Agreement, then the Program may be made available + under the terms of such Secondary Licenses, and + + b) a copy of this Agreement must be included with each copy of + the Program. + + 3.3 Contributors may not remove or alter any copyright, patent, + trademark, attribution notices, disclaimers of warranty, or limitations + of liability ("notices") contained within the Program from any copy of + the Program which they Distribute, provided that Contributors may add + their own appropriate notices. + + 4. COMMERCIAL DISTRIBUTION + + Commercial distributors of software may accept certain responsibilities + with respect to end users, business partners and the like. While this + license is intended to facilitate the commercial use of the Program, + the Contributor who includes the Program in a commercial product + offering should do so in a manner which does not create potential + liability for other Contributors. Therefore, if a Contributor includes + the Program in a commercial product offering, such Contributor + ("Commercial Contributor") hereby agrees to defend and indemnify every + other Contributor ("Indemnified Contributor") against any losses, + damages and costs (collectively "Losses") arising from claims, lawsuits + and other legal actions brought by a third party against the Indemnified + Contributor to the extent caused by the acts or omissions of such + Commercial Contributor in connection with its distribution of the Program + in a commercial product offering. The obligations in this section do not + apply to any claims or Losses relating to any actual or alleged + intellectual property infringement. In order to qualify, an Indemnified + Contributor must: a) promptly notify the Commercial Contributor in + writing of such claim, and b) allow the Commercial Contributor to control, + and cooperate with the Commercial Contributor in, the defense and any + related settlement negotiations. The Indemnified Contributor may + participate in any such claim at its own expense. + + For example, a Contributor might include the Program in a commercial + product offering, Product X. That Contributor is then a Commercial + Contributor. If that Commercial Contributor then makes performance + claims, or offers warranties related to Product X, those performance + claims and warranties are such Commercial Contributor's responsibility + alone. Under this section, the Commercial Contributor would have to + defend claims against the other Contributors related to those performance + claims and warranties, and if a court requires any other Contributor to + pay any damages as a result, the Commercial Contributor must pay + those damages. + + 5. NO WARRANTY + + EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT + PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS" + BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR + IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF + TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR + PURPOSE. Each Recipient is solely responsible for determining the + appropriateness of using and distributing the Program and assumes all + risks associated with its exercise of rights under this Agreement, + including but not limited to the risks and costs of program errors, + compliance with applicable laws, damage to or loss of data, programs + or equipment, and unavailability or interruption of operations. + + 6. DISCLAIMER OF LIABILITY + + EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT + PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS + SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST + PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE + EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGES. + + 7. GENERAL + + If any provision of this Agreement is invalid or unenforceable under + applicable law, it shall not affect the validity or enforceability of + the remainder of the terms of this Agreement, and without further + action by the parties hereto, such provision shall be reformed to the + minimum extent necessary to make such provision valid and enforceable. + + If Recipient institutes patent litigation against any entity + (including a cross-claim or counterclaim in a lawsuit) alleging that the + Program itself (excluding combinations of the Program with other software + or hardware) infringes such Recipient's patent(s), then such Recipient's + rights granted under Section 2(b) shall terminate as of the date such + litigation is filed. + + All Recipient's rights under this Agreement shall terminate if it + fails to comply with any of the material terms or conditions of this + Agreement and does not cure such failure in a reasonable period of + time after becoming aware of such noncompliance. If all Recipient's + rights under this Agreement terminate, Recipient agrees to cease use + and distribution of the Program as soon as reasonably practicable. + However, Recipient's obligations under this Agreement and any licenses + granted by Recipient relating to the Program shall continue and survive. + + Everyone is permitted to copy and distribute copies of this Agreement, + but in order to avoid inconsistency the Agreement is copyrighted and + may only be modified in the following manner. The Agreement Steward + reserves the right to publish new versions (including revisions) of + this Agreement from time to time. No one other than the Agreement + Steward has the right to modify this Agreement. The Eclipse Foundation + is the initial Agreement Steward. The Eclipse Foundation may assign the + responsibility to serve as the Agreement Steward to a suitable separate + entity. Each new version of the Agreement will be given a distinguishing + version number. The Program (including Contributions) may always be + Distributed subject to the version of the Agreement under which it was + received. In addition, after a new version of the Agreement is published, + Contributor may elect to Distribute the Program (including its + Contributions) under the new version. + + Except as expressly stated in Sections 2(a) and 2(b) above, Recipient + receives no rights or licenses to the intellectual property of any + Contributor under this Agreement, whether expressly, by implication, + estoppel or otherwise. All rights in the Program not expressly granted + under this Agreement are reserved. Nothing in this Agreement is intended + to be enforceable by any entity that is not a Contributor or Recipient. + No third-party beneficiary rights are created under this Agreement. + + Exhibit A - Form of Secondary Licenses Notice + + "This Source Code may also be made available under the following + Secondary Licenses when the conditions for such availability set forth + in the Eclipse Public License, v. 2.0 are satisfied: {name license(s), + version(s), and exceptions or additional permissions here}." + + Simply including a copy of this Agreement, including this Exhibit A + is not sufficient to license the Source Code under Secondary Licenses. + + If it is not possible or desirable to put the notice in a particular + file, then You may include the notice in a location (such as a LICENSE + file in a relevant directory) where a recipient would be likely to + look for such a notice. + + You may add additional accurate notices of copyright ownership. + +--- + +## The GNU General Public License (GPL) Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor + Boston, MA 02110-1335 + USA + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your freedom to + share and change it. By contrast, the GNU General Public License is + intended to guarantee your freedom to share and change free software--to + make sure the software is free for all its users. This General Public + License applies to most of the Free Software Foundation's software and + to any other program whose authors commit to using it. (Some other Free + Software Foundation software is covered by the GNU Library General + Public License instead.) You can apply it to your programs, too. + + When we speak of free software, we are referring to freedom, not price. + Our General Public Licenses are designed to make sure that you have the + freedom to distribute copies of free software (and charge for this + service if you wish), that you receive source code or can get it if you + want it, that you can change the software or use pieces of it in new + free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid anyone + to deny you these rights or to ask you to surrender the rights. These + restrictions translate to certain responsibilities for you if you + distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether gratis + or for a fee, you must give the recipients all the rights that you have. + You must make sure that they, too, receive or can get the source code. + And you must show them these terms so they know their rights. + + We protect your rights with two steps: (1) copyright the software, and + (2) offer you this license which gives you legal permission to copy, + distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain + that everyone understands that there is no warranty for this free + software. If the software is modified by someone else and passed on, we + want its recipients to know that what they have is not the original, so + that any problems introduced by others will not reflect on the original + authors' reputations. + + Finally, any free program is threatened constantly by software patents. + We wish to avoid the danger that redistributors of a free program will + individually obtain patent licenses, in effect making the program + proprietary. To prevent this, we have made it clear that any patent must + be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and + modification follow. + + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains a + notice placed by the copyright holder saying it may be distributed under + the terms of this General Public License. The "Program", below, refers + to any such program or work, and a "work based on the Program" means + either the Program or any derivative work under copyright law: that is + to say, a work containing the Program or a portion of it, either + verbatim or with modifications and/or translated into another language. + (Hereinafter, translation is included without limitation in the term + "modification".) Each licensee is addressed as "you". + + Activities other than copying, distribution and modification are not + covered by this License; they are outside its scope. The act of running + the Program is not restricted, and the output from the Program is + covered only if its contents constitute a work based on the Program + (independent of having been made by running the Program). Whether that + is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's source + code as you receive it, in any medium, provided that you conspicuously + and appropriately publish on each copy an appropriate copyright notice + and disclaimer of warranty; keep intact all the notices that refer to + this License and to the absence of any warranty; and give any other + recipients of the Program a copy of this License along with the Program. + + You may charge a fee for the physical act of transferring a copy, and + you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion of + it, thus forming a work based on the Program, and copy and distribute + such modifications or work under the terms of Section 1 above, provided + that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any part + thereof, to be licensed as a whole at no charge to all third parties + under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a notice + that there is no warranty (or else, saying that you provide a + warranty) and that users may redistribute the program under these + conditions, and telling the user how to view a copy of this License. + (Exception: if the Program itself is interactive but does not + normally print such an announcement, your work based on the Program + is not required to print an announcement.) + + These requirements apply to the modified work as a whole. If + identifiable sections of that work are not derived from the Program, and + can be reasonably considered independent and separate works in + themselves, then this License, and its terms, do not apply to those + sections when you distribute them as separate works. But when you + distribute the same sections as part of a whole which is a work based on + the Program, the distribution of the whole must be on the terms of this + License, whose permissions for other licensees extend to the entire + whole, and thus to each and every part regardless of who wrote it. + + Thus, it is not the intent of this section to claim rights or contest + your rights to work written entirely by you; rather, the intent is to + exercise the right to control the distribution of derivative or + collective works based on the Program. + + In addition, mere aggregation of another work not based on the Program + with the Program (or with a work based on the Program) on a volume of a + storage or distribution medium does not bring the other work under the + scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, + under Section 2) in object code or executable form under the terms of + Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections 1 + and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your cost + of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer to + distribute corresponding source code. (This alternative is allowed + only for noncommercial distribution and only if you received the + program in object code or executable form with such an offer, in + accord with Subsection b above.) + + The source code for a work means the preferred form of the work for + making modifications to it. For an executable work, complete source code + means all the source code for all modules it contains, plus any + associated interface definition files, plus the scripts used to control + compilation and installation of the executable. However, as a special + exception, the source code distributed need not include anything that is + normally distributed (in either source or binary form) with the major + components (compiler, kernel, and so on) of the operating system on + which the executable runs, unless that component itself accompanies the + executable. + + If distribution of executable or object code is made by offering access + to copy from a designated place, then offering equivalent access to copy + the source code from the same place counts as distribution of the source + code, even though third parties are not compelled to copy the source + along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program + except as expressly provided under this License. Any attempt otherwise + to copy, modify, sublicense or distribute the Program is void, and will + automatically terminate your rights under this License. However, parties + who have received copies, or rights, from you under this License will + not have their licenses terminated so long as such parties remain in + full compliance. + + 5. You are not required to accept this License, since you have not + signed it. However, nothing else grants you permission to modify or + distribute the Program or its derivative works. These actions are + prohibited by law if you do not accept this License. Therefore, by + modifying or distributing the Program (or any work based on the + Program), you indicate your acceptance of this License to do so, and all + its terms and conditions for copying, distributing or modifying the + Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the + Program), the recipient automatically receives a license from the + original licensor to copy, distribute or modify the Program subject to + these terms and conditions. You may not impose any further restrictions + on the recipients' exercise of the rights granted herein. You are not + responsible for enforcing compliance by third parties to this License. + + 7. If, as a consequence of a court judgment or allegation of patent + infringement or for any other reason (not limited to patent issues), + conditions are imposed on you (whether by court order, agreement or + otherwise) that contradict the conditions of this License, they do not + excuse you from the conditions of this License. If you cannot distribute + so as to satisfy simultaneously your obligations under this License and + any other pertinent obligations, then as a consequence you may not + distribute the Program at all. For example, if a patent license would + not permit royalty-free redistribution of the Program by all those who + receive copies directly or indirectly through you, then the only way you + could satisfy both it and this License would be to refrain entirely from + distribution of the Program. + + If any portion of this section is held invalid or unenforceable under + any particular circumstance, the balance of the section is intended to + apply and the section as a whole is intended to apply in other + circumstances. + + It is not the purpose of this section to induce you to infringe any + patents or other property right claims or to contest validity of any + such claims; this section has the sole purpose of protecting the + integrity of the free software distribution system, which is implemented + by public license practices. Many people have made generous + contributions to the wide range of software distributed through that + system in reliance on consistent application of that system; it is up to + the author/donor to decide if he or she is willing to distribute + software through any other system and a licensee cannot impose that choice. + + This section is intended to make thoroughly clear what is believed to be + a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in + certain countries either by patents or by copyrighted interfaces, the + original copyright holder who places the Program under this License may + add an explicit geographical distribution limitation excluding those + countries, so that distribution is permitted only in or among countries + not thus excluded. In such case, this License incorporates the + limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new + versions of the General Public License from time to time. Such new + versions will be similar in spirit to the present version, but may + differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the Program + specifies a version number of this License which applies to it and "any + later version", you have the option of following the terms and + conditions either of that version or of any later version published by + the Free Software Foundation. If the Program does not specify a version + number of this License, you may choose any version ever published by the + Free Software Foundation. + + 10. If you wish to incorporate parts of the Program into other free + programs whose distribution conditions are different, write to the + author to ask for permission. For software which is copyrighted by the + Free Software Foundation, write to the Free Software Foundation; we + sometimes make exceptions for this. Our decision will be guided by the + two goals of preserving the free status of all derivatives of our free + software and of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO + WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. + EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR + OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, + EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE + ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH + YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL + NECESSARY SERVICING, REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN + WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY + AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR + DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL + DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM + (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED + INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF + THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR + OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest + possible use to the public, the best way to achieve this is to make it + free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest to + attach them to the start of each source file to most effectively convey + the exclusion of warranty; and each file should have at least the + "copyright" line and a pointer to where the full notice is found. + + One line to give the program's name and a brief idea of what it does. + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + + Also add information on how to contact you by electronic and paper mail. + + If the program is interactive, make it output a short notice like this + when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type + `show w'. This is free software, and you are welcome to redistribute + it under certain conditions; type `show c' for details. + + The hypothetical commands `show w' and `show c' should show the + appropriate parts of the General Public License. Of course, the commands + you use may be called something other than `show w' and `show c'; they + could even be mouse-clicks or menu items--whatever suits your program. + + You should also get your employer (if you work as a programmer) or your + school, if any, to sign a "copyright disclaimer" for the program, if + necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + program `Gnomovision' (which makes passes at compilers) written by + James Hacker. + + signature of Ty Coon, 1 April 1989 + Ty Coon, President of Vice + + This General Public License does not permit incorporating your program + into proprietary programs. If your program is a subroutine library, you + may consider it more useful to permit linking proprietary applications + with the library. If this is what you want to do, use the GNU Library + General Public License instead of this License. + +--- + +## CLASSPATH EXCEPTION + + Linking this library statically or dynamically with other modules is + making a combined work based on this library. Thus, the terms and + conditions of the GNU General Public License version 2 cover the whole + combination. + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent + modules, and to copy and distribute the resulting executable under + terms of your choice, provided that you also meet, for each linked + independent module, the terms and conditions of the license of that + module. An independent module is a module which is not derived from or + based on this library. If you modify this library, you may extend this + exception to your version of the library, but you are not obligated to + do so. If you do not wish to do so, delete this exception statement + from your version. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-grpc-java.txt b/hugegraph-dist/release-docs/licenses/LICENSE-grpc-java.txt new file mode 100644 index 0000000000..7a4a3ea242 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-grpc-java.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-gson.txt b/hugegraph-dist/release-docs/licenses/LICENSE-gson.txt new file mode 100644 index 0000000000..7a4a3ea242 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-gson.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-httpclient.txt b/hugegraph-dist/release-docs/licenses/LICENSE-httpclient.txt new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-httpclient.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-httpcore.txt b/hugegraph-dist/release-docs/licenses/LICENSE-httpcore.txt new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-httpcore.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-j2objc.txt b/hugegraph-dist/release-docs/licenses/LICENSE-j2objc.txt new file mode 100644 index 0000000000..2b004c3eee --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-j2objc.txt @@ -0,0 +1,232 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. + +-------------------------------------------------------------------------------- +The next section, BSD-3-Clause, applies to the files in: +jre_emul/android/platform/libcore/ojluni/src/main/java/java/time +-------------------------------------------------------------------------------- +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of JSR-310 nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-annotations-2.14.0.txt b/hugegraph-dist/release-docs/licenses/LICENSE-jackson-annotations-2.14.0.txt new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-jackson-annotations-2.14.0.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-annotations.txt b/hugegraph-dist/release-docs/licenses/LICENSE-jackson-annotations.txt new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-jackson-annotations.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-core-2.14.0.txt b/hugegraph-dist/release-docs/licenses/LICENSE-jackson-core-2.14.0.txt new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-jackson-core-2.14.0.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-core.txt b/hugegraph-dist/release-docs/licenses/LICENSE-jackson-core.txt new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-jackson-core.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-databind-2.14.0.txt b/hugegraph-dist/release-docs/licenses/LICENSE-jackson-databind-2.14.0.txt new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-jackson-databind-2.14.0.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-databind.txt b/hugegraph-dist/release-docs/licenses/LICENSE-jackson-databind.txt new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-jackson-databind.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-dataformat-yaml.txt b/hugegraph-dist/release-docs/licenses/LICENSE-jackson-dataformat-yaml.txt new file mode 100644 index 0000000000..8d5775d40c --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-jackson-dataformat-yaml.txt @@ -0,0 +1,8 @@ +This copy of Jackson JSON processor YAML module is licensed under the +Apache (Software) License, version 2.0 ("the License"). +See the License for details about distribution rights, and the +specific rights regarding derivate works. + +You may obtain a copy of the License at: + +http://www.apache.org/licenses/LICENSE-2.0 diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-base-2.14.0.txt b/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-base-2.14.0.txt new file mode 100644 index 0000000000..6acf75483f --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-base-2.14.0.txt @@ -0,0 +1,8 @@ +This copy of Jackson JSON processor databind module is licensed under the +Apache (Software) License, version 2.0 ("the License"). +See the License for details about distribution rights, and the +specific rights regarding derivate works. + +You may obtain a copy of the License at: + +http://www.apache.org/licenses/LICENSE-2.0 diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-base.txt b/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-base.txt new file mode 100644 index 0000000000..6acf75483f --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-base.txt @@ -0,0 +1,8 @@ +This copy of Jackson JSON processor databind module is licensed under the +Apache (Software) License, version 2.0 ("the License"). +See the License for details about distribution rights, and the +specific rights regarding derivate works. + +You may obtain a copy of the License at: + +http://www.apache.org/licenses/LICENSE-2.0 diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider-2.14.0.txt b/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider-2.14.0.txt new file mode 100644 index 0000000000..6acf75483f --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider-2.14.0.txt @@ -0,0 +1,8 @@ +This copy of Jackson JSON processor databind module is licensed under the +Apache (Software) License, version 2.0 ("the License"). +See the License for details about distribution rights, and the +specific rights regarding derivate works. + +You may obtain a copy of the License at: + +http://www.apache.org/licenses/LICENSE-2.0 diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider.txt b/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider.txt new file mode 100644 index 0000000000..6acf75483f --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider.txt @@ -0,0 +1,8 @@ +This copy of Jackson JSON processor databind module is licensed under the +Apache (Software) License, version 2.0 ("the License"). +See the License for details about distribution rights, and the +specific rights regarding derivate works. + +You may obtain a copy of the License at: + +http://www.apache.org/licenses/LICENSE-2.0 diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-module-jaxb-annotations-2.14.0.txt b/hugegraph-dist/release-docs/licenses/LICENSE-jackson-module-jaxb-annotations-2.14.0.txt new file mode 100644 index 0000000000..283587f1b1 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-jackson-module-jaxb-annotations-2.14.0.txt @@ -0,0 +1,8 @@ +This copy of Jackson JSON processor `jackson-module-jaxb-annotations` module is licensed under the +Apache (Software) License, version 2.0 ("the License"). +See the License for details about distribution rights, and the +specific rights regarding derivate works. + +You may obtain a copy of the License at: + +http://www.apache.org/licenses/LICENSE-2.0 diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-module-jaxb-annotations.txt b/hugegraph-dist/release-docs/licenses/LICENSE-jackson-module-jaxb-annotations.txt new file mode 100644 index 0000000000..283587f1b1 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-jackson-module-jaxb-annotations.txt @@ -0,0 +1,8 @@ +This copy of Jackson JSON processor `jackson-module-jaxb-annotations` module is licensed under the +Apache (Software) License, version 2.0 ("the License"). +See the License for details about distribution rights, and the +specific rights regarding derivate works. + +You may obtain a copy of the License at: + +http://www.apache.org/licenses/LICENSE-2.0 diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jaf-api.txt b/hugegraph-dist/release-docs/licenses/LICENSE-jaf-api.txt new file mode 100644 index 0000000000..05220de312 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-jaf-api.txt @@ -0,0 +1,29 @@ + + Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + - Neither the name of the Eclipse Foundation, Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jakarta.activation-api.txt b/hugegraph-dist/release-docs/licenses/LICENSE-jakarta.activation-api.txt new file mode 100644 index 0000000000..e0358f9721 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-jakarta.activation-api.txt @@ -0,0 +1,29 @@ + + Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + - Neither the name of the Eclipse Foundation, Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jakarta.annotation-api.txt b/hugegraph-dist/release-docs/licenses/LICENSE-jakarta.annotation-api.txt new file mode 100644 index 0000000000..5de3d1b40c --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-jakarta.annotation-api.txt @@ -0,0 +1,637 @@ +# Eclipse Public License - v 2.0 + + THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE + PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION + OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + + 1. DEFINITIONS + + "Contribution" means: + + a) in the case of the initial Contributor, the initial content + Distributed under this Agreement, and + + b) in the case of each subsequent Contributor: + i) changes to the Program, and + ii) additions to the Program; + where such changes and/or additions to the Program originate from + and are Distributed by that particular Contributor. A Contribution + "originates" from a Contributor if it was added to the Program by + such Contributor itself or anyone acting on such Contributor's behalf. + Contributions do not include changes or additions to the Program that + are not Modified Works. + + "Contributor" means any person or entity that Distributes the Program. + + "Licensed Patents" mean patent claims licensable by a Contributor which + are necessarily infringed by the use or sale of its Contribution alone + or when combined with the Program. + + "Program" means the Contributions Distributed in accordance with this + Agreement. + + "Recipient" means anyone who receives the Program under this Agreement + or any Secondary License (as applicable), including Contributors. + + "Derivative Works" shall mean any work, whether in Source Code or other + form, that is based on (or derived from) the Program and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. + + "Modified Works" shall mean any work in Source Code or other form that + results from an addition to, deletion from, or modification of the + contents of the Program, including, for purposes of clarity any new file + in Source Code form that contains any contents of the Program. Modified + Works shall not include works that contain only declarations, + interfaces, types, classes, structures, or files of the Program solely + in each case in order to link to, bind by name, or subclass the Program + or Modified Works thereof. + + "Distribute" means the acts of a) distributing or b) making available + in any manner that enables the transfer of a copy. + + "Source Code" means the form of a Program preferred for making + modifications, including but not limited to software source code, + documentation source, and configuration files. + + "Secondary License" means either the GNU General Public License, + Version 2.0, or any later versions of that license, including any + exceptions or additional permissions as identified by the initial + Contributor. + + 2. GRANT OF RIGHTS + + a) Subject to the terms of this Agreement, each Contributor hereby + grants Recipient a non-exclusive, worldwide, royalty-free copyright + license to reproduce, prepare Derivative Works of, publicly display, + publicly perform, Distribute and sublicense the Contribution of such + Contributor, if any, and such Derivative Works. + + b) Subject to the terms of this Agreement, each Contributor hereby + grants Recipient a non-exclusive, worldwide, royalty-free patent + license under Licensed Patents to make, use, sell, offer to sell, + import and otherwise transfer the Contribution of such Contributor, + if any, in Source Code or other form. This patent license shall + apply to the combination of the Contribution and the Program if, at + the time the Contribution is added by the Contributor, such addition + of the Contribution causes such combination to be covered by the + Licensed Patents. The patent license shall not apply to any other + combinations which include the Contribution. No hardware per se is + licensed hereunder. + + c) Recipient understands that although each Contributor grants the + licenses to its Contributions set forth herein, no assurances are + provided by any Contributor that the Program does not infringe the + patent or other intellectual property rights of any other entity. + Each Contributor disclaims any liability to Recipient for claims + brought by any other entity based on infringement of intellectual + property rights or otherwise. As a condition to exercising the + rights and licenses granted hereunder, each Recipient hereby + assumes sole responsibility to secure any other intellectual + property rights needed, if any. For example, if a third party + patent license is required to allow Recipient to Distribute the + Program, it is Recipient's responsibility to acquire that license + before distributing the Program. + + d) Each Contributor represents that to its knowledge it has + sufficient copyright rights in its Contribution, if any, to grant + the copyright license set forth in this Agreement. + + e) Notwithstanding the terms of any Secondary License, no + Contributor makes additional grants to any Recipient (other than + those set forth in this Agreement) as a result of such Recipient's + receipt of the Program under the terms of a Secondary License + (if permitted under the terms of Section 3). + + 3. REQUIREMENTS + + 3.1 If a Contributor Distributes the Program in any form, then: + + a) the Program must also be made available as Source Code, in + accordance with section 3.2, and the Contributor must accompany + the Program with a statement that the Source Code for the Program + is available under this Agreement, and informs Recipients how to + obtain it in a reasonable manner on or through a medium customarily + used for software exchange; and + + b) the Contributor may Distribute the Program under a license + different than this Agreement, provided that such license: + i) effectively disclaims on behalf of all other Contributors all + warranties and conditions, express and implied, including + warranties or conditions of title and non-infringement, and + implied warranties or conditions of merchantability and fitness + for a particular purpose; + + ii) effectively excludes on behalf of all other Contributors all + liability for damages, including direct, indirect, special, + incidental and consequential damages, such as lost profits; + + iii) does not attempt to limit or alter the recipients' rights + in the Source Code under section 3.2; and + + iv) requires any subsequent distribution of the Program by any + party to be under a license that satisfies the requirements + of this section 3. + + 3.2 When the Program is Distributed as Source Code: + + a) it must be made available under this Agreement, or if the + Program (i) is combined with other material in a separate file or + files made available under a Secondary License, and (ii) the initial + Contributor attached to the Source Code the notice described in + Exhibit A of this Agreement, then the Program may be made available + under the terms of such Secondary Licenses, and + + b) a copy of this Agreement must be included with each copy of + the Program. + + 3.3 Contributors may not remove or alter any copyright, patent, + trademark, attribution notices, disclaimers of warranty, or limitations + of liability ("notices") contained within the Program from any copy of + the Program which they Distribute, provided that Contributors may add + their own appropriate notices. + + 4. COMMERCIAL DISTRIBUTION + + Commercial distributors of software may accept certain responsibilities + with respect to end users, business partners and the like. While this + license is intended to facilitate the commercial use of the Program, + the Contributor who includes the Program in a commercial product + offering should do so in a manner which does not create potential + liability for other Contributors. Therefore, if a Contributor includes + the Program in a commercial product offering, such Contributor + ("Commercial Contributor") hereby agrees to defend and indemnify every + other Contributor ("Indemnified Contributor") against any losses, + damages and costs (collectively "Losses") arising from claims, lawsuits + and other legal actions brought by a third party against the Indemnified + Contributor to the extent caused by the acts or omissions of such + Commercial Contributor in connection with its distribution of the Program + in a commercial product offering. The obligations in this section do not + apply to any claims or Losses relating to any actual or alleged + intellectual property infringement. In order to qualify, an Indemnified + Contributor must: a) promptly notify the Commercial Contributor in + writing of such claim, and b) allow the Commercial Contributor to control, + and cooperate with the Commercial Contributor in, the defense and any + related settlement negotiations. The Indemnified Contributor may + participate in any such claim at its own expense. + + For example, a Contributor might include the Program in a commercial + product offering, Product X. That Contributor is then a Commercial + Contributor. If that Commercial Contributor then makes performance + claims, or offers warranties related to Product X, those performance + claims and warranties are such Commercial Contributor's responsibility + alone. Under this section, the Commercial Contributor would have to + defend claims against the other Contributors related to those performance + claims and warranties, and if a court requires any other Contributor to + pay any damages as a result, the Commercial Contributor must pay + those damages. + + 5. NO WARRANTY + + EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT + PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS" + BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR + IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF + TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR + PURPOSE. Each Recipient is solely responsible for determining the + appropriateness of using and distributing the Program and assumes all + risks associated with its exercise of rights under this Agreement, + including but not limited to the risks and costs of program errors, + compliance with applicable laws, damage to or loss of data, programs + or equipment, and unavailability or interruption of operations. + + 6. DISCLAIMER OF LIABILITY + + EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT + PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS + SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST + PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE + EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGES. + + 7. GENERAL + + If any provision of this Agreement is invalid or unenforceable under + applicable law, it shall not affect the validity or enforceability of + the remainder of the terms of this Agreement, and without further + action by the parties hereto, such provision shall be reformed to the + minimum extent necessary to make such provision valid and enforceable. + + If Recipient institutes patent litigation against any entity + (including a cross-claim or counterclaim in a lawsuit) alleging that the + Program itself (excluding combinations of the Program with other software + or hardware) infringes such Recipient's patent(s), then such Recipient's + rights granted under Section 2(b) shall terminate as of the date such + litigation is filed. + + All Recipient's rights under this Agreement shall terminate if it + fails to comply with any of the material terms or conditions of this + Agreement and does not cure such failure in a reasonable period of + time after becoming aware of such noncompliance. If all Recipient's + rights under this Agreement terminate, Recipient agrees to cease use + and distribution of the Program as soon as reasonably practicable. + However, Recipient's obligations under this Agreement and any licenses + granted by Recipient relating to the Program shall continue and survive. + + Everyone is permitted to copy and distribute copies of this Agreement, + but in order to avoid inconsistency the Agreement is copyrighted and + may only be modified in the following manner. The Agreement Steward + reserves the right to publish new versions (including revisions) of + this Agreement from time to time. No one other than the Agreement + Steward has the right to modify this Agreement. The Eclipse Foundation + is the initial Agreement Steward. The Eclipse Foundation may assign the + responsibility to serve as the Agreement Steward to a suitable separate + entity. Each new version of the Agreement will be given a distinguishing + version number. The Program (including Contributions) may always be + Distributed subject to the version of the Agreement under which it was + received. In addition, after a new version of the Agreement is published, + Contributor may elect to Distribute the Program (including its + Contributions) under the new version. + + Except as expressly stated in Sections 2(a) and 2(b) above, Recipient + receives no rights or licenses to the intellectual property of any + Contributor under this Agreement, whether expressly, by implication, + estoppel or otherwise. All rights in the Program not expressly granted + under this Agreement are reserved. Nothing in this Agreement is intended + to be enforceable by any entity that is not a Contributor or Recipient. + No third-party beneficiary rights are created under this Agreement. + + Exhibit A - Form of Secondary Licenses Notice + + "This Source Code may also be made available under the following + Secondary Licenses when the conditions for such availability set forth + in the Eclipse Public License, v. 2.0 are satisfied: {name license(s), + version(s), and exceptions or additional permissions here}." + + Simply including a copy of this Agreement, including this Exhibit A + is not sufficient to license the Source Code under Secondary Licenses. + + If it is not possible or desirable to put the notice in a particular + file, then You may include the notice in a location (such as a LICENSE + file in a relevant directory) where a recipient would be likely to + look for such a notice. + + You may add additional accurate notices of copyright ownership. + +--- + +## The GNU General Public License (GPL) Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor + Boston, MA 02110-1335 + USA + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your freedom to + share and change it. By contrast, the GNU General Public License is + intended to guarantee your freedom to share and change free software--to + make sure the software is free for all its users. This General Public + License applies to most of the Free Software Foundation's software and + to any other program whose authors commit to using it. (Some other Free + Software Foundation software is covered by the GNU Library General + Public License instead.) You can apply it to your programs, too. + + When we speak of free software, we are referring to freedom, not price. + Our General Public Licenses are designed to make sure that you have the + freedom to distribute copies of free software (and charge for this + service if you wish), that you receive source code or can get it if you + want it, that you can change the software or use pieces of it in new + free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid anyone + to deny you these rights or to ask you to surrender the rights. These + restrictions translate to certain responsibilities for you if you + distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether gratis + or for a fee, you must give the recipients all the rights that you have. + You must make sure that they, too, receive or can get the source code. + And you must show them these terms so they know their rights. + + We protect your rights with two steps: (1) copyright the software, and + (2) offer you this license which gives you legal permission to copy, + distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain + that everyone understands that there is no warranty for this free + software. If the software is modified by someone else and passed on, we + want its recipients to know that what they have is not the original, so + that any problems introduced by others will not reflect on the original + authors' reputations. + + Finally, any free program is threatened constantly by software patents. + We wish to avoid the danger that redistributors of a free program will + individually obtain patent licenses, in effect making the program + proprietary. To prevent this, we have made it clear that any patent must + be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and + modification follow. + + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains a + notice placed by the copyright holder saying it may be distributed under + the terms of this General Public License. The "Program", below, refers + to any such program or work, and a "work based on the Program" means + either the Program or any derivative work under copyright law: that is + to say, a work containing the Program or a portion of it, either + verbatim or with modifications and/or translated into another language. + (Hereinafter, translation is included without limitation in the term + "modification".) Each licensee is addressed as "you". + + Activities other than copying, distribution and modification are not + covered by this License; they are outside its scope. The act of running + the Program is not restricted, and the output from the Program is + covered only if its contents constitute a work based on the Program + (independent of having been made by running the Program). Whether that + is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's source + code as you receive it, in any medium, provided that you conspicuously + and appropriately publish on each copy an appropriate copyright notice + and disclaimer of warranty; keep intact all the notices that refer to + this License and to the absence of any warranty; and give any other + recipients of the Program a copy of this License along with the Program. + + You may charge a fee for the physical act of transferring a copy, and + you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion of + it, thus forming a work based on the Program, and copy and distribute + such modifications or work under the terms of Section 1 above, provided + that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any part + thereof, to be licensed as a whole at no charge to all third parties + under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a notice + that there is no warranty (or else, saying that you provide a + warranty) and that users may redistribute the program under these + conditions, and telling the user how to view a copy of this License. + (Exception: if the Program itself is interactive but does not + normally print such an announcement, your work based on the Program + is not required to print an announcement.) + + These requirements apply to the modified work as a whole. If + identifiable sections of that work are not derived from the Program, and + can be reasonably considered independent and separate works in + themselves, then this License, and its terms, do not apply to those + sections when you distribute them as separate works. But when you + distribute the same sections as part of a whole which is a work based on + the Program, the distribution of the whole must be on the terms of this + License, whose permissions for other licensees extend to the entire + whole, and thus to each and every part regardless of who wrote it. + + Thus, it is not the intent of this section to claim rights or contest + your rights to work written entirely by you; rather, the intent is to + exercise the right to control the distribution of derivative or + collective works based on the Program. + + In addition, mere aggregation of another work not based on the Program + with the Program (or with a work based on the Program) on a volume of a + storage or distribution medium does not bring the other work under the + scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, + under Section 2) in object code or executable form under the terms of + Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections 1 + and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your cost + of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer to + distribute corresponding source code. (This alternative is allowed + only for noncommercial distribution and only if you received the + program in object code or executable form with such an offer, in + accord with Subsection b above.) + + The source code for a work means the preferred form of the work for + making modifications to it. For an executable work, complete source code + means all the source code for all modules it contains, plus any + associated interface definition files, plus the scripts used to control + compilation and installation of the executable. However, as a special + exception, the source code distributed need not include anything that is + normally distributed (in either source or binary form) with the major + components (compiler, kernel, and so on) of the operating system on + which the executable runs, unless that component itself accompanies the + executable. + + If distribution of executable or object code is made by offering access + to copy from a designated place, then offering equivalent access to copy + the source code from the same place counts as distribution of the source + code, even though third parties are not compelled to copy the source + along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program + except as expressly provided under this License. Any attempt otherwise + to copy, modify, sublicense or distribute the Program is void, and will + automatically terminate your rights under this License. However, parties + who have received copies, or rights, from you under this License will + not have their licenses terminated so long as such parties remain in + full compliance. + + 5. You are not required to accept this License, since you have not + signed it. However, nothing else grants you permission to modify or + distribute the Program or its derivative works. These actions are + prohibited by law if you do not accept this License. Therefore, by + modifying or distributing the Program (or any work based on the + Program), you indicate your acceptance of this License to do so, and all + its terms and conditions for copying, distributing or modifying the + Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the + Program), the recipient automatically receives a license from the + original licensor to copy, distribute or modify the Program subject to + these terms and conditions. You may not impose any further restrictions + on the recipients' exercise of the rights granted herein. You are not + responsible for enforcing compliance by third parties to this License. + + 7. If, as a consequence of a court judgment or allegation of patent + infringement or for any other reason (not limited to patent issues), + conditions are imposed on you (whether by court order, agreement or + otherwise) that contradict the conditions of this License, they do not + excuse you from the conditions of this License. If you cannot distribute + so as to satisfy simultaneously your obligations under this License and + any other pertinent obligations, then as a consequence you may not + distribute the Program at all. For example, if a patent license would + not permit royalty-free redistribution of the Program by all those who + receive copies directly or indirectly through you, then the only way you + could satisfy both it and this License would be to refrain entirely from + distribution of the Program. + + If any portion of this section is held invalid or unenforceable under + any particular circumstance, the balance of the section is intended to + apply and the section as a whole is intended to apply in other + circumstances. + + It is not the purpose of this section to induce you to infringe any + patents or other property right claims or to contest validity of any + such claims; this section has the sole purpose of protecting the + integrity of the free software distribution system, which is implemented + by public license practices. Many people have made generous + contributions to the wide range of software distributed through that + system in reliance on consistent application of that system; it is up to + the author/donor to decide if he or she is willing to distribute + software through any other system and a licensee cannot impose that choice. + + This section is intended to make thoroughly clear what is believed to be + a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in + certain countries either by patents or by copyrighted interfaces, the + original copyright holder who places the Program under this License may + add an explicit geographical distribution limitation excluding those + countries, so that distribution is permitted only in or among countries + not thus excluded. In such case, this License incorporates the + limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new + versions of the General Public License from time to time. Such new + versions will be similar in spirit to the present version, but may + differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the Program + specifies a version number of this License which applies to it and "any + later version", you have the option of following the terms and + conditions either of that version or of any later version published by + the Free Software Foundation. If the Program does not specify a version + number of this License, you may choose any version ever published by the + Free Software Foundation. + + 10. If you wish to incorporate parts of the Program into other free + programs whose distribution conditions are different, write to the + author to ask for permission. For software which is copyrighted by the + Free Software Foundation, write to the Free Software Foundation; we + sometimes make exceptions for this. Our decision will be guided by the + two goals of preserving the free status of all derivatives of our free + software and of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO + WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. + EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR + OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, + EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE + ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH + YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL + NECESSARY SERVICING, REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN + WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY + AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR + DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL + DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM + (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED + INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF + THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR + OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest + possible use to the public, the best way to achieve this is to make it + free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest to + attach them to the start of each source file to most effectively convey + the exclusion of warranty; and each file should have at least the + "copyright" line and a pointer to where the full notice is found. + + One line to give the program's name and a brief idea of what it does. + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + + Also add information on how to contact you by electronic and paper mail. + + If the program is interactive, make it output a short notice like this + when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type + `show w'. This is free software, and you are welcome to redistribute + it under certain conditions; type `show c' for details. + + The hypothetical commands `show w' and `show c' should show the + appropriate parts of the General Public License. Of course, the commands + you use may be called something other than `show w' and `show c'; they + could even be mouse-clicks or menu items--whatever suits your program. + + You should also get your employer (if you work as a programmer) or your + school, if any, to sign a "copyright disclaimer" for the program, if + necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + program `Gnomovision' (which makes passes at compilers) written by + James Hacker. + + signature of Ty Coon, 1 April 1989 + Ty Coon, President of Vice + + This General Public License does not permit incorporating your program + into proprietary programs. If your program is a subroutine library, you + may consider it more useful to permit linking proprietary applications + with the library. If this is what you want to do, use the GNU Library + General Public License instead of this License. + +--- + +## CLASSPATH EXCEPTION + + Linking this library statically or dynamically with other modules is + making a combined work based on this library. Thus, the terms and + conditions of the GNU General Public License version 2 cover the whole + combination. + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent + modules, and to copy and distribute the resulting executable under + terms of your choice, provided that you also meet, for each linked + independent module, the terms and conditions of the license of that + module. An independent module is a module which is not derived from or + based on this library. If you modify this library, you may extend this + exception to your version of the library, but you are not obligated to + do so. If you do not wish to do so, delete this exception statement + from your version. diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jakarta.xml.bind-api.txt b/hugegraph-dist/release-docs/licenses/LICENSE-jakarta.xml.bind-api.txt new file mode 100644 index 0000000000..6fb337cb01 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-jakarta.xml.bind-api.txt @@ -0,0 +1,29 @@ + + Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + - Neither the name of the Eclipse Foundation, Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-javassist.txt b/hugegraph-dist/release-docs/licenses/LICENSE-javassist.txt new file mode 100644 index 0000000000..67a92303ff --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-javassist.txt @@ -0,0 +1,381 @@ + + +Javassist License + + + + +
MOZILLA PUBLIC LICENSE
Version +1.1 +

+


+
+

1. Definitions. +

    1.0.1. "Commercial Use" means distribution or otherwise making the + Covered Code available to a third party. +

    1.1. ''Contributor'' means each entity that creates or contributes + to the creation of Modifications. +

    1.2. ''Contributor Version'' means the combination of the Original + Code, prior Modifications used by a Contributor, and the Modifications made by + that particular Contributor. +

    1.3. ''Covered Code'' means the Original Code or Modifications or + the combination of the Original Code and Modifications, in each case including + portions thereof. +

    1.4. ''Electronic Distribution Mechanism'' means a mechanism + generally accepted in the software development community for the electronic + transfer of data. +

    1.5. ''Executable'' means Covered Code in any form other than Source + Code. +

    1.6. ''Initial Developer'' means the individual or entity identified + as the Initial Developer in the Source Code notice required by Exhibit + A. +

    1.7. ''Larger Work'' means a work which combines Covered Code or + portions thereof with code not governed by the terms of this License. +

    1.8. ''License'' means this document. +

    1.8.1. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or subsequently + acquired, any and all of the rights conveyed herein. +

    1.9. ''Modifications'' means any addition to or deletion from the + substance or structure of either the Original Code or any previous + Modifications. When Covered Code is released as a series of files, a + Modification is: +

      A. Any addition to or deletion from the contents of a file + containing Original Code or previous Modifications. +

      B. Any new file that contains any part of the Original Code or + previous Modifications.
       

    1.10. ''Original Code'' + means Source Code of computer software code which is described in the Source + Code notice required by Exhibit A as Original Code, and which, at the + time of its release under this License is not already Covered Code governed by + this License. +

    1.10.1. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation,  method, process, and + apparatus claims, in any patent Licensable by grantor. +

    1.11. ''Source Code'' means the preferred form of the Covered Code + for making modifications to it, including all modules it contains, plus any + associated interface definition files, scripts used to control compilation and + installation of an Executable, or source code differential comparisons against + either the Original Code or another well known, available Covered Code of the + Contributor's choice. The Source Code can be in a compressed or archival form, + provided the appropriate decompression or de-archiving software is widely + available for no charge. +

    1.12. "You'' (or "Your")  means an individual or a legal entity + exercising rights under, and complying with all of the terms of, this License + or a future version of this License issued under Section 6.1. For legal + entities, "You'' includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this definition, "control'' + means (a) the power, direct or indirect, to cause the direction or management + of such entity, whether by contract or otherwise, or (b) ownership of more + than fifty percent (50%) of the outstanding shares or beneficial ownership of + such entity.

2. Source Code License. +
    2.1. The Initial Developer Grant.
    The Initial Developer hereby + grants You a world-wide, royalty-free, non-exclusive license, subject to third + party intellectual property claims: +
      (a)  under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer to use, reproduce, + modify, display, perform, sublicense and distribute the Original Code (or + portions thereof) with or without Modifications, and/or as part of a Larger + Work; and +

      (b) under Patents Claims infringed by the making, using or selling + of Original Code, to make, have made, use, practice, sell, and offer for + sale, and/or otherwise dispose of the Original Code (or portions thereof). +

        +
        (c) the licenses granted in this Section 2.1(a) and (b) + are effective on the date Initial Developer first distributes Original Code + under the terms of this License. +

        (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: 1) for code that You delete from the Original Code; 2) separate + from the Original Code;  or 3) for infringements caused by: i) the + modification of the Original Code or ii) the combination of the Original + Code with other software or devices.
         

      2.2. Contributor + Grant.
      Subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, non-exclusive + license +

        (a)  under intellectual property rights (other + than patent or trademark) Licensable by Contributor, to use, reproduce, + modify, display, perform, sublicense and distribute the Modifications + created by such Contributor (or portions thereof) either on an unmodified + basis, with other Modifications, as Covered Code and/or as part of a Larger + Work; and +

        (b) under Patent Claims infringed by the making, using, or selling + of  Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, have made, and/or + otherwise dispose of: 1) Modifications made by that Contributor (or portions + thereof); and 2) the combination of  Modifications made by that + Contributor with its Contributor Version (or portions of such + combination). +

        (c) the licenses granted in Sections 2.2(a) and 2.2(b) are + effective on the date Contributor first makes Commercial Use of the Covered + Code. +

        (d)    Notwithstanding Section 2.2(b) above, no + patent license is granted: 1) for any code that Contributor has deleted from + the Contributor Version; 2)  separate from the Contributor + Version;  3)  for infringements caused by: i) third party + modifications of Contributor Version or ii)  the combination of + Modifications made by that Contributor with other software  (except as + part of the Contributor Version) or other devices; or 4) under Patent Claims + infringed by Covered Code in the absence of Modifications made by that + Contributor.

    +


    3. Distribution Obligations. +

      3.1. Application of License.
      The Modifications which You create + or to which You contribute are governed by the terms of this License, + including without limitation Section 2.2. The Source Code version of + Covered Code may be distributed only under the terms of this License or a + future version of this License released under Section 6.1, and You must + include a copy of this License with every copy of the Source Code You + distribute. You may not offer or impose any terms on any Source Code version + that alters or restricts the applicable version of this License or the + recipients' rights hereunder. However, You may include an additional document + offering the additional rights described in Section 3.5. +

      3.2. Availability of Source Code.
      Any Modification which You + create or to which You contribute must be made available in Source Code form + under the terms of this License either on the same media as an Executable + version or via an accepted Electronic Distribution Mechanism to anyone to whom + you made an Executable version available; and if made available via Electronic + Distribution Mechanism, must remain available for at least twelve (12) months + after the date it initially became available, or at least six (6) months after + a subsequent version of that particular Modification has been made available + to such recipients. You are responsible for ensuring that the Source Code + version remains available even if the Electronic Distribution Mechanism is + maintained by a third party. +

      3.3. Description of Modifications.
      You must cause all Covered + Code to which You contribute to contain a file documenting the changes You + made to create that Covered Code and the date of any change. You must include + a prominent statement that the Modification is derived, directly or + indirectly, from Original Code provided by the Initial Developer and including + the name of the Initial Developer in (a) the Source Code, and (b) in any + notice in an Executable version or related documentation in which You describe + the origin or ownership of the Covered Code. +

      3.4. Intellectual Property Matters +

        (a) Third Party Claims.
        If Contributor has knowledge that a + license under a third party's intellectual property rights is required to + exercise the rights granted by such Contributor under Sections 2.1 or 2.2, + Contributor must include a text file with the Source Code distribution + titled "LEGAL'' which describes the claim and the party making the claim in + sufficient detail that a recipient will know whom to contact. If Contributor + obtains such knowledge after the Modification is made available as described + in Section 3.2, Contributor shall promptly modify the LEGAL file in all + copies Contributor makes available thereafter and shall take other steps + (such as notifying appropriate mailing lists or newsgroups) reasonably + calculated to inform those who received the Covered Code that new knowledge + has been obtained. +

        (b) Contributor APIs.
        If Contributor's Modifications include + an application programming interface and Contributor has knowledge of patent + licenses which are reasonably necessary to implement that API, Contributor + must also include this information in the LEGAL file. +
         

                + (c)    Representations. +
        Contributor represents that, except as disclosed pursuant to Section + 3.4(a) above, Contributor believes that Contributor's Modifications are + Contributor's original creation(s) and/or Contributor has sufficient rights + to grant the rights conveyed by this License.
      +


      3.5. Required Notices.
      You must duplicate the notice in + Exhibit A in each file of the Source Code.  If it is not possible + to put such notice in a particular Source Code file due to its structure, then + You must include such notice in a location (such as a relevant directory) + where a user would be likely to look for such a notice.  If You created + one or more Modification(s) You may add your name as a Contributor to the + notice described in Exhibit A.  You must also duplicate this + License in any documentation for the Source Code where You describe + recipients' rights or ownership rights relating to Covered Code.  You may + choose to offer, and to charge a fee for, warranty, support, indemnity or + liability obligations to one or more recipients of Covered Code. However, You + may do so only on Your own behalf, and not on behalf of the Initial Developer + or any Contributor. You must make it absolutely clear than any such warranty, + support, indemnity or liability obligation is offered by You alone, and You + hereby agree to indemnify the Initial Developer and every Contributor for any + liability incurred by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. +

      3.6. Distribution of Executable Versions.
      You may distribute + Covered Code in Executable form only if the requirements of Section + 3.1-3.5 have been met for that Covered Code, and if You include a + notice stating that the Source Code version of the Covered Code is available + under the terms of this License, including a description of how and where You + have fulfilled the obligations of Section 3.2. The notice must be + conspicuously included in any notice in an Executable version, related + documentation or collateral in which You describe recipients' rights relating + to the Covered Code. You may distribute the Executable version of Covered Code + or ownership rights under a license of Your choice, which may contain terms + different from this License, provided that You are in compliance with the + terms of this License and that the license for the Executable version does not + attempt to limit or alter the recipient's rights in the Source Code version + from the rights set forth in this License. If You distribute the Executable + version under a different license You must make it absolutely clear that any + terms which differ from this License are offered by You alone, not by the + Initial Developer or any Contributor. You hereby agree to indemnify the + Initial Developer and every Contributor for any liability incurred by the + Initial Developer or such Contributor as a result of any such terms You offer. + +

      3.7. Larger Works.
      You may create a Larger Work by combining + Covered Code with other code not governed by the terms of this License and + distribute the Larger Work as a single product. In such a case, You must make + sure the requirements of this License are fulfilled for the Covered +Code.

    4. Inability to Comply Due to Statute or Regulation. +
      If it is impossible for You to comply with any of the terms of this + License with respect to some or all of the Covered Code due to statute, + judicial order, or regulation then You must: (a) comply with the terms of this + License to the maximum extent possible; and (b) describe the limitations and + the code they affect. Such description must be included in the LEGAL file + described in Section 3.4 and must be included with all distributions of + the Source Code. Except to the extent prohibited by statute or regulation, + such description must be sufficiently detailed for a recipient of ordinary + skill to be able to understand it.
    5. Application of this License. +
      This License applies to code to which the Initial Developer has attached + the notice in Exhibit A and to related Covered Code.
    6. Versions +of the License. +
      6.1. New Versions.
      Netscape Communications Corporation + (''Netscape'') may publish revised and/or new versions of the License from + time to time. Each version will be given a distinguishing version number. +

      6.2. Effect of New Versions.
      Once Covered Code has been + published under a particular version of the License, You may always continue + to use it under the terms of that version. You may also choose to use such + Covered Code under the terms of any subsequent version of the License + published by Netscape. No one other than Netscape has the right to modify the + terms applicable to Covered Code created under this License. +

      6.3. Derivative Works.
      If You create or use a modified version + of this License (which you may only do in order to apply it to code which is + not already Covered Code governed by this License), You must (a) rename Your + license so that the phrases ''Mozilla'', ''MOZILLAPL'', ''MOZPL'', + ''Netscape'', "MPL", ''NPL'' or any confusingly similar phrase do not appear + in your license (except to note that your license differs from this License) + and (b) otherwise make it clear that Your version of the license contains + terms which differ from the Mozilla Public License and Netscape Public + License. (Filling in the name of the Initial Developer, Original Code or + Contributor in the notice described in Exhibit A shall not of + themselves be deemed to be modifications of this License.)

    7. +DISCLAIMER OF WARRANTY. +
      COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS'' BASIS, WITHOUT + WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT + LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, + FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE + QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED + CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY + OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR + CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS + LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER.
    8. TERMINATION. +
      8.1.  This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms herein and fail to + cure such breach within 30 days of becoming aware of the breach. All + sublicenses to the Covered Code which are properly granted shall survive any + termination of this License. Provisions which, by their nature, must remain in + effect beyond the termination of this License shall survive. +

      8.2.  If You initiate litigation by asserting a patent + infringement claim (excluding declatory judgment actions) against Initial + Developer or a Contributor (the Initial Developer or Contributor against whom + You file such action is referred to as "Participant")  alleging that: +

      (a)  such Participant's Contributor Version directly or + indirectly infringes any patent, then any and all rights granted by such + Participant to You under Sections 2.1 and/or 2.2 of this License shall, upon + 60 days notice from Participant terminate prospectively, unless if within 60 + days after receipt of notice You either: (i)  agree in writing to pay + Participant a mutually agreeable reasonable royalty for Your past and future + use of Modifications made by such Participant, or (ii) withdraw Your + litigation claim with respect to the Contributor Version against such + Participant.  If within 60 days of notice, a reasonable royalty and + payment arrangement are not mutually agreed upon in writing by the parties or + the litigation claim is not withdrawn, the rights granted by Participant to + You under Sections 2.1 and/or 2.2 automatically terminate at the expiration of + the 60 day notice period specified above. +

      (b)  any software, hardware, or device, other than such + Participant's Contributor Version, directly or indirectly infringes any + patent, then any rights granted to You by such Participant under Sections + 2.1(b) and 2.2(b) are revoked effective as of the date You first made, used, + sold, distributed, or had made, Modifications made by that Participant. +

      8.3.  If You assert a patent infringement claim against + Participant alleging that such Participant's Contributor Version directly or + indirectly infringes any patent where such claim is resolved (such as by + license or settlement) prior to the initiation of patent infringement + litigation, then the reasonable value of the licenses granted by such + Participant under Sections 2.1 or 2.2 shall be taken into account in + determining the amount or value of any payment or license. +

      8.4.  In the event of termination under Sections 8.1 or 8.2 + above,  all end user license agreements (excluding distributors and + resellers) which have been validly granted by You or any distributor hereunder + prior to termination shall survive termination.

    9. LIMITATION OF +LIABILITY. +
      UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING + NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY + OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY + OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, + INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR + MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH + PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS + LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW + PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR + LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND + LIMITATION MAY NOT APPLY TO YOU.
    10. U.S. GOVERNMENT END USERS. +
      The Covered Code is a ''commercial item,'' as that term is defined in 48 + C.F.R. 2.101 (Oct. 1995), consisting of ''commercial computer software'' and + ''commercial computer software documentation,'' as such terms are used in 48 + C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. + 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Code with only those rights set forth herein.
    11. +MISCELLANEOUS. +
      This License represents the complete agreement concerning subject matter + hereof. If any provision of this License is held to be unenforceable, such + provision shall be reformed only to the extent necessary to make it + enforceable. This License shall be governed by California law provisions + (except to the extent applicable law, if any, provides otherwise), excluding + its conflict-of-law provisions. With respect to disputes in which at least one + party is a citizen of, or an entity chartered or registered to do business in + the United States of America, any litigation relating to this License shall be + subject to the jurisdiction of the Federal Courts of the Northern District of + California, with venue lying in Santa Clara County, California, with the + losing party responsible for costs, including without limitation, court costs + and reasonable attorneys' fees and expenses. The application of the United + Nations Convention on Contracts for the International Sale of Goods is + expressly excluded. Any law or regulation which provides that the language of + a contract shall be construed against the drafter shall not apply to this + License.
    12. RESPONSIBILITY FOR CLAIMS. +
      As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or indirectly, out of its + utilization of rights under this License and You agree to work with Initial + Developer and Contributors to distribute such responsibility on an equitable + basis. Nothing herein is intended or shall be deemed to constitute any + admission of liability.
    13. MULTIPLE-LICENSED CODE. +
      Initial Developer may designate portions of the Covered Code as + "Multiple-Licensed".  "Multiple-Licensed" means that the Initial + Developer permits you to utilize portions of the Covered Code under Your + choice of the MPL or the alternative licenses, if any, specified by the + Initial Developer in the file described in Exhibit A.
    +


    EXHIBIT A -Mozilla Public License. +

      The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ +

      Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + for the specific language governing rights and limitations under the + License. +

      The Original Code is Javassist. +

      The Initial Developer of the Original Code is Shigeru Chiba. + Portions created by the Initial Developer are
        + Copyright (C) 1999- Shigeru Chiba. All Rights Reserved. +

      Contributor(s): __Bill Burke, Jason T. Greene______________. + +

      Alternatively, the contents of this software may be used under the +terms of the GNU Lesser General Public License Version 2.1 or later +(the "LGPL"), or the Apache License Version 2.0 (the "AL"), +in which case the provisions of the LGPL or the AL are applicable +instead of those above. If you wish to allow use of your version of +this software only under the terms of either the LGPL or the AL, and not to allow others to +use your version of this software under the terms of the MPL, indicate +your decision by deleting the provisions above and replace them with +the notice and other provisions required by the LGPL or the AL. If you do not +delete the provisions above, a recipient may use your version of this +software under the terms of any one of the MPL, the LGPL or the AL.

      + +

      If you obtain this software as part of JBoss, + the contents of this software may be used under only the terms of the LGPL. + To use them under the MPL, you must obtain a separate package including only + Javassist but not the other part of JBoss.

      + +

      All the contributors to the original source tree have agreed to the original + license term described above.

      + +

    + + \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-javax.activation-api-1.2.0-sources.txt b/hugegraph-dist/release-docs/licenses/LICENSE-javax.activation-api-1.2.0-sources.txt new file mode 100644 index 0000000000..859071326e --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-javax.activation-api-1.2.0-sources.txt @@ -0,0 +1,759 @@ +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1 + +1. Definitions. + + 1.1. "Contributor" means each individual or entity that creates or + contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original + Software, prior Modifications used by a Contributor (if any), and + the Modifications made by that particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or (b) + Modifications, or (c) the combination of files containing Original + Software with files containing Modifications, in each case including + portions thereof. + + 1.4. "Executable" means the Covered Software in any form other than + Source Code. + + 1.5. "Initial Developer" means the individual or entity that first + makes Original Software available under this License. + + 1.6. "Larger Work" means a work which combines Covered Software or + portions thereof with code not governed by the terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable form of + any of the following: + + A. Any file that results from an addition to, deletion from or + modification of the contents of a file containing Original Software + or previous Modifications; + + B. Any new file that contains any part of the Original Software or + previous Modification; or + + C. Any new file that is contributed or otherwise made available + under the terms of this License. + + 1.10. "Original Software" means the Source Code and Executable form + of computer software code that is originally released under this + License. + + 1.11. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, process, + and apparatus claims, in any patent Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer software + code in which modifications are made and (b) associated + documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms of, + this License. For legal entities, "You" includes any entity which + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and subject + to third party intellectual property claims, the Initial Developer + hereby grants You a world-wide, royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer, to use, reproduce, + modify, display, perform, sublicense and distribute the Original + Software (or portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using or selling of + Original Software, to make, have made, use, practice, sell, and + offer for sale, and/or otherwise dispose of the Original Software + (or portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) are effective on + the date Initial Developer first distributes or otherwise makes the + Original Software available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: (1) for code that You delete from the Original Software, or + (2) for infringements caused by: (i) the modification of the + Original Software, or (ii) the combination of the Original Software + with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and subject + to third party intellectual property claims, each Contributor hereby + grants You a world-wide, royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor to use, reproduce, modify, + display, perform, sublicense and distribute the Modifications + created by such Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as Covered Software + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling + of Modifications made by that Contributor either alone and/or in + combination with its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, have made, and/or + otherwise dispose of: (1) Modifications made by that Contributor (or + portions thereof); and (2) the combination of Modifications made by + that Contributor with its Contributor Version (or portions of such + combination). + + (c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective + on the date Contributor first distributes or otherwise makes the + Modifications available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: (1) for any code that Contributor has deleted from the + Contributor Version; (2) for infringements caused by: (i) third + party modifications of Contributor Version, or (ii) the combination + of Modifications made by that Contributor with other software + (except as part of the Contributor Version) or other devices; or (3) + under Patent Claims infringed by Covered Software in the absence of + Modifications made by that Contributor. + +3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make available + in Executable form must also be made available in Source Code form + and that Source Code form must be distributed only under the terms + of this License. You must include a copy of this License with every + copy of the Source Code form of the Covered Software You distribute + or otherwise make available. You must inform recipients of any such + Covered Software in Executable form as to how they can obtain such + Covered Software in Source Code form in a reasonable manner on or + through a medium customarily used for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You contribute are + governed by the terms of this License. You represent that You + believe Your Modifications are Your original creation(s) and/or You + have sufficient rights to grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications that + identifies You as the Contributor of the Modification. You may not + remove or alter any copyright, patent or trademark notices contained + within the Covered Software, or any notices of licensing or any + descriptive text giving attribution to any Contributor or the + Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered Software in + Source Code form that alters or restricts the applicable version of + this License or the recipients' rights hereunder. You may choose to + offer, and to charge a fee for, warranty, support, indemnity or + liability obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on behalf of + the Initial Developer or any Contributor. You must make it + absolutely clear that any such warranty, support, indemnity or + liability obligation is offered by You alone, and You hereby agree + to indemnify the Initial Developer and every Contributor for any + liability incurred by the Initial Developer or such Contributor as a + result of warranty, support, indemnity or liability terms You offer. + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered Software under + the terms of this License or under the terms of a license of Your + choice, which may contain terms different from this License, + provided that You are in compliance with the terms of this License + and that the license for the Executable form does not attempt to + limit or alter the recipient's rights in the Source Code form from + the rights set forth in this License. If You distribute the Covered + Software in Executable form under a different license, You must make + it absolutely clear that any terms which differ from this License + are offered by You alone, not by the Initial Developer or + Contributor. You hereby agree to indemnify the Initial Developer and + every Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software with + other code not governed by the terms of this License and distribute + the Larger Work as a single product. In such a case, You must make + sure the requirements of this License are fulfilled for the Covered + Software. + +4. Versions of the License. + + 4.1. New Versions. + + Oracle is the initial license steward and may publish revised and/or + new versions of this License from time to time. Each version will be + given a distinguishing version number. Except as provided in Section + 4.3, no one other than the license steward has the right to modify + this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise make the + Covered Software available under the terms of the version of the + License under which You originally received the Covered Software. If + the Initial Developer includes a notice in the Original Software + prohibiting it from being distributed or otherwise made available + under any subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the version + of the License under which You originally received the Covered + Software. Otherwise, You may also choose to use, distribute or + otherwise make the Covered Software available under the terms of any + subsequent version of the License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a new + license for Your Original Software, You may create and use a + modified version of this License if You: (a) rename the license and + remove any references to the name of the license steward (except to + note that the license differs from this License); and (b) otherwise + make it clear that the license contains terms which differ from this + License. + +5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE + IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR + NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF + THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE + DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY + OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, + REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN + ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS + AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +6. TERMINATION. + + 6.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to + cure such breach within 30 days of becoming aware of the breach. + Provisions which, by their nature, must remain in effect beyond the + termination of this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or a + Contributor (the Initial Developer or Contributor against whom You + assert such claim is referred to as "Participant") alleging that the + Participant Software (meaning the Contributor Version where the + Participant is a Contributor or the Original Software where the + Participant is the Initial Developer) directly or indirectly + infringes any patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial Developer (if the + Initial Developer is not the Participant) and all Contributors under + Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice + from Participant terminate prospectively and automatically at the + expiration of such 60 day notice period, unless if within such 60 + day period You withdraw Your claim with respect to the Participant + Software against such Participant either unilaterally or pursuant to + a written agreement with Participant. + + 6.3. If You assert a patent infringement claim against Participant + alleging that the Participant Software directly or indirectly + infringes any patent where such claim is resolved (such as by + license or settlement) prior to the initiation of patent + infringement litigation, then the reasonable value of the licenses + granted by such Participant under Sections 2.1 or 2.2 shall be taken + into account in determining the amount or value of any payment or + license. + + 6.4. In the event of termination under Sections 6.1 or 6.2 above, + all end user licenses that have been validly granted by You or any + distributor hereunder prior to termination (excluding licenses + granted to You by any distributor) shall survive termination. + +7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE + TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER + FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR + LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE + POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT + APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH + PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH + LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR + LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION + AND LIMITATION MAY NOT APPLY TO YOU. + +8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is defined + in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer + software" (as that term is defined at 48 C.F.R. � + 252.227-7014(a)(1)) and "commercial computer software documentation" + as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent + with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 + (June 1995), all U.S. Government End Users acquire Covered Software + with only those rights set forth herein. This U.S. Government Rights + clause is in lieu of, and supersedes, any other FAR, DFAR, or other + clause or provision that addresses Government rights in computer + software under this License. + +9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed by + the law of the jurisdiction specified in a notice contained within + the Original Software (except to the extent applicable law, if any, + provides otherwise), excluding such jurisdiction's conflict-of-law + provisions. Any litigation relating to this License shall be subject + to the jurisdiction of the courts located in the jurisdiction and + venue specified in a notice contained within the Original Software, + with the losing party responsible for costs, including, without + limitation, court costs and reasonable attorneys' fees and expenses. + The application of the United Nations Convention on Contracts for + the International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall be + construed against the drafter shall not apply to this License. You + agree that You alone are responsible for compliance with the United + States export administration regulations (and the export control + laws and regulation of any other countries) when You use, distribute + or otherwise make available any Covered Software. + +10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or indirectly, + out of its utilization of rights under this License and You agree to + work with Initial Developer and Contributors to distribute such + responsibility on an equitable basis. Nothing herein is intended or + shall be deemed to constitute any admission of liability. + +------------------------------------------------------------------------ + +NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION +LICENSE (CDDL) + +The code released under the CDDL shall be governed by the laws of the +State of California (excluding conflict-of-law provisions). Any +litigation relating to this License shall be subject to the jurisdiction +of the Federal Courts of the Northern District of California and the +state courts of the State of California, with venue lying in Santa Clara +County, California. + + + + The GNU General Public License (GPL) Version 2, June 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +51 Franklin Street, Fifth Floor +Boston, MA 02110-1335 +USA + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your freedom to +share and change it. By contrast, the GNU General Public License is +intended to guarantee your freedom to share and change free software--to +make sure the software is free for all its users. This General Public +License applies to most of the Free Software Foundation's software and +to any other program whose authors commit to using it. (Some other Free +Software Foundation software is covered by the GNU Library General +Public License instead.) You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. +Our General Public Licenses are designed to make sure that you have the +freedom to distribute copies of free software (and charge for this +service if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs; and that you know you can do these things. + +To protect your rights, we need to make restrictions that forbid anyone +to deny you these rights or to ask you to surrender the rights. These +restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis +or for a fee, you must give the recipients all the rights that you have. +You must make sure that they, too, receive or can get the source code. +And you must show them these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + +Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + +Finally, any free program is threatened constantly by software patents. +We wish to avoid the danger that redistributors of a free program will +individually obtain patent licenses, in effect making the program +proprietary. To prevent this, we have made it clear that any patent must +be licensed for everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and +modification follow. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License applies to any program or other work which contains a +notice placed by the copyright holder saying it may be distributed under +the terms of this General Public License. The "Program", below, refers +to any such program or work, and a "work based on the Program" means +either the Program or any derivative work under copyright law: that is +to say, a work containing the Program or a portion of it, either +verbatim or with modifications and/or translated into another language. +(Hereinafter, translation is included without limitation in the term +"modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of running +the Program is not restricted, and the output from the Program is +covered only if its contents constitute a work based on the Program +(independent of having been made by running the Program). Whether that +is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's source +code as you receive it, in any medium, provided that you conspicuously +and appropriately publish on each copy an appropriate copyright notice +and disclaimer of warranty; keep intact all the notices that refer to +this License and to the absence of any warranty; and give any other +recipients of the Program a copy of this License along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion of +it, thus forming a work based on the Program, and copy and distribute +such modifications or work under the terms of Section 1 above, provided +that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any part + thereof, to be licensed as a whole at no charge to all third parties + under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a notice + that there is no warranty (or else, saying that you provide a + warranty) and that users may redistribute the program under these + conditions, and telling the user how to view a copy of this License. + (Exception: if the Program itself is interactive but does not + normally print such an announcement, your work based on the Program + is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, and +can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based on +the Program, the distribution of the whole must be on the terms of this +License, whose permissions for other licensees extend to the entire +whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of a +storage or distribution medium does not bring the other work under the +scope of this License. + +3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections 1 + and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your cost + of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer to + distribute corresponding source code. (This alternative is allowed + only for noncommercial distribution and only if you received the + program in object code or executable form with such an offer, in + accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source code +means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to control +compilation and installation of the executable. However, as a special +exception, the source code distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies the +executable. + +If distribution of executable or object code is made by offering access +to copy from a designated place, then offering equivalent access to copy +the source code from the same place counts as distribution of the source +code, even though third parties are not compelled to copy the source +along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt otherwise +to copy, modify, sublicense or distribute the Program is void, and will +automatically terminate your rights under this License. However, parties +who have received copies, or rights, from you under this License will +not have their licenses terminated so long as such parties remain in +full compliance. + +5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and all +its terms and conditions for copying, distributing or modifying the +Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further restrictions +on the recipients' exercise of the rights granted herein. You are not +responsible for enforcing compliance by third parties to this License. + +7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot distribute +so as to satisfy simultaneously your obligations under this License and +any other pertinent obligations, then as a consequence you may not +distribute the Program at all. For example, if a patent license would +not permit royalty-free redistribution of the Program by all those who +receive copies directly or indirectly through you, then the only way you +could satisfy both it and this License would be to refrain entirely from +distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is implemented +by public license practices. Many people have made generous +contributions to the wide range of software distributed through that +system in reliance on consistent application of that system; it is up to +the author/donor to decide if he or she is willing to distribute +software through any other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be +a consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License may +add an explicit geographical distribution limitation excluding those +countries, so that distribution is permitted only in or among countries +not thus excluded. In such case, this License incorporates the +limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new +versions of the General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Program does not specify a version +number of this License, you may choose any version ever published by the +Free Software Foundation. + +10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the +author to ask for permission. For software which is copyrighted by the +Free Software Foundation, write to the Free Software Foundation; we +sometimes make exceptions for this. Our decision will be guided by the +two goals of preserving the free status of all derivatives of our free +software and of promoting the sharing and reuse of software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, +EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE +ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH +YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL +NECESSARY SERVICING, REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR +DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL +DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM +(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED +INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF +THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR +OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to +attach them to the start of each source file to most effectively convey +the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + One line to give the program's name and a brief idea of what it does. + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type + `show w'. This is free software, and you are welcome to redistribute + it under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the +appropriate parts of the General Public License. Of course, the commands +you use may be called something other than `show w' and `show c'; they +could even be mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + program `Gnomovision' (which makes passes at compilers) written by + James Hacker. + + signature of Ty Coon, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications +with the library. If this is what you want to do, use the GNU Library +General Public License instead of this License. + +# + +Certain source files distributed by Oracle America, Inc. and/or its +affiliates are subject to the following clarification and special +exception to the GPLv2, based on the GNU Project exception for its +Classpath libraries, known as the GNU Classpath Exception, but only +where Oracle has expressly included in the particular source file's +header the words "Oracle designates this particular file as subject to +the "Classpath" exception as provided by Oracle in the LICENSE file +that accompanied this code." + +You should also note that Oracle includes multiple, independent +programs in this software package. Some of those programs are provided +under licenses deemed incompatible with the GPLv2 by the Free Software +Foundation and others. For example, the package includes programs +licensed under the Apache License, Version 2.0. Such programs are +licensed to you under their original licenses. + +Oracle facilitates your further distribution of this package by adding +the Classpath Exception to the necessary parts of its GPLv2 code, which +permits you to use that code in combination with other independent +modules not licensed under the GPLv2. However, note that this would +not permit you to commingle code under an incompatible license with +Oracle's GPLv2 licensed code by, for example, cutting and pasting such +code into a file also containing Oracle's GPLv2 licensed code and then +distributing the result. Additionally, if you were to remove the +Classpath Exception from any of the files to which it applies and +distribute the result, you would likely be required to license some or +all of the other code in that distribution under the GPLv2 as well, and +since the GPLv2 is incompatible with the license terms of some items +included in the distribution by Oracle, removing the Classpath +Exception could therefore effectively compromise your ability to +further distribute the package. + +Proceed with caution and we recommend that you obtain the advice of a +lawyer skilled in open source matters before removing the Classpath +Exception or making modifications to this package which may +subsequently be redistributed and/or involve the use of third party +software. + +CLASSPATH EXCEPTION +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License version 2 cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from or +based on this library. If you modify this library, you may extend this +exception to your version of the library, but you are not obligated to +do so. If you do not wish to do so, delete this exception statement +from your version. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jaxb-ri.txt b/hugegraph-dist/release-docs/licenses/LICENSE-jaxb-ri.txt new file mode 100644 index 0000000000..74b62b6219 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-jaxb-ri.txt @@ -0,0 +1,11 @@ +Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +Neither the name of the Eclipse Foundation, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jersey.txt b/hugegraph-dist/release-docs/licenses/LICENSE-jersey.txt new file mode 100644 index 0000000000..9e9429fce4 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-jersey.txt @@ -0,0 +1,759 @@ +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1 + +1. Definitions. + + 1.1. "Contributor" means each individual or entity that creates or + contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original + Software, prior Modifications used by a Contributor (if any), and + the Modifications made by that particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or (b) + Modifications, or (c) the combination of files containing Original + Software with files containing Modifications, in each case including + portions thereof. + + 1.4. "Executable" means the Covered Software in any form other than + Source Code. + + 1.5. "Initial Developer" means the individual or entity that first + makes Original Software available under this License. + + 1.6. "Larger Work" means a work which combines Covered Software or + portions thereof with code not governed by the terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable form of + any of the following: + + A. Any file that results from an addition to, deletion from or + modification of the contents of a file containing Original Software + or previous Modifications; + + B. Any new file that contains any part of the Original Software or + previous Modification; or + + C. Any new file that is contributed or otherwise made available + under the terms of this License. + + 1.10. "Original Software" means the Source Code and Executable form + of computer software code that is originally released under this + License. + + 1.11. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, process, + and apparatus claims, in any patent Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer software + code in which modifications are made and (b) associated + documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms of, + this License. For legal entities, "You" includes any entity which + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and subject + to third party intellectual property claims, the Initial Developer + hereby grants You a world-wide, royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer, to use, reproduce, + modify, display, perform, sublicense and distribute the Original + Software (or portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using or selling of + Original Software, to make, have made, use, practice, sell, and + offer for sale, and/or otherwise dispose of the Original Software + (or portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) are effective on + the date Initial Developer first distributes or otherwise makes the + Original Software available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: (1) for code that You delete from the Original Software, or + (2) for infringements caused by: (i) the modification of the + Original Software, or (ii) the combination of the Original Software + with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and subject + to third party intellectual property claims, each Contributor hereby + grants You a world-wide, royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor to use, reproduce, modify, + display, perform, sublicense and distribute the Modifications + created by such Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as Covered Software + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling + of Modifications made by that Contributor either alone and/or in + combination with its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, have made, and/or + otherwise dispose of: (1) Modifications made by that Contributor (or + portions thereof); and (2) the combination of Modifications made by + that Contributor with its Contributor Version (or portions of such + combination). + + (c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective + on the date Contributor first distributes or otherwise makes the + Modifications available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: (1) for any code that Contributor has deleted from the + Contributor Version; (2) for infringements caused by: (i) third + party modifications of Contributor Version, or (ii) the combination + of Modifications made by that Contributor with other software + (except as part of the Contributor Version) or other devices; or (3) + under Patent Claims infringed by Covered Software in the absence of + Modifications made by that Contributor. + +3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make available + in Executable form must also be made available in Source Code form + and that Source Code form must be distributed only under the terms + of this License. You must include a copy of this License with every + copy of the Source Code form of the Covered Software You distribute + or otherwise make available. You must inform recipients of any such + Covered Software in Executable form as to how they can obtain such + Covered Software in Source Code form in a reasonable manner on or + through a medium customarily used for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You contribute are + governed by the terms of this License. You represent that You + believe Your Modifications are Your original creation(s) and/or You + have sufficient rights to grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications that + identifies You as the Contributor of the Modification. You may not + remove or alter any copyright, patent or trademark notices contained + within the Covered Software, or any notices of licensing or any + descriptive text giving attribution to any Contributor or the + Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered Software in + Source Code form that alters or restricts the applicable version of + this License or the recipients' rights hereunder. You may choose to + offer, and to charge a fee for, warranty, support, indemnity or + liability obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on behalf of + the Initial Developer or any Contributor. You must make it + absolutely clear that any such warranty, support, indemnity or + liability obligation is offered by You alone, and You hereby agree + to indemnify the Initial Developer and every Contributor for any + liability incurred by the Initial Developer or such Contributor as a + result of warranty, support, indemnity or liability terms You offer. + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered Software under + the terms of this License or under the terms of a license of Your + choice, which may contain terms different from this License, + provided that You are in compliance with the terms of this License + and that the license for the Executable form does not attempt to + limit or alter the recipient's rights in the Source Code form from + the rights set forth in this License. If You distribute the Covered + Software in Executable form under a different license, You must make + it absolutely clear that any terms which differ from this License + are offered by You alone, not by the Initial Developer or + Contributor. You hereby agree to indemnify the Initial Developer and + every Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software with + other code not governed by the terms of this License and distribute + the Larger Work as a single product. In such a case, You must make + sure the requirements of this License are fulfilled for the Covered + Software. + +4. Versions of the License. + + 4.1. New Versions. + + Oracle is the initial license steward and may publish revised and/or + new versions of this License from time to time. Each version will be + given a distinguishing version number. Except as provided in Section + 4.3, no one other than the license steward has the right to modify + this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise make the + Covered Software available under the terms of the version of the + License under which You originally received the Covered Software. If + the Initial Developer includes a notice in the Original Software + prohibiting it from being distributed or otherwise made available + under any subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the version + of the License under which You originally received the Covered + Software. Otherwise, You may also choose to use, distribute or + otherwise make the Covered Software available under the terms of any + subsequent version of the License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a new + license for Your Original Software, You may create and use a + modified version of this License if You: (a) rename the license and + remove any references to the name of the license steward (except to + note that the license differs from this License); and (b) otherwise + make it clear that the license contains terms which differ from this + License. + +5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE + IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR + NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF + THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE + DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY + OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, + REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN + ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS + AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +6. TERMINATION. + + 6.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to + cure such breach within 30 days of becoming aware of the breach. + Provisions which, by their nature, must remain in effect beyond the + termination of this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or a + Contributor (the Initial Developer or Contributor against whom You + assert such claim is referred to as "Participant") alleging that the + Participant Software (meaning the Contributor Version where the + Participant is a Contributor or the Original Software where the + Participant is the Initial Developer) directly or indirectly + infringes any patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial Developer (if the + Initial Developer is not the Participant) and all Contributors under + Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice + from Participant terminate prospectively and automatically at the + expiration of such 60 day notice period, unless if within such 60 + day period You withdraw Your claim with respect to the Participant + Software against such Participant either unilaterally or pursuant to + a written agreement with Participant. + + 6.3. If You assert a patent infringement claim against Participant + alleging that the Participant Software directly or indirectly + infringes any patent where such claim is resolved (such as by + license or settlement) prior to the initiation of patent + infringement litigation, then the reasonable value of the licenses + granted by such Participant under Sections 2.1 or 2.2 shall be taken + into account in determining the amount or value of any payment or + license. + + 6.4. In the event of termination under Sections 6.1 or 6.2 above, + all end user licenses that have been validly granted by You or any + distributor hereunder prior to termination (excluding licenses + granted to You by any distributor) shall survive termination. + +7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE + TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER + FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR + LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE + POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT + APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH + PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH + LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR + LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION + AND LIMITATION MAY NOT APPLY TO YOU. + +8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is defined + in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer + software" (as that term is defined at 48 C.F.R. ß + 252.227-7014(a)(1)) and "commercial computer software documentation" + as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent + with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 + (June 1995), all U.S. Government End Users acquire Covered Software + with only those rights set forth herein. This U.S. Government Rights + clause is in lieu of, and supersedes, any other FAR, DFAR, or other + clause or provision that addresses Government rights in computer + software under this License. + +9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed by + the law of the jurisdiction specified in a notice contained within + the Original Software (except to the extent applicable law, if any, + provides otherwise), excluding such jurisdiction's conflict-of-law + provisions. Any litigation relating to this License shall be subject + to the jurisdiction of the courts located in the jurisdiction and + venue specified in a notice contained within the Original Software, + with the losing party responsible for costs, including, without + limitation, court costs and reasonable attorneys' fees and expenses. + The application of the United Nations Convention on Contracts for + the International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall be + construed against the drafter shall not apply to this License. You + agree that You alone are responsible for compliance with the United + States export administration regulations (and the export control + laws and regulation of any other countries) when You use, distribute + or otherwise make available any Covered Software. + +10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or indirectly, + out of its utilization of rights under this License and You agree to + work with Initial Developer and Contributors to distribute such + responsibility on an equitable basis. Nothing herein is intended or + shall be deemed to constitute any admission of liability. + +------------------------------------------------------------------------ + +NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION +LICENSE (CDDL) + +The code released under the CDDL shall be governed by the laws of the +State of California (excluding conflict-of-law provisions). Any +litigation relating to this License shall be subject to the jurisdiction +of the Federal Courts of the Northern District of California and the +state courts of the State of California, with venue lying in Santa Clara +County, California. + + + + The GNU General Public License (GPL) Version 2, June 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +51 Franklin Street, Fifth Floor +Boston, MA 02110-1335 +USA + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your freedom to +share and change it. By contrast, the GNU General Public License is +intended to guarantee your freedom to share and change free software--to +make sure the software is free for all its users. This General Public +License applies to most of the Free Software Foundation's software and +to any other program whose authors commit to using it. (Some other Free +Software Foundation software is covered by the GNU Library General +Public License instead.) You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. +Our General Public Licenses are designed to make sure that you have the +freedom to distribute copies of free software (and charge for this +service if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs; and that you know you can do these things. + +To protect your rights, we need to make restrictions that forbid anyone +to deny you these rights or to ask you to surrender the rights. These +restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis +or for a fee, you must give the recipients all the rights that you have. +You must make sure that they, too, receive or can get the source code. +And you must show them these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + +Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + +Finally, any free program is threatened constantly by software patents. +We wish to avoid the danger that redistributors of a free program will +individually obtain patent licenses, in effect making the program +proprietary. To prevent this, we have made it clear that any patent must +be licensed for everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and +modification follow. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License applies to any program or other work which contains a +notice placed by the copyright holder saying it may be distributed under +the terms of this General Public License. The "Program", below, refers +to any such program or work, and a "work based on the Program" means +either the Program or any derivative work under copyright law: that is +to say, a work containing the Program or a portion of it, either +verbatim or with modifications and/or translated into another language. +(Hereinafter, translation is included without limitation in the term +"modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of running +the Program is not restricted, and the output from the Program is +covered only if its contents constitute a work based on the Program +(independent of having been made by running the Program). Whether that +is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's source +code as you receive it, in any medium, provided that you conspicuously +and appropriately publish on each copy an appropriate copyright notice +and disclaimer of warranty; keep intact all the notices that refer to +this License and to the absence of any warranty; and give any other +recipients of the Program a copy of this License along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion of +it, thus forming a work based on the Program, and copy and distribute +such modifications or work under the terms of Section 1 above, provided +that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any part + thereof, to be licensed as a whole at no charge to all third parties + under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a notice + that there is no warranty (or else, saying that you provide a + warranty) and that users may redistribute the program under these + conditions, and telling the user how to view a copy of this License. + (Exception: if the Program itself is interactive but does not + normally print such an announcement, your work based on the Program + is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, and +can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based on +the Program, the distribution of the whole must be on the terms of this +License, whose permissions for other licensees extend to the entire +whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of a +storage or distribution medium does not bring the other work under the +scope of this License. + +3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections 1 + and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your cost + of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer to + distribute corresponding source code. (This alternative is allowed + only for noncommercial distribution and only if you received the + program in object code or executable form with such an offer, in + accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source code +means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to control +compilation and installation of the executable. However, as a special +exception, the source code distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies the +executable. + +If distribution of executable or object code is made by offering access +to copy from a designated place, then offering equivalent access to copy +the source code from the same place counts as distribution of the source +code, even though third parties are not compelled to copy the source +along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt otherwise +to copy, modify, sublicense or distribute the Program is void, and will +automatically terminate your rights under this License. However, parties +who have received copies, or rights, from you under this License will +not have their licenses terminated so long as such parties remain in +full compliance. + +5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and all +its terms and conditions for copying, distributing or modifying the +Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further restrictions +on the recipients' exercise of the rights granted herein. You are not +responsible for enforcing compliance by third parties to this License. + +7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot distribute +so as to satisfy simultaneously your obligations under this License and +any other pertinent obligations, then as a consequence you may not +distribute the Program at all. For example, if a patent license would +not permit royalty-free redistribution of the Program by all those who +receive copies directly or indirectly through you, then the only way you +could satisfy both it and this License would be to refrain entirely from +distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is implemented +by public license practices. Many people have made generous +contributions to the wide range of software distributed through that +system in reliance on consistent application of that system; it is up to +the author/donor to decide if he or she is willing to distribute +software through any other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be +a consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License may +add an explicit geographical distribution limitation excluding those +countries, so that distribution is permitted only in or among countries +not thus excluded. In such case, this License incorporates the +limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new +versions of the General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Program does not specify a version +number of this License, you may choose any version ever published by the +Free Software Foundation. + +10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the +author to ask for permission. For software which is copyrighted by the +Free Software Foundation, write to the Free Software Foundation; we +sometimes make exceptions for this. Our decision will be guided by the +two goals of preserving the free status of all derivatives of our free +software and of promoting the sharing and reuse of software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, +EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE +ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH +YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL +NECESSARY SERVICING, REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR +DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL +DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM +(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED +INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF +THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR +OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to +attach them to the start of each source file to most effectively convey +the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + One line to give the program's name and a brief idea of what it does. + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type + `show w'. This is free software, and you are welcome to redistribute + it under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the +appropriate parts of the General Public License. Of course, the commands +you use may be called something other than `show w' and `show c'; they +could even be mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + program `Gnomovision' (which makes passes at compilers) written by + James Hacker. + + signature of Ty Coon, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications +with the library. If this is what you want to do, use the GNU Library +General Public License instead of this License. + +# + +Certain source files distributed by Oracle America, Inc. and/or its +affiliates are subject to the following clarification and special +exception to the GPLv2, based on the GNU Project exception for its +Classpath libraries, known as the GNU Classpath Exception, but only +where Oracle has expressly included in the particular source file's +header the words "Oracle designates this particular file as subject to +the "Classpath" exception as provided by Oracle in the LICENSE file +that accompanied this code." + +You should also note that Oracle includes multiple, independent +programs in this software package. Some of those programs are provided +under licenses deemed incompatible with the GPLv2 by the Free Software +Foundation and others. For example, the package includes programs +licensed under the Apache License, Version 2.0. Such programs are +licensed to you under their original licenses. + +Oracle facilitates your further distribution of this package by adding +the Classpath Exception to the necessary parts of its GPLv2 code, which +permits you to use that code in combination with other independent +modules not licensed under the GPLv2. However, note that this would +not permit you to commingle code under an incompatible license with +Oracle's GPLv2 licensed code by, for example, cutting and pasting such +code into a file also containing Oracle's GPLv2 licensed code and then +distributing the result. Additionally, if you were to remove the +Classpath Exception from any of the files to which it applies and +distribute the result, you would likely be required to license some or +all of the other code in that distribution under the GPLv2 as well, and +since the GPLv2 is incompatible with the license terms of some items +included in the distribution by Oracle, removing the Classpath +Exception could therefore effectively compromise your ability to +further distribute the package. + +Proceed with caution and we recommend that you obtain the advice of a +lawyer skilled in open source matters before removing the Classpath +Exception or making modifications to this package which may +subsequently be redistributed and/or involve the use of third party +software. + +CLASSPATH EXCEPTION +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License version 2 cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from or +based on this library. If you modify this library, you may extend this +exception to your version of the library, but you are not obligated to +do so. If you do not wish to do so, delete this exception statement +from your version. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-joda-time.txt b/hugegraph-dist/release-docs/licenses/LICENSE-joda-time.txt new file mode 100644 index 0000000000..7a4a3ea242 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-joda-time.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jsonp.txt b/hugegraph-dist/release-docs/licenses/LICENSE-jsonp.txt new file mode 100644 index 0000000000..68076ad96b --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-jsonp.txt @@ -0,0 +1,759 @@ +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1 + +1. Definitions. + + 1.1. "Contributor" means each individual or entity that creates or + contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original + Software, prior Modifications used by a Contributor (if any), and + the Modifications made by that particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or (b) + Modifications, or (c) the combination of files containing Original + Software with files containing Modifications, in each case including + portions thereof. + + 1.4. "Executable" means the Covered Software in any form other than + Source Code. + + 1.5. "Initial Developer" means the individual or entity that first + makes Original Software available under this License. + + 1.6. "Larger Work" means a work which combines Covered Software or + portions thereof with code not governed by the terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable form of + any of the following: + + A. Any file that results from an addition to, deletion from or + modification of the contents of a file containing Original Software + or previous Modifications; + + B. Any new file that contains any part of the Original Software or + previous Modification; or + + C. Any new file that is contributed or otherwise made available + under the terms of this License. + + 1.10. "Original Software" means the Source Code and Executable form + of computer software code that is originally released under this + License. + + 1.11. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, process, + and apparatus claims, in any patent Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer software + code in which modifications are made and (b) associated + documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms of, + this License. For legal entities, "You" includes any entity which + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and subject + to third party intellectual property claims, the Initial Developer + hereby grants You a world-wide, royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer, to use, reproduce, + modify, display, perform, sublicense and distribute the Original + Software (or portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using or selling of + Original Software, to make, have made, use, practice, sell, and + offer for sale, and/or otherwise dispose of the Original Software + (or portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) are effective on + the date Initial Developer first distributes or otherwise makes the + Original Software available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: (1) for code that You delete from the Original Software, or + (2) for infringements caused by: (i) the modification of the + Original Software, or (ii) the combination of the Original Software + with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and subject + to third party intellectual property claims, each Contributor hereby + grants You a world-wide, royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor to use, reproduce, modify, + display, perform, sublicense and distribute the Modifications + created by such Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as Covered Software + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling + of Modifications made by that Contributor either alone and/or in + combination with its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, have made, and/or + otherwise dispose of: (1) Modifications made by that Contributor (or + portions thereof); and (2) the combination of Modifications made by + that Contributor with its Contributor Version (or portions of such + combination). + + (c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective + on the date Contributor first distributes or otherwise makes the + Modifications available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: (1) for any code that Contributor has deleted from the + Contributor Version; (2) for infringements caused by: (i) third + party modifications of Contributor Version, or (ii) the combination + of Modifications made by that Contributor with other software + (except as part of the Contributor Version) or other devices; or (3) + under Patent Claims infringed by Covered Software in the absence of + Modifications made by that Contributor. + +3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make available + in Executable form must also be made available in Source Code form + and that Source Code form must be distributed only under the terms + of this License. You must include a copy of this License with every + copy of the Source Code form of the Covered Software You distribute + or otherwise make available. You must inform recipients of any such + Covered Software in Executable form as to how they can obtain such + Covered Software in Source Code form in a reasonable manner on or + through a medium customarily used for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You contribute are + governed by the terms of this License. You represent that You + believe Your Modifications are Your original creation(s) and/or You + have sufficient rights to grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications that + identifies You as the Contributor of the Modification. You may not + remove or alter any copyright, patent or trademark notices contained + within the Covered Software, or any notices of licensing or any + descriptive text giving attribution to any Contributor or the + Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered Software in + Source Code form that alters or restricts the applicable version of + this License or the recipients' rights hereunder. You may choose to + offer, and to charge a fee for, warranty, support, indemnity or + liability obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on behalf of + the Initial Developer or any Contributor. You must make it + absolutely clear that any such warranty, support, indemnity or + liability obligation is offered by You alone, and You hereby agree + to indemnify the Initial Developer and every Contributor for any + liability incurred by the Initial Developer or such Contributor as a + result of warranty, support, indemnity or liability terms You offer. + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered Software under + the terms of this License or under the terms of a license of Your + choice, which may contain terms different from this License, + provided that You are in compliance with the terms of this License + and that the license for the Executable form does not attempt to + limit or alter the recipient's rights in the Source Code form from + the rights set forth in this License. If You distribute the Covered + Software in Executable form under a different license, You must make + it absolutely clear that any terms which differ from this License + are offered by You alone, not by the Initial Developer or + Contributor. You hereby agree to indemnify the Initial Developer and + every Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software with + other code not governed by the terms of this License and distribute + the Larger Work as a single product. In such a case, You must make + sure the requirements of this License are fulfilled for the Covered + Software. + +4. Versions of the License. + + 4.1. New Versions. + + Oracle is the initial license steward and may publish revised and/or + new versions of this License from time to time. Each version will be + given a distinguishing version number. Except as provided in Section + 4.3, no one other than the license steward has the right to modify + this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise make the + Covered Software available under the terms of the version of the + License under which You originally received the Covered Software. If + the Initial Developer includes a notice in the Original Software + prohibiting it from being distributed or otherwise made available + under any subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the version + of the License under which You originally received the Covered + Software. Otherwise, You may also choose to use, distribute or + otherwise make the Covered Software available under the terms of any + subsequent version of the License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a new + license for Your Original Software, You may create and use a + modified version of this License if You: (a) rename the license and + remove any references to the name of the license steward (except to + note that the license differs from this License); and (b) otherwise + make it clear that the license contains terms which differ from this + License. + +5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE + IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR + NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF + THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE + DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY + OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, + REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN + ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS + AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +6. TERMINATION. + + 6.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to + cure such breach within 30 days of becoming aware of the breach. + Provisions which, by their nature, must remain in effect beyond the + termination of this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or a + Contributor (the Initial Developer or Contributor against whom You + assert such claim is referred to as "Participant") alleging that the + Participant Software (meaning the Contributor Version where the + Participant is a Contributor or the Original Software where the + Participant is the Initial Developer) directly or indirectly + infringes any patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial Developer (if the + Initial Developer is not the Participant) and all Contributors under + Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice + from Participant terminate prospectively and automatically at the + expiration of such 60 day notice period, unless if within such 60 + day period You withdraw Your claim with respect to the Participant + Software against such Participant either unilaterally or pursuant to + a written agreement with Participant. + + 6.3. If You assert a patent infringement claim against Participant + alleging that the Participant Software directly or indirectly + infringes any patent where such claim is resolved (such as by + license or settlement) prior to the initiation of patent + infringement litigation, then the reasonable value of the licenses + granted by such Participant under Sections 2.1 or 2.2 shall be taken + into account in determining the amount or value of any payment or + license. + + 6.4. In the event of termination under Sections 6.1 or 6.2 above, + all end user licenses that have been validly granted by You or any + distributor hereunder prior to termination (excluding licenses + granted to You by any distributor) shall survive termination. + +7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE + TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER + FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR + LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE + POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT + APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH + PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH + LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR + LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION + AND LIMITATION MAY NOT APPLY TO YOU. + +8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is defined + in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer + software" (as that term is defined at 48 C.F.R. § + 252.227-7014(a)(1)) and "commercial computer software documentation" + as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent + with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 + (June 1995), all U.S. Government End Users acquire Covered Software + with only those rights set forth herein. This U.S. Government Rights + clause is in lieu of, and supersedes, any other FAR, DFAR, or other + clause or provision that addresses Government rights in computer + software under this License. + +9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed by + the law of the jurisdiction specified in a notice contained within + the Original Software (except to the extent applicable law, if any, + provides otherwise), excluding such jurisdiction's conflict-of-law + provisions. Any litigation relating to this License shall be subject + to the jurisdiction of the courts located in the jurisdiction and + venue specified in a notice contained within the Original Software, + with the losing party responsible for costs, including, without + limitation, court costs and reasonable attorneys' fees and expenses. + The application of the United Nations Convention on Contracts for + the International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall be + construed against the drafter shall not apply to this License. You + agree that You alone are responsible for compliance with the United + States export administration regulations (and the export control + laws and regulation of any other countries) when You use, distribute + or otherwise make available any Covered Software. + +10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or indirectly, + out of its utilization of rights under this License and You agree to + work with Initial Developer and Contributors to distribute such + responsibility on an equitable basis. Nothing herein is intended or + shall be deemed to constitute any admission of liability. + +------------------------------------------------------------------------ + +NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION +LICENSE (CDDL) + +The code released under the CDDL shall be governed by the laws of the +State of California (excluding conflict-of-law provisions). Any +litigation relating to this License shall be subject to the jurisdiction +of the Federal Courts of the Northern District of California and the +state courts of the State of California, with venue lying in Santa Clara +County, California. + + + + The GNU General Public License (GPL) Version 2, June 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +51 Franklin Street, Fifth Floor +Boston, MA 02110-1335 +USA + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your freedom to +share and change it. By contrast, the GNU General Public License is +intended to guarantee your freedom to share and change free software--to +make sure the software is free for all its users. This General Public +License applies to most of the Free Software Foundation's software and +to any other program whose authors commit to using it. (Some other Free +Software Foundation software is covered by the GNU Library General +Public License instead.) You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. +Our General Public Licenses are designed to make sure that you have the +freedom to distribute copies of free software (and charge for this +service if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs; and that you know you can do these things. + +To protect your rights, we need to make restrictions that forbid anyone +to deny you these rights or to ask you to surrender the rights. These +restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis +or for a fee, you must give the recipients all the rights that you have. +You must make sure that they, too, receive or can get the source code. +And you must show them these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + +Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + +Finally, any free program is threatened constantly by software patents. +We wish to avoid the danger that redistributors of a free program will +individually obtain patent licenses, in effect making the program +proprietary. To prevent this, we have made it clear that any patent must +be licensed for everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and +modification follow. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License applies to any program or other work which contains a +notice placed by the copyright holder saying it may be distributed under +the terms of this General Public License. The "Program", below, refers +to any such program or work, and a "work based on the Program" means +either the Program or any derivative work under copyright law: that is +to say, a work containing the Program or a portion of it, either +verbatim or with modifications and/or translated into another language. +(Hereinafter, translation is included without limitation in the term +"modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of running +the Program is not restricted, and the output from the Program is +covered only if its contents constitute a work based on the Program +(independent of having been made by running the Program). Whether that +is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's source +code as you receive it, in any medium, provided that you conspicuously +and appropriately publish on each copy an appropriate copyright notice +and disclaimer of warranty; keep intact all the notices that refer to +this License and to the absence of any warranty; and give any other +recipients of the Program a copy of this License along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion of +it, thus forming a work based on the Program, and copy and distribute +such modifications or work under the terms of Section 1 above, provided +that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any part + thereof, to be licensed as a whole at no charge to all third parties + under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a notice + that there is no warranty (or else, saying that you provide a + warranty) and that users may redistribute the program under these + conditions, and telling the user how to view a copy of this License. + (Exception: if the Program itself is interactive but does not + normally print such an announcement, your work based on the Program + is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, and +can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based on +the Program, the distribution of the whole must be on the terms of this +License, whose permissions for other licensees extend to the entire +whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of a +storage or distribution medium does not bring the other work under the +scope of this License. + +3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections 1 + and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your cost + of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer to + distribute corresponding source code. (This alternative is allowed + only for noncommercial distribution and only if you received the + program in object code or executable form with such an offer, in + accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source code +means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to control +compilation and installation of the executable. However, as a special +exception, the source code distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies the +executable. + +If distribution of executable or object code is made by offering access +to copy from a designated place, then offering equivalent access to copy +the source code from the same place counts as distribution of the source +code, even though third parties are not compelled to copy the source +along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt otherwise +to copy, modify, sublicense or distribute the Program is void, and will +automatically terminate your rights under this License. However, parties +who have received copies, or rights, from you under this License will +not have their licenses terminated so long as such parties remain in +full compliance. + +5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and all +its terms and conditions for copying, distributing or modifying the +Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further restrictions +on the recipients' exercise of the rights granted herein. You are not +responsible for enforcing compliance by third parties to this License. + +7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot distribute +so as to satisfy simultaneously your obligations under this License and +any other pertinent obligations, then as a consequence you may not +distribute the Program at all. For example, if a patent license would +not permit royalty-free redistribution of the Program by all those who +receive copies directly or indirectly through you, then the only way you +could satisfy both it and this License would be to refrain entirely from +distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is implemented +by public license practices. Many people have made generous +contributions to the wide range of software distributed through that +system in reliance on consistent application of that system; it is up to +the author/donor to decide if he or she is willing to distribute +software through any other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be +a consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License may +add an explicit geographical distribution limitation excluding those +countries, so that distribution is permitted only in or among countries +not thus excluded. In such case, this License incorporates the +limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new +versions of the General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Program does not specify a version +number of this License, you may choose any version ever published by the +Free Software Foundation. + +10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the +author to ask for permission. For software which is copyrighted by the +Free Software Foundation, write to the Free Software Foundation; we +sometimes make exceptions for this. Our decision will be guided by the +two goals of preserving the free status of all derivatives of our free +software and of promoting the sharing and reuse of software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, +EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE +ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH +YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL +NECESSARY SERVICING, REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR +DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL +DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM +(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED +INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF +THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR +OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to +attach them to the start of each source file to most effectively convey +the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + One line to give the program's name and a brief idea of what it does. + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type + `show w'. This is free software, and you are welcome to redistribute + it under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the +appropriate parts of the General Public License. Of course, the commands +you use may be called something other than `show w' and `show c'; they +could even be mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + program `Gnomovision' (which makes passes at compilers) written by + James Hacker. + + signature of Ty Coon, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications +with the library. If this is what you want to do, use the GNU Library +General Public License instead of this License. + +# + +Certain source files distributed by Oracle America, Inc. and/or its +affiliates are subject to the following clarification and special +exception to the GPLv2, based on the GNU Project exception for its +Classpath libraries, known as the GNU Classpath Exception, but only +where Oracle has expressly included in the particular source file's +header the words "Oracle designates this particular file as subject to +the "Classpath" exception as provided by Oracle in the LICENSE file +that accompanied this code." + +You should also note that Oracle includes multiple, independent +programs in this software package. Some of those programs are provided +under licenses deemed incompatible with the GPLv2 by the Free Software +Foundation and others. For example, the package includes programs +licensed under the Apache License, Version 2.0. Such programs are +licensed to you under their original licenses. + +Oracle facilitates your further distribution of this package by adding +the Classpath Exception to the necessary parts of its GPLv2 code, which +permits you to use that code in combination with other independent +modules not licensed under the GPLv2. However, note that this would +not permit you to commingle code under an incompatible license with +Oracle's GPLv2 licensed code by, for example, cutting and pasting such +code into a file also containing Oracle's GPLv2 licensed code and then +distributing the result. Additionally, if you were to remove the +Classpath Exception from any of the files to which it applies and +distribute the result, you would likely be required to license some or +all of the other code in that distribution under the GPLv2 as well, and +since the GPLv2 is incompatible with the license terms of some items +included in the distribution by Oracle, removing the Classpath +Exception could therefore effectively compromise your ability to +further distribute the package. + +Proceed with caution and we recommend that you obtain the advice of a +lawyer skilled in open source matters before removing the Classpath +Exception or making modifications to this package which may +subsequently be redistributed and/or involve the use of third party +software. + +CLASSPATH EXCEPTION +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License version 2 cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from or +based on this library. If you modify this library, you may extend this +exception to your version of the library, but you are not obligated to +do so. If you do not wish to do so, delete this exception statement +from your version. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-junit5.txt b/hugegraph-dist/release-docs/licenses/LICENSE-junit5.txt new file mode 100644 index 0000000000..8ebced110a --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-junit5.txt @@ -0,0 +1,98 @@ +Eclipse Public License - v 2.0 +============================== + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (“AGREEMENT”). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +### 1. Definitions + +“Contribution” means: +* **a)** in the case of the initial Contributor, the initial content Distributed under this Agreement, and +* **b)** in the case of each subsequent Contributor: + * **i)** changes to the Program, and + * **ii)** additions to the Program; +where such changes and/or additions to the Program originate from and are Distributed by that particular Contributor. A Contribution “originates” from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include changes or additions to the Program that are not Modified Works. + +“Contributor” means any person or entity that Distributes the Program. + +“Licensed Patents” mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. + +“Program” means the Contributions Distributed in accordance with this Agreement. + +“Recipient” means anyone who receives the Program under this Agreement or any Secondary License (as applicable), including Contributors. + +“Derivative Works” shall mean any work, whether in Source Code or other form, that is based on (or derived from) the Program and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. + +“Modified Works” shall mean any work in Source Code or other form that results from an addition to, deletion from, or modification of the contents of the Program, including, for purposes of clarity any new file in Source Code form that contains any contents of the Program. Modified Works shall not include works that contain only declarations, interfaces, types, classes, structures, or files of the Program solely in each case in order to link to, bind by name, or subclass the Program or Modified Works thereof. + +“Distribute” means the acts of **a)** distributing or **b)** making available in any manner that enables the transfer of a copy. + +“Source Code” means the form of a Program preferred for making modifications, including but not limited to software source code, documentation source, and configuration files. + +“Secondary License” means either the GNU General Public License, Version 2.0, or any later versions of that license, including any exceptions or additional permissions as identified by the initial Contributor. + +### 2. Grant of Rights + +**a)** Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, Distribute and sublicense the Contribution of such Contributor, if any, and such Derivative Works. + +**b)** Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in Source Code or other form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. + +**c)** Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to Distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. + +**d)** Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. + +**e)** Notwithstanding the terms of any Secondary License, no Contributor makes additional grants to any Recipient (other than those set forth in this Agreement) as a result of such Recipient's receipt of the Program under the terms of a Secondary License (if permitted under the terms of Section 3). + +### 3. Requirements + +**3.1** If a Contributor Distributes the Program in any form, then: + +* **a)** the Program must also be made available as Source Code, in accordance with section 3.2, and the Contributor must accompany the Program with a statement that the Source Code for the Program is available under this Agreement, and informs Recipients how to obtain it in a reasonable manner on or through a medium customarily used for software exchange; and + +* **b)** the Contributor may Distribute the Program under a license different than this Agreement, provided that such license: + * **i)** effectively disclaims on behalf of all other Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; + * **ii)** effectively excludes on behalf of all other Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; + * **iii)** does not attempt to limit or alter the recipients' rights in the Source Code under section 3.2; and + * **iv)** requires any subsequent distribution of the Program by any party to be under a license that satisfies the requirements of this section 3. + +**3.2** When the Program is Distributed as Source Code: + +* **a)** it must be made available under this Agreement, or if the Program **(i)** is combined with other material in a separate file or files made available under a Secondary License, and **(ii)** the initial Contributor attached to the Source Code the notice described in Exhibit A of this Agreement, then the Program may be made available under the terms of such Secondary Licenses, and +* **b)** a copy of this Agreement must be included with each copy of the Program. + +**3.3** Contributors may not remove or alter any copyright, patent, trademark, attribution notices, disclaimers of warranty, or limitations of liability (“notices”) contained within the Program from any copy of the Program which they Distribute, provided that Contributors may add their own appropriate notices. + +### 4. Commercial Distribution + +Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor (“Commercial Contributor”) hereby agrees to defend and indemnify every other Contributor (“Indemnified Contributor”) against any losses, damages and costs (collectively “Losses”) arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: **a)** promptly notify the Commercial Contributor in writing of such claim, and **b)** allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. + +### 5. No Warranty + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. + +### 6. Disclaimer of Liability + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +### 7. General + +If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be Distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to Distribute the Program (including its Contributions) under the new version. + +Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. Nothing in this Agreement is intended to be enforceable by any entity that is not a Contributor or Recipient. No third-party beneficiary rights are created under this Agreement. + +#### Exhibit A - Form of Secondary Licenses Notice + +> “This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: {name license(s), version(s), and exceptions or additional permissions here}.” + +Simply including a copy of this Agreement, including this Exhibit A is not sufficient to license the Source Code under Secondary Licenses. + +If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice. + +You may add additional accurate notices of copyright ownership. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-log4j-api.txt b/hugegraph-dist/release-docs/licenses/LICENSE-log4j-api.txt new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-log4j-api.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-log4j-core.txt b/hugegraph-dist/release-docs/licenses/LICENSE-log4j-core.txt new file mode 100644 index 0000000000..6279e5206d --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-log4j-core.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 1999-2005 The Apache Software Foundation + + Licensed 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. diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-log4j-slf4j-impl.txt b/hugegraph-dist/release-docs/licenses/LICENSE-log4j-slf4j-impl.txt new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-log4j-slf4j-impl.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-netty.txt b/hugegraph-dist/release-docs/licenses/LICENSE-netty.txt new file mode 100644 index 0000000000..e25e752cf1 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-netty.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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 + + https://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. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-opentracing-java.txt b/hugegraph-dist/release-docs/licenses/LICENSE-opentracing-java.txt new file mode 100644 index 0000000000..8dada3edaf --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-opentracing-java.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed 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. diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-perfmark.txt b/hugegraph-dist/release-docs/licenses/LICENSE-perfmark.txt new file mode 100644 index 0000000000..f49a4e16e6 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-perfmark.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-protobuf.txt b/hugegraph-dist/release-docs/licenses/LICENSE-protobuf.txt new file mode 100644 index 0000000000..97a6e3d199 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-protobuf.txt @@ -0,0 +1,32 @@ +Copyright 2008 Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Code generated by the Protocol Buffer compiler is owned by the owner +of the input file used when generating it. This code is not +standalone and requires a support library to be linked with it. This +support library is itself covered by the above license. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-slf4j.txt b/hugegraph-dist/release-docs/licenses/LICENSE-slf4j.txt new file mode 100644 index 0000000000..a51675a21c --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-slf4j.txt @@ -0,0 +1,23 @@ +Copyright (c) 2004-2022 QOS.ch Sarl (Switzerland) +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-sofa-bolt.txt b/hugegraph-dist/release-docs/licenses/LICENSE-sofa-bolt.txt new file mode 100644 index 0000000000..f49a4e16e6 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-sofa-bolt.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-sofa-boot.txt b/hugegraph-dist/release-docs/licenses/LICENSE-sofa-boot.txt new file mode 100644 index 0000000000..f49a4e16e6 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-sofa-boot.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-sofa-common-tools.txt b/hugegraph-dist/release-docs/licenses/LICENSE-sofa-common-tools.txt new file mode 100644 index 0000000000..f49a4e16e6 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-sofa-common-tools.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-sofa-hessian.txt b/hugegraph-dist/release-docs/licenses/LICENSE-sofa-hessian.txt new file mode 100644 index 0000000000..f49a4e16e6 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-sofa-hessian.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-sofa-lookout.txt b/hugegraph-dist/release-docs/licenses/LICENSE-sofa-lookout.txt new file mode 100644 index 0000000000..f49a4e16e6 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-sofa-lookout.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-sofa-rpc.txt b/hugegraph-dist/release-docs/licenses/LICENSE-sofa-rpc.txt new file mode 100644 index 0000000000..f49a4e16e6 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-sofa-rpc.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-swagger-annotations.txt b/hugegraph-dist/release-docs/licenses/LICENSE-swagger-annotations.txt new file mode 100644 index 0000000000..e280013182 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-swagger-annotations.txt @@ -0,0 +1,11 @@ +Copyright 2016 SmartBear Software + +Licensed 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 [apache.org/licenses/LICENSE-2.0](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. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-swagger-core.txt b/hugegraph-dist/release-docs/licenses/LICENSE-swagger-core.txt new file mode 100644 index 0000000000..3e5194180d --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-swagger-core.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright (c) 2015. SmartBear Software Inc. + + Licensed 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. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-swagger-models.txt b/hugegraph-dist/release-docs/licenses/LICENSE-swagger-models.txt new file mode 100644 index 0000000000..e280013182 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-swagger-models.txt @@ -0,0 +1,11 @@ +Copyright 2016 SmartBear Software + +Licensed 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 [apache.org/licenses/LICENSE-2.0](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. \ No newline at end of file From 5bc993fe7969fb4b9af60ff0bbcf720e25d1481d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9D=92=E5=B9=B4?= <1043706593@qq.com> Date: Wed, 23 Nov 2022 21:17:02 +0800 Subject: [PATCH 187/217] manifest version use project.version (#119) --- hugegraph-common/pom.xml | 2 +- hugegraph-rpc/pom.xml | 2 +- pom.xml | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/hugegraph-common/pom.xml b/hugegraph-common/pom.xml index 862c3d775b..cba4fefe0f 100644 --- a/hugegraph-common/pom.xml +++ b/hugegraph-common/pom.xml @@ -239,7 +239,7 @@ - ${implementation.version} + ${project.version}
    diff --git a/hugegraph-rpc/pom.xml b/hugegraph-rpc/pom.xml index 2a29065cbb..ad5309d915 100644 --- a/hugegraph-rpc/pom.xml +++ b/hugegraph-rpc/pom.xml @@ -132,7 +132,7 @@ - ${implementation.version} + ${project.version}
    diff --git a/pom.xml b/pom.xml index ad7e3a4c9f..7167a93e23 100644 --- a/pom.xml +++ b/pom.xml @@ -80,7 +80,6 @@ 3.0.2 3.1.2 8.45 - 2.1.2.0 @@ -149,7 +148,7 @@ - ${implementation.version} + ${project.version} From 37e221a71220ec81b78082f7e5c812dd340f974a Mon Sep 17 00:00:00 2001 From: seagle Date: Wed, 30 Nov 2022 15:45:16 +0800 Subject: [PATCH 188/217] delete blankspace of licenses filename (#120) Co-authored-by: yuanbingze --- .../{LICENSE-commons-text.txt => LICENSE-commons-text.txt} | 0 .../licenses/{LICENSE-joda-time.txt => LICENSE-joda-time.txt} | 0 .../licenses/{LICENSE-jsonp.txt => LICENSE-jsonp.txt} | 0 .../licenses/{LICENSE-netty.txt => LICENSE-netty.txt} | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename hugegraph-dist/release-docs/licenses/{LICENSE-commons-text.txt => LICENSE-commons-text.txt} (100%) rename hugegraph-dist/release-docs/licenses/{LICENSE-joda-time.txt => LICENSE-joda-time.txt} (100%) rename hugegraph-dist/release-docs/licenses/{LICENSE-jsonp.txt => LICENSE-jsonp.txt} (100%) rename hugegraph-dist/release-docs/licenses/{LICENSE-netty.txt => LICENSE-netty.txt} (100%) diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-text.txt b/hugegraph-dist/release-docs/licenses/LICENSE-commons-text.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-commons-text.txt rename to hugegraph-dist/release-docs/licenses/LICENSE-commons-text.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-joda-time.txt b/hugegraph-dist/release-docs/licenses/LICENSE-joda-time.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-joda-time.txt rename to hugegraph-dist/release-docs/licenses/LICENSE-joda-time.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jsonp.txt b/hugegraph-dist/release-docs/licenses/LICENSE-jsonp.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jsonp.txt rename to hugegraph-dist/release-docs/licenses/LICENSE-jsonp.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-netty.txt b/hugegraph-dist/release-docs/licenses/LICENSE-netty.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-netty.txt rename to hugegraph-dist/release-docs/licenses/LICENSE-netty.txt From c86e38a8ac7eb05e405ffac531585443f9d362d3 Mon Sep 17 00:00:00 2001 From: imbajin Date: Mon, 5 Dec 2022 00:05:14 +0800 Subject: [PATCH 189/217] chore: enable rebase option (#121) --- .asf.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.asf.yaml b/.asf.yaml index 1b320bf16e..4354d52b08 100644 --- a/.asf.yaml +++ b/.asf.yaml @@ -31,7 +31,7 @@ github: enabled_merge_buttons: merge: false squash: true - rebase: false + rebase: true protected_branches: master: required_status_checks: From a40774e484c9af39064e1653a0b6582b6e588967 Mon Sep 17 00:00:00 2001 From: imbajin Date: Tue, 6 Dec 2022 15:41:56 +0800 Subject: [PATCH 190/217] chore: prepare for release v1.0.0 (#122) --- .gitattributes | 8 ++ .gitignore | 4 +- hugegraph-common/build.sh | 1 - hugegraph-dist/scripts/apache-release.sh | 89 +++++++++++++++++++ .../scripts/dependency/check_dependencies.sh | 10 +-- .../regenerate_known_dependencies.sh | 14 +-- 6 files changed, 111 insertions(+), 15 deletions(-) create mode 100644 .gitattributes create mode 100755 hugegraph-dist/scripts/apache-release.sh diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..f34702952e --- /dev/null +++ b/.gitattributes @@ -0,0 +1,8 @@ +# ignore when package to source.tgz +.github/ export-ignore +.gitattributes export-ignore +.gitignore export-ignore +.asf.yaml export-ignore +apache-release.sh export-ignore + +hugegraph-dist/scripts export-ignore diff --git a/.gitignore b/.gitignore index 05e7e3ad2a..3ef2d3ab55 100644 --- a/.gitignore +++ b/.gitignore @@ -29,10 +29,10 @@ build ### NetBeans ### /nbproject/private/ /nbbuild/ -/dist/ /nbdist/ /.nb-gradle/ build/ +dist/ ### VS Code ### .vscode/ @@ -61,7 +61,7 @@ output/ *.war *.zip *.tar -*.tar.gz +*.tar.gz* tree.txt *.versionsBackup diff --git a/hugegraph-common/build.sh b/hugegraph-common/build.sh index b0eef45966..b2cb6211b9 100644 --- a/hugegraph-common/build.sh +++ b/hugegraph-common/build.sh @@ -21,4 +21,3 @@ export JAVA_HOME=/home/scmtools/buildkit/java/jdk1.8.0_25/ export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH mvn clean test -Dtest=UnitTestSuite - diff --git a/hugegraph-dist/scripts/apache-release.sh b/hugegraph-dist/scripts/apache-release.sh new file mode 100755 index 0000000000..942392227e --- /dev/null +++ b/hugegraph-dist/scripts/apache-release.sh @@ -0,0 +1,89 @@ +#!/usr/bin/env bash +# +# 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. +# + +GROUP="hugegraph" +# current REPOsitory name +REPO="${GROUP}-commons" +# release version (input by committer) +RELEASE_VERSION=$1 +# git release branch (check it carefully) +GIT_BRANCH="release-${RELEASE_VERSION}" + +RELEASE_VERSION=${RELEASE_VERSION:?"Please input the release version behind script"} + +WORK_DIR=$(cd "$(dirname "$0")" || exit; pwd) +cd "${WORK_DIR}" || exit +echo "In the work dir: $(pwd)" + +# clean old dir then build a new one +rm -rfv dist && mkdir -p dist/apache-${REPO} + +# step1: package the source code +git archive --format=tar.gz \ + --output="dist/apache-${REPO}/apache-${REPO}-incubating-${RELEASE_VERSION}-src.tar.gz" \ + --prefix=apache-${REPO}-incubating-"${RELEASE_VERSION}"-src/ "${GIT_BRANCH}" || exit + +# step2: copy the binary file (Optional) +# Note: it's optional for project to generate binary package (skip this step if not need) +#cp -v ../../target/apache-${REPO}-incubating-"${RELEASE_VERSION}".tar.gz \ +# dist/apache-${REPO} || exit + +# step3: sign + hash +##### 3.1 sign in source & binary package +gpg --version 1>/dev/null || exit +cd ./dist/apache-${REPO} || exit +for i in *.tar.gz; do + echo "$i" && gpg --armor --output "$i".asc --detach-sig "$i" +done + +##### 3.2 Generate SHA512 file +shasum --version 1>/dev/null || exit +for i in *.tar.gz; do + echo "$i" && shasum -a 512 "$i" >"$i".sha512 +done + +#### 3.3 check signature & sha512 +for i in *.tar.gz; do + echo "$i" + gpg --verify "$i".asc "$i" || exit +done + +for i in *.tar.gz; do + echo "$i" + shasum -a 512 --check "$i".sha512 || exit +done + +# step4: upload to Apache-SVN +SVN_DIR="${GROUP}-svn-dev" +cd ../ +rm -rfv ${SVN_DIR} + +svn co "https://dist.apache.org/repos/dist/dev/incubator/${GROUP}" ${SVN_DIR} +mkdir -p ${SVN_DIR}/"${RELEASE_VERSION}" +cp -v apache-${REPO}/*tar.gz* "${SVN_DIR}/${RELEASE_VERSION}" +cd ${SVN_DIR} || exit + +# check status first +svn status +svn add "${RELEASE_VERSION}" +# check status again +svn status +# commit & push files +svn commit -m "submit files for ${REPO} ${RELEASE_VERSION}" + +echo "Finished all, please check all steps in script manually again! " diff --git a/hugegraph-dist/scripts/dependency/check_dependencies.sh b/hugegraph-dist/scripts/dependency/check_dependencies.sh index 29f9031078..642c455aa9 100644 --- a/hugegraph-dist/scripts/dependency/check_dependencies.sh +++ b/hugegraph-dist/scripts/dependency/check_dependencies.sh @@ -16,16 +16,16 @@ # limitations under the License. # -BASE_PATH=$(cd $(dirname $0); pwd) +BASE_PATH=$(cd "$(dirname "$0")" || exit; pwd) # check whether there are new third-party dependencies by diff command, # diff generated 'current-dependencies.txt' file with 'known-dependencies.txt' file. -diff -w -B -U0 <(sort < ${BASE_PATH}/known-dependencies.txt) \ -<(sort < ${BASE_PATH}/current-dependencies.txt) > ${BASE_PATH}/result.txt +diff -w -B -U0 <(sort < "${BASE_PATH}"/known-dependencies.txt) \ + <(sort < "${BASE_PATH}"/current-dependencies.txt) > "${BASE_PATH}"/result.txt # if has new third-party,the Action will fail and print diff -if [ -s ${BASE_PATH}/result.txt ]; then - cat ${BASE_PATH}/result.txt +if [ -s "${BASE_PATH}"/result.txt ]; then + cat "${BASE_PATH}"/result.txt exit 1 else echo 'All third dependencies is known!' diff --git a/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh b/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh index 1c27c9f025..91f8b986ad 100644 --- a/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh +++ b/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh @@ -16,18 +16,18 @@ # limitations under the License. # -BASE_PATH=$(cd $(dirname $0); pwd) +BASE_PATH=$(cd "$(dirname "$0")" || exit; pwd) DEP_PATH=$BASE_PATH/all_dependencies FILE_NAME=${1:-known-dependencies.txt} -if [[ -d $DEP_PATH ]];then +if [[ -d $DEP_PATH ]]; then echo "rm -r -f DEP_PATH" - rm -r -f $DEP_PATH + rm -r -f "$DEP_PATH" fi -cd $BASE_PATH/../../../ +cd "$BASE_PATH"/../../../ || exit -mvn dependency:copy-dependencies -DincludeScope=runtime -DoutputDirectory=$DEP_PATH +mvn dependency:copy-dependencies -DincludeScope=runtime -DoutputDirectory="$DEP_PATH" -ls $DEP_PATH | egrep -v "^hugegraph|hubble" | sort -n > $BASE_PATH/$FILE_NAME -rm -r -f $DEP_PATH +ls "$DEP_PATH" | egrep -v "^hugegraph|hubble" | sort -n > "$BASE_PATH"/"$FILE_NAME" +rm -r -f "$DEP_PATH" From 9463119a67bb786a4290360546741bad554cfed2 Mon Sep 17 00:00:00 2001 From: imbajin Date: Thu, 15 Dec 2022 16:14:29 +0800 Subject: [PATCH 191/217] chore: update release script & add mailing lists (#123) --- .gitattributes | 1 + .gitignore | 6 ++-- hugegraph-dist/scripts/apache-release.sh | 27 +++++++++++----- pom.xml | 41 +++++++++++++++++++++--- 4 files changed, 60 insertions(+), 15 deletions(-) diff --git a/.gitattributes b/.gitattributes index f34702952e..d72a587aa0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6,3 +6,4 @@ apache-release.sh export-ignore hugegraph-dist/scripts export-ignore +style/ export-ignore diff --git a/.gitignore b/.gitignore index 3ef2d3ab55..5a63c69c7d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ target/ **.db logs/ ui -node_modules +node_modules/ upload-files/ demo* gen-java @@ -20,7 +20,6 @@ build .svn ### IntelliJ IDEA ### -.idea .idea/ *.iws *.iml @@ -58,12 +57,14 @@ dist/ # maven ignore output/ +apache-hugegraph-*-incubating-*/ *.war *.zip *.tar *.tar.gz* tree.txt *.versionsBackup +.flattened-pom.xml # eclipse ignore .settings/ @@ -81,4 +82,3 @@ hs_err_pid* .mtj.tmp/ # blueJ files *.ctxt -.flattened-pom.xml diff --git a/hugegraph-dist/scripts/apache-release.sh b/hugegraph-dist/scripts/apache-release.sh index 942392227e..da29e3f1b0 100755 --- a/hugegraph-dist/scripts/apache-release.sh +++ b/hugegraph-dist/scripts/apache-release.sh @@ -17,10 +17,12 @@ # GROUP="hugegraph" -# current REPOsitory name +# current repository name REPO="${GROUP}-commons" # release version (input by committer) RELEASE_VERSION=$1 +USERNAME=$2 +PASSWORD=$3 # git release branch (check it carefully) GIT_BRANCH="release-${RELEASE_VERSION}" @@ -34,9 +36,12 @@ echo "In the work dir: $(pwd)" rm -rfv dist && mkdir -p dist/apache-${REPO} # step1: package the source code +cd ../../ || exit git archive --format=tar.gz \ - --output="dist/apache-${REPO}/apache-${REPO}-incubating-${RELEASE_VERSION}-src.tar.gz" \ - --prefix=apache-${REPO}-incubating-"${RELEASE_VERSION}"-src/ "${GIT_BRANCH}" || exit + --output="${GROUP}-dist/scripts/dist/apache-${REPO}/apache-${REPO}-incubating-${RELEASE_VERSION}-src.tar.gz" \ + --prefix="apache-${REPO}-incubating-${RELEASE_VERSION}-src/" "${GIT_BRANCH}" || exit + +cd - || exit # step2: copy the binary file (Optional) # Note: it's optional for project to generate binary package (skip this step if not need) @@ -73,17 +78,23 @@ SVN_DIR="${GROUP}-svn-dev" cd ../ rm -rfv ${SVN_DIR} +##### 4.1 pull from remote & copy files svn co "https://dist.apache.org/repos/dist/dev/incubator/${GROUP}" ${SVN_DIR} mkdir -p ${SVN_DIR}/"${RELEASE_VERSION}" cp -v apache-${REPO}/*tar.gz* "${SVN_DIR}/${RELEASE_VERSION}" cd ${SVN_DIR} || exit -# check status first +##### 4.2 check status first svn status -svn add "${RELEASE_VERSION}" +svn add --parents "${RELEASE_VERSION}"/apache-${REPO}-* # check status again svn status -# commit & push files -svn commit -m "submit files for ${REPO} ${RELEASE_VERSION}" -echo "Finished all, please check all steps in script manually again! " +##### 4.3 commit & push files +if [ "$USERNAME" = "" ]; then + svn commit -m "submit files for ${REPO} ${RELEASE_VERSION}" +else + svn commit -m "submit files for ${REPO} ${RELEASE_VERSION}" --username "${USERNAME}" --password "${PASSWORD}" +fi + +echo "Finished all, please check all steps in script manually again!" diff --git a/pom.xml b/pom.xml index 7167a93e23..4b62a7699e 100644 --- a/pom.xml +++ b/pom.xml @@ -42,16 +42,49 @@ The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt + https://www.apache.org/licenses/LICENSE-2.0.txt repo - + + + Apache Hugegraph(Incubating) + dev-subscribe@hugegraph.apache.org + https://hugegraph.apache.org/ + + + + + + Developer List + dev-subscribe@hugegraph.apache.org + dev-unsubscribe@hugegraph.apache.org + dev@hugegraph.incubator.apache.org + + + Commits List + commits-subscribe@hugegraph.apache.org + commits-unsubscribe@hugegraph.apache.org + commits@hugegraph.apache.org + + + Issues List + issues-subscribe@hugegraph.apache.org + issues-unsubscribe@hugegraph.apache.org + issues@hugegraph.apache.org + + + + + Github Issues + https://github.com/apache/hugegraph-commons/issues + + https://github.com/apache/hugegraph-commons - https://github.com/apache/hugegraph-commons - https://github.com/apache/hugegraph-commons + scm:git:https://github.com/apache/hugegraph-commons.git + scm:git:https://github.com/apache/hugegraph-commons.git From 0239a1e174a5b83c3612efc342f20a9a2a04889e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9D=92=E5=B9=B4?= <1043706593@qq.com> Date: Sun, 1 Jan 2023 13:18:07 +0800 Subject: [PATCH 192/217] fix: add style files back (#125) * add style * Update .gitattributes Co-authored-by: imbajin --- .gitattributes | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index d72a587aa0..f34702952e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6,4 +6,3 @@ apache-release.sh export-ignore hugegraph-dist/scripts export-ignore -style/ export-ignore From e400e4d22b3346cf5522932dafb885769a6e6dd1 Mon Sep 17 00:00:00 2001 From: imbajin Date: Fri, 13 Jan 2023 23:44:21 +0800 Subject: [PATCH 193/217] refact(test): download binary file for https test (#126) --- .../apache/hugegraph/unit/BaseUnitTest.java | 18 ++++++++++++++++-- .../unit/concurrent/KeyLockTest.java | 3 ++- .../unit/license/LicenseCreateParamTest.java | 8 +++----- .../hugegraph/unit/rest/RestClientTest.java | 9 +++++++++ .../src/test/resources/cacerts.jks | Bin 939 -> 0 bytes .../src/test/resources/privateKeys.store | Bin 1280 -> 0 bytes .../src/test/resources/publicCerts.store | Bin 873 -> 0 bytes 7 files changed, 30 insertions(+), 8 deletions(-) delete mode 100644 hugegraph-common/src/test/resources/cacerts.jks delete mode 100644 hugegraph-common/src/test/resources/privateKeys.store delete mode 100644 hugegraph-common/src/test/resources/publicCerts.store diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java index cd09b8006e..c93b78a9c9 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java @@ -19,6 +19,9 @@ package org.apache.hugegraph.unit; +import java.io.File; +import java.io.IOException; +import java.net.URL; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutionException; @@ -26,6 +29,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.Future; +import org.apache.commons.io.FileUtils; import org.apache.hugegraph.util.TimeUtil; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -42,7 +46,7 @@ public static void clear() throws Exception { // pass } - protected static final void runWithThreads(int threads, Runnable task) { + protected static void runWithThreads(int threads, Runnable task) { ExecutorService executor = Executors.newFixedThreadPool(threads); List> futures = new ArrayList<>(); for (int i = 0; i < threads; i++) { @@ -57,7 +61,17 @@ protected static final void runWithThreads(int threads, Runnable task) { } } - protected static final void waitTillNext(long seconds) { + protected static void waitTillNext(long seconds) { TimeUtil.tillNextMillis(TimeUtil.timeGen() + seconds * 1000); } + + public static void downloadFileByUrl(String url, String destPath) { + int connectTimeout = 5000; + int readTimeout = 5000; + try { + FileUtils.copyURLToFile(new URL(url), new File(destPath), connectTimeout, readTimeout); + } catch (IOException e) { + throw new RuntimeException(e); + } + } } diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/KeyLockTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/KeyLockTest.java index e431853e08..b690e3525e 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/KeyLockTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/KeyLockTest.java @@ -20,6 +20,7 @@ package org.apache.hugegraph.unit.concurrent; import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.concurrent.locks.Lock; @@ -103,7 +104,7 @@ public void testLockUnlockAll() { }); Assert.assertThrows(IllegalArgumentException.class, () -> { - locks.lockAll(Arrays.asList().toArray()); + locks.lockAll(Collections.emptyList().toArray()); }, e -> { Assert.assertContains("Lock keys can't be null or empty", e.getMessage()); diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseCreateParamTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseCreateParamTest.java index 92b902f02a..a00307ba7d 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseCreateParamTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseCreateParamTest.java @@ -20,20 +20,18 @@ package org.apache.hugegraph.unit.license; import java.io.IOException; -import java.text.ParseException; import org.apache.hugegraph.date.SafeDateFormat; -import org.junit.Test; - import org.apache.hugegraph.license.LicenseCreateParam; import org.apache.hugegraph.testutil.Assert; +import org.junit.Test; + import com.fasterxml.jackson.databind.ObjectMapper; public class LicenseCreateParamTest { @Test - public void testDeserializeLicenseCreateParam() - throws IOException, ParseException { + public void testDeserializeLicenseCreateParam() throws IOException { String json = "{" + "\"subject\":\"hugegraph-evaluation\"," + "\"private_alias\":\"privatekey\"," diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestClientTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestClientTest.java index 71fa1cd639..0badaee10a 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestClientTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestClientTest.java @@ -39,6 +39,7 @@ import jakarta.ws.rs.core.MultivaluedMap; import jakarta.ws.rs.core.Response; +import org.apache.hugegraph.unit.BaseUnitTest; import org.junit.Test; import org.mockito.Mockito; @@ -271,7 +272,11 @@ public void testPostWithTokenAndAllParams() { @Test public void testPostHttpsWithAllParams() { + String url = "https://github.com/apache/incubator-hugegraph-doc/" + + "raw/master/dist/commons/cacerts.jks"; String trustStoreFile = "src/test/resources/cacerts.jks"; + BaseUnitTest.downloadFileByUrl(url, trustStoreFile); + String trustStorePassword = "changeit"; RestClient client = new RestClientImpl("/test", "user", "", 1000, 10, 5, trustStoreFile, @@ -282,7 +287,11 @@ public void testPostHttpsWithAllParams() { @Test public void testPostHttpsWithTokenAndAllParams() { + String url = "https://github.com/apache/incubator-hugegraph-doc/" + + "raw/master/dist/commons/cacerts.jks"; String trustStoreFile = "src/test/resources/cacerts.jks"; + BaseUnitTest.downloadFileByUrl(url, trustStoreFile); + String trustStorePassword = "changeit"; RestClient client = new RestClientImpl("/test", "token", 1000, 10, 5, trustStoreFile, diff --git a/hugegraph-common/src/test/resources/cacerts.jks b/hugegraph-common/src/test/resources/cacerts.jks deleted file mode 100644 index d1c57e050dc7076e8df3c948016d80ec01f2e9b7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 939 zcmezO_TO6u1_mY|W(3om8Kvo|=|zbJ89!;MW#iOp^Jx3d%gD&h%3zRe$Zf#M#vIDRCd}mI1>M?ZweIbyqWsMZPS(9GyaQ{ zCao@Jy_m^=bffyo9TL-)xmf(1;E*cx`MLSEC;G?M9I;!hr~B$a^oGW#v+w=XcD<9y zZgqCPY2^p)BeO4S3YagnaL`^@D;l$>K$%yu`yBIz3Ad+4v`Np<+s&oY>h|Wq?}}r) zZ8n~ed$I2MdDgv$#Akec%jGa*na`~iIUN7*IZf0ox$WVT`9(N?Z;u~O#4|p|6M5Hr zO567*&bFDpZO##G>6faj^h=hle9gqn$iTQ*(Lmln78ud8d@N!tB3ENK*6$BJ(8089 zV*Ifdh7D5l)Vz=b5txF2fyl_<^uF%?j*C;@&iiUVfrHmhBX!4GtL&JrD)}RNM*Nd} zW-!@x6=_XTla9Jzt5#FmnR6j_$?>TZ6l2{kHvTtnX>UIGhCPj^zOzvA=Hf6oZZo8Dd=R9#-;^{VtH=db0)y@egqH(48$2Rp20 z`L^=$!!1E_8~kqHn8>boc)~gMrKusCvRON{bx%tzXnxPL-f>x!Q73D7Y)svBtFHh; CGhpNZ diff --git a/hugegraph-common/src/test/resources/privateKeys.store b/hugegraph-common/src/test/resources/privateKeys.store deleted file mode 100644 index 4982719687f2c84d2ad914ab34f86051832c1936..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1280 zcmezO_TO6u1_mY|W&~rdf}+f_#FEtP)JmXG#f=?ny@7PUK@(%Q0UsNeHX9=gqZX4O zBO@yVOA}+cAnU7X#tY(n*2}RU?Ya>B=1U^iP93xG>1DgqcAc#MvS)f8=cUtUW7d9h z$T+!w!3O#B_vc)C5dO-WD`Rf8&oj-FQ;%9qFXOwuX$Rlx_9FZ2Dhs*o)^~G-?;C75 zcT!W;Va0^^V>u`gXki^ry2kZ+|-2cWU{w9$TAZ+MBH$gH&86^WVL9q<-bE ztrIVvbYF3O!43hr$d$9SW^A7yZ6zwFKH;lT-NJh@Ks_@1b>nF+Crx-znN{V-x=dF0!&t=&(4S=qg_ zi*l_l#&pYXl0Fvqp!r1mW43PTlP9hSmY!^E>09=A!{<~}fw(putCv1^O?6L%oet5m zR5Zy^t4h3Ew~#g2N#-o`{=*6ke&!n+Pq%Aq{;D-mDPx7!0j=7um-PvMXZ;a(u+jOO zc|Z84n)ZdXC4Y99dglZjoc1VFLVv5LTFsng?6MqNJ?`@q%6<=G1xFQYgr2E^B?AMq znn4q@l0g&Gg9Xe?j7&@{$vX~d7;v+(YqfctvtVInWiUuK7 znSwoF9Ck2A$Up$3j7yj^CqFqcCnLYO#1JaRjYW(ZNz6b_oY%>$ndv5xKXxLNHgfZ*Bre!Po94h+#Y1}-i6_? zoPEQ#K($QQSO=xR-;uVx5x@2y{kqHG+v(Y%IoBJl8)QxLKcyvX&z>2ubjkerFIcJt zln(jtUU~iB_G8jNtizulTd_=(pXGP+x64Q64l|jC2uF!cH2PNhd7XCRb*=ZGl$a&w zUi4r*&Lqk(Jt3f9RGItCrb#=S7QJra{tzMa738$<4;Qpvn{9jV^q$o*W;?=nR!&*J z`4A~qeY>ti`adgV7ietQ;we_B{K7{=OnCcwPNSX^%O2W@Rdt8d z^lCg zsws><*8k3XYB4vqFfcVX)SheCD?GrrS|RmY{YQ^$r%%je-}-D*%!>CvW1swpk-Dv> zyXW!bZzd&21-CxXdTMk1np>B$`Hs>XYST5n~b2om9N`hU7e%s)Sc;NoQ7lSn70rB1)oW)@Lx#VG{AGiP*qoeev5< z=f$_XC+%*!%3yMxNrWZnJKKpHFMt2%P@AB8zTQ^kN}9`YJ*Jh1Cg~M2T$=snYuCOb Juk~Lo1^{R=3CsWh diff --git a/hugegraph-common/src/test/resources/publicCerts.store b/hugegraph-common/src/test/resources/publicCerts.store deleted file mode 100644 index e6624be937cb1506763c8ac0d6b432c12529e958..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 873 zcmezO_TO6u1_mY|W(3n*1*J(jnaRniMI}I?iW@sS{xYye=$RT=GB7Z!88k5~88k6H zSisE0$i&2wyyK9D0XG}FR-4B;3l?Tp27_cnZUas>=1>+kVJ2rk7>7fcDcA$XVFz=B z3>$ndv5xKXxLNHgfZ*Bre!Po94h+#Y1}-i6_?oPEQ#K($QQ zSO=xR-;uVx5x@2y{kqHG+v(Y%IoBJl8)QxLKcyvX&z>2ubjkerFIcJtln(jtUU~iB z_G8jNtizulTd_=(pXGP+x64Q64l|jC2uF!cH2PNhd7XCRb*=ZGl$a&wUi4r*&Lqk( zJt3f9RGItCrb#=S7QJra{tzMa738$<4;Qpvn{9jV^q$o*W;?=nR!&*J`4A~qeY>ti`adgV7ietQ;we_B{K7{=OnCcwPNSX^%O2W@Rdt8d^lCgsws><*8k3X zYB4vqFfcVX)SheCD?GrrS|RmY{YQ^$r%%je-}-D*%!>CvW1swpk-Dv>yXW!bZzd&2 z1-CxXdTMk1np>B$`Hs>XYST z5n~b2om9N`hU7e%s)Sc;NoQ7lSn70rB1)oW)@Lx#VG{AGiP*qoeev5<=f$_XC+%*! z%3yMxNrWZnJKKpHFMt2%P@AB8zTQ^kN}9{Vq7P;7nJfQH|NAU(!tJiojOD8D0o%(; AmH+?% From e339fed6c9978a55e20dae42ee753ed47f8b2e4a Mon Sep 17 00:00:00 2001 From: imbajin Date: Thu, 15 Dec 2022 18:28:15 +0800 Subject: [PATCH 194/217] fix(dist): generate doc & exit script when upload files failed --- hugegraph-common/pom.xml | 56 +----------------- hugegraph-dist/scripts/apache-release.sh | 12 ++-- hugegraph-rpc/pom.xml | 56 +----------------- pom.xml | 72 +++++++++++------------- 4 files changed, 46 insertions(+), 150 deletions(-) diff --git a/hugegraph-common/pom.xml b/hugegraph-common/pom.xml index cba4fefe0f..b75cdc5403 100644 --- a/hugegraph-common/pom.xml +++ b/hugegraph-common/pom.xml @@ -210,39 +210,12 @@ + org.apache.maven.plugins maven-compiler-plugin - - ${compiler.source} - ${compiler.target} - - 500 - - - -Xlint:unchecked - - org.apache.maven.plugins maven-jar-plugin - - - true - - - false - - - true - - - - - ${project.version} - - - @@ -273,45 +246,20 @@ - release + apache-release org.apache.maven.plugins maven-source-plugin - - - attach-sources - - jar-no-fork - - - org.apache.maven.plugins maven-javadoc-plugin - - - attach-javadocs - - jar - - - org.apache.maven.plugins maven-gpg-plugin - - - sign-artifacts - verify - - sign - - - diff --git a/hugegraph-dist/scripts/apache-release.sh b/hugegraph-dist/scripts/apache-release.sh index da29e3f1b0..3a4c800910 100755 --- a/hugegraph-dist/scripts/apache-release.sh +++ b/hugegraph-dist/scripts/apache-release.sh @@ -28,12 +28,15 @@ GIT_BRANCH="release-${RELEASE_VERSION}" RELEASE_VERSION=${RELEASE_VERSION:?"Please input the release version behind script"} -WORK_DIR=$(cd "$(dirname "$0")" || exit; pwd) +WORK_DIR=$( + cd "$(dirname "$0")" || exit + pwd +) cd "${WORK_DIR}" || exit echo "In the work dir: $(pwd)" # clean old dir then build a new one -rm -rfv dist && mkdir -p dist/apache-${REPO} +rm -rf dist && mkdir -p dist/apache-${REPO} # step1: package the source code cd ../../ || exit @@ -92,9 +95,10 @@ svn status ##### 4.3 commit & push files if [ "$USERNAME" = "" ]; then - svn commit -m "submit files for ${REPO} ${RELEASE_VERSION}" + svn commit -m "submit files for ${REPO} ${RELEASE_VERSION}" || exit else - svn commit -m "submit files for ${REPO} ${RELEASE_VERSION}" --username "${USERNAME}" --password "${PASSWORD}" + svn commit -m "submit files for ${REPO} ${RELEASE_VERSION}" \ + --username "${USERNAME}" --password "${PASSWORD}" || exit fi echo "Finished all, please check all steps in script manually again!" diff --git a/hugegraph-rpc/pom.xml b/hugegraph-rpc/pom.xml index ad5309d915..a6c15df21d 100644 --- a/hugegraph-rpc/pom.xml +++ b/hugegraph-rpc/pom.xml @@ -103,39 +103,12 @@ + org.apache.maven.plugins maven-compiler-plugin - - ${compiler.source} - ${compiler.target} - - 500 - - - -Xlint:unchecked - - org.apache.maven.plugins maven-jar-plugin - - - true - - - false - - - true - - - - - ${project.version} - - - @@ -166,45 +139,20 @@ - release + apache-release org.apache.maven.plugins maven-source-plugin - - - attach-sources - - jar-no-fork - - - org.apache.maven.plugins maven-javadoc-plugin - - - attach-javadocs - - jar - - - org.apache.maven.plugins maven-gpg-plugin - - - sign-artifacts - verify - - sign - - - diff --git a/pom.xml b/pom.xml index 4b62a7699e..98677233ea 100644 --- a/pom.xml +++ b/pom.xml @@ -28,9 +28,10 @@ ${project.artifactId} https://github.com/apache/hugegraph-commons - hugegraph-commons is a common module for HugeGraph-Common and HugeGraph-Rpc with their peripheral components. - It includes rpc frame, locks, configurations, events, iterators, rest and some - numeric or collection util classes to simplify the development of HugeGraph and its components. + hugegraph-commons is a common module for HugeGraph-Common and HugeGraph-Rpc with their + peripheral components. + It includes rpc frame, locks, configurations, events, iterators, rest and some numeric or + collection util classes to simplify the development of HugeGraph and its components. @@ -48,37 +49,37 @@ - - Apache Hugegraph(Incubating) - dev-subscribe@hugegraph.apache.org - https://hugegraph.apache.org/ - + + Apache Hugegraph(Incubating) + dev-subscribe@hugegraph.apache.org + https://hugegraph.apache.org/ + - - Developer List - dev-subscribe@hugegraph.apache.org - dev-unsubscribe@hugegraph.apache.org - dev@hugegraph.incubator.apache.org - - - Commits List - commits-subscribe@hugegraph.apache.org - commits-unsubscribe@hugegraph.apache.org - commits@hugegraph.apache.org - - - Issues List - issues-subscribe@hugegraph.apache.org - issues-unsubscribe@hugegraph.apache.org - issues@hugegraph.apache.org - + + Developer List + dev-subscribe@hugegraph.apache.org + dev-unsubscribe@hugegraph.apache.org + dev@hugegraph.incubator.apache.org + + + Commits List + commits-subscribe@hugegraph.apache.org + commits-unsubscribe@hugegraph.apache.org + commits@hugegraph.apache.org + + + Issues List + issues-subscribe@hugegraph.apache.org + issues-unsubscribe@hugegraph.apache.org + issues@hugegraph.apache.org + - Github Issues - https://github.com/apache/hugegraph-commons/issues + Github Issues + https://github.com/apache/hugegraph-commons/issues @@ -171,12 +172,8 @@ true - - false - - - true - + false + true .github/**/* From 1f64e8afb0123896b6c1e15a43ebba7cf2df6075 Mon Sep 17 00:00:00 2001 From: imbajin Date: Thu, 12 Jan 2023 18:05:27 +0800 Subject: [PATCH 196/217] chore: remove copyright in file header & fix some files --- .../hugegraph/concurrent/AtomicLock.java | 2 -- .../hugegraph/concurrent/BarrierEvent.java | 27 +++++++++---------- .../apache/hugegraph/concurrent/KeyLock.java | 2 -- .../hugegraph/concurrent/LockGroup.java | 2 -- .../hugegraph/concurrent/LockManager.java | 2 -- .../PausableScheduledThreadPool.java | 2 -- .../apache/hugegraph/concurrent/RowLock.java | 2 -- .../hugegraph/config/ConfigConvOption.java | 2 -- .../hugegraph/config/ConfigException.java | 2 -- .../config/ConfigListConvOption.java | 2 -- .../hugegraph/config/ConfigListOption.java | 2 -- .../apache/hugegraph/config/ConfigOption.java | 2 -- .../apache/hugegraph/config/HugeConfig.java | 2 -- .../hugegraph/config/OptionChecker.java | 2 -- .../apache/hugegraph/config/OptionHolder.java | 2 -- .../apache/hugegraph/config/OptionSpace.java | 2 -- .../apache/hugegraph/config/TypedOption.java | 2 -- .../apache/hugegraph/date/SafeDateFormat.java | 2 -- .../org/apache/hugegraph/event/Event.java | 2 -- .../org/apache/hugegraph/event/EventHub.java | 2 -- .../apache/hugegraph/event/EventListener.java | 2 -- .../apache/hugegraph/func/TriFunction.java | 2 -- .../iterator/BatchMapperIterator.java | 2 -- .../org/apache/hugegraph/iterator/CIter.java | 2 -- .../iterator/ExtendableIterator.java | 2 -- .../hugegraph/iterator/FilterIterator.java | 2 -- .../iterator/FlatMapperFilterIterator.java | 2 -- .../iterator/FlatMapperIterator.java | 2 -- .../hugegraph/iterator/LimitIterator.java | 2 -- .../hugegraph/iterator/ListIterator.java | 2 -- .../hugegraph/iterator/MapperIterator.java | 2 -- .../hugegraph/iterator/Metadatable.java | 2 -- .../hugegraph/iterator/WrappedIterator.java | 2 -- .../hugegraph/license/LicenseCommonParam.java | 2 -- .../hugegraph/license/LicenseCreateParam.java | 2 -- .../hugegraph/license/LicenseExtraParam.java | 2 -- .../license/LicenseInstallParam.java | 2 -- .../hugegraph/license/LicenseManager.java | 2 -- .../license/LicenseManagerFactory.java | 2 -- .../hugegraph/license/LicenseParams.java | 2 -- .../apache/hugegraph/license/MachineInfo.java | 2 -- .../apache/hugegraph/perf/LightStopwatch.java | 2 -- .../hugegraph/perf/NormalStopwatch.java | 2 -- .../org/apache/hugegraph/perf/PerfUtil.java | 2 -- .../org/apache/hugegraph/perf/Stopwatch.java | 2 -- .../hugegraph/rest/AbstractRestClient.java | 2 -- .../hugegraph/rest/ClientException.java | 2 -- .../org/apache/hugegraph/rest/RestClient.java | 2 -- .../org/apache/hugegraph/rest/RestResult.java | 2 -- .../hugegraph/rest/SerializeException.java | 2 -- .../org/apache/hugegraph/testutil/Assert.java | 2 -- .../apache/hugegraph/testutil/Whitebox.java | 2 -- .../java/org/apache/hugegraph/util/Bytes.java | 2 -- .../apache/hugegraph/util/CollectionUtil.java | 2 -- .../org/apache/hugegraph/util/DateUtil.java | 2 -- .../java/org/apache/hugegraph/util/E.java | 2 -- .../apache/hugegraph/util/ExecutorUtil.java | 2 -- .../org/apache/hugegraph/util/HashUtil.java | 2 -- .../hugegraph/util/InsertionOrderUtil.java | 2 -- .../java/org/apache/hugegraph/util/Log.java | 2 -- .../apache/hugegraph/util/OrderLimitMap.java | 2 -- .../apache/hugegraph/util/ReflectionUtil.java | 2 -- .../org/apache/hugegraph/util/StringUtil.java | 2 -- .../org/apache/hugegraph/util/TimeUtil.java | 2 -- .../org/apache/hugegraph/util/UnitUtil.java | 2 -- .../apache/hugegraph/util/VersionUtil.java | 2 -- .../hugegraph/version/CommonVersion.java | 2 -- .../apache/hugegraph/testutil/AssertTest.java | 2 -- .../hugegraph/testutil/WhiteboxTest.java | 2 -- .../apache/hugegraph/unit/BaseUnitTest.java | 2 -- .../apache/hugegraph/unit/UnitTestSuite.java | 2 -- .../unit/concurrent/AtomicLockTest.java | 2 -- .../unit/concurrent/BarrierEventTest.java | 2 -- .../unit/concurrent/KeyLockTest.java | 2 -- .../unit/concurrent/LockGroupTest.java | 2 -- .../unit/concurrent/LockManagerTest.java | 2 -- .../PausableScheduledThreadPoolTest.java | 2 -- .../unit/concurrent/RowLockTest.java | 2 -- .../hugegraph/unit/config/HugeConfigTest.java | 2 -- .../unit/config/OptionSpaceTest.java | 2 -- .../unit/date/SafeDateFormatTest.java | 2 -- .../hugegraph/unit/event/EventHubTest.java | 2 -- .../iterator/BatchMapperIteratorTest.java | 2 -- .../unit/iterator/ExtendableIteratorTest.java | 2 -- .../unit/iterator/FilterIteratorTest.java | 2 -- .../FlatMapperFilterIteratorTest.java | 2 -- .../unit/iterator/FlatMapperIteratorTest.java | 2 -- .../unit/iterator/LimitIteratorTest.java | 2 -- .../unit/iterator/ListIteratorTest.java | 2 -- .../unit/iterator/MapperIteratorTest.java | 2 -- .../unit/license/LicenseCreateParamTest.java | 2 -- .../unit/license/LicenseExtraParamTest.java | 2 -- .../unit/license/LicenseInstallParamTest.java | 2 -- .../unit/license/LicenseParamsTest.java | 2 -- .../unit/license/MachineInfoTest.java | 2 -- .../hugegraph/unit/perf/PerfUtilTest.java | 2 -- .../hugegraph/unit/perf/StopwatchTest.java | 2 -- .../unit/perf/testclass/TestClass.java | 2 -- .../unit/perf/testclass/TestLightClass.java | 2 -- .../unit/perf/testclass/TestPerfClass.java | 2 -- .../perf/testclass/TestPerfLightClass.java | 2 -- .../perf/testclass2/TestClass4Package.java | 2 -- .../hugegraph/unit/rest/RestClientTest.java | 2 -- .../hugegraph/unit/rest/RestResultTest.java | 2 -- .../apache/hugegraph/unit/util/BytesTest.java | 2 -- .../unit/util/CollectionUtilTest.java | 2 -- .../hugegraph/unit/util/DateUtilTest.java | 2 -- .../hugegraph/unit/util/EcheckTest.java | 2 -- .../hugegraph/unit/util/HashUtilTest.java | 2 -- .../unit/util/InsertionOrderUtilTest.java | 2 -- .../apache/hugegraph/unit/util/LogTest.java | 2 -- .../hugegraph/unit/util/LongEncodingTest.java | 2 -- .../hugegraph/unit/util/NumericUtilTest.java | 2 -- .../unit/util/OrderLimitMapTest.java | 2 -- .../unit/util/ReflectionUtilTest.java | 2 -- .../hugegraph/unit/util/StringUtilTest.java | 2 -- .../hugegraph/unit/util/TimeUtilTest.java | 2 -- .../hugegraph/unit/util/UnitUtilTest.java | 2 -- .../hugegraph/unit/util/VersionUtilTest.java | 2 -- .../hugegraph/unit/version/VersionTest.java | 2 -- .../apache/hugegraph/config/RpcOptions.java | 2 -- .../hugegraph/rpc/RpcClientProvider.java | 2 -- .../apache/hugegraph/rpc/RpcCommonConfig.java | 2 -- .../hugegraph/rpc/RpcConsumerConfig.java | 2 -- .../apache/hugegraph/rpc/RpcException.java | 2 -- .../hugegraph/rpc/RpcProviderConfig.java | 2 -- .../org/apache/hugegraph/rpc/RpcServer.java | 2 -- .../rpc/RpcServiceConfig4Client.java | 2 -- .../rpc/RpcServiceConfig4Server.java | 2 -- .../apache/hugegraph/version/RpcVersion.java | 2 -- .../apache/hugegraph/unit/BaseUnitTest.java | 2 -- .../apache/hugegraph/unit/ExceptionTest.java | 2 -- .../hugegraph/unit/ServerClientTest.java | 2 -- .../apache/hugegraph/unit/UnitTestSuite.java | 2 -- .../apache/hugegraph/unit/VersionTest.java | 2 -- .../test/resources/rpc-client-lb.properties | 17 ++++++++++++ .../src/test/resources/rpc-client.properties | 17 ++++++++++++ .../test/resources/rpc-client345.properties | 17 ++++++++++++ .../test/resources/rpc-client346.properties | 17 ++++++++++++ .../test/resources/rpc-client67.properties | 17 ++++++++++++ .../resources/rpc-server-adaptive.properties | 17 ++++++++++++ .../resources/rpc-server-random.properties | 17 ++++++++++++ .../src/test/resources/rpc-server.properties | 17 ++++++++++++ .../resources/rpc-server1-client.properties | 17 ++++++++++++ .../resources/rpc-server2-client.properties | 17 ++++++++++++ .../src/test/resources/rpc-server3.properties | 17 ++++++++++++ .../src/test/resources/rpc-server4.properties | 17 ++++++++++++ .../src/test/resources/rpc-server5.properties | 17 ++++++++++++ style/checkstyle.xml | 16 +++++++++++ 149 files changed, 249 insertions(+), 283 deletions(-) diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/AtomicLock.java b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/AtomicLock.java index 7c9a4c0aac..6f7a669d7d 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/AtomicLock.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/AtomicLock.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/BarrierEvent.java b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/BarrierEvent.java index 1c89d11d04..3c8734d16d 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/BarrierEvent.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/BarrierEvent.java @@ -1,21 +1,18 @@ /* + * 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 * - * Copyright 2017 HugeGraph Authors + * http://www.apache.org/licenses/LICENSE-2.0 * - * 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. + * 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.concurrent; diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/KeyLock.java b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/KeyLock.java index 351f50cf0b..44ca8803ca 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/KeyLock.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/KeyLock.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/LockGroup.java b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/LockGroup.java index 17b7347cdf..aa864ecaf8 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/LockGroup.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/LockGroup.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/LockManager.java b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/LockManager.java index d2c60980da..e686c67895 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/LockManager.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/LockManager.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/PausableScheduledThreadPool.java b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/PausableScheduledThreadPool.java index ddfc8b72f5..a820aeb638 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/PausableScheduledThreadPool.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/PausableScheduledThreadPool.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/RowLock.java b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/RowLock.java index 1eb18f649c..3908803771 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/RowLock.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/RowLock.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigConvOption.java b/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigConvOption.java index 5966176c29..bb794ec48b 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigConvOption.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigConvOption.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigException.java b/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigException.java index cd7981368c..51ba0c2f55 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigException.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigException.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigListConvOption.java b/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigListConvOption.java index 32351b4fa0..79996c3680 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigListConvOption.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigListConvOption.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigListOption.java b/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigListOption.java index 7bba7ec2fd..0a41e3b7e4 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigListOption.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigListOption.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigOption.java b/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigOption.java index d85d508aff..159f13901f 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigOption.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigOption.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/config/HugeConfig.java b/hugegraph-common/src/main/java/org/apache/hugegraph/config/HugeConfig.java index 17088ea3c8..b765369f4e 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/config/HugeConfig.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/config/HugeConfig.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionChecker.java b/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionChecker.java index 0e795ff15d..77364e1789 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionChecker.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionChecker.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionHolder.java b/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionHolder.java index 39c0dad94b..8f4ddca764 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionHolder.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionHolder.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionSpace.java b/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionSpace.java index 0c4d94aaa3..7193d23deb 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionSpace.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionSpace.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/config/TypedOption.java b/hugegraph-common/src/main/java/org/apache/hugegraph/config/TypedOption.java index 59ed9da3ac..fc2c7de2ff 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/config/TypedOption.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/config/TypedOption.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/date/SafeDateFormat.java b/hugegraph-common/src/main/java/org/apache/hugegraph/date/SafeDateFormat.java index 9f9a665f5b..716880568a 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/date/SafeDateFormat.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/date/SafeDateFormat.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/event/Event.java b/hugegraph-common/src/main/java/org/apache/hugegraph/event/Event.java index fccc1cd8e3..b9cf87fa76 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/event/Event.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/event/Event.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventHub.java b/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventHub.java index 2db8347429..0886e7e981 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventHub.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventHub.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventListener.java b/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventListener.java index 3810926f02..24fc594a5b 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventListener.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventListener.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/func/TriFunction.java b/hugegraph-common/src/main/java/org/apache/hugegraph/func/TriFunction.java index 0e5fbb4682..4b086440bc 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/func/TriFunction.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/func/TriFunction.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/BatchMapperIterator.java b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/BatchMapperIterator.java index 39be041e52..795ba61f93 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/BatchMapperIterator.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/BatchMapperIterator.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/CIter.java b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/CIter.java index fdaa8dc61c..249d8dc8e4 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/CIter.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/CIter.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/ExtendableIterator.java b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/ExtendableIterator.java index a07f3e47b2..94c734b988 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/ExtendableIterator.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/ExtendableIterator.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FilterIterator.java b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FilterIterator.java index 8b546efea3..d467f5151a 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FilterIterator.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FilterIterator.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FlatMapperFilterIterator.java b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FlatMapperFilterIterator.java index fe552326a3..e202a1dffe 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FlatMapperFilterIterator.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FlatMapperFilterIterator.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FlatMapperIterator.java b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FlatMapperIterator.java index 92cd451e98..3273ab8ec8 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FlatMapperIterator.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FlatMapperIterator.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/LimitIterator.java b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/LimitIterator.java index 6a166af79d..9df6299a6b 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/LimitIterator.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/LimitIterator.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/ListIterator.java b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/ListIterator.java index 9ca190f125..77d54765fd 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/ListIterator.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/ListIterator.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/MapperIterator.java b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/MapperIterator.java index 9d523b5fb4..f93d4ab5d3 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/MapperIterator.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/MapperIterator.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/Metadatable.java b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/Metadatable.java index 777e46801c..992138ab53 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/Metadatable.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/Metadatable.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/WrappedIterator.java b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/WrappedIterator.java index 6eb2f59f05..9836d997c7 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/WrappedIterator.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/WrappedIterator.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseCommonParam.java b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseCommonParam.java index 6cb5b8940d..dac13e8d1a 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseCommonParam.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseCommonParam.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseCreateParam.java b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseCreateParam.java index c14b2403ba..d67f8a2a3d 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseCreateParam.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseCreateParam.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseExtraParam.java b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseExtraParam.java index 361acb5de4..4f563ebce2 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseExtraParam.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseExtraParam.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseInstallParam.java b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseInstallParam.java index 462029f342..3717e5d518 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseInstallParam.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseInstallParam.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseManager.java b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseManager.java index f87b9ebb9a..47bb886b07 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseManager.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseManager.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseManagerFactory.java b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseManagerFactory.java index c14ddca232..5794663175 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseManagerFactory.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseManagerFactory.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseParams.java b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseParams.java index dcc4146d6a..94b9dd15c0 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseParams.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseParams.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/license/MachineInfo.java b/hugegraph-common/src/main/java/org/apache/hugegraph/license/MachineInfo.java index 63d09de9a1..cd106921ea 100755 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/license/MachineInfo.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/license/MachineInfo.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/LightStopwatch.java b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/LightStopwatch.java index ca81082e6f..6bdbcaad37 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/LightStopwatch.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/LightStopwatch.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/NormalStopwatch.java b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/NormalStopwatch.java index c595a34395..40901434e8 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/NormalStopwatch.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/NormalStopwatch.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java index 36b5c05157..456611b6d4 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/Stopwatch.java b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/Stopwatch.java index 15f7a234f7..487c778820 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/Stopwatch.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/Stopwatch.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java index e6708c5c0f..37c4df86b4 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/ClientException.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/ClientException.java index 0188a3a26a..ba954a28ff 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/ClientException.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/ClientException.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClient.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClient.java index 06347b3b06..dc3b7b7425 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClient.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClient.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestResult.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestResult.java index 440deabe43..813aeff3d9 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestResult.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestResult.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/SerializeException.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/SerializeException.java index eedac9074c..857ea9427d 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/SerializeException.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/SerializeException.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Assert.java b/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Assert.java index 5e09cb83d0..218342ea42 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Assert.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Assert.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Whitebox.java b/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Whitebox.java index db92f6241a..73d8ee2afd 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Whitebox.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Whitebox.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/Bytes.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/Bytes.java index 43f091cb89..79ece63a78 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/Bytes.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/Bytes.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/CollectionUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/CollectionUtil.java index 6e04858be7..f719b8a552 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/CollectionUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/CollectionUtil.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/DateUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/DateUtil.java index b34ebb15ae..43c58f8098 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/DateUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/DateUtil.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/E.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/E.java index 52acdd3870..162999c68a 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/E.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/E.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/ExecutorUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/ExecutorUtil.java index 1058c9861a..9f37c83285 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/ExecutorUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/ExecutorUtil.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/HashUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/HashUtil.java index 443295e12c..fa382f7d10 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/HashUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/HashUtil.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/InsertionOrderUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/InsertionOrderUtil.java index 929cd6c85a..bb80ff602d 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/InsertionOrderUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/InsertionOrderUtil.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/Log.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/Log.java index 1192e9db1d..0338272d83 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/Log.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/Log.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/OrderLimitMap.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/OrderLimitMap.java index d8b0cc6ffc..b8ce47152c 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/OrderLimitMap.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/OrderLimitMap.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/ReflectionUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/ReflectionUtil.java index 812a962ae5..f48d5b6c78 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/ReflectionUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/ReflectionUtil.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/StringUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/StringUtil.java index d717510052..f144957db5 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/StringUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/StringUtil.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/TimeUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/TimeUtil.java index 69394df87d..8a6b9abeb2 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/TimeUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/TimeUtil.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/UnitUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/UnitUtil.java index 30c1beee05..09e1ff6379 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/UnitUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/UnitUtil.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java index 8d633f02d1..c7d6c2ede9 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/version/CommonVersion.java b/hugegraph-common/src/main/java/org/apache/hugegraph/version/CommonVersion.java index 8dfbc13e04..e2fa83a385 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/version/CommonVersion.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/version/CommonVersion.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/testutil/AssertTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/testutil/AssertTest.java index 0f30bbd2c6..cf08fdaff5 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/testutil/AssertTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/testutil/AssertTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/testutil/WhiteboxTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/testutil/WhiteboxTest.java index f6ebf6dd4a..15124edbcc 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/testutil/WhiteboxTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/testutil/WhiteboxTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java index c93b78a9c9..96133d40f0 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/UnitTestSuite.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/UnitTestSuite.java index 05219878ca..838928193c 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/UnitTestSuite.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/UnitTestSuite.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/AtomicLockTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/AtomicLockTest.java index 02265ad191..1b2807aa30 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/AtomicLockTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/AtomicLockTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/BarrierEventTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/BarrierEventTest.java index bc69386a33..254f3eb3de 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/BarrierEventTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/BarrierEventTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/KeyLockTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/KeyLockTest.java index b690e3525e..3f142be764 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/KeyLockTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/KeyLockTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/LockGroupTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/LockGroupTest.java index 0d0d064300..961fdde7e8 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/LockGroupTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/LockGroupTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/LockManagerTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/LockManagerTest.java index edb628b273..e0efa80645 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/LockManagerTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/LockManagerTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java index a477344deb..c10b3b8756 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/RowLockTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/RowLockTest.java index 0fd666146f..b845da46d3 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/RowLockTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/RowLockTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/HugeConfigTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/HugeConfigTest.java index 7664f7847d..4cc04cb4d0 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/HugeConfigTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/HugeConfigTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/OptionSpaceTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/OptionSpaceTest.java index cfb35e5cf5..ab794faf5d 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/OptionSpaceTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/OptionSpaceTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/date/SafeDateFormatTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/date/SafeDateFormatTest.java index 68bad8c330..30729ebab4 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/date/SafeDateFormatTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/date/SafeDateFormatTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/event/EventHubTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/event/EventHubTest.java index b5b1591956..dff0227022 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/event/EventHubTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/event/EventHubTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/BatchMapperIteratorTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/BatchMapperIteratorTest.java index 78bd08cb0b..52bc632c0a 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/BatchMapperIteratorTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/BatchMapperIteratorTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ExtendableIteratorTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ExtendableIteratorTest.java index fc1e9f3bae..5e08f2d9c8 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ExtendableIteratorTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ExtendableIteratorTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FilterIteratorTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FilterIteratorTest.java index 845c5c642f..6761ef60be 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FilterIteratorTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FilterIteratorTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java index 5370fe3359..6a3b658332 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperIteratorTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperIteratorTest.java index f286dd47b7..641b6fc379 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperIteratorTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperIteratorTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/LimitIteratorTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/LimitIteratorTest.java index 9a9f7ca0d9..f087e7df3e 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/LimitIteratorTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/LimitIteratorTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ListIteratorTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ListIteratorTest.java index d6949bf5f5..659ab482ed 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ListIteratorTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ListIteratorTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/MapperIteratorTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/MapperIteratorTest.java index c8878cab4f..4f36e857ce 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/MapperIteratorTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/MapperIteratorTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseCreateParamTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseCreateParamTest.java index a00307ba7d..67e6a54808 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseCreateParamTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseCreateParamTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseExtraParamTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseExtraParamTest.java index 65f9defd5b..b24470d2a4 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseExtraParamTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseExtraParamTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseInstallParamTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseInstallParamTest.java index 8b3bbc47ef..ed38d93f6f 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseInstallParamTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseInstallParamTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseParamsTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseParamsTest.java index 75e74f2600..9a2968d6f8 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseParamsTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseParamsTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/MachineInfoTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/MachineInfoTest.java index dfe3dc74ad..9dc69cbdb9 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/MachineInfoTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/MachineInfoTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/PerfUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/PerfUtilTest.java index 218afbcf11..1fcb50711a 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/PerfUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/PerfUtilTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/StopwatchTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/StopwatchTest.java index 63ef77d084..6a6c7865d9 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/StopwatchTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/StopwatchTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestClass.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestClass.java index 455c1707f0..fcc90b9813 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestClass.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestClass.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestLightClass.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestLightClass.java index 658b654bc3..fd2e334bad 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestLightClass.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestLightClass.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestPerfClass.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestPerfClass.java index 9e53fa6a50..a9146f727e 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestPerfClass.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestPerfClass.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestPerfLightClass.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestPerfLightClass.java index 4f5939ed77..430b9ac97a 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestPerfLightClass.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestPerfLightClass.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass2/TestClass4Package.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass2/TestClass4Package.java index ffd76cdb19..9a29c2ab56 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass2/TestClass4Package.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass2/TestClass4Package.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestClientTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestClientTest.java index 0badaee10a..eb9c7c297f 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestClientTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestClientTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestResultTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestResultTest.java index 141b5f5081..2ae9a4ee54 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestResultTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestResultTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/BytesTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/BytesTest.java index 0867a7f7c1..7ecc59cbd0 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/BytesTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/BytesTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/CollectionUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/CollectionUtilTest.java index 23ffff74c9..71a440cd23 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/CollectionUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/CollectionUtilTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/DateUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/DateUtilTest.java index 051253f5f0..7c51406b36 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/DateUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/DateUtilTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/EcheckTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/EcheckTest.java index 59f70f51d3..c87bbf6271 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/EcheckTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/EcheckTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/HashUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/HashUtilTest.java index 6ba5d4a915..3efde1b55d 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/HashUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/HashUtilTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/InsertionOrderUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/InsertionOrderUtilTest.java index 9dc49a402b..b2776a7d7f 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/InsertionOrderUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/InsertionOrderUtilTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/LogTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/LogTest.java index dac5ece0f4..9ab55c8fd3 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/LogTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/LogTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/LongEncodingTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/LongEncodingTest.java index a3f1518ef8..8e822058c8 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/LongEncodingTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/LongEncodingTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/NumericUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/NumericUtilTest.java index 5278427d05..fc1f0d6149 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/NumericUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/NumericUtilTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/OrderLimitMapTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/OrderLimitMapTest.java index 048cd1360c..de8375c102 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/OrderLimitMapTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/OrderLimitMapTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/ReflectionUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/ReflectionUtilTest.java index 6c5e62098a..510d1454bd 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/ReflectionUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/ReflectionUtilTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/StringUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/StringUtilTest.java index d271ae93b1..c7aab1532c 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/StringUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/StringUtilTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/TimeUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/TimeUtilTest.java index 453de2f106..2fc34f0bb5 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/TimeUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/TimeUtilTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/UnitUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/UnitUtilTest.java index 8b383034de..56eb73f4d4 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/UnitUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/UnitUtilTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/VersionUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/VersionUtilTest.java index b405e7daf6..25f6ef129a 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/VersionUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/VersionUtilTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/version/VersionTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/version/VersionTest.java index 12e3c659bb..432d66ee31 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/version/VersionTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/version/VersionTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/config/RpcOptions.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/config/RpcOptions.java index e4c9730fad..09adcbab84 100644 --- a/hugegraph-rpc/src/main/java/org/apache/hugegraph/config/RpcOptions.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/config/RpcOptions.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcClientProvider.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcClientProvider.java index 826c013a26..2b50468b9f 100644 --- a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcClientProvider.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcClientProvider.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcCommonConfig.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcCommonConfig.java index 475a82a916..37ec980302 100644 --- a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcCommonConfig.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcCommonConfig.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcConsumerConfig.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcConsumerConfig.java index 796f8fbe2b..c489f5cd9b 100644 --- a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcConsumerConfig.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcConsumerConfig.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcException.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcException.java index 6fc2f2493d..59e80f3d53 100644 --- a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcException.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcException.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcProviderConfig.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcProviderConfig.java index bc6d322d2d..dafdfcf5a4 100644 --- a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcProviderConfig.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcProviderConfig.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServer.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServer.java index 576ad8180b..fe0b91ac58 100644 --- a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServer.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServer.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Client.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Client.java index 333f0abc8a..b08d6327d1 100644 --- a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Client.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Client.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Server.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Server.java index 0deabfd227..cd0290900e 100644 --- a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Server.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Server.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/version/RpcVersion.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/version/RpcVersion.java index 753ef2fb19..70be408cdf 100644 --- a/hugegraph-rpc/src/main/java/org/apache/hugegraph/version/RpcVersion.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/version/RpcVersion.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java b/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java index 9d1e0d7731..919ba151f0 100644 --- a/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java +++ b/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ExceptionTest.java b/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ExceptionTest.java index c70d00b71a..ae5f2edc43 100644 --- a/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ExceptionTest.java +++ b/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ExceptionTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ServerClientTest.java b/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ServerClientTest.java index 8daa37e1f8..6b800c02c2 100644 --- a/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ServerClientTest.java +++ b/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ServerClientTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/UnitTestSuite.java b/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/UnitTestSuite.java index ed422950d1..a19b5522c8 100644 --- a/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/UnitTestSuite.java +++ b/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/UnitTestSuite.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/VersionTest.java b/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/VersionTest.java index fae9fb84f1..56d0bc552c 100644 --- a/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/VersionTest.java +++ b/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/VersionTest.java @@ -1,6 +1,4 @@ /* - * Copyright 2017 HugeGraph Authors - * * 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 diff --git a/hugegraph-rpc/src/test/resources/rpc-client-lb.properties b/hugegraph-rpc/src/test/resources/rpc-client-lb.properties index fb8cad866d..3040bf78cd 100644 --- a/hugegraph-rpc/src/test/resources/rpc-client-lb.properties +++ b/hugegraph-rpc/src/test/resources/rpc-client-lb.properties @@ -1,3 +1,20 @@ +# +# 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. +# + #rpc.server_host=127.0.0.1 #rpc.server_port=8090 #rpc.server_timeout=30 diff --git a/hugegraph-rpc/src/test/resources/rpc-client.properties b/hugegraph-rpc/src/test/resources/rpc-client.properties index 16b23f333f..332a4fb5a5 100644 --- a/hugegraph-rpc/src/test/resources/rpc-client.properties +++ b/hugegraph-rpc/src/test/resources/rpc-client.properties @@ -1,3 +1,20 @@ +# +# 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. +# + #rpc.server_host=127.0.0.1 #rpc.server_port=8090 #rpc.server_timeout=30 diff --git a/hugegraph-rpc/src/test/resources/rpc-client345.properties b/hugegraph-rpc/src/test/resources/rpc-client345.properties index 1a4fa00271..ef6b36dc27 100644 --- a/hugegraph-rpc/src/test/resources/rpc-client345.properties +++ b/hugegraph-rpc/src/test/resources/rpc-client345.properties @@ -1,3 +1,20 @@ +# +# 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. +# + #rpc.server_host=127.0.0.1 #rpc.server_port=8090 #rpc.server_timeout=30 diff --git a/hugegraph-rpc/src/test/resources/rpc-client346.properties b/hugegraph-rpc/src/test/resources/rpc-client346.properties index dbcede57a4..6c651bcabb 100644 --- a/hugegraph-rpc/src/test/resources/rpc-client346.properties +++ b/hugegraph-rpc/src/test/resources/rpc-client346.properties @@ -1,3 +1,20 @@ +# +# 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. +# + #rpc.server_host=127.0.0.1 #rpc.server_port=8090 #rpc.server_timeout=30 diff --git a/hugegraph-rpc/src/test/resources/rpc-client67.properties b/hugegraph-rpc/src/test/resources/rpc-client67.properties index 692d7cefc9..7c266da60d 100644 --- a/hugegraph-rpc/src/test/resources/rpc-client67.properties +++ b/hugegraph-rpc/src/test/resources/rpc-client67.properties @@ -1,3 +1,20 @@ +# +# 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. +# + #rpc.server_host=127.0.0.1 #rpc.server_port=8090 #rpc.server_timeout=30 diff --git a/hugegraph-rpc/src/test/resources/rpc-server-adaptive.properties b/hugegraph-rpc/src/test/resources/rpc-server-adaptive.properties index ae92732d31..043f99cda7 100644 --- a/hugegraph-rpc/src/test/resources/rpc-server-adaptive.properties +++ b/hugegraph-rpc/src/test/resources/rpc-server-adaptive.properties @@ -1,3 +1,20 @@ +# +# 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. +# + rpc.server_host=127.0.0.1 rpc.server_port=8098 rpc.server_adaptive_port=true diff --git a/hugegraph-rpc/src/test/resources/rpc-server-random.properties b/hugegraph-rpc/src/test/resources/rpc-server-random.properties index 5be8331dc7..6fd695764b 100644 --- a/hugegraph-rpc/src/test/resources/rpc-server-random.properties +++ b/hugegraph-rpc/src/test/resources/rpc-server-random.properties @@ -1,3 +1,20 @@ +# +# 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. +# + rpc.server_host=127.0.0.1 rpc.server_port=0 #rpc.server_timeout=30 diff --git a/hugegraph-rpc/src/test/resources/rpc-server.properties b/hugegraph-rpc/src/test/resources/rpc-server.properties index a22bf7ee1d..baaf638b4c 100644 --- a/hugegraph-rpc/src/test/resources/rpc-server.properties +++ b/hugegraph-rpc/src/test/resources/rpc-server.properties @@ -1,3 +1,20 @@ +# +# 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. +# + rpc.server_host=127.0.0.1 rpc.server_port=8090 #rpc.server_timeout=30 diff --git a/hugegraph-rpc/src/test/resources/rpc-server1-client.properties b/hugegraph-rpc/src/test/resources/rpc-server1-client.properties index a3907584d9..d40a797f6f 100644 --- a/hugegraph-rpc/src/test/resources/rpc-server1-client.properties +++ b/hugegraph-rpc/src/test/resources/rpc-server1-client.properties @@ -1,3 +1,20 @@ +# +# 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. +# + rpc.server_host=127.0.0.1 rpc.server_port=8091 #rpc.server_timeout=30 diff --git a/hugegraph-rpc/src/test/resources/rpc-server2-client.properties b/hugegraph-rpc/src/test/resources/rpc-server2-client.properties index e0298ed76f..b368a0a403 100644 --- a/hugegraph-rpc/src/test/resources/rpc-server2-client.properties +++ b/hugegraph-rpc/src/test/resources/rpc-server2-client.properties @@ -1,3 +1,20 @@ +# +# 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. +# + rpc.server_host=127.0.0.1 rpc.server_port=8092 #rpc.server_timeout=30 diff --git a/hugegraph-rpc/src/test/resources/rpc-server3.properties b/hugegraph-rpc/src/test/resources/rpc-server3.properties index 004757cb4b..56c5719f21 100644 --- a/hugegraph-rpc/src/test/resources/rpc-server3.properties +++ b/hugegraph-rpc/src/test/resources/rpc-server3.properties @@ -1,3 +1,20 @@ +# +# 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. +# + rpc.server_host=127.0.0.1 rpc.server_port=8093 #rpc.server_timeout=30 diff --git a/hugegraph-rpc/src/test/resources/rpc-server4.properties b/hugegraph-rpc/src/test/resources/rpc-server4.properties index 607b751b4d..1cb7e582d5 100644 --- a/hugegraph-rpc/src/test/resources/rpc-server4.properties +++ b/hugegraph-rpc/src/test/resources/rpc-server4.properties @@ -1,3 +1,20 @@ +# +# 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. +# + rpc.server_host=127.0.0.1 rpc.server_port=8094 #rpc.server_timeout=30 diff --git a/hugegraph-rpc/src/test/resources/rpc-server5.properties b/hugegraph-rpc/src/test/resources/rpc-server5.properties index dbeb1e97a2..ec7b647172 100644 --- a/hugegraph-rpc/src/test/resources/rpc-server5.properties +++ b/hugegraph-rpc/src/test/resources/rpc-server5.properties @@ -1,3 +1,20 @@ +# +# 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. +# + rpc.server_host=127.0.0.1 rpc.server_port=8095 #rpc.server_timeout=30 diff --git a/style/checkstyle.xml b/style/checkstyle.xml index c2429281af..c6099a8d47 100644 --- a/style/checkstyle.xml +++ b/style/checkstyle.xml @@ -1,4 +1,20 @@ + From 8724b120322d97cfa99b094192555d7421ed7fb3 Mon Sep 17 00:00:00 2001 From: imbajin Date: Thu, 12 Jan 2023 18:12:50 +0800 Subject: [PATCH 197/217] chore: fix copyright year and format --- .github/{workflows => outdated}/release.yml | 0 LICENSE | 2 +- NOTICE | 2 ++ hugegraph-dist/release-docs/NOTICE | 6 ++++-- 4 files changed, 7 insertions(+), 3 deletions(-) rename .github/{workflows => outdated}/release.yml (100%) diff --git a/.github/workflows/release.yml b/.github/outdated/release.yml similarity index 100% rename from .github/workflows/release.yml rename to .github/outdated/release.yml diff --git a/LICENSE b/LICENSE index e06d208186..8f71f43fee 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Apache License + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ diff --git a/NOTICE b/NOTICE index 6be2560f99..42f88212ea 100644 --- a/NOTICE +++ b/NOTICE @@ -3,3 +3,5 @@ Copyright 2022-2023 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). + +The initial codebase was donated to the ASF by HugeGraph Authors, copyright 2017-2021. diff --git a/hugegraph-dist/release-docs/NOTICE b/hugegraph-dist/release-docs/NOTICE index eddc8b226c..ec465a4662 100644 --- a/hugegraph-dist/release-docs/NOTICE +++ b/hugegraph-dist/release-docs/NOTICE @@ -1,9 +1,11 @@ -Apache HugeGraph -Copyright 2021-2022 The Apache Software Foundation +Apache HugeGraph(incubating) +Copyright 2022-2023 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). +The initial codebase was donated to the ASF by HugeGraph Authors, copyright 2017-2021. + ======================================================================== commons-logging NOTICE From e1cb3eb16ca46dbb9a8d6698594678d483e4af5c Mon Sep 17 00:00:00 2001 From: imbajin Date: Sat, 4 Feb 2023 01:52:42 +0800 Subject: [PATCH 198/217] chore(license): fix 3rd party refer code (#127) * fix 3rd party refer in LICENSE * add sky-walking action to check license header * Update pom.xml --- .github/workflows/check-dependencies.yml | 11 ++- .github/workflows/ci.yml | 9 ++- .github/workflows/license-checker.yml | 34 ++++++++ .github/workflows/stale.yml | 4 +- .licenserc.yaml | 79 +++++++++++++++++++ .../hugegraph/rest/AbstractRestClient.java | 9 +-- .../java/org/apache/hugegraph/util/Bytes.java | 3 +- .../apache/hugegraph/util/CheckSocket.java | 66 ++++++---------- .../org/apache/hugegraph/util/DateUtil.java | 6 +- .../java/org/apache/hugegraph/util/E.java | 4 +- .../apache/hugegraph/util/LongEncoding.java | 4 - .../apache/hugegraph/util/NumericUtil.java | 9 +-- .../apache/hugegraph/util/OrderLimitMap.java | 9 +-- .../apache/hugegraph/util/VersionUtil.java | 5 -- pom.xml | 2 - 15 files changed, 163 insertions(+), 91 deletions(-) create mode 100644 .github/workflows/license-checker.yml create mode 100644 .licenserc.yaml diff --git a/.github/workflows/check-dependencies.yml b/.github/workflows/check-dependencies.yml index f6b35c4160..fe8b2d55c4 100644 --- a/.github/workflows/check-dependencies.yml +++ b/.github/workflows/check-dependencies.yml @@ -1,6 +1,11 @@ name: third-party dependencies check -on: [push, pull_request] +on: + push: + branches: + - master + - /^release-.*$/ + pull_request: jobs: build: @@ -10,10 +15,10 @@ jobs: steps: - name: Checkout source uses: actions/checkout@v3 - - name: Set up JDK 8 + - name: Set up JDK 11 uses: actions/setup-java@v3 with: - java-version: '8' + java-version: '11' distribution: 'adopt' - name: mvn install run: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b7f08d93b..b2552479e7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ on: jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest strategy: fail-fast: false matrix: @@ -37,12 +37,13 @@ jobs: - name: License check(RAT) run: | - mvn apache-rat:check | grep -v "Downloading\|Downloaded\|Progress" - find ./ -name rat.txt -print0 | xargs -0 -I file cat file > merged-rat.txt && cat merged-rat.txt + mvn apache-rat:check -ntp + find ./ -name rat.txt -print0 | xargs -0 -I file cat file > merged-rat.txt + grep "Binaries" merged-rat.txt -C 3 && cat merged-rat.txt - name: Compile run: | - mvn compile -Dmaven.javadoc.skip=true | grep -v "Downloading\|Downloaded" + mvn compile -Dmaven.javadoc.skip=true -ntp - name: Run test run: | diff --git a/.github/workflows/license-checker.yml b/.github/workflows/license-checker.yml new file mode 100644 index 0000000000..2345f12532 --- /dev/null +++ b/.github/workflows/license-checker.yml @@ -0,0 +1,34 @@ +name: License checker + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + check-license: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + # More info could refer to: https://github.com/apache/skywalking-eyes + - name: Check License Header + uses: apache/skywalking-eyes@main + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + log: info + config: .licenserc.yaml + + - uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + + - name: License check(RAT) + run: | + mvn apache-rat:check -ntp + find ./ -name rat.txt -print0 | xargs -0 -I file cat file > merged-rat.txt + grep "Binaries" merged-rat.txt -C 3 && cat merged-rat.txt diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 93e1bd1c5e..1d7651bc73 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -20,8 +20,8 @@ jobs: stale-pr-message: 'Due to the lack of activity, the current pr is marked as stale and will be closed after 180 days, any update will remove the stale label' stale-issue-label: 'inactive' stale-pr-label: 'inactive' - exempt-issue-labels: 'feature,bug,enhancement,improvement,wontfix,todo,help wanted' - exempt-pr-labels: 'feature,bug,enhancement,improvement,wontfix,todo,help wanted' + exempt-issue-labels: 'feature,bug,enhancement,improvement,todo,guide,doc,help wanted,security' + exempt-pr-labels: 'feature,bug,enhancement,improvement,todo,guide,doc,help wanted,security' exempt-all-milestones: true days-before-issue-stale: 15 diff --git a/.licenserc.yaml b/.licenserc.yaml new file mode 100644 index 0000000000..efa4789855 --- /dev/null +++ b/.licenserc.yaml @@ -0,0 +1,79 @@ +# +# 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. +# + +header: # `header` section is configurations for source codes license header. + license: + spdx-id: Apache-2.0 # the spdx id of the license, it's convenient when your license is standard SPDX license. + copyright-owner: Apache Software Foundation # the copyright owner to replace the [owner] in the `spdx-id` template. + content: | # `license` will be used as the content when `fix` command needs to insert a license header. + 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. + # `pattern` is optional regexp if all the file headers are the same as `license` or the license of `spdx-id` and `copyright-owner`. + pattern: | + Licensed to the Apache Software Foundation under one or more contributor + license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright + ownership. The Apache Software Foundation 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. + paths: # `paths` are the path list that will be checked (and fixed) by license-eye, default is ['**']. + - '**' + + paths-ignore: # `paths-ignore` are the path list that will be ignored by license-eye. + - '.gitignore' + - 'LICENSE' + - 'NOTICE' + - 'DISCLAIMER' + - '**/*.md' + - '**/*.versionsBackup' + - '**/*.log' + - '**/*.conf' + - '**/*.txt' + - '**/*.csv' + - '**/*.json' + - '**/*.svg' + - '**/*.gitattributes' + - '**/.flattened-pom.xml' + - '**/.prettierrc' + - '**/*.MF' + - '**/.stylelintrc' + - 'assembly/**' + - '.github/**/*' + - '**/target/*' + comment: on-failure # on what condition license-eye will comment on the pull request, `on-failure`, `always`, `never`. + + # license-location-threshold specifies the index threshold where the license header can be located, + # after all, a "header" cannot be TOO far from the file start. + license-location-threshold: 80 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java index 37c4df86b4..ea7e923ee1 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java @@ -427,13 +427,8 @@ private static MediaType parseCustomContentType(MultivaluedMap h private static void configConnectionManager(String url, ClientConfig conf) { /* * Using httpclient with connection pooling, and configuring the - * jersey connector, reference: - * http://www.theotherian.com/2013/08/jersey-client-2.0-httpclient-timeouts-max-connections.html - * https://stackoverflow.com/questions/43228051/memory-issue-with-jax-rs-using-jersey/46175943#46175943 - * - * But the jersey that has been released in the maven central - * repository seems to have a bug. - * https://github.com/jersey/jersey/pull/3752 + * jersey connector. But the jersey that has been released in the maven central + * repository seems to have a bug: https://github.com/jersey/jersey/pull/3752 */ PoolingHttpClientConnectionManager pool = connectionManager(url, conf); Object maxTotal = conf.getProperty("maxTotal"); diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/Bytes.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/Bytes.java index 79ece63a78..4abd57df44 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/Bytes.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/Bytes.java @@ -38,8 +38,7 @@ public final class Bytes { public static final long PB = GB * MB; public static final long EB = GB * GB; - private static final Comparator CMP = - UnsignedBytes.lexicographicalComparator(); + private static final Comparator CMP = UnsignedBytes.lexicographicalComparator(); public static int compare(byte[] bytes1, byte[] bytes2) { return CMP.compare(bytes1, bytes2); diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/CheckSocket.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/CheckSocket.java index 96d83e38ec..09a36b9a36 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/CheckSocket.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/CheckSocket.java @@ -1,55 +1,37 @@ -// Copyright 2017 JanusGraph Authors -// -// Licensed 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. +/* + * 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.util; -import java.io.IOException; +import static java.lang.System.exit; + import java.net.InetAddress; import java.net.Socket; -/* - * This doesn't really belong here. It's only used in the zipfile - * distribution to check whether Gremlin Server or ES are listening on - * their respective TCP ports. But it's so tiny that I don't want - * to reorganize the repo to accommodate it (yet). - * - * Many widely available *NIX programs do this task better (e.g. - * netcat, telnet, nmap, socat, ... we could even use netstat since - * we're interested only in the status of local ports). But we want - * to keep the JanusGraph distribution self-contained insofar as is - * reasonable. - */ public final class CheckSocket { - private static final int E_USAGE = 1; - private static final int E_FAILED = 2; - private static final String MSG_USAGE = - "Usage: " + CheckSocket.class.getSimpleName() + " hostname port"; - public static void main(String[] args) { - if (args.length != 2) { - System.err.println(MSG_USAGE); - System.exit(E_USAGE); - } try { - Socket s = new Socket(InetAddress.getByName(args[0]), - Integer.parseInt(args[1])); - s.close(); - System.exit(0); - } catch (IOException e) { - System.err.println(e); - System.exit(E_FAILED); + // Check if the socket connection can be closed normally + new Socket(InetAddress.getByName(args[0]), Integer.parseInt(args[1])).close(); + exit(0); + } catch (Exception e) { + e.printStackTrace(); + exit(-1); } } } diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/DateUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/DateUtil.java index 43c58f8098..4e7ce13de0 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/DateUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/DateUtil.java @@ -37,8 +37,7 @@ public final class DateUtil { "yyyy-MM-dd HH:mm:ss.SSS" ); - private static final Map DATE_FORMATS = - new ConcurrentHashMap<>(); + private static final Map DATE_FORMATS = new ConcurrentHashMap<>(); public static Date parse(String value) { for (Map.Entry entry : VALID_DFS.entrySet()) { @@ -47,8 +46,7 @@ public static Date parse(String value) { } } throw new IllegalArgumentException(String.format( - "Expected date format is: %s, but got '%s'", - VALID_DFS.values(), value)); + "Expected date format is: %s, but got '%s'", VALID_DFS.values(), value)); } public static Date parse(String value, String df) { diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/E.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/E.java index 162999c68a..214add304b 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/E.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/E.java @@ -40,9 +40,7 @@ public static void checkNotEmpty(Collection collection, String elem) { "The '%s' can't be empty", elem); } - public static void checkNotEmpty(Collection collection, - String elem, - String owner) { + public static void checkNotEmpty(Collection collection, String elem, String owner) { Preconditions.checkArgument(!collection.isEmpty(), "The '%s' of '%s' can't be empty", elem, owner); diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/LongEncoding.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/LongEncoding.java index 24c857fd03..761d72b907 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/LongEncoding.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/LongEncoding.java @@ -17,10 +17,6 @@ package org.apache.hugegraph.util; -/** - * Utility class for encoding longs in strings based on: - * @see encode decode long to string - */ public final class LongEncoding { private static final String B64_SYMBOLS = diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/NumericUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/NumericUtil.java index f567a89593..516170811a 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/NumericUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/NumericUtil.java @@ -291,12 +291,9 @@ public static boolean isNumber(Object value) { public static boolean isNumber(Class clazz) { if (clazz.isPrimitive()) { - if (clazz == int.class || clazz == long.class || - clazz == float.class || clazz == double.class || - clazz == short.class || clazz == byte.class) { - return true; - } - return false; + return clazz == int.class || clazz == long.class || + clazz == float.class || clazz == double.class || + clazz == short.class || clazz == byte.class; } return Number.class.isAssignableFrom(clazz); } diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/OrderLimitMap.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/OrderLimitMap.java index b8ce47152c..b711e3e585 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/OrderLimitMap.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/OrderLimitMap.java @@ -24,12 +24,7 @@ import com.google.common.base.Functions; import com.google.common.collect.Ordering; -/** - * Reference: - * ... - */ -public class OrderLimitMap, V extends Comparable> - extends TreeMap { +public class OrderLimitMap, V extends Comparable> extends TreeMap { private static final long serialVersionUID = 756490437953358633L; @@ -37,7 +32,7 @@ public class OrderLimitMap, V extends Comparable> private final Map valueMap; private static > Ordering incr() { - return Ordering.from((V o1, V o2) -> o1.compareTo(o2)); + return Ordering.from(Comparable::compareTo); } private static > Ordering decr() { diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java index c7d6c2ede9..b49adda87a 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java @@ -75,7 +75,6 @@ public static String getImplementationVersion(Class clazz) { /* * We don't use Package.getImplementationVersion() due to * a duplicate package would override the origin package info. - * https://stackoverflow.com/questions/1272648/reading-my-own-jars-manifest */ String className = clazz.getSimpleName() + ".class"; String classPath = Objects.requireNonNull(clazz.getResource(className)).toString(); @@ -137,10 +136,6 @@ public static String getPomVersion() { } } - /** - * class Version for compare - * https://stackoverflow.com/questions/198431/how-do-you-compare-two-version-strings-in-java - */ public static class Version implements Comparable { public static Version of(Class clazz) { diff --git a/pom.xml b/pom.xml index 8c02e765e1..a726be5a2a 100644 --- a/pom.xml +++ b/pom.xml @@ -218,12 +218,10 @@ **/*.txt **/*.json **/*.conf - **/*.properties dist/**/* docs/**/* scripts/dev/reviewers **/*.md - **/dependency-reduced-pom.xml **/.flattened-pom.xml **/logs/*.log **/target/* From 6f9493a517d8fc734347da9dfc09c761646e1aa2 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 9 Feb 2023 18:05:39 +0800 Subject: [PATCH 199/217] 1 --- hugegraph-dist/release-docs/LICENSE | 34 +- hugegraph-dist/release-docs/NOTICE | 10 +- .../LICENSE-aopalliance-repackaged.txt | 397 ------------------ .../licenses/LICENSE-glassfish-hk2.txt | 360 ---------------- .../LICENSE-jakarta.annotation-api.txt | 360 ---------------- .../licenses/LICENSE-javassist.txt | 24 -- ...NSE-javax.activation-api-1.2.0-sources.txt | 397 ------------------ .../release-docs/licenses/LICENSE-jersey.txt | 397 ------------------ .../release-docs/licenses/LICENSE-jsonp.txt | 397 ------------------ 9 files changed, 21 insertions(+), 2355 deletions(-) diff --git a/hugegraph-dist/release-docs/LICENSE b/hugegraph-dist/release-docs/LICENSE index 5da8cae26e..faa4bb101f 100644 --- a/hugegraph-dist/release-docs/LICENSE +++ b/hugegraph-dist/release-docs/LICENSE @@ -218,13 +218,13 @@ Third party Apache 2.0 licenses The following components are provided under the Apache 2.0 License. See licenses/ for text of these licenses. - (Apache License, 2.0) (LGPL 2.1) (MPL 1.1) Javassist (org.javassist:javassist:3.28.0-GA - http://www.javassist.org/) - (Apache License, 2.0) (BSD 2-Clause) (EDL 1.0) (EPL 2.0) (GPL2 w/ CPE) (MIT license) (Modified BSD) (Public Domain) (W3C license) (jQuery license) jersey-connectors-apache (org.glassfish.jersey.connectors:jersey-apache-connector:3.0.3 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-apache-connector) - (Apache License, 2.0) (BSD 2-Clause) (EDL 1.0) (EPL 2.0) (GPL2 w/ CPE) (MIT license) (Modified BSD) (Public Domain) (W3C license) (jQuery license) jersey-core-client (org.glassfish.jersey.core:jersey-client:3.0.3 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-client) - (Apache License, 2.0) (EPL 2.0) (Public Domain) (The GNU General Public License (GPL), Version 2, With Classpath Exception) jersey-core-common (org.glassfish.jersey.core:jersey-common:3.0.3 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-common) - (Apache License, 2.0) (BSD 2-Clause) (EDL 1.0) (EPL 2.0) (GPL2 w/ CPE) (MIT license) (Modified BSD) (Public Domain) (W3C license) (jQuery license) jersey-ext-entity-filtering (org.glassfish.jersey.ext:jersey-entity-filtering:3.0.3 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-entity-filtering) - (Apache License, 2.0) (BSD 2-Clause) (EDL 1.0) (EPL 2.0) (GPL2 w/ CPE) (MIT license) (Modified BSD) (Public Domain) (W3C license) (jQuery license) jersey-inject-hk2 (org.glassfish.jersey.inject:jersey-hk2:3.0.3 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-hk2) - (Apache License, 2.0) (EPL 2.0) (The GNU General Public License (GPL), Version 2, With Classpath Exception) jersey-media-json-jackson (org.glassfish.jersey.media:jersey-media-json-jackson:3.0.3 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-media-json-jackson) + (Apache License, 2.0) Javassist (org.javassist:javassist:3.28.0-GA - http://www.javassist.org/) + (Apache License, 2.0) jersey-connectors-apache (org.glassfish.jersey.connectors:jersey-apache-connector:3.0.3 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-apache-connector) + (Apache License, 2.0) jersey-core-client (org.glassfish.jersey.core:jersey-client:3.0.3 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-client) + (Apache License, 2.0) jersey-core-common (org.glassfish.jersey.core:jersey-common:3.0.3 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-common) + (Apache License, 2.0) jersey-ext-entity-filtering (org.glassfish.jersey.ext:jersey-entity-filtering:3.0.3 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-entity-filtering) + (Apache License, 2.0) jersey-inject-hk2 (org.glassfish.jersey.inject:jersey-hk2:3.0.3 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-hk2) + (Apache License, 2.0) jersey-media-json-jackson (org.glassfish.jersey.media:jersey-media-json-jackson:3.0.3 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-media-json-jackson) (Apache License, Version 2.0) * Apache Commons BeanUtils:- commons-beanutils:commons-beanutils:1.9.4 (https://commons.apache.org/proper/commons-beanutils/) (Apache License, Version 2.0) * Apache Commons Codec:- commons-codec:commons-codec:1.13 (https://commons.apache.org/proper/commons-codec/) (Apache License, Version 2.0) * Apache Commons Collections:- commons-collections:commons-collections:3.2.2 (http://commons.apache.org/collections/) @@ -292,9 +292,9 @@ Third party CDDL licenses The following components are provided under the CDDL License. See licenses/ for text of these licenses. - (CDDL + GPLv2 with classpath exception) * JavaBeans Activation Framework API jar:- javax.activation:javax.activation-api:1.2.0 (http://java.net/all/javax.activation-api/) - (CDDL 1.1, GPL2 w/ CPE) * jaxb-api:- javax.xml.bind:jaxb-api:2.3.1 (https://github.com/javaee/jaxb-spec/jaxb-api) - (Dual license consisting of the CDDL v1.1 and GPL v2) * Default Provider:- org.glassfish:javax.json:1.0 (http://jsonp.java.net) + (CDDL) * JavaBeans Activation Framework API jar:- javax.activation:javax.activation-api:1.2.0 (http://java.net/all/javax.activation-api/) + (CDDL 1.1) * jaxb-api:- javax.xml.bind:jaxb-api:2.3.1 (https://github.com/javaee/jaxb-spec/jaxb-api) + (Dual license consisting of the CDDL v1.1) * Default Provider:- org.glassfish:javax.json:1.0 (http://jsonp.java.net) ======================================================================== @@ -303,13 +303,13 @@ Third party EPL licenses The following components are provided under the EPL License. See licenses/ for text of these licenses. - (Eclipse Public License - v2.0, GPL2 w/ CPE) * HK2 API module:- org.glassfish.hk2:hk2-api:3.0.1 (https://github.com/eclipse-ee4j/glassfish-hk2/hk2-api) - (Eclipse Public License - v2.0, GPL2 w/ CPE) * HK2 Implementation Utilities:- org.glassfish.hk2:hk2-utils:3.0.1 (https://github.com/eclipse-ee4j/glassfish-hk2/hk2-utils) - (Eclipse Public License - v2.0, GPL2 w/ CPE) * Jakarta Annotations API:- jakarta.annotation:jakarta.annotation-api:2.0.0 (https://projects.eclipse.org/projects/ee4j.ca) - (Eclipse Public License - v2.0, GPL2 w/ CPE) * OSGi resource locator:- org.glassfish.hk2:osgi-resource-locator:1.0.3 (https://projects.eclipse.org/projects/ee4j/osgi-resource-locator) - (Eclipse Public License - v2.0, GPL2 w/ CPE) * ServiceLocator Default Implementation:- org.glassfish.hk2:hk2-locator:3.0.1 (https://github.com/eclipse-ee4j/glassfish-hk2/hk2-locator) - (Eclipse Public License - v2.0, GPL2 w/ CPE) * aopalliance version 1.0 repackaged as a module:- org.glassfish.hk2.external:aopalliance-repackaged:3.0.1 (https://github.com/eclipse-ee4j/glassfish-hk2/external/aopalliance-repackaged) - (Eclipse Public License - v2.0, GPL2 w/ CPE) * jakarta.ws.rs-api:- jakarta.ws.rs:jakarta.ws.rs-api:3.0.0 (https://github.com/eclipse-ee4j/jaxrs-api) + (Eclipse Public License - v2.0) * HK2 API module:- org.glassfish.hk2:hk2-api:3.0.1 (https://github.com/eclipse-ee4j/glassfish-hk2/hk2-api) + (Eclipse Public License - v2.0) * HK2 Implementation Utilities:- org.glassfish.hk2:hk2-utils:3.0.1 (https://github.com/eclipse-ee4j/glassfish-hk2/hk2-utils) + (Eclipse Public License - v2.0) * Jakarta Annotations API:- jakarta.annotation:jakarta.annotation-api:2.0.0 (https://projects.eclipse.org/projects/ee4j.ca) + (Eclipse Public License - v2.0) * OSGi resource locator:- org.glassfish.hk2:osgi-resource-locator:1.0.3 (https://projects.eclipse.org/projects/ee4j/osgi-resource-locator) + (Eclipse Public License - v2.0) * ServiceLocator Default Implementation:- org.glassfish.hk2:hk2-locator:3.0.1 (https://github.com/eclipse-ee4j/glassfish-hk2/hk2-locator) + (Eclipse Public License - v2.0) * aopalliance version 1.0 repackaged as a module:- org.glassfish.hk2.external:aopalliance-repackaged:3.0.1 (https://github.com/eclipse-ee4j/glassfish-hk2/external/aopalliance-repackaged) + (Eclipse Public License - v2.0) * jakarta.ws.rs-api:- jakarta.ws.rs:jakarta.ws.rs-api:3.0.0 (https://github.com/eclipse-ee4j/jaxrs-api) (Eclipse Public License - v2.0) * JUnit:- junit:junit:4.13.1 (http://junit.org) ======================================================================== diff --git a/hugegraph-dist/release-docs/NOTICE b/hugegraph-dist/release-docs/NOTICE index ec465a4662..fff5477397 100644 --- a/hugegraph-dist/release-docs/NOTICE +++ b/hugegraph-dist/release-docs/NOTICE @@ -1,11 +1,9 @@ -Apache HugeGraph(incubating) -Copyright 2022-2023 The Apache Software Foundation +Apache HugeGraph +Copyright 2021-2022 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). -The initial codebase was donated to the ASF by HugeGraph Authors, copyright 2017-2021. - ======================================================================== commons-logging NOTICE @@ -452,7 +450,7 @@ Sax (0.2) testng (6.14.2) -* License: Apache-2.0 AND (MIT OR GPL-1.0+) +* License: Apache-2.0 AND (MIT ) * Project: https://testng.org/doc/index.html * Source: https://github.com/cbeust/testng @@ -532,7 +530,7 @@ availability set forth in the Eclipse Public License v. 2.0 are satisfied: GNU General Public License, version 2 with the GNU Classpath Exception which is available at https://www.gnu.org/software/classpath/license.html. -SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +SPDX-License-Identifier: EPL-2.0 ## Source Code diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-aopalliance-repackaged.txt b/hugegraph-dist/release-docs/licenses/LICENSE-aopalliance-repackaged.txt index b1c74f95ed..4a00ba9482 100644 --- a/hugegraph-dist/release-docs/licenses/LICENSE-aopalliance-repackaged.txt +++ b/hugegraph-dist/release-docs/licenses/LICENSE-aopalliance-repackaged.txt @@ -360,400 +360,3 @@ litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California and the state courts of the State of California, with venue lying in Santa Clara County, California. - - - - The GNU General Public License (GPL) Version 2, June 1991 - -Copyright (C) 1989, 1991 Free Software Foundation, Inc. -51 Franklin Street, Fifth Floor -Boston, MA 02110-1335 -USA - -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. - -Preamble - -The licenses for most software are designed to take away your freedom to -share and change it. By contrast, the GNU General Public License is -intended to guarantee your freedom to share and change free software--to -make sure the software is free for all its users. This General Public -License applies to most of the Free Software Foundation's software and -to any other program whose authors commit to using it. (Some other Free -Software Foundation software is covered by the GNU Library General -Public License instead.) You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. -Our General Public Licenses are designed to make sure that you have the -freedom to distribute copies of free software (and charge for this -service if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs; and that you know you can do these things. - -To protect your rights, we need to make restrictions that forbid anyone -to deny you these rights or to ask you to surrender the rights. These -restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - -For example, if you distribute copies of such a program, whether gratis -or for a fee, you must give the recipients all the rights that you have. -You must make sure that they, too, receive or can get the source code. -And you must show them these terms so they know their rights. - -We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - -Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - -Finally, any free program is threatened constantly by software patents. -We wish to avoid the danger that redistributors of a free program will -individually obtain patent licenses, in effect making the program -proprietary. To prevent this, we have made it clear that any patent must -be licensed for everyone's free use or not licensed at all. - -The precise terms and conditions for copying, distribution and -modification follow. - -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - -0. This License applies to any program or other work which contains a -notice placed by the copyright holder saying it may be distributed under -the terms of this General Public License. The "Program", below, refers -to any such program or work, and a "work based on the Program" means -either the Program or any derivative work under copyright law: that is -to say, a work containing the Program or a portion of it, either -verbatim or with modifications and/or translated into another language. -(Hereinafter, translation is included without limitation in the term -"modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of running -the Program is not restricted, and the output from the Program is -covered only if its contents constitute a work based on the Program -(independent of having been made by running the Program). Whether that -is true depends on what the Program does. - -1. You may copy and distribute verbatim copies of the Program's source -code as you receive it, in any medium, provided that you conspicuously -and appropriately publish on each copy an appropriate copyright notice -and disclaimer of warranty; keep intact all the notices that refer to -this License and to the absence of any warranty; and give any other -recipients of the Program a copy of this License along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - -2. You may modify your copy or copies of the Program or any portion of -it, thus forming a work based on the Program, and copy and distribute -such modifications or work under the terms of Section 1 above, provided -that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any part - thereof, to be licensed as a whole at no charge to all third parties - under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a notice - that there is no warranty (or else, saying that you provide a - warranty) and that users may redistribute the program under these - conditions, and telling the user how to view a copy of this License. - (Exception: if the Program itself is interactive but does not - normally print such an announcement, your work based on the Program - is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, and -can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based on -the Program, the distribution of the whole must be on the terms of this -License, whose permissions for other licensees extend to the entire -whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of a -storage or distribution medium does not bring the other work under the -scope of this License. - -3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections 1 - and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your cost - of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer to - distribute corresponding source code. (This alternative is allowed - only for noncommercial distribution and only if you received the - program in object code or executable form with such an offer, in - accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source code -means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to control -compilation and installation of the executable. However, as a special -exception, the source code distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies the -executable. - -If distribution of executable or object code is made by offering access -to copy from a designated place, then offering equivalent access to copy -the source code from the same place counts as distribution of the source -code, even though third parties are not compelled to copy the source -along with the object code. - -4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt otherwise -to copy, modify, sublicense or distribute the Program is void, and will -automatically terminate your rights under this License. However, parties -who have received copies, or rights, from you under this License will -not have their licenses terminated so long as such parties remain in -full compliance. - -5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and all -its terms and conditions for copying, distributing or modifying the -Program or works based on it. - -6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further restrictions -on the recipients' exercise of the rights granted herein. You are not -responsible for enforcing compliance by third parties to this License. - -7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot distribute -so as to satisfy simultaneously your obligations under this License and -any other pertinent obligations, then as a consequence you may not -distribute the Program at all. For example, if a patent license would -not permit royalty-free redistribution of the Program by all those who -receive copies directly or indirectly through you, then the only way you -could satisfy both it and this License would be to refrain entirely from -distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is implemented -by public license practices. Many people have made generous -contributions to the wide range of software distributed through that -system in reliance on consistent application of that system; it is up to -the author/donor to decide if he or she is willing to distribute -software through any other system and a licensee cannot impose that choice. - -This section is intended to make thoroughly clear what is believed to be -a consequence of the rest of this License. - -8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License may -add an explicit geographical distribution limitation excluding those -countries, so that distribution is permitted only in or among countries -not thus excluded. In such case, this License incorporates the -limitation as if written in the body of this License. - -9. The Free Software Foundation may publish revised and/or new -versions of the General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Program does not specify a version -number of this License, you may choose any version ever published by the -Free Software Foundation. - -10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the -author to ask for permission. For software which is copyrighted by the -Free Software Foundation, write to the Free Software Foundation; we -sometimes make exceptions for this. Our decision will be guided by the -two goals of preserving the free status of all derivatives of our free -software and of promoting the sharing and reuse of software generally. - -NO WARRANTY - -11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, -EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE -ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH -YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL -NECESSARY SERVICING, REPAIR OR CORRECTION. - -12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR -DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL -DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM -(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF -THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR -OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -END OF TERMS AND CONDITIONS - -How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to -attach them to the start of each source file to most effectively convey -the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - One line to give the program's name and a brief idea of what it does. - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type - `show w'. This is free software, and you are welcome to redistribute - it under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the -appropriate parts of the General Public License. Of course, the commands -you use may be called something other than `show w' and `show c'; they -could even be mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - program `Gnomovision' (which makes passes at compilers) written by - James Hacker. - - signature of Ty Coon, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications -with the library. If this is what you want to do, use the GNU Library -General Public License instead of this License. - -# - -Certain source files distributed by Oracle America, Inc. and/or its -affiliates are subject to the following clarification and special -exception to the GPLv2, based on the GNU Project exception for its -Classpath libraries, known as the GNU Classpath Exception, but only -where Oracle has expressly included in the particular source file's -header the words "Oracle designates this particular file as subject to -the "Classpath" exception as provided by Oracle in the LICENSE file -that accompanied this code." - -You should also note that Oracle includes multiple, independent -programs in this software package. Some of those programs are provided -under licenses deemed incompatible with the GPLv2 by the Free Software -Foundation and others. For example, the package includes programs -licensed under the Apache License, Version 2.0. Such programs are -licensed to you under their original licenses. - -Oracle facilitates your further distribution of this package by adding -the Classpath Exception to the necessary parts of its GPLv2 code, which -permits you to use that code in combination with other independent -modules not licensed under the GPLv2. However, note that this would -not permit you to commingle code under an incompatible license with -Oracle's GPLv2 licensed code by, for example, cutting and pasting such -code into a file also containing Oracle's GPLv2 licensed code and then -distributing the result. Additionally, if you were to remove the -Classpath Exception from any of the files to which it applies and -distribute the result, you would likely be required to license some or -all of the other code in that distribution under the GPLv2 as well, and -since the GPLv2 is incompatible with the license terms of some items -included in the distribution by Oracle, removing the Classpath -Exception could therefore effectively compromise your ability to -further distribute the package. - -Proceed with caution and we recommend that you obtain the advice of a -lawyer skilled in open source matters before removing the Classpath -Exception or making modifications to this package which may -subsequently be redistributed and/or involve the use of third party -software. - -CLASSPATH EXCEPTION -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License version 2 cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from or -based on this library. If you modify this library, you may extend this -exception to your version of the library, but you are not obligated to -do so. If you do not wish to do so, delete this exception statement -from your version. diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-glassfish-hk2.txt b/hugegraph-dist/release-docs/licenses/LICENSE-glassfish-hk2.txt index 3b7ae66064..bda7db00c5 100644 --- a/hugegraph-dist/release-docs/licenses/LICENSE-glassfish-hk2.txt +++ b/hugegraph-dist/release-docs/licenses/LICENSE-glassfish-hk2.txt @@ -275,363 +275,3 @@ look for such a notice. You may add additional accurate notices of copyright ownership. - ---- - -## The GNU General Public License (GPL) Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor - Boston, MA 02110-1335 - USA - - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your freedom to - share and change it. By contrast, the GNU General Public License is - intended to guarantee your freedom to share and change free software--to - make sure the software is free for all its users. This General Public - License applies to most of the Free Software Foundation's software and - to any other program whose authors commit to using it. (Some other Free - Software Foundation software is covered by the GNU Library General - Public License instead.) You can apply it to your programs, too. - - When we speak of free software, we are referring to freedom, not price. - Our General Public Licenses are designed to make sure that you have the - freedom to distribute copies of free software (and charge for this - service if you wish), that you receive source code or can get it if you - want it, that you can change the software or use pieces of it in new - free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid anyone - to deny you these rights or to ask you to surrender the rights. These - restrictions translate to certain responsibilities for you if you - distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether gratis - or for a fee, you must give the recipients all the rights that you have. - You must make sure that they, too, receive or can get the source code. - And you must show them these terms so they know their rights. - - We protect your rights with two steps: (1) copyright the software, and - (2) offer you this license which gives you legal permission to copy, - distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain - that everyone understands that there is no warranty for this free - software. If the software is modified by someone else and passed on, we - want its recipients to know that what they have is not the original, so - that any problems introduced by others will not reflect on the original - authors' reputations. - - Finally, any free program is threatened constantly by software patents. - We wish to avoid the danger that redistributors of a free program will - individually obtain patent licenses, in effect making the program - proprietary. To prevent this, we have made it clear that any patent must - be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and - modification follow. - - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains a - notice placed by the copyright holder saying it may be distributed under - the terms of this General Public License. The "Program", below, refers - to any such program or work, and a "work based on the Program" means - either the Program or any derivative work under copyright law: that is - to say, a work containing the Program or a portion of it, either - verbatim or with modifications and/or translated into another language. - (Hereinafter, translation is included without limitation in the term - "modification".) Each licensee is addressed as "you". - - Activities other than copying, distribution and modification are not - covered by this License; they are outside its scope. The act of running - the Program is not restricted, and the output from the Program is - covered only if its contents constitute a work based on the Program - (independent of having been made by running the Program). Whether that - is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's source - code as you receive it, in any medium, provided that you conspicuously - and appropriately publish on each copy an appropriate copyright notice - and disclaimer of warranty; keep intact all the notices that refer to - this License and to the absence of any warranty; and give any other - recipients of the Program a copy of this License along with the Program. - - You may charge a fee for the physical act of transferring a copy, and - you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion of - it, thus forming a work based on the Program, and copy and distribute - such modifications or work under the terms of Section 1 above, provided - that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any part - thereof, to be licensed as a whole at no charge to all third parties - under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a notice - that there is no warranty (or else, saying that you provide a - warranty) and that users may redistribute the program under these - conditions, and telling the user how to view a copy of this License. - (Exception: if the Program itself is interactive but does not - normally print such an announcement, your work based on the Program - is not required to print an announcement.) - - These requirements apply to the modified work as a whole. If - identifiable sections of that work are not derived from the Program, and - can be reasonably considered independent and separate works in - themselves, then this License, and its terms, do not apply to those - sections when you distribute them as separate works. But when you - distribute the same sections as part of a whole which is a work based on - the Program, the distribution of the whole must be on the terms of this - License, whose permissions for other licensees extend to the entire - whole, and thus to each and every part regardless of who wrote it. - - Thus, it is not the intent of this section to claim rights or contest - your rights to work written entirely by you; rather, the intent is to - exercise the right to control the distribution of derivative or - collective works based on the Program. - - In addition, mere aggregation of another work not based on the Program - with the Program (or with a work based on the Program) on a volume of a - storage or distribution medium does not bring the other work under the - scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, - under Section 2) in object code or executable form under the terms of - Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections 1 - and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your cost - of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer to - distribute corresponding source code. (This alternative is allowed - only for noncommercial distribution and only if you received the - program in object code or executable form with such an offer, in - accord with Subsection b above.) - - The source code for a work means the preferred form of the work for - making modifications to it. For an executable work, complete source code - means all the source code for all modules it contains, plus any - associated interface definition files, plus the scripts used to control - compilation and installation of the executable. However, as a special - exception, the source code distributed need not include anything that is - normally distributed (in either source or binary form) with the major - components (compiler, kernel, and so on) of the operating system on - which the executable runs, unless that component itself accompanies the - executable. - - If distribution of executable or object code is made by offering access - to copy from a designated place, then offering equivalent access to copy - the source code from the same place counts as distribution of the source - code, even though third parties are not compelled to copy the source - along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program - except as expressly provided under this License. Any attempt otherwise - to copy, modify, sublicense or distribute the Program is void, and will - automatically terminate your rights under this License. However, parties - who have received copies, or rights, from you under this License will - not have their licenses terminated so long as such parties remain in - full compliance. - - 5. You are not required to accept this License, since you have not - signed it. However, nothing else grants you permission to modify or - distribute the Program or its derivative works. These actions are - prohibited by law if you do not accept this License. Therefore, by - modifying or distributing the Program (or any work based on the - Program), you indicate your acceptance of this License to do so, and all - its terms and conditions for copying, distributing or modifying the - Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the - Program), the recipient automatically receives a license from the - original licensor to copy, distribute or modify the Program subject to - these terms and conditions. You may not impose any further restrictions - on the recipients' exercise of the rights granted herein. You are not - responsible for enforcing compliance by third parties to this License. - - 7. If, as a consequence of a court judgment or allegation of patent - infringement or for any other reason (not limited to patent issues), - conditions are imposed on you (whether by court order, agreement or - otherwise) that contradict the conditions of this License, they do not - excuse you from the conditions of this License. If you cannot distribute - so as to satisfy simultaneously your obligations under this License and - any other pertinent obligations, then as a consequence you may not - distribute the Program at all. For example, if a patent license would - not permit royalty-free redistribution of the Program by all those who - receive copies directly or indirectly through you, then the only way you - could satisfy both it and this License would be to refrain entirely from - distribution of the Program. - - If any portion of this section is held invalid or unenforceable under - any particular circumstance, the balance of the section is intended to - apply and the section as a whole is intended to apply in other - circumstances. - - It is not the purpose of this section to induce you to infringe any - patents or other property right claims or to contest validity of any - such claims; this section has the sole purpose of protecting the - integrity of the free software distribution system, which is implemented - by public license practices. Many people have made generous - contributions to the wide range of software distributed through that - system in reliance on consistent application of that system; it is up to - the author/donor to decide if he or she is willing to distribute - software through any other system and a licensee cannot impose that choice. - - This section is intended to make thoroughly clear what is believed to be - a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in - certain countries either by patents or by copyrighted interfaces, the - original copyright holder who places the Program under this License may - add an explicit geographical distribution limitation excluding those - countries, so that distribution is permitted only in or among countries - not thus excluded. In such case, this License incorporates the - limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new - versions of the General Public License from time to time. Such new - versions will be similar in spirit to the present version, but may - differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the Program - specifies a version number of this License which applies to it and "any - later version", you have the option of following the terms and - conditions either of that version or of any later version published by - the Free Software Foundation. If the Program does not specify a version - number of this License, you may choose any version ever published by the - Free Software Foundation. - - 10. If you wish to incorporate parts of the Program into other free - programs whose distribution conditions are different, write to the - author to ask for permission. For software which is copyrighted by the - Free Software Foundation, write to the Free Software Foundation; we - sometimes make exceptions for this. Our decision will be guided by the - two goals of preserving the free status of all derivatives of our free - software and of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO - WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. - EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR - OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE - ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH - YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL - NECESSARY SERVICING, REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN - WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY - AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR - DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL - DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM - (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED - INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF - THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR - OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest - possible use to the public, the best way to achieve this is to make it - free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest to - attach them to the start of each source file to most effectively convey - the exclusion of warranty; and each file should have at least the - "copyright" line and a pointer to where the full notice is found. - - One line to give the program's name and a brief idea of what it does. - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA - - Also add information on how to contact you by electronic and paper mail. - - If the program is interactive, make it output a short notice like this - when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type - `show w'. This is free software, and you are welcome to redistribute - it under certain conditions; type `show c' for details. - - The hypothetical commands `show w' and `show c' should show the - appropriate parts of the General Public License. Of course, the commands - you use may be called something other than `show w' and `show c'; they - could even be mouse-clicks or menu items--whatever suits your program. - - You should also get your employer (if you work as a programmer) or your - school, if any, to sign a "copyright disclaimer" for the program, if - necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - program `Gnomovision' (which makes passes at compilers) written by - James Hacker. - - signature of Ty Coon, 1 April 1989 - Ty Coon, President of Vice - - This General Public License does not permit incorporating your program - into proprietary programs. If your program is a subroutine library, you - may consider it more useful to permit linking proprietary applications - with the library. If this is what you want to do, use the GNU Library - General Public License instead of this License. - ---- - -## CLASSPATH EXCEPTION - - Linking this library statically or dynamically with other modules is - making a combined work based on this library. Thus, the terms and - conditions of the GNU General Public License version 2 cover the whole - combination. - - As a special exception, the copyright holders of this library give you - permission to link this library with independent modules to produce an - executable, regardless of the license terms of these independent - modules, and to copy and distribute the resulting executable under - terms of your choice, provided that you also meet, for each linked - independent module, the terms and conditions of the license of that - module. An independent module is a module which is not derived from or - based on this library. If you modify this library, you may extend this - exception to your version of the library, but you are not obligated to - do so. If you do not wish to do so, delete this exception statement - from your version. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jakarta.annotation-api.txt b/hugegraph-dist/release-docs/licenses/LICENSE-jakarta.annotation-api.txt index 5de3d1b40c..a8ba56ef14 100644 --- a/hugegraph-dist/release-docs/licenses/LICENSE-jakarta.annotation-api.txt +++ b/hugegraph-dist/release-docs/licenses/LICENSE-jakarta.annotation-api.txt @@ -275,363 +275,3 @@ look for such a notice. You may add additional accurate notices of copyright ownership. - ---- - -## The GNU General Public License (GPL) Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor - Boston, MA 02110-1335 - USA - - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your freedom to - share and change it. By contrast, the GNU General Public License is - intended to guarantee your freedom to share and change free software--to - make sure the software is free for all its users. This General Public - License applies to most of the Free Software Foundation's software and - to any other program whose authors commit to using it. (Some other Free - Software Foundation software is covered by the GNU Library General - Public License instead.) You can apply it to your programs, too. - - When we speak of free software, we are referring to freedom, not price. - Our General Public Licenses are designed to make sure that you have the - freedom to distribute copies of free software (and charge for this - service if you wish), that you receive source code or can get it if you - want it, that you can change the software or use pieces of it in new - free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid anyone - to deny you these rights or to ask you to surrender the rights. These - restrictions translate to certain responsibilities for you if you - distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether gratis - or for a fee, you must give the recipients all the rights that you have. - You must make sure that they, too, receive or can get the source code. - And you must show them these terms so they know their rights. - - We protect your rights with two steps: (1) copyright the software, and - (2) offer you this license which gives you legal permission to copy, - distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain - that everyone understands that there is no warranty for this free - software. If the software is modified by someone else and passed on, we - want its recipients to know that what they have is not the original, so - that any problems introduced by others will not reflect on the original - authors' reputations. - - Finally, any free program is threatened constantly by software patents. - We wish to avoid the danger that redistributors of a free program will - individually obtain patent licenses, in effect making the program - proprietary. To prevent this, we have made it clear that any patent must - be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and - modification follow. - - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains a - notice placed by the copyright holder saying it may be distributed under - the terms of this General Public License. The "Program", below, refers - to any such program or work, and a "work based on the Program" means - either the Program or any derivative work under copyright law: that is - to say, a work containing the Program or a portion of it, either - verbatim or with modifications and/or translated into another language. - (Hereinafter, translation is included without limitation in the term - "modification".) Each licensee is addressed as "you". - - Activities other than copying, distribution and modification are not - covered by this License; they are outside its scope. The act of running - the Program is not restricted, and the output from the Program is - covered only if its contents constitute a work based on the Program - (independent of having been made by running the Program). Whether that - is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's source - code as you receive it, in any medium, provided that you conspicuously - and appropriately publish on each copy an appropriate copyright notice - and disclaimer of warranty; keep intact all the notices that refer to - this License and to the absence of any warranty; and give any other - recipients of the Program a copy of this License along with the Program. - - You may charge a fee for the physical act of transferring a copy, and - you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion of - it, thus forming a work based on the Program, and copy and distribute - such modifications or work under the terms of Section 1 above, provided - that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any part - thereof, to be licensed as a whole at no charge to all third parties - under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a notice - that there is no warranty (or else, saying that you provide a - warranty) and that users may redistribute the program under these - conditions, and telling the user how to view a copy of this License. - (Exception: if the Program itself is interactive but does not - normally print such an announcement, your work based on the Program - is not required to print an announcement.) - - These requirements apply to the modified work as a whole. If - identifiable sections of that work are not derived from the Program, and - can be reasonably considered independent and separate works in - themselves, then this License, and its terms, do not apply to those - sections when you distribute them as separate works. But when you - distribute the same sections as part of a whole which is a work based on - the Program, the distribution of the whole must be on the terms of this - License, whose permissions for other licensees extend to the entire - whole, and thus to each and every part regardless of who wrote it. - - Thus, it is not the intent of this section to claim rights or contest - your rights to work written entirely by you; rather, the intent is to - exercise the right to control the distribution of derivative or - collective works based on the Program. - - In addition, mere aggregation of another work not based on the Program - with the Program (or with a work based on the Program) on a volume of a - storage or distribution medium does not bring the other work under the - scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, - under Section 2) in object code or executable form under the terms of - Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections 1 - and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your cost - of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer to - distribute corresponding source code. (This alternative is allowed - only for noncommercial distribution and only if you received the - program in object code or executable form with such an offer, in - accord with Subsection b above.) - - The source code for a work means the preferred form of the work for - making modifications to it. For an executable work, complete source code - means all the source code for all modules it contains, plus any - associated interface definition files, plus the scripts used to control - compilation and installation of the executable. However, as a special - exception, the source code distributed need not include anything that is - normally distributed (in either source or binary form) with the major - components (compiler, kernel, and so on) of the operating system on - which the executable runs, unless that component itself accompanies the - executable. - - If distribution of executable or object code is made by offering access - to copy from a designated place, then offering equivalent access to copy - the source code from the same place counts as distribution of the source - code, even though third parties are not compelled to copy the source - along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program - except as expressly provided under this License. Any attempt otherwise - to copy, modify, sublicense or distribute the Program is void, and will - automatically terminate your rights under this License. However, parties - who have received copies, or rights, from you under this License will - not have their licenses terminated so long as such parties remain in - full compliance. - - 5. You are not required to accept this License, since you have not - signed it. However, nothing else grants you permission to modify or - distribute the Program or its derivative works. These actions are - prohibited by law if you do not accept this License. Therefore, by - modifying or distributing the Program (or any work based on the - Program), you indicate your acceptance of this License to do so, and all - its terms and conditions for copying, distributing or modifying the - Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the - Program), the recipient automatically receives a license from the - original licensor to copy, distribute or modify the Program subject to - these terms and conditions. You may not impose any further restrictions - on the recipients' exercise of the rights granted herein. You are not - responsible for enforcing compliance by third parties to this License. - - 7. If, as a consequence of a court judgment or allegation of patent - infringement or for any other reason (not limited to patent issues), - conditions are imposed on you (whether by court order, agreement or - otherwise) that contradict the conditions of this License, they do not - excuse you from the conditions of this License. If you cannot distribute - so as to satisfy simultaneously your obligations under this License and - any other pertinent obligations, then as a consequence you may not - distribute the Program at all. For example, if a patent license would - not permit royalty-free redistribution of the Program by all those who - receive copies directly or indirectly through you, then the only way you - could satisfy both it and this License would be to refrain entirely from - distribution of the Program. - - If any portion of this section is held invalid or unenforceable under - any particular circumstance, the balance of the section is intended to - apply and the section as a whole is intended to apply in other - circumstances. - - It is not the purpose of this section to induce you to infringe any - patents or other property right claims or to contest validity of any - such claims; this section has the sole purpose of protecting the - integrity of the free software distribution system, which is implemented - by public license practices. Many people have made generous - contributions to the wide range of software distributed through that - system in reliance on consistent application of that system; it is up to - the author/donor to decide if he or she is willing to distribute - software through any other system and a licensee cannot impose that choice. - - This section is intended to make thoroughly clear what is believed to be - a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in - certain countries either by patents or by copyrighted interfaces, the - original copyright holder who places the Program under this License may - add an explicit geographical distribution limitation excluding those - countries, so that distribution is permitted only in or among countries - not thus excluded. In such case, this License incorporates the - limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new - versions of the General Public License from time to time. Such new - versions will be similar in spirit to the present version, but may - differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the Program - specifies a version number of this License which applies to it and "any - later version", you have the option of following the terms and - conditions either of that version or of any later version published by - the Free Software Foundation. If the Program does not specify a version - number of this License, you may choose any version ever published by the - Free Software Foundation. - - 10. If you wish to incorporate parts of the Program into other free - programs whose distribution conditions are different, write to the - author to ask for permission. For software which is copyrighted by the - Free Software Foundation, write to the Free Software Foundation; we - sometimes make exceptions for this. Our decision will be guided by the - two goals of preserving the free status of all derivatives of our free - software and of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO - WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. - EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR - OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE - ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH - YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL - NECESSARY SERVICING, REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN - WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY - AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR - DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL - DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM - (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED - INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF - THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR - OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest - possible use to the public, the best way to achieve this is to make it - free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest to - attach them to the start of each source file to most effectively convey - the exclusion of warranty; and each file should have at least the - "copyright" line and a pointer to where the full notice is found. - - One line to give the program's name and a brief idea of what it does. - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA - - Also add information on how to contact you by electronic and paper mail. - - If the program is interactive, make it output a short notice like this - when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type - `show w'. This is free software, and you are welcome to redistribute - it under certain conditions; type `show c' for details. - - The hypothetical commands `show w' and `show c' should show the - appropriate parts of the General Public License. Of course, the commands - you use may be called something other than `show w' and `show c'; they - could even be mouse-clicks or menu items--whatever suits your program. - - You should also get your employer (if you work as a programmer) or your - school, if any, to sign a "copyright disclaimer" for the program, if - necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - program `Gnomovision' (which makes passes at compilers) written by - James Hacker. - - signature of Ty Coon, 1 April 1989 - Ty Coon, President of Vice - - This General Public License does not permit incorporating your program - into proprietary programs. If your program is a subroutine library, you - may consider it more useful to permit linking proprietary applications - with the library. If this is what you want to do, use the GNU Library - General Public License instead of this License. - ---- - -## CLASSPATH EXCEPTION - - Linking this library statically or dynamically with other modules is - making a combined work based on this library. Thus, the terms and - conditions of the GNU General Public License version 2 cover the whole - combination. - - As a special exception, the copyright holders of this library give you - permission to link this library with independent modules to produce an - executable, regardless of the license terms of these independent - modules, and to copy and distribute the resulting executable under - terms of your choice, provided that you also meet, for each linked - independent module, the terms and conditions of the license of that - module. An independent module is a module which is not derived from or - based on this library. If you modify this library, you may extend this - exception to your version of the library, but you are not obligated to - do so. If you do not wish to do so, delete this exception statement - from your version. diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-javassist.txt b/hugegraph-dist/release-docs/licenses/LICENSE-javassist.txt index 67a92303ff..f45a423e3f 100644 --- a/hugegraph-dist/release-docs/licenses/LICENSE-javassist.txt +++ b/hugegraph-dist/release-docs/licenses/LICENSE-javassist.txt @@ -355,27 +355,3 @@ MISCELLANEOUS. Portions created by the Initial Developer are
      Copyright (C) 1999- Shigeru Chiba. All Rights Reserved.

    Contributor(s): __Bill Burke, Jason T. Greene______________. - -

    Alternatively, the contents of this software may be used under the -terms of the GNU Lesser General Public License Version 2.1 or later -(the "LGPL"), or the Apache License Version 2.0 (the "AL"), -in which case the provisions of the LGPL or the AL are applicable -instead of those above. If you wish to allow use of your version of -this software only under the terms of either the LGPL or the AL, and not to allow others to -use your version of this software under the terms of the MPL, indicate -your decision by deleting the provisions above and replace them with -the notice and other provisions required by the LGPL or the AL. If you do not -delete the provisions above, a recipient may use your version of this -software under the terms of any one of the MPL, the LGPL or the AL.

    - -

    If you obtain this software as part of JBoss, - the contents of this software may be used under only the terms of the LGPL. - To use them under the MPL, you must obtain a separate package including only - Javassist but not the other part of JBoss.

    - -

    All the contributors to the original source tree have agreed to the original - license term described above.

    - -

    - - \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-javax.activation-api-1.2.0-sources.txt b/hugegraph-dist/release-docs/licenses/LICENSE-javax.activation-api-1.2.0-sources.txt index 859071326e..596a510633 100644 --- a/hugegraph-dist/release-docs/licenses/LICENSE-javax.activation-api-1.2.0-sources.txt +++ b/hugegraph-dist/release-docs/licenses/LICENSE-javax.activation-api-1.2.0-sources.txt @@ -360,400 +360,3 @@ litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California and the state courts of the State of California, with venue lying in Santa Clara County, California. - - - - The GNU General Public License (GPL) Version 2, June 1991 - -Copyright (C) 1989, 1991 Free Software Foundation, Inc. -51 Franklin Street, Fifth Floor -Boston, MA 02110-1335 -USA - -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. - -Preamble - -The licenses for most software are designed to take away your freedom to -share and change it. By contrast, the GNU General Public License is -intended to guarantee your freedom to share and change free software--to -make sure the software is free for all its users. This General Public -License applies to most of the Free Software Foundation's software and -to any other program whose authors commit to using it. (Some other Free -Software Foundation software is covered by the GNU Library General -Public License instead.) You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. -Our General Public Licenses are designed to make sure that you have the -freedom to distribute copies of free software (and charge for this -service if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs; and that you know you can do these things. - -To protect your rights, we need to make restrictions that forbid anyone -to deny you these rights or to ask you to surrender the rights. These -restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - -For example, if you distribute copies of such a program, whether gratis -or for a fee, you must give the recipients all the rights that you have. -You must make sure that they, too, receive or can get the source code. -And you must show them these terms so they know their rights. - -We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - -Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - -Finally, any free program is threatened constantly by software patents. -We wish to avoid the danger that redistributors of a free program will -individually obtain patent licenses, in effect making the program -proprietary. To prevent this, we have made it clear that any patent must -be licensed for everyone's free use or not licensed at all. - -The precise terms and conditions for copying, distribution and -modification follow. - -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - -0. This License applies to any program or other work which contains a -notice placed by the copyright holder saying it may be distributed under -the terms of this General Public License. The "Program", below, refers -to any such program or work, and a "work based on the Program" means -either the Program or any derivative work under copyright law: that is -to say, a work containing the Program or a portion of it, either -verbatim or with modifications and/or translated into another language. -(Hereinafter, translation is included without limitation in the term -"modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of running -the Program is not restricted, and the output from the Program is -covered only if its contents constitute a work based on the Program -(independent of having been made by running the Program). Whether that -is true depends on what the Program does. - -1. You may copy and distribute verbatim copies of the Program's source -code as you receive it, in any medium, provided that you conspicuously -and appropriately publish on each copy an appropriate copyright notice -and disclaimer of warranty; keep intact all the notices that refer to -this License and to the absence of any warranty; and give any other -recipients of the Program a copy of this License along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - -2. You may modify your copy or copies of the Program or any portion of -it, thus forming a work based on the Program, and copy and distribute -such modifications or work under the terms of Section 1 above, provided -that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any part - thereof, to be licensed as a whole at no charge to all third parties - under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a notice - that there is no warranty (or else, saying that you provide a - warranty) and that users may redistribute the program under these - conditions, and telling the user how to view a copy of this License. - (Exception: if the Program itself is interactive but does not - normally print such an announcement, your work based on the Program - is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, and -can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based on -the Program, the distribution of the whole must be on the terms of this -License, whose permissions for other licensees extend to the entire -whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of a -storage or distribution medium does not bring the other work under the -scope of this License. - -3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections 1 - and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your cost - of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer to - distribute corresponding source code. (This alternative is allowed - only for noncommercial distribution and only if you received the - program in object code or executable form with such an offer, in - accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source code -means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to control -compilation and installation of the executable. However, as a special -exception, the source code distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies the -executable. - -If distribution of executable or object code is made by offering access -to copy from a designated place, then offering equivalent access to copy -the source code from the same place counts as distribution of the source -code, even though third parties are not compelled to copy the source -along with the object code. - -4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt otherwise -to copy, modify, sublicense or distribute the Program is void, and will -automatically terminate your rights under this License. However, parties -who have received copies, or rights, from you under this License will -not have their licenses terminated so long as such parties remain in -full compliance. - -5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and all -its terms and conditions for copying, distributing or modifying the -Program or works based on it. - -6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further restrictions -on the recipients' exercise of the rights granted herein. You are not -responsible for enforcing compliance by third parties to this License. - -7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot distribute -so as to satisfy simultaneously your obligations under this License and -any other pertinent obligations, then as a consequence you may not -distribute the Program at all. For example, if a patent license would -not permit royalty-free redistribution of the Program by all those who -receive copies directly or indirectly through you, then the only way you -could satisfy both it and this License would be to refrain entirely from -distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is implemented -by public license practices. Many people have made generous -contributions to the wide range of software distributed through that -system in reliance on consistent application of that system; it is up to -the author/donor to decide if he or she is willing to distribute -software through any other system and a licensee cannot impose that choice. - -This section is intended to make thoroughly clear what is believed to be -a consequence of the rest of this License. - -8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License may -add an explicit geographical distribution limitation excluding those -countries, so that distribution is permitted only in or among countries -not thus excluded. In such case, this License incorporates the -limitation as if written in the body of this License. - -9. The Free Software Foundation may publish revised and/or new -versions of the General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Program does not specify a version -number of this License, you may choose any version ever published by the -Free Software Foundation. - -10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the -author to ask for permission. For software which is copyrighted by the -Free Software Foundation, write to the Free Software Foundation; we -sometimes make exceptions for this. Our decision will be guided by the -two goals of preserving the free status of all derivatives of our free -software and of promoting the sharing and reuse of software generally. - -NO WARRANTY - -11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, -EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE -ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH -YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL -NECESSARY SERVICING, REPAIR OR CORRECTION. - -12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR -DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL -DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM -(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF -THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR -OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -END OF TERMS AND CONDITIONS - -How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to -attach them to the start of each source file to most effectively convey -the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - One line to give the program's name and a brief idea of what it does. - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type - `show w'. This is free software, and you are welcome to redistribute - it under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the -appropriate parts of the General Public License. Of course, the commands -you use may be called something other than `show w' and `show c'; they -could even be mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - program `Gnomovision' (which makes passes at compilers) written by - James Hacker. - - signature of Ty Coon, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications -with the library. If this is what you want to do, use the GNU Library -General Public License instead of this License. - -# - -Certain source files distributed by Oracle America, Inc. and/or its -affiliates are subject to the following clarification and special -exception to the GPLv2, based on the GNU Project exception for its -Classpath libraries, known as the GNU Classpath Exception, but only -where Oracle has expressly included in the particular source file's -header the words "Oracle designates this particular file as subject to -the "Classpath" exception as provided by Oracle in the LICENSE file -that accompanied this code." - -You should also note that Oracle includes multiple, independent -programs in this software package. Some of those programs are provided -under licenses deemed incompatible with the GPLv2 by the Free Software -Foundation and others. For example, the package includes programs -licensed under the Apache License, Version 2.0. Such programs are -licensed to you under their original licenses. - -Oracle facilitates your further distribution of this package by adding -the Classpath Exception to the necessary parts of its GPLv2 code, which -permits you to use that code in combination with other independent -modules not licensed under the GPLv2. However, note that this would -not permit you to commingle code under an incompatible license with -Oracle's GPLv2 licensed code by, for example, cutting and pasting such -code into a file also containing Oracle's GPLv2 licensed code and then -distributing the result. Additionally, if you were to remove the -Classpath Exception from any of the files to which it applies and -distribute the result, you would likely be required to license some or -all of the other code in that distribution under the GPLv2 as well, and -since the GPLv2 is incompatible with the license terms of some items -included in the distribution by Oracle, removing the Classpath -Exception could therefore effectively compromise your ability to -further distribute the package. - -Proceed with caution and we recommend that you obtain the advice of a -lawyer skilled in open source matters before removing the Classpath -Exception or making modifications to this package which may -subsequently be redistributed and/or involve the use of third party -software. - -CLASSPATH EXCEPTION -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License version 2 cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from or -based on this library. If you modify this library, you may extend this -exception to your version of the library, but you are not obligated to -do so. If you do not wish to do so, delete this exception statement -from your version. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jersey.txt b/hugegraph-dist/release-docs/licenses/LICENSE-jersey.txt index 9e9429fce4..82dfb5ccd4 100644 --- a/hugegraph-dist/release-docs/licenses/LICENSE-jersey.txt +++ b/hugegraph-dist/release-docs/licenses/LICENSE-jersey.txt @@ -360,400 +360,3 @@ litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California and the state courts of the State of California, with venue lying in Santa Clara County, California. - - - - The GNU General Public License (GPL) Version 2, June 1991 - -Copyright (C) 1989, 1991 Free Software Foundation, Inc. -51 Franklin Street, Fifth Floor -Boston, MA 02110-1335 -USA - -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. - -Preamble - -The licenses for most software are designed to take away your freedom to -share and change it. By contrast, the GNU General Public License is -intended to guarantee your freedom to share and change free software--to -make sure the software is free for all its users. This General Public -License applies to most of the Free Software Foundation's software and -to any other program whose authors commit to using it. (Some other Free -Software Foundation software is covered by the GNU Library General -Public License instead.) You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. -Our General Public Licenses are designed to make sure that you have the -freedom to distribute copies of free software (and charge for this -service if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs; and that you know you can do these things. - -To protect your rights, we need to make restrictions that forbid anyone -to deny you these rights or to ask you to surrender the rights. These -restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - -For example, if you distribute copies of such a program, whether gratis -or for a fee, you must give the recipients all the rights that you have. -You must make sure that they, too, receive or can get the source code. -And you must show them these terms so they know their rights. - -We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - -Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - -Finally, any free program is threatened constantly by software patents. -We wish to avoid the danger that redistributors of a free program will -individually obtain patent licenses, in effect making the program -proprietary. To prevent this, we have made it clear that any patent must -be licensed for everyone's free use or not licensed at all. - -The precise terms and conditions for copying, distribution and -modification follow. - -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - -0. This License applies to any program or other work which contains a -notice placed by the copyright holder saying it may be distributed under -the terms of this General Public License. The "Program", below, refers -to any such program or work, and a "work based on the Program" means -either the Program or any derivative work under copyright law: that is -to say, a work containing the Program or a portion of it, either -verbatim or with modifications and/or translated into another language. -(Hereinafter, translation is included without limitation in the term -"modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of running -the Program is not restricted, and the output from the Program is -covered only if its contents constitute a work based on the Program -(independent of having been made by running the Program). Whether that -is true depends on what the Program does. - -1. You may copy and distribute verbatim copies of the Program's source -code as you receive it, in any medium, provided that you conspicuously -and appropriately publish on each copy an appropriate copyright notice -and disclaimer of warranty; keep intact all the notices that refer to -this License and to the absence of any warranty; and give any other -recipients of the Program a copy of this License along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - -2. You may modify your copy or copies of the Program or any portion of -it, thus forming a work based on the Program, and copy and distribute -such modifications or work under the terms of Section 1 above, provided -that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any part - thereof, to be licensed as a whole at no charge to all third parties - under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a notice - that there is no warranty (or else, saying that you provide a - warranty) and that users may redistribute the program under these - conditions, and telling the user how to view a copy of this License. - (Exception: if the Program itself is interactive but does not - normally print such an announcement, your work based on the Program - is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, and -can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based on -the Program, the distribution of the whole must be on the terms of this -License, whose permissions for other licensees extend to the entire -whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of a -storage or distribution medium does not bring the other work under the -scope of this License. - -3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections 1 - and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your cost - of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer to - distribute corresponding source code. (This alternative is allowed - only for noncommercial distribution and only if you received the - program in object code or executable form with such an offer, in - accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source code -means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to control -compilation and installation of the executable. However, as a special -exception, the source code distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies the -executable. - -If distribution of executable or object code is made by offering access -to copy from a designated place, then offering equivalent access to copy -the source code from the same place counts as distribution of the source -code, even though third parties are not compelled to copy the source -along with the object code. - -4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt otherwise -to copy, modify, sublicense or distribute the Program is void, and will -automatically terminate your rights under this License. However, parties -who have received copies, or rights, from you under this License will -not have their licenses terminated so long as such parties remain in -full compliance. - -5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and all -its terms and conditions for copying, distributing or modifying the -Program or works based on it. - -6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further restrictions -on the recipients' exercise of the rights granted herein. You are not -responsible for enforcing compliance by third parties to this License. - -7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot distribute -so as to satisfy simultaneously your obligations under this License and -any other pertinent obligations, then as a consequence you may not -distribute the Program at all. For example, if a patent license would -not permit royalty-free redistribution of the Program by all those who -receive copies directly or indirectly through you, then the only way you -could satisfy both it and this License would be to refrain entirely from -distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is implemented -by public license practices. Many people have made generous -contributions to the wide range of software distributed through that -system in reliance on consistent application of that system; it is up to -the author/donor to decide if he or she is willing to distribute -software through any other system and a licensee cannot impose that choice. - -This section is intended to make thoroughly clear what is believed to be -a consequence of the rest of this License. - -8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License may -add an explicit geographical distribution limitation excluding those -countries, so that distribution is permitted only in or among countries -not thus excluded. In such case, this License incorporates the -limitation as if written in the body of this License. - -9. The Free Software Foundation may publish revised and/or new -versions of the General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Program does not specify a version -number of this License, you may choose any version ever published by the -Free Software Foundation. - -10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the -author to ask for permission. For software which is copyrighted by the -Free Software Foundation, write to the Free Software Foundation; we -sometimes make exceptions for this. Our decision will be guided by the -two goals of preserving the free status of all derivatives of our free -software and of promoting the sharing and reuse of software generally. - -NO WARRANTY - -11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, -EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE -ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH -YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL -NECESSARY SERVICING, REPAIR OR CORRECTION. - -12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR -DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL -DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM -(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF -THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR -OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -END OF TERMS AND CONDITIONS - -How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to -attach them to the start of each source file to most effectively convey -the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - One line to give the program's name and a brief idea of what it does. - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type - `show w'. This is free software, and you are welcome to redistribute - it under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the -appropriate parts of the General Public License. Of course, the commands -you use may be called something other than `show w' and `show c'; they -could even be mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - program `Gnomovision' (which makes passes at compilers) written by - James Hacker. - - signature of Ty Coon, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications -with the library. If this is what you want to do, use the GNU Library -General Public License instead of this License. - -# - -Certain source files distributed by Oracle America, Inc. and/or its -affiliates are subject to the following clarification and special -exception to the GPLv2, based on the GNU Project exception for its -Classpath libraries, known as the GNU Classpath Exception, but only -where Oracle has expressly included in the particular source file's -header the words "Oracle designates this particular file as subject to -the "Classpath" exception as provided by Oracle in the LICENSE file -that accompanied this code." - -You should also note that Oracle includes multiple, independent -programs in this software package. Some of those programs are provided -under licenses deemed incompatible with the GPLv2 by the Free Software -Foundation and others. For example, the package includes programs -licensed under the Apache License, Version 2.0. Such programs are -licensed to you under their original licenses. - -Oracle facilitates your further distribution of this package by adding -the Classpath Exception to the necessary parts of its GPLv2 code, which -permits you to use that code in combination with other independent -modules not licensed under the GPLv2. However, note that this would -not permit you to commingle code under an incompatible license with -Oracle's GPLv2 licensed code by, for example, cutting and pasting such -code into a file also containing Oracle's GPLv2 licensed code and then -distributing the result. Additionally, if you were to remove the -Classpath Exception from any of the files to which it applies and -distribute the result, you would likely be required to license some or -all of the other code in that distribution under the GPLv2 as well, and -since the GPLv2 is incompatible with the license terms of some items -included in the distribution by Oracle, removing the Classpath -Exception could therefore effectively compromise your ability to -further distribute the package. - -Proceed with caution and we recommend that you obtain the advice of a -lawyer skilled in open source matters before removing the Classpath -Exception or making modifications to this package which may -subsequently be redistributed and/or involve the use of third party -software. - -CLASSPATH EXCEPTION -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License version 2 cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from or -based on this library. If you modify this library, you may extend this -exception to your version of the library, but you are not obligated to -do so. If you do not wish to do so, delete this exception statement -from your version. \ No newline at end of file diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jsonp.txt b/hugegraph-dist/release-docs/licenses/LICENSE-jsonp.txt index 68076ad96b..4a00ba9482 100644 --- a/hugegraph-dist/release-docs/licenses/LICENSE-jsonp.txt +++ b/hugegraph-dist/release-docs/licenses/LICENSE-jsonp.txt @@ -360,400 +360,3 @@ litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California and the state courts of the State of California, with venue lying in Santa Clara County, California. - - - - The GNU General Public License (GPL) Version 2, June 1991 - -Copyright (C) 1989, 1991 Free Software Foundation, Inc. -51 Franklin Street, Fifth Floor -Boston, MA 02110-1335 -USA - -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. - -Preamble - -The licenses for most software are designed to take away your freedom to -share and change it. By contrast, the GNU General Public License is -intended to guarantee your freedom to share and change free software--to -make sure the software is free for all its users. This General Public -License applies to most of the Free Software Foundation's software and -to any other program whose authors commit to using it. (Some other Free -Software Foundation software is covered by the GNU Library General -Public License instead.) You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. -Our General Public Licenses are designed to make sure that you have the -freedom to distribute copies of free software (and charge for this -service if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs; and that you know you can do these things. - -To protect your rights, we need to make restrictions that forbid anyone -to deny you these rights or to ask you to surrender the rights. These -restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - -For example, if you distribute copies of such a program, whether gratis -or for a fee, you must give the recipients all the rights that you have. -You must make sure that they, too, receive or can get the source code. -And you must show them these terms so they know their rights. - -We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - -Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - -Finally, any free program is threatened constantly by software patents. -We wish to avoid the danger that redistributors of a free program will -individually obtain patent licenses, in effect making the program -proprietary. To prevent this, we have made it clear that any patent must -be licensed for everyone's free use or not licensed at all. - -The precise terms and conditions for copying, distribution and -modification follow. - -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - -0. This License applies to any program or other work which contains a -notice placed by the copyright holder saying it may be distributed under -the terms of this General Public License. The "Program", below, refers -to any such program or work, and a "work based on the Program" means -either the Program or any derivative work under copyright law: that is -to say, a work containing the Program or a portion of it, either -verbatim or with modifications and/or translated into another language. -(Hereinafter, translation is included without limitation in the term -"modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of running -the Program is not restricted, and the output from the Program is -covered only if its contents constitute a work based on the Program -(independent of having been made by running the Program). Whether that -is true depends on what the Program does. - -1. You may copy and distribute verbatim copies of the Program's source -code as you receive it, in any medium, provided that you conspicuously -and appropriately publish on each copy an appropriate copyright notice -and disclaimer of warranty; keep intact all the notices that refer to -this License and to the absence of any warranty; and give any other -recipients of the Program a copy of this License along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - -2. You may modify your copy or copies of the Program or any portion of -it, thus forming a work based on the Program, and copy and distribute -such modifications or work under the terms of Section 1 above, provided -that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any part - thereof, to be licensed as a whole at no charge to all third parties - under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a notice - that there is no warranty (or else, saying that you provide a - warranty) and that users may redistribute the program under these - conditions, and telling the user how to view a copy of this License. - (Exception: if the Program itself is interactive but does not - normally print such an announcement, your work based on the Program - is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, and -can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based on -the Program, the distribution of the whole must be on the terms of this -License, whose permissions for other licensees extend to the entire -whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of a -storage or distribution medium does not bring the other work under the -scope of this License. - -3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections 1 - and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your cost - of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer to - distribute corresponding source code. (This alternative is allowed - only for noncommercial distribution and only if you received the - program in object code or executable form with such an offer, in - accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source code -means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to control -compilation and installation of the executable. However, as a special -exception, the source code distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies the -executable. - -If distribution of executable or object code is made by offering access -to copy from a designated place, then offering equivalent access to copy -the source code from the same place counts as distribution of the source -code, even though third parties are not compelled to copy the source -along with the object code. - -4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt otherwise -to copy, modify, sublicense or distribute the Program is void, and will -automatically terminate your rights under this License. However, parties -who have received copies, or rights, from you under this License will -not have their licenses terminated so long as such parties remain in -full compliance. - -5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and all -its terms and conditions for copying, distributing or modifying the -Program or works based on it. - -6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further restrictions -on the recipients' exercise of the rights granted herein. You are not -responsible for enforcing compliance by third parties to this License. - -7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot distribute -so as to satisfy simultaneously your obligations under this License and -any other pertinent obligations, then as a consequence you may not -distribute the Program at all. For example, if a patent license would -not permit royalty-free redistribution of the Program by all those who -receive copies directly or indirectly through you, then the only way you -could satisfy both it and this License would be to refrain entirely from -distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is implemented -by public license practices. Many people have made generous -contributions to the wide range of software distributed through that -system in reliance on consistent application of that system; it is up to -the author/donor to decide if he or she is willing to distribute -software through any other system and a licensee cannot impose that choice. - -This section is intended to make thoroughly clear what is believed to be -a consequence of the rest of this License. - -8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License may -add an explicit geographical distribution limitation excluding those -countries, so that distribution is permitted only in or among countries -not thus excluded. In such case, this License incorporates the -limitation as if written in the body of this License. - -9. The Free Software Foundation may publish revised and/or new -versions of the General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Program does not specify a version -number of this License, you may choose any version ever published by the -Free Software Foundation. - -10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the -author to ask for permission. For software which is copyrighted by the -Free Software Foundation, write to the Free Software Foundation; we -sometimes make exceptions for this. Our decision will be guided by the -two goals of preserving the free status of all derivatives of our free -software and of promoting the sharing and reuse of software generally. - -NO WARRANTY - -11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, -EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE -ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH -YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL -NECESSARY SERVICING, REPAIR OR CORRECTION. - -12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR -DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL -DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM -(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF -THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR -OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -END OF TERMS AND CONDITIONS - -How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to -attach them to the start of each source file to most effectively convey -the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - One line to give the program's name and a brief idea of what it does. - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type - `show w'. This is free software, and you are welcome to redistribute - it under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the -appropriate parts of the General Public License. Of course, the commands -you use may be called something other than `show w' and `show c'; they -could even be mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - program `Gnomovision' (which makes passes at compilers) written by - James Hacker. - - signature of Ty Coon, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications -with the library. If this is what you want to do, use the GNU Library -General Public License instead of this License. - -# - -Certain source files distributed by Oracle America, Inc. and/or its -affiliates are subject to the following clarification and special -exception to the GPLv2, based on the GNU Project exception for its -Classpath libraries, known as the GNU Classpath Exception, but only -where Oracle has expressly included in the particular source file's -header the words "Oracle designates this particular file as subject to -the "Classpath" exception as provided by Oracle in the LICENSE file -that accompanied this code." - -You should also note that Oracle includes multiple, independent -programs in this software package. Some of those programs are provided -under licenses deemed incompatible with the GPLv2 by the Free Software -Foundation and others. For example, the package includes programs -licensed under the Apache License, Version 2.0. Such programs are -licensed to you under their original licenses. - -Oracle facilitates your further distribution of this package by adding -the Classpath Exception to the necessary parts of its GPLv2 code, which -permits you to use that code in combination with other independent -modules not licensed under the GPLv2. However, note that this would -not permit you to commingle code under an incompatible license with -Oracle's GPLv2 licensed code by, for example, cutting and pasting such -code into a file also containing Oracle's GPLv2 licensed code and then -distributing the result. Additionally, if you were to remove the -Classpath Exception from any of the files to which it applies and -distribute the result, you would likely be required to license some or -all of the other code in that distribution under the GPLv2 as well, and -since the GPLv2 is incompatible with the license terms of some items -included in the distribution by Oracle, removing the Classpath -Exception could therefore effectively compromise your ability to -further distribute the package. - -Proceed with caution and we recommend that you obtain the advice of a -lawyer skilled in open source matters before removing the Classpath -Exception or making modifications to this package which may -subsequently be redistributed and/or involve the use of third party -software. - -CLASSPATH EXCEPTION -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License version 2 cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from or -based on this library. If you modify this library, you may extend this -exception to your version of the library, but you are not obligated to -do so. If you do not wish to do so, delete this exception statement -from your version. \ No newline at end of file From 6aa01af49e85eb99e6f6fa2b6c2c98a736b56b67 Mon Sep 17 00:00:00 2001 From: Simon Cheung Date: Thu, 9 Feb 2023 18:07:21 +0800 Subject: [PATCH 200/217] Update NOTICE --- hugegraph-dist/release-docs/NOTICE | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hugegraph-dist/release-docs/NOTICE b/hugegraph-dist/release-docs/NOTICE index fff5477397..f058182929 100644 --- a/hugegraph-dist/release-docs/NOTICE +++ b/hugegraph-dist/release-docs/NOTICE @@ -1,9 +1,11 @@ -Apache HugeGraph -Copyright 2021-2022 The Apache Software Foundation +Apache HugeGraph(incubating) +Copyright 2022-2023 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). +The initial codebase was donated to the ASF by HugeGraph Authors, copyright 2017-2021. + ======================================================================== commons-logging NOTICE @@ -919,4 +921,4 @@ SPDX-License-Identifier: BSD-3-Clause The project maintains the following source code repositories: -* https://github.com/eclipse-ee4j/jaf \ No newline at end of file +* https://github.com/eclipse-ee4j/jaf From f9593d494bf58e4a6bd71a8666f85e506efc1518 Mon Sep 17 00:00:00 2001 From: imbajin Date: Tue, 7 Feb 2023 23:59:45 +0800 Subject: [PATCH 201/217] chore: refactor the license check CI --- .github/workflows/check-dependencies.yml | 31 ---------------------- .github/workflows/ci.yml | 2 +- .github/workflows/license-checker.yml | 33 +++++++++++++++++++++--- .github/workflows/stale.yml | 2 +- 4 files changed, 31 insertions(+), 37 deletions(-) delete mode 100644 .github/workflows/check-dependencies.yml diff --git a/.github/workflows/check-dependencies.yml b/.github/workflows/check-dependencies.yml deleted file mode 100644 index fe8b2d55c4..0000000000 --- a/.github/workflows/check-dependencies.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: third-party dependencies check - -on: - push: - branches: - - master - - /^release-.*$/ - pull_request: - -jobs: - build: - runs-on: ubuntu-latest - env: - SCRIPT_DEPENDENCY: hugegraph-dist/scripts/dependency - steps: - - name: Checkout source - uses: actions/checkout@v3 - - name: Set up JDK 11 - uses: actions/setup-java@v3 - with: - java-version: '11' - distribution: 'adopt' - - name: mvn install - run: | - mvn install -DskipTests=true - - name: generate current dependencies - run: | - bash $SCRIPT_DEPENDENCY/regenerate_known_dependencies.sh current-dependencies.txt - - name: check third dependencies - run: | - bash $SCRIPT_DEPENDENCY/check_dependencies.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b2552479e7..0616bf882f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: hugegraph-commons ci +name: "hugegraph-commons ci" on: push: diff --git a/.github/workflows/license-checker.yml b/.github/workflows/license-checker.yml index 2345f12532..8cdfb9358b 100644 --- a/.github/workflows/license-checker.yml +++ b/.github/workflows/license-checker.yml @@ -1,15 +1,18 @@ -name: License checker +name: "license checker" on: push: branches: - master + - /^release-.*$/ pull_request: - branches: - - master + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: - check-license: + check-license-header: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -32,3 +35,25 @@ jobs: mvn apache-rat:check -ntp find ./ -name rat.txt -print0 | xargs -0 -I file cat file > merged-rat.txt grep "Binaries" merged-rat.txt -C 3 && cat merged-rat.txt + + check-dependency-license: + runs-on: ubuntu-latest + env: + SCRIPT_DEPENDENCY: hugegraph-dist/scripts/dependency + steps: + - name: Checkout source + uses: actions/checkout@v3 + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + - name: mvn install + run: | + mvn install -DskipTests=true -ntp + - name: generate current dependencies + run: | + bash $SCRIPT_DEPENDENCY/regenerate_known_dependencies.sh current-dependencies.txt + - name: check third dependencies + run: | + bash $SCRIPT_DEPENDENCY/check_dependencies.sh \ No newline at end of file diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 1d7651bc73..c38c7afe7e 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,4 +1,4 @@ -name: Mark stale issues and pull requests +name: "Mark stale issues and pull requests" on: schedule: From 82f2a6539f50cf060f02c3d8663444b14050796f Mon Sep 17 00:00:00 2001 From: imbajin Date: Wed, 8 Feb 2023 00:10:38 +0800 Subject: [PATCH 202/217] Update license-checker.yml --- .github/workflows/license-checker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/license-checker.yml b/.github/workflows/license-checker.yml index 8cdfb9358b..9c74ed0a4e 100644 --- a/.github/workflows/license-checker.yml +++ b/.github/workflows/license-checker.yml @@ -56,4 +56,4 @@ jobs: bash $SCRIPT_DEPENDENCY/regenerate_known_dependencies.sh current-dependencies.txt - name: check third dependencies run: | - bash $SCRIPT_DEPENDENCY/check_dependencies.sh \ No newline at end of file + bash $SCRIPT_DEPENDENCY/check_dependencies.sh From 297e49123298da7c17aecd5db826f4ff8d8a5fe5 Mon Sep 17 00:00:00 2001 From: zoulei <1043706593@qq.com> Date: Fri, 21 Apr 2023 00:07:05 +0800 Subject: [PATCH 203/217] fix commons dependency conflict (#131) * fix commons dependency conflict * upgrade commons version to 1.0.1 * upgrade grpc-core version to 1.28.1 Co-authored-by: imbajin --- hugegraph-common/pom.xml | 73 +++++++++++++++++++ .../hugegraph/version/CommonVersion.java | 2 +- .../scripts/dependency/known-dependencies.txt | 6 +- hugegraph-rpc/pom.xml | 9 +++ .../apache/hugegraph/version/RpcVersion.java | 2 +- pom.xml | 4 +- 6 files changed, 90 insertions(+), 6 deletions(-) diff --git a/hugegraph-common/pom.xml b/hugegraph-common/pom.xml index b75cdc5403..01bf29b16f 100644 --- a/hugegraph-common/pom.xml +++ b/hugegraph-common/pom.xml @@ -85,11 +85,32 @@ org.apache.commons commons-configuration2 ${commons.configuration2.version} + + + commons-logging + commons-logging + + + commons-lang3 + org.apache.commons + + + + + org.apache.commons + commons-lang3 + ${commons.lang3.version} commons-beanutils commons-beanutils ${commons.beanutils.version} + + + commons-logging + commons-logging + + commons-io @@ -110,6 +131,12 @@ com.google.guava guava ${guava.version} + + + jsr305 + com.google.code.findbugs + + @@ -151,6 +178,12 @@ com.fasterxml.jackson.module jackson-module-jaxb-annotations ${jackson.version} + + + jakarta.xml.bind-api + jakarta.xml.bind + + com.fasterxml.jackson.jaxrs @@ -182,28 +215,68 @@ com.fasterxml.jackson.jaxrs jackson-jaxrs-json-provider + + jackson-annotations + com.fasterxml.jackson.core + + + jackson-databind + com.fasterxml.jackson.core + + + jackson-module-jaxb-annotations + com.fasterxml.jackson.module + org.glassfish.jersey.connectors jersey-apache-connector ${jersey.version} + + + commons-codec + commons-codec + + + commons-logging + commons-logging + + org.glassfish.jersey.inject jersey-hk2 ${jersey.hk2.version} + + + javassist + org.javassist + + jakarta.xml.bind jakarta.xml.bind-api ${jakarta.xml.version} + + + jakarta.activation-api + jakarta.activation + + com.sun.xml.bind jaxb-impl ${sun.xml.version} runtime + + + jakarta.xml.bind-api + jakarta.xml.bind + + diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/version/CommonVersion.java b/hugegraph-common/src/main/java/org/apache/hugegraph/version/CommonVersion.java index e2fa83a385..bcdad92654 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/version/CommonVersion.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/version/CommonVersion.java @@ -24,5 +24,5 @@ public class CommonVersion { public static final String NAME = "hugegraph-common"; // The second parameter of Version.of() is for all-in-one JAR - public static final Version VERSION = Version.of(CommonVersion.class, "1.0.0"); + public static final Version VERSION = Version.of(CommonVersion.class, "1.0.1"); } diff --git a/hugegraph-dist/scripts/dependency/known-dependencies.txt b/hugegraph-dist/scripts/dependency/known-dependencies.txt index 40d65bff8b..c6de269ced 100644 --- a/hugegraph-dist/scripts/dependency/known-dependencies.txt +++ b/hugegraph-dist/scripts/dependency/known-dependencies.txt @@ -16,9 +16,9 @@ commons-text-1.9.jar disruptor-3.3.7.jar error_prone_annotations-2.3.4.jar failureaccess-1.0.1.jar -grpc-api-1.28.0.jar -grpc-context-1.28.0.jar -grpc-core-1.28.0.jar +grpc-api-1.28.1.jar +grpc-context-1.28.1.jar +grpc-core-1.28.1.jar grpc-netty-shaded-1.28.0.jar grpc-protobuf-1.28.0.jar grpc-protobuf-lite-1.28.0.jar diff --git a/hugegraph-rpc/pom.xml b/hugegraph-rpc/pom.xml index a6c15df21d..0637da1c5c 100644 --- a/hugegraph-rpc/pom.xml +++ b/hugegraph-rpc/pom.xml @@ -96,8 +96,17 @@ org.slf4j slf4j-api + + io.grpc + grpc-core + + + io.grpc + grpc-core + 1.28.1 + diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/version/RpcVersion.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/version/RpcVersion.java index 70be408cdf..f3cf926a0b 100644 --- a/hugegraph-rpc/src/main/java/org/apache/hugegraph/version/RpcVersion.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/version/RpcVersion.java @@ -24,5 +24,5 @@ public class RpcVersion { public static final String NAME = "hugegraph-rpc"; // The second parameter of Version.of() is for all-in-one JAR - public static final Version VERSION = Version.of(RpcVersion.class, "1.0.0"); + public static final Version VERSION = Version.of(RpcVersion.class, "1.0.1"); } diff --git a/pom.xml b/pom.xml index a726be5a2a..8f2e39bb2e 100644 --- a/pom.xml +++ b/pom.xml @@ -89,7 +89,8 @@
    - 1.0.0 + + 1.0.1 UTF-8 ${project.basedir}/.. 1.8 @@ -99,6 +100,7 @@ 2.8.0 1.9.4 3.2.2 + 3.12.0 2.7 1.13 30.0-jre From c31a53641febb1008d45ddeb1fb45b7b765aeb5d Mon Sep 17 00:00:00 2001 From: ustcer <68738717+chengxin1374@users.noreply.github.com> Date: Wed, 19 Jul 2023 21:06:52 +0800 Subject: [PATCH 204/217] add some construction methods for more convenient use (#132) Co-authored-by: chengxin05 --- .../java/org/apache/hugegraph/config/HugeConfig.java | 11 +++++++++++ .../java/org/apache/hugegraph/event/EventHub.java | 7 +++++-- .../java/org/apache/hugegraph/rest/RestResult.java | 12 +++++++++--- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/config/HugeConfig.java b/hugegraph-common/src/main/java/org/apache/hugegraph/config/HugeConfig.java index b765369f4e..c48219fc68 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/config/HugeConfig.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/config/HugeConfig.java @@ -55,6 +55,17 @@ public HugeConfig(String configFile) { this.configPath = configFile; } + public HugeConfig(Map propertyMap) { + if (propertyMap == null) { + throw new ConfigException("The property map is null"); + } + + for (Map.Entry kv : propertyMap.entrySet()) { + this.addProperty(kv.getKey(), kv.getValue()); + } + this.checkRequiredOptions(); + } + private void loadConfig(Configuration config) { if (config == null) { throw new ConfigException("The config object is null"); diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventHub.java b/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventHub.java index 0886e7e981..5107fba698 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventHub.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventHub.java @@ -57,11 +57,14 @@ public EventHub() { } public EventHub(String name) { - LOG.debug("Create new EventHub: {}", name); + this(name, 1); + } + public EventHub(String name, int threadSize) { + LOG.debug("Create new EventHub {}", name); this.name = name; this.listeners = new ConcurrentHashMap<>(); - EventHub.init(1); + EventHub.init(threadSize); } public static synchronized void init(int poolSize) { diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestResult.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestResult.java index 813aeff3d9..82b7f39a19 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestResult.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestResult.java @@ -38,9 +38,15 @@ public class RestResult { private final String content; public RestResult(Response response) { - this.status = response.getStatus(); - this.headers = response.getHeaders(); - this.content = response.readEntity(String.class); + this(response.getStatus(), response.readEntity(String.class), + response.getHeaders()); + } + + public RestResult(int status, String content, + MultivaluedMap headers) { + this.status = status; + this.headers = headers; + this.content = content; } public int status() { From b49be051717691a6b989910ee1f7a04d2c3ab7d8 Mon Sep 17 00:00:00 2001 From: M <87920097+msgui@users.noreply.github.com> Date: Wed, 20 Sep 2023 17:47:01 +0800 Subject: [PATCH 205/217] add: dependency-review (#134) * add: dependency-review * tiny improve * fix Co-authored-by: imbajin --------- Co-authored-by: imbajin --- .github/workflows/codeql-analysis.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index aa71513dc4..7b895324a3 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -3,8 +3,6 @@ name: "CodeQL" on: - push: - branches: [ master, release-* ] pull_request: # The branches below must be a subset of the branches above # branches: [ master ] # enable in all PRs @@ -57,3 +55,12 @@ jobs: - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 + + dependency-review: + runs-on: ubuntu-latest + steps: + - name: 'Checkout Repository' + uses: actions/checkout@v3 + - name: 'Dependency Review' + uses: actions/dependency-review-action@v3 + From 5ad55fb82f1e8720778aa1a337f5cd2d0535c8b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87?= <940643974@qq.com> Date: Wed, 22 Nov 2023 09:37:02 +0800 Subject: [PATCH 206/217] feat(common): replace jersey dependencies with OkHttp (Breaking Change) (#133) * remove jersey * Update ci.yml * refact: replace params okhttp3.Headers to internal RestHeaders * fix: licence dependency * fix: test error * fix: code format issue * fix: unit test error --------- Co-authored-by: imbajin --- .github/workflows/ci.yml | 1 + .github/workflows/license-checker.yml | 1 + hugegraph-common/pom.xml | 107 +-- .../hugegraph/rest/AbstractRestClient.java | 719 +++++++----------- .../rest/OkHttpBasicAuthInterceptor.java | 47 ++ .../rest/OkHttpTokenInterceptor.java | 50 ++ .../org/apache/hugegraph/rest/RestClient.java | 11 +- .../hugegraph/rest/RestClientConfig.java | 41 + .../apache/hugegraph/rest/RestHeaders.java | 90 +++ .../org/apache/hugegraph/rest/RestResult.java | 46 +- .../org/apache/hugegraph/util/JsonUtil.java | 62 ++ .../hugegraph/version/CommonVersion.java | 2 +- .../hugegraph/unit/rest/RestClientTest.java | 507 +++++------- .../hugegraph/unit/rest/RestResultTest.java | 61 +- .../unit/util/ReflectionUtilTest.java | 4 +- .../org.mockito.plugins.MockMaker | 17 + .../scripts/dependency/known-dependencies.txt | 29 +- .../apache/hugegraph/version/RpcVersion.java | 2 +- pom.xml | 2 +- 19 files changed, 887 insertions(+), 912 deletions(-) create mode 100644 hugegraph-common/src/main/java/org/apache/hugegraph/rest/OkHttpBasicAuthInterceptor.java create mode 100644 hugegraph-common/src/main/java/org/apache/hugegraph/rest/OkHttpTokenInterceptor.java create mode 100644 hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClientConfig.java create mode 100644 hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestHeaders.java create mode 100644 hugegraph-common/src/main/java/org/apache/hugegraph/util/JsonUtil.java create mode 100644 hugegraph-common/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0616bf882f..cc0cd1aa00 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,7 @@ name: "hugegraph-commons ci" on: + workflow_dispatch: push: branches: - master diff --git a/.github/workflows/license-checker.yml b/.github/workflows/license-checker.yml index 9c74ed0a4e..0485bd1b11 100644 --- a/.github/workflows/license-checker.yml +++ b/.github/workflows/license-checker.yml @@ -1,6 +1,7 @@ name: "license checker" on: + workflow_dispatch: push: branches: - master diff --git a/hugegraph-common/pom.xml b/hugegraph-common/pom.xml index 01bf29b16f..2010869b17 100644 --- a/hugegraph-common/pom.xml +++ b/hugegraph-common/pom.xml @@ -15,8 +15,8 @@ See the License for the specific language governing permissions and limitations under the License. --> - 4.0.0 @@ -32,11 +32,14 @@ hugegraph-common is a common module for HugeGraph and its peripheral components. hugegraph-common encapsulates locks, configurations, events, iterators, rest and some - numeric or collection util classes to simplify the development of HugeGraph and its components. + numeric or collection util classes to simplify the development of HugeGraph and its + components. + 1.18.8 + 4.10.0 @@ -196,76 +199,6 @@ ${jackson.version} - - - org.glassfish.jersey.core - jersey-client - ${jersey.version} - - - org.glassfish.jersey.media - jersey-media-json-jackson - ${jersey.version} - - - com.fasterxml.jackson.jaxrs - jackson-jaxrs-base - - - com.fasterxml.jackson.jaxrs - jackson-jaxrs-json-provider - - - jackson-annotations - com.fasterxml.jackson.core - - - jackson-databind - com.fasterxml.jackson.core - - - jackson-module-jaxb-annotations - com.fasterxml.jackson.module - - - - - org.glassfish.jersey.connectors - jersey-apache-connector - ${jersey.version} - - - commons-codec - commons-codec - - - commons-logging - commons-logging - - - - - org.glassfish.jersey.inject - jersey-hk2 - ${jersey.hk2.version} - - - javassist - org.javassist - - - - - jakarta.xml.bind - jakarta.xml.bind-api - ${jakarta.xml.version} - - - jakarta.activation-api - jakarta.activation - - - com.sun.xml.bind jaxb-impl @@ -278,8 +211,36 @@ + + + com.squareup.okhttp3 + okhttp + + + com.squareup.okhttp3 + logging-interceptor + + + + org.projectlombok + lombok + ${lombok.version} + true + + + + + com.squareup.okhttp3 + okhttp-bom + ${okhttp.version} + pom + import + + + + diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java index ea7e923ee1..27d9add572 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java @@ -17,188 +17,219 @@ package org.apache.hugegraph.rest; +import java.io.FileInputStream; +import java.io.IOException; import java.net.URI; -import java.security.KeyManagementException; -import java.security.SecureRandom; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; +import java.security.KeyStore; +import java.util.Arrays; import java.util.Collection; -import java.util.List; import java.util.Map; -import java.util.concurrent.Callable; -import java.util.concurrent.ScheduledExecutorService; +import java.util.Objects; import java.util.concurrent.TimeUnit; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSession; +import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.TrustManager; +import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.X509TrustManager; -import org.apache.commons.collections.MapUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang3.tuple.Pair; -import org.apache.http.HttpHeaders; -import org.apache.http.config.Registry; -import org.apache.http.config.RegistryBuilder; -import org.apache.http.conn.socket.ConnectionSocketFactory; -import org.apache.http.conn.socket.PlainConnectionSocketFactory; -import org.apache.http.conn.ssl.SSLConnectionSocketFactory; -import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; -import org.apache.http.pool.PoolStats; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.ExecutorUtil; -import org.glassfish.jersey.SslConfigurator; -import org.glassfish.jersey.apache.connector.ApacheClientProperties; -import org.glassfish.jersey.apache.connector.ApacheConnectorProvider; -import org.glassfish.jersey.client.ClientConfig; -import org.glassfish.jersey.client.ClientProperties; -import org.glassfish.jersey.client.JerseyClientBuilder; -import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; -import org.glassfish.jersey.internal.util.collection.Ref; -import org.glassfish.jersey.internal.util.collection.Refs; -import org.glassfish.jersey.message.GZipEncoder; -import org.glassfish.jersey.uri.UriComponent; +import org.apache.commons.lang3.StringUtils; +import org.apache.hugegraph.util.JsonUtil; +import org.jetbrains.annotations.NotNull; import com.google.common.collect.ImmutableMap; -import jakarta.ws.rs.client.Client; -import jakarta.ws.rs.client.ClientRequestContext; -import jakarta.ws.rs.client.ClientRequestFilter; -import jakarta.ws.rs.client.Entity; -import jakarta.ws.rs.client.Invocation.Builder; -import jakarta.ws.rs.client.WebTarget; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.MultivaluedMap; -import jakarta.ws.rs.core.Response; -import jakarta.ws.rs.core.Variant; - +import lombok.SneakyThrows; +import okhttp3.ConnectionPool; +import okhttp3.HttpUrl; +import okhttp3.MediaType; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okio.BufferedSink; +import okio.GzipSink; +import okio.Okio; + +/** + * This class provides an abstract implementation of the RestClient interface. + * It provides methods for making HTTP requests (GET, POST, PUT, DELETE) to a REST API. + * Note: It uses the OkHttp library to make these requests for now. + */ public abstract class AbstractRestClient implements RestClient { - // Time unit: hours - private static final long TTL = 24L; - // Time unit: ms - private static final long IDLE_TIME = 40L * 1000L; - - private static final String TOKEN_KEY = "tokenKey"; + private final ThreadLocal authContext; - private final Client client; - private final WebTarget target; + private final OkHttpClient client; - private PoolingHttpClientConnectionManager pool; - private ScheduledExecutorService cleanExecutor; + private final String baseUrl; public AbstractRestClient(String url, int timeout) { - this(url, new ConfigBuilder().configTimeout(timeout).build()); - } - - public AbstractRestClient(String url, String user, String password, - int timeout) { - this(url, new ConfigBuilder().configTimeout(timeout) - .configUser(user, password) - .build()); + this(url, RestClientConfig.builder().timeout(timeout).build()); } - public AbstractRestClient(String url, int timeout, - int maxTotal, int maxPerRoute) { - this(url, new ConfigBuilder().configTimeout(timeout) - .configPool(maxTotal, maxPerRoute) - .build()); + public AbstractRestClient(String url, String user, String password, int timeout) { + this(url, RestClientConfig.builder() + .user(user) + .password(password) + .timeout(timeout) + .build()); } public AbstractRestClient(String url, int timeout, int idleTime, - int maxTotal, int maxPerRoute) { - this(url, new ConfigBuilder().configTimeout(timeout) - .configIdleTime(idleTime) - .configPool(maxTotal, maxPerRoute) - .build()); + int maxConns, int maxConnsPerRoute) { + this(url, RestClientConfig.builder() + .idleTime(idleTime) + .timeout(timeout) + .maxConns(maxConns) + .maxConnsPerRoute(maxConnsPerRoute) + .build()); + } + + public AbstractRestClient(String url, String user, String password, int timeout, + int maxConns, int maxConnsPerRoute, + String trustStoreFile, String trustStorePassword) { + this(url, RestClientConfig.builder() + .user(user).password(password) + .timeout(timeout) + .maxConns(maxConns) + .maxConnsPerRoute(maxConnsPerRoute) + .trustStoreFile(trustStoreFile) + .trustStorePassword(trustStorePassword) + .build()); } - public AbstractRestClient(String url, String user, String password, - int timeout, int maxTotal, int maxPerRoute) { - this(url, new ConfigBuilder().configTimeout(timeout) - .configUser(user, password) - .configPool(maxTotal, maxPerRoute) - .build()); - } + public AbstractRestClient(String url, String token, int timeout, + int maxConns, int maxConnsPerRoute, + String trustStoreFile, String trustStorePassword) { + this(url, RestClientConfig.builder() + .token(token) + .timeout(timeout) + .maxConns(maxConns) + .maxConnsPerRoute(maxConnsPerRoute) + .trustStoreFile(trustStoreFile) + .trustStorePassword(trustStorePassword) + .build()); + } + + public AbstractRestClient(String url, RestClientConfig config) { + this.baseUrl = url; + this.client = buildOkHttpClient(config); + this.authContext = new InheritableThreadLocal<>(); + } + + private static RequestBody buildRequestBody(Object body, RestHeaders headers) { + String contentType = parseContentType(headers); + String bodyContent; + if (RestHeaders.APPLICATION_JSON.equals(contentType)) { + if (body == null) { + bodyContent = "{}"; + } else { + bodyContent = JsonUtil.toJson(body); + } + } else { + bodyContent = String.valueOf(body); + } + RequestBody requestBody = RequestBody.create(bodyContent.getBytes(), + MediaType.parse(contentType)); - public AbstractRestClient(String url, String user, String password, - int timeout, int maxTotal, int maxPerRoute, - String trustStoreFile, - String trustStorePassword) { - this(url, new ConfigBuilder().configTimeout(timeout) - .configUser(user, password) - .configPool(maxTotal, maxPerRoute) - .configSSL(trustStoreFile, - trustStorePassword) - .build()); + if (headers != null && + "gzip".equals(headers.get(RestHeaders.CONTENT_ENCODING))) { + requestBody = gzipBody(requestBody); + } + return requestBody; } - public AbstractRestClient(String url, String token, int timeout) { - this(url, new ConfigBuilder().configTimeout(timeout) - .configToken(token) - .build()); - } + private static RequestBody gzipBody(final RequestBody body) { + return new RequestBody() { + @Override + public MediaType contentType() { + return body.contentType(); + } - public AbstractRestClient(String url, String token, int timeout, - int maxTotal, int maxPerRoute) { - this(url, new ConfigBuilder().configTimeout(timeout) - .configToken(token) - .configPool(maxTotal, maxPerRoute) - .build()); + @Override + public long contentLength() { + return -1; // We don't know the compressed length in advance! + } + + @Override + public void writeTo(@NotNull BufferedSink sink) throws IOException { + BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); + body.writeTo(gzipSink); + gzipSink.close(); + } + }; } - public AbstractRestClient(String url, String token, int timeout, - int maxTotal, int maxPerRoute, - String trustStoreFile, - String trustStorePassword) { - this(url, new ConfigBuilder().configTimeout(timeout) - .configToken(token) - .configPool(maxTotal, maxPerRoute) - .configSSL(trustStoreFile, - trustStorePassword) - .build()); - } - - public AbstractRestClient(String url, ClientConfig config) { - configConnectionManager(url, config); - - this.client = JerseyClientBuilder.newClient(config); - this.client.register(GZipEncoder.class); - this.target = this.client.target(url); - this.pool = (PoolingHttpClientConnectionManager) config.getProperty( - ApacheClientProperties.CONNECTION_MANAGER); - if (this.pool != null) { - this.cleanExecutor = ExecutorUtil.newScheduledThreadPool( - "conn-clean-worker-%d"); - Number idleTimeProp = (Number) config.getProperty("idleTime"); - final long idleTime = idleTimeProp == null ? - IDLE_TIME : idleTimeProp.longValue(); - final long checkPeriod = idleTime / 2L; - this.cleanExecutor.scheduleWithFixedDelay(() -> { - PoolStats stats = this.pool.getTotalStats(); - int using = stats.getLeased() + stats.getPending(); - if (using > 0) { - // Do clean only when all connections are idle - return; - } - // Release connections when all clients are inactive - this.pool.closeIdleConnections(idleTime, TimeUnit.MILLISECONDS); - this.pool.closeExpiredConnections(); - }, checkPeriod, checkPeriod, TimeUnit.MILLISECONDS); + private static String parseContentType(RestHeaders headers) { + if (headers != null) { + String contentType = headers.get(RestHeaders.CONTENT_TYPE); + if (contentType != null) { + return contentType; + } } + return RestHeaders.APPLICATION_JSON; } - protected abstract void checkStatus(Response response, - Response.Status... statuses); + private OkHttpClient buildOkHttpClient(RestClientConfig config) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + + if (config.getTimeout() != null) { + builder.connectTimeout(config.getTimeout(), TimeUnit.MILLISECONDS) + .readTimeout(config.getTimeout(), TimeUnit.MILLISECONDS); + } + + if (config.getMaxIdleConns() != null || config.getIdleTime() != null) { + ConnectionPool connectionPool = new ConnectionPool(config.getMaxIdleConns(), + config.getIdleTime(), + TimeUnit.SECONDS); + builder.connectionPool(connectionPool); + } + + // auth header interceptor + if (StringUtils.isNotBlank(config.getUser()) && + StringUtils.isNotBlank(config.getPassword())) { + builder.addInterceptor(new OkHttpBasicAuthInterceptor(config.getUser(), + config.getPassword())); + } + if (StringUtils.isNotBlank(config.getToken())) { + builder.addInterceptor(new OkHttpTokenInterceptor(config.getToken())); + } + + // ssl + configSsl(builder, this.baseUrl, config.getTrustStoreFile(), + config.getTrustStorePassword()); + + OkHttpClient okHttpClient = builder.build(); + + if (config.getMaxConns() != null) { + okHttpClient.dispatcher().setMaxRequests(config.getMaxConns()); + } + + if (config.getMaxConnsPerRoute() != null) { + okHttpClient.dispatcher().setMaxRequestsPerHost(config.getMaxConnsPerRoute()); + } + + return okHttpClient; + } - protected Response request(Callable method) { - try { - return method.call(); - } catch (Exception e) { - throw new ClientException("Failed to do request", e); + @SneakyThrows + private void configSsl(OkHttpClient.Builder builder, String url, String trustStoreFile, + String trustStorePass) { + if (StringUtils.isBlank(trustStoreFile) || StringUtils.isBlank(trustStorePass)) { + return; } + + X509TrustManager trustManager = trustManagerForCertificates(trustStoreFile, trustStorePass); + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(null, new TrustManager[]{trustManager}, null); + SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory(); + + builder.sslSocketFactory(sslSocketFactory, trustManager) + .hostnameVerifier(new HostNameVerifier(url)); } @Override @@ -207,31 +238,69 @@ public RestResult post(String path, Object object) { } @Override - public RestResult post(String path, Object object, - MultivaluedMap headers) { + public RestResult post(String path, Object object, RestHeaders headers) { return this.post(path, object, headers, null); } @Override - public RestResult post(String path, Object object, - Map params) { + public RestResult post(String path, Object object, Map params) { return this.post(path, object, null, params); } + private Request.Builder genRequestBuilder(String path, String id, RestHeaders headers, + Map params) { + HttpUrl.Builder urlBuilder = Objects.requireNonNull(HttpUrl.parse(this.baseUrl)) + .newBuilder() + .addPathSegments(path); + if (id != null) { + urlBuilder.addPathSegment(id); + } + + if (params != null) { + params.forEach((name, value) -> { + if (value == null) { + return; + } + + if (value instanceof Collection) { + for (Object i : (Collection) value) { + urlBuilder.addQueryParameter(name, String.valueOf(i)); + } + } else { + urlBuilder.addQueryParameter(name, String.valueOf(value)); + } + }); + } + + Request.Builder builder = newRequestBuilder().url(urlBuilder.build()); + + if (headers != null) { + builder.headers(headers.toOkHttpHeader()); + } + + this.attachAuthToRequest(builder); + + return builder; + } + + /** + * In order to provide subclasses with overloading opportunities + */ + protected Request.Builder newRequestBuilder() { + return new Request.Builder(); + } + + @SneakyThrows @Override - public RestResult post(String path, Object object, - MultivaluedMap headers, + public RestResult post(String path, Object object, RestHeaders headers, Map params) { - Pair> pair = this.buildRequest(path, null, object, - headers, params); - Response response = this.request(() -> { - // pair.getLeft() is builder, pair.getRight() is entity (http body) - return pair.getLeft().post(pair.getRight()); - }); - // If check status failed, throw client exception. - checkStatus(response, Response.Status.CREATED, - Response.Status.OK, Response.Status.ACCEPTED); - return new RestResult(response); + Request.Builder requestBuilder = genRequestBuilder(path, null, headers, params); + requestBuilder.post(buildRequestBody(object, headers)); + + try (Response response = request(requestBuilder)) { + checkStatus(response, 200, 201, 202); + return new RestResult(response); + } } @Override @@ -240,30 +309,27 @@ public RestResult put(String path, String id, Object object) { } @Override - public RestResult put(String path, String id, Object object, - MultivaluedMap headers) { + public RestResult put(String path, String id, Object object, RestHeaders headers) { return this.put(path, id, object, headers, null); } @Override - public RestResult put(String path, String id, Object object, - Map params) { + public RestResult put(String path, String id, Object object, Map params) { return this.put(path, id, object, null, params); } + @SneakyThrows @Override public RestResult put(String path, String id, Object object, - MultivaluedMap headers, + RestHeaders headers, Map params) { - Pair> pair = this.buildRequest(path, id, object, - headers, params); - Response response = this.request(() -> { - // pair.getLeft() is builder, pair.getRight() is entity (http body) - return pair.getLeft().put(pair.getRight()); - }); - // If check status failed, throw client exception. - checkStatus(response, Response.Status.OK, Response.Status.ACCEPTED); - return new RestResult(response); + Request.Builder requestBuilder = genRequestBuilder(path, id, headers, params); + requestBuilder.put(buildRequestBody(object, headers)); + + try (Response response = request(requestBuilder)) { + checkStatus(response, 200, 202); + return new RestResult(response); + } } @Override @@ -281,29 +347,14 @@ public RestResult get(String path, String id) { return this.get(path, id, ImmutableMap.of()); } + @SneakyThrows private RestResult get(String path, String id, Map params) { - Ref target = Refs.of(this.target); - for (String key : params.keySet()) { - Object value = params.get(key); - if (value instanceof Collection) { - for (Object i : (Collection) value) { - target.set(target.get().queryParam(key, i)); - } - } else { - target.set(target.get().queryParam(key, value)); - } - } + Request.Builder requestBuilder = genRequestBuilder(path, id, null, params); - Response response = this.request(() -> { - WebTarget webTarget = target.get(); - Builder builder = id == null ? webTarget.path(path).request() : - webTarget.path(path).path(encode(id)).request(); - this.attachAuthToRequest(builder); - return builder.get(); - }); - - checkStatus(response, Response.Status.OK); - return new RestResult(response); + try (Response response = request(requestBuilder)) { + checkStatus(response, 200); + return new RestResult(response); + } } @Override @@ -316,40 +367,35 @@ public RestResult delete(String path, String id) { return this.delete(path, id, ImmutableMap.of()); } + @SneakyThrows private RestResult delete(String path, String id, Map params) { - Ref target = Refs.of(this.target); - for (String key : params.keySet()) { - target.set(target.get().queryParam(key, params.get(key))); + Request.Builder requestBuilder = genRequestBuilder(path, id, null, params); + requestBuilder.delete(); + + try (Response response = request(requestBuilder)) { + checkStatus(response, 204, 202); + return new RestResult(response); } + } - Response response = this.request(() -> { - WebTarget webTarget = target.get(); - Builder builder = id == null ? webTarget.path(path).request() : - webTarget.path(path).path(encode(id)).request(); - this.attachAuthToRequest(builder); - return builder.delete(); - }); + protected abstract void checkStatus(Response response, int... statuses); - checkStatus(response, Response.Status.NO_CONTENT, - Response.Status.ACCEPTED); - return new RestResult(response); + @SneakyThrows + protected Response request(Request.Builder requestBuilder) { + return this.client.newCall(requestBuilder.build()).execute(); } + @SneakyThrows @Override public void close() { - if (this.pool != null) { - this.pool.close(); - this.cleanExecutor.shutdownNow(); + if (this.client != null) { + this.client.dispatcher().executorService().shutdown(); + this.client.connectionPool().evictAll(); + if (this.client.cache() != null) { + this.client.cache().close(); + } } - this.client.close(); - } - - private final ThreadLocal authContext = - new InheritableThreadLocal<>(); - - public void setAuthContext(String auth) { - this.authContext.set(auth); } public void resetAuthContext() { @@ -360,132 +406,39 @@ public String getAuthContext() { return this.authContext.get(); } - private void attachAuthToRequest(Builder builder) { + public void setAuthContext(String auth) { + this.authContext.set(auth); + } + + private void attachAuthToRequest(Request.Builder builder) { // Add auth header String auth = this.getAuthContext(); if (StringUtils.isNotEmpty(auth)) { - builder.header(HttpHeaders.AUTHORIZATION, auth); + builder.addHeader(RestHeaders.AUTHORIZATION, auth); } } - private Pair> buildRequest( - String path, String id, Object object, - MultivaluedMap headers, - Map params) { - WebTarget target = this.target; - if (params != null && !params.isEmpty()) { - for (Map.Entry param : params.entrySet()) { - target = target.queryParam(param.getKey(), param.getValue()); - } - } - - Builder builder = id == null ? target.path(path).request() : - target.path(path).path(encode(id)).request(); - - String encoding = null; - if (headers != null && !headers.isEmpty()) { - // Add headers - builder = builder.headers(headers); - encoding = (String) headers.getFirst("Content-Encoding"); - } - // Add auth header - this.attachAuthToRequest(builder); - - /* - * We should specify the encoding of the entity object manually, - * because Entity.json() method will reset "content encoding = - * null" that has been set up by headers before. - */ - MediaType customContentType = parseCustomContentType(headers); - Entity entity; - if (encoding == null) { - entity = Entity.entity(object, customContentType); - } else { - Variant variant = new Variant(customContentType, - (String) null, encoding); - entity = Entity.entity(object, variant); - } - return Pair.of(builder, entity); - } + @SneakyThrows + private X509TrustManager trustManagerForCertificates(String trustStoreFile, + String trustStorePass) { + char[] password = trustStorePass.toCharArray(); - /** - * parse user custom content-type, returns MediaType.APPLICATION_JSON_TYPE default. - * @param headers custom http header - */ - private static MediaType parseCustomContentType(MultivaluedMap headers) { - String customContentType = null; - if (MapUtils.isNotEmpty(headers) && headers.get("Content-Type") != null) { - List contentTypeObj = headers.get("Content-Type"); - if (contentTypeObj != null && !contentTypeObj.isEmpty()) { - customContentType = contentTypeObj.get(0).toString(); - } - return MediaType.valueOf(customContentType); - } - return MediaType.APPLICATION_JSON_TYPE; - } - - private static void configConnectionManager(String url, ClientConfig conf) { - /* - * Using httpclient with connection pooling, and configuring the - * jersey connector. But the jersey that has been released in the maven central - * repository seems to have a bug: https://github.com/jersey/jersey/pull/3752 - */ - PoolingHttpClientConnectionManager pool = connectionManager(url, conf); - Object maxTotal = conf.getProperty("maxTotal"); - Object maxPerRoute = conf.getProperty("maxPerRoute"); - if (maxTotal != null) { - pool.setMaxTotal((int) maxTotal); + // load keyStore + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + try (FileInputStream in = new FileInputStream(trustStoreFile)) { + keyStore.load(in, password); } - if (maxPerRoute != null) { - pool.setDefaultMaxPerRoute((int) maxPerRoute); - } - conf.property(ApacheClientProperties.CONNECTION_MANAGER, pool); - conf.connectorProvider(new ApacheConnectorProvider()); - } - private static PoolingHttpClientConnectionManager connectionManager( - String url, - ClientConfig conf) { - String protocol = (String) conf.getProperty("protocol"); - if (protocol == null || "http".equals(protocol)) { - return new PoolingHttpClientConnectionManager(TTL, TimeUnit.HOURS); - } + TrustManagerFactory trustManagerFactory = + TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + trustManagerFactory.init(keyStore); - assert "https".equals(protocol); - String trustStoreFile = (String) conf.getProperty("trustStoreFile"); - E.checkArgument(trustStoreFile != null && !trustStoreFile.isEmpty(), - "The trust store file must be set when use https"); - String trustStorePass = (String) conf.getProperty("trustStorePassword"); - E.checkArgument(trustStorePass != null, - "The trust store password must be set when use https"); - SSLContext context = SslConfigurator.newInstance() - .trustStoreFile(trustStoreFile) - .trustStorePassword(trustStorePass) - .securityProtocol("SSL") - .createSSLContext(); - TrustManager[] trustAllManager = NoCheckTrustManager.create(); - try { - context.init(null, trustAllManager, new SecureRandom()); - } catch (KeyManagementException e) { - throw new ClientException("Failed to init security management", e); + TrustManager[] trustManagers = trustManagerFactory.getTrustManagers(); + if (trustManagers.length != 1 || !(trustManagers[0] instanceof X509TrustManager)) { + throw new IllegalStateException("Unexpected default trust managers:" + + Arrays.toString(trustManagers)); } - - HostnameVerifier verifier = new HostNameVerifier(url); - ConnectionSocketFactory httpSocketFactory, httpsSocketFactory; - httpSocketFactory = PlainConnectionSocketFactory.getSocketFactory(); - httpsSocketFactory = new SSLConnectionSocketFactory(context, verifier); - Registry registry = - RegistryBuilder.create() - .register("http", httpSocketFactory) - .register("https", httpsSocketFactory) - .build(); - return new PoolingHttpClientConnectionManager(registry, null, - null, null, TTL, - TimeUnit.HOURS); - } - - public static String encode(String raw) { - return UriComponent.encode(raw, UriComponent.Type.PATH_SEGMENT); + return (X509TrustManager) trustManagers[0]; } public static class HostNameVerifier implements HostnameVerifier { @@ -505,107 +458,9 @@ public boolean verify(String hostname, SSLSession session) { if (!this.url.isEmpty() && this.url.endsWith(hostname)) { return true; } else { - HostnameVerifier verifier = HttpsURLConnection - .getDefaultHostnameVerifier(); + HostnameVerifier verifier = HttpsURLConnection.getDefaultHostnameVerifier(); return verifier.verify(hostname, session); } } } - - private static class NoCheckTrustManager implements X509TrustManager { - - @Override - public void checkClientTrusted(X509Certificate[] chain, String authType) - throws CertificateException { - } - - @Override - public void checkServerTrusted(X509Certificate[] chain, String authType) - throws CertificateException { - } - - @Override - public X509Certificate[] getAcceptedIssuers() { - return null; - } - - public static TrustManager[] create() { - return new TrustManager[]{new NoCheckTrustManager()}; - } - } - - private static class ConfigBuilder { - - private final ClientConfig config; - - ConfigBuilder() { - this.config = new ClientConfig(); - } - - public ConfigBuilder configTimeout(int timeout) { - this.config.property(ClientProperties.CONNECT_TIMEOUT, timeout); - this.config.property(ClientProperties.READ_TIMEOUT, timeout); - return this; - } - - public ConfigBuilder configUser(String username, String password) { - /* - * NOTE: don't use non-preemptive mode - * In non-preemptive mode the authentication information is added - * only when server refuses the request with 401 status code and - * then the request is repeated. - * Non-preemptive has negative impact on the performance. The - * advantage is it doesn't send credentials when they are not needed - * https://jersey.github.io/documentation/latest/client.html#d0e5461 - */ - this.config.register(HttpAuthenticationFeature.basic(username, - password)); - return this; - } - - public ConfigBuilder configToken(String token) { - this.config.property(TOKEN_KEY, token); - this.config.register(BearerRequestFilter.class); - return this; - } - - public ConfigBuilder configPool(int maxTotal, int maxPerRoute) { - this.config.property("maxTotal", maxTotal); - this.config.property("maxPerRoute", maxPerRoute); - return this; - } - - public ConfigBuilder configIdleTime(int idleTime) { - this.config.property("idleTime", idleTime); - return this; - } - - public ConfigBuilder configSSL(String trustStoreFile, - String trustStorePassword) { - if (trustStoreFile == null || trustStoreFile.isEmpty() || - trustStorePassword == null) { - this.config.property("protocol", "http"); - } else { - this.config.property("protocol", "https"); - } - this.config.property("trustStoreFile", trustStoreFile); - this.config.property("trustStorePassword", trustStorePassword); - return this; - } - - public ClientConfig build() { - return this.config; - } - } - - public static class BearerRequestFilter implements ClientRequestFilter { - - @Override - public void filter(ClientRequestContext context) { - String token = context.getClient().getConfiguration() - .getProperty(TOKEN_KEY).toString(); - context.getHeaders().add(HttpHeaders.AUTHORIZATION, - "Bearer " + token); - } - } } diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/OkHttpBasicAuthInterceptor.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/OkHttpBasicAuthInterceptor.java new file mode 100644 index 0000000000..f7b1509f50 --- /dev/null +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/OkHttpBasicAuthInterceptor.java @@ -0,0 +1,47 @@ +/* + * 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.rest; + +import java.io.IOException; + +import okhttp3.Credentials; +import okhttp3.Interceptor; +import okhttp3.Request; +import okhttp3.Response; + +public class OkHttpBasicAuthInterceptor implements Interceptor { + + private final String credentials; + + public OkHttpBasicAuthInterceptor(String user, String password) { + this.credentials = Credentials.basic(user, password); + } + + @Override + public Response intercept(Chain chain) throws IOException { + Request request = chain.request(); + if (request.header(RestHeaders.AUTHORIZATION) == null) { + Request authenticatedRequest = request.newBuilder() + .header(RestHeaders.AUTHORIZATION, + this.credentials) + .build(); + return chain.proceed(authenticatedRequest); + } + return chain.proceed(request); + } +} diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/OkHttpTokenInterceptor.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/OkHttpTokenInterceptor.java new file mode 100644 index 0000000000..f564033225 --- /dev/null +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/OkHttpTokenInterceptor.java @@ -0,0 +1,50 @@ +/* + * 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.rest; + +import static org.apache.hugegraph.rest.RestHeaders.AUTHORIZATION; +import static org.apache.hugegraph.rest.RestHeaders.BEARER_PREFIX; + +import java.io.IOException; + +import okhttp3.Interceptor; +import okhttp3.Request; +import okhttp3.Response; + + +public class OkHttpTokenInterceptor implements Interceptor { + + private final String token; + + public OkHttpTokenInterceptor(String token) { + this.token = token; + } + + @Override + public Response intercept(Chain chain) throws IOException { + Request request = chain.request(); + if (request.header(AUTHORIZATION) == null) { + Request authenticatedRequest = request.newBuilder() + .header(AUTHORIZATION, + BEARER_PREFIX + this.token) + .build(); + return chain.proceed(authenticatedRequest); + } + return chain.proceed(request); + } +} diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClient.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClient.java index dc3b7b7425..d5b58d9fc6 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClient.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClient.java @@ -19,31 +19,28 @@ import java.util.Map; -import jakarta.ws.rs.core.MultivaluedMap; - public interface RestClient { /** * Post method */ RestResult post(String path, Object object); - RestResult post(String path, Object object, MultivaluedMap headers); + RestResult post(String path, Object object, RestHeaders headers); RestResult post(String path, Object object, Map params); - RestResult post(String path, Object object, MultivaluedMap headers, - Map params); + RestResult post(String path, Object object, RestHeaders headers, Map params); /** * Put method */ RestResult put(String path, String id, Object object); - RestResult put(String path, String id, Object object, MultivaluedMap headers); + RestResult put(String path, String id, Object object, RestHeaders headers); RestResult put(String path, String id, Object object, Map params); - RestResult put(String path, String id, Object object, MultivaluedMap headers, + RestResult put(String path, String id, Object object, RestHeaders headers, Map params); /** diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClientConfig.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClientConfig.java new file mode 100644 index 0000000000..ef3e9b0ee1 --- /dev/null +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClientConfig.java @@ -0,0 +1,41 @@ +/* + * 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.rest; + +import lombok.Builder; +import lombok.Getter; +import lombok.Setter; + +@Builder +@Getter +@Setter +public class RestClientConfig { + + private String user; + private String password; + private String token; + // unit in milliseconds + private Integer timeout; + private Integer maxConns; + private Integer maxConnsPerRoute; + // unit in seconds + private Integer idleTime = 30; + private Integer maxIdleConns = 5; + private String trustStoreFile; + private String trustStorePassword; +} diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestHeaders.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestHeaders.java new file mode 100644 index 0000000000..03c082ede3 --- /dev/null +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestHeaders.java @@ -0,0 +1,90 @@ +/* + * 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.rest; + +import java.util.Date; +import java.util.Iterator; + +import kotlin.Pair; + +public class RestHeaders { + + public static final String CONTENT_TYPE = "Content-Type"; + + public static final String CONTENT_ENCODING = "Content-Encoding"; + + public static final String AUTHORIZATION = "Authorization"; + + public static final String APPLICATION_JSON = "application/json"; + + public static final String BEARER_PREFIX = "Bearer "; + + private final okhttp3.Headers.Builder headersBuilder; + + public RestHeaders() { + this.headersBuilder = new okhttp3.Headers.Builder(); + } + + public static RestHeaders convertToRestHeaders(okhttp3.Headers headers) { + RestHeaders restHeaders = new RestHeaders(); + + if (headers != null) { + Iterator> iter = headers.iterator(); + while (iter.hasNext()) { + Pair pair = iter.next(); + restHeaders.add(pair.getFirst(), pair.getSecond()); + } + } + return restHeaders; + } + + public String get(String key) { + return this.headersBuilder.get(key); + } + + public Date getDate(String key) { + return this.headersBuilder.build().getDate(key); + } + + public RestHeaders add(String key, String value) { + this.headersBuilder.add(key, value); + return this; + } + + public RestHeaders add(String key, Date value) { + this.headersBuilder.add(key, value); + return this; + } + + @Override + public int hashCode() { + return this.toOkHttpHeader().hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof RestHeaders) { + return this.toOkHttpHeader().equals(((RestHeaders) obj).toOkHttpHeader()); + } + return false; + } + + public okhttp3.Headers toOkHttpHeader() { + return this.headersBuilder.build(); + } +} diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestResult.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestResult.java index 82b7f39a19..0aa482b067 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestResult.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestResult.java @@ -21,39 +21,47 @@ import java.util.ArrayList; import java.util.List; -import jakarta.ws.rs.core.MultivaluedMap; -import jakarta.ws.rs.core.Response; - import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.Module; import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.SneakyThrows; +import okhttp3.Response; + public class RestResult { private static final ObjectMapper MAPPER = new ObjectMapper(); private final int status; - private final MultivaluedMap headers; + private final RestHeaders headers; private final String content; public RestResult(Response response) { - this(response.getStatus(), response.readEntity(String.class), - response.getHeaders()); + this(response.code(), getResponseContent(response), + RestHeaders.convertToRestHeaders(response.headers())); } - public RestResult(int status, String content, - MultivaluedMap headers) { + public RestResult(int status, String content, RestHeaders headers) { this.status = status; this.headers = headers; this.content = content; } + @SneakyThrows + private static String getResponseContent(Response response) { + return response.body().string(); + } + + public static void registerModule(Module module) { + MAPPER.registerModule(module); + } + public int status() { return this.status; } - public MultivaluedMap headers() { + public RestHeaders headers() { return this.headers; } @@ -65,8 +73,7 @@ public T readObject(Class clazz) { try { return MAPPER.readValue(this.content, clazz); } catch (Exception e) { - throw new SerializeException( - "Failed to deserialize: %s", e, this.content); + throw new SerializeException("Failed to deserialize: %s", e, this.content); } } @@ -76,16 +83,14 @@ public List readList(String key, Class clazz) { JsonNode root = MAPPER.readTree(this.content); JsonNode element = root.get(key); if (element == null) { - throw new SerializeException( - "Can't find value of the key: %s in json.", key); + throw new SerializeException("Can't find value of the key: %s in json.", key); } JavaType type = MAPPER.getTypeFactory() .constructParametrizedType(ArrayList.class, List.class, clazz); return MAPPER.convertValue(element, type); } catch (IOException e) { - throw new SerializeException( - "Failed to deserialize %s", e, this.content); + throw new SerializeException("Failed to deserialize %s", e, this.content); } } @@ -97,18 +102,13 @@ public List readList(Class clazz) { try { return MAPPER.readValue(this.content, type); } catch (IOException e) { - throw new SerializeException( - "Failed to deserialize %s", e, this.content); + throw new SerializeException("Failed to deserialize %s", e, this.content); } } @Override public String toString() { - return String.format("{status=%s, headers=%s, content=%s}", - this.status, this.headers, this.content); - } - - public static void registerModule(Module module) { - MAPPER.registerModule(module); + return String.format("{status=%s, headers=%s, content=%s}", this.status, this.headers, + this.content); } } diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/JsonUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/JsonUtil.java new file mode 100644 index 0000000000..fc9586b3e8 --- /dev/null +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/JsonUtil.java @@ -0,0 +1,62 @@ +/* + * 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.util; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.Module; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.hugegraph.rest.SerializeException; + +import java.io.IOException; + +public final class JsonUtil { + + private static final ObjectMapper MAPPER = new ObjectMapper(); + + public static void registerModule(Module module) { + MAPPER.registerModule(module); + } + + public static String toJson(Object object) { + try { + return MAPPER.writeValueAsString(object); + } catch (JsonProcessingException e) { + throw new SerializeException("Failed to serialize object '%s'", + e, object); + } + } + + public static T fromJson(String json, Class clazz) { + try { + return MAPPER.readValue(json, clazz); + } catch (IOException e) { + throw new SerializeException("Failed to deserialize json '%s'", + e, json); + } + } + + public static T convertValue(JsonNode node, Class clazz) { + try { + return MAPPER.convertValue(node, clazz); + } catch (IllegalArgumentException e) { + throw new SerializeException("Failed to deserialize json node '%s'", + e, node); + } + } +} diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/version/CommonVersion.java b/hugegraph-common/src/main/java/org/apache/hugegraph/version/CommonVersion.java index bcdad92654..a049ff44fe 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/version/CommonVersion.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/version/CommonVersion.java @@ -24,5 +24,5 @@ public class CommonVersion { public static final String NAME = "hugegraph-common"; // The second parameter of Version.of() is for all-in-one JAR - public static final Version VERSION = Version.of(CommonVersion.class, "1.0.1"); + public static final Version VERSION = Version.of(CommonVersion.class, "1.2.0"); } diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestClientTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestClientTest.java index eb9c7c297f..f7b998df5c 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestClientTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestClientTest.java @@ -21,249 +21,90 @@ import java.util.HashMap; import java.util.Map; import java.util.UUID; -import java.util.concurrent.Callable; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.BiFunction; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSessionContext; -import jakarta.ws.rs.client.Invocation.Builder; -import jakarta.ws.rs.client.WebTarget; -import jakarta.ws.rs.core.MultivaluedHashMap; -import jakarta.ws.rs.core.MultivaluedMap; -import jakarta.ws.rs.core.Response; - -import org.apache.hugegraph.unit.BaseUnitTest; -import org.junit.Test; -import org.mockito.Mockito; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import org.glassfish.jersey.internal.util.collection.ImmutableMultivaluedMap; - -import org.apache.http.HttpClientConnection; -import org.apache.http.HttpHeaders; -import org.apache.http.HttpHost; -import org.apache.http.conn.routing.HttpRoute; -import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; -import org.apache.http.pool.PoolStats; - import org.apache.hugegraph.rest.AbstractRestClient; import org.apache.hugegraph.rest.ClientException; import org.apache.hugegraph.rest.RestClient; +import org.apache.hugegraph.rest.RestClientConfig; +import org.apache.hugegraph.rest.RestHeaders; import org.apache.hugegraph.rest.RestResult; import org.apache.hugegraph.testutil.Assert; import org.apache.hugegraph.testutil.Whitebox; +import org.apache.hugegraph.unit.BaseUnitTest; +import org.junit.Test; +import org.mockito.Mockito; -public class RestClientTest { - - private static class RestClientImpl extends AbstractRestClient { - - private final int status; - private final MultivaluedMap headers; - private final String content; - - public RestClientImpl(String url, int timeout, int idleTime, - int maxTotal, int maxPerRoute, int status) { - super(url, timeout, idleTime, maxTotal, maxPerRoute); - this.status = status; - this.headers = ImmutableMultivaluedMap.empty(); - this.content = ""; - } - - public RestClientImpl(String url, int timeout, - int maxTotal, int maxPerRoute, int status) { - super(url, timeout, maxTotal, maxPerRoute); - this.status = status; - this.headers = ImmutableMultivaluedMap.empty(); - this.content = ""; - } - - public RestClientImpl(String url, String user, String password, - int timeout, int status) { - super(url, user, password, timeout); - this.status = status; - this.headers = ImmutableMultivaluedMap.empty(); - this.content = ""; - } - - public RestClientImpl(String url, String user, String password, - int timeout, int maxTotal, int maxPerRoute, - int status) { - super(url, user, password, timeout, maxTotal, maxPerRoute); - this.status = status; - this.headers = ImmutableMultivaluedMap.empty(); - this.content = ""; - } - - public RestClientImpl(String url, String user, String password, - int timeout, int maxTotal, int maxPerRoute, - String trustStoreFile, String trustStorePassword, - int status) { - super(url, user, password, timeout, maxTotal, maxPerRoute, - trustStoreFile, trustStorePassword); - this.status = status; - this.headers = ImmutableMultivaluedMap.empty(); - this.content = ""; - } - - public RestClientImpl(String url, String token, - int timeout, int status) { - super(url, token, timeout); - this.status = status; - this.headers = ImmutableMultivaluedMap.empty(); - this.content = ""; - } - - public RestClientImpl(String url, String token, int timeout, - int maxTotal, int maxPerRoute, int status) { - super(url, token, timeout, maxTotal, maxPerRoute); - this.status = status; - this.headers = ImmutableMultivaluedMap.empty(); - this.content = ""; - } - - public RestClientImpl(String url, String token, int timeout, - int maxTotal, int maxPerRoute, - String trustStoreFile, - String trustStorePassword, int status) { - super(url, token, timeout, maxTotal, maxPerRoute, - trustStoreFile, trustStorePassword); - this.status = status; - this.headers = ImmutableMultivaluedMap.empty(); - this.content = ""; - } - - public RestClientImpl(String url, int timeout, int status) { - this(url, timeout, status, ImmutableMultivaluedMap.empty(), ""); - } +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.net.HttpHeaders; - public RestClientImpl(String url, int timeout, int status, - MultivaluedMap headers, - String content) { - super(url, timeout); - this.status = status; - this.headers = headers; - this.content = content; - } +import lombok.SneakyThrows; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; - @Override - protected Response request(Callable method) { - Response response = Mockito.mock(Response.class); - Mockito.when(response.getStatus()).thenReturn(this.status); - Mockito.when(response.getHeaders()).thenReturn(this.headers); - Mockito.when(response.readEntity(String.class)) - .thenReturn(this.content); - return response; - } +public class RestClientTest { - @Override - protected void checkStatus(Response response, - Response.Status... statuses) { - boolean match = false; - for (Response.Status status : statuses) { - if (status.getStatusCode() == response.getStatus()) { - match = true; - break; - } - } - if (!match) { - throw new ClientException("Invalid response '%s'", response); - } - } - } + private static final String TEST_URL = "http://localhost:8080"; @Test public void testPost() { - RestClient client = new RestClientImpl("/test", 1000, 200); + RestClientConfig restClientConfig = RestClientConfig.builder().timeout(1000).build(); + RestClient client = new RestClientImpl(TEST_URL, restClientConfig, 200); RestResult restResult = client.post("path", "body"); Assert.assertEquals(200, restResult.status()); } @Test // TODO: How to verify it? - public void testPostWithMaxTotalAndPerRoute() { - RestClient client = new RestClientImpl("/test", 1000, 10, 5, 200); + public void testPostWithMaxConnsAndPerRoute() { + RestClientConfig restClientConfig = + RestClientConfig.builder().timeout(1000).maxConns(10).maxConnsPerRoute(5).build(); + RestClient client = new RestClientImpl(TEST_URL, restClientConfig, 200); RestResult restResult = client.post("path", "body"); Assert.assertEquals(200, restResult.status()); } - @Test - public void testCleanExecutor() throws Exception { - // Modify IDLE_TIME 100ms to speed test - int newIdleTime = 100; - int newCheckPeriod = newIdleTime + 20; - - RestClient client = new RestClientImpl("/test", 1000, newIdleTime, - 10, 5, 200); - - PoolingHttpClientConnectionManager pool; - pool = Whitebox.getInternalState(client, "pool"); - pool = Mockito.spy(pool); - Whitebox.setInternalState(client, "pool", pool); - HttpRoute route = new HttpRoute(HttpHost.create( - "http://127.0.0.1:8080")); - // Create a connection manually, it will be put into leased list - HttpClientConnection conn = pool.requestConnection(route, null) - .get(1L, TimeUnit.SECONDS); - PoolStats stats = pool.getTotalStats(); - int usingConns = stats.getLeased() + stats.getPending(); - Assert.assertGte(1, usingConns); - - // Sleep more than two check periods for busy connection - Thread.sleep(newCheckPeriod); - Mockito.verify(pool, Mockito.never()).closeExpiredConnections(); - stats = pool.getTotalStats(); - usingConns = stats.getLeased() + stats.getPending(); - Assert.assertGte(1, usingConns); - - // The connection will be put into available list - pool.releaseConnection(conn, null, 0, TimeUnit.SECONDS); - - stats = pool.getTotalStats(); - usingConns = stats.getLeased() + stats.getPending(); - Assert.assertEquals(0, usingConns); - /* - * Sleep more than two check periods for free connection, - * ensure connection has been closed - */ - Thread.sleep(newCheckPeriod); - Mockito.verify(pool, Mockito.atLeastOnce()) - .closeExpiredConnections(); - Mockito.verify(pool, Mockito.atLeastOnce()) - .closeIdleConnections(newIdleTime, TimeUnit.MILLISECONDS); - } - @Test public void testPostWithUserAndPassword() { - RestClient client = new RestClientImpl("/test", "user", "", 1000, 200); + RestClientConfig restClientConfig = + RestClientConfig.builder().user("user").password("").timeout(1000).build(); + RestClient client = new RestClientImpl(TEST_URL, restClientConfig, 200); RestResult restResult = client.post("path", "body"); Assert.assertEquals(200, restResult.status()); } @Test public void testPostWithToken() { - RestClient client = new RestClientImpl("/test", "token", 1000, 200); + RestClientConfig restClientConfig = + RestClientConfig.builder().token("token").timeout(1000).build(); + RestClient client = new RestClientImpl(TEST_URL, restClientConfig, 200); RestResult restResult = client.post("path", "body"); Assert.assertEquals(200, restResult.status()); } @Test public void testPostWithAllParams() { - RestClient client = new RestClientImpl("/test", "user", "", 1000, - 10, 5, 200); + RestClientConfig restClientConfig = + RestClientConfig.builder().user("user").password("").timeout(1000).maxConns(10) + .maxConnsPerRoute(5).build(); + RestClient client = new RestClientImpl(TEST_URL, restClientConfig, 200); RestResult restResult = client.post("path", "body"); Assert.assertEquals(200, restResult.status()); } @Test public void testPostWithTokenAndAllParams() { - RestClient client = new RestClientImpl("/test", "token", 1000, - 10, 5, 200); + RestClientConfig restClientConfig = + RestClientConfig.builder().token("token").timeout(1000).maxConns(10) + .maxConnsPerRoute(5).build(); + RestClient client = new RestClientImpl(TEST_URL, restClientConfig, 200); RestResult restResult = client.post("path", "body"); Assert.assertEquals(200, restResult.status()); } @@ -276,9 +117,11 @@ public void testPostHttpsWithAllParams() { BaseUnitTest.downloadFileByUrl(url, trustStoreFile); String trustStorePassword = "changeit"; - RestClient client = new RestClientImpl("/test", "user", "", 1000, - 10, 5, trustStoreFile, - trustStorePassword, 200); + RestClientConfig restClientConfig = + RestClientConfig.builder().user("user").password("").timeout(1000).maxConns(10) + .maxConnsPerRoute(5).trustStoreFile(trustStoreFile) + .trustStorePassword(trustStorePassword).build(); + RestClient client = new RestClientImpl(TEST_URL, restClientConfig, 200); RestResult restResult = client.post("path", "body"); Assert.assertEquals(200, restResult.status()); } @@ -291,9 +134,11 @@ public void testPostHttpsWithTokenAndAllParams() { BaseUnitTest.downloadFileByUrl(url, trustStoreFile); String trustStorePassword = "changeit"; - RestClient client = new RestClientImpl("/test", "token", 1000, - 10, 5, trustStoreFile, - trustStorePassword, 200); + RestClientConfig restClientConfig = + RestClientConfig.builder().token("token").timeout(1000).maxConns(10) + .maxConnsPerRoute(5).trustStoreFile(trustStoreFile) + .trustStorePassword(trustStorePassword).build(); + RestClient client = new RestClientImpl(TEST_URL, restClientConfig, 200); RestResult restResult = client.post("path", "body"); Assert.assertEquals(200, restResult.status()); } @@ -327,13 +172,12 @@ public void testHostNameVerifier() { @Test public void testPostWithHeaderAndContent() { - MultivaluedMap headers = new MultivaluedHashMap<>(); - headers.add("key1", "value1-1"); - headers.add("key1", "value1-2"); - headers.add("Content-Encoding", "gzip"); + RestHeaders headers = new RestHeaders().add("key1", "value1-1") + .add("key1", "value1-2") + .add("Content-Encoding", "gzip"); String content = "{\"names\": [\"marko\", \"josh\", \"lop\"]}"; - RestClient client = new RestClientImpl("/test", 1000, 200, - headers, content); + RestClientConfig restClientConfig = RestClientConfig.builder().timeout(1000).build(); + RestClient client = new RestClientImpl(TEST_URL, restClientConfig, 200, headers, content); RestResult restResult = client.post("path", "body"); Assert.assertEquals(200, restResult.status()); Assert.assertEquals(headers, restResult.headers()); @@ -344,7 +188,8 @@ public void testPostWithHeaderAndContent() { @Test public void testPostWithException() { - RestClient client = new RestClientImpl("/test", 1000, 400); + RestClientConfig restClientConfig = RestClientConfig.builder().timeout(1000).build(); + RestClient client = new RestClientImpl(TEST_URL, restClientConfig, 400); Assert.assertThrows(ClientException.class, () -> { client.post("path", "body"); }); @@ -352,8 +197,10 @@ public void testPostWithException() { @Test public void testPostWithParams() { - RestClient client = new RestClientImpl("/test", 1000, 200); - MultivaluedMap headers = ImmutableMultivaluedMap.empty(); + RestClientConfig restClientConfig = RestClientConfig.builder().timeout(1000).build(); + RestClient client = new RestClientImpl(TEST_URL, restClientConfig, 200); + RestHeaders headers = new RestHeaders(); + Map params = ImmutableMap.of("param1", "value1"); RestResult restResult = client.post("path", "body", headers, params); @@ -362,25 +209,27 @@ public void testPostWithParams() { @Test public void testPut() { - RestClient client = new RestClientImpl("/test", 1000, 200); + RestClientConfig restClientConfig = RestClientConfig.builder().timeout(1000).build(); + RestClient client = new RestClientImpl(TEST_URL, restClientConfig, 200); RestResult restResult = client.put("path", "id1", "body"); Assert.assertEquals(200, restResult.status()); } @Test public void testPutWithHeaders() { - RestClient client = new RestClientImpl("/test", 1000, 200); - MultivaluedMap headers = new MultivaluedHashMap<>(); - headers.add("key1", "value1-1"); - headers.add("key1", "value1-2"); - headers.add("Content-Encoding", "gzip"); + RestClientConfig restClientConfig = RestClientConfig.builder().timeout(1000).build(); + RestClient client = new RestClientImpl(TEST_URL, restClientConfig, 200); + RestHeaders headers = new RestHeaders().add("key1", "value1-1") + .add("key2", "value1-2") + .add("Content-Encoding", "gzip"); RestResult restResult = client.put("path", "id1", "body", headers); Assert.assertEquals(200, restResult.status()); } @Test public void testPutWithParams() { - RestClient client = new RestClientImpl("/test", 1000, 200); + RestClientConfig restClientConfig = RestClientConfig.builder().timeout(1000).build(); + RestClient client = new RestClientImpl(TEST_URL, restClientConfig, 200); Map params = ImmutableMap.of("param1", "value1"); RestResult restResult = client.put("path", "id1", "body", params); Assert.assertEquals(200, restResult.status()); @@ -388,7 +237,8 @@ public void testPutWithParams() { @Test public void testPutWithException() { - RestClient client = new RestClientImpl("/test", 1000, 400); + RestClientConfig restClientConfig = RestClientConfig.builder().timeout(1000).build(); + RestClient client = new RestClientImpl(TEST_URL, restClientConfig, 400); Assert.assertThrows(ClientException.class, () -> { client.put("path", "id1", "body"); }); @@ -396,21 +246,24 @@ public void testPutWithException() { @Test public void testGet() { - RestClient client = new RestClientImpl("/test", 1000, 200); + RestClientConfig restClientConfig = RestClientConfig.builder().timeout(1000).build(); + RestClient client = new RestClientImpl(TEST_URL, restClientConfig, 200); RestResult restResult = client.get("path"); Assert.assertEquals(200, restResult.status()); } @Test public void testGetWithId() { - RestClient client = new RestClientImpl("/test", 1000, 200); + RestClientConfig restClientConfig = RestClientConfig.builder().timeout(1000).build(); + RestClient client = new RestClientImpl(TEST_URL, restClientConfig, 200); RestResult restResult = client.get("path", "id1"); Assert.assertEquals(200, restResult.status()); } @Test public void testGetWithParams() { - RestClient client = new RestClientImpl("/test", 1000, 200); + RestClientConfig restClientConfig = RestClientConfig.builder().timeout(1000).build(); + RestClient client = new RestClientImpl(TEST_URL, restClientConfig, 200); Map params = new HashMap<>(); params.put("key1", ImmutableList.of("value1-1", "value1-2")); params.put("key2", "value2"); @@ -420,7 +273,8 @@ public void testGetWithParams() { @Test public void testGetWithException() { - RestClient client = new RestClientImpl("/test", 1000, 400); + RestClientConfig restClientConfig = RestClientConfig.builder().timeout(1000).build(); + RestClient client = new RestClientImpl(TEST_URL, restClientConfig, 400); Assert.assertThrows(ClientException.class, () -> { client.get("path", "id1"); }); @@ -428,14 +282,16 @@ public void testGetWithException() { @Test public void testDeleteWithId() { - RestClient client = new RestClientImpl("/test", 1000, 204); + RestClientConfig restClientConfig = RestClientConfig.builder().timeout(1000).build(); + RestClient client = new RestClientImpl(TEST_URL, restClientConfig, 204); RestResult restResult = client.delete("path", "id1"); Assert.assertEquals(204, restResult.status()); } @Test public void testDeleteWithParams() { - RestClient client = new RestClientImpl("/test", 1000, 204); + RestClientConfig restClientConfig = RestClientConfig.builder().timeout(1000).build(); + RestClient client = new RestClientImpl(TEST_URL, restClientConfig, 204); Map params = ImmutableMap.of("param1", "value1"); RestResult restResult = client.delete("path", params); Assert.assertEquals(204, restResult.status()); @@ -443,38 +299,17 @@ public void testDeleteWithParams() { @Test public void testDeleteWithException() { - RestClient client = new RestClientImpl("/test", 1000, 400); + RestClientConfig restClientConfig = RestClientConfig.builder().timeout(1000).build(); + RestClient client = new RestClientImpl(TEST_URL, restClientConfig, 400); Assert.assertThrows(ClientException.class, () -> { client.delete("path", "id1"); }); } - @Test - public void testClose() { - RestClient client = new RestClientImpl("/test", 1000, 10, 5, 200); - RestResult restResult = client.post("path", "body"); - Assert.assertEquals(200, restResult.status()); - - client.close(); - Assert.assertThrows(IllegalStateException.class, () -> { - client.post("path", "body"); - }); - - PoolingHttpClientConnectionManager pool; - pool = Whitebox.getInternalState(client, "pool"); - Assert.assertNotNull(pool); - AtomicBoolean isShutDown = Whitebox.getInternalState(pool, "isShutDown"); - Assert.assertTrue(isShutDown.get()); - - ScheduledExecutorService cleanExecutor; - cleanExecutor = Whitebox.getInternalState(client, "cleanExecutor"); - Assert.assertNotNull(cleanExecutor); - Assert.assertTrue(cleanExecutor.isShutdown()); - } - @Test public void testAuthContext() { - RestClientImpl client = new RestClientImpl("/test", 1000, 10, 5, 200); + RestClientConfig restClientConfig = RestClientConfig.builder().timeout(1000).build(); + RestClientImpl client = new RestClientImpl(TEST_URL, restClientConfig, 200); Assert.assertNull(client.getAuthContext()); String token = UUID.randomUUID().toString(); @@ -485,48 +320,33 @@ public void testAuthContext() { Assert.assertNull(client.getAuthContext()); } - private static class MockRestClientImpl extends AbstractRestClient { - - public MockRestClientImpl(String url, int timeout) { - super(url, timeout); - } - - @Override - protected void checkStatus(Response response, - Response.Status... statuses) { - // pass - } - } - + @SneakyThrows @Test public void testRequest() { - MockRestClientImpl client = new MockRestClientImpl("test", 1000); - - WebTarget target = Mockito.mock(WebTarget.class); - Builder builder = Mockito.mock(Builder.class); - - Mockito.when(target.path("test")).thenReturn(target); - Mockito.when(target.path("test") - .path(AbstractRestClient.encode("id"))) - .thenReturn(target); - Mockito.when(target.path("test").request()).thenReturn(builder); - Mockito.when(target.path("test") - .path(AbstractRestClient.encode("id")) - .request()) - .thenReturn(builder); - - Response response = Mockito.mock(Response.class); - Mockito.when(response.getStatus()).thenReturn(200); - Mockito.when(response.getHeaders()) - .thenReturn(new MultivaluedHashMap<>()); - Mockito.when(response.readEntity(String.class)).thenReturn("content"); - - Mockito.when(builder.delete()).thenReturn(response); - Mockito.when(builder.get()).thenReturn(response); - Mockito.when(builder.put(Mockito.any())).thenReturn(response); - Mockito.when(builder.post(Mockito.any())).thenReturn(response); - - Whitebox.setInternalState(client, "target", target); + Response response = Mockito.mock(Response.class, Mockito.RETURNS_DEEP_STUBS); + Mockito.when(response.code()).thenReturn(200); + Mockito.when(response.headers()) + .thenReturn(new RestHeaders().toOkHttpHeader()); + Mockito.when(response.body().string()).thenReturn("content"); + + Request.Builder requestBuilder = Mockito.mock(Request.Builder.class, + Mockito.RETURNS_DEEP_STUBS); + Mockito.when(requestBuilder.delete()).thenReturn(requestBuilder); + Mockito.when(requestBuilder.get()).thenReturn(requestBuilder); + Mockito.when(requestBuilder.put(Mockito.any())).thenReturn(requestBuilder); + Mockito.when(requestBuilder.post(Mockito.any())).thenReturn(requestBuilder); + Mockito.when(requestBuilder.url((HttpUrl) Mockito.any())).thenReturn(requestBuilder); + MockRestClientImpl client = new MockRestClientImpl(TEST_URL, 1000) { + @Override + protected Request.Builder newRequestBuilder() { + return requestBuilder; + } + }; + + OkHttpClient okHttpClient = Mockito.mock(OkHttpClient.class, Mockito.RETURNS_DEEP_STUBS); + Mockito.when(okHttpClient.newCall(Mockito.any()).execute()).thenReturn(response); + + Whitebox.setInternalState(client, "client", okHttpClient); RestResult result; @@ -534,97 +354,140 @@ public void testRequest() { client.setAuthContext("token1"); result = client.delete("test", ImmutableMap.of()); Assert.assertEquals(200, result.status()); - Mockito.verify(builder).header(HttpHeaders.AUTHORIZATION, - "token1"); + Mockito.verify(requestBuilder).addHeader(RestHeaders.AUTHORIZATION, "token1"); + client.resetAuthContext(); client.setAuthContext("token2"); result = client.delete("test", "id"); Assert.assertEquals(200, result.status()); - Mockito.verify(builder).header(HttpHeaders.AUTHORIZATION, - "token2"); + Mockito.verify(requestBuilder).addHeader(HttpHeaders.AUTHORIZATION, "token2"); client.resetAuthContext(); // Test get client.setAuthContext("token3"); result = client.get("test"); Assert.assertEquals(200, result.status()); - Mockito.verify(builder).header(HttpHeaders.AUTHORIZATION, - "token3"); + Mockito.verify(requestBuilder).addHeader(HttpHeaders.AUTHORIZATION, "token3"); client.resetAuthContext(); client.setAuthContext("token4"); result = client.get("test", ImmutableMap.of()); Assert.assertEquals(200, result.status()); - Mockito.verify(builder).header(HttpHeaders.AUTHORIZATION, - "token4"); + Mockito.verify(requestBuilder).addHeader(HttpHeaders.AUTHORIZATION, "token4"); client.resetAuthContext(); client.setAuthContext("token5"); result = client.get("test", "id"); Assert.assertEquals(200, result.status()); - Mockito.verify(builder).header(HttpHeaders.AUTHORIZATION, - "token5"); + Mockito.verify(requestBuilder).addHeader(HttpHeaders.AUTHORIZATION, "token5"); client.resetAuthContext(); // Test put client.setAuthContext("token6"); - result = client.post("test", new Object()); + result = client.post("test", null); Assert.assertEquals(200, result.status()); - Mockito.verify(builder).header(HttpHeaders.AUTHORIZATION, - "token6"); + Mockito.verify(requestBuilder).addHeader(HttpHeaders.AUTHORIZATION, "token6"); client.resetAuthContext(); client.setAuthContext("token7"); - result = client.post("test", new Object(), new MultivaluedHashMap<>()); + result = client.post("test", null, new RestHeaders()); Assert.assertEquals(200, result.status()); - Mockito.verify(builder).header(HttpHeaders.AUTHORIZATION, - "token7"); + Mockito.verify(requestBuilder).addHeader(HttpHeaders.AUTHORIZATION, "token7"); client.resetAuthContext(); client.setAuthContext("token8"); - result = client.post("test", new Object(), ImmutableMap.of()); + result = client.post("test", null, ImmutableMap.of()); Assert.assertEquals(200, result.status()); - Mockito.verify(builder).header(HttpHeaders.AUTHORIZATION, - "token8"); + Mockito.verify(requestBuilder).addHeader(HttpHeaders.AUTHORIZATION, "token8"); client.resetAuthContext(); client.setAuthContext("token9"); - result = client.post("test", new Object(), new MultivaluedHashMap<>(), + result = client.post("test", null, new RestHeaders(), ImmutableMap.of()); Assert.assertEquals(200, result.status()); - Mockito.verify(builder).header(HttpHeaders.AUTHORIZATION, - "token9"); + Mockito.verify(requestBuilder).addHeader(HttpHeaders.AUTHORIZATION, "token9"); client.resetAuthContext(); // Test post client.setAuthContext("token10"); - result = client.post("test", new Object()); + result = client.post("test", null); Assert.assertEquals(200, result.status()); - Mockito.verify(builder).header(HttpHeaders.AUTHORIZATION, - "token10"); + Mockito.verify(requestBuilder).addHeader(HttpHeaders.AUTHORIZATION, "token10"); client.resetAuthContext(); client.setAuthContext("token11"); - result = client.post("test", new Object(), new MultivaluedHashMap<>()); + result = client.post("test", null, new RestHeaders()); Assert.assertEquals(200, result.status()); - Mockito.verify(builder).header(HttpHeaders.AUTHORIZATION, - "token11"); + Mockito.verify(requestBuilder).addHeader(HttpHeaders.AUTHORIZATION, "token11"); client.resetAuthContext(); client.setAuthContext("token12"); - result = client.post("test", new Object(), ImmutableMap.of()); + result = client.post("test", null, ImmutableMap.of()); Assert.assertEquals(200, result.status()); - Mockito.verify(builder).header(HttpHeaders.AUTHORIZATION, - "token12"); + Mockito.verify(requestBuilder).addHeader(HttpHeaders.AUTHORIZATION, "token12"); client.resetAuthContext(); client.setAuthContext("token13"); - result = client.post("test", new Object(), new MultivaluedHashMap<>(), + result = client.post("test", null, new RestHeaders(), ImmutableMap.of()); Assert.assertEquals(200, result.status()); - Mockito.verify(builder).header(HttpHeaders.AUTHORIZATION, - "token13"); + Mockito.verify(requestBuilder).addHeader(HttpHeaders.AUTHORIZATION, "token13"); client.resetAuthContext(); } + + private static class RestClientImpl extends AbstractRestClient { + + private final int status; + private final RestHeaders headers; + private final String content; + + public RestClientImpl(String url, RestClientConfig config, int status) { + this(url, config, status, new RestHeaders(), ""); + } + + public RestClientImpl(String url, RestClientConfig config, int status, RestHeaders headers, + String content) { + super(url, config); + this.status = status; + this.headers = headers; + this.content = content; + } + + @SneakyThrows + @Override + protected Response request(Request.Builder requestBuilder) { + Response response = Mockito.mock(Response.class, Mockito.RETURNS_DEEP_STUBS); + Mockito.when(response.code()).thenReturn(this.status); + Mockito.when(response.headers()).thenReturn(this.headers.toOkHttpHeader()); + Mockito.when(response.body().string()).thenReturn(this.content); + return response; + } + + @Override + protected void checkStatus(Response response, int... statuses) { + boolean match = false; + for (int status : statuses) { + if (status == response.code()) { + match = true; + break; + } + } + if (!match) { + throw new ClientException("Invalid response '%s'", response); + } + } + } + + private static class MockRestClientImpl extends AbstractRestClient { + + public MockRestClientImpl(String url, int timeout) { + super(url, timeout); + } + + @Override + protected void checkStatus(Response response, int... statuses) { + // pass + } + } } diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestResultTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestResultTest.java index 2ae9a4ee54..06eb03a11d 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestResultTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestResultTest.java @@ -19,22 +19,44 @@ import java.util.Map; -import jakarta.ws.rs.core.MultivaluedHashMap; -import jakarta.ws.rs.core.MultivaluedMap; -import jakarta.ws.rs.core.Response; -import org.glassfish.jersey.internal.util.collection.ImmutableMultivaluedMap; +import org.apache.hugegraph.rest.RestHeaders; +import org.apache.hugegraph.rest.RestResult; +import org.apache.hugegraph.rest.SerializeException; +import org.apache.hugegraph.testutil.Assert; import org.junit.Test; import org.mockito.Mockito; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import org.apache.hugegraph.rest.RestResult; -import org.apache.hugegraph.rest.SerializeException; -import org.apache.hugegraph.testutil.Assert; +import lombok.SneakyThrows; +import okhttp3.Response; public class RestResultTest { + private static RestResult newRestResult(int status) { + return newRestResult(status, "", new RestHeaders()); + } + + private static RestResult newRestResult(int status, String content) { + return newRestResult(status, content, new RestHeaders()); + } + + private static RestResult newRestResult(int status, RestHeaders headers) { + return newRestResult(status, "", headers); + } + + @SneakyThrows + private static RestResult newRestResult(int status, String content, + RestHeaders headers) { + Response response = Mockito.mock(Response.class, Mockito.RETURNS_DEEP_STUBS); + Mockito.when(response.code()).thenReturn(status); + Mockito.when(response.headers()).thenReturn(headers.toOkHttpHeader()); + Mockito.when(response.body().string()) + .thenReturn(content); + return new RestResult(response); + } + @Test public void testStatus() { RestResult result = newRestResult(200); @@ -43,7 +65,7 @@ public void testStatus() { @Test public void testHeaders() { - MultivaluedMap headers = new MultivaluedHashMap<>(); + RestHeaders headers = new RestHeaders(); headers.add("key1", "value1-1"); headers.add("key1", "value1-2"); headers.add("key2", "value2"); @@ -116,27 +138,4 @@ public void testContentListWithException() { result3.readList(String.class); }); } - - private static RestResult newRestResult(int status) { - return newRestResult(status, "", ImmutableMultivaluedMap.empty()); - } - - private static RestResult newRestResult(int status, String content) { - return newRestResult(status, content, ImmutableMultivaluedMap.empty()); - } - - private static RestResult newRestResult(int status, - MultivaluedMap h) { - return newRestResult(status, "", h); - } - - private static RestResult newRestResult(int status, String content, - MultivaluedMap h) { - Response response = Mockito.mock(Response.class); - Mockito.when(response.getStatus()).thenReturn(status); - Mockito.when(response.getHeaders()).thenReturn(h); - Mockito.when(response.readEntity(String.class)) - .thenReturn(content); - return new RestResult(response); - } } diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/ReflectionUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/ReflectionUtilTest.java index 510d1454bd..c83b2ad987 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/ReflectionUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/ReflectionUtilTest.java @@ -94,7 +94,7 @@ public void testClasses() throws IOException { @SuppressWarnings("unchecked") List classes = IteratorUtils.toList(ReflectionUtil.classes( "org.apache.hugegraph.util")); - Assert.assertEquals(17, classes.size()); + Assert.assertEquals(18, classes.size()); classes.sort(Comparator.comparing(ClassInfo::getName)); Assert.assertEquals("org.apache.hugegraph.util.Bytes", classes.get(0).getName()); @@ -103,7 +103,7 @@ public void testClasses() throws IOException { Assert.assertEquals("org.apache.hugegraph.util.CollectionUtil", classes.get(2).getName()); Assert.assertEquals("org.apache.hugegraph.util.VersionUtil", - classes.get(16).getName()); + classes.get(17).getName()); } @Test diff --git a/hugegraph-common/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/hugegraph-common/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker new file mode 100644 index 0000000000..a76010b24c --- /dev/null +++ b/hugegraph-common/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker @@ -0,0 +1,17 @@ +# +# 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. +# +mock-maker-inline diff --git a/hugegraph-dist/scripts/dependency/known-dependencies.txt b/hugegraph-dist/scripts/dependency/known-dependencies.txt index c6de269ced..53b4567d5b 100644 --- a/hugegraph-dist/scripts/dependency/known-dependencies.txt +++ b/hugegraph-dist/scripts/dependency/known-dependencies.txt @@ -1,6 +1,6 @@ animal-sniffer-annotations-1.18.jar annotations-4.1.1.4.jar -aopalliance-repackaged-3.0.1.jar +annotations-13.0.jar bolt-1.6.2.jar checker-qual-3.5.0.jar commons-beanutils-1.9.4.jar @@ -27,11 +27,6 @@ gson-2.8.6.jar guava-30.0-jre.jar hamcrest-core-1.3.jar hessian-3.3.7.jar -hk2-api-3.0.1.jar -hk2-locator-3.0.1.jar -hk2-utils-3.0.1.jar -httpclient-4.5.13.jar -httpcore-4.4.13.jar j2objc-annotations-1.3.jar jackson-annotations-2.14.0-rc1.jar jackson-core-2.14.0-rc1.jar @@ -42,22 +37,10 @@ jackson-jaxrs-json-provider-2.14.0-rc1.jar jackson-module-jaxb-annotations-2.14.0-rc1.jar jakarta.activation-2.0.1.jar jakarta.activation-api-1.2.2.jar -jakarta.annotation-api-2.0.0.jar -jakarta.inject-api-2.0.0.jar -jakarta.ws.rs-api-3.0.0.jar -jakarta.xml.bind-api-4.0.0-RC2.jar javassist-3.28.0-GA.jar -javax.activation-api-1.2.0.jar javax.json-1.0.jar -jaxb-api-2.3.1.jar jaxb-core-3.0.2.jar jaxb-impl-3.0.2.jar -jersey-apache-connector-3.0.3.jar -jersey-client-3.0.3.jar -jersey-common-3.0.3.jar -jersey-entity-filtering-3.0.3.jar -jersey-hk2-3.0.3.jar -jersey-media-json-jackson-3.0.3.jar joda-time-2.10.8.jar jsr305-3.0.1.jar junit-4.13.1.jar @@ -71,7 +54,6 @@ opentracing-api-0.22.0.jar opentracing-mock-0.22.0.jar opentracing-noop-0.22.0.jar opentracing-util-0.22.0.jar -osgi-resource-locator-1.0.3.jar perfmark-api-0.19.0.jar proto-google-common-protos-1.17.0.jar protobuf-java-3.11.0.jar @@ -84,3 +66,12 @@ swagger-core-1.5.18.jar swagger-models-1.5.18.jar tracer-core-3.0.8.jar validation-api-1.1.0.Final.jar +kotlin-stdlib-1.6.20.jar +kotlin-stdlib-common-1.5.31.jar +kotlin-stdlib-jdk7-1.6.10.jar +kotlin-stdlib-jdk8-1.6.10.jar +logging-interceptor-4.10.0.jar +lombok-1.18.8.jar +okhttp-4.10.0.jar +okio-jvm-3.0.0.jar + diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/version/RpcVersion.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/version/RpcVersion.java index f3cf926a0b..c7ab4052a0 100644 --- a/hugegraph-rpc/src/main/java/org/apache/hugegraph/version/RpcVersion.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/version/RpcVersion.java @@ -24,5 +24,5 @@ public class RpcVersion { public static final String NAME = "hugegraph-rpc"; // The second parameter of Version.of() is for all-in-one JAR - public static final Version VERSION = Version.of(RpcVersion.class, "1.0.1"); + public static final Version VERSION = Version.of(RpcVersion.class, "1.2.0"); } diff --git a/pom.xml b/pom.xml index 8f2e39bb2e..2b8a486621 100644 --- a/pom.xml +++ b/pom.xml @@ -90,7 +90,7 @@ - 1.0.1 + 1.2.0 UTF-8 ${project.basedir}/.. 1.8 From 8c93652de7f8dc8d478c1029e34912fa06566fa6 Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Thu, 30 Nov 2023 16:25:31 +0800 Subject: [PATCH 207/217] fix: Assert.assertThrows() should check result of exceptionConsumer (#135) * fix: Assert.assertThrows() should check result of exceptionConsumer * fix some warnings * remove assertThrowsFuture() from Assert --- .../apache/hugegraph/config/HugeConfig.java | 12 ++--- .../org/apache/hugegraph/perf/PerfUtil.java | 12 ++--- .../hugegraph/rest/RestClientConfig.java | 1 + .../org/apache/hugegraph/testutil/Assert.java | 54 +++++++++---------- .../apache/hugegraph/util/ExceptionUtil.java | 49 +++++++++++++++++ .../apache/hugegraph/testutil/AssertTest.java | 26 +++++++-- .../apache/hugegraph/unit/BaseUnitTest.java | 8 +-- .../unit/util/ReflectionUtilTest.java | 16 +++--- 8 files changed, 121 insertions(+), 57 deletions(-) create mode 100644 hugegraph-common/src/main/java/org/apache/hugegraph/util/ExceptionUtil.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/config/HugeConfig.java b/hugegraph-common/src/main/java/org/apache/hugegraph/config/HugeConfig.java index c48219fc68..4837154563 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/config/HugeConfig.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/config/HugeConfig.java @@ -22,8 +22,8 @@ import java.util.List; import java.util.Map; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.Log; +import javax.annotation.Nullable; + import org.apache.commons.configuration2.Configuration; import org.apache.commons.configuration2.FileBasedConfiguration; import org.apache.commons.configuration2.PropertiesConfiguration; @@ -35,10 +35,10 @@ import org.apache.commons.configuration2.io.FileHandler; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.Log; import org.slf4j.Logger; -import javax.annotation.Nullable; - public class HugeConfig extends PropertiesConfiguration { private static final Logger LOG = Log.logger(HugeConfig.class); @@ -117,7 +117,7 @@ public void addPropertyDirect(String key, Object value) { value = this.validateOption(key, value); } if (this.containsKey(key) && value instanceof List) { - for (Object item : (List) value) { + for (Object item : (List) value) { super.addPropertyDirect(key, item); } } else { @@ -137,7 +137,7 @@ private Object validateOption(String key, Object value) { return option.parseConvert((String) value); } - Class dataType = option.dataType(); + Class dataType = option.dataType(); if (dataType.isInstance(value)) { return value; } diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java index 456611b6d4..77b68d6be7 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java @@ -556,7 +556,7 @@ public long preventOptimizePadding() { } } - public static final class LocalStack { + public static final class LocalStack { private final Object[] elementData; private int elementCount; @@ -574,27 +574,27 @@ boolean empty() { return this.elementCount == 0; } - public void push(E elem) { + public void push(T elem) { this.elementData[this.elementCount++] = elem; } - public E pop() { + public T pop() { if (this.elementCount == 0) { throw new EmptyStackException(); } this.elementCount--; @SuppressWarnings("unchecked") - E elem = (E) this.elementData[this.elementCount]; + T elem = (T) this.elementData[this.elementCount]; this.elementData[this.elementCount] = null; return elem; } - public E peek() { + public T peek() { if (this.elementCount == 0) { throw new EmptyStackException(); } @SuppressWarnings("unchecked") - E elem = (E) this.elementData[this.elementCount - 1]; + T elem = (T) this.elementData[this.elementCount - 1]; return elem; } } diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClientConfig.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClientConfig.java index ef3e9b0ee1..fc63613bb2 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClientConfig.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClientConfig.java @@ -24,6 +24,7 @@ @Builder @Getter @Setter +@SuppressWarnings("unused") public class RestClientConfig { private String user; diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Assert.java b/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Assert.java index 218342ea42..bd82eef6a9 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Assert.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Assert.java @@ -17,7 +17,6 @@ package org.apache.hugegraph.testutil; -import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; import java.util.function.Function; @@ -37,43 +36,36 @@ public interface ThrowableConsumer { void accept(T t) throws Throwable; } - public static void assertThrows(Class throwable, - ThrowableRunnable runnable) { - CompletableFuture future = assertThrowsFuture(throwable, runnable); - future.thenAccept(System.err::println); - } - - public static void assertThrows(Class throwable, + public static void assertThrows(Class clazz, ThrowableRunnable runnable, Consumer exceptionConsumer) { - CompletableFuture future = assertThrowsFuture(throwable, - runnable); - future.thenAccept(exceptionConsumer); + Throwable expectedException = assertThrows(clazz, runnable); + assert expectedException != null; + exceptionConsumer.accept(expectedException); } - public static CompletableFuture assertThrowsFuture( - Class clazz, - ThrowableRunnable runnable) { - CompletableFuture future = new CompletableFuture<>(); - boolean fail = false; + public static Throwable assertThrows(Class clazz, + ThrowableRunnable runnable) { try { + // expect throwing here runnable.run(); - fail = true; } catch (Throwable e) { if (!clazz.isInstance(e)) { - Assert.fail(String.format( - "Bad exception type %s(expected %s)", - e.getClass().getName(), clazz.getName())); + // exception type not matched + Assert.fail(String.format("Bad exception type %s(expected %s)", + e.getClass().getName(), clazz.getName())); } - future.complete(e); - } - if (fail) { - String msg = String.format("No exception was thrown(expected %s)", - clazz.getName()); - future.completeExceptionally(new AssertionError(msg)); - Assert.fail(msg); + + return e; } - return future; + + // no exception + Assert.fail(String.format("No exception was thrown(expected %s)", + clazz.getName())); + + // unavailable + assert false; + return null; } public static void assertEquals(byte expected, Object actual) { @@ -104,34 +96,40 @@ public static void assertEquals(double expected, Object actual) { org.junit.Assert.assertEquals(expected, actual); } + @SuppressWarnings("deprecation") public static void assertGt(Number expected, Object actual) { org.junit.Assert.assertThat(actual, new NumberMatcher(expected, cmp -> { return cmp > 0; }, ">")); } + @SuppressWarnings("deprecation") public static void assertGte(Number expected, Object actual) { org.junit.Assert.assertThat(actual, new NumberMatcher(expected, cmp -> { return cmp >= 0; }, ">=")); } + @SuppressWarnings("deprecation") public static void assertLt(Number expected, Object actual) { org.junit.Assert.assertThat(actual, new NumberMatcher(expected, cmp -> { return cmp < 0; }, "<")); } + @SuppressWarnings("deprecation") public static void assertLte(Number expected, Object actual) { org.junit.Assert.assertThat(actual, new NumberMatcher(expected, cmp -> { return cmp <= 0; }, "<=")); } + @SuppressWarnings("deprecation") public static void assertContains(String sub, String actual) { org.junit.Assert.assertThat(actual, CoreMatchers.containsString(sub)); } + @SuppressWarnings("deprecation") public static void assertInstanceOf(Class clazz, Object object) { org.junit.Assert.assertThat(object, CoreMatchers.instanceOf(clazz)); } diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/ExceptionUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/ExceptionUtil.java new file mode 100644 index 0000000000..7142aea76a --- /dev/null +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/ExceptionUtil.java @@ -0,0 +1,49 @@ +/* + * 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.util; + +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; + +public final class ExceptionUtil { + + public static Throwable rootCause(Throwable e) { + Throwable cause = e; + while (cause.getCause() != null) { + cause = cause.getCause(); + } + return cause; + } + + public static RuntimeException transToRuntimeException(Throwable e) { + if (e instanceof RuntimeException) { + return (RuntimeException) e; + } + return new RuntimeException(rootCause(e).getMessage(), e); + } + + public static T futureGet(Future future) { + try { + return future.get(); + } catch (InterruptedException e) { + throw ExceptionUtil.transToRuntimeException(e); + } catch (ExecutionException e) { + throw ExceptionUtil.transToRuntimeException(e.getCause()); + } + } +} diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/testutil/AssertTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/testutil/AssertTest.java index cf08fdaff5..53f60247e9 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/testutil/AssertTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/testutil/AssertTest.java @@ -17,9 +17,8 @@ package org.apache.hugegraph.testutil; -import org.junit.Test; - import org.apache.hugegraph.unit.BaseUnitTest; +import org.junit.Test; public class AssertTest extends BaseUnitTest { @@ -175,6 +174,12 @@ public void testAssertThrows() { throw new RuntimeException(); }); + Throwable exception = Assert.assertThrows(RuntimeException.class, () -> { + throw new RuntimeException("fake-error"); + }); + Assert.assertInstanceOf(RuntimeException.class, exception); + Assert.assertEquals("fake-error", exception.getMessage()); + Assert.assertThrows(RuntimeException.class, () -> { throw new RuntimeException("fake-error"); }, e -> { @@ -183,7 +188,7 @@ public void testAssertThrows() { } @Test - public void testAssertThrowsWithError() { + public void testAssertThrowsWithTypeError() { try { Assert.assertThrows(NullPointerException.class, () -> { // pass @@ -204,6 +209,21 @@ public void testAssertThrowsWithError() { } } + @Test + public void testAssertThrowsWithMessageError() { + try { + Assert.assertThrows(RuntimeException.class, () -> { + throw new RuntimeException("fake-error"); + }, e -> { + Assert.assertEquals("fake-error-typo", e.getMessage()); + }); + Assert.fail("Expect error"); + } catch (AssertionError e) { + Assert.assertContains("expected: but was:", + e.getMessage()); + } + } + @Test public void testAssertGt() { Assert.assertGt((byte) 1, Byte.valueOf("2")); diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java index 96133d40f0..6b9ffcc869 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java @@ -22,12 +22,12 @@ import java.net.URL; import java.util.ArrayList; import java.util.List; -import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import org.apache.commons.io.FileUtils; +import org.apache.hugegraph.util.ExceptionUtil; import org.apache.hugegraph.util.TimeUtil; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -51,11 +51,7 @@ protected static void runWithThreads(int threads, Runnable task) { futures.add(executor.submit(task)); } for (Future future : futures) { - try { - future.get(); - } catch (InterruptedException | ExecutionException e) { - throw new RuntimeException(e); - } + ExceptionUtil.futureGet(future); } } diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/ReflectionUtilTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/ReflectionUtilTest.java index c83b2ad987..f511ddfc7d 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/ReflectionUtilTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/ReflectionUtilTest.java @@ -22,19 +22,19 @@ import java.util.Comparator; import java.util.List; -import org.junit.Test; - +import org.apache.commons.collections.IteratorUtils; +import org.apache.hugegraph.perf.PerfUtil; import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.unit.BaseUnitTest; import org.apache.hugegraph.unit.perf.testclass.TestClass; import org.apache.hugegraph.unit.perf.testclass.TestClass.Bar; import org.apache.hugegraph.unit.perf.testclass.TestClass.Base; import org.apache.hugegraph.unit.perf.testclass.TestClass.Foo; import org.apache.hugegraph.unit.perf.testclass.TestClass.ManuallyProfile; import org.apache.hugegraph.unit.perf.testclass.TestClass.Sub; -import org.apache.hugegraph.perf.PerfUtil; -import org.apache.hugegraph.unit.BaseUnitTest; import org.apache.hugegraph.util.ReflectionUtil; -import org.apache.commons.collections.IteratorUtils; +import org.junit.Test; + import com.google.common.reflect.ClassPath.ClassInfo; import javassist.NotFoundException; @@ -94,7 +94,7 @@ public void testClasses() throws IOException { @SuppressWarnings("unchecked") List classes = IteratorUtils.toList(ReflectionUtil.classes( "org.apache.hugegraph.util")); - Assert.assertEquals(18, classes.size()); + Assert.assertEquals(19, classes.size()); classes.sort(Comparator.comparing(ClassInfo::getName)); Assert.assertEquals("org.apache.hugegraph.util.Bytes", classes.get(0).getName()); @@ -102,8 +102,8 @@ public void testClasses() throws IOException { classes.get(1).getName()); Assert.assertEquals("org.apache.hugegraph.util.CollectionUtil", classes.get(2).getName()); - Assert.assertEquals("org.apache.hugegraph.util.VersionUtil", - classes.get(17).getName()); + Assert.assertEquals("org.apache.hugegraph.util.DateUtil", + classes.get(3).getName()); } @Test From 10f0a87c7b6a0519c4575964909e322d03aeda85 Mon Sep 17 00:00:00 2001 From: imbajin Date: Mon, 4 Dec 2023 14:55:56 +0800 Subject: [PATCH 208/217] refact(common): rename jsonutil to avoid conflicts with server (#136) fix https://github.com/apache/incubator-hugegraph/actions/runs/7082354080/job/19273001614?pr=2365 Also add some comment for it --- .../hugegraph/rest/AbstractRestClient.java | 4 +- .../{JsonUtil.java => JsonUtilCommon.java} | 52 +++++++++++++++---- 2 files changed, 44 insertions(+), 12 deletions(-) rename hugegraph-common/src/main/java/org/apache/hugegraph/util/{JsonUtil.java => JsonUtilCommon.java} (63%) diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java index 27d9add572..00662bf160 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java @@ -37,7 +37,7 @@ import javax.net.ssl.X509TrustManager; import org.apache.commons.lang3.StringUtils; -import org.apache.hugegraph.util.JsonUtil; +import org.apache.hugegraph.util.JsonUtilCommon; import org.jetbrains.annotations.NotNull; import com.google.common.collect.ImmutableMap; @@ -128,7 +128,7 @@ private static RequestBody buildRequestBody(Object body, RestHeaders headers) { if (body == null) { bodyContent = "{}"; } else { - bodyContent = JsonUtil.toJson(body); + bodyContent = JsonUtilCommon.toJson(body); } } else { bodyContent = String.valueOf(body); diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/JsonUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/JsonUtilCommon.java similarity index 63% rename from hugegraph-common/src/main/java/org/apache/hugegraph/util/JsonUtil.java rename to hugegraph-common/src/main/java/org/apache/hugegraph/util/JsonUtilCommon.java index fc9586b3e8..ad0acebeec 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/JsonUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/JsonUtilCommon.java @@ -17,46 +17,78 @@ package org.apache.hugegraph.util; +import java.io.IOException; + +import org.apache.hugegraph.rest.SerializeException; + import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.Module; import com.fasterxml.jackson.databind.ObjectMapper; -import org.apache.hugegraph.rest.SerializeException; - -import java.io.IOException; -public final class JsonUtil { +/** + * Utility class for JSON operations. + */ +public final class JsonUtilCommon { + /** + * ObjectMapper instance used for JSON operations. + */ private static final ObjectMapper MAPPER = new ObjectMapper(); + /** + * Registers a module with the ObjectMapper. + * + * @param module the module to register + */ public static void registerModule(Module module) { MAPPER.registerModule(module); } + /** + * Converts an object to a JSON string. + * + * @param object the object to convert + * @return the JSON string representation of the object + * @throws SerializeException if the object cannot be serialized + */ public static String toJson(Object object) { try { return MAPPER.writeValueAsString(object); } catch (JsonProcessingException e) { - throw new SerializeException("Failed to serialize object '%s'", - e, object); + throw new SerializeException("Failed to serialize object '%s'", e, object); } } + /** + * Converts a JSON string to an object of the specified class. + * + * @param json the JSON string + * @param clazz the class of the object + * @return the object represented by the JSON string + * @throws SerializeException if the JSON string cannot be deserialized + */ public static T fromJson(String json, Class clazz) { try { return MAPPER.readValue(json, clazz); } catch (IOException e) { - throw new SerializeException("Failed to deserialize json '%s'", - e, json); + throw new SerializeException("Failed to deserialize json '%s'", e, json); } } + /** + * Converts a JsonNode to an object of the specified class. + * + * @param node the JsonNode + * @param clazz the class of the object + * @return the object represented by the JsonNode + * @throws SerializeException if the JsonNode cannot be deserialized + */ public static T convertValue(JsonNode node, Class clazz) { try { return MAPPER.convertValue(node, clazz); } catch (IllegalArgumentException e) { - throw new SerializeException("Failed to deserialize json node '%s'", - e, node); + throw new SerializeException("Failed to deserialize json node '%s'", e, node); } } } From dcf37525153c87ba31106e35f9866f94a5977913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87?= <940643974@qq.com> Date: Tue, 5 Dec 2023 10:56:12 +0800 Subject: [PATCH 209/217] fix the json param convert (#137) --- .../main/java/org/apache/hugegraph/rest/AbstractRestClient.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java index 00662bf160..973f177da5 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java @@ -127,6 +127,8 @@ private static RequestBody buildRequestBody(Object body, RestHeaders headers) { if (RestHeaders.APPLICATION_JSON.equals(contentType)) { if (body == null) { bodyContent = "{}"; + } else if (body instanceof String) { + bodyContent = (String) body; } else { bodyContent = JsonUtilCommon.toJson(body); } From 44f99e968cca572368d33f4d7cb58cd2de676145 Mon Sep 17 00:00:00 2001 From: imbajin Date: Tue, 12 Dec 2023 17:21:28 +0800 Subject: [PATCH 210/217] doc: update README for release (#138) --- README.md | 39 ++++++++++++++++++++++++++++++++------ hugegraph-common/README.md | 4 ++-- hugegraph-rpc/README.md | 7 ++----- 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 556a3a33cf..d7e834ecd8 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,9 @@ [![License](https://img.shields.io/badge/license-Apache%202-0E78BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) [![codecov](https://codecov.io/gh/hugegraph/hugegraph-common/branch/master/graph/badge.svg)](https://codecov.io/gh/hugegraph/hugegraph-common) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.apache.hugegraph/hugegraph-common/badge.svg)](https://mvnrepository.com/artifact/org.apache.hugegraph/hugegraph-common) +[![CodeQL](https://github.com/apache/incubator-hugegraph-commons/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/apache/incubator-hugegraph-commons/actions/workflows/codeql-analysis.yml) +[![hugegraph-commons ci](https://github.com/apache/incubator-hugegraph-commons/actions/workflows/ci.yml/badge.svg)](https://github.com/apache/incubator-hugegraph-commons/actions/workflows/ci.yml) + hugegraph-commons is a common module for [HugeGraph](https://github.com/apache/hugegraph) and its peripheral components. hugegraph-commons encapsulates locks, configurations, events, iterators, rest and some @@ -13,11 +16,21 @@ numeric or collection util classes to simplify the development of HugeGraph and - Lock: atomic lock, key lock, lock group and lock manger - Config: register and load config option with security check - Event: listening and notification, do something asynchronously -- Iterator: some iterators with extra functions, map, filter, extend etc. -- Rest: RESTful client implemented on Jersey, POST, PUT, GET and DELETE -- Util: performance analyzer, version checker, numeric and Collection utils, log and exception utils etc. +- Iterator: some iterators with extra functions, map, filter, extend, etc. +- Rest: RESTful client implemented on OkHttp, POST, PUT, GET and DELETE +- Util: performance analyzer, version checker, numeric and Collection utils, log and exception utils, etc. - Rpc: rpc component for inner module communication, currently it's based on [Sofa-RPC](https://github.com/sofastack/sofa-rpc) +You could use import the dependencies in `maven` like this: + +```xml + + org.apache.hugegraph + hugegraph-common + 1.2.0 + +``` + ## Learn More The [doc page](https://hugegraph.apache.org/docs/) contains more information about hugegraph modules. @@ -28,12 +41,26 @@ And here are links of other repositories: 3. [hugegraph-computer](https://github.com/apache/hugegraph-computer) (graph processing system - OLAP) 4. [hugegraph-website/doc](https://github.com/apache/hugegraph-doc) (include doc & website code) + + ## Contributing -Welcome to contribute, please see [`How to Contribute`](https://github.com/apache/hugegraph/blob/master/CONTRIBUTING.md) for more information +- Welcome to contribute to HugeGraph, please see [`How to Contribute`](CONTRIBUTING.md) & [Guidelines](https://hugegraph.apache.org/docs/contribution-guidelines/) for more information. +- Note: It's recommended to use [GitHub Desktop](https://desktop.github.com/) to greatly simplify the PR and commit process. +- Thank you to all the people who already contributed to HugeGraph! -Note: It's recommended to use [GitHub Desktop](https://desktop.github.com/) to **greatly simplify** the PR and commit process. +[![contributors graph](https://contrib.rocks/image?repo=apache/hugegraph-commons)](https://github.com/apache/incubator-hugegraph-commons/graphs/contributors) ## Licence -Same as HugeGraph, hugegraph-commons is also licensed under `Apache 2.0` License. +Same as HugeGraph, hugegraph-commons are also licensed under [Apache 2.0](./LICENSE) License. + +### Contact Us + +--- + + - [GitHub Issues](https://github.com/apache/incubator-hugegraph-commons/issues): Feedback on usage issues and functional requirements (quick response) + - Feedback Email: [dev@hugegraph.apache.org](mailto:dev@hugegraph.apache.org) ([subscriber](https://hugegraph.apache.org/docs/contribution-guidelines/subscribe/) only) + - WeChat public account: Apache HugeGraph, welcome to scan this QR code to follow us. + + QR png diff --git a/hugegraph-common/README.md b/hugegraph-common/README.md index ca2f80d752..8614ba126b 100644 --- a/hugegraph-common/README.md +++ b/hugegraph-common/README.md @@ -15,9 +15,9 @@ its components. - Lock: atomic lock, key lock, lock group and lock manger - Config: register and load config option with security check - Event: listening and notification, do something asynchronously -- Iterator: some iterators with extra functions, map, filter, extend etc. +- Iterator: some iterators with extra functions, map, filter, extend, etc. - Rest: RESTful client implemented on Jersey, POST, PUT, GET and DELETE -- Util: Performance analyzer, version checker, numeric and Collection utils, log and exception utils etc. +- Util: Performance analyzer, version checker, numeric and Collection utils, log and exception utils, etc. ## Licence The same as HugeGraph, hugegraph-common is also licensed under Apache 2.0 License. diff --git a/hugegraph-rpc/README.md b/hugegraph-rpc/README.md index 17a17b6eab..c316a9c412 100644 --- a/hugegraph-rpc/README.md +++ b/hugegraph-rpc/README.md @@ -6,11 +6,8 @@ HugeGraph Database RPC component, currently it's based on [Sofa-RPC](https://git ## Learn More -The [project homepage](https://hugegraph.github.io/hugegraph-doc/) contains more information on HugeGraph and provides links to documentation, getting-started guides and release downloads. - -## Contributing - -Welcome to contribute to HugeGraph, please see [`How to Contribute`](CONTRIBUTING.md) for more information. +The [project homepage](https://hugegraph.github.io/hugegraph-doc/) contains more information on +HugeGraph and provides links to documentation, getting-started guides and release downloads. ## License From 33fa9ed45d0d2b743e9ea528b6f1f0b5d0bbbb5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87?= <940643974@qq.com> Date: Sun, 17 Dec 2023 15:35:03 +0800 Subject: [PATCH 211/217] update licence (#139) --- hugegraph-dist/release-docs/LICENSE | 12 +- hugegraph-dist/release-docs/NOTICE | 11 + ...api.txt => LICENSE-jakarta.activation.txt} | 0 .../licenses/LICENSE-jakarta.xml.bind-api.txt | 29 -- .../release-docs/licenses/LICENSE-jersey.txt | 362 ------------------ .../release-docs/licenses/LICENSE-okhttp.txt | 202 ++++++++++ 6 files changed, 215 insertions(+), 401 deletions(-) rename hugegraph-dist/release-docs/licenses/{LICENSE-jakarta.annotation-api.txt => LICENSE-jakarta.activation.txt} (100%) delete mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-jakarta.xml.bind-api.txt delete mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-jersey.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-okhttp.txt diff --git a/hugegraph-dist/release-docs/LICENSE b/hugegraph-dist/release-docs/LICENSE index faa4bb101f..ab02e44829 100644 --- a/hugegraph-dist/release-docs/LICENSE +++ b/hugegraph-dist/release-docs/LICENSE @@ -219,12 +219,6 @@ The following components are provided under the Apache 2.0 License. See licenses/ for text of these licenses. (Apache License, 2.0) Javassist (org.javassist:javassist:3.28.0-GA - http://www.javassist.org/) - (Apache License, 2.0) jersey-connectors-apache (org.glassfish.jersey.connectors:jersey-apache-connector:3.0.3 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-apache-connector) - (Apache License, 2.0) jersey-core-client (org.glassfish.jersey.core:jersey-client:3.0.3 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-client) - (Apache License, 2.0) jersey-core-common (org.glassfish.jersey.core:jersey-common:3.0.3 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-common) - (Apache License, 2.0) jersey-ext-entity-filtering (org.glassfish.jersey.ext:jersey-entity-filtering:3.0.3 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-entity-filtering) - (Apache License, 2.0) jersey-inject-hk2 (org.glassfish.jersey.inject:jersey-hk2:3.0.3 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-hk2) - (Apache License, 2.0) jersey-media-json-jackson (org.glassfish.jersey.media:jersey-media-json-jackson:3.0.3 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-media-json-jackson) (Apache License, Version 2.0) * Apache Commons BeanUtils:- commons-beanutils:commons-beanutils:1.9.4 (https://commons.apache.org/proper/commons-beanutils/) (Apache License, Version 2.0) * Apache Commons Codec:- commons-codec:commons-codec:1.13 (https://commons.apache.org/proper/commons-codec/) (Apache License, Version 2.0) * Apache Commons Collections:- commons-collections:commons-collections:3.2.2 (http://commons.apache.org/collections/) @@ -256,7 +250,6 @@ See licenses/ for text of these licenses. (Apache License, Version 2.0) * Jackson-annotations:- com.fasterxml.jackson.core:jackson-annotations:2.14.0-rc1 (https://github.com/FasterXML/jackson) (Apache License, Version 2.0) * Jackson-core:- com.fasterxml.jackson.core:jackson-core:2.14.0-rc1 (https://github.com/FasterXML/jackson-core) (Apache License, Version 2.0) * Jackson-dataformat-YAML:- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.9.3 (https://github.com/FasterXML/jackson-dataformats-text) - (Apache License, Version 2.0) * Jakarta Dependency Injection:- jakarta.inject:jakarta.inject-api:2.0.0 (https://github.com/eclipse-ee4j/injection-api) (Apache License, Version 2.0) * Joda-Time:- joda-time:joda-time:2.10.8 (https://www.joda.org/joda-time/) (Apache License, Version 2.0) * Netty/All-in-One:- io.netty:netty-all:4.1.42.Final (https://netty.io/netty-all/) (Apache License, Version 2.0) * Objenesis:- org.objenesis:objenesis:3.2 (http://objenesis.org/objenesis) @@ -285,6 +278,8 @@ See licenses/ for text of these licenses. (Apache License, Version 2.0) * swagger-core:- io.swagger:swagger-core:1.5.18 (https://github.com/swagger-api/swagger-core/modules/swagger-core) (Apache License, Version 2.0) * swagger-models:- io.swagger:swagger-models:1.5.18 (https://github.com/swagger-api/swagger-core/modules/swagger-models) (Apache License, Version 2.0) * tracer-core:- com.alipay.sofa:tracer-core:3.0.8 (https://projects.spring.io/spring-boot/#/spring-boot-starter-parent/sofaboot-dependencies/tracer-all-parent/tracer-core) + (Apache License, Version 2.0) * OkHttp (com.squareup.okhttp3:okhttp:4.10.0 - https://github.com/square/okhttp) + (Apache License, Version 2.0) * OkHttp (com.squareup.okhttp3:logging-interceptor:4.10.0 - https://github.com/square/okhttp) ======================================================================== Third party CDDL licenses @@ -305,11 +300,9 @@ The following components are provided under the EPL License. See licenses/ for text of these licenses. (Eclipse Public License - v2.0) * HK2 API module:- org.glassfish.hk2:hk2-api:3.0.1 (https://github.com/eclipse-ee4j/glassfish-hk2/hk2-api) (Eclipse Public License - v2.0) * HK2 Implementation Utilities:- org.glassfish.hk2:hk2-utils:3.0.1 (https://github.com/eclipse-ee4j/glassfish-hk2/hk2-utils) - (Eclipse Public License - v2.0) * Jakarta Annotations API:- jakarta.annotation:jakarta.annotation-api:2.0.0 (https://projects.eclipse.org/projects/ee4j.ca) (Eclipse Public License - v2.0) * OSGi resource locator:- org.glassfish.hk2:osgi-resource-locator:1.0.3 (https://projects.eclipse.org/projects/ee4j/osgi-resource-locator) (Eclipse Public License - v2.0) * ServiceLocator Default Implementation:- org.glassfish.hk2:hk2-locator:3.0.1 (https://github.com/eclipse-ee4j/glassfish-hk2/hk2-locator) (Eclipse Public License - v2.0) * aopalliance version 1.0 repackaged as a module:- org.glassfish.hk2.external:aopalliance-repackaged:3.0.1 (https://github.com/eclipse-ee4j/glassfish-hk2/external/aopalliance-repackaged) - (Eclipse Public License - v2.0) * jakarta.ws.rs-api:- jakarta.ws.rs:jakarta.ws.rs-api:3.0.0 (https://github.com/eclipse-ee4j/jaxrs-api) (Eclipse Public License - v2.0) * JUnit:- junit:junit:4.13.1 (http://junit.org) ======================================================================== @@ -320,7 +313,6 @@ The following components are provided under the EDL License. See licenses/ for text of these licenses. (Eclipse Distribution License - v1.0) * Jakarta Activation:- com.sun.activation:jakarta.activation:2.0.1 (https://github.com/eclipse-ee4j/jaf/jakarta.activation) (Eclipse Distribution License - v1.0) * Jakarta Activation API jar:- jakarta.activation:jakarta.activation-api:1.2.2 (https://github.com/eclipse-ee4j/jaf/jakarta.activation-api) - (Eclipse Distribution License - v1.0) * Jakarta XML Binding API:- jakarta.xml.bind:jakarta.xml.bind-api:4.0.0-RC2 (https://github.com/eclipse-ee4j/jaxb-api/jakarta.xml.bind-api) (Eclipse Distribution License - v1.0) * Old JAXB Core:- com.sun.xml.bind:jaxb-core:3.0.2 (https://eclipse-ee4j.github.io/jaxb-ri/) (Eclipse Distribution License - v1.0) * Old JAXB Runtime:- com.sun.xml.bind:jaxb-impl:3.0.2 (https://eclipse-ee4j.github.io/jaxb-ri/) diff --git a/hugegraph-dist/release-docs/NOTICE b/hugegraph-dist/release-docs/NOTICE index f058182929..7d13a7d48f 100644 --- a/hugegraph-dist/release-docs/NOTICE +++ b/hugegraph-dist/release-docs/NOTICE @@ -922,3 +922,14 @@ SPDX-License-Identifier: BSD-3-Clause The project maintains the following source code repositories: * https://github.com/eclipse-ee4j/jaf +======================================================================== + +okhttp NOTICE + +======================================================================== + +Note that publicsuffixes.gz is compiled from The Public Suffix List: +https://publicsuffix.org/list/public_suffix_list.dat + +It is subject to the terms of the Mozilla Public License, v. 2.0: +https://mozilla.org/MPL/2.0/ diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jakarta.annotation-api.txt b/hugegraph-dist/release-docs/licenses/LICENSE-jakarta.activation.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jakarta.annotation-api.txt rename to hugegraph-dist/release-docs/licenses/LICENSE-jakarta.activation.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jakarta.xml.bind-api.txt b/hugegraph-dist/release-docs/licenses/LICENSE-jakarta.xml.bind-api.txt deleted file mode 100644 index 6fb337cb01..0000000000 --- a/hugegraph-dist/release-docs/licenses/LICENSE-jakarta.xml.bind-api.txt +++ /dev/null @@ -1,29 +0,0 @@ - - Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - - Neither the name of the Eclipse Foundation, Inc. nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS - IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jersey.txt b/hugegraph-dist/release-docs/licenses/LICENSE-jersey.txt deleted file mode 100644 index 82dfb5ccd4..0000000000 --- a/hugegraph-dist/release-docs/licenses/LICENSE-jersey.txt +++ /dev/null @@ -1,362 +0,0 @@ -COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1 - -1. Definitions. - - 1.1. "Contributor" means each individual or entity that creates or - contributes to the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original - Software, prior Modifications used by a Contributor (if any), and - the Modifications made by that particular Contributor. - - 1.3. "Covered Software" means (a) the Original Software, or (b) - Modifications, or (c) the combination of files containing Original - Software with files containing Modifications, in each case including - portions thereof. - - 1.4. "Executable" means the Covered Software in any form other than - Source Code. - - 1.5. "Initial Developer" means the individual or entity that first - makes Original Software available under this License. - - 1.6. "Larger Work" means a work which combines Covered Software or - portions thereof with code not governed by the terms of this License. - - 1.7. "License" means this document. - - 1.8. "Licensable" means having the right to grant, to the maximum - extent possible, whether at the time of the initial grant or - subsequently acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means the Source Code and Executable form of - any of the following: - - A. Any file that results from an addition to, deletion from or - modification of the contents of a file containing Original Software - or previous Modifications; - - B. Any new file that contains any part of the Original Software or - previous Modification; or - - C. Any new file that is contributed or otherwise made available - under the terms of this License. - - 1.10. "Original Software" means the Source Code and Executable form - of computer software code that is originally released under this - License. - - 1.11. "Patent Claims" means any patent claim(s), now owned or - hereafter acquired, including without limitation, method, process, - and apparatus claims, in any patent Licensable by grantor. - - 1.12. "Source Code" means (a) the common form of computer software - code in which modifications are made and (b) associated - documentation included in or with such code. - - 1.13. "You" (or "Your") means an individual or a legal entity - exercising rights under, and complying with all of the terms of, - this License. For legal entities, "You" includes any entity which - controls, is controlled by, or is under common control with You. For - purposes of this definition, "control" means (a) the power, direct - or indirect, to cause the direction or management of such entity, - whether by contract or otherwise, or (b) ownership of more than - fifty percent (50%) of the outstanding shares or beneficial - ownership of such entity. - -2. License Grants. - - 2.1. The Initial Developer Grant. - - Conditioned upon Your compliance with Section 3.1 below and subject - to third party intellectual property claims, the Initial Developer - hereby grants You a world-wide, royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than patent or - trademark) Licensable by Initial Developer, to use, reproduce, - modify, display, perform, sublicense and distribute the Original - Software (or portions thereof), with or without Modifications, - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using or selling of - Original Software, to make, have made, use, practice, sell, and - offer for sale, and/or otherwise dispose of the Original Software - (or portions thereof). - - (c) The licenses granted in Sections 2.1(a) and (b) are effective on - the date Initial Developer first distributes or otherwise makes the - Original Software available to a third party under the terms of this - License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is - granted: (1) for code that You delete from the Original Software, or - (2) for infringements caused by: (i) the modification of the - Original Software, or (ii) the combination of the Original Software - with other software or devices. - - 2.2. Contributor Grant. - - Conditioned upon Your compliance with Section 3.1 below and subject - to third party intellectual property claims, each Contributor hereby - grants You a world-wide, royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than patent or - trademark) Licensable by Contributor to use, reproduce, modify, - display, perform, sublicense and distribute the Modifications - created by such Contributor (or portions thereof), either on an - unmodified basis, with other Modifications, as Covered Software - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or selling - of Modifications made by that Contributor either alone and/or in - combination with its Contributor Version (or portions of such - combination), to make, use, sell, offer for sale, have made, and/or - otherwise dispose of: (1) Modifications made by that Contributor (or - portions thereof); and (2) the combination of Modifications made by - that Contributor with its Contributor Version (or portions of such - combination). - - (c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective - on the date Contributor first distributes or otherwise makes the - Modifications available to a third party. - - (d) Notwithstanding Section 2.2(b) above, no patent license is - granted: (1) for any code that Contributor has deleted from the - Contributor Version; (2) for infringements caused by: (i) third - party modifications of Contributor Version, or (ii) the combination - of Modifications made by that Contributor with other software - (except as part of the Contributor Version) or other devices; or (3) - under Patent Claims infringed by Covered Software in the absence of - Modifications made by that Contributor. - -3. Distribution Obligations. - - 3.1. Availability of Source Code. - - Any Covered Software that You distribute or otherwise make available - in Executable form must also be made available in Source Code form - and that Source Code form must be distributed only under the terms - of this License. You must include a copy of this License with every - copy of the Source Code form of the Covered Software You distribute - or otherwise make available. You must inform recipients of any such - Covered Software in Executable form as to how they can obtain such - Covered Software in Source Code form in a reasonable manner on or - through a medium customarily used for software exchange. - - 3.2. Modifications. - - The Modifications that You create or to which You contribute are - governed by the terms of this License. You represent that You - believe Your Modifications are Your original creation(s) and/or You - have sufficient rights to grant the rights conveyed by this License. - - 3.3. Required Notices. - - You must include a notice in each of Your Modifications that - identifies You as the Contributor of the Modification. You may not - remove or alter any copyright, patent or trademark notices contained - within the Covered Software, or any notices of licensing or any - descriptive text giving attribution to any Contributor or the - Initial Developer. - - 3.4. Application of Additional Terms. - - You may not offer or impose any terms on any Covered Software in - Source Code form that alters or restricts the applicable version of - this License or the recipients' rights hereunder. You may choose to - offer, and to charge a fee for, warranty, support, indemnity or - liability obligations to one or more recipients of Covered Software. - However, you may do so only on Your own behalf, and not on behalf of - the Initial Developer or any Contributor. You must make it - absolutely clear that any such warranty, support, indemnity or - liability obligation is offered by You alone, and You hereby agree - to indemnify the Initial Developer and every Contributor for any - liability incurred by the Initial Developer or such Contributor as a - result of warranty, support, indemnity or liability terms You offer. - - 3.5. Distribution of Executable Versions. - - You may distribute the Executable form of the Covered Software under - the terms of this License or under the terms of a license of Your - choice, which may contain terms different from this License, - provided that You are in compliance with the terms of this License - and that the license for the Executable form does not attempt to - limit or alter the recipient's rights in the Source Code form from - the rights set forth in this License. If You distribute the Covered - Software in Executable form under a different license, You must make - it absolutely clear that any terms which differ from this License - are offered by You alone, not by the Initial Developer or - Contributor. You hereby agree to indemnify the Initial Developer and - every Contributor for any liability incurred by the Initial - Developer or such Contributor as a result of any such terms You offer. - - 3.6. Larger Works. - - You may create a Larger Work by combining Covered Software with - other code not governed by the terms of this License and distribute - the Larger Work as a single product. In such a case, You must make - sure the requirements of this License are fulfilled for the Covered - Software. - -4. Versions of the License. - - 4.1. New Versions. - - Oracle is the initial license steward and may publish revised and/or - new versions of this License from time to time. Each version will be - given a distinguishing version number. Except as provided in Section - 4.3, no one other than the license steward has the right to modify - this License. - - 4.2. Effect of New Versions. - - You may always continue to use, distribute or otherwise make the - Covered Software available under the terms of the version of the - License under which You originally received the Covered Software. If - the Initial Developer includes a notice in the Original Software - prohibiting it from being distributed or otherwise made available - under any subsequent version of the License, You must distribute and - make the Covered Software available under the terms of the version - of the License under which You originally received the Covered - Software. Otherwise, You may also choose to use, distribute or - otherwise make the Covered Software available under the terms of any - subsequent version of the License published by the license steward. - - 4.3. Modified Versions. - - When You are an Initial Developer and You want to create a new - license for Your Original Software, You may create and use a - modified version of this License if You: (a) rename the license and - remove any references to the name of the license steward (except to - note that the license differs from this License); and (b) otherwise - make it clear that the license contains terms which differ from this - License. - -5. DISCLAIMER OF WARRANTY. - - COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE - IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR - NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE - DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY - OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, - REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN - ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS - AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. - -6. TERMINATION. - - 6.1. This License and the rights granted hereunder will terminate - automatically if You fail to comply with terms herein and fail to - cure such breach within 30 days of becoming aware of the breach. - Provisions which, by their nature, must remain in effect beyond the - termination of this License shall survive. - - 6.2. If You assert a patent infringement claim (excluding - declaratory judgment actions) against Initial Developer or a - Contributor (the Initial Developer or Contributor against whom You - assert such claim is referred to as "Participant") alleging that the - Participant Software (meaning the Contributor Version where the - Participant is a Contributor or the Original Software where the - Participant is the Initial Developer) directly or indirectly - infringes any patent, then any and all rights granted directly or - indirectly to You by such Participant, the Initial Developer (if the - Initial Developer is not the Participant) and all Contributors under - Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice - from Participant terminate prospectively and automatically at the - expiration of such 60 day notice period, unless if within such 60 - day period You withdraw Your claim with respect to the Participant - Software against such Participant either unilaterally or pursuant to - a written agreement with Participant. - - 6.3. If You assert a patent infringement claim against Participant - alleging that the Participant Software directly or indirectly - infringes any patent where such claim is resolved (such as by - license or settlement) prior to the initiation of patent - infringement litigation, then the reasonable value of the licenses - granted by such Participant under Sections 2.1 or 2.2 shall be taken - into account in determining the amount or value of any payment or - license. - - 6.4. In the event of termination under Sections 6.1 or 6.2 above, - all end user licenses that have been validly granted by You or any - distributor hereunder prior to termination (excluding licenses - granted to You by any distributor) shall survive termination. - -7. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE - INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF - COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE - TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR - CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT - LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER - FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR - LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE - POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT - APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH - PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH - LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR - LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION - AND LIMITATION MAY NOT APPLY TO YOU. - -8. U.S. GOVERNMENT END USERS. - - The Covered Software is a "commercial item," as that term is defined - in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer - software" (as that term is defined at 48 C.F.R. ß - 252.227-7014(a)(1)) and "commercial computer software documentation" - as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent - with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 - (June 1995), all U.S. Government End Users acquire Covered Software - with only those rights set forth herein. This U.S. Government Rights - clause is in lieu of, and supersedes, any other FAR, DFAR, or other - clause or provision that addresses Government rights in computer - software under this License. - -9. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. This License shall be governed by - the law of the jurisdiction specified in a notice contained within - the Original Software (except to the extent applicable law, if any, - provides otherwise), excluding such jurisdiction's conflict-of-law - provisions. Any litigation relating to this License shall be subject - to the jurisdiction of the courts located in the jurisdiction and - venue specified in a notice contained within the Original Software, - with the losing party responsible for costs, including, without - limitation, court costs and reasonable attorneys' fees and expenses. - The application of the United Nations Convention on Contracts for - the International Sale of Goods is expressly excluded. Any law or - regulation which provides that the language of a contract shall be - construed against the drafter shall not apply to this License. You - agree that You alone are responsible for compliance with the United - States export administration regulations (and the export control - laws and regulation of any other countries) when You use, distribute - or otherwise make available any Covered Software. - -10. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or indirectly, - out of its utilization of rights under this License and You agree to - work with Initial Developer and Contributors to distribute such - responsibility on an equitable basis. Nothing herein is intended or - shall be deemed to constitute any admission of liability. - ------------------------------------------------------------------------- - -NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION -LICENSE (CDDL) - -The code released under the CDDL shall be governed by the laws of the -State of California (excluding conflict-of-law provisions). Any -litigation relating to this License shall be subject to the jurisdiction -of the Federal Courts of the Northern District of California and the -state courts of the State of California, with venue lying in Santa Clara -County, California. diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-okhttp.txt b/hugegraph-dist/release-docs/licenses/LICENSE-okhttp.txt new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-okhttp.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. From 0cfd8daed32cb2644502d6330b9d1ad01387722c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87?= <940643974@qq.com> Date: Wed, 13 Mar 2024 20:13:01 +0800 Subject: [PATCH 212/217] feat: support user defined RestClientConfig/HTTPClient params (#140) - add builderCallback param for client to add custom config - add params connectTimeout and readTimeout to instead the param time - update version to 1.3.0 --------- Co-authored-by: imbajin --- .editorconfig | 31 +++++++++++++++++++ .../hugegraph/rest/AbstractRestClient.java | 11 +++++++ .../hugegraph/rest/RestClientConfig.java | 13 +++++++- .../hugegraph/version/CommonVersion.java | 2 +- .../hugegraph/unit/rest/RestClientTest.java | 28 +++++++++++++++++ .../apache/hugegraph/version/RpcVersion.java | 2 +- pom.xml | 10 +++++- 7 files changed, 93 insertions(+), 4 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..5c47926694 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,31 @@ +# +# 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. +# + +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true + +[*.{java, xml, py}] +indent_style = space +indent_size = 4 + +[*.{java, xml}] +# Ignore the IDEA unsupported warning & it works well (indeed) +continuation_indent_size = 8 diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java index 973f177da5..2b08e69b38 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java @@ -183,6 +183,12 @@ private OkHttpClient buildOkHttpClient(RestClientConfig config) { builder.connectTimeout(config.getTimeout(), TimeUnit.MILLISECONDS) .readTimeout(config.getTimeout(), TimeUnit.MILLISECONDS); } + if (config.getConnectTimeout() != null) { + builder.connectTimeout(config.getConnectTimeout(), TimeUnit.MILLISECONDS); + } + if (config.getReadTimeout() != null) { + builder.readTimeout(config.getReadTimeout(), TimeUnit.MILLISECONDS); + } if (config.getMaxIdleConns() != null || config.getIdleTime() != null) { ConnectionPool connectionPool = new ConnectionPool(config.getMaxIdleConns(), @@ -205,6 +211,11 @@ private OkHttpClient buildOkHttpClient(RestClientConfig config) { configSsl(builder, this.baseUrl, config.getTrustStoreFile(), config.getTrustStorePassword()); + // Execute builder callback before builder.build() for user configs + if (config.getBuilderCallback() != null) { + config.getBuilderCallback().accept(builder); + } + OkHttpClient okHttpClient = builder.build(); if (config.getMaxConns() != null) { diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClientConfig.java b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClientConfig.java index fc63613bb2..c8e766ba7e 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClientConfig.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClientConfig.java @@ -17,9 +17,12 @@ package org.apache.hugegraph.rest; +import java.util.function.Consumer; + import lombok.Builder; import lombok.Getter; import lombok.Setter; +import okhttp3.OkHttpClient; @Builder @Getter @@ -30,8 +33,15 @@ public class RestClientConfig { private String user; private String password; private String token; - // unit in milliseconds + /** + * @deprecated use connectTimeout and readTimeout instead + */ + @Deprecated private Integer timeout; + /** unit in milliseconds */ + private Integer connectTimeout; + /** unit in milliseconds */ + private Integer readTimeout; private Integer maxConns; private Integer maxConnsPerRoute; // unit in seconds @@ -39,4 +49,5 @@ public class RestClientConfig { private Integer maxIdleConns = 5; private String trustStoreFile; private String trustStorePassword; + private Consumer builderCallback; } diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/version/CommonVersion.java b/hugegraph-common/src/main/java/org/apache/hugegraph/version/CommonVersion.java index a049ff44fe..8ae89bd0e2 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/version/CommonVersion.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/version/CommonVersion.java @@ -24,5 +24,5 @@ public class CommonVersion { public static final String NAME = "hugegraph-common"; // The second parameter of Version.of() is for all-in-one JAR - public static final Version VERSION = Version.of(CommonVersion.class, "1.2.0"); + public static final Version VERSION = Version.of(CommonVersion.class, "1.3.0"); } diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestClientTest.java b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestClientTest.java index f7b998df5c..712aea7ab2 100644 --- a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestClientTest.java +++ b/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestClientTest.java @@ -21,6 +21,7 @@ import java.util.HashMap; import java.util.Map; import java.util.UUID; +import java.util.concurrent.TimeUnit; import java.util.function.BiFunction; import javax.net.ssl.SSLContext; @@ -320,6 +321,29 @@ public void testAuthContext() { Assert.assertNull(client.getAuthContext()); } + @SneakyThrows + @Test + public void testBuilderCallback() { + // default configs + MockRestClientImpl restClient = new MockRestClientImpl(TEST_URL, + RestClientConfig.builder().build()); + OkHttpClient okHttpClient = Whitebox.getInternalState(restClient, "client"); + Assert.assertEquals(okHttpClient.connectTimeoutMillis(), 10000); + Assert.assertEquals(okHttpClient.readTimeoutMillis(), 10000); + + // set config by (user)builderCallback + RestClientConfig config = RestClientConfig.builder().builderCallback( + builder -> builder.connectTimeout(5, TimeUnit.SECONDS) + .readTimeout(30, TimeUnit.SECONDS)) + .build(); + + restClient = new MockRestClientImpl(TEST_URL, config); + okHttpClient = Whitebox.getInternalState(restClient, "client"); + + Assert.assertEquals(okHttpClient.connectTimeoutMillis(), 5000); + Assert.assertEquals(okHttpClient.readTimeoutMillis(), 30000); + } + @SneakyThrows @Test public void testRequest() { @@ -485,6 +509,10 @@ public MockRestClientImpl(String url, int timeout) { super(url, timeout); } + public MockRestClientImpl(String url, RestClientConfig config) { + super(url, config); + } + @Override protected void checkStatus(Response response, int... statuses) { // pass diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/version/RpcVersion.java b/hugegraph-rpc/src/main/java/org/apache/hugegraph/version/RpcVersion.java index c7ab4052a0..ac359822d1 100644 --- a/hugegraph-rpc/src/main/java/org/apache/hugegraph/version/RpcVersion.java +++ b/hugegraph-rpc/src/main/java/org/apache/hugegraph/version/RpcVersion.java @@ -24,5 +24,5 @@ public class RpcVersion { public static final String NAME = "hugegraph-rpc"; // The second parameter of Version.of() is for all-in-one JAR - public static final Version VERSION = Version.of(RpcVersion.class, "1.2.0"); + public static final Version VERSION = Version.of(RpcVersion.class, "1.3.0"); } diff --git a/pom.xml b/pom.xml index 2b8a486621..157da40bea 100644 --- a/pom.xml +++ b/pom.xml @@ -90,7 +90,7 @@ - 1.2.0 + 1.3.0 UTF-8 ${project.basedir}/.. 1.8 @@ -270,6 +270,14 @@ clean + + + remove-flattened-pom + install + + clean + + From c883f56a4e491548e090ca1a87a5d0a9c927447a Mon Sep 17 00:00:00 2001 From: imbajin Date: Wed, 13 Mar 2024 20:27:00 +0800 Subject: [PATCH 213/217] chore: disable clean flatten for deploy (#141) --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 157da40bea..198247feab 100644 --- a/pom.xml +++ b/pom.xml @@ -270,14 +270,14 @@ clean - - + + From 93c2e08780a83aa57c90c845b1f4eb1882c549e0 Mon Sep 17 00:00:00 2001 From: Zee Huang <136208225+ZeeJJ123@users.noreply.github.com> Date: Tue, 28 May 2024 15:22:43 +0800 Subject: [PATCH 214/217] Update 'How to Contribute' link and remove duplicate 'Guidelines' link in README (#143) * Update 'How to Contribute' link and remove duplicate 'Guidelines' link in README This PR makes the following changes to the README file to streamline the contribution guidelines and avoid redundancy: - Updated the 'How to Contribute' link to ensure it directs contributors to the correct resource. - Removed the 'Guidelines' link as it duplicated the information provided in 'How to Contribute'. * Update contribution link from markdown to website - Changed the contribution guide link in the README.md from the markdown file to the corresponding section on the official website. - This change ensures that the link remains stable and is not impacted by the frequent changes to Markdown files. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d7e834ecd8..4ec2ebb5bb 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ And here are links of other repositories: ## Contributing -- Welcome to contribute to HugeGraph, please see [`How to Contribute`](CONTRIBUTING.md) & [Guidelines](https://hugegraph.apache.org/docs/contribution-guidelines/) for more information. +- Welcome to contribute to HugeGraph, please see [How to Contribute](https://hugegraph.apache.org/docs/contribution-guidelines/contribute/) for more information. - Note: It's recommended to use [GitHub Desktop](https://desktop.github.com/) to greatly simplify the PR and commit process. - Thank you to all the people who already contributed to HugeGraph! From 9baef8b255bbed67714215835e6f50b245ae43f6 Mon Sep 17 00:00:00 2001 From: haohao0103 <956322745@qq.com> Date: Tue, 30 Jul 2024 17:46:59 +0800 Subject: [PATCH 215/217] fix(commons):fixed memory leaks occur in HugeGraph Server during data writing (#144) * #2578 fixed memory leaks occur in HugeGraph Server during data writing --- .../org/apache/hugegraph/event/EventHub.java | 20 +++++++- .../apache/hugegraph/util/ExecutorUtil.java | 47 ++++++++++++++++++- 2 files changed, 64 insertions(+), 3 deletions(-) diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventHub.java b/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventHub.java index 5107fba698..b37c67133b 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventHub.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventHub.java @@ -57,16 +57,23 @@ public EventHub() { } public EventHub(String name) { - this(name, 1); + this(name, 1, Runtime.getRuntime().availableProcessors() << 2); } public EventHub(String name, int threadSize) { - LOG.debug("Create new EventHub {}", name); + LOG.debug("Create new EventHub {},threadSize {}", name, threadSize); this.name = name; this.listeners = new ConcurrentHashMap<>(); EventHub.init(threadSize); } + public EventHub(String name, int corePoolSize, int maximumPoolSize) { + LOG.debug("Create new EventHub {},corePoolSize {}, maximumPoolSize {}", name, corePoolSize, maximumPoolSize); + this.name = name; + this.listeners = new ConcurrentHashMap<>(); + EventHub.init(corePoolSize, maximumPoolSize); + } + public static synchronized void init(int poolSize) { if (executor != null) { return; @@ -75,6 +82,15 @@ public static synchronized void init(int poolSize) { executor = ExecutorUtil.newFixedThreadPool(poolSize, EVENT_WORKER); } + public static synchronized void init(int corePoolSize, int maximumPoolSize) { + LOG.debug("Init corePoolSize {}, maximumPoolSize {} for EventHub", corePoolSize, maximumPoolSize); + if (executor != null) { + LOG.debug("EventHub executor already initialized"); + return; + } + executor = ExecutorUtil.newDynamicThreadExecutor(EVENT_WORKER, corePoolSize, maximumPoolSize); + } + public static synchronized boolean destroy(long timeout) throws InterruptedException { E.checkState(executor != null, "EventHub has not been initialized"); diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/ExecutorUtil.java b/hugegraph-common/src/main/java/org/apache/hugegraph/util/ExecutorUtil.java index 9f37c83285..f0ff7f1172 100644 --- a/hugegraph-common/src/main/java/org/apache/hugegraph/util/ExecutorUtil.java +++ b/hugegraph-common/src/main/java/org/apache/hugegraph/util/ExecutorUtil.java @@ -21,13 +21,58 @@ import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ThreadFactory; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.LinkedBlockingQueue; import org.apache.commons.lang3.concurrent.BasicThreadFactory; - import org.apache.hugegraph.concurrent.PausableScheduledThreadPool; + + public final class ExecutorUtil { + public static ThreadPoolExecutor newDynamicThreadExecutor(String name, + int corePoolSize, + int maximumPoolSize) { + + long keepAliveTime = 60L; + TimeUnit unit = TimeUnit.SECONDS; + ThreadFactory factory = new BasicThreadFactory.Builder() + .namingPattern(name) + .build(); + CustomBlockingQueue workQueue = new CustomBlockingQueue<>(); + ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor( + corePoolSize, + maximumPoolSize, + keepAliveTime, + unit, + workQueue, + factory, + new ThreadPoolExecutor.CallerRunsPolicy() + ); + + workQueue.setThreadPoolExecutor(threadPoolExecutor); + + return threadPoolExecutor; + } + + static class CustomBlockingQueue extends LinkedBlockingQueue { + private ThreadPoolExecutor threadPoolExecutor; + + public void setThreadPoolExecutor(ThreadPoolExecutor threadPoolExecutor) { + this.threadPoolExecutor = threadPoolExecutor; + } + + @Override + public boolean offer(E e) { + if (threadPoolExecutor.getPoolSize() < threadPoolExecutor.getMaximumPoolSize()) { + return false; + } + return super.offer(e); + } + } + public static ExecutorService newFixedThreadPool(String name) { return newFixedThreadPool(1, name); } From 162a104ebd61e613ae4d19f73505fd6a39037f31 Mon Sep 17 00:00:00 2001 From: VGalaxies Date: Sat, 3 Aug 2024 20:34:23 +0800 Subject: [PATCH 216/217] git mv to hugegraph-commons --- .asf.yaml => hugegraph-commons/.asf.yaml | 0 .editorconfig => hugegraph-commons/.editorconfig | 0 .gitattributes => hugegraph-commons/.gitattributes | 0 .../.github}/ISSUE_TEMPLATE/bug_report.yml | 0 {.github => hugegraph-commons/.github}/ISSUE_TEMPLATE/config.yml | 0 .../.github}/ISSUE_TEMPLATE/feature_request.yml | 0 .../.github}/ISSUE_TEMPLATE/question_ask.yml | 0 {.github => hugegraph-commons/.github}/outdated/.travis.yml | 0 {.github => hugegraph-commons/.github}/outdated/cla.yml | 0 {.github => hugegraph-commons/.github}/outdated/release.yml | 0 {.github => hugegraph-commons/.github}/workflows/ci.yml | 0 .../.github}/workflows/codeql-analysis.yml | 0 .../.github}/workflows/license-checker.yml | 0 {.github => hugegraph-commons/.github}/workflows/stale.yml | 0 .gitignore => hugegraph-commons/.gitignore | 0 .licenserc.yaml => hugegraph-commons/.licenserc.yaml | 0 DISCLAIMER => hugegraph-commons/DISCLAIMER | 0 LICENSE => hugegraph-commons/LICENSE | 0 NOTICE => hugegraph-commons/NOTICE | 0 README.md => hugegraph-commons/README.md | 0 .../hugegraph-common}/README.md | 0 {hugegraph-common => hugegraph-commons/hugegraph-common}/build.sh | 0 {hugegraph-common => hugegraph-commons/hugegraph-common}/pom.xml | 0 .../src/main/java/org/apache/hugegraph/concurrent/AtomicLock.java | 0 .../main/java/org/apache/hugegraph/concurrent/BarrierEvent.java | 0 .../src/main/java/org/apache/hugegraph/concurrent/KeyLock.java | 0 .../src/main/java/org/apache/hugegraph/concurrent/LockGroup.java | 0 .../main/java/org/apache/hugegraph/concurrent/LockManager.java | 0 .../apache/hugegraph/concurrent/PausableScheduledThreadPool.java | 0 .../src/main/java/org/apache/hugegraph/concurrent/RowLock.java | 0 .../main/java/org/apache/hugegraph/config/ConfigConvOption.java | 0 .../main/java/org/apache/hugegraph/config/ConfigException.java | 0 .../java/org/apache/hugegraph/config/ConfigListConvOption.java | 0 .../main/java/org/apache/hugegraph/config/ConfigListOption.java | 0 .../src/main/java/org/apache/hugegraph/config/ConfigOption.java | 0 .../src/main/java/org/apache/hugegraph/config/HugeConfig.java | 0 .../src/main/java/org/apache/hugegraph/config/OptionChecker.java | 0 .../src/main/java/org/apache/hugegraph/config/OptionHolder.java | 0 .../src/main/java/org/apache/hugegraph/config/OptionSpace.java | 0 .../src/main/java/org/apache/hugegraph/config/TypedOption.java | 0 .../src/main/java/org/apache/hugegraph/date/SafeDateFormat.java | 0 .../src/main/java/org/apache/hugegraph/event/Event.java | 0 .../src/main/java/org/apache/hugegraph/event/EventHub.java | 0 .../src/main/java/org/apache/hugegraph/event/EventListener.java | 0 .../src/main/java/org/apache/hugegraph/func/TriFunction.java | 0 .../java/org/apache/hugegraph/iterator/BatchMapperIterator.java | 0 .../src/main/java/org/apache/hugegraph/iterator/CIter.java | 0 .../java/org/apache/hugegraph/iterator/ExtendableIterator.java | 0 .../main/java/org/apache/hugegraph/iterator/FilterIterator.java | 0 .../org/apache/hugegraph/iterator/FlatMapperFilterIterator.java | 0 .../java/org/apache/hugegraph/iterator/FlatMapperIterator.java | 0 .../main/java/org/apache/hugegraph/iterator/LimitIterator.java | 0 .../src/main/java/org/apache/hugegraph/iterator/ListIterator.java | 0 .../main/java/org/apache/hugegraph/iterator/MapperIterator.java | 0 .../src/main/java/org/apache/hugegraph/iterator/Metadatable.java | 0 .../main/java/org/apache/hugegraph/iterator/WrappedIterator.java | 0 .../java/org/apache/hugegraph/license/LicenseCommonParam.java | 0 .../java/org/apache/hugegraph/license/LicenseCreateParam.java | 0 .../main/java/org/apache/hugegraph/license/LicenseExtraParam.java | 0 .../java/org/apache/hugegraph/license/LicenseInstallParam.java | 0 .../main/java/org/apache/hugegraph/license/LicenseManager.java | 0 .../java/org/apache/hugegraph/license/LicenseManagerFactory.java | 0 .../src/main/java/org/apache/hugegraph/license/LicenseParams.java | 0 .../src/main/java/org/apache/hugegraph/license/MachineInfo.java | 0 .../src/main/java/org/apache/hugegraph/perf/LightStopwatch.java | 0 .../src/main/java/org/apache/hugegraph/perf/NormalStopwatch.java | 0 .../src/main/java/org/apache/hugegraph/perf/PerfUtil.java | 0 .../src/main/java/org/apache/hugegraph/perf/Stopwatch.java | 0 .../main/java/org/apache/hugegraph/rest/AbstractRestClient.java | 0 .../src/main/java/org/apache/hugegraph/rest/ClientException.java | 0 .../org/apache/hugegraph/rest/OkHttpBasicAuthInterceptor.java | 0 .../java/org/apache/hugegraph/rest/OkHttpTokenInterceptor.java | 0 .../src/main/java/org/apache/hugegraph/rest/RestClient.java | 0 .../src/main/java/org/apache/hugegraph/rest/RestClientConfig.java | 0 .../src/main/java/org/apache/hugegraph/rest/RestHeaders.java | 0 .../src/main/java/org/apache/hugegraph/rest/RestResult.java | 0 .../main/java/org/apache/hugegraph/rest/SerializeException.java | 0 .../src/main/java/org/apache/hugegraph/testutil/Assert.java | 0 .../src/main/java/org/apache/hugegraph/testutil/Whitebox.java | 0 .../src/main/java/org/apache/hugegraph/util/Bytes.java | 0 .../src/main/java/org/apache/hugegraph/util/CheckSocket.java | 0 .../src/main/java/org/apache/hugegraph/util/CollectionUtil.java | 0 .../src/main/java/org/apache/hugegraph/util/DateUtil.java | 0 .../src/main/java/org/apache/hugegraph/util/E.java | 0 .../src/main/java/org/apache/hugegraph/util/ExceptionUtil.java | 0 .../src/main/java/org/apache/hugegraph/util/ExecutorUtil.java | 0 .../src/main/java/org/apache/hugegraph/util/HashUtil.java | 0 .../main/java/org/apache/hugegraph/util/InsertionOrderUtil.java | 0 .../src/main/java/org/apache/hugegraph/util/JsonUtilCommon.java | 0 .../src/main/java/org/apache/hugegraph/util/Log.java | 0 .../src/main/java/org/apache/hugegraph/util/LongEncoding.java | 0 .../src/main/java/org/apache/hugegraph/util/NumericUtil.java | 0 .../src/main/java/org/apache/hugegraph/util/OrderLimitMap.java | 0 .../src/main/java/org/apache/hugegraph/util/ReflectionUtil.java | 0 .../src/main/java/org/apache/hugegraph/util/StringUtil.java | 0 .../src/main/java/org/apache/hugegraph/util/TimeUtil.java | 0 .../src/main/java/org/apache/hugegraph/util/UnitUtil.java | 0 .../src/main/java/org/apache/hugegraph/util/VersionUtil.java | 0 .../src/main/java/org/apache/hugegraph/version/CommonVersion.java | 0 .../src/test/java/org/apache/hugegraph/testutil/AssertTest.java | 0 .../src/test/java/org/apache/hugegraph/testutil/WhiteboxTest.java | 0 .../src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java | 0 .../src/test/java/org/apache/hugegraph/unit/UnitTestSuite.java | 0 .../java/org/apache/hugegraph/unit/concurrent/AtomicLockTest.java | 0 .../org/apache/hugegraph/unit/concurrent/BarrierEventTest.java | 0 .../java/org/apache/hugegraph/unit/concurrent/KeyLockTest.java | 0 .../java/org/apache/hugegraph/unit/concurrent/LockGroupTest.java | 0 .../org/apache/hugegraph/unit/concurrent/LockManagerTest.java | 0 .../unit/concurrent/PausableScheduledThreadPoolTest.java | 0 .../java/org/apache/hugegraph/unit/concurrent/RowLockTest.java | 0 .../java/org/apache/hugegraph/unit/config/HugeConfigTest.java | 0 .../java/org/apache/hugegraph/unit/config/OptionSpaceTest.java | 0 .../java/org/apache/hugegraph/unit/config/test-check-error.conf | 0 .../java/org/apache/hugegraph/unit/config/test-list-error.conf | 0 .../java/org/apache/hugegraph/unit/config/test-type-error.conf | 0 .../src/test/java/org/apache/hugegraph/unit/config/test.conf | 0 .../java/org/apache/hugegraph/unit/date/SafeDateFormatTest.java | 0 .../test/java/org/apache/hugegraph/unit/event/EventHubTest.java | 0 .../apache/hugegraph/unit/iterator/BatchMapperIteratorTest.java | 0 .../apache/hugegraph/unit/iterator/ExtendableIteratorTest.java | 0 .../org/apache/hugegraph/unit/iterator/FilterIteratorTest.java | 0 .../hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java | 0 .../apache/hugegraph/unit/iterator/FlatMapperIteratorTest.java | 0 .../org/apache/hugegraph/unit/iterator/LimitIteratorTest.java | 0 .../java/org/apache/hugegraph/unit/iterator/ListIteratorTest.java | 0 .../org/apache/hugegraph/unit/iterator/MapperIteratorTest.java | 0 .../org/apache/hugegraph/unit/license/LicenseCreateParamTest.java | 0 .../org/apache/hugegraph/unit/license/LicenseExtraParamTest.java | 0 .../apache/hugegraph/unit/license/LicenseInstallParamTest.java | 0 .../java/org/apache/hugegraph/unit/license/LicenseParamsTest.java | 0 .../java/org/apache/hugegraph/unit/license/MachineInfoTest.java | 0 .../test/java/org/apache/hugegraph/unit/perf/PerfUtilTest.java | 0 .../test/java/org/apache/hugegraph/unit/perf/StopwatchTest.java | 0 .../java/org/apache/hugegraph/unit/perf/testclass/TestClass.java | 0 .../org/apache/hugegraph/unit/perf/testclass/TestLightClass.java | 0 .../org/apache/hugegraph/unit/perf/testclass/TestPerfClass.java | 0 .../apache/hugegraph/unit/perf/testclass/TestPerfLightClass.java | 0 .../apache/hugegraph/unit/perf/testclass2/TestClass4Package.java | 0 .../test/java/org/apache/hugegraph/unit/rest/RestClientTest.java | 0 .../test/java/org/apache/hugegraph/unit/rest/RestResultTest.java | 0 .../src/test/java/org/apache/hugegraph/unit/util/BytesTest.java | 0 .../java/org/apache/hugegraph/unit/util/CollectionUtilTest.java | 0 .../test/java/org/apache/hugegraph/unit/util/DateUtilTest.java | 0 .../src/test/java/org/apache/hugegraph/unit/util/EcheckTest.java | 0 .../test/java/org/apache/hugegraph/unit/util/HashUtilTest.java | 0 .../org/apache/hugegraph/unit/util/InsertionOrderUtilTest.java | 0 .../src/test/java/org/apache/hugegraph/unit/util/LogTest.java | 0 .../java/org/apache/hugegraph/unit/util/LongEncodingTest.java | 0 .../test/java/org/apache/hugegraph/unit/util/NumericUtilTest.java | 0 .../java/org/apache/hugegraph/unit/util/OrderLimitMapTest.java | 0 .../java/org/apache/hugegraph/unit/util/ReflectionUtilTest.java | 0 .../test/java/org/apache/hugegraph/unit/util/StringUtilTest.java | 0 .../test/java/org/apache/hugegraph/unit/util/TimeUtilTest.java | 0 .../test/java/org/apache/hugegraph/unit/util/UnitUtilTest.java | 0 .../test/java/org/apache/hugegraph/unit/util/VersionUtilTest.java | 0 .../test/java/org/apache/hugegraph/unit/version/VersionTest.java | 0 .../hugegraph-common}/src/test/resources/META-INF/MANIFEST.MF | 0 .../hugegraph-common}/src/test/resources/create-license.json | 0 .../hugegraph-common}/src/test/resources/log4j2.xml | 0 .../resources/mockito-extensions/org.mockito.plugins.MockMaker | 0 .../hugegraph-common}/src/test/resources/verify-license.json | 0 .../hugegraph-dist}/release-docs/LICENSE | 0 .../hugegraph-dist}/release-docs/NOTICE | 0 .../release-docs/licenses/LICENSE-JavaHamcrest.txt | 0 .../release-docs/licenses/LICENSE-animal-sniffer.txt | 0 .../release-docs/licenses/LICENSE-aopalliance-repackaged.txt | 0 .../release-docs/licenses/LICENSE-api-client-staging.txt | 0 .../release-docs/licenses/LICENSE-checker-qual.txt | 0 .../release-docs/licenses/LICENSE-commons-beanutils.txt | 0 .../release-docs/licenses/LICENSE-commons-codec.txt | 0 .../release-docs/licenses/LICENSE-commons-collections.txt | 0 .../release-docs/licenses/LICENSE-commons-configuration.txt | 0 .../release-docs/licenses/LICENSE-commons-configuration2.txt | 0 .../hugegraph-dist}/release-docs/licenses/LICENSE-commons-io.txt | 0 .../release-docs/licenses/LICENSE-commons-lang.txt | 0 .../release-docs/licenses/LICENSE-commons-lang3.txt | 0 .../release-docs/licenses/LICENSE-commons-logging.txt | 0 .../release-docs/licenses/LICENSE-commons-text.txt | 0 .../release-docs/licenses/LICENSE-failureaccess.txt | 0 .../release-docs/licenses/LICENSE-glassfish-hk2.txt | 0 .../hugegraph-dist}/release-docs/licenses/LICENSE-grpc-java.txt | 0 .../hugegraph-dist}/release-docs/licenses/LICENSE-gson.txt | 0 .../hugegraph-dist}/release-docs/licenses/LICENSE-httpclient.txt | 0 .../hugegraph-dist}/release-docs/licenses/LICENSE-httpcore.txt | 0 .../hugegraph-dist}/release-docs/licenses/LICENSE-j2objc.txt | 0 .../release-docs/licenses/LICENSE-jackson-annotations-2.14.0.txt | 0 .../release-docs/licenses/LICENSE-jackson-annotations.txt | 0 .../release-docs/licenses/LICENSE-jackson-core-2.14.0.txt | 0 .../release-docs/licenses/LICENSE-jackson-core.txt | 0 .../release-docs/licenses/LICENSE-jackson-databind-2.14.0.txt | 0 .../release-docs/licenses/LICENSE-jackson-databind.txt | 0 .../release-docs/licenses/LICENSE-jackson-dataformat-yaml.txt | 0 .../release-docs/licenses/LICENSE-jackson-jaxrs-base-2.14.0.txt | 0 .../release-docs/licenses/LICENSE-jackson-jaxrs-base.txt | 0 .../licenses/LICENSE-jackson-jaxrs-json-provider-2.14.0.txt | 0 .../release-docs/licenses/LICENSE-jackson-jaxrs-json-provider.txt | 0 .../licenses/LICENSE-jackson-module-jaxb-annotations-2.14.0.txt | 0 .../licenses/LICENSE-jackson-module-jaxb-annotations.txt | 0 .../hugegraph-dist}/release-docs/licenses/LICENSE-jaf-api.txt | 0 .../release-docs/licenses/LICENSE-jakarta.activation-api.txt | 0 .../release-docs/licenses/LICENSE-jakarta.activation.txt | 0 .../hugegraph-dist}/release-docs/licenses/LICENSE-javassist.txt | 0 .../licenses/LICENSE-javax.activation-api-1.2.0-sources.txt | 0 .../hugegraph-dist}/release-docs/licenses/LICENSE-jaxb-ri.txt | 0 .../hugegraph-dist}/release-docs/licenses/LICENSE-joda-time.txt | 0 .../hugegraph-dist}/release-docs/licenses/LICENSE-jsonp.txt | 0 .../hugegraph-dist}/release-docs/licenses/LICENSE-junit5.txt | 0 .../hugegraph-dist}/release-docs/licenses/LICENSE-log4j-api.txt | 0 .../hugegraph-dist}/release-docs/licenses/LICENSE-log4j-core.txt | 0 .../release-docs/licenses/LICENSE-log4j-slf4j-impl.txt | 0 .../hugegraph-dist}/release-docs/licenses/LICENSE-netty.txt | 0 .../hugegraph-dist}/release-docs/licenses/LICENSE-okhttp.txt | 0 .../release-docs/licenses/LICENSE-opentracing-java.txt | 0 .../hugegraph-dist}/release-docs/licenses/LICENSE-perfmark.txt | 0 .../hugegraph-dist}/release-docs/licenses/LICENSE-protobuf.txt | 0 .../hugegraph-dist}/release-docs/licenses/LICENSE-slf4j.txt | 0 .../hugegraph-dist}/release-docs/licenses/LICENSE-sofa-bolt.txt | 0 .../hugegraph-dist}/release-docs/licenses/LICENSE-sofa-boot.txt | 0 .../release-docs/licenses/LICENSE-sofa-common-tools.txt | 0 .../release-docs/licenses/LICENSE-sofa-hessian.txt | 0 .../release-docs/licenses/LICENSE-sofa-lookout.txt | 0 .../hugegraph-dist}/release-docs/licenses/LICENSE-sofa-rpc.txt | 0 .../release-docs/licenses/LICENSE-swagger-annotations.txt | 0 .../release-docs/licenses/LICENSE-swagger-core.txt | 0 .../release-docs/licenses/LICENSE-swagger-models.txt | 0 .../hugegraph-dist}/scripts/apache-release.sh | 0 .../hugegraph-dist}/scripts/dependency/check_dependencies.sh | 0 .../hugegraph-dist}/scripts/dependency/known-dependencies.txt | 0 .../scripts/dependency/regenerate_known_dependencies.sh | 0 {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/README.md | 0 {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/pom.xml | 0 .../src/main/java/org/apache/hugegraph/config/RpcOptions.java | 0 .../src/main/java/org/apache/hugegraph/rpc/RpcClientProvider.java | 0 .../src/main/java/org/apache/hugegraph/rpc/RpcCommonConfig.java | 0 .../src/main/java/org/apache/hugegraph/rpc/RpcConsumerConfig.java | 0 .../src/main/java/org/apache/hugegraph/rpc/RpcException.java | 0 .../src/main/java/org/apache/hugegraph/rpc/RpcProviderConfig.java | 0 .../src/main/java/org/apache/hugegraph/rpc/RpcServer.java | 0 .../java/org/apache/hugegraph/rpc/RpcServiceConfig4Client.java | 0 .../java/org/apache/hugegraph/rpc/RpcServiceConfig4Server.java | 0 .../src/main/java/org/apache/hugegraph/version/RpcVersion.java | 0 .../src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java | 0 .../src/test/java/org/apache/hugegraph/unit/ExceptionTest.java | 0 .../src/test/java/org/apache/hugegraph/unit/ServerClientTest.java | 0 .../src/test/java/org/apache/hugegraph/unit/UnitTestSuite.java | 0 .../src/test/java/org/apache/hugegraph/unit/VersionTest.java | 0 .../hugegraph-rpc}/src/test/resources/log4j2.xml | 0 .../hugegraph-rpc}/src/test/resources/rpc-client-lb.properties | 0 .../hugegraph-rpc}/src/test/resources/rpc-client.properties | 0 .../hugegraph-rpc}/src/test/resources/rpc-client345.properties | 0 .../hugegraph-rpc}/src/test/resources/rpc-client346.properties | 0 .../hugegraph-rpc}/src/test/resources/rpc-client67.properties | 0 .../src/test/resources/rpc-server-adaptive.properties | 0 .../src/test/resources/rpc-server-random.properties | 0 .../hugegraph-rpc}/src/test/resources/rpc-server.properties | 0 .../src/test/resources/rpc-server1-client.properties | 0 .../src/test/resources/rpc-server2-client.properties | 0 .../hugegraph-rpc}/src/test/resources/rpc-server3.properties | 0 .../hugegraph-rpc}/src/test/resources/rpc-server4.properties | 0 .../hugegraph-rpc}/src/test/resources/rpc-server5.properties | 0 pom.xml => hugegraph-commons/pom.xml | 0 {style => hugegraph-commons/style}/checkstyle.xml | 0 262 files changed, 0 insertions(+), 0 deletions(-) rename .asf.yaml => hugegraph-commons/.asf.yaml (100%) rename .editorconfig => hugegraph-commons/.editorconfig (100%) rename .gitattributes => hugegraph-commons/.gitattributes (100%) rename {.github => hugegraph-commons/.github}/ISSUE_TEMPLATE/bug_report.yml (100%) rename {.github => hugegraph-commons/.github}/ISSUE_TEMPLATE/config.yml (100%) rename {.github => hugegraph-commons/.github}/ISSUE_TEMPLATE/feature_request.yml (100%) rename {.github => hugegraph-commons/.github}/ISSUE_TEMPLATE/question_ask.yml (100%) rename {.github => hugegraph-commons/.github}/outdated/.travis.yml (100%) rename {.github => hugegraph-commons/.github}/outdated/cla.yml (100%) rename {.github => hugegraph-commons/.github}/outdated/release.yml (100%) rename {.github => hugegraph-commons/.github}/workflows/ci.yml (100%) rename {.github => hugegraph-commons/.github}/workflows/codeql-analysis.yml (100%) rename {.github => hugegraph-commons/.github}/workflows/license-checker.yml (100%) rename {.github => hugegraph-commons/.github}/workflows/stale.yml (100%) rename .gitignore => hugegraph-commons/.gitignore (100%) rename .licenserc.yaml => hugegraph-commons/.licenserc.yaml (100%) rename DISCLAIMER => hugegraph-commons/DISCLAIMER (100%) rename LICENSE => hugegraph-commons/LICENSE (100%) rename NOTICE => hugegraph-commons/NOTICE (100%) rename README.md => hugegraph-commons/README.md (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/README.md (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/build.sh (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/pom.xml (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/concurrent/AtomicLock.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/concurrent/BarrierEvent.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/concurrent/KeyLock.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/concurrent/LockGroup.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/concurrent/LockManager.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/concurrent/PausableScheduledThreadPool.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/concurrent/RowLock.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/config/ConfigConvOption.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/config/ConfigException.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/config/ConfigListConvOption.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/config/ConfigListOption.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/config/ConfigOption.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/config/HugeConfig.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/config/OptionChecker.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/config/OptionHolder.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/config/OptionSpace.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/config/TypedOption.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/date/SafeDateFormat.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/event/Event.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/event/EventHub.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/event/EventListener.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/func/TriFunction.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/iterator/BatchMapperIterator.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/iterator/CIter.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/iterator/ExtendableIterator.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/iterator/FilterIterator.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/iterator/FlatMapperFilterIterator.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/iterator/FlatMapperIterator.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/iterator/LimitIterator.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/iterator/ListIterator.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/iterator/MapperIterator.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/iterator/Metadatable.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/iterator/WrappedIterator.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/license/LicenseCommonParam.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/license/LicenseCreateParam.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/license/LicenseExtraParam.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/license/LicenseInstallParam.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/license/LicenseManager.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/license/LicenseManagerFactory.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/license/LicenseParams.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/license/MachineInfo.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/perf/LightStopwatch.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/perf/NormalStopwatch.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/perf/PerfUtil.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/perf/Stopwatch.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/rest/ClientException.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/rest/OkHttpBasicAuthInterceptor.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/rest/OkHttpTokenInterceptor.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/rest/RestClient.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/rest/RestClientConfig.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/rest/RestHeaders.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/rest/RestResult.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/rest/SerializeException.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/testutil/Assert.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/testutil/Whitebox.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/util/Bytes.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/util/CheckSocket.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/util/CollectionUtil.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/util/DateUtil.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/util/E.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/util/ExceptionUtil.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/util/ExecutorUtil.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/util/HashUtil.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/util/InsertionOrderUtil.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/util/JsonUtilCommon.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/util/Log.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/util/LongEncoding.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/util/NumericUtil.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/util/OrderLimitMap.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/util/ReflectionUtil.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/util/StringUtil.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/util/TimeUtil.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/util/UnitUtil.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/util/VersionUtil.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/main/java/org/apache/hugegraph/version/CommonVersion.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/testutil/AssertTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/testutil/WhiteboxTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/UnitTestSuite.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/concurrent/AtomicLockTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/concurrent/BarrierEventTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/concurrent/KeyLockTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/concurrent/LockGroupTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/concurrent/LockManagerTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/concurrent/RowLockTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/config/HugeConfigTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/config/OptionSpaceTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/config/test-check-error.conf (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/config/test-list-error.conf (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/config/test-type-error.conf (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/config/test.conf (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/date/SafeDateFormatTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/event/EventHubTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/iterator/BatchMapperIteratorTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/iterator/ExtendableIteratorTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/iterator/FilterIteratorTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperIteratorTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/iterator/LimitIteratorTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/iterator/ListIteratorTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/iterator/MapperIteratorTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/license/LicenseCreateParamTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/license/LicenseExtraParamTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/license/LicenseInstallParamTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/license/LicenseParamsTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/license/MachineInfoTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/perf/PerfUtilTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/perf/StopwatchTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestClass.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestLightClass.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestPerfClass.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestPerfLightClass.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/perf/testclass2/TestClass4Package.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/rest/RestClientTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/rest/RestResultTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/util/BytesTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/util/CollectionUtilTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/util/DateUtilTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/util/EcheckTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/util/HashUtilTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/util/InsertionOrderUtilTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/util/LogTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/util/LongEncodingTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/util/NumericUtilTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/util/OrderLimitMapTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/util/ReflectionUtilTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/util/StringUtilTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/util/TimeUtilTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/util/UnitUtilTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/util/VersionUtilTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/java/org/apache/hugegraph/unit/version/VersionTest.java (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/resources/META-INF/MANIFEST.MF (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/resources/create-license.json (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/resources/log4j2.xml (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker (100%) rename {hugegraph-common => hugegraph-commons/hugegraph-common}/src/test/resources/verify-license.json (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/LICENSE (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/NOTICE (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-JavaHamcrest.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-animal-sniffer.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-aopalliance-repackaged.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-api-client-staging.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-checker-qual.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-commons-beanutils.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-commons-codec.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-commons-collections.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-commons-configuration.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-commons-configuration2.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-commons-io.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-commons-lang.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-commons-lang3.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-commons-logging.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-commons-text.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-failureaccess.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-glassfish-hk2.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-grpc-java.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-gson.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-httpclient.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-httpcore.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-j2objc.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-jackson-annotations-2.14.0.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-jackson-annotations.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-jackson-core-2.14.0.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-jackson-core.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-jackson-databind-2.14.0.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-jackson-databind.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-jackson-dataformat-yaml.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-jackson-jaxrs-base-2.14.0.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-jackson-jaxrs-base.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider-2.14.0.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-jackson-module-jaxb-annotations-2.14.0.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-jackson-module-jaxb-annotations.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-jaf-api.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-jakarta.activation-api.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-jakarta.activation.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-javassist.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-javax.activation-api-1.2.0-sources.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-jaxb-ri.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-joda-time.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-jsonp.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-junit5.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-log4j-api.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-log4j-core.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-log4j-slf4j-impl.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-netty.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-okhttp.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-opentracing-java.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-perfmark.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-protobuf.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-slf4j.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-sofa-bolt.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-sofa-boot.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-sofa-common-tools.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-sofa-hessian.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-sofa-lookout.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-sofa-rpc.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-swagger-annotations.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-swagger-core.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/release-docs/licenses/LICENSE-swagger-models.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/scripts/apache-release.sh (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/scripts/dependency/check_dependencies.sh (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/scripts/dependency/known-dependencies.txt (100%) rename {hugegraph-dist => hugegraph-commons/hugegraph-dist}/scripts/dependency/regenerate_known_dependencies.sh (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/README.md (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/pom.xml (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/main/java/org/apache/hugegraph/config/RpcOptions.java (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/main/java/org/apache/hugegraph/rpc/RpcClientProvider.java (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/main/java/org/apache/hugegraph/rpc/RpcCommonConfig.java (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/main/java/org/apache/hugegraph/rpc/RpcConsumerConfig.java (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/main/java/org/apache/hugegraph/rpc/RpcException.java (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/main/java/org/apache/hugegraph/rpc/RpcProviderConfig.java (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/main/java/org/apache/hugegraph/rpc/RpcServer.java (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Client.java (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Server.java (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/main/java/org/apache/hugegraph/version/RpcVersion.java (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/test/java/org/apache/hugegraph/unit/ExceptionTest.java (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/test/java/org/apache/hugegraph/unit/ServerClientTest.java (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/test/java/org/apache/hugegraph/unit/UnitTestSuite.java (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/test/java/org/apache/hugegraph/unit/VersionTest.java (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/test/resources/log4j2.xml (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/test/resources/rpc-client-lb.properties (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/test/resources/rpc-client.properties (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/test/resources/rpc-client345.properties (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/test/resources/rpc-client346.properties (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/test/resources/rpc-client67.properties (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/test/resources/rpc-server-adaptive.properties (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/test/resources/rpc-server-random.properties (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/test/resources/rpc-server.properties (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/test/resources/rpc-server1-client.properties (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/test/resources/rpc-server2-client.properties (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/test/resources/rpc-server3.properties (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/test/resources/rpc-server4.properties (100%) rename {hugegraph-rpc => hugegraph-commons/hugegraph-rpc}/src/test/resources/rpc-server5.properties (100%) rename pom.xml => hugegraph-commons/pom.xml (100%) rename {style => hugegraph-commons/style}/checkstyle.xml (100%) diff --git a/.asf.yaml b/hugegraph-commons/.asf.yaml similarity index 100% rename from .asf.yaml rename to hugegraph-commons/.asf.yaml diff --git a/.editorconfig b/hugegraph-commons/.editorconfig similarity index 100% rename from .editorconfig rename to hugegraph-commons/.editorconfig diff --git a/.gitattributes b/hugegraph-commons/.gitattributes similarity index 100% rename from .gitattributes rename to hugegraph-commons/.gitattributes diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/hugegraph-commons/.github/ISSUE_TEMPLATE/bug_report.yml similarity index 100% rename from .github/ISSUE_TEMPLATE/bug_report.yml rename to hugegraph-commons/.github/ISSUE_TEMPLATE/bug_report.yml diff --git a/.github/ISSUE_TEMPLATE/config.yml b/hugegraph-commons/.github/ISSUE_TEMPLATE/config.yml similarity index 100% rename from .github/ISSUE_TEMPLATE/config.yml rename to hugegraph-commons/.github/ISSUE_TEMPLATE/config.yml diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/hugegraph-commons/.github/ISSUE_TEMPLATE/feature_request.yml similarity index 100% rename from .github/ISSUE_TEMPLATE/feature_request.yml rename to hugegraph-commons/.github/ISSUE_TEMPLATE/feature_request.yml diff --git a/.github/ISSUE_TEMPLATE/question_ask.yml b/hugegraph-commons/.github/ISSUE_TEMPLATE/question_ask.yml similarity index 100% rename from .github/ISSUE_TEMPLATE/question_ask.yml rename to hugegraph-commons/.github/ISSUE_TEMPLATE/question_ask.yml diff --git a/.github/outdated/.travis.yml b/hugegraph-commons/.github/outdated/.travis.yml similarity index 100% rename from .github/outdated/.travis.yml rename to hugegraph-commons/.github/outdated/.travis.yml diff --git a/.github/outdated/cla.yml b/hugegraph-commons/.github/outdated/cla.yml similarity index 100% rename from .github/outdated/cla.yml rename to hugegraph-commons/.github/outdated/cla.yml diff --git a/.github/outdated/release.yml b/hugegraph-commons/.github/outdated/release.yml similarity index 100% rename from .github/outdated/release.yml rename to hugegraph-commons/.github/outdated/release.yml diff --git a/.github/workflows/ci.yml b/hugegraph-commons/.github/workflows/ci.yml similarity index 100% rename from .github/workflows/ci.yml rename to hugegraph-commons/.github/workflows/ci.yml diff --git a/.github/workflows/codeql-analysis.yml b/hugegraph-commons/.github/workflows/codeql-analysis.yml similarity index 100% rename from .github/workflows/codeql-analysis.yml rename to hugegraph-commons/.github/workflows/codeql-analysis.yml diff --git a/.github/workflows/license-checker.yml b/hugegraph-commons/.github/workflows/license-checker.yml similarity index 100% rename from .github/workflows/license-checker.yml rename to hugegraph-commons/.github/workflows/license-checker.yml diff --git a/.github/workflows/stale.yml b/hugegraph-commons/.github/workflows/stale.yml similarity index 100% rename from .github/workflows/stale.yml rename to hugegraph-commons/.github/workflows/stale.yml diff --git a/.gitignore b/hugegraph-commons/.gitignore similarity index 100% rename from .gitignore rename to hugegraph-commons/.gitignore diff --git a/.licenserc.yaml b/hugegraph-commons/.licenserc.yaml similarity index 100% rename from .licenserc.yaml rename to hugegraph-commons/.licenserc.yaml diff --git a/DISCLAIMER b/hugegraph-commons/DISCLAIMER similarity index 100% rename from DISCLAIMER rename to hugegraph-commons/DISCLAIMER diff --git a/LICENSE b/hugegraph-commons/LICENSE similarity index 100% rename from LICENSE rename to hugegraph-commons/LICENSE diff --git a/NOTICE b/hugegraph-commons/NOTICE similarity index 100% rename from NOTICE rename to hugegraph-commons/NOTICE diff --git a/README.md b/hugegraph-commons/README.md similarity index 100% rename from README.md rename to hugegraph-commons/README.md diff --git a/hugegraph-common/README.md b/hugegraph-commons/hugegraph-common/README.md similarity index 100% rename from hugegraph-common/README.md rename to hugegraph-commons/hugegraph-common/README.md diff --git a/hugegraph-common/build.sh b/hugegraph-commons/hugegraph-common/build.sh similarity index 100% rename from hugegraph-common/build.sh rename to hugegraph-commons/hugegraph-common/build.sh diff --git a/hugegraph-common/pom.xml b/hugegraph-commons/hugegraph-common/pom.xml similarity index 100% rename from hugegraph-common/pom.xml rename to hugegraph-commons/hugegraph-common/pom.xml diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/AtomicLock.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/AtomicLock.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/AtomicLock.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/AtomicLock.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/BarrierEvent.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/BarrierEvent.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/BarrierEvent.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/BarrierEvent.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/KeyLock.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/KeyLock.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/KeyLock.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/KeyLock.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/LockGroup.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/LockGroup.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/LockGroup.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/LockGroup.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/LockManager.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/LockManager.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/LockManager.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/LockManager.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/PausableScheduledThreadPool.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/PausableScheduledThreadPool.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/PausableScheduledThreadPool.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/PausableScheduledThreadPool.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/RowLock.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/RowLock.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/RowLock.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/concurrent/RowLock.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigConvOption.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigConvOption.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigConvOption.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigConvOption.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigException.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigException.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigException.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigException.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigListConvOption.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigListConvOption.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigListConvOption.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigListConvOption.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigListOption.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigListOption.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigListOption.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigListOption.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigOption.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigOption.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigOption.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/config/ConfigOption.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/config/HugeConfig.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/config/HugeConfig.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/config/HugeConfig.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/config/HugeConfig.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionChecker.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionChecker.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionChecker.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionChecker.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionHolder.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionHolder.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionHolder.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionHolder.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionSpace.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionSpace.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionSpace.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/config/OptionSpace.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/config/TypedOption.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/config/TypedOption.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/config/TypedOption.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/config/TypedOption.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/date/SafeDateFormat.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/date/SafeDateFormat.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/date/SafeDateFormat.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/date/SafeDateFormat.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/event/Event.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/event/Event.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/event/Event.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/event/Event.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventHub.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventHub.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/event/EventHub.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventHub.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventListener.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventListener.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/event/EventListener.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventListener.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/func/TriFunction.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/func/TriFunction.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/func/TriFunction.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/func/TriFunction.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/BatchMapperIterator.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/BatchMapperIterator.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/iterator/BatchMapperIterator.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/BatchMapperIterator.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/CIter.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/CIter.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/iterator/CIter.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/CIter.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/ExtendableIterator.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/ExtendableIterator.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/iterator/ExtendableIterator.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/ExtendableIterator.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FilterIterator.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FilterIterator.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FilterIterator.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FilterIterator.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FlatMapperFilterIterator.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FlatMapperFilterIterator.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FlatMapperFilterIterator.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FlatMapperFilterIterator.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FlatMapperIterator.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FlatMapperIterator.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FlatMapperIterator.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/FlatMapperIterator.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/LimitIterator.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/LimitIterator.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/iterator/LimitIterator.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/LimitIterator.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/ListIterator.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/ListIterator.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/iterator/ListIterator.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/ListIterator.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/MapperIterator.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/MapperIterator.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/iterator/MapperIterator.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/MapperIterator.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/Metadatable.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/Metadatable.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/iterator/Metadatable.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/Metadatable.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/WrappedIterator.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/WrappedIterator.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/iterator/WrappedIterator.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/iterator/WrappedIterator.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseCommonParam.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseCommonParam.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseCommonParam.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseCommonParam.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseCreateParam.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseCreateParam.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseCreateParam.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseCreateParam.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseExtraParam.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseExtraParam.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseExtraParam.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseExtraParam.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseInstallParam.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseInstallParam.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseInstallParam.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseInstallParam.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseManager.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseManager.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseManager.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseManager.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseManagerFactory.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseManagerFactory.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseManagerFactory.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseManagerFactory.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseParams.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseParams.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseParams.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/license/LicenseParams.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/license/MachineInfo.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/license/MachineInfo.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/license/MachineInfo.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/license/MachineInfo.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/LightStopwatch.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/perf/LightStopwatch.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/perf/LightStopwatch.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/perf/LightStopwatch.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/NormalStopwatch.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/perf/NormalStopwatch.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/perf/NormalStopwatch.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/perf/NormalStopwatch.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/perf/PerfUtil.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/perf/Stopwatch.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/perf/Stopwatch.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/perf/Stopwatch.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/perf/Stopwatch.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/ClientException.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/rest/ClientException.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/rest/ClientException.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/rest/ClientException.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/OkHttpBasicAuthInterceptor.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/rest/OkHttpBasicAuthInterceptor.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/rest/OkHttpBasicAuthInterceptor.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/rest/OkHttpBasicAuthInterceptor.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/OkHttpTokenInterceptor.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/rest/OkHttpTokenInterceptor.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/rest/OkHttpTokenInterceptor.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/rest/OkHttpTokenInterceptor.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClient.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClient.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClient.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClient.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClientConfig.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClientConfig.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClientConfig.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestClientConfig.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestHeaders.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestHeaders.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestHeaders.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestHeaders.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestResult.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestResult.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestResult.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestResult.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/rest/SerializeException.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/rest/SerializeException.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/rest/SerializeException.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/rest/SerializeException.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Assert.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Assert.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Assert.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Assert.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Whitebox.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Whitebox.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Whitebox.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Whitebox.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/Bytes.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/Bytes.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/util/Bytes.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/Bytes.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/CheckSocket.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/CheckSocket.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/util/CheckSocket.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/CheckSocket.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/CollectionUtil.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/CollectionUtil.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/util/CollectionUtil.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/CollectionUtil.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/DateUtil.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/DateUtil.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/util/DateUtil.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/DateUtil.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/E.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/E.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/util/E.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/E.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/ExceptionUtil.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/ExceptionUtil.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/util/ExceptionUtil.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/ExceptionUtil.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/ExecutorUtil.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/ExecutorUtil.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/util/ExecutorUtil.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/ExecutorUtil.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/HashUtil.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/HashUtil.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/util/HashUtil.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/HashUtil.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/InsertionOrderUtil.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/InsertionOrderUtil.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/util/InsertionOrderUtil.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/InsertionOrderUtil.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/JsonUtilCommon.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/JsonUtilCommon.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/util/JsonUtilCommon.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/JsonUtilCommon.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/Log.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/Log.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/util/Log.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/Log.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/LongEncoding.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/LongEncoding.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/util/LongEncoding.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/LongEncoding.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/NumericUtil.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/NumericUtil.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/util/NumericUtil.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/NumericUtil.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/OrderLimitMap.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/OrderLimitMap.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/util/OrderLimitMap.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/OrderLimitMap.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/ReflectionUtil.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/ReflectionUtil.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/util/ReflectionUtil.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/ReflectionUtil.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/StringUtil.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/StringUtil.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/util/StringUtil.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/StringUtil.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/TimeUtil.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/TimeUtil.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/util/TimeUtil.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/TimeUtil.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/UnitUtil.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/UnitUtil.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/util/UnitUtil.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/UnitUtil.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java diff --git a/hugegraph-common/src/main/java/org/apache/hugegraph/version/CommonVersion.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/version/CommonVersion.java similarity index 100% rename from hugegraph-common/src/main/java/org/apache/hugegraph/version/CommonVersion.java rename to hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/version/CommonVersion.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/testutil/AssertTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/testutil/AssertTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/testutil/AssertTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/testutil/AssertTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/testutil/WhiteboxTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/testutil/WhiteboxTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/testutil/WhiteboxTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/testutil/WhiteboxTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/UnitTestSuite.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/UnitTestSuite.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/UnitTestSuite.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/UnitTestSuite.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/AtomicLockTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/AtomicLockTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/AtomicLockTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/AtomicLockTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/BarrierEventTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/BarrierEventTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/BarrierEventTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/BarrierEventTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/KeyLockTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/KeyLockTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/KeyLockTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/KeyLockTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/LockGroupTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/LockGroupTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/LockGroupTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/LockGroupTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/LockManagerTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/LockManagerTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/LockManagerTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/LockManagerTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/RowLockTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/RowLockTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/RowLockTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/concurrent/RowLockTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/HugeConfigTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/HugeConfigTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/HugeConfigTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/HugeConfigTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/OptionSpaceTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/OptionSpaceTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/OptionSpaceTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/OptionSpaceTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/test-check-error.conf b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/test-check-error.conf similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/test-check-error.conf rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/test-check-error.conf diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/test-list-error.conf b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/test-list-error.conf similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/test-list-error.conf rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/test-list-error.conf diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/test-type-error.conf b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/test-type-error.conf similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/test-type-error.conf rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/test-type-error.conf diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/test.conf b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/test.conf similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/test.conf rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/config/test.conf diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/date/SafeDateFormatTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/date/SafeDateFormatTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/date/SafeDateFormatTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/date/SafeDateFormatTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/event/EventHubTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/event/EventHubTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/event/EventHubTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/event/EventHubTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/BatchMapperIteratorTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/BatchMapperIteratorTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/BatchMapperIteratorTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/BatchMapperIteratorTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ExtendableIteratorTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ExtendableIteratorTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ExtendableIteratorTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ExtendableIteratorTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FilterIteratorTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FilterIteratorTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FilterIteratorTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FilterIteratorTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperIteratorTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperIteratorTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperIteratorTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/FlatMapperIteratorTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/LimitIteratorTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/LimitIteratorTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/LimitIteratorTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/LimitIteratorTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ListIteratorTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ListIteratorTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ListIteratorTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/ListIteratorTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/MapperIteratorTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/MapperIteratorTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/MapperIteratorTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/iterator/MapperIteratorTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseCreateParamTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseCreateParamTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseCreateParamTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseCreateParamTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseExtraParamTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseExtraParamTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseExtraParamTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseExtraParamTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseInstallParamTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseInstallParamTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseInstallParamTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseInstallParamTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseParamsTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseParamsTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseParamsTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/LicenseParamsTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/MachineInfoTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/MachineInfoTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/MachineInfoTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/license/MachineInfoTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/PerfUtilTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/PerfUtilTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/PerfUtilTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/PerfUtilTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/StopwatchTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/StopwatchTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/StopwatchTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/StopwatchTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestClass.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestClass.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestClass.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestClass.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestLightClass.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestLightClass.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestLightClass.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestLightClass.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestPerfClass.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestPerfClass.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestPerfClass.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestPerfClass.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestPerfLightClass.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestPerfLightClass.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestPerfLightClass.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass/TestPerfLightClass.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass2/TestClass4Package.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass2/TestClass4Package.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass2/TestClass4Package.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/testclass2/TestClass4Package.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestClientTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestClientTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestClientTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestClientTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestResultTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestResultTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestResultTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestResultTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/BytesTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/BytesTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/BytesTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/BytesTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/CollectionUtilTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/CollectionUtilTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/CollectionUtilTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/CollectionUtilTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/DateUtilTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/DateUtilTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/DateUtilTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/DateUtilTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/EcheckTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/EcheckTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/EcheckTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/EcheckTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/HashUtilTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/HashUtilTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/HashUtilTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/HashUtilTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/InsertionOrderUtilTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/InsertionOrderUtilTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/InsertionOrderUtilTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/InsertionOrderUtilTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/LogTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/LogTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/LogTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/LogTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/LongEncodingTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/LongEncodingTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/LongEncodingTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/LongEncodingTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/NumericUtilTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/NumericUtilTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/NumericUtilTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/NumericUtilTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/OrderLimitMapTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/OrderLimitMapTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/OrderLimitMapTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/OrderLimitMapTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/ReflectionUtilTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/ReflectionUtilTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/ReflectionUtilTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/ReflectionUtilTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/StringUtilTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/StringUtilTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/StringUtilTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/StringUtilTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/TimeUtilTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/TimeUtilTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/TimeUtilTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/TimeUtilTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/UnitUtilTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/UnitUtilTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/UnitUtilTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/UnitUtilTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/VersionUtilTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/VersionUtilTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/VersionUtilTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/util/VersionUtilTest.java diff --git a/hugegraph-common/src/test/java/org/apache/hugegraph/unit/version/VersionTest.java b/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/version/VersionTest.java similarity index 100% rename from hugegraph-common/src/test/java/org/apache/hugegraph/unit/version/VersionTest.java rename to hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/version/VersionTest.java diff --git a/hugegraph-common/src/test/resources/META-INF/MANIFEST.MF b/hugegraph-commons/hugegraph-common/src/test/resources/META-INF/MANIFEST.MF similarity index 100% rename from hugegraph-common/src/test/resources/META-INF/MANIFEST.MF rename to hugegraph-commons/hugegraph-common/src/test/resources/META-INF/MANIFEST.MF diff --git a/hugegraph-common/src/test/resources/create-license.json b/hugegraph-commons/hugegraph-common/src/test/resources/create-license.json similarity index 100% rename from hugegraph-common/src/test/resources/create-license.json rename to hugegraph-commons/hugegraph-common/src/test/resources/create-license.json diff --git a/hugegraph-common/src/test/resources/log4j2.xml b/hugegraph-commons/hugegraph-common/src/test/resources/log4j2.xml similarity index 100% rename from hugegraph-common/src/test/resources/log4j2.xml rename to hugegraph-commons/hugegraph-common/src/test/resources/log4j2.xml diff --git a/hugegraph-common/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/hugegraph-commons/hugegraph-common/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker similarity index 100% rename from hugegraph-common/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker rename to hugegraph-commons/hugegraph-common/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker diff --git a/hugegraph-common/src/test/resources/verify-license.json b/hugegraph-commons/hugegraph-common/src/test/resources/verify-license.json similarity index 100% rename from hugegraph-common/src/test/resources/verify-license.json rename to hugegraph-commons/hugegraph-common/src/test/resources/verify-license.json diff --git a/hugegraph-dist/release-docs/LICENSE b/hugegraph-commons/hugegraph-dist/release-docs/LICENSE similarity index 100% rename from hugegraph-dist/release-docs/LICENSE rename to hugegraph-commons/hugegraph-dist/release-docs/LICENSE diff --git a/hugegraph-dist/release-docs/NOTICE b/hugegraph-commons/hugegraph-dist/release-docs/NOTICE similarity index 100% rename from hugegraph-dist/release-docs/NOTICE rename to hugegraph-commons/hugegraph-dist/release-docs/NOTICE diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-JavaHamcrest.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-JavaHamcrest.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-JavaHamcrest.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-JavaHamcrest.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-animal-sniffer.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-animal-sniffer.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-animal-sniffer.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-animal-sniffer.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-aopalliance-repackaged.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-aopalliance-repackaged.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-aopalliance-repackaged.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-aopalliance-repackaged.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-api-client-staging.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-api-client-staging.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-api-client-staging.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-api-client-staging.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-checker-qual.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-checker-qual.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-checker-qual.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-checker-qual.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-beanutils.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-commons-beanutils.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-commons-beanutils.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-commons-beanutils.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-codec.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-commons-codec.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-commons-codec.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-commons-codec.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-collections.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-commons-collections.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-commons-collections.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-commons-collections.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-configuration.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-commons-configuration.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-commons-configuration.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-commons-configuration.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-configuration2.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-commons-configuration2.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-commons-configuration2.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-commons-configuration2.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-io.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-commons-io.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-commons-io.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-commons-io.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-lang.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-commons-lang.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-commons-lang.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-commons-lang.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-lang3.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-commons-lang3.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-commons-lang3.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-commons-lang3.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-logging.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-commons-logging.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-commons-logging.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-commons-logging.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-text.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-commons-text.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-commons-text.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-commons-text.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-failureaccess.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-failureaccess.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-failureaccess.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-failureaccess.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-glassfish-hk2.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-glassfish-hk2.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-glassfish-hk2.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-glassfish-hk2.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-grpc-java.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-grpc-java.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-grpc-java.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-grpc-java.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-gson.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-gson.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-gson.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-gson.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-httpclient.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-httpclient.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-httpclient.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-httpclient.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-httpcore.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-httpcore.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-httpcore.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-httpcore.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-j2objc.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-j2objc.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-j2objc.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-j2objc.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-annotations-2.14.0.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jackson-annotations-2.14.0.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jackson-annotations-2.14.0.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jackson-annotations-2.14.0.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-annotations.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jackson-annotations.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jackson-annotations.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jackson-annotations.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-core-2.14.0.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jackson-core-2.14.0.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jackson-core-2.14.0.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jackson-core-2.14.0.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-core.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jackson-core.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jackson-core.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jackson-core.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-databind-2.14.0.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jackson-databind-2.14.0.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jackson-databind-2.14.0.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jackson-databind-2.14.0.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-databind.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jackson-databind.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jackson-databind.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jackson-databind.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-dataformat-yaml.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jackson-dataformat-yaml.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jackson-dataformat-yaml.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jackson-dataformat-yaml.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-base-2.14.0.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-base-2.14.0.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-base-2.14.0.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-base-2.14.0.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-base.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-base.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-base.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-base.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider-2.14.0.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider-2.14.0.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider-2.14.0.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider-2.14.0.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-module-jaxb-annotations-2.14.0.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jackson-module-jaxb-annotations-2.14.0.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jackson-module-jaxb-annotations-2.14.0.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jackson-module-jaxb-annotations-2.14.0.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-module-jaxb-annotations.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jackson-module-jaxb-annotations.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jackson-module-jaxb-annotations.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jackson-module-jaxb-annotations.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jaf-api.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jaf-api.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jaf-api.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jaf-api.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jakarta.activation-api.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jakarta.activation-api.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jakarta.activation-api.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jakarta.activation-api.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jakarta.activation.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jakarta.activation.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jakarta.activation.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jakarta.activation.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-javassist.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-javassist.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-javassist.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-javassist.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-javax.activation-api-1.2.0-sources.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-javax.activation-api-1.2.0-sources.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-javax.activation-api-1.2.0-sources.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-javax.activation-api-1.2.0-sources.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jaxb-ri.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jaxb-ri.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jaxb-ri.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jaxb-ri.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-joda-time.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-joda-time.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-joda-time.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-joda-time.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jsonp.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jsonp.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jsonp.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-jsonp.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-junit5.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-junit5.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-junit5.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-junit5.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-log4j-api.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-log4j-api.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-log4j-api.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-log4j-api.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-log4j-core.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-log4j-core.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-log4j-core.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-log4j-core.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-log4j-slf4j-impl.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-log4j-slf4j-impl.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-log4j-slf4j-impl.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-log4j-slf4j-impl.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-netty.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-netty.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-netty.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-netty.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-okhttp.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-okhttp.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-okhttp.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-okhttp.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-opentracing-java.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-opentracing-java.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-opentracing-java.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-opentracing-java.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-perfmark.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-perfmark.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-perfmark.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-perfmark.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-protobuf.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-protobuf.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-protobuf.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-protobuf.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-slf4j.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-slf4j.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-slf4j.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-slf4j.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-sofa-bolt.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-sofa-bolt.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-sofa-bolt.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-sofa-bolt.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-sofa-boot.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-sofa-boot.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-sofa-boot.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-sofa-boot.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-sofa-common-tools.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-sofa-common-tools.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-sofa-common-tools.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-sofa-common-tools.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-sofa-hessian.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-sofa-hessian.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-sofa-hessian.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-sofa-hessian.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-sofa-lookout.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-sofa-lookout.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-sofa-lookout.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-sofa-lookout.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-sofa-rpc.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-sofa-rpc.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-sofa-rpc.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-sofa-rpc.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-swagger-annotations.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-swagger-annotations.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-swagger-annotations.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-swagger-annotations.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-swagger-core.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-swagger-core.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-swagger-core.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-swagger-core.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-swagger-models.txt b/hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-swagger-models.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-swagger-models.txt rename to hugegraph-commons/hugegraph-dist/release-docs/licenses/LICENSE-swagger-models.txt diff --git a/hugegraph-dist/scripts/apache-release.sh b/hugegraph-commons/hugegraph-dist/scripts/apache-release.sh similarity index 100% rename from hugegraph-dist/scripts/apache-release.sh rename to hugegraph-commons/hugegraph-dist/scripts/apache-release.sh diff --git a/hugegraph-dist/scripts/dependency/check_dependencies.sh b/hugegraph-commons/hugegraph-dist/scripts/dependency/check_dependencies.sh similarity index 100% rename from hugegraph-dist/scripts/dependency/check_dependencies.sh rename to hugegraph-commons/hugegraph-dist/scripts/dependency/check_dependencies.sh diff --git a/hugegraph-dist/scripts/dependency/known-dependencies.txt b/hugegraph-commons/hugegraph-dist/scripts/dependency/known-dependencies.txt similarity index 100% rename from hugegraph-dist/scripts/dependency/known-dependencies.txt rename to hugegraph-commons/hugegraph-dist/scripts/dependency/known-dependencies.txt diff --git a/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh b/hugegraph-commons/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh similarity index 100% rename from hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh rename to hugegraph-commons/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh diff --git a/hugegraph-rpc/README.md b/hugegraph-commons/hugegraph-rpc/README.md similarity index 100% rename from hugegraph-rpc/README.md rename to hugegraph-commons/hugegraph-rpc/README.md diff --git a/hugegraph-rpc/pom.xml b/hugegraph-commons/hugegraph-rpc/pom.xml similarity index 100% rename from hugegraph-rpc/pom.xml rename to hugegraph-commons/hugegraph-rpc/pom.xml diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/config/RpcOptions.java b/hugegraph-commons/hugegraph-rpc/src/main/java/org/apache/hugegraph/config/RpcOptions.java similarity index 100% rename from hugegraph-rpc/src/main/java/org/apache/hugegraph/config/RpcOptions.java rename to hugegraph-commons/hugegraph-rpc/src/main/java/org/apache/hugegraph/config/RpcOptions.java diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcClientProvider.java b/hugegraph-commons/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcClientProvider.java similarity index 100% rename from hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcClientProvider.java rename to hugegraph-commons/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcClientProvider.java diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcCommonConfig.java b/hugegraph-commons/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcCommonConfig.java similarity index 100% rename from hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcCommonConfig.java rename to hugegraph-commons/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcCommonConfig.java diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcConsumerConfig.java b/hugegraph-commons/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcConsumerConfig.java similarity index 100% rename from hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcConsumerConfig.java rename to hugegraph-commons/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcConsumerConfig.java diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcException.java b/hugegraph-commons/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcException.java similarity index 100% rename from hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcException.java rename to hugegraph-commons/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcException.java diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcProviderConfig.java b/hugegraph-commons/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcProviderConfig.java similarity index 100% rename from hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcProviderConfig.java rename to hugegraph-commons/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcProviderConfig.java diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServer.java b/hugegraph-commons/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServer.java similarity index 100% rename from hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServer.java rename to hugegraph-commons/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServer.java diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Client.java b/hugegraph-commons/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Client.java similarity index 100% rename from hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Client.java rename to hugegraph-commons/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Client.java diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Server.java b/hugegraph-commons/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Server.java similarity index 100% rename from hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Server.java rename to hugegraph-commons/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Server.java diff --git a/hugegraph-rpc/src/main/java/org/apache/hugegraph/version/RpcVersion.java b/hugegraph-commons/hugegraph-rpc/src/main/java/org/apache/hugegraph/version/RpcVersion.java similarity index 100% rename from hugegraph-rpc/src/main/java/org/apache/hugegraph/version/RpcVersion.java rename to hugegraph-commons/hugegraph-rpc/src/main/java/org/apache/hugegraph/version/RpcVersion.java diff --git a/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java b/hugegraph-commons/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java similarity index 100% rename from hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java rename to hugegraph-commons/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/BaseUnitTest.java diff --git a/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ExceptionTest.java b/hugegraph-commons/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ExceptionTest.java similarity index 100% rename from hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ExceptionTest.java rename to hugegraph-commons/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ExceptionTest.java diff --git a/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ServerClientTest.java b/hugegraph-commons/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ServerClientTest.java similarity index 100% rename from hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ServerClientTest.java rename to hugegraph-commons/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/ServerClientTest.java diff --git a/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/UnitTestSuite.java b/hugegraph-commons/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/UnitTestSuite.java similarity index 100% rename from hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/UnitTestSuite.java rename to hugegraph-commons/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/UnitTestSuite.java diff --git a/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/VersionTest.java b/hugegraph-commons/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/VersionTest.java similarity index 100% rename from hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/VersionTest.java rename to hugegraph-commons/hugegraph-rpc/src/test/java/org/apache/hugegraph/unit/VersionTest.java diff --git a/hugegraph-rpc/src/test/resources/log4j2.xml b/hugegraph-commons/hugegraph-rpc/src/test/resources/log4j2.xml similarity index 100% rename from hugegraph-rpc/src/test/resources/log4j2.xml rename to hugegraph-commons/hugegraph-rpc/src/test/resources/log4j2.xml diff --git a/hugegraph-rpc/src/test/resources/rpc-client-lb.properties b/hugegraph-commons/hugegraph-rpc/src/test/resources/rpc-client-lb.properties similarity index 100% rename from hugegraph-rpc/src/test/resources/rpc-client-lb.properties rename to hugegraph-commons/hugegraph-rpc/src/test/resources/rpc-client-lb.properties diff --git a/hugegraph-rpc/src/test/resources/rpc-client.properties b/hugegraph-commons/hugegraph-rpc/src/test/resources/rpc-client.properties similarity index 100% rename from hugegraph-rpc/src/test/resources/rpc-client.properties rename to hugegraph-commons/hugegraph-rpc/src/test/resources/rpc-client.properties diff --git a/hugegraph-rpc/src/test/resources/rpc-client345.properties b/hugegraph-commons/hugegraph-rpc/src/test/resources/rpc-client345.properties similarity index 100% rename from hugegraph-rpc/src/test/resources/rpc-client345.properties rename to hugegraph-commons/hugegraph-rpc/src/test/resources/rpc-client345.properties diff --git a/hugegraph-rpc/src/test/resources/rpc-client346.properties b/hugegraph-commons/hugegraph-rpc/src/test/resources/rpc-client346.properties similarity index 100% rename from hugegraph-rpc/src/test/resources/rpc-client346.properties rename to hugegraph-commons/hugegraph-rpc/src/test/resources/rpc-client346.properties diff --git a/hugegraph-rpc/src/test/resources/rpc-client67.properties b/hugegraph-commons/hugegraph-rpc/src/test/resources/rpc-client67.properties similarity index 100% rename from hugegraph-rpc/src/test/resources/rpc-client67.properties rename to hugegraph-commons/hugegraph-rpc/src/test/resources/rpc-client67.properties diff --git a/hugegraph-rpc/src/test/resources/rpc-server-adaptive.properties b/hugegraph-commons/hugegraph-rpc/src/test/resources/rpc-server-adaptive.properties similarity index 100% rename from hugegraph-rpc/src/test/resources/rpc-server-adaptive.properties rename to hugegraph-commons/hugegraph-rpc/src/test/resources/rpc-server-adaptive.properties diff --git a/hugegraph-rpc/src/test/resources/rpc-server-random.properties b/hugegraph-commons/hugegraph-rpc/src/test/resources/rpc-server-random.properties similarity index 100% rename from hugegraph-rpc/src/test/resources/rpc-server-random.properties rename to hugegraph-commons/hugegraph-rpc/src/test/resources/rpc-server-random.properties diff --git a/hugegraph-rpc/src/test/resources/rpc-server.properties b/hugegraph-commons/hugegraph-rpc/src/test/resources/rpc-server.properties similarity index 100% rename from hugegraph-rpc/src/test/resources/rpc-server.properties rename to hugegraph-commons/hugegraph-rpc/src/test/resources/rpc-server.properties diff --git a/hugegraph-rpc/src/test/resources/rpc-server1-client.properties b/hugegraph-commons/hugegraph-rpc/src/test/resources/rpc-server1-client.properties similarity index 100% rename from hugegraph-rpc/src/test/resources/rpc-server1-client.properties rename to hugegraph-commons/hugegraph-rpc/src/test/resources/rpc-server1-client.properties diff --git a/hugegraph-rpc/src/test/resources/rpc-server2-client.properties b/hugegraph-commons/hugegraph-rpc/src/test/resources/rpc-server2-client.properties similarity index 100% rename from hugegraph-rpc/src/test/resources/rpc-server2-client.properties rename to hugegraph-commons/hugegraph-rpc/src/test/resources/rpc-server2-client.properties diff --git a/hugegraph-rpc/src/test/resources/rpc-server3.properties b/hugegraph-commons/hugegraph-rpc/src/test/resources/rpc-server3.properties similarity index 100% rename from hugegraph-rpc/src/test/resources/rpc-server3.properties rename to hugegraph-commons/hugegraph-rpc/src/test/resources/rpc-server3.properties diff --git a/hugegraph-rpc/src/test/resources/rpc-server4.properties b/hugegraph-commons/hugegraph-rpc/src/test/resources/rpc-server4.properties similarity index 100% rename from hugegraph-rpc/src/test/resources/rpc-server4.properties rename to hugegraph-commons/hugegraph-rpc/src/test/resources/rpc-server4.properties diff --git a/hugegraph-rpc/src/test/resources/rpc-server5.properties b/hugegraph-commons/hugegraph-rpc/src/test/resources/rpc-server5.properties similarity index 100% rename from hugegraph-rpc/src/test/resources/rpc-server5.properties rename to hugegraph-commons/hugegraph-rpc/src/test/resources/rpc-server5.properties diff --git a/pom.xml b/hugegraph-commons/pom.xml similarity index 100% rename from pom.xml rename to hugegraph-commons/pom.xml diff --git a/style/checkstyle.xml b/hugegraph-commons/style/checkstyle.xml similarity index 100% rename from style/checkstyle.xml rename to hugegraph-commons/style/checkstyle.xml From 2fb950086358c9434c8e1f7705fa80ca1124deac Mon Sep 17 00:00:00 2001 From: VGalaxies Date: Sat, 3 Aug 2024 22:06:36 +0800 Subject: [PATCH 217/217] chore(commons): basic adapt for commons migration --- .asf.yaml | 3 +- .gitattributes | 8 +- .github/workflows/check-dependencies.yml | 2 +- .../workflows/commons-ci.yml | 23 +- .github/workflows/pd-store-ci.yml | 24 +- .github/workflows/server-ci.yml | 2 +- .gitignore | 2 +- BUILDING.md | 2 +- hugegraph-commons/.asf.yaml | 54 ---- hugegraph-commons/.editorconfig | 31 --- hugegraph-commons/.gitattributes | 8 - .../.github/ISSUE_TEMPLATE/bug_report.yml | 96 ------- .../.github/ISSUE_TEMPLATE/config.yml | 7 - .../ISSUE_TEMPLATE/feature_request.yml | 15 -- .../.github/ISSUE_TEMPLATE/question_ask.yml | 94 ------- .../.github/outdated/.travis.yml | 11 - hugegraph-commons/.github/outdated/cla.yml | 35 --- .../.github/outdated/release.yml | 39 --- .../.github/workflows/codeql-analysis.yml | 66 ----- .../.github/workflows/license-checker.yml | 60 ----- hugegraph-commons/.github/workflows/stale.yml | 38 --- hugegraph-commons/.gitignore | 84 ------- hugegraph-commons/.licenserc.yaml | 79 ------ hugegraph-commons/DISCLAIMER | 7 - hugegraph-commons/LICENSE | 202 --------------- hugegraph-commons/NOTICE | 7 - .../hugegraph/version/CommonVersion.java | 2 +- .../src/test/resources/META-INF/MANIFEST.MF | 18 +- .../apache/hugegraph/version/RpcVersion.java | 2 +- hugegraph-commons/pom.xml | 20 +- hugegraph-commons/style/checkstyle.xml | 234 ------------------ hugegraph-pd/Dockerfile | 4 +- hugegraph-pd/hg-pd-dist/pom.xml | 1 - hugegraph-pd/pom.xml | 2 +- hugegraph-server/Dockerfile | 2 +- hugegraph-server/hugegraph-dist/pom.xml | 80 +++--- .../src/assembly/descriptor/assembly.xml | 11 - .../assembly/static/bin/hugegraph-server.sh | 9 +- .../assembly/static/bin/start-hugegraph.sh | 5 + .../assembly/travis/run-api-test-for-raft.sh | 6 +- .../src/assembly/travis/run-api-test.sh | 6 +- .../src/assembly/travis/run-core-test.sh | 2 +- .../src/assembly/travis/run-tinkerpop-test.sh | 4 +- .../src/assembly/travis/run-unit-test.sh | 2 +- .../src/assembly/travis/start-pd.sh | 2 +- .../src/assembly/travis/start-store.sh | 2 +- hugegraph-server/pom.xml | 3 +- hugegraph-store/Dockerfile | 4 +- hugegraph-store/hg-store-dist/pom.xml | 1 - .../assembly/descriptor/server-assembly.xml | 3 + .../static/bin/start-hugegraph-store.sh | 38 ++- .../src/assembly/static/bin/util.sh | 30 +++ hugegraph-store/pom.xml | 2 +- install-dist/pom.xml | 62 +++++ install-dist/scripts/apache-release.sh | 4 +- .../scripts/dependency/known-dependencies.txt | 16 ++ pom.xml | 5 +- 57 files changed, 274 insertions(+), 1307 deletions(-) rename hugegraph-commons/.github/workflows/ci.yml => .github/workflows/commons-ci.yml (62%) delete mode 100644 hugegraph-commons/.asf.yaml delete mode 100644 hugegraph-commons/.editorconfig delete mode 100644 hugegraph-commons/.gitattributes delete mode 100644 hugegraph-commons/.github/ISSUE_TEMPLATE/bug_report.yml delete mode 100644 hugegraph-commons/.github/ISSUE_TEMPLATE/config.yml delete mode 100644 hugegraph-commons/.github/ISSUE_TEMPLATE/feature_request.yml delete mode 100644 hugegraph-commons/.github/ISSUE_TEMPLATE/question_ask.yml delete mode 100644 hugegraph-commons/.github/outdated/.travis.yml delete mode 100644 hugegraph-commons/.github/outdated/cla.yml delete mode 100644 hugegraph-commons/.github/outdated/release.yml delete mode 100644 hugegraph-commons/.github/workflows/codeql-analysis.yml delete mode 100644 hugegraph-commons/.github/workflows/license-checker.yml delete mode 100644 hugegraph-commons/.github/workflows/stale.yml delete mode 100644 hugegraph-commons/.gitignore delete mode 100644 hugegraph-commons/.licenserc.yaml delete mode 100644 hugegraph-commons/DISCLAIMER delete mode 100644 hugegraph-commons/LICENSE delete mode 100644 hugegraph-commons/NOTICE delete mode 100644 hugegraph-commons/style/checkstyle.xml diff --git a/.asf.yaml b/.asf.yaml index 6c78530425..7729f8aa1d 100644 --- a/.asf.yaml +++ b/.asf.yaml @@ -41,7 +41,8 @@ github: - Analyze (java) - CodeQL - check-license - - build (memory, 11) + - build (memory, 11) # Server CI + - build (11) # Commons CI required_pull_request_reviews: dismiss_stale_reviews: true require_code_owner_reviews: false diff --git a/.gitattributes b/.gitattributes index 636f55aa01..85f64d198b 100755 --- a/.gitattributes +++ b/.gitattributes @@ -5,8 +5,12 @@ apache-release.sh export-ignore .licenserc.yaml export-ignore .editorconfig export-ignore +hugegraph-store/hg-store-dist/src/assembly/static/bin/libjemalloc.so export-ignore +hugegraph-store/hg-store-dist/src/assembly/static/bin/libjemalloc_aarch64.so export-ignore # ignored directory .github/ export-ignore -hugegraph-dist/scripts/ export-ignore -#assembly/ export-ignore +.idea/ export-ignore +install-dist/scripts/ export-ignore +hugegraph-commons/hugegraph-dist/ export-ignore +docker/ export-ignore diff --git a/.github/workflows/check-dependencies.yml b/.github/workflows/check-dependencies.yml index 6e3c572889..68f8c0e0c9 100644 --- a/.github/workflows/check-dependencies.yml +++ b/.github/workflows/check-dependencies.yml @@ -32,7 +32,7 @@ jobs: - name: mvn install run: | - mvn install -DskipTests=true -ntp + mvn install -Dmaven.test.skip=true -ntp - name: generate current dependencies run: | bash $SCRIPT_DEPENDENCY/regenerate_known_dependencies.sh current-dependencies.txt diff --git a/hugegraph-commons/.github/workflows/ci.yml b/.github/workflows/commons-ci.yml similarity index 62% rename from hugegraph-commons/.github/workflows/ci.yml rename to .github/workflows/commons-ci.yml index cc0cd1aa00..06d4c9d419 100644 --- a/hugegraph-commons/.github/workflows/ci.yml +++ b/.github/workflows/commons-ci.yml @@ -1,4 +1,4 @@ -name: "hugegraph-commons ci" +name: "Graph Commons CI" on: workflow_dispatch: @@ -12,10 +12,13 @@ on: jobs: build: runs-on: ubuntu-latest + env: + USE_STAGE: 'true' # Whether to include the stage repository. + strategy: fail-fast: false matrix: - JAVA_VERSION: ['8', '11'] + JAVA_VERSION: ['11'] steps: - name: Install JDK ${{ matrix.JAVA_VERSION }} @@ -36,19 +39,23 @@ jobs: with: fetch-depth: 2 - - name: License check(RAT) + - name: Use staged maven repo settings + if: ${{ env.USE_STAGE == 'true' }} run: | - mvn apache-rat:check -ntp - find ./ -name rat.txt -print0 | xargs -0 -I file cat file > merged-rat.txt - grep "Binaries" merged-rat.txt -C 3 && cat merged-rat.txt + cp $HOME/.m2/settings.xml /tmp/settings.xml + cp -vf .github/configs/settings.xml $HOME/.m2/settings.xml && cat $HOME/.m2/settings.xml - name: Compile run: | mvn compile -Dmaven.javadoc.skip=true -ntp - - name: Run test + - name: Run common test + run: | + mvn test -pl hugegraph-commons/hugegraph-common -Dtest=UnitTestSuite + + - name: Run rpc test run: | - mvn test -Dtest=UnitTestSuite + mvn test -pl hugegraph-commons/hugegraph-rpc -Dtest=UnitTestSuite - name: Upload coverage to Codecov uses: codecov/codecov-action@v3.0.0 diff --git a/.github/workflows/pd-store-ci.yml b/.github/workflows/pd-store-ci.yml index c0f4825251..5921729d04 100644 --- a/.github/workflows/pd-store-ci.yml +++ b/.github/workflows/pd-store-ci.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest env: # TODO: avoid duplicated env setup in pd & store - USE_STAGE: 'false' # Whether to include the stage repository. + USE_STAGE: 'true' # Whether to include the stage repository. # TODO: remove outdated env TRAVIS_DIR: hugegraph-server/hugegraph-dist/src/assembly/travis REPORT_DIR: target/site/jacoco @@ -46,11 +46,11 @@ jobs: - name: Run common test run: | - mvn test -pl hugegraph-pd/hg-pd-test -am -P pd-common-test + mvn test -pl hugegraph-pd/hg-pd-test -am -P pd-common-test -DskipCommonsTests=true - name: Run core test run: | - mvn test -pl hugegraph-pd/hg-pd-test -am -P pd-core-test + mvn test -pl hugegraph-pd/hg-pd-test -am -P pd-core-test -DskipCommonsTests=true # The above tests do not require starting a PD instance. @@ -64,11 +64,11 @@ jobs: - name: Run client test run: | - mvn test -pl hugegraph-pd/hg-pd-test -am -P pd-client-test + mvn test -pl hugegraph-pd/hg-pd-test -am -P pd-client-test -DskipCommonsTests=true - name: Run rest test run: | - mvn test -pl hugegraph-pd/hg-pd-test -am -P pd-rest-test + mvn test -pl hugegraph-pd/hg-pd-test -am -P pd-rest-test -DskipCommonsTests=true - name: Upload coverage to Codecov uses: codecov/codecov-action@v3.0.0 @@ -79,7 +79,7 @@ jobs: # TODO: avoid duplicated env setup runs-on: ubuntu-latest env: - USE_STAGE: 'false' # Whether to include the stage repository. + USE_STAGE: 'true' # Whether to include the stage repository. # TODO: remove outdated env TRAVIS_DIR: hugegraph-server/hugegraph-dist/src/assembly/travis REPORT_DIR: target/site/jacoco @@ -120,27 +120,27 @@ jobs: - name: Run common test run: | - mvn test -pl hugegraph-store/hg-store-test -am -P store-common-test + mvn test -pl hugegraph-store/hg-store-test -am -P store-common-test -DskipCommonsTests=true - name: Run client test run: | - mvn test -pl hugegraph-store/hg-store-test -am -P store-client-test + mvn test -pl hugegraph-store/hg-store-test -am -P store-client-test -DskipCommonsTests=true - name: Run core test run: | - mvn test -pl hugegraph-store/hg-store-test -am -P store-core-test + mvn test -pl hugegraph-store/hg-store-test -am -P store-core-test -DskipCommonsTests=true - name: Run rocksdb test run: | - mvn test -pl hugegraph-store/hg-store-test -am -P store-rocksdb-test + mvn test -pl hugegraph-store/hg-store-test -am -P store-rocksdb-test -DskipCommonsTests=true - name: Run server test run: | - mvn test -pl hugegraph-store/hg-store-test -am -P store-server-test + mvn test -pl hugegraph-store/hg-store-test -am -P store-server-test -DskipCommonsTests=true - name: Run raft-core test run: | - mvn test -pl hugegraph-store/hg-store-test -am -P store-raftcore-test + mvn test -pl hugegraph-store/hg-store-test -am -P store-raftcore-test -DskipCommonsTests=true - name: Upload coverage to Codecov uses: codecov/codecov-action@v3.0.0 diff --git a/.github/workflows/server-ci.yml b/.github/workflows/server-ci.yml index bbf8a5eab6..86b55d0236 100644 --- a/.github/workflows/server-ci.yml +++ b/.github/workflows/server-ci.yml @@ -13,7 +13,7 @@ jobs: # TODO: we need test & replace it to ubuntu-24.04 or ubuntu-latest runs-on: ubuntu-20.04 env: - USE_STAGE: 'false' # Whether to include the stage repository. + USE_STAGE: 'true' # Whether to include the stage repository. TRAVIS_DIR: hugegraph-server/hugegraph-dist/src/assembly/travis REPORT_DIR: target/site/jacoco BACKEND: ${{ matrix.BACKEND }} diff --git a/.gitignore b/.gitignore index bf4993e030..c8c2e1eb55 100644 --- a/.gitignore +++ b/.gitignore @@ -57,7 +57,7 @@ build/ *.pyc # maven ignore -apache-hugegraph-incubating-*/ +apache-hugegraph-*/ output/ *.war *.zip diff --git a/BUILDING.md b/BUILDING.md index b7342e68d6..d4c807c748 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -6,7 +6,7 @@ Required: * Java 11 * Maven 3.5+ -To build without executing tests: `mvn clean package -DskipTests` +To build without executing tests: `mvn clean package -Dmaven.test.skip=true` ## Building in IDEA diff --git a/hugegraph-commons/.asf.yaml b/hugegraph-commons/.asf.yaml deleted file mode 100644 index 4354d52b08..0000000000 --- a/hugegraph-commons/.asf.yaml +++ /dev/null @@ -1,54 +0,0 @@ -# -# 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. -# - -github: - features: - # Enable issue management - issues: true - # Enable wiki for documentation - wiki: true - # Enable projects for project management boards - projects: true - description: HugeGraph Commons - include common library & RPC module - homepage: https://hugegraph.apache.org/ - del_branch_on_merge: true - #labels: - - enabled_merge_buttons: - merge: false - squash: true - rebase: true - protected_branches: - master: - required_status_checks: - # strict means "Require branches to be up-to-date before merging". - strict: true - # contexts are the names of checks that must pass - contexts: - - build (8) - - build (11) - required_pull_request_reviews: - dismiss_stale_reviews: true - require_code_owner_reviews: false - required_approving_review_count: 2 - -notifications: - pullrequests_status: dev@hugegraph.apache.org - # Note: before use the config, we should ensure the "mail" address has set well (exist) - #pullrequests_comment: issues@hugegraph.apache.org - #issues: issues@hugegraph.apache.org - #discussions: issues@hugegraph.apache.org diff --git a/hugegraph-commons/.editorconfig b/hugegraph-commons/.editorconfig deleted file mode 100644 index 5c47926694..0000000000 --- a/hugegraph-commons/.editorconfig +++ /dev/null @@ -1,31 +0,0 @@ -# -# 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. -# - -root = true - -[*] -charset = utf-8 -end_of_line = lf -insert_final_newline = true - -[*.{java, xml, py}] -indent_style = space -indent_size = 4 - -[*.{java, xml}] -# Ignore the IDEA unsupported warning & it works well (indeed) -continuation_indent_size = 8 diff --git a/hugegraph-commons/.gitattributes b/hugegraph-commons/.gitattributes deleted file mode 100644 index f34702952e..0000000000 --- a/hugegraph-commons/.gitattributes +++ /dev/null @@ -1,8 +0,0 @@ -# ignore when package to source.tgz -.github/ export-ignore -.gitattributes export-ignore -.gitignore export-ignore -.asf.yaml export-ignore -apache-release.sh export-ignore - -hugegraph-dist/scripts export-ignore diff --git a/hugegraph-commons/.github/ISSUE_TEMPLATE/bug_report.yml b/hugegraph-commons/.github/ISSUE_TEMPLATE/bug_report.yml deleted file mode 100644 index 43f22140f5..0000000000 --- a/hugegraph-commons/.github/ISSUE_TEMPLATE/bug_report.yml +++ /dev/null @@ -1,96 +0,0 @@ -name: Bug report (反馈 Bug) -description: Create a bug report to help HugeGraph improve -title: '[Bug] describe the main problem' -labels: - - bug - -body: - - type: markdown - attributes: - value: >- - ### Note (特别注意) : - - > 1. 请先**搜索**现有的[Server-Issues](https://github.com/apache/hugegraph/issues) 与 - [Commons-Issues](https://github.com/apache/hugegraph-commons/issues) 中没有与您相同 - / 相关的问题 (请勿重复提交) - - > 2. 我们需要尽可能**详细**的信息来**复现**问题, 越详细的信息 (包括**日志 / 截图 / 配置**等) - 会**越快**被响应和处理 - - > 3. Issue 标题请保持原有模板分类(例如:`[Bug]`), 长段描述之间可以增加`空行`或使用`序号`标记, 保持排版清晰 - - > 4. 请在对应的模块提交 issue, 缺乏有效信息 / 长时间 (> 14 天) 没有回复的 issue 可能会被 **关闭** - (更新时会再开启) - - - type: dropdown - attributes: - label: Bug Type (问题类型) - options: - - exception / error (异常报错) - - logic (逻辑设计问题) - - performance (性能下降) - - others (please edit later) - - - type: checkboxes - attributes: - label: Before submit - options: - - label: 我已经确认现有的 [Server-Issues](https://github.com/apache/hugegraph/issues) 与 [Commons-Issues](https://github.com/apache/hugegraph-commons/issues) 中没有相同 / 重复问题 - required: true - - - type: textarea - attributes: - label: Environment (环境信息) - description: | - > server version could get from [rest-api](https://hugegraph.apache.org/docs/clients/restful-api/) (http://localhost:8080/versions) - value: | - - Server Version: v0.11.x - - Common Version: v1.x - validations: - required: true - - - type: textarea - attributes: - label: Expected & Actual behavior (期望与实际表现) - description: | - > we can refer [How to create a minimal reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) (如何提供最简的可复现用例) - > if possible, please provide screenshots or GIF (请提供清晰的截图, 动图录屏更佳) - placeholder: | - type the main problem here - - ```java - // Exception / Error info (尽可能详细的日志 + 完整异常栈) - - ``` - validations: - required: true - - - type: textarea - attributes: - label: Vertex/Edge example (问题点 / 边数据举例) - description: | - > 如果问题与具体的点 / 边数据相关, 请提供完整的`查询语句 + 返回 JSON 结果` - placeholder: | - // Query URL - GET http://localhost:8080/gremlin?gremlin=hugegraph.traversal().V('1:tom') - - // JSON of Vertex / Edge - { - "vertex": { "id": "xxx" } - } - render: javascript - - - type: textarea - attributes: - label: Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构) - description: | - > 如果问题与具体的点类型 / 边类型 / 索引类型相关, 请提供完整的 `Schema 返回 JSON 结果` - placeholder: | - // Query URL - GET http://localhost:8080/graphs/hugegraph/schema/vertexlabels - - // JSON of GraphSchema - { - "vertex": { "id": "xxx" } - } - render: javascript diff --git a/hugegraph-commons/.github/ISSUE_TEMPLATE/config.yml b/hugegraph-commons/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index df4d7459c0..0000000000 --- a/hugegraph-commons/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1,7 +0,0 @@ -blank_issues_enabled: false - -# 设置提 issue 前的参考文档 -contact_links: - - name: HugeGraph API Doc - url: https://hugegraph.apache.org/docs/clients/ - about: Please search usage here before opening a new issue diff --git a/hugegraph-commons/.github/ISSUE_TEMPLATE/feature_request.yml b/hugegraph-commons/.github/ISSUE_TEMPLATE/feature_request.yml deleted file mode 100644 index 4012606e4a..0000000000 --- a/hugegraph-commons/.github/ISSUE_TEMPLATE/feature_request.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Feature request (新需求 / 功能) -description: Give an idea for HugeGraph -title: '[Feature] describe the new feature' -labels: - - feature - -body: - - type: textarea - attributes: - label: Feature Description (功能描述) - description: | - > 请简要描述新功能 / 需求的使用场景或上下文, 最好能给个具体的例子说明 - placeholder: type the feature description here - validations: - required: true diff --git a/hugegraph-commons/.github/ISSUE_TEMPLATE/question_ask.yml b/hugegraph-commons/.github/ISSUE_TEMPLATE/question_ask.yml deleted file mode 100644 index 2b2d0bc524..0000000000 --- a/hugegraph-commons/.github/ISSUE_TEMPLATE/question_ask.yml +++ /dev/null @@ -1,94 +0,0 @@ -name: Ask question (提问) -description: Question about usage or configs in HugeGraph -title: '[Question] describe your problem' - -body: - - type: markdown - attributes: - value: >- - ### Note (特别注意) : - - > 1. 请先**搜索**现有的[Server-Issues](https://github.com/apache/hugegraph/issues) 与 - [Commons-Issues](https://github.com/apache/hugegraph-commons/issues) 中没有与您相同 - / 相关的问题 (请勿重复提交) - - > 2. 我们需要尽可能**详细**的信息来**复现**问题, 越详细的信息 (包括**日志 / 截图 / 配置**等) - 会**越快**被响应和处理 - - > 3. Issue 标题请保持原有模板分类(例如:`[Bug]`), 长段描述之间可以增加`空行`或使用`序号`标记, 保持排版清晰 - - > 4. 请在对应的模块提交 issue, 缺乏有效信息 / 长时间 (> 14 天) 没有回复的 issue 可能会被 **关闭** - (更新时会再开启) - - - type: dropdown - attributes: - label: Problem Type (问题类型) - options: - - struct / logic (架构 / 逻辑设计问题) - - performance (性能优化) - - exception / error (异常报错) - - others (please edit later) - - - type: checkboxes - attributes: - label: Before submit - options: - - label: 我已经确认现有的 [Server-Issues](https://github.com/apache/hugegraph/issues) 与 [Commons-Issues](https://github.com/apache/hugegraph-commons/issues) 中没有相同 / 重复问题 - required: true - - - type: textarea - attributes: - label: Environment (环境信息) - description: | - > server version could get from [rest-api](https://hugegraph.apache.org/docs/clients/restful-api/) (http://localhost:8080/versions) - value: | - - Server Version: v0.11.x - - Common Version: v1.x - validations: - required: true - - - type: textarea - attributes: - label: Your Question (问题描述) - description: | - > 图使用 / 配置相关问题,请优先参考 [REST-API 文档](https://hugegraph.apache.org/docs/clients/restful-api/), 以及 [Server 配置文档](https://hugegraph.apache.org/docs/config/config-option/) - > if possible, please provide screenshots or GIF (请提供清晰的截图, 动图录屏更佳) - placeholder: | - type the main problem here - - ```java - // Exception / Error info (尽可能详细的日志 + 完整异常栈) - - ``` - validations: - required: true - - - type: textarea - attributes: - label: Vertex/Edge example (问题点 / 边数据举例) - description: | - > 如果问题与具体的点 / 边数据相关, 请提供完整的`查询语句 + 返回 JSON 结果` - placeholder: | - // Query URL - GET http://localhost:8080/gremlin?gremlin=hugegraph.traversal().V('1:tom') - - // JSON of Vertex / Edge - { - "vertex": { "id": "xxx" } - } - render: javascript - - - type: textarea - attributes: - label: Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构) - description: | - > 如果问题与具体的点类型 / 边类型 / 索引类型相关, 请提供完整的 `Schema 返回 JSON 结果` - placeholder: | - // Query URL - GET http://localhost:8080/graphs/hugegraph/schema/vertexlabels - - // JSON of GraphSchema - { - "vertex": { "id": "xxx" } - } - render: javascript diff --git a/hugegraph-commons/.github/outdated/.travis.yml b/hugegraph-commons/.github/outdated/.travis.yml deleted file mode 100644 index 8df38075e5..0000000000 --- a/hugegraph-commons/.github/outdated/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: java - -jdk: - - openjdk8 - -install: mvn compile -Dmaven.javadoc.skip=true - -script: mvn test -Dtest=UnitTestSuite - -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/hugegraph-commons/.github/outdated/cla.yml b/hugegraph-commons/.github/outdated/cla.yml deleted file mode 100644 index a182b9515b..0000000000 --- a/hugegraph-commons/.github/outdated/cla.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: "CLA Assistant" -on: - issue_comment: - types: [created] - pull_request_target: - types: [opened,closed,synchronize] - -jobs: - CLAssistant: - runs-on: ubuntu-latest - steps: - - name: "CLA Assistant" - if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target' - uses: cla-assistant/github-action@v2.1.3-beta - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # the below token should have repo scope and must be manually added by you in the repository's secret - PERSONAL_ACCESS_TOKEN : ${{ secrets.PERSONAL_ACCESS_TOKEN }} - with: - path-to-signatures: '.github/cla-signatures/cla.json' - path-to-document: 'https://github.com/hugegraph/hugegraph-doc/blob/master/CLA.md' # e.g. a CLA or a DCO document - custom-allsigned-prcomment: '**Good**! All Contributors have signed the [CLA](https://github.com/hugegraph/hugegraph-doc/blob/master/CLA.md).' - # branch should not be protected - branch: 'cla-assist' - allowlist: bot* - lock-pullrequest-aftermerge: false - - # the following are the optional inputs - If the optional inputs are not given, then default values will be taken - #remote-organization-name: enter the remote organization name where the signatures should be stored (Default is storing the signatures in the same repository) - #remote-repository-name: enter the remote repository name where the signatures should be stored (Default is storing the signatures in the same repository) - #create-file-commit-message: 'For example: Creating file for storing CLA Signatures' - #signed-commit-message: 'For example: $contributorName has signed the CLA in #$pullRequestNo' - #custom-notsigned-prcomment: 'pull request comment with Introductory message to ask new contributors to sign' - #custom-pr-sign-comment: 'The signature to be committed in order to sign the CLA' - #use-dco-flag: true - If you are using DCO instead of CLA diff --git a/hugegraph-commons/.github/outdated/release.yml b/hugegraph-commons/.github/outdated/release.yml deleted file mode 100644 index 7c1e641fa1..0000000000 --- a/hugegraph-commons/.github/outdated/release.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: release maven package - -on: - release: - types: [ published ] - -jobs: - build: - runs-on: ubuntu-20.04 - steps: - - name: Install JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'zulu' - - - name: Cache Maven packages - uses: actions/cache@v3 - with: - path: ~/.m2 - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-m2 - - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - name: Release Maven package - uses: samuelmeuli/action-maven-publish@v1 - with: - gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} - gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }} - nexus_username: ${{ secrets.NEXUS_USERNAME }} - nexus_password: ${{ secrets.NEXUS_PASSWORD }} - server_id: sonatype-nexus-staging - maven_profiles: "release" - maven_args: > - -Dmaven.test.skip=true diff --git a/hugegraph-commons/.github/workflows/codeql-analysis.yml b/hugegraph-commons/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 7b895324a3..0000000000 --- a/hugegraph-commons/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,66 +0,0 @@ -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -name: "CodeQL" - -on: - pull_request: - # The branches below must be a subset of the branches above - # branches: [ master ] # enable in all PRs - schedule: - - cron: '33 15 * * 5' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'java' ] - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - # ℹ️ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 - - dependency-review: - runs-on: ubuntu-latest - steps: - - name: 'Checkout Repository' - uses: actions/checkout@v3 - - name: 'Dependency Review' - uses: actions/dependency-review-action@v3 - diff --git a/hugegraph-commons/.github/workflows/license-checker.yml b/hugegraph-commons/.github/workflows/license-checker.yml deleted file mode 100644 index 0485bd1b11..0000000000 --- a/hugegraph-commons/.github/workflows/license-checker.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: "license checker" - -on: - workflow_dispatch: - push: - branches: - - master - - /^release-.*$/ - pull_request: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - check-license-header: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - # More info could refer to: https://github.com/apache/skywalking-eyes - - name: Check License Header - uses: apache/skywalking-eyes@main - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - log: info - config: .licenserc.yaml - - - uses: actions/setup-java@v3 - with: - java-version: '11' - distribution: 'adopt' - - - name: License check(RAT) - run: | - mvn apache-rat:check -ntp - find ./ -name rat.txt -print0 | xargs -0 -I file cat file > merged-rat.txt - grep "Binaries" merged-rat.txt -C 3 && cat merged-rat.txt - - check-dependency-license: - runs-on: ubuntu-latest - env: - SCRIPT_DEPENDENCY: hugegraph-dist/scripts/dependency - steps: - - name: Checkout source - uses: actions/checkout@v3 - - name: Set up JDK 11 - uses: actions/setup-java@v3 - with: - java-version: '11' - distribution: 'adopt' - - name: mvn install - run: | - mvn install -DskipTests=true -ntp - - name: generate current dependencies - run: | - bash $SCRIPT_DEPENDENCY/regenerate_known_dependencies.sh current-dependencies.txt - - name: check third dependencies - run: | - bash $SCRIPT_DEPENDENCY/check_dependencies.sh diff --git a/hugegraph-commons/.github/workflows/stale.yml b/hugegraph-commons/.github/workflows/stale.yml deleted file mode 100644 index c38c7afe7e..0000000000 --- a/hugegraph-commons/.github/workflows/stale.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: "Mark stale issues and pull requests" - -on: - schedule: - - cron: "0 21 * * *" - -jobs: - stale: - - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - - steps: - - uses: actions/stale@v3 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: 'Due to the lack of activity, the current issue is marked as stale and will be closed after 20 days, any update will remove the stale label' - stale-pr-message: 'Due to the lack of activity, the current pr is marked as stale and will be closed after 180 days, any update will remove the stale label' - stale-issue-label: 'inactive' - stale-pr-label: 'inactive' - exempt-issue-labels: 'feature,bug,enhancement,improvement,todo,guide,doc,help wanted,security' - exempt-pr-labels: 'feature,bug,enhancement,improvement,todo,guide,doc,help wanted,security' - exempt-all-milestones: true - - days-before-issue-stale: 15 - days-before-issue-close: 20 - days-before-pr-stale: 30 - days-before-pr-close: 180 - operations-per-run: 10 - start-date: '2018-10-01T00:00:00Z' - - exempt-all-assignees: true - remove-stale-when-updated: true - exempt-all-pr-milestones: true - delete-branch: false - enable-statistics: true diff --git a/hugegraph-commons/.gitignore b/hugegraph-commons/.gitignore deleted file mode 100644 index 5a63c69c7d..0000000000 --- a/hugegraph-commons/.gitignore +++ /dev/null @@ -1,84 +0,0 @@ -target/ -**.db -logs/ -ui -node_modules/ -upload-files/ -demo* -gen-java -build -*.class - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache -.svn - -### IntelliJ IDEA ### -.idea/ -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/nbbuild/ -/nbdist/ -/.nb-gradle/ -build/ -dist/ - -### VS Code ### -.vscode/ - -# misc -.DS_Store -*/.DS_Store -**/*.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -*.orig -*.rej -**/.keep -*.sdf -*.suo -*.vcxproj.user -*.swp -*.log -*.pyc - -# maven ignore -output/ -apache-hugegraph-*-incubating-*/ -*.war -*.zip -*.tar -*.tar.gz* -tree.txt -*.versionsBackup -.flattened-pom.xml - -# eclipse ignore -.settings/ - -# temp ignore -*.cache -*.diff -*.patch -*.tmp - -# system ignore -Thumbs.db -hs_err_pid* -# mobile Tools for Java (J2ME) -.mtj.tmp/ -# blueJ files -*.ctxt diff --git a/hugegraph-commons/.licenserc.yaml b/hugegraph-commons/.licenserc.yaml deleted file mode 100644 index efa4789855..0000000000 --- a/hugegraph-commons/.licenserc.yaml +++ /dev/null @@ -1,79 +0,0 @@ -# -# 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. -# - -header: # `header` section is configurations for source codes license header. - license: - spdx-id: Apache-2.0 # the spdx id of the license, it's convenient when your license is standard SPDX license. - copyright-owner: Apache Software Foundation # the copyright owner to replace the [owner] in the `spdx-id` template. - content: | # `license` will be used as the content when `fix` command needs to insert a license header. - 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. - # `pattern` is optional regexp if all the file headers are the same as `license` or the license of `spdx-id` and `copyright-owner`. - pattern: | - Licensed to the Apache Software Foundation under one or more contributor - license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright - ownership. The Apache Software Foundation 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. - paths: # `paths` are the path list that will be checked (and fixed) by license-eye, default is ['**']. - - '**' - - paths-ignore: # `paths-ignore` are the path list that will be ignored by license-eye. - - '.gitignore' - - 'LICENSE' - - 'NOTICE' - - 'DISCLAIMER' - - '**/*.md' - - '**/*.versionsBackup' - - '**/*.log' - - '**/*.conf' - - '**/*.txt' - - '**/*.csv' - - '**/*.json' - - '**/*.svg' - - '**/*.gitattributes' - - '**/.flattened-pom.xml' - - '**/.prettierrc' - - '**/*.MF' - - '**/.stylelintrc' - - 'assembly/**' - - '.github/**/*' - - '**/target/*' - comment: on-failure # on what condition license-eye will comment on the pull request, `on-failure`, `always`, `never`. - - # license-location-threshold specifies the index threshold where the license header can be located, - # after all, a "header" cannot be TOO far from the file start. - license-location-threshold: 80 diff --git a/hugegraph-commons/DISCLAIMER b/hugegraph-commons/DISCLAIMER deleted file mode 100644 index be557e3607..0000000000 --- a/hugegraph-commons/DISCLAIMER +++ /dev/null @@ -1,7 +0,0 @@ -Apache HugeGraph (incubating) is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator PMC. - -Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, -and decision making process have stabilized in a manner consistent with other successful ASF projects. - -While incubation status is not necessarily a reflection of the completeness or stability of the code, -it does indicate that the project has yet to be fully endorsed by the ASF. diff --git a/hugegraph-commons/LICENSE b/hugegraph-commons/LICENSE deleted file mode 100644 index 8f71f43fee..0000000000 --- a/hugegraph-commons/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed 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. - diff --git a/hugegraph-commons/NOTICE b/hugegraph-commons/NOTICE deleted file mode 100644 index 42f88212ea..0000000000 --- a/hugegraph-commons/NOTICE +++ /dev/null @@ -1,7 +0,0 @@ -Apache HugeGraph(incubating) -Copyright 2022-2023 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - -The initial codebase was donated to the ASF by HugeGraph Authors, copyright 2017-2021. diff --git a/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/version/CommonVersion.java b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/version/CommonVersion.java index 8ae89bd0e2..73342fdaaa 100644 --- a/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/version/CommonVersion.java +++ b/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/version/CommonVersion.java @@ -24,5 +24,5 @@ public class CommonVersion { public static final String NAME = "hugegraph-common"; // The second parameter of Version.of() is for all-in-one JAR - public static final Version VERSION = Version.of(CommonVersion.class, "1.3.0"); + public static final Version VERSION = Version.of(CommonVersion.class, "1.5.0"); } diff --git a/hugegraph-commons/hugegraph-common/src/test/resources/META-INF/MANIFEST.MF b/hugegraph-commons/hugegraph-common/src/test/resources/META-INF/MANIFEST.MF index 8ea4eeefb9..6210bfcc57 100644 --- a/hugegraph-commons/hugegraph-common/src/test/resources/META-INF/MANIFEST.MF +++ b/hugegraph-commons/hugegraph-common/src/test/resources/META-INF/MANIFEST.MF @@ -1,9 +1,9 @@ -Manifest-Version: 1.0 -Implementation-Version: 1.8.8.0 -Archiver-Version: Plexus Archiver -Built-By: jermy -Specification-Title: hugegraph-common -Created-By: Apache Maven 3.3.9 -Build-Jdk: 1.8.0_111 -Specification-Version: 1.8.8 - +Manifest-Version: 1.0 +Implementation-Version: 1.8.8.0 +Archiver-Version: Plexus Archiver +Built-By: jermy +Specification-Title: hugegraph-common +Created-By: Apache Maven 3.3.9 +Build-Jdk: 1.8.0_111 +Specification-Version: 1.8.8 + diff --git a/hugegraph-commons/hugegraph-rpc/src/main/java/org/apache/hugegraph/version/RpcVersion.java b/hugegraph-commons/hugegraph-rpc/src/main/java/org/apache/hugegraph/version/RpcVersion.java index ac359822d1..a2dd3d72c1 100644 --- a/hugegraph-commons/hugegraph-rpc/src/main/java/org/apache/hugegraph/version/RpcVersion.java +++ b/hugegraph-commons/hugegraph-rpc/src/main/java/org/apache/hugegraph/version/RpcVersion.java @@ -24,5 +24,5 @@ public class RpcVersion { public static final String NAME = "hugegraph-rpc"; // The second parameter of Version.of() is for all-in-one JAR - public static final Version VERSION = Version.of(RpcVersion.class, "1.3.0"); + public static final Version VERSION = Version.of(RpcVersion.class, "1.5.0"); } diff --git a/hugegraph-commons/pom.xml b/hugegraph-commons/pom.xml index 198247feab..91d0eb42f6 100644 --- a/hugegraph-commons/pom.xml +++ b/hugegraph-commons/pom.xml @@ -20,7 +20,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.apache.hugegraph hugegraph-commons ${revision} pom @@ -35,9 +34,10 @@ - org.apache - apache - 23 + org.apache.hugegraph + hugegraph + ${revision} + ../pom.xml @@ -90,7 +90,7 @@ - 1.3.0 + 1.5.0 UTF-8 ${project.basedir}/.. 1.8 @@ -116,6 +116,7 @@ 3.0.2 3.1.2 8.45 + false @@ -280,6 +281,15 @@ + + + org.apache.maven.plugins + maven-surefire-plugin + 2.20 + + ${skipCommonsTests} + + diff --git a/hugegraph-commons/style/checkstyle.xml b/hugegraph-commons/style/checkstyle.xml deleted file mode 100644 index c6099a8d47..0000000000 --- a/hugegraph-commons/style/checkstyle.xml +++ /dev/null @@ -1,234 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hugegraph-pd/Dockerfile b/hugegraph-pd/Dockerfile index a86b5b9bd4..6ab5817f24 100644 --- a/hugegraph-pd/Dockerfile +++ b/hugegraph-pd/Dockerfile @@ -23,14 +23,14 @@ COPY . /pkg WORKDIR /pkg ARG MAVEN_ARGS -RUN mvn package $MAVEN_ARGS -e -B -ntp -DskipTests -Dmaven.javadoc.skip=true && pwd && ls -l && rm \ +RUN mvn package $MAVEN_ARGS -e -B -ntp -Dmaven.test.skip=true -Dmaven.javadoc.skip=true && pwd && ls -l && rm \ ./hugegraph-server/*.tar.gz && rm ./hugegraph-pd/*.tar.gz && rm ./hugegraph-store/*.tar.gz # 2nd stage: runtime env # Note: ZGC (The Z Garbage Collector) is only supported on ARM-Mac with java > 13 FROM openjdk:11-slim -COPY --from=build /pkg/hugegraph-pd/apache-hugegraph-incubating-pd-*/ /hugegraph-pd/ +COPY --from=build /pkg/hugegraph-pd/apache-hugegraph-pd-incubating-*/ /hugegraph-pd/ LABEL maintainer="HugeGraph Docker Maintainers " # TODO: use g1gc or zgc as default diff --git a/hugegraph-pd/hg-pd-dist/pom.xml b/hugegraph-pd/hg-pd-dist/pom.xml index a764bdd817..251ec8bcb7 100644 --- a/hugegraph-pd/hg-pd-dist/pom.xml +++ b/hugegraph-pd/hg-pd-dist/pom.xml @@ -31,7 +31,6 @@ ${project.parent.basedir} - bash ${project.basedir}/src/assembly ${assembly.dir}/descriptor ${assembly.dir}/static diff --git a/hugegraph-pd/pom.xml b/hugegraph-pd/pom.xml index 34f25b5d8b..b2547a7dc4 100644 --- a/hugegraph-pd/pom.xml +++ b/hugegraph-pd/pom.xml @@ -43,7 +43,7 @@ 2.17.0 - apache-${release.name}-incubating-pd-${project.version} + apache-${release.name}-pd-incubating-${project.version} diff --git a/hugegraph-server/Dockerfile b/hugegraph-server/Dockerfile index 0e39704fd6..e790162e6a 100644 --- a/hugegraph-server/Dockerfile +++ b/hugegraph-server/Dockerfile @@ -23,7 +23,7 @@ COPY . /pkg WORKDIR /pkg ARG MAVEN_ARGS -RUN mvn package $MAVEN_ARGS -e -B -ntp -DskipTests -Dmaven.javadoc.skip=true && pwd && ls -l && rm \ +RUN mvn package $MAVEN_ARGS -e -B -ntp -Dmaven.test.skip=true -Dmaven.javadoc.skip=true && pwd && ls -l && rm \ ./hugegraph-server/*.tar.gz && rm ./hugegraph-pd/*.tar.gz && rm ./hugegraph-store/*.tar.gz # 2nd stage: runtime env diff --git a/hugegraph-server/hugegraph-dist/pom.xml b/hugegraph-server/hugegraph-dist/pom.xml index ce4c00b225..7f4dd454c9 100644 --- a/hugegraph-server/hugegraph-dist/pom.xml +++ b/hugegraph-server/hugegraph-dist/pom.xml @@ -230,45 +230,47 @@ - - download-keystore - prepare-package - - run - - - - - - - - - - - cp-keystore - package - - run - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hugegraph-server/hugegraph-dist/src/assembly/descriptor/assembly.xml b/hugegraph-server/hugegraph-dist/src/assembly/descriptor/assembly.xml index b1c293dfb1..b7f9ee0487 100644 --- a/hugegraph-server/hugegraph-dist/src/assembly/descriptor/assembly.xml +++ b/hugegraph-server/hugegraph-dist/src/assembly/descriptor/assembly.xml @@ -46,17 +46,6 @@ *.jar - - ${top.level.dir}/hugegraph-dist/release-docs/ - / - - - ${top.level.dir}/../ - / - - DISCLAIMER* - - diff --git a/hugegraph-server/hugegraph-dist/src/assembly/static/bin/hugegraph-server.sh b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/hugegraph-server.sh index 8174082d49..8b6a16d5ad 100644 --- a/hugegraph-server/hugegraph-dist/src/assembly/static/bin/hugegraph-server.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/hugegraph-server.sh @@ -61,14 +61,7 @@ ensure_path_writable "$PLUGINS" # The maximum and minimum heap memory that service can use MAX_MEM=$((32 * 1024)) MIN_MEM=$((1 * 512)) -# TODO: upgrade to Java 11 in 1.5.0 -MIN_JAVA_VERSION=8 - -# Note: Download for HTTPS, could comment out if you don't need it -# TODO: only download it when we config https (check the conf file) -if [[ ! -e "${CONF}/hugegraph-server.keystore" ]]; then - download "${CONF}" "${GITHUB}/apache/hugegraph-doc/raw/binary-1.0/dist/server/hugegraph-server.keystore" -fi +MIN_JAVA_VERSION=11 # Add the slf4j-log4j12 binding CP=$(find -L $LIB -name 'log4j-slf4j-impl*.jar' | sort | tr '\n' ':') diff --git a/hugegraph-server/hugegraph-dist/src/assembly/static/bin/start-hugegraph.sh b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/start-hugegraph.sh index 5e14397f7e..30c2764989 100644 --- a/hugegraph-server/hugegraph-dist/src/assembly/static/bin/start-hugegraph.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/start-hugegraph.sh @@ -80,6 +80,11 @@ REST_SERVER_URL=$(read_property "$CONF/rest-server.properties" "restserver.url") check_port "$GREMLIN_SERVER_URL" check_port "$REST_SERVER_URL" +# Note: Only download hugegraph-server.keystore when we config https (check the conf file) +if [[ $REST_SERVER_URL == https* && ! -e "${CONF}/hugegraph-server.keystore" ]]; then + download "${CONF}" "https://github.com/apache/hugegraph-doc/raw/binary-1.5/dist/server/hugegraph-server.keystore" +fi + if [ ! -d "$LOGS" ]; then mkdir -p "$LOGS" fi diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-api-test-for-raft.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-api-test-for-raft.sh index 85c45b8c47..f83123854c 100755 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-api-test-for-raft.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-api-test-for-raft.sh @@ -23,7 +23,7 @@ REPORT_FILE=$REPORT_DIR/jacoco-api-test.xml TRAVIS_DIR=$(dirname $0) VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) -SERVER_DIR=hugegraph-server/apache-hugegraph-incubating-server-$VERSION +SERVER_DIR=hugegraph-server/apache-hugegraph-server-incubating-$VERSION RAFT1_DIR=hugegraph-raft1 RAFT2_DIR=hugegraph-raft2 RAFT3_DIR=hugegraph-raft3 @@ -35,7 +35,7 @@ JACOCO_PORT=36320 RAFT_TOOLS=$RAFT1_DIR/bin/raft-tools.sh RAFT_LEADER="127.0.0.1:8091" -mvn package -DskipTests +mvn package -Dmaven.test.skip=true # mkdir for each raft-server cp -r $SERVER_DIR $RAFT1_DIR @@ -57,7 +57,7 @@ export HUGEGRAPH_PASSWORD=pa $RAFT_TOOLS --set-leader "hugegraph" "$RAFT_LEADER" # run api-test -mvn test -pl hugegraph-server/hugegraph-test -am -P api-test,$BACKEND || (cat $RAFT1_DIR/logs/hugegraph-server.log && exit 1) +mvn test -pl hugegraph-server/hugegraph-test -am -P api-test,$BACKEND -DskipCommonsTests=true || (cat $RAFT1_DIR/logs/hugegraph-server.log && exit 1) $TRAVIS_DIR/build-report.sh $BACKEND $JACOCO_PORT $REPORT_FILE diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-api-test.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-api-test.sh index 17d4722dc2..4959112149 100755 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-api-test.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-api-test.sh @@ -23,13 +23,13 @@ REPORT_FILE=$REPORT_DIR/jacoco-api-test-for-raft.xml TRAVIS_DIR=$(dirname $0) VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) -SERVER_DIR=hugegraph-server/apache-hugegraph-incubating-server-$VERSION/ +SERVER_DIR=hugegraph-server/apache-hugegraph-server-incubating-$VERSION/ CONF=$SERVER_DIR/conf/graphs/hugegraph.properties REST_SERVER_CONF=$SERVER_DIR/conf/rest-server.properties GREMLIN_SERVER_CONF=$SERVER_DIR/conf/gremlin-server.yaml JACOCO_PORT=36320 -mvn package -DskipTests -ntp +mvn package -Dmaven.test.skip=true -ntp # add mysql dependency wget -P $SERVER_DIR/lib/ https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.28/mysql-connector-java-8.0.28.jar @@ -57,7 +57,7 @@ authentication: { $TRAVIS_DIR/start-server.sh $SERVER_DIR $BACKEND $JACOCO_PORT || (cat $SERVER_DIR/logs/hugegraph-server.log && exit 1) # run api-test -mvn test -pl hugegraph-server/hugegraph-test -am -P api-test,$BACKEND || (cat $SERVER_DIR/logs/hugegraph-server.log && exit 1) +mvn test -pl hugegraph-server/hugegraph-test -am -P api-test,$BACKEND -DskipCommonsTests=true || (cat $SERVER_DIR/logs/hugegraph-server.log && exit 1) $TRAVIS_DIR/build-report.sh $BACKEND $JACOCO_PORT $REPORT_FILE diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-core-test.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-core-test.sh index a95d2f0806..91e5859328 100755 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-core-test.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-core-test.sh @@ -19,4 +19,4 @@ set -ev BACKEND=$1 -mvn test -pl hugegraph-server/hugegraph-test -am -P core-test,$BACKEND +mvn test -pl hugegraph-server/hugegraph-test -am -P core-test,$BACKEND -DskipCommonsTests=true diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-tinkerpop-test.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-tinkerpop-test.sh index 87d60c8880..6c43dac1d7 100755 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-tinkerpop-test.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-tinkerpop-test.sh @@ -21,9 +21,9 @@ BACKEND=$1 SUITE=$2 if [[ "$SUITE" == "structure" || "$SUITE" == "tinkerpop" ]]; then - mvn test -pl hugegraph-server/hugegraph-test -am -P tinkerpop-structure-test,$BACKEND + mvn test -pl hugegraph-server/hugegraph-test -am -P tinkerpop-structure-test,$BACKEND -DskipCommonsTests=true fi if [[ "$SUITE" == "process" || "$SUITE" == "tinkerpop" ]]; then - mvn test -pl hugegraph-server/hugegraph-test -am -P tinkerpop-process-test,$BACKEND + mvn test -pl hugegraph-server/hugegraph-test -am -P tinkerpop-process-test,$BACKEND -DskipCommonsTests=true fi diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-unit-test.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-unit-test.sh index 5fe9b476b3..f5a6a728e7 100755 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-unit-test.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-unit-test.sh @@ -20,5 +20,5 @@ set -ev BACKEND=$1 if [[ "$BACKEND" == "memory" ]]; then - mvn test -pl hugegraph-server/hugegraph-test -am -P unit-test + mvn test -pl hugegraph-server/hugegraph-test -am -P unit-test -DskipCommonsTests=true fi diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/start-pd.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/start-pd.sh index c9200fefb3..9f694d5c3c 100755 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/start-pd.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/start-pd.sh @@ -18,7 +18,7 @@ set -ev HOME_DIR=$(pwd) -PD_DIR=$HOME_DIR/hugegraph-pd/apache-hugegraph-incubating-pd-1.5.0 +PD_DIR=$HOME_DIR/hugegraph-pd/apache-hugegraph-pd-incubating-1.5.0 pushd $PD_DIR . bin/start-hugegraph-pd.sh diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/start-store.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/start-store.sh index c4c11c2c35..23e8f2297c 100755 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/start-store.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/start-store.sh @@ -18,7 +18,7 @@ set -ev HOME_DIR=$(pwd) -STORE_DIR=$HOME_DIR/hugegraph-store/apache-hugegraph-incubating-store-1.5.0 +STORE_DIR=$HOME_DIR/hugegraph-store/apache-hugegraph-store-incubating-1.5.0 pushd $STORE_DIR . bin/start-hugegraph-store.sh diff --git a/hugegraph-server/pom.xml b/hugegraph-server/pom.xml index 9c03fdefa5..a4dac32ab5 100644 --- a/hugegraph-server/pom.xml +++ b/hugegraph-server/pom.xml @@ -37,7 +37,7 @@ ${project.basedir}/.. - apache-${release.name}-incubating-server-${project.version} + apache-${release.name}-server-incubating-${project.version} 1.7.5 1.2.17 2.17.1 @@ -49,7 +49,6 @@ 3.0.3 4.2.4 3.21.0-GA - bash 3.1.2 8.45 1.47.0 diff --git a/hugegraph-store/Dockerfile b/hugegraph-store/Dockerfile index c7329a8f81..b677da2f6b 100644 --- a/hugegraph-store/Dockerfile +++ b/hugegraph-store/Dockerfile @@ -23,14 +23,14 @@ COPY . /pkg WORKDIR /pkg ARG MAVEN_ARGS -RUN mvn package $MAVEN_ARGS -e -B -ntp -DskipTests -Dmaven.javadoc.skip=true && pwd && ls -l && rm \ +RUN mvn package $MAVEN_ARGS -e -B -ntp -Dmaven.test.skip=true -Dmaven.javadoc.skip=true && pwd && ls -l && rm \ ./hugegraph-server/*.tar.gz && rm ./hugegraph-pd/*.tar.gz && rm ./hugegraph-store/*.tar.gz # 2nd stage: runtime env # Note: ZGC (The Z Garbage Collector) is only supported on ARM-Mac with java > 13 FROM openjdk:11-slim -COPY --from=build /pkg/hugegraph-store/apache-hugegraph-incubating-store-*/ /hugegraph-store/ +COPY --from=build /pkg/hugegraph-store/apache-hugegraph-store-incubating-*/ /hugegraph-store/ LABEL maintainer="HugeGraph Docker Maintainers " # TODO: use g1gc or zgc as default diff --git a/hugegraph-store/hg-store-dist/pom.xml b/hugegraph-store/hg-store-dist/pom.xml index 13df60f0a5..b0988d8aab 100644 --- a/hugegraph-store/hg-store-dist/pom.xml +++ b/hugegraph-store/hg-store-dist/pom.xml @@ -32,7 +32,6 @@ ${project.parent.basedir} - bash ${project.basedir}/src/assembly ${assembly.dir}/descriptor ${assembly.dir}/static diff --git a/hugegraph-store/hg-store-dist/src/assembly/descriptor/server-assembly.xml b/hugegraph-store/hg-store-dist/src/assembly/descriptor/server-assembly.xml index 3e7a6aeb55..522a93c917 100644 --- a/hugegraph-store/hg-store-dist/src/assembly/descriptor/server-assembly.xml +++ b/hugegraph-store/hg-store-dist/src/assembly/descriptor/server-assembly.xml @@ -32,6 +32,9 @@ * + + *.so + 755 diff --git a/hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh b/hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh index b12fb354df..b363b7ab45 100644 --- a/hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh +++ b/hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh @@ -36,14 +36,33 @@ LOGS="$TOP/logs" OUTPUT=${LOGS}/hugegraph-store-server.log GITHUB="https://github.com" PID_FILE="$BIN/pid" -arch=$(arch) -echo "Current arch: ", "${arch}" -#if [[ $arch =~ "aarch64" ]];then -# export LD_PRELOAD="$TOP/bin/libjemalloc_aarch64.so" -#else -export LD_PRELOAD="$TOP/bin/libjemalloc.so" -#fi +. "$BIN"/util.sh + +arch=$(uname -m) +echo "Current arch: $arch" + +if [[ $arch == "aarch64" || $arch == "arm64" ]]; then + lib_file="$TOP/bin/libjemalloc_aarch64.so" + download_url="${GITHUB}/apache/hugegraph-doc/raw/binary-1.5/dist/server/libjemalloc_aarch64.so" + expected_md5="2a631d2f81837f9d5864586761c5e380" + if download_and_verify $download_url $lib_file $expected_md5; then + export LD_PRELOAD=$lib_file + else + echo "Failed to verify or download $lib_file, skip it" + fi +elif [[ $arch == "x86_64" ]]; then + lib_file="$TOP/bin/libjemalloc.so" + download_url="${GITHUB}/apache/hugegraph-doc/raw/binary-1.5/dist/server/libjemalloc.so" + expected_md5="fd61765eec3bfea961b646c269f298df" + if download_and_verify $download_url $lib_file $expected_md5; then + export LD_PRELOAD=$lib_file + else + echo "Failed to verify or download $lib_file, skip it" + fi +else + echo "Unsupported architecture: $arch" +fi ##pd/store max user processes, ulimit -u # Reduce the maximum number of processes that can be opened by a normal dev/user @@ -92,11 +111,6 @@ while getopts "g:j:y:" arg; do esac done - - - -. "$BIN"/util.sh - ensure_path_writable "$LOGS" ensure_path_writable "$PLUGINS" diff --git a/hugegraph-store/hg-store-dist/src/assembly/static/bin/util.sh b/hugegraph-store/hg-store-dist/src/assembly/static/bin/util.sh index 93eae7b890..93b55311cb 100644 --- a/hugegraph-store/hg-store-dist/src/assembly/static/bin/util.sh +++ b/hugegraph-store/hg-store-dist/src/assembly/static/bin/util.sh @@ -282,6 +282,36 @@ function download() { fi } +download_and_verify() { + local url=$1 + local filepath=$2 + local expected_md5=$3 + + if [[ -f $filepath ]]; then + echo "File $filepath exists. Verifying MD5 checksum..." + actual_md5=$(md5sum $filepath | awk '{ print $1 }') + if [[ $actual_md5 != $expected_md5 ]]; then + echo "MD5 checksum verification failed for $filepath. Expected: $expected_md5, but got: $actual_md5" + echo "Deleting $filepath..." + rm -f $filepath + else + echo "MD5 checksum verification succeeded for $filepath." + return 0 + fi + fi + + echo "Downloading $filepath..." + curl -L -o $filepath $url + + actual_md5=$(md5sum $filepath | awk '{ print $1 }') + if [[ $actual_md5 != $expected_md5 ]]; then + echo "MD5 checksum verification failed for $filepath after download. Expected: $expected_md5, but got: $actual_md5" + return 1 + fi + + return 0 +} + function ensure_package_exist() { local path=$1 local dir=$2 diff --git a/hugegraph-store/pom.xml b/hugegraph-store/pom.xml index ebf5f0d2a3..f9cd0bcfb3 100644 --- a/hugegraph-store/pom.xml +++ b/hugegraph-store/pom.xml @@ -45,7 +45,7 @@ 2.15.0 - apache-${release.name}-incubating-store-${project.version} + apache-${release.name}-store-incubating-${project.version} diff --git a/install-dist/pom.xml b/install-dist/pom.xml index d351fcf908..ff4fb92c2f 100644 --- a/install-dist/pom.xml +++ b/install-dist/pom.xml @@ -27,4 +27,66 @@ install-dist + + + apache-${release.name}-incubating-${project.version} + + + + + + maven-antrun-plugin + + + package + + run + + + + + + root_path=$(cd $(dirname $0)/..; pwd) + cd $root_path || exit + + mkdir -p ${final.name} + cp -r -v $root_path/hugegraph-pd/apache-hugegraph-pd-incubating-${project.version} ${final.name}/ || exit + cp -r -v $root_path/hugegraph-store/apache-hugegraph-store-incubating-${project.version} ${final.name}/ || exit + cp -r -v $root_path/hugegraph-server/apache-hugegraph-server-incubating-${project.version} ${final.name}/ || exit + cp -r -v $root_path/install-dist/release-docs/* $root_path/DISCLAIMER ${final.name}/ || exit + + tar zcvf $root_path/target/${final.name}.tar.gz ./${final.name} || exit 1 + + md5sum $root_path/target/${final.name}.tar.gz + echo -n "hugegraph tar.gz available at: " + echo "$root_path/target/${final.name}.tar.gz" + rm -f ${project.basedir}/dist.sh + + + + + + + + + + + maven-clean-plugin + + + + ${project.basedir}/.. + + ${final.name}.tar.gz + + false + + + ${project.basedir}/../${final.name} + + + + + + diff --git a/install-dist/scripts/apache-release.sh b/install-dist/scripts/apache-release.sh index 859a635620..168217c425 100755 --- a/install-dist/scripts/apache-release.sh +++ b/install-dist/scripts/apache-release.sh @@ -47,9 +47,7 @@ cd - || exit # step2: copy the binary file (Optional) # Note: it's optional for project to generate binary package (skip this step if not need) -cp -v ../../hugegraph-server/apache-${REPO}-incubating-server-"${RELEASE_VERSION}".tar.gz \ - dist/apache-${REPO} || exit -# TODO: pd & store +cp -v ../../target/apache-${REPO}-incubating-"${RELEASE_VERSION}".tar.gz dist/apache-${REPO} || exit # step3: sign + hash ##### 3.1 sign in source & binary package diff --git a/install-dist/scripts/dependency/known-dependencies.txt b/install-dist/scripts/dependency/known-dependencies.txt index 1bbf7241fe..9caa8ecab8 100644 --- a/install-dist/scripts/dependency/known-dependencies.txt +++ b/install-dist/scripts/dependency/known-dependencies.txt @@ -1,6 +1,7 @@ accessors-smart-1.2.jar airline-0.8.jar android-json-0.0.20131108.vaadin1.jar +animal-sniffer-annotations-1.18.jar animal-sniffer-annotations-1.19.jar annotations-13.0.jar annotations-4.1.1.4.jar @@ -25,6 +26,7 @@ assertj-core-3.19.0.jar ast-9.0-9.0.20190305.jar audience-annotations-0.5.0.jar auto-service-annotations-1.0.jar +bolt-1.6.2.jar bolt-1.6.4.jar byte-buddy-1.10.20.jar byte-buddy-1.10.5.jar @@ -104,21 +106,28 @@ groovy-jsr223-2.5.14-indy.jar groovy-swing-2.5.14.jar groovy-templates-2.5.14.jar groovy-xml-2.5.14.jar +grpc-api-1.28.1.jar grpc-api-1.39.0.jar grpc-api-1.47.0.jar +grpc-context-1.28.1.jar grpc-context-1.39.0.jar grpc-context-1.47.0.jar +grpc-core-1.28.1.jar grpc-core-1.39.0.jar grpc-core-1.47.0.jar grpc-grpclb-1.39.0.jar grpc-netty-1.39.0.jar grpc-netty-1.47.0.jar +grpc-netty-shaded-1.28.0.jar grpc-netty-shaded-1.39.0.jar grpc-netty-shaded-1.47.0.jar +grpc-protobuf-1.28.0.jar grpc-protobuf-1.39.0.jar +grpc-protobuf-lite-1.28.0.jar grpc-protobuf-lite-1.39.0.jar grpc-services-1.39.0.jar grpc-spring-boot-starter-4.5.5.jar +grpc-stub-1.28.0.jar grpc-stub-1.39.0.jar grpc-stub-1.47.0.jar gson-2.8.6.jar @@ -134,6 +143,7 @@ hbase-shaded-endpoint-2.0.6.jar HdrHistogram-2.1.12.jar HdrHistogram-2.1.9.jar hessian-3.3.6.jar +hessian-3.3.7.jar hg-pd-client-1.5.0.jar hg-pd-common-1.5.0.jar hg-pd-core-1.5.0.jar @@ -318,9 +328,11 @@ log4j-jul-2.17.2.jar log4j-slf4j-impl-2.15.0.jar log4j-slf4j-impl-2.17.0.jar log4j-slf4j-impl-2.17.1.jar +log4j-slf4j-impl-2.18.0.jar logging-interceptor-4.10.0.jar lombok-1.18.20.jar lombok-1.18.24.jar +lombok-1.18.8.jar lookout-api-1.4.1.jar lucene-analyzers-common-8.11.2.jar lucene-analyzers-smartcn-8.11.2.jar @@ -388,6 +400,7 @@ osgi-resource-locator-1.0.3.jar parboiled-core-1.2.0.jar parboiled-scala_2.12-1.2.0.jar parser-9.0-9.0.20190305.jar +perfmark-api-0.19.0.jar perfmark-api-0.23.0.jar perfmark-api-0.25.0.jar picocli-4.3.2.jar @@ -401,10 +414,12 @@ powermock-module-junit4-2.0.0-RC.3.jar powermock-module-junit4-common-2.0.0-RC.3.jar powermock-module-junit4-rule-2.0.0-RC.3.jar powermock-reflect-2.0.0-RC.3.jar +protobuf-java-3.11.0.jar protobuf-java-3.17.2.jar protobuf-java-3.21.7.jar protobuf-java-3.5.1.jar protobuf-java-util-3.17.2.jar +proto-google-common-protos-1.17.0.jar proto-google-common-protos-2.0.1.jar protostuff-api-1.6.0.jar protostuff-collectionschema-1.6.0.jar @@ -440,6 +455,7 @@ sjk-stacktrace-0.22.jar slf4j-api-1.7.21.jar slf4j-api-1.7.25.jar slf4j-api-1.7.32.jar +snakeyaml-1.18.jar snakeyaml-1.26.jar snakeyaml-1.27.jar snakeyaml-1.28.jar diff --git a/pom.xml b/pom.xml index 0f8bc3e228..004ef16909 100644 --- a/pom.xml +++ b/pom.xml @@ -87,17 +87,19 @@ 1.5.0 - 1.3.0 + 1.5.0 hugegraph UTF-8 11 11 + bash hugegraph-server hugegraph-pd hugegraph-store + hugegraph-commons install-dist @@ -271,6 +273,7 @@ **/*.txt **/.flattened-pom.xml + **/apache-hugegraph-*/**/*