Skip to content

Commit bd941d9

Browse files
authored
Merge pull request #15 from dist-sys/refactor_v0.7.1
Refactor v0.7.1
2 parents c9e3787 + 2946dc7 commit bd941d9

19 files changed

+655
-269
lines changed

build.gradle

+8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ plugins {
33
id 'application'
44
}
55

6+
wrapper {
7+
gradleVersion = '6.6.1'
8+
}
9+
610
mainClassName = 'mqttloader.Loader'
711
applicationDefaultJvmArgs = ['-Djava.util.logging.config.file=src/dist/logging.properties', '-Dfile.encoding=UTF-8', '--illegal-access=deny']
812

@@ -17,6 +21,10 @@ dependencies {
1721
implementation group: 'commons-net', name: 'commons-net', version: '3.7'
1822
}
1923

24+
compileJava {
25+
options.release = 8
26+
}
27+
2028
run {
2129
args '-h'.split('\\s+')
2230
}

doc/usage_en.md

+17-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# MQTTLoader usage
1+
# MQTTLoader usage (v0.7.2)
22
MQTTLoader is a load testing tool (client tool) for MQTT.
33
It supports both MQTT v5.0 and v3.1.1.
44

55
## 1. Environment requirements
66
MQTTLoader is available on Windows, MacOS, Ubuntu Linux or any platforms that supports Java.
7-
It requires Java SE 14.0.1 or later.
7+
It requires Java SE 8 or later.
88
Older versions might work, but are not tested.
99

1010
## 2. Download and run
@@ -197,10 +197,11 @@ To build MQTTLoader, JDK and Gradle with the following versions are required.
197197

198198
| Software | Version |
199199
|:-----------|:------------|
200-
| JDK | 14.0.1 or later |
201-
| Gradle | 4.9 or later |
200+
| JDK | 8 or later |
201+
| Gradle | 6.6 or later |
202202

203-
Older versions might work, but are not tested.
203+
Older versions might work, but are not tested.
204+
This repository has Gradle Wrapper, so that the required version of Gradle will be automatically installed when usin gradlew command in the following steps.
204205

205206
### 5-b. Download
206207
Clone the MQTTLoader repository from GitHub: `$ git clone [email protected]:dist-sys/mqttloader.git`
@@ -209,20 +210,26 @@ The structure of the directories/files is as follows:
209210
```
210211
mqttloader/
211212
+-- doc/
213+
+-- gradle/
212214
+-- src/
215+
+-- .gitignore
213216
+-- build.gradle
217+
+-- gradlew
218+
+-- gradlew.bat
214219
:
215220
```
216221

217222
Hereafter, the name of the root directory, where the file `build.gradle` exists, is denoted as *\<ROOT_DIR\>*.
218223

219224
### 5-c. Build
220-
Open a terminal software (e.g., xterm, command prompt, etc.) and you can build by the following Gradle command.
225+
Open a terminal software (e.g., xterm, command prompt, etc.) and you can build by the following gradlew command.
221226
```
222227
$ cd <ROOT_DIR>
223-
$ gradle build
228+
$ ./gradlew build
224229
```
225230

231+
For Windows users, please use `gradlew.bat` instead of `./gradlew`.
232+
When using gradlew command first time, it may take time because the required version of Gradle is automatically downloaded.
226233
If successful, *build* directory is created under *\<ROOT_DIR\>*.
227234
You can find *distributions* directory under the *build* directory.
228235

@@ -236,7 +243,7 @@ You can find *distributions* directory under the *build* directory.
236243
By extracting the archive file (tar or zip), you can get the binary files of MQTTLoader.
237244

238245
### 5-d. Run MQTTLoader with Gradle
239-
You can run MQTTLoader by using Gradle command.
246+
You can run MQTTLoader by using gradlew command.
240247

241248
In *\<ROOT_DIR\>/build.gradle*, the execution parameters are stated in the following part:
242249

