Skip to content

Commit e0b972c

Browse files
committed
First commit
0 parents  commit e0b972c

58 files changed

Lines changed: 4335 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/main.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: main
2+
on:
3+
push:
4+
branches: [ main ]
5+
pull_request:
6+
branches: [ main ]
7+
workflow_dispatch:
8+
jobs:
9+
run-tests:
10+
runs-on: ubuntu-latest
11+
continue-on-error: false
12+
strategy:
13+
fail-fast: true
14+
matrix:
15+
java: [ '8' ]
16+
steps:
17+
- name: Checkout source code
18+
uses: actions/checkout@v3
19+
with:
20+
persist-credentials: false
21+
- name: Install JDK ${{ matrix.java }}
22+
uses: actions/setup-java@v3
23+
with:
24+
architecture: 'x64'
25+
distribution: 'temurin'
26+
java-version: ${{ matrix.java }}
27+
cache: 'maven'
28+
- name: Run unit tests
29+
run: |
30+
mvn -V -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false \
31+
-Dmaven.wagon.httpconnectionManager.ttlSeconds=120 --no-transfer-progress \
32+
clean test
33+
- name: Run integration tests
34+
run: |
35+
mvn -V -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false \
36+
-Dmaven.wagon.httpconnectionManager.ttlSeconds=120 --no-transfer-progress \
37+
clean test -Pint

.gitignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
.settings/
2+
.idea/
3+
.vscode/
4+
.mvn/
5+
.gradle/
6+
build/
7+
target/
8+
gradle/
9+
tmp/
10+
.project
11+
.classpath
12+
.factorypath
13+
.DS_Store
14+
mvnw
15+
mvnw.cmd
16+
gradlew
17+
gradlew.bat
18+
*.log
19+
*.log.*
20+
*.class
21+
*.jar
22+
*.out
23+
*.iml
24+
*.hprof
25+
*.cap
26+
*.jks
27+
*.p12
28+
*.crt
29+
*.pem
30+
*.der

