Skip to content

Commit

Permalink
improve
Browse files Browse the repository at this point in the history
  • Loading branch information
Linary committed Aug 1, 2019
1 parent cc98dbd commit 950c312
Show file tree
Hide file tree
Showing 41 changed files with 481 additions and 280 deletions.
32 changes: 32 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
language: java

jdk:
- openjdk8

sudo: required

cache:
directories:
- $HOME/.m2
- $HOME/downloads

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

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

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

script:
- mvn test -Punit

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

env:
global:
- TRAVIS_DIR=hubble-be/assembly/travis
14 changes: 7 additions & 7 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Apache License

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction,
"License" shall mean the conditions 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
Expand Down Expand Up @@ -63,14 +63,14 @@ Apache License
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
2. Grant of Copyright License. Subject to the conditions 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
3. Grant of Patent License. Subject to the conditions 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,
Expand Down Expand Up @@ -121,18 +121,18 @@ Apache License
as modifying the License.

You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
may provide additional or different license conditions 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.
by You to the Licensor shall be under the conditions and conditions of
this License, without any additional conditions or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
the conditions 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
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# hugegraph-hubble

[![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-hubble.svg?branch=master)](https://travis-ci.org/hugegraph/hugegraph-hubble)
[![codecov](https://codecov.io/gh/hugegraph/hugegraph-hubble/branch/master/graph/badge.svg)](https://codecov.io/gh/hugegraph/hugegraph-hubble)

hugegraph-hubble is a graph management and analysis platform that provides features: graph data load, schema management, graph relationship analysis and graphical display.

## Features
Expand Down
54 changes: 54 additions & 0 deletions hubble-be/assembly/descriptor/assembly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<assembly>
<id>distribution</id>
<includeBaseDirectory>false</includeBaseDirectory>

<formats>
<format>dir</format>
</formats>

<fileSets>
<fileSet>
<directory>${assembly.static.dir}/bin</directory>
<outputDirectory>bin</outputDirectory>
<includes>
<include>*</include>
</includes>
<fileMode>755</fileMode>
</fileSet>
<fileSet>
<directory>${assembly.static.dir}</directory>
<outputDirectory>/</outputDirectory>
<filtered>false</filtered>
</fileSet>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>README*</include>
<include>LICENSE*</include>
<include>NOTICE*</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>lib</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
</fileSets>

<dependencySets>
<!-- Code jars -->
<dependencySet>
<outputDirectory>/lib</outputDirectory>
<unpack>false</unpack>
<scope>runtime</scope>
<useProjectArtifact>false</useProjectArtifact>
<includes>
<include>*:*:jar:*</include>
</includes>
</dependencySet>
</dependencySets>

</assembly>
35 changes: 35 additions & 0 deletions hubble-be/assembly/travis/install-hugegraph.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

set -ev

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

HUBBLE_BRANCH=$1
HUGEGRAPH_BRANCH=${HUBBLE_BRANCH}

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

git clone ${HUGEGRAPH_GIT_URL} || exit 1

cd hugegraph

git checkout ${HUGEGRAPH_BRANCH} || exit 1

mvn package -DskipTests || exit 1

mv hugegraph-*.tar.gz ../

cd ../

rm -rf hugegraph

tar -zxvf hugegraph-*.tar.gz

cd hugegraph-*

bin/init-store.sh || exit 1

bin/start-hugegraph.sh || exit 1
38 changes: 37 additions & 1 deletion hubble-be/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@
</dependency>
</dependencies>

<profiles>
<profile>
<id>unit</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<test-classes>**/UnitTestSuite.java</test-classes>
</properties>
</profile>
</profiles>

<build>
<plugins>
<plugin>
Expand All @@ -93,7 +105,31 @@
<mainClass>com.baidu.hugegraph.HugeGraphHubbleApplication</mainClass>
</configuration>
</plugin>

<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.4</version>
<executions>
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>

<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,18 @@ public Response exceptionHandler(Exception e) {
.build();
}

private String handleMessage(String messageKey, Object[] args) {
private String handleMessage(String message, Object[] args) {
String[] strArgs = null;
if (args != null && args.length > 0) {
strArgs = new String[args.length];
for (int i = 0; i < args.length; i++) {
strArgs[i] = args[i].toString();
}
}
String msg = messageKey;
String msg = message;
try {
msg = this.messageSourceHandler.getMessage(messageKey, strArgs);
} catch (Exception e) {
msg = this.messageSourceHandler.getMessage(message, strArgs);
} catch (Throwable e) {
log.error(e.getMessage(), e);
}
return msg;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.springframework.web.servlet.support.RequestContextUtils;
import org.springframework.web.util.WebUtils;

import com.baidu.hugegraph.common.Constant;
import com.baidu.hugegraph.entity.UserInfo;
import com.baidu.hugegraph.service.UserInfoService;

Expand Down Expand Up @@ -63,12 +64,10 @@ private Locale getLocale() {
}

private UserInfo getUserInfo() {
Cookie cookie = WebUtils.getCookie(this.request, "user");
Cookie cookie = WebUtils.getCookie(this.request, Constant.COOKIE_USER);
if (cookie == null || cookie.getValue() == null) {
return null;
}
// String json = URLUtil.decode(cookie.getValue());
// return UserInfo.read(json);
String username = cookie.getValue();
return this.service.getByName(username);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ public Response beforeBodyWrite(Object body, MethodParameter returnType,
.data(body)
.build();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@ public final class Constant {

public static final Charset CHARSET = UTF_8;

public static final String PARAM_LANGUAGE = "lang";
public static final Set<String> LANGUAGES = ImmutableSet.of(
"en_US",
"zh_CN"
);

public static final String CONTROLLER_PACKAGE =
"com.baidu.hugegraph.controller";

public static final String COOKIE_USER = "user";
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class CacheConfig {

public enum Caches {

explain;
GREMLIN_QUERY_EXPLAIN;

private int maxSize = DEFAULT_MAXSIZE;
private int ttl = DEFAULT_TTL;
Expand Down

This file was deleted.

Loading

0 comments on commit 950c312

Please sign in to comment.