@@ -254,6 +261,6 @@ run {
254261
}
255262
```
256263

257-
Then, by using the following Gradle command in *\<ROOT_DIR\>*, you can run MQTTLoader.
264+
Then, by using the following gradlew command in *\<ROOT_DIR\>*, you can run MQTTLoader.
258265

259-
`$ gradle run`
266+
`$ ./gradlew run`

doc/usage_jp.md

+16-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# MQTTLoader 利用方法
1+
# MQTTLoader 利用方法 (v0.7.2)
22
MQTTLoaderは、MQTT v5.0とv3.1.1に対応した負荷テストツール(クライアントツール)です。
33

44
## 1. 環境要件
55
MQTTLoader は Java を利用可能なOS(Windows, MacOS, Ubuntu Linux等)上で動きます。
6-
Java SE 14.0.1 以降での動作を確認しています。(それより前のバージョンでの動作は未確認です
6+
Java SE 8以降で動作します。(より古いバージョンでの動作は未確認です。
77

88
## 2. ダウンロード&実行
99
以下のURLからアーカイブファイル(zip or tar)をダウンロードできます。
@@ -197,10 +197,11 @@ MQTTLoaderのビルドには、以下バージョンのJDKとGradleが必要で
197197

198198
| Software | Version |
199199
|:-----------|:------------|
200-
| JDK | 14.0.1 or later |
201-
| Gradle | 4.9 or later |
200+
| JDK | 8 or later |
201+
| Gradle | 6.6 or later |
202202

203-
上記より前のバージョンでの動作は未確認です。
203+
上記より前のバージョンでの動作は未確認です。
204+
なお、Gradle wrapperを用意してあるため、以降の手順でgradlewコマンドを使う際に、Gradleは自動的にインストールされます。
204205

205206
### 5-b. ダウンロード
206207
GitHubからクローンしてください: `$ git clone [email protected]:dist-sys/mqttloader.git`
@@ -209,8 +210,12 @@ GitHubからクローンしてください: `$ git clone [email protected]:dist-s
209210
```
210211
mqttloader/
211212
+-- doc/
213+
+-- gradle/
212214
+-- src/
215+
+-- .gitignore
213216
+-- build.gradle
217+
+-- gradlew
218+
+-- gradlew.bat
214219
:
215220
```
216221

@@ -221,9 +226,11 @@ mqttloader/
221226

222227
```
223228
$ cd <ROOT_DIR>
224-
$ gradle build
229+
$ ./gradlew build
225230
```
226231

232+
Windowsユーザは、 `./gradlew` の代わりに `gradlew.bat` を使ってください(以降も同じ)。
233+
gradlewコマンドを初めて実行する際には、Gradleが自動的にダウンロードされるため、少し時間がかかります。
227234
成功すると、*\<ROOT_DIR\>* 配下に *build* ディレクトリが生成されます。
228235

229236
```
@@ -237,7 +244,7 @@ $ gradle build
237244
*distributions* ディレクトリに入っているアーカイブファイル(tar または zip)を解凍することで、MQTTLoaderのバイナリが得られます。
238245

239246
### 5-d. GradleによるMQTTLoaderの実行
240-
Gradleコマンドを使ってMQTTLoaderを実行することもできます
247+
gradlewコマンドを使ってMQTTLoaderを実行することもできます
241248

242249
*\<ROOT_DIR\>/build.gradle* 内の以下の箇所に、実行時オプションが記述されています。
243250

@@ -255,6 +262,6 @@ run {
255262
}
256263
```
257264

258-
上記のように *build.gradle* にオプションを記述した上で、 *\<ROOT_DIR\>* にて以下のGradleコマンドを実行することで、MQTTLoaderを実行できます。
265+
上記のように *build.gradle* にオプションを記述した上で、 *\<ROOT_DIR\>* にて以下のgradlewコマンドを実行することで、MQTTLoaderを実行できます。
259266

260-
`$ gradle run`
267+
`$ ./gradlew run`

gradle/wrapper/gradle-wrapper.jar

57.8 KB
Binary file not shown.
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

gradlew

