diff --git a/.travis.yml b/.travis.yml
index f83ab4f59..163a6be4d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -20,3 +20,16 @@ branches:
- /^v[0-9]\..*$/
install: mvn compile -Dmaven.javadoc.skip=true | grep -v "Downloading\|Downloaded"
+
+before_script:
+ - $TRAVIS_DIR/install-env.sh
+
+script:
+ - mvn test -P core-test
+
+after_success:
+ - bash <(curl -s https://codecov.io/bash)
+
+env:
+ global:
+ - TRAVIS_DIR=computer-dist/src/assembly/travis
diff --git a/computer-core/src/main/java/com/baidu/hugegraph/computer/exception/ComputeException.java b/computer-core/src/main/java/com/baidu/hugegraph/computer/exception/ComputeException.java
new file mode 100644
index 000000000..004d4aee7
--- /dev/null
+++ b/computer-core/src/main/java/com/baidu/hugegraph/computer/exception/ComputeException.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.computer.exception;
+
+public class ComputeException extends ComputerException {
+
+ private static final long serialVersionUID = 185790114205374242L;
+
+ public ComputeException(String message) {
+ super(message);
+ }
+
+ public ComputeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ComputeException(String message, Object... args) {
+ super(message, args);
+ }
+
+ public ComputeException(String message, Throwable cause, Object... args) {
+ super(message, cause, args);
+ }
+}
diff --git a/computer-core/src/main/java/com/baidu/hugegraph/computer/exception/ComputerException.java b/computer-core/src/main/java/com/baidu/hugegraph/computer/exception/ComputerException.java
new file mode 100644
index 000000000..15aeee167
--- /dev/null
+++ b/computer-core/src/main/java/com/baidu/hugegraph/computer/exception/ComputerException.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2017 HugeGraph Authors
+ *
+ * Licensed to the Apache Software Foundation (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.computer.exception;
+
+/**
+ * The base class for all exception types
+ */
+public class ComputerException extends RuntimeException {
+
+ private static final long serialVersionUID = 3621207523020113277L;
+
+ public ComputerException(String message) {
+ super(message);
+ }
+
+ public ComputerException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ComputerException(String message, Object... args) {
+ super(String.format(message, args));
+ }
+
+ public ComputerException(String message, Throwable cause, Object... args) {
+ super(String.format(message, args), cause);
+ }
+
+ public Throwable rootCause() {
+ return rootCause(this);
+ }
+
+ public static Throwable rootCause(Throwable e) {
+ Throwable cause = e;
+ while (cause.getCause() != null) {
+ cause = cause.getCause();
+ }
+ return cause;
+ }
+}
diff --git a/computer-core/src/main/java/com/baidu/hugegraph/computer/exception/IllegalArgException.java b/computer-core/src/main/java/com/baidu/hugegraph/computer/exception/IllegalArgException.java
new file mode 100644
index 000000000..bae3824fd
--- /dev/null
+++ b/computer-core/src/main/java/com/baidu/hugegraph/computer/exception/IllegalArgException.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2017 HugeGraph Authors
+ *
+ * Licensed to the Apache Software Foundation (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.computer.exception;
+
+/**
+ * A wrapper class for IllegalArgumentException
+ */
+public class IllegalArgException extends IllegalArgumentException {
+
+ private static final long serialVersionUID = 3031687162799359544L;
+
+ public IllegalArgException(String message) {
+ super(message);
+ }
+
+ public IllegalArgException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public IllegalArgException(String message, Object... args) {
+ super(String.format(message, args));
+ }
+
+ public IllegalArgException(String message, Throwable cause,
+ Object... args) {
+ super(String.format(message, args), cause);
+ }
+}
diff --git a/computer-core/src/main/java/com/baidu/hugegraph/computer/exception/ReadException.java b/computer-core/src/main/java/com/baidu/hugegraph/computer/exception/ReadException.java
new file mode 100644
index 000000000..77c3d81ae
--- /dev/null
+++ b/computer-core/src/main/java/com/baidu/hugegraph/computer/exception/ReadException.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.computer.exception;
+
+public class ReadException extends ComputerException {
+
+ private static final long serialVersionUID = 8073034531965759161L;
+
+ public ReadException(String message) {
+ super(message);
+ }
+
+ public ReadException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ReadException(String message, Object... args) {
+ super(message, args);
+ }
+
+ public ReadException(String message, Throwable cause, Object... args) {
+ super(message, cause, args);
+ }
+}
diff --git a/computer-core/src/main/java/com/baidu/hugegraph/computer/exception/WriteException.java b/computer-core/src/main/java/com/baidu/hugegraph/computer/exception/WriteException.java
new file mode 100644
index 000000000..82041c9e8
--- /dev/null
+++ b/computer-core/src/main/java/com/baidu/hugegraph/computer/exception/WriteException.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.computer.exception;
+
+public class WriteException extends ComputerException {
+
+ private static final long serialVersionUID = -1604886592292423750L;
+
+ public WriteException(String message) {
+ super(message);
+ }
+
+ public WriteException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public WriteException(String message, Object... args) {
+ super(message, args);
+ }
+
+ public WriteException(String message, Throwable cause, Object... args) {
+ super(message, cause, args);
+ }
+}
diff --git a/computer-dist/src/assembly/travis/install-env.sh b/computer-dist/src/assembly/travis/install-env.sh
new file mode 100755
index 000000000..99ce16a1e
--- /dev/null
+++ b/computer-dist/src/assembly/travis/install-env.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+set -ev
+
+TRAVIS_DIR=`dirname $0`
+
+echo "Installing requirments..."
diff --git a/computer-test/pom.xml b/computer-test/pom.xml
new file mode 100644
index 000000000..cb793edde
--- /dev/null
+++ b/computer-test/pom.xml
@@ -0,0 +1,107 @@
+
+
+
+ hugegraph-computer
+ com.baidu.hugegraph
+ 0.1.0
+
+ 4.0.0
+
+ computer-test
+
+
+
+
+ com.baidu.hugegraph
+ hugegraph-common
+
+
+ com.baidu.hugegraph
+ computer-core
+ ${project.version}
+
+
+ com.baidu.hugegraph
+ computer-algorithm
+ ${project.version}
+
+
+ com.baidu.hugegraph
+ computer-driver
+ ${project.version}
+
+
+ com.baidu.hugegraph
+ computer-yarn
+ ${project.version}
+
+
+ com.baidu.hugegraph
+ computer-k8s
+ ${project.version}
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.20
+
+
+ core-test
+
+
+ ${basedir}/src/main/java/
+
+
+ ${basedir}/target/classes/
+
+
+ **/CoreTestSuite.java
+
+
+
+
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ 0.8.4
+
+
+
+
+
+
+ pre-test
+
+ prepare-agent
+
+
+
+ post-test
+ test
+
+ report-aggregate
+
+
+ ${basedir}/../target/site/jacoco
+
+
+
+
+
+
+
+
+ src/main/resources/
+ true
+
+
+
+
diff --git a/computer-test/src/main/java/com/baidu/hugegraph/computer/core/CoreTestSuite.java b/computer-test/src/main/java/com/baidu/hugegraph/computer/core/CoreTestSuite.java
new file mode 100644
index 000000000..f635ba740
--- /dev/null
+++ b/computer-test/src/main/java/com/baidu/hugegraph/computer/core/CoreTestSuite.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.computer.core;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.slf4j.Logger;
+
+import com.baidu.hugegraph.computer.core.exception.ExceptionTest;
+import com.baidu.hugegraph.util.Log;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ ExceptionTest.class
+})
+public class CoreTestSuite {
+
+ private static final Logger LOG = Log.logger(CoreTestSuite.class);
+}
diff --git a/computer-test/src/main/java/com/baidu/hugegraph/computer/core/exception/ExceptionTest.java b/computer-test/src/main/java/com/baidu/hugegraph/computer/core/exception/ExceptionTest.java
new file mode 100644
index 000000000..dc438d8ac
--- /dev/null
+++ b/computer-test/src/main/java/com/baidu/hugegraph/computer/core/exception/ExceptionTest.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2017 HugeGraph Authors
+ *
+ * Licensed to the Apache Software Foundation (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.computer.core.exception;
+
+import java.io.IOException;
+import java.nio.charset.IllegalCharsetNameException;
+
+import org.junit.Test;
+
+import com.baidu.hugegraph.computer.exception.ComputerException;
+import com.baidu.hugegraph.testutil.Assert;
+
+public class ExceptionTest {
+
+ @Test
+ public void testComputerException() {
+ Assert.assertThrows(ComputerException.class, () -> {
+ throw new ComputerException("computer exception");
+ }, e -> {
+ Assert.assertEquals("computer exception", e.getMessage());
+ Assert.assertNull(e.getCause());
+ });
+
+ Assert.assertThrows(ComputerException.class, () -> {
+ throw new ComputerException("computer exception",
+ new IOException());
+ }, e -> {
+ Assert.assertEquals("computer exception", e.getMessage());
+ Assert.assertEquals(IOException.class, e.getCause().getClass());
+ });
+
+ Assert.assertThrows(ComputerException.class, () -> {
+ throw new ComputerException("computer exception at step %s", 1);
+ }, e -> {
+ Assert.assertEquals("computer exception at step 1",
+ e.getMessage());
+ Assert.assertNull(e.getCause());
+ });
+
+ Assert.assertThrows(ComputerException.class, () -> {
+ throw new ComputerException("computer exception at step %s",
+ new IOException(), 1);
+ }, e -> {
+ Assert.assertEquals("computer exception at step 1",
+ e.getMessage());
+ Assert.assertEquals(IOException.class, e.getCause().getClass());
+ });
+
+
+ Throwable rootCause = new IllegalCharsetNameException("invalid");
+ Assert.assertThrows(ComputerException.class, () -> {
+ throw new ComputerException("computer exception",
+ new IOException(rootCause));
+ }, e -> {
+ Assert.assertEquals("computer exception", e.getMessage());
+ Assert.assertEquals(IOException.class, e.getCause().getClass());
+ Assert.assertEquals(rootCause, ComputerException.rootCause(e));
+ });
+ }
+}
diff --git a/pom.xml b/pom.xml
index a761d873c..4118973ad 100644
--- a/pom.xml
+++ b/pom.xml
@@ -42,6 +42,7 @@
computer-yarn
computer-k8s
computer-dist
+ computer-test
@@ -115,4 +116,31 @@
+
+
+
+ core-test
+
+ true
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.20
+
+
+ core-test
+
+ test
+
+ test
+
+
+
+
+
+
+