Code review on NLPCRAFT-381
diff --git a/nlpcraft-examples/alarm/pom.xml b/nlpcraft-examples/alarm/pom.xml
index 0f6af79..9856392 100644
--- a/nlpcraft-examples/alarm/pom.xml
+++ b/nlpcraft-examples/alarm/pom.xml
@@ -21,7 +21,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <name>NLPCraft example Alarm</name>
+ <name>NLPCraft Example Alarm</name>
<artifactId>nlpcraft-example-alarm</artifactId>
<parent>
diff --git a/nlpcraft-examples/echo/pom.xml b/nlpcraft-examples/echo/pom.xml
index 9474274..1d057f1 100644
--- a/nlpcraft-examples/echo/pom.xml
+++ b/nlpcraft-examples/echo/pom.xml
@@ -21,7 +21,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <name>NLPCraft example Echo</name>
+ <name>NLPCraft Example Echo</name>
<artifactId>nlpcraft-example-echo</artifactId>
<parent>
diff --git a/nlpcraft-examples/helloworld/pom.xml b/nlpcraft-examples/helloworld/pom.xml
index 72ab825..441f825 100644
--- a/nlpcraft-examples/helloworld/pom.xml
+++ b/nlpcraft-examples/helloworld/pom.xml
@@ -21,7 +21,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <name>NLPCraft example Hello World</name>
+ <name>NLPCraft Example Hello World</name>
<artifactId>nlpcraft-example-helloworld</artifactId>
<parent>
diff --git a/nlpcraft-examples/lightswitch/pom.xml b/nlpcraft-examples/lightswitch/pom.xml
index 327da62..0ebbf8a 100644
--- a/nlpcraft-examples/lightswitch/pom.xml
+++ b/nlpcraft-examples/lightswitch/pom.xml
@@ -21,7 +21,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <name>NLPCraft example Light Switch</name>
+ <name>NLPCraft Example Light Switch</name>
<artifactId>nlpcraft-example-lightswitch</artifactId>
<parent>
diff --git a/nlpcraft-examples/phone/pom.xml b/nlpcraft-examples/phone/pom.xml
index cf29107..c6a8d39 100644
--- a/nlpcraft-examples/phone/pom.xml
+++ b/nlpcraft-examples/phone/pom.xml
@@ -21,7 +21,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <name>NLPCraft example Phone</name>
+ <name>NLPCraft Example Phone</name>
<artifactId>nlpcraft-example-phone</artifactId>
<parent>
diff --git a/nlpcraft-examples/sql/pom.xml b/nlpcraft-examples/sql/pom.xml
index b1ab75e..51754b6 100644
--- a/nlpcraft-examples/sql/pom.xml
+++ b/nlpcraft-examples/sql/pom.xml
@@ -21,7 +21,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <name>NLPCraft example SQL</name>
+ <name>NLPCraft Example SQL</name>
<artifactId>nlpcraft-example-sql</artifactId>
<parent>
diff --git a/nlpcraft-examples/weather/pom.xml b/nlpcraft-examples/weather/pom.xml
index 2d465c6..4e668a0 100644
--- a/nlpcraft-examples/weather/pom.xml
+++ b/nlpcraft-examples/weather/pom.xml
@@ -21,7 +21,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <name>NLPCraft example Weather</name>
+ <name>NLPCraft Example Weather</name>
<artifactId>nlpcraft-example-weather</artifactId>
<parent>
diff --git a/nlpcraft-tests/cli/pom.xml b/nlpcraft-tests/cli/pom.xml
index 0c8f8bb..0515ff0 100644
--- a/nlpcraft-tests/cli/pom.xml
+++ b/nlpcraft-tests/cli/pom.xml
@@ -65,7 +65,7 @@
<configuration>
<skip>true</skip>
<environmentVariables>
- <DNLPCRAFT_CLI_TEST_ENABLED>true</DNLPCRAFT_CLI_TEST_ENABLED>
+ <NLPCRAFT_CLI_TEST_ENABLED>true</NLPCRAFT_CLI_TEST_ENABLED>
</environmentVariables>
</configuration>
<executions>
diff --git a/nlpcraft-tests/cli/src/test/java/org/apache/nlpcraft/model/tools/cmdline/NCCliSpec.scala b/nlpcraft-tests/cli/src/test/java/org/apache/nlpcraft/model/tools/cmdline/NCCliSpec.scala
index 77b6841..7090221 100644
--- a/nlpcraft-tests/cli/src/test/java/org/apache/nlpcraft/model/tools/cmdline/NCCliSpec.scala
+++ b/nlpcraft-tests/cli/src/test/java/org/apache/nlpcraft/model/tools/cmdline/NCCliSpec.scala
@@ -28,16 +28,21 @@
/**
* This test designed only for maven tests ('mvn clean verify')
- * - Project target folder should contains built jars.
+ * - Project target folder should contains built JARs.
* - This test cannot be started together with other server instances.
*/
class NCCliSpec {
- private lazy val SKIP = !U.isSysEnvSet("DNLPCRAFT_CLI_TEST_ENABLED")
+ private lazy val SKIP = !U.isSysEnvSet("NLPCRAFT_CLI_TEST_ENABLED")
- private var dirBin: File = _
- private var script: File = _
+ private var dirBin: File = _
+ private var script: File = _
private var allDepsJar: File = _
+ /**
+ *
+ * @param process
+ * @param listener
+ */
case class ProcessWrapper(process: Process, listener: Thread) {
def destroy(): Unit = {
process.destroy()
@@ -45,6 +50,9 @@
}
}
+ /**
+ *
+ */
@BeforeEach
def before(): Unit = {
if (SKIP)
@@ -64,18 +72,26 @@
override def accept(f: File): Boolean = f.isFile && f.getName.toLowerCase().endsWith("all-deps.jar")
})
- require(jars != null && jars.length == 1, s"Required jar file not found in ${dirTarget.getAbsolutePath}")
+ require(jars != null && jars.length == 1, s"Required JAR file not found in ${dirTarget.getAbsolutePath}")
jars.head
}
}
- private def start(arg: String, timeoutSecs: Int, expectedLines: String*): ProcessWrapper = {
+ /**
+ *
+ * @param args
+ * @param timeoutSecs
+ * @param expectedLines
+ * @return
+ */
+ private def start(args: String, timeoutSecs: Int, expectedLines: String*): ProcessWrapper = {
+ val argsSeq = args.split(" ").toSeq
val scriptArgs =
if (SystemUtils.IS_OS_UNIX)
- Seq("bash", "-f", script.getAbsolutePath, arg)
+ Seq("bash", "-f", script.getAbsolutePath) ++ argsSeq
else
- Seq(script.getAbsolutePath, arg)
+ Seq(script.getAbsolutePath) ++ argsSeq
val builder =
new ProcessBuilder(scriptArgs: _*).
@@ -98,13 +114,13 @@
if (expectedLines.exists(line.contains)) {
isStarted = true
- println(s"$arg started fine. Expected line found: '$line'")
+ println(s"'$args' started fine. Expected line found: '$line'")
println()
cdl.countDown()
}
else {
- println(s"($arg) $line")
+ println(s"($args) $line")
line = reader.readLine()
}
@@ -121,12 +137,15 @@
if (!isStarted) {
wrapper.destroy()
- throw new RuntimeException(s"Command cannot be started: $arg")
+ throw new RuntimeException(s"Command cannot be started: $args")
}
wrapper
}
+ /**
+ *
+ */
@Test
def test(): Unit = {
if (SKIP) {
@@ -139,16 +158,16 @@
def stopInstances(): Unit = {
// Both variant (stopped or already stopped) are fine.
- procs += start("stop-server", 10, "has been stopped", "Local server not found")
- procs += start("stop-probe", 10, "has been stopped", "Local probe not found")
+ procs += start("stop-server no-logo no-ansi", 10, "has been stopped", "Local server not found")
+ procs += start("stop-probe no-logo no-ansi", 10, "has been stopped", "Local probe not found")
}
try {
stopInstances()
- procs += start("start-server", 120, "Started on")
- procs += start("start-probe", 30, "Started on")
- procs += start("info", 10, "Local server")
+ procs += start("start-server no-logo no-ansi", 120, "Started on")
+ procs += start("start-probe no-logo no-ansi", 30, "Started on")
+ procs += start("info no-logo no-ansi", 10, "Local server")
}
finally
try