.plugins/assembly/assembly.xml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<assembly>
3+
<id>bin</id>
4+
<formats>
5+
<format>zip</format>
6+
<format>tar.gz</format>
7+
</formats>
8+
<fileSets>
9+
<fileSet>
10+
<directory>${project.build.directory}</directory>
11+
<outputDirectory>lib</outputDirectory>
12+
<includes>
13+
<include>*.jar</include>
14+
</includes>
15+
</fileSet>
16+
<fileSet>
17+
<directory>${project.build.directory}/classes</directory>
18+
<outputDirectory>etc</outputDirectory>
19+
<includes>
20+
<include>templates/*</include>
21+
<include>application.properties</include>
22+
</includes>
23+
</fileSet>
24+
<fileSet>
25+
<directory>${project.basedir}/.plugins/assembly</directory>
26+
<outputDirectory>bin</outputDirectory>
27+
<includes>
28+
<include>repgen.sh</include>
29+
</includes>
30+
</fileSet>
31+
<fileSet>
32+
<directory>${project.basedir}</directory>
33+
<outputDirectory></outputDirectory>
34+
<includes>
35+
<include>LICENSE</include>
36+
</includes>
37+
</fileSet>
38+
</fileSets>
39+
</assembly>

.plugins/assembly/repgen.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/usr/bin/env bash
2+
set -Eeuo pipefail
3+
error() {
4+
echo "$@" 1>&2 && exit 1
5+
}
6+
for x in sed java; do
7+
if ! command -v "$x" &>/dev/null; then
8+
error "Missing required utility: $x"
9+
fi
10+
done
11+
12+
# sed non-printable text delimiter
13+
SD=$(echo -en "\001") && readonly SD
14+
15+
HOME_DIR="" && pushd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" >/dev/null \
16+
&& { HOME_DIR="$PWD/.."; popd >/dev/null; } && readonly HOME_DIR
17+
18+
start() {
19+
echo "Starting"
20+
mkdir -p "$HOME_DIR"/data
21+
local config="$HOME_DIR/etc/application.properties"
22+
sed -i "s${SD}templateHome = .*${SD}templateHome = $HOME_DIR/etc/templates${SD}g" "$config"
23+
sed -i "s${SD}databaseHome = .*${SD}databaseHome = $HOME_DIR/data/h2/repgen${SD}g" "$config"
24+
nohup java -Xms5g -Xmx5g -XX:+UseG1GC -Djava.security.egd=file:/dev/urandom -DlogsDir="$HOME_DIR"/data/logs \
25+
-jar "$HOME_DIR"/lib/repgen-*.jar --spring.config.location="$config" >/dev/null 2>&1 &
26+
echo $! > "$HOME_DIR"/data/repgen.pid
27+
echo "Started"
28+
}
29+
30+
stop() {
31+
echo "Stopping"
32+
kill -TERM "$(cat "$HOME_DIR"/data/repgen.pid)"
33+
echo "Stopped"
34+
}
35+
36+
readonly USAGE="
37+
Usage: $0 [command]
38+
39+
start Start the server
40+
stop Stop the server
41+
"
42+
readonly COMMAND="${1-}"
43+
if [[ -z "$COMMAND" ]]; then
44+
error "$USAGE"
45+
else
46+
if (declare -F "$COMMAND" >/dev/null); then
47+
"$COMMAND"
48+
else
49+
error "Invalid command"
50+
fi
51+
fi

.plugins/checkstyle/checkstyle.xml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://checkstyle.sourceforge.net/dtds/configuration_1_3.dtd">
3+
<module name="Checker">
4+
5+
<property name="localeLanguage" value="en" />
6+
<module name="FileTabCharacter" />
7+
<module name="SuppressWarningsFilter" />
8+
9+
<!-- header -->
10+
<module name="RegexpHeader">
11+
<property name="header" value="^\/\*$\n^\s\*\sCopyright\sFederico\sValeri\.$\n^\s\*\sLicense:\sApache\sLicense\s2\.0\s\(see\sthe\sfile\sLICENSE\)\.$\n^\s\*\/$"/>
12+
<property name="fileExtensions" value="java"/>
13+
</module>
14+
15+
<module name="TreeWalker">
16+
<!-- code cleanup -->
17+
<module name="UnusedImports">
18+
<property name="processJavadoc" value="true" />
19+
</module>
20+
<module name="RedundantImport" />
21+
<module name="IllegalImport" />
22+
<module name="EqualsHashCode" />
23+
<module name="SimplifyBooleanExpression" />
24+
<module name="OneStatementPerLine" />
25+
<module name="UnnecessaryParentheses" />
26+
<module name="SimplifyBooleanReturn" />
27+
28+
<!-- style -->
29+
<module name="DefaultComesLast" />
30+
<module name="EmptyStatement" />
31+
<module name="ArrayTypeStyle" />
32+
<module name="UpperEll" />
33+
<module name="LeftCurly" />
34+
<module name="RightCurly" />
35+
<module name="EmptyStatement" />
36+
<module name="ConstantName">
37+
<property name="format" value="(^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$)|(^log$)" />
38+
</module>
39+
<module name="LocalVariableName" />
40+
<module name="LocalFinalVariableName" />
41+
<module name="MemberName" />
42+
<module name="ClassTypeParameterName">
43+
<property name="format" value="^[A-Z][a-zA-Z0-9]*$$" />
44+
</module>
45+
<module name="MethodTypeParameterName">
46+
<property name="format" value="^[A-Z][a-zA-Z0-9]*$$" />
47+
</module>
48+
<module name="InterfaceTypeParameterName">
49+
<property name="format" value="^[A-Z][a-zA-Z0-9]*$$" />
50+
</module>
51+
<module name="PackageName" />
52+
<module name="ParameterName" />
53+
<module name="StaticVariableName" />
54+
<module name="TypeName" />
55+
<module name="AvoidStarImport" />
56+
57+
<!-- dependencies -->
58+
<!--<module name="ImportControl">
59+
<property name="file" value="${importControlFile}"/>
60+
</module>-->
61+
62+
<!-- whitespace -->
63+
<module name="GenericWhitespace" />
64+
<module name="NoWhitespaceBefore" />
65+
<module name="WhitespaceAfter" />
66+
<module name="NoWhitespaceAfter" />
67+
<module name="WhitespaceAround">
68+
<property name="allowEmptyConstructors" value="true" />
69+
<property name="allowEmptyMethods" value="true" />
70+
</module>
71+
<module name="Indentation" />
72+
<module name="MethodParamPad" />
73+
<module name="ParenPad" />
74+
<module name="TypecastParenPad" />
75+
76+
<!-- locale-sensitive methods should specify locale -->
77+
<module name="Regexp">
78+
<property name="format" value="\.to(Lower|Upper)Case\(\)" />
79+
<property name="illegalPattern" value="true" />
80+
<property name="ignoreComments" value="true" />
81+
</module>
82+
83+
<!-- code quality -->
84+
<module name="MethodLength" />
85+
<module name="ParameterNumber">
86+
<!-- default is 8 -->
87+
<property name="max" value="13" />
88+
</module>
89+
<module name="ClassDataAbstractionCoupling">
90+
<!-- default is 7 -->
91+
<property name="max" value="20" />
92+
</module>
93+
<module name="BooleanExpressionComplexity">
94+
<!-- default is 3 -->
95+
<property name="max" value="5" />
96+
</module>
97+
98+
<module name="ClassFanOutComplexity">
99+
<!-- default is 20 -->
100+
<property name="max" value="44" />
101+
</module>
102+
<module name="CyclomaticComplexity">
103+
<!-- default is 10-->
104+
<property name="max" value="19" />
105+
</module>
106+
<module name="JavaNCSS">
107+
<!-- default is 50 -->
108+
<property name="methodMaximum" value="100" />
109+
</module>
110+
<module name="NPathComplexity">
111+
<!-- default is 200 -->
112+
<property name="max" value="5832" />
113+
</module>
114+
115+
<module name="IllegalToken">
116+
<property name="tokens" value="LITERAL_ASSERT" />
117+
</module>
118+
119+
<!-- Make the @SuppressWarnings annotations available to Checkstyle -->
120+
<module name="SuppressWarningsHolder" />
121+
</module>
122+
123+
<module name="SuppressionFilter">
124+
<property name="file" value="${checkstyle.suppressions.file}" />
125+
</module>
126+
127+
<!-- Filter out Checkstyle warnings that have been suppressed with the @SuppressWarnings annotation -->
128+
<module name="SuppressWarningsFilter" />
129+
</module>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE suppressions PUBLIC "-//Puppy Crawl//DTD Suppressions 1.1//EN" "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
3+
<suppressions>
4+
5+
<!-- Note that [/\\] must be used as the path separator for cross-platform support -->
6+
<!--<suppress checks="ParameterNumber" files="com[/\\]example[/\\]MyClass.java" />-->
7+
8+
</suppressions>

.plugins/spotbugs/exclude.xml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<FindBugsFilter>
3+
<Match>
4+
<Bug pattern="DMI_HARDCODED_ABSOLUTE_FILENAME"/>
5+
</Match>
6+
<Match>
7+
<!-- this allows the use of singleton pattern -->
8+
<Bug pattern="EI_EXPOSE_REP"/>
9+
</Match>
10+
<Match>
11+
<Bug pattern="EI_EXPOSE_REP2"/>
12+
</Match>
13+
<Match>
14+
<Bug pattern="MS_EXPOSE_REP"/>
15+
</Match>
16+
<Match>
17+
<Bug pattern="MS_EXPOSE_REP2"/>
18+
</Match>
19+
<Match>
20+
<Bug pattern="EI_EXPOSE_STATIC_REP2"/>
21+
</Match>
22+
<Match>
23+
<Bug pattern="MC_OVERRIDABLE_METHOD_CALL_IN_CONSTRUCTOR"/>
24+
</Match>
25+
<Match>
26+
<!-- java11 build throws false positives: https://github.com/spotbugs/spotbugs/issues/811 -->
27+
<Bug pattern="UPM_UNCALLED_PRIVATE_METHOD"/>
28+
</Match>
29+
</FindBugsFilter>

0 commit comments

Comments
 (0)