+185
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
#!/usr/bin/env sh
2+
3+
#
4+
# Copyright 2015 the original author or authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# https://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
19+
##############################################################################
20+
##
21+
## Gradle start up script for UN*X
22+
##
23+
##############################################################################
24+
25+
# Attempt to set APP_HOME
26+
# Resolve links: $0 may be a link
27+
PRG="$0"
28+
# Need this for relative symlinks.
29+
while [ -h "$PRG" ] ; do
30+
ls=`ls -ld "$PRG"`
31+
link=`expr "$ls" : '.*-> \(.*\)$'`
32+
if expr "$link" : '/.*' > /dev/null; then
33+
PRG="$link"
34+
else
35+
PRG=`dirname "$PRG"`"/$link"
36+
fi
37+
done
38+
SAVED="`pwd`"
39+
cd "`dirname \"$PRG\"`/" >/dev/null
40+
APP_HOME="`pwd -P`"
41+
cd "$SAVED" >/dev/null
42+
43+
APP_NAME="Gradle"
44+
APP_BASE_NAME=`basename "$0"`
45+
46+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48+
49+
# Use the maximum available, or set MAX_FD != -1 to use that value.
50+
MAX_FD="maximum"
51+
52+
warn () {
53+
echo "$*"
54+
}
55+
56+
die () {
57+
echo
58+
echo "$*"
59+
echo
60+
exit 1
61+
}
62+
63+
# OS specific support (must be 'true' or 'false').
64+
cygwin=false
65+
msys=false
66+
darwin=false
67+
nonstop=false
68+
case "`uname`" in
69+
CYGWIN* )
70+
cygwin=true
71+
;;
72+
Darwin* )
73+
darwin=true
74+
;;
75+
MINGW* )
76+
msys=true
77+
;;
78+
NONSTOP* )
79+
nonstop=true
80+
;;
81+
esac
82+
83+
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84+
85+
86+
# Determine the Java command to use to start the JVM.
87+
if [ -n "$JAVA_HOME" ] ; then
88+
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89+
# IBM's JDK on AIX uses strange locations for the executables
90+
JAVACMD="$JAVA_HOME/jre/sh/java"
91+
else
92+
JAVACMD="$JAVA_HOME/bin/java"
93+
fi
94+
if [ ! -x "$JAVACMD" ] ; then
95+
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96+
97+
Please set the JAVA_HOME variable in your environment to match the
98+
location of your Java installation."
99+
fi
100+
else
101+
JAVACMD="java"
102+
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103+
104+
Please set the JAVA_HOME variable in your environment to match the
105+
location of your Java installation."
106+
fi
107+
108+
# Increase the maximum file descriptors if we can.
109+
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110+
MAX_FD_LIMIT=`ulimit -H -n`
111+
if [ $? -eq 0 ] ; then
112+
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113+
MAX_FD="$MAX_FD_LIMIT"
114+
fi
115+
ulimit -n $MAX_FD
116+
if [ $? -ne 0 ] ; then
117+
warn "Could not set maximum file descriptor limit: $MAX_FD"
118+
fi
119+
else
120+
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121+
fi
122+
fi
123+
124+
# For Darwin, add options to specify how the application appears in the dock
125+
if $darwin; then
126+
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127+
fi
128+
129+
# For Cygwin or MSYS, switch paths to Windows format before running java
130+
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131+
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132+
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133+
134+
JAVACMD=`cygpath --unix "$JAVACMD"`
135+
136+
# We build the pattern for arguments to be converted via cygpath
137+
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138+
SEP=""
139+
for dir in $ROOTDIRSRAW ; do
140+
ROOTDIRS="$ROOTDIRS$SEP$dir"
141+
SEP="|"
142+
done
143+
OURCYGPATTERN="(^($ROOTDIRS))"
144+
# Add a user-defined pattern to the cygpath arguments
145+
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146+
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147+
fi
148+
# Now convert the arguments - kludge to limit ourselves to /bin/sh
149+
i=0
150+
for arg in "$@" ; do
151+
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152+
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153+
154+
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155+
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156+
else
157+
eval `echo args$i`="\"$arg\""
158+
fi
159+
i=`expr $i + 1`
160+
done
161+
case $i in
162+
0) set -- ;;
163+
1) set -- "$args0" ;;
164+
2) set -- "$args0" "$args1" ;;
165+
3) set -- "$args0" "$args1" "$args2" ;;
166+
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167+
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168+
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169+
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170+
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171+
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172+
esac
173+
fi
174+
175+
# Escape application args
176+
save () {
177+
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178+
echo " "
179+
}
180+
APP_ARGS=`save "$@"`
181+
182+
# Collect all arguments for the java command, following the shell quoting and substitution rules
183+
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184+
185+
exec "$JAVACMD" "$@"

0 commit comments

Comments
 (0)