diff --git a/.travis.yml b/.travis.yml index 91cce0cef6..4f7be19fc7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ sudo: required cache: directories: + - $HOME/.m2 - $HOME/downloads branches: @@ -37,6 +38,9 @@ script: mvn test -P tinkerpop-process-test,$BACKEND fi +after_success: + - bash <(curl -s https://codecov.io/bash) + jobs: include: - stage: deploy @@ -47,7 +51,6 @@ jobs: - | if [ $DEPLOYED = 0 ]; then DEPLOYED=1 - mvn cobertura:cobertura > /dev/null && bash <(curl -s https://codecov.io/bash) mvn clean package -DskipTests else echo "Skipping before_deploy since it has been executed once." diff --git a/hugegraph-cassandra/src/main/java/com/baidu/hugegraph/backend/store/cassandra/CassandraTable.java b/hugegraph-cassandra/src/main/java/com/baidu/hugegraph/backend/store/cassandra/CassandraTable.java index db55235042..ae8c80b974 100644 --- a/hugegraph-cassandra/src/main/java/com/baidu/hugegraph/backend/store/cassandra/CassandraTable.java +++ b/hugegraph-cassandra/src/main/java/com/baidu/hugegraph/backend/store/cassandra/CassandraTable.java @@ -27,8 +27,12 @@ import java.util.Map; import java.util.Set; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.http.client.utils.CloneUtils; +import org.apache.lucene.queryparser.xml.QueryBuilderFactory; import org.slf4j.Logger; +import com.baidu.hugegraph.HugeException; import com.baidu.hugegraph.backend.BackendException; import com.baidu.hugegraph.backend.id.Id; import com.baidu.hugegraph.backend.query.Condition; diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/util/CopyUtil.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/util/CopyUtil.java index 69cf2fbafc..52f2b5b382 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/util/CopyUtil.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/util/CopyUtil.java @@ -19,6 +19,7 @@ package com.baidu.hugegraph.util; +import java.lang.reflect.Array; import java.lang.reflect.Field; import java.lang.reflect.Modifier; @@ -33,27 +34,40 @@ public static T cloneObject(T o, T clone) throws Exception { } for (Field field : o.getClass().getDeclaredFields()) { field.setAccessible(true); - Object childObj = field.get(o); - if (childObj == null || Modifier.isFinal(field.getModifiers())) { + Object value = field.get(o); + if (value == null || Modifier.isFinal(field.getModifiers())) { continue; } Class declareType = field.getType(); - Class valueType = childObj.getClass(); + Class valueType = value.getClass(); if (ReflectionUtil.isSimpleType(declareType) || ReflectionUtil.isSimpleType(valueType)) { - field.set(clone, field.get(o)); + field.set(clone, value); + } else if (declareType.isArray() && valueType.isArray() && + valueType.getComponentType().isPrimitive()) { + field.set(clone, cloneArray(value)); } else { - if (childObj == o) { + if (value == o) { field.set(clone, clone); } else { - field.set(clone, cloneObject(field.get(o), null)); + field.set(clone, cloneObject(value, null)); } } } return clone; } + private static Object cloneArray(Object value) { + Class valueType = value.getClass(); + assert valueType.isArray() && + valueType.getComponentType().isPrimitive(); + int len = Array.getLength(value); + Object array = Array.newInstance(valueType.getComponentType(), len); + System.arraycopy(value, 0, array, 0, len); + return array; + } + public static T copy(T object) { return copy(object, null); } diff --git a/hugegraph-dist/pom.xml b/hugegraph-dist/pom.xml index 990022930e..f555eda2ad 100644 --- a/hugegraph-dist/pom.xml +++ b/hugegraph-dist/pom.xml @@ -165,5 +165,4 @@ - - \ No newline at end of file + diff --git a/hugegraph-test/pom.xml b/hugegraph-test/pom.xml index 5cf6edba6b..e28c95686b 100644 --- a/hugegraph-test/pom.xml +++ b/hugegraph-test/pom.xml @@ -12,11 +12,47 @@ hugegraph-test + + + com.baidu.hugegraph + hugegraph-core + ${project.version} + + + + com.baidu.hugegraph + hugegraph-cassandra + ${project.version} + + + com.baidu.hugegraph + hugegraph-scylladb + ${project.version} + + + com.baidu.hugegraph + hugegraph-rocksdb + ${project.version} + + + com.baidu.hugegraph + hugegraph-hbase + ${project.version} + + + com.baidu.hugegraph + hugegraph-mysql + ${project.version} + com.baidu.hugegraph hugegraph-dist ${project.version} + org.apache.tinkerpop gremlin-test @@ -35,134 +71,143 @@ - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.20 - - - core-test - - ${basedir}/src/main/java/ - - ${basedir}/target/classes/ - - - **/CoreTestSuite.java - - - - - unit-test - - ${basedir}/src/main/java/ - - ${basedir}/target/classes/ - - - **/UnitTestSuite.java - - - - - api-test - - ${basedir}/src/main/java/ - - ${basedir}/target/classes/ - - - **/ApiTestSuite.java - - - - - tinkerpop-structure-test - - ${basedir}/src/main/java/ - - ${basedir}/target/classes/ - - - **/StructureStandardTest.java - - - - - tinkerpop-process-test - - ${basedir}/src/main/java/ - - ${basedir}/target/classes/ - - - **/ProcessStandardTest.java - - - - - tinkerpop-structure-perf-test - - ${basedir}/src/main/java/ - - ${basedir}/target/classes/ - - - **/StructurePerformanceTest.java - - - - - tinkerpop-process-perf-test - - ${basedir}/src/main/java/ - - ${basedir}/target/classes/ - - - **/ProcessPerformanceTest.java - - - - - - - maven-clean-plugin - 3.0.0 - - - - ${top.level.dir} - - ${final.name}/** - *.tar.gz - *.zip - *.tar - - false - - - ${final.name} - - - - - - org.codehaus.mojo - cobertura-maven-plugin - 2.7 - - - html - xml - - - - - - + + + org.apache.maven.plugins + maven-surefire-plugin + 2.20 + + + core-test + + ${basedir}/src/main/java/ + + ${basedir}/target/classes/ + + + **/CoreTestSuite.java + + + + + unit-test + + ${basedir}/src/main/java/ + + ${basedir}/target/classes/ + + + **/UnitTestSuite.java + + + + + api-test + + ${basedir}/src/main/java/ + + ${basedir}/target/classes/ + + + **/ApiTestSuite.java + + + + + tinkerpop-structure-test + + ${basedir}/src/main/java/ + + ${basedir}/target/classes/ + + + **/StructureStandardTest.java + + + + + tinkerpop-process-test + + ${basedir}/src/main/java/ + + ${basedir}/target/classes/ + + + **/ProcessStandardTest.java + + + + + tinkerpop-structure-perf-test + + ${basedir}/src/main/java/ + + ${basedir}/target/classes/ + + + **/StructurePerformanceTest.java + + + + + tinkerpop-process-perf-test + + ${basedir}/src/main/java/ + + ${basedir}/target/classes/ + + + **/ProcessPerformanceTest.java + + + + + + + maven-clean-plugin + 3.0.0 + + + + ${top.level.dir} + + ${final.name}/** + *.tar.gz + *.zip + *.tar + + false + + + ${final.name} + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.3 + + + pre-test + + prepare-agent + + + + post-test + test + + report-aggregate + + + ${basedir}/../target/site/jacoco + + + + + @@ -244,4 +289,4 @@ - \ No newline at end of file +