This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/master by this push:
new 9f72da2 Fix fior NLPCRAFT0-28.
9f72da2 is described below
commit 9f72da23eb65aa46be76163861ab7afd2c4d91cf
Author: Aaron Radzinzski <[email protected]>
AuthorDate: Sun Mar 29 14:09:19 2020 -0700
Fix fior NLPCRAFT0-28.
---
pom.xml | 57 ++++++++-
.../nlpcraft/server/rest/NCBasicRestApi.scala | 93 +++++++++------
.../nlpcraft/common/ascii/NCAsciiTableSpec.scala | 15 +--
.../common/blowfish/NCBlowfishHasherSpec.scala | 14 +--
.../nlpcraft/common/crypto/NCCipherSpec.scala | 31 ++---
.../nlpcraft/common/makro/NCMacroParserSpec.scala | 68 +++++------
.../apache/nlpcraft/common/util/NCUtilsSpec.scala | 35 +++---
.../nlpcraft/model/intent/dsl/NCDslTest.java | 16 ++-
.../intent/impl/NCIntentSolverEngineSpec.scala | 32 +++---
.../model/tools/NCSqlModelEngineSpec.scala | 65 ++++++-----
.../mgrs/nlp/enrichers/NCDefaultTestModel.scala | 2 +-
.../mgrs/nlp/enrichers/NCEnrichersTestBeans.scala | 2 +-
.../relation/NCEnricherRelationSpec.scala | 2 +-
.../enrichers/date/tools/NCDateGeneratorSpec.scala | 127 +++++++++++++--------
14 files changed, 345 insertions(+), 214 deletions(-)
diff --git a/pom.xml b/pom.xml
index 04d80cf..5456bd7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -119,6 +119,7 @@
<maven.source.plugin.ver>3.0.1</maven.source.plugin.ver>
<maven.gpg.plugin.ver>1.6</maven.gpg.plugin.ver>
<maven.nexus.staging.plugin>1.6.7</maven.nexus.staging.plugin>
+ <maven.bazaarvoice.plugin>0.9</maven.bazaarvoice.plugin>
<org.antlr4.ver>4.8</org.antlr4.ver>
<akka.http.2.11.ver>10.1.9</akka.http.2.11.ver>
<akka.stream.2.11.ver>2.5.23</akka.stream.2.11.ver>
@@ -499,13 +500,67 @@
</plugin>
<plugin>
+ <groupId>com.bazaarvoice.maven.plugins</groupId>
+ <artifactId>process-exec-maven-plugin</artifactId>
+ <version>${maven.bazaarvoice.plugin}</version>
+ <executions>
+ <execution>
+ <id>pre-integration-test</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ <configuration>
+ <name>server</name>
+
<healthcheckUrl>http://localhost:8081/api/v1/health</healthcheckUrl>
+ <waitAfterLaunch>180</waitAfterLaunch>
+ <arguments>
+ <argument>java</argument>
+ <argument>-Xmx4G</argument>
+ <argument>-Xms4G</argument>
+ <argument>-jar</argument>
+
<argument>${project.build.directory}/${project.artifactId}-${project.version}-all-deps.jar</argument>
+ <argument>-server</argument>
+ </arguments>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop-all</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop-all</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.plugin.ver}</version>
<configuration>
- <skipTests>true</skipTests>
+ <!-- Skips all tests on phase `test`. -->
+ <skip>true</skip>
</configuration>
+ <executions>
+ <!-- All tests are defined as integration. -->
+ <execution>
+ <id>integration-tests</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ <!-- Mandatory part. -->
+ <includes>
+ <include>**/*.*</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
</plugin>
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
diff --git
a/src/main/scala/org/apache/nlpcraft/server/rest/NCBasicRestApi.scala
b/src/main/scala/org/apache/nlpcraft/server/rest/NCBasicRestApi.scala
index 4071932..472b9d1 100644
--- a/src/main/scala/org/apache/nlpcraft/server/rest/NCBasicRestApi.scala
+++ b/src/main/scala/org/apache/nlpcraft/server/rest/NCBasicRestApi.scala
@@ -354,6 +354,20 @@ class NCBasicRestApi extends NCRestApi with LazyLogging
with NCOpenCensusTrace w
}
/**
+ *
+ * @return
+ */
+ protected def health$(): Route = {
+ case class Res(status: String)
+
+ implicit val resFmt: RootJsonFormat[Res] = jsonFormat1(Res)
+
+ complete {
+ Res(API_OK)
+ }
+ }
+
+ /**
*
* @return
*/
@@ -1696,42 +1710,49 @@ class NCBasicRestApi extends NCRestApi with LazyLogging
with NCOpenCensusTrace w
entity = "Unable to serve response within time limit, please
enhance your calm."
)
- corsHandler (post {
- withRequestTimeoutResponse(_ ⇒ timeoutResp) {
- path(API / "signin") { withLatency(M_SIGNIN_LATENCY_MS,
signin$) } ~
- path(API / "signout") { withLatency(M_SIGNOUT_LATENCY_MS,
signout$) } ~ {
- path(API / "cancel") { withLatency(M_CANCEL_LATENCY_MS,
cancel$) } ~
- path(API / "check") { withLatency(M_CHECK_LATENCY_MS, check$)
} ~
- path(API / "clear"/ "conversation") {
withLatency(M_CLEAR_CONV_LATENCY_MS, clear$Conversation) } ~
- path(API / "clear"/ "dialog") {
withLatency(M_CLEAR_DIALOG_LATENCY_MS, clear$Dialog) } ~
- path(API / "company"/ "add") {
withLatency(M_COMPANY_ADD_LATENCY_MS, company$Add) } ~
- path(API / "company"/ "get") {
withLatency(M_COMPANY_GET_LATENCY_MS, company$Get) } ~
- path(API / "company" / "update") {
withLatency(M_COMPANY_UPDATE_LATENCY_MS, company$Update) } ~
- path(API / "company" / "token" / "reset") {
withLatency(M_COMPANY_TOKEN_LATENCY_MS, company$Token$Reset) } ~
- path(API / "company" / "delete") {
withLatency(M_COMPANY_DELETE_LATENCY_MS, company$Delete) } ~
- path(API / "user" / "get") {
withLatency(M_USER_GET_LATENCY_MS, user$Get) } ~
- path(API / "user" / "add") {
withLatency(M_USER_ADD_LATENCY_MS, user$Add) } ~
- path(API / "user" / "update") {
withLatency(M_USER_UPDATE_LATENCY_MS, user$Update) } ~
- path(API / "user" / "delete") {
withLatency(M_USER_DELETE_LATENCY_MS, user$Delete) } ~
- path(API / "user" / "admin") {
withLatency(M_USER_ADMIN_LATENCY_MS, user$Admin) } ~
- path(API / "user" / "passwd" / "reset") {
withLatency(M_USER_PASSWD_RESET_LATENCY_MS, user$Password$Reset) } ~
- path(API / "user" / "all") {
withLatency(M_USER_ALL_LATENCY_MS, user$All) } ~
- path(API / "feedback"/ "add") {
withLatency(M_FEEDBACK_ADD_LATENCY_MS, feedback$Add) } ~
- path(API / "feedback"/ "all") {
withLatency(M_FEEDBACK_GET_LATENCY_MS, feedback$All) } ~
- path(API / "feedback" / "delete") {
withLatency(M_FEEDBACK_DELETE_LATENCY_MS, feedback$Delete) } ~
- path(API / "probe" / "all") {
withLatency(M_PROBE_ALL_LATENCY_MS, probe$All) } ~
- path(API / "ask") { withLatency(M_ASK_LATENCY_MS, ask$) } ~
- (path(API / "ask" / "sync") &
- entity(as[JsValue]) &
- optionalHeaderValueByName("User-Agent") &
- extractClientIP
- ) {
- (req, userAgentOpt, rmtAddr) ⇒
- onSuccess(withLatency(M_ASK_SYNC_LATENCY_MS,
ask$Sync(req, userAgentOpt, rmtAddr))) {
- js ⇒ complete(HttpResponse(entity =
HttpEntity(ContentTypes.`application/json`, js)))
- }
- }}
+ corsHandler (
+ get {
+ withRequestTimeoutResponse(_ ⇒ timeoutResp) {
+ path(API / "health") { health$() }
+ }
+ } ~
+ post {
+ withRequestTimeoutResponse(_ ⇒ timeoutResp) {
+ path(API / "signin") { withLatency(M_SIGNIN_LATENCY_MS,
signin$) } ~
+ path(API / "signout") { withLatency(M_SIGNOUT_LATENCY_MS,
signout$) } ~ {
+ path(API / "cancel") { withLatency(M_CANCEL_LATENCY_MS,
cancel$) } ~
+ path(API / "check") { withLatency(M_CHECK_LATENCY_MS,
check$) } ~
+ path(API / "clear"/ "conversation") {
withLatency(M_CLEAR_CONV_LATENCY_MS, clear$Conversation) } ~
+ path(API / "clear"/ "dialog") {
withLatency(M_CLEAR_DIALOG_LATENCY_MS, clear$Dialog) } ~
+ path(API / "company"/ "add") {
withLatency(M_COMPANY_ADD_LATENCY_MS, company$Add) } ~
+ path(API / "company"/ "get") {
withLatency(M_COMPANY_GET_LATENCY_MS, company$Get) } ~
+ path(API / "company" / "update") {
withLatency(M_COMPANY_UPDATE_LATENCY_MS, company$Update) } ~
+ path(API / "company" / "token" / "reset") {
withLatency(M_COMPANY_TOKEN_LATENCY_MS, company$Token$Reset) } ~
+ path(API / "company" / "delete") {
withLatency(M_COMPANY_DELETE_LATENCY_MS, company$Delete) } ~
+ path(API / "user" / "get") {
withLatency(M_USER_GET_LATENCY_MS, user$Get) } ~
+ path(API / "user" / "add") {
withLatency(M_USER_ADD_LATENCY_MS, user$Add) } ~
+ path(API / "user" / "update") {
withLatency(M_USER_UPDATE_LATENCY_MS, user$Update) } ~
+ path(API / "user" / "delete") {
withLatency(M_USER_DELETE_LATENCY_MS, user$Delete) } ~
+ path(API / "user" / "admin") {
withLatency(M_USER_ADMIN_LATENCY_MS, user$Admin) } ~
+ path(API / "user" / "passwd" / "reset") {
withLatency(M_USER_PASSWD_RESET_LATENCY_MS, user$Password$Reset) } ~
+ path(API / "user" / "all") {
withLatency(M_USER_ALL_LATENCY_MS, user$All) } ~
+ path(API / "feedback"/ "add") {
withLatency(M_FEEDBACK_ADD_LATENCY_MS, feedback$Add) } ~
+ path(API / "feedback"/ "all") {
withLatency(M_FEEDBACK_GET_LATENCY_MS, feedback$All) } ~
+ path(API / "feedback" / "delete") {
withLatency(M_FEEDBACK_DELETE_LATENCY_MS, feedback$Delete) } ~
+ path(API / "probe" / "all") {
withLatency(M_PROBE_ALL_LATENCY_MS, probe$All) } ~
+ path(API / "ask") { withLatency(M_ASK_LATENCY_MS, ask$) } ~
+ (path(API / "ask" / "sync") &
+ entity(as[JsValue]) &
+ optionalHeaderValueByName("User-Agent") &
+ extractClientIP
+ ) {
+ (req, userAgentOpt, rmtAddr) ⇒
+ onSuccess(withLatency(M_ASK_SYNC_LATENCY_MS,
ask$Sync(req, userAgentOpt, rmtAddr))) {
+ js ⇒ complete(HttpResponse(entity =
HttpEntity(ContentTypes.`application/json`, js)))
+ }
+ }}
+ }
}
- })
+ )
}
}
diff --git
a/src/test/scala/org/apache/nlpcraft/common/ascii/NCAsciiTableSpec.scala
b/src/test/scala/org/apache/nlpcraft/common/ascii/NCAsciiTableSpec.scala
index 3a73921..2b44d93 100644
--- a/src/test/scala/org/apache/nlpcraft/common/ascii/NCAsciiTableSpec.scala
+++ b/src/test/scala/org/apache/nlpcraft/common/ascii/NCAsciiTableSpec.scala
@@ -17,15 +17,14 @@
package org.apache.nlpcraft.common.ascii
-import org.scalatest.FlatSpec
+import org.junit.jupiter.api.Test
/**
* Test for ASCII text table.
*/
-class NCAsciiTableSpec extends FlatSpec {
- behavior of "ASCII table"
-
- it should "render" in {
+class NCAsciiTableSpec {
+ @Test
+ def test() {
val t = NCAsciiTable()
t.headerStyle = "leftPad: 10, rightPad: 5"
@@ -42,7 +41,8 @@ class NCAsciiTableSpec extends FlatSpec {
t.render()
}
- it should "render with sequence header" in {
+ @Test
+ def testWithSequenceHeader() {
val t = NCAsciiTable()
t.headerStyle = "leftPad: 10, rightPad: 5"
@@ -57,7 +57,8 @@ class NCAsciiTableSpec extends FlatSpec {
t.render()
}
- it should "render a very big table" in {
+ @Test
+ def testWithVeryBigTable() {
val NUM = 1000
val start = System.currentTimeMillis()
diff --git
a/src/test/scala/org/apache/nlpcraft/common/blowfish/NCBlowfishHasherSpec.scala
b/src/test/scala/org/apache/nlpcraft/common/blowfish/NCBlowfishHasherSpec.scala
index c853d21..a7529c9 100644
---
a/src/test/scala/org/apache/nlpcraft/common/blowfish/NCBlowfishHasherSpec.scala
+++
b/src/test/scala/org/apache/nlpcraft/common/blowfish/NCBlowfishHasherSpec.scala
@@ -17,15 +17,15 @@
package org.apache.nlpcraft.common.blowfish
-import org.scalatest.FlatSpec
+import org.junit.jupiter.api.Assertions.assertTrue
+import org.junit.jupiter.api.Test
/**
* Tests for Blowfish hasher.
*/
-class NCBlowfishHasherSpec extends FlatSpec {
- behavior of "Blowfish hasher"
-
- it should "properly hash password" in {
+class NCBlowfishHasherSpec {
+ @Test
+ def testWithSequenceHeader() {
val email = "[email protected]"
val passwd = "test"
@@ -37,8 +37,8 @@ class NCBlowfishHasherSpec extends FlatSpec {
val hash1 = NCBlowfishHasher.hash(passwd, salt1)
val hash2 = NCBlowfishHasher.hash(passwd, salt1)
-
- assert(hash1 == hash2)
+
+ assertTrue(hash1 == hash2)
println(s"Salt: $salt1")
println(s"Hash: $hash1")
diff --git
a/src/test/scala/org/apache/nlpcraft/common/crypto/NCCipherSpec.scala
b/src/test/scala/org/apache/nlpcraft/common/crypto/NCCipherSpec.scala
index 69d2210..d0af6c0 100644
--- a/src/test/scala/org/apache/nlpcraft/common/crypto/NCCipherSpec.scala
+++ b/src/test/scala/org/apache/nlpcraft/common/crypto/NCCipherSpec.scala
@@ -20,41 +20,42 @@ package org.apache.nlpcraft.common.crypto
import java.util.Base64
import org.apache.nlpcraft.common._
-import org.scalatest.{BeforeAndAfter, FlatSpec}
-
+import org.junit.jupiter.api.Assertions.{assertEquals, assertTrue}
+import org.junit.jupiter.api.Test
/**
* Tests for crypto and PKI support.
*/
-class NCCipherSpec extends FlatSpec with BeforeAndAfter {
- behavior of "Cipher"
-
+class NCCipherSpec {
private final val IN = "abcdefghijklmnopqrstuvwxyz0123456789"
- it should "properly encrypt and decrypt" in {
+ @Test
+ def testEncryptDecrypt() {
val s1 = NCCipher.encrypt(IN)
val s2 = NCCipher.decrypt(s1)
- assertResult(IN)(s2)
+ assertEquals(IN, s2)
}
- it should "produce different encrypted string for the same input" in {
+ @Test
+ def testDifference() {
val s1 = NCCipher.encrypt(IN)
val s2 = NCCipher.encrypt(IN)
val s3 = NCCipher.encrypt(IN)
- assert(s1 != s2)
- assert(s2 != s3)
+ assertTrue(s1 != s2)
+ assertTrue(s2 != s3)
val r1 = NCCipher.decrypt(s1)
val r2 = NCCipher.decrypt(s2)
val r3 = NCCipher.decrypt(s3)
- assertResult(r1)(IN)
- assertResult(r2)(IN)
- assertResult(r3)(IN)
+ assertEquals(IN, r1)
+ assertEquals(IN, r2)
+ assertEquals(IN, r3)
}
-
- it should "properly encrypt" in {
+
+ @Test
+ def testCorrectness() {
val buf = new StringBuilder
// Max long string.
diff --git
a/src/test/scala/org/apache/nlpcraft/common/makro/NCMacroParserSpec.scala
b/src/test/scala/org/apache/nlpcraft/common/makro/NCMacroParserSpec.scala
index 6de969b..1a77bf4 100644
--- a/src/test/scala/org/apache/nlpcraft/common/makro/NCMacroParserSpec.scala
+++ b/src/test/scala/org/apache/nlpcraft/common/makro/NCMacroParserSpec.scala
@@ -18,7 +18,8 @@
package org.apache.nlpcraft.common.makro
import org.apache.nlpcraft.common._
-import org.scalatest.FlatSpec
+import org.junit.jupiter.api.Assertions.assertTrue
+import org.junit.jupiter.api.Test
import scala.compat.Platform._
import scala.util.control.Exception._
@@ -26,9 +27,7 @@ import scala.util.control.Exception._
/**
* Tests for text parser.
*/
-class NCMacroParserSpec extends FlatSpec {
- behavior of "Text parser"
-
+class NCMacroParserSpec {
private val parser = NCMacroParser(
"<A>" → "aaa",
"<B>" → "<A> bbb",
@@ -65,8 +64,8 @@ class NCMacroParserSpec extends FlatSpec {
def testToken(txt: String, tokHead: String, tokTail: String): Unit = {
val tok = parser.nextToken(txt)
- assert(tok.get.head == tokHead)
- assert(tok.get.tail == tokTail)
+ assertTrue(tok.get.head == tokHead)
+ assertTrue(tok.get.tail == tokTail)
}
/**
@@ -75,7 +74,7 @@ class NCMacroParserSpec extends FlatSpec {
* @param exp Expected expansion strings.
*/
def testParser(txt: String, exp: Seq[String]): Unit =
- assert(parser.expand(txt).sorted == exp.sorted)
+ assertTrue(parser.expand(txt).sorted == exp.sorted)
/**
*
@@ -85,10 +84,11 @@ class NCMacroParserSpec extends FlatSpec {
def testGroup(txt: String, grps: Seq[String]): Unit = {
val elms = parser.parseGroup(txt)
- assert(grps == elms.map(_.head))
+ assertTrue(grps == elms.map(_.head))
}
-
- it should "measure performance" in {
+
+ @Test
+ def testPerformance() {
val start = currentTime
val N = 50000
@@ -100,8 +100,9 @@ class NCMacroParserSpec extends FlatSpec {
println(s"${N * 1000 / duration} ops/second.")
}
-
- it should "expand string" in {
+
+ @Test
+ def testExpand() {
// Make sure we can parse these.
parser.expand("<OF>")
parser.expand("<QTY>")
@@ -212,13 +213,14 @@ class NCMacroParserSpec extends FlatSpec {
"a c"
))
- ignoreNCE { testParser("a | b", Seq.empty); assert(false) }
- ignoreNCE { testParser("a *", Seq.empty); assert(false) }
- ignoreNCE { testParser("a}}", Seq.empty); assert(false) }
- ignoreNCE { testParser("a {a|b} *", Seq.empty); assert(false) }
+ ignoreNCE { testParser("a | b", Seq.empty); assertTrue(false) }
+ ignoreNCE { testParser("a *", Seq.empty); assertTrue(false) }
+ ignoreNCE { testParser("a}}", Seq.empty); assertTrue(false) }
+ ignoreNCE { testParser("a {a|b} *", Seq.empty); assertTrue(false) }
}
-
- it should "parse option group" in {
+
+ @Test
+ def testOptionGroup() {
testGroup("{a {b|c} | d}", Seq("a {b|c} ", " d"))
testGroup("{a|b}", Seq("a", "b"))
testGroup("{a}", Seq("a"))
@@ -227,12 +229,13 @@ class NCMacroParserSpec extends FlatSpec {
testGroup("{a {c}|b|*}", Seq("a {c}", "b", "*"))
testGroup("""{/abc.\*/|\{\*\}}""", Seq("/abc.\\*/", "\\{\\*\\}"))
- ignoreNCE { parser.parseGroup("a"); assert(false) }
- ignoreNCE { parser.parseGroup("{a"); assert(false) }
- ignoreNCE { parser.parseGroup("a}"); assert(false) }
+ ignoreNCE { parser.parseGroup("a"); assertTrue(false) }
+ ignoreNCE { parser.parseGroup("{a"); assertTrue(false) }
+ ignoreNCE { parser.parseGroup("a}"); assertTrue(false) }
}
-
- it should "parse token" in {
+
+ @Test
+ def testParseTokens() {
testToken("""a \* b""", """a \* b""", "")
testToken("""a \\\* b""", """a \\\* b""", "")
testToken("""a \{\*\*\*\} b""", """a \{\*\*\*\} b""", "")
@@ -244,20 +247,21 @@ class NCMacroParserSpec extends FlatSpec {
testToken("c{a} b", "c", "{a} b")
testToken("{{{a}}}", "{{{a}}}", "")
- ignoreNCE { parser.nextToken("a } b"); assert(false) }
- ignoreNCE { parser.nextToken("{c b"); assert(false) }
- ignoreNCE { parser.nextToken("a | b"); assert(false) }
- ignoreNCE { parser.nextToken("a |*"); assert(false) }
+ ignoreNCE { parser.nextToken("a } b"); assertTrue(false) }
+ ignoreNCE { parser.nextToken("{c b"); assertTrue(false) }
+ ignoreNCE { parser.nextToken("a | b"); assertTrue(false) }
+ ignoreNCE { parser.nextToken("a |*"); assertTrue(false) }
- assert(parser.nextToken("").isEmpty)
- assert(parser.nextToken(" ").isDefined)
+ assertTrue(parser.nextToken("").isEmpty)
+ assertTrue(parser.nextToken(" ").isDefined)
}
-
- it should "obey max limit" in {
+
+ @Test
+ def testLimit() {
ignoreNCE {
parser.expand("<METRICS> <USER> <BY> <WEBSITE> <BY> <SES> <BY>
<METRICS> <BY> <USER> <BY> <METRICS>")
- assert(false)
+ assertTrue(false)
}
}
}
diff --git a/src/test/scala/org/apache/nlpcraft/common/util/NCUtilsSpec.scala
b/src/test/scala/org/apache/nlpcraft/common/util/NCUtilsSpec.scala
index 569b32e..4a4ed27 100644
--- a/src/test/scala/org/apache/nlpcraft/common/util/NCUtilsSpec.scala
+++ b/src/test/scala/org/apache/nlpcraft/common/util/NCUtilsSpec.scala
@@ -18,13 +18,15 @@
package org.apache.nlpcraft.common.util
import org.apache.nlpcraft.common._
-import org.scalatest.FlatSpec
+import org.junit.jupiter.api.Assertions.assertTrue
+import org.junit.jupiter.api.Test
/**
* Utilities tests.
*/
-class NCUtilsSpec extends FlatSpec {
- "inflate() and deflate() methods" should "work" in {
+class NCUtilsSpec {
+ @Test
+ def testInflateDeflate() {
val rawStr = "Lorem Ipsum is simply dummy text of the printing and
typesetting industry. " +
"Lorem Ipsum has been the industry's standard dummy text ever
since the 1500s, when " +
"an unknown printer took a galley of type and scrambled it to make
a type specimen book. " +
@@ -40,22 +42,25 @@ class NCUtilsSpec extends FlatSpec {
println(s"Compressed length: " + zipStr.length())
- assert(rawStr == rawStr2)
+ assertTrue(rawStr == rawStr2)
}
-
- "getDups() method" should "properly work" in {
- assert(U.getDups(Seq("a", "b", "a")) == Set("a"))
- assert(U.getDups(Seq("a", "a", "a", "b", "a")) == Set("a"))
- assert(U.getDups(Seq("a", "d", "c", "b", "e")) == Set())
+
+ @Test
+ def testGetDups() {
+ assertTrue(U.getDups(Seq("a", "b", "a")) == Set("a"))
+ assertTrue(U.getDups(Seq("a", "a", "a", "b", "a")) == Set("a"))
+ assertTrue(U.getDups(Seq("a", "d", "c", "b", "e")) == Set())
}
-
- "toFirstLastName() method" should "properly work" in {
- assert(U.toFirstLastName("A BbbBB") == ("A", "Bbbbb"))
- assert(U.toFirstLastName("aBC BbbBB CCC") == ("Abc", "Bbbbb ccc"))
- assert(U.toFirstLastName("abc b C C C") == ("Abc", "B c c c"))
+
+ @Test
+ def testToFirstLastName() {
+ assertTrue(U.toFirstLastName("A BbbBB") == ("A", "Bbbbb"))
+ assertTrue(U.toFirstLastName("aBC BbbBB CCC") == ("Abc", "Bbbbb ccc"))
+ assertTrue(U.toFirstLastName("abc b C C C") == ("Abc", "B c c c"))
}
- "sleep method" should "work without unnecessary logging" in {
+ @Test
+ def testWorkWithoutUnnecessaryLogging() {
val t = new Thread() {
override def run(): Unit = {
while (!isInterrupted) {
diff --git a/src/test/scala/org/apache/nlpcraft/model/intent/dsl/NCDslTest.java
b/src/test/scala/org/apache/nlpcraft/model/intent/dsl/NCDslTest.java
index 4934ca1..48192f2 100644
--- a/src/test/scala/org/apache/nlpcraft/model/intent/dsl/NCDslTest.java
+++ b/src/test/scala/org/apache/nlpcraft/model/intent/dsl/NCDslTest.java
@@ -17,13 +17,17 @@
package org.apache.nlpcraft.model.intent.dsl;
-import org.junit.jupiter.api.*;
-import org.apache.nlpcraft.common.*;
-import org.apache.nlpcraft.model.tools.test.*;
-import org.apache.nlpcraft.probe.embedded.*;
-import java.io.*;
+import org.apache.nlpcraft.common.NCException;
+import org.apache.nlpcraft.model.tools.test.NCTestClient;
+import org.apache.nlpcraft.model.tools.test.NCTestClientBuilder;
+import org.apache.nlpcraft.probe.embedded.NCEmbeddedProbe;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
-import static org.junit.jupiter.api.Assertions.*;
+import java.io.IOException;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* DSL test model test. Make sure to start up the NLPCraft server before
running this test.
diff --git
a/src/test/scala/org/apache/nlpcraft/model/intent/impl/NCIntentSolverEngineSpec.scala
b/src/test/scala/org/apache/nlpcraft/model/intent/impl/NCIntentSolverEngineSpec.scala
index c52e291..85f75a5 100644
---
a/src/test/scala/org/apache/nlpcraft/model/intent/impl/NCIntentSolverEngineSpec.scala
+++
b/src/test/scala/org/apache/nlpcraft/model/intent/impl/NCIntentSolverEngineSpec.scala
@@ -18,14 +18,13 @@
package org.apache.nlpcraft.model.intent.impl
import org.apache.nlpcraft.model.intent.utils.NCDslFlowItem
-import org.scalatest.FlatSpec
+import org.junit.jupiter.api.Assertions.assertTrue
+import org.junit.jupiter.api.Test
/**
* Unit tests for intent solver engine.
*/
-class NCIntentSolverEngineSpec extends FlatSpec {
- behavior of "Intent solver engine"
-
+class NCIntentSolverEngineSpec {
/**
*
* @param hist Matched intents.
@@ -34,20 +33,21 @@ class NCIntentSolverEngineSpec extends FlatSpec {
*/
private def matchFlow(hist: String, flow: (String/*Intent ID*/,
Int/*min*/, Int/*max*/)*): Boolean = {
NCIntentSolverEngine.matchFlow(
- flow.toArray.map(x ⇒ new
NCDslFlowItem(x._1.split('|').map(_.trim), x._2, x._3)),
+ flow.toArray.map(x ⇒ NCDslFlowItem(x._1.split('|').map(_.trim),
x._2, x._3)),
hist.split(" ").map(_.trim)
)
}
-
- it should "match dialog flow" in {
- assert(!matchFlow("", ("a", 1, 1)))
- assert(matchFlow("a c", ("a", 1, 1), ("b", 0, 2), ("c", 1, 1)))
- assert(matchFlow("a b c", ("a", 1, 1), ("b", 0, 2), ("c", 1, 1)))
- assert(matchFlow("a b b c", ("a", 1, 1), ("b", 0, 2), ("c", 1, 1)))
- assert(matchFlow("a b b c", ("a", 1, 1), ("b|c", 0, 2), ("c", 1, 1)))
- assert(matchFlow("a a c c", ("a", 2, 2), ("b|c", 1, 2), ("d", 0, 1)))
- assert(matchFlow("a a c c d", ("a", 2, 2), ("b|c", 1, 2), ("d", 0, 1)))
- assert(matchFlow("a a c c e f g h", ("a", 2, 2), ("b|c", 1, 2), ("d",
0, 1)))
- assert(!matchFlow("a a c c x", ("a", 2, 2), ("b|c", 1, 2), ("d", 1,
1)))
+
+ @Test
+ def testMatchDialogFlow() {
+ assertTrue(!matchFlow("", ("a", 1, 1)))
+ assertTrue(matchFlow("a c", ("a", 1, 1), ("b", 0, 2), ("c", 1, 1)))
+ assertTrue(matchFlow("a b c", ("a", 1, 1), ("b", 0, 2), ("c", 1, 1)))
+ assertTrue(matchFlow("a b b c", ("a", 1, 1), ("b", 0, 2), ("c", 1, 1)))
+ assertTrue(matchFlow("a b b c", ("a", 1, 1), ("b|c", 0, 2), ("c", 1,
1)))
+ assertTrue(matchFlow("a a c c", ("a", 2, 2), ("b|c", 1, 2), ("d", 0,
1)))
+ assertTrue(matchFlow("a a c c d", ("a", 2, 2), ("b|c", 1, 2), ("d", 0,
1)))
+ assertTrue(matchFlow("a a c c e f g h", ("a", 2, 2), ("b|c", 1, 2),
("d", 0, 1)))
+ assertTrue(!matchFlow("a a c c x", ("a", 2, 2), ("b|c", 1, 2), ("d",
1, 1)))
}
}
diff --git
a/src/test/scala/org/apache/nlpcraft/model/tools/NCSqlModelEngineSpec.scala
b/src/test/scala/org/apache/nlpcraft/model/tools/NCSqlModelEngineSpec.scala
index 6b9fe73..c9c5dd2 100644
--- a/src/test/scala/org/apache/nlpcraft/model/tools/NCSqlModelEngineSpec.scala
+++ b/src/test/scala/org/apache/nlpcraft/model/tools/NCSqlModelEngineSpec.scala
@@ -17,14 +17,13 @@
package org.apache.nlpcraft.model.tools
-import org.scalatest.FlatSpec
+import org.junit.jupiter.api.Assertions.assertTrue
+import org.junit.jupiter.api.Test
/**
* TODO: add description.
*/
-class NCSqlModelEngineSpec extends FlatSpec {
- behavior of "SQL model engine"
-
+class NCSqlModelEngineSpec {
/**
* Copy of the private method from 'NCSqlModelEngine'.
*
@@ -74,44 +73,48 @@ class NCSqlModelEngineSpec extends FlatSpec {
case Some(head) if head == w ⇒ list // Skip duplicate 'w'.
case _ ⇒ w :: list
}).mkString(" ")
-
- it should "correctly remove prefix" in {
+
+ @Test
+ def testRemovePrefix() {
val fun1 = mkPrefixFun("tbl_, col_")
val fun2 = mkPrefixFun("")
val fun3 = mkPrefixFun("tbl_tbl_, col_")
- assert(fun1("tbl_table") == "table")
- assert(fun1("tbl_tbl_table") == "tbl_table")
- assert(fun3("tbl_tbl_table") == "table")
- assert(fun1("col_column") == "column")
- assert(fun1("_col_column") == "_col_column")
- assert(fun2("col_column") == "col_column")
+ assertTrue(fun1("tbl_table") == "table")
+ assertTrue(fun1("tbl_tbl_table") == "tbl_table")
+ assertTrue(fun3("tbl_tbl_table") == "table")
+ assertTrue(fun1("col_column") == "column")
+ assertTrue(fun1("_col_column") == "_col_column")
+ assertTrue(fun2("col_column") == "col_column")
}
-
- it should "correctly remove suffix" in {
+
+ @Test
+ def testRemoveSuffix() {
val fun1 = mkSuffixFun("_tmp, _old")
val fun2 = mkSuffixFun("")
val fun3 = mkSuffixFun("_tmp_tmp")
- assert(fun1("table_old") == "table")
- assert(fun1("table_old_old") == "table_old")
- assert(fun3("table_tmp_tmp") == "table")
- assert(fun1("column_old") == "column")
- assert(fun1("column_old_") == "column_old_")
- assert(fun2("column_old") == "column_old")
+ assertTrue(fun1("table_old") == "table")
+ assertTrue(fun1("table_old_old") == "table_old")
+ assertTrue(fun3("table_tmp_tmp") == "table")
+ assertTrue(fun1("column_old") == "column")
+ assertTrue(fun1("column_old_") == "column_old_")
+ assertTrue(fun2("column_old") == "column_old")
}
- it should "correctly substitute macros" in {
- assert(substituteMacros("a id") == "a <ID>")
- assert(substituteMacros("a id ") == "a <ID>")
- assert(substituteMacros("id") == "<ID>")
+ @Test
+ def testSubstituteMacros() {
+ assertTrue(substituteMacros("a id") == "a <ID>")
+ assertTrue(substituteMacros("a id ") == "a <ID>")
+ assertTrue(substituteMacros("id") == "<ID>")
}
-
- it should "correctly remove sequential dups" in {
- assert(removeSeqDups("a a b b") == "a b")
- assert(removeSeqDups("aa b b") == "aa b")
- assert(removeSeqDups("aa b b") == "aa b")
- assert(removeSeqDups("aa b bb") == "aa b bb")
- assert(removeSeqDups("a a b b") != "a b c")
+
+ @Test
+ def testRemoveSequentialDups() {
+ assertTrue(removeSeqDups("a a b b") == "a b")
+ assertTrue(removeSeqDups("aa b b") == "aa b")
+ assertTrue(removeSeqDups("aa b b") == "aa b")
+ assertTrue(removeSeqDups("aa b bb") == "aa b bb")
+ assertTrue(removeSeqDups("a a b b") != "a b c")
}
}
diff --git
a/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/NCDefaultTestModel.scala
b/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/NCDefaultTestModel.scala
index f0e55fa..4048005 100644
---
a/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/NCDefaultTestModel.scala
+++
b/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/NCDefaultTestModel.scala
@@ -21,10 +21,10 @@ import java.util
import java.util.Collections
import org.apache.nlpcraft.model.{NCContext, NCElement, NCModelAdapter,
NCResult, NCValue}
+import org.apache.nlpcraft.probe.mgrs.nlp.enrichers.NCDefaultTestModel._
import scala.collection.JavaConverters._
import scala.language.implicitConversions
-import NCDefaultTestModel._
/**
* Enrichers default test model.
diff --git
a/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/NCEnrichersTestBeans.scala
b/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/NCEnrichersTestBeans.scala
index 79cb207..9775ba1 100644
---
a/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/NCEnrichersTestBeans.scala
+++
b/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/NCEnrichersTestBeans.scala
@@ -24,8 +24,8 @@ import java.util.{Base64, Optional}
import org.apache.nlpcraft.model.NCToken
import resource.managed
-import scala.compat.java8.OptionConverters._
import scala.collection.JavaConverters._
+import scala.compat.java8.OptionConverters._
/**
* Tests infrastructure beans.
diff --git
a/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/relation/NCEnricherRelationSpec.scala
b/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/relation/NCEnricherRelationSpec.scala
index 8253217..0b31149 100644
---
a/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/relation/NCEnricherRelationSpec.scala
+++
b/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/relation/NCEnricherRelationSpec.scala
@@ -17,7 +17,7 @@
package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.relation
-import org.apache.nlpcraft.probe.mgrs.nlp.enrichers.{NCEnricherBaseSpec,
NCTestRelationToken ⇒ rel, NCTestUserToken ⇒ usr, NCTestNlpToken ⇒ nlp}
+import org.apache.nlpcraft.probe.mgrs.nlp.enrichers.{NCEnricherBaseSpec,
NCTestNlpToken ⇒ nlp, NCTestRelationToken ⇒ rel, NCTestUserToken ⇒ usr}
import org.junit.jupiter.api.Test
/**
diff --git
a/src/test/scala/org/apache/nlpcraft/server/nlp/enrichers/date/tools/NCDateGeneratorSpec.scala
b/src/test/scala/org/apache/nlpcraft/server/nlp/enrichers/date/tools/NCDateGeneratorSpec.scala
index 3f9f970..4db3503 100644
---
a/src/test/scala/org/apache/nlpcraft/server/nlp/enrichers/date/tools/NCDateGeneratorSpec.scala
+++
b/src/test/scala/org/apache/nlpcraft/server/nlp/enrichers/date/tools/NCDateGeneratorSpec.scala
@@ -21,22 +21,24 @@ import java.text.SimpleDateFormat
import java.util.{Calendar, Date, Locale}
import org.apache.nlpcraft.common.ascii.NCAsciiTable
+import org.apache.nlpcraft.server.nlp.enrichers.date.NCDateConstants._
+import org.apache.nlpcraft.server.nlp.enrichers.date.NCDateFormatType._
import
org.apache.nlpcraft.server.nlp.enrichers.date.tools.NCDateGenerator.LHM_SS
import org.apache.nlpcraft.server.nlp.enrichers.date.{NCDateParser,
NCDateRange}
-import org.apache.nlpcraft.server.nlp.enrichers.date.NCDateFormatType._
-
-import org.scalatest.FunSuite
+import org.junit.jupiter.api.Assertions.{assertTrue, fail}
+import org.junit.jupiter.api.{Disabled, Test}
import scala.collection.JavaConverters._
import scala.collection._
import scala.collection.mutable.{LinkedHashMap ⇒ LHM}
-import org.apache.nlpcraft.server.nlp.enrichers.date.NCDateConstants._
import scala.language.implicitConversions
/**
- * Tests for dates templates generators.
- */
-class NCDateGeneratorSpec extends FunSuite {
+ * Tests for dates templates generators.
+ * Excluded from suite because added for manual testing.
+ */
+@Disabled
+class NCDateGeneratorSpec {
private def print(
f: LHM[String, String] ⇒ Unit, cnt: Int = 500, asc: Boolean = true,
keys2Check: Option[Seq[String]] = None
) {
@@ -62,7 +64,7 @@ class NCDateGeneratorSpec extends FunSuite {
case Some(keys) ⇒
val missed = keys.filter(k ⇒ !map.contains(k))
- assert(missed.isEmpty, s"Missed keys: ${missed.mkString(",
")}")
+ assertTrue(missed.isEmpty, s"Missed keys: ${missed.mkString(",
")}")
case None ⇒ // No-op.
}
}
@@ -84,7 +86,8 @@ class NCDateGeneratorSpec extends FunSuite {
fail(s"Duplicated data expected.")
}
- test("formatters") {
+ @Test
+ def testFormatters(): Unit = {
val f = new SimpleDateFormat("MM.dd.yyyy")
// M.D
@@ -113,129 +116,159 @@ class NCDateGeneratorSpec extends FunSuite {
checkFormatters(d4, NCDateGenerator.FMT_DAYS_YEAR_COMMON,
NCDateGenerator.FMT_DAYS_YEAR_DIGITS, withDup = true)
}
- test("relativeDays") {
+ @Test
+ def testRelativeDays(): Unit = {
print(NCDateGenerator.relativeDays)
}
- test("periods") {
+ @Test
+ def testPeriods(): Unit = {
print(NCDateGenerator.periods)
}
- test("years") {
+ @Test
+ def testYears(): Unit = {
print(NCDateGenerator.years)
}
- test("months") {
+ @Test
+ def testMonths(): Unit = {
print((df: LHM_SS) ⇒ NCDateGenerator.months(df,
MONTH_YEAR_COMMON.map(new SimpleDateFormat(_))))
}
- test("months.dmy") {
+ @Test
+ def testMonthsDmy(): Unit = {
print((df: LHM_SS) ⇒ NCDateGenerator.months(df,
MONTH_YEAR_COUNTRY(DMY).map(new SimpleDateFormat(_))))
}
- test("months.mdy") {
+ @Test
+ def testMonthsMdy(): Unit = {
print((df: LHM_SS) ⇒ NCDateGenerator.months(df,
MONTH_YEAR_COUNTRY(MDY).map(new SimpleDateFormat(_))))
}
- test("months.ymd") {
+ @Test
+ def testMonthsYmd(): Unit = {
print((df: LHM_SS) ⇒ NCDateGenerator.months(df,
MONTH_YEAR_COUNTRY(YMD).map(new SimpleDateFormat(_))))
}
- test("seasons") {
+ @Test
+ def testSeasons(): Unit = {
print(NCDateGenerator.seasons)
}
- test("days") {
+ @Test
+ def testDays(): Unit = {
print((df: LHM_SS) ⇒ NCDateGenerator.days(df,
NCDateGenerator.FMT_DAYS_YEAR_COMMON), cnt = 5000)
}
- test("dates") {
+ @Test
+ def testDates(): Unit = {
print((df: LHM_SS) ⇒ NCDateGenerator.dates(df,
NCDateGenerator.FMT_DATES_COMMON), cnt = 2000)
print((df: LHM_SS) ⇒ NCDateGenerator.days(df,
NCDateGenerator.FMT_DAYS_YEAR_COMMON), cnt = 2000, asc = false)
}
- test("simpleYears") {
+ @Test
+ def testSimpleYears(): Unit = {
print(NCDateGenerator.simpleYears)
}
- test("simpleQuarters") {
+ @Test
+ def tesSimpleQuarters(): Unit = {
print(NCDateGenerator.simpleQuarters, cnt = 5000)
}
- test("durationDays") {
+ @Test
+ def testDurationDays(): Unit = {
print(NCDateGenerator.durationDays, cnt = 1000, keys2Check =
Some(Seq("next couple of days", "few next days", "few last days")))
print(NCDateGenerator.durationDays, cnt = 5000, asc = false)
}
- test("durationWeeks") {
+ @Test
+ def testDurationWeeks(): Unit = {
print(NCDateGenerator.durationWeeks)
print(NCDateGenerator.durationWeeks, asc = false)
}
- test("durationMonths") {
+ @Test
+ def testDurationMonths(): Unit = {
print(NCDateGenerator.durationMonths)
print(NCDateGenerator.durationMonths, cnt = 5000, asc = false)
}
- test("durationYears") {
+ @Test
+ def testDurationYears(): Unit = {
print(NCDateGenerator.durationYears)
print(NCDateGenerator.durationYears, asc = false)
}
- test("durationDecades") {
+ @Test
+ def testDurationDecades(): Unit = {
print(NCDateGenerator.durationDecades, cnt = 5000)
}
- test("durationQuarters") {
+ @Test
+ def testDurationQuarters(): Unit = {
print(NCDateGenerator.durationQuarters, cnt = 5000)
}
- test("durationCenturies") {
+ @Test
+ def testDurationCenturies(): Unit = {
print(NCDateGenerator.durationCenturies, cnt = 5000)
}
- test("relativeDaysOfWeekByNum") {
+ @Test
+ def testRelativeDaysOfWeekByNum(): Unit = {
print(NCDateGenerator.relativeDaysOfWeekByNum, cnt = 5000)
}
- test("relativeDaysOfWeekByName") {
+ @Test
+ def testRelativeDaysOfWeekByName(): Unit = {
print(NCDateGenerator.relativeDaysOfWeekByName)
}
- test("relativeDaysOfMonth") {
+ @Test
+ def testRelativeDaysOfMonth(): Unit = {
print(NCDateGenerator.relativeDaysOfMonth, cnt = 5000)
}
- test("relativeWeeksOfMonth") {
+ @Test
+ def testRelativeWeeksOfMonth(): Unit = {
print(NCDateGenerator.relativeWeeksOfMonth)
}
- test("relativeWeeksOfQuarter") {
+ @Test
+ def testRelativeWeeksOfQuarter(): Unit = {
print(NCDateGenerator.relativeWeeksOfQuarter, cnt = 5000)
}
- test("relativeWeeksOfYear") {
+ @Test
+ def testRelativeWeeksOfYear(): Unit = {
print(NCDateGenerator.relativeWeeksOfYear, cnt = 5000)
}
- test("relativeMonthsOfYear") {
+ @Test
+ def testRelativeMonthsOfYear(): Unit = {
print(NCDateGenerator.relativeMonthsOfYear, cnt = 5000)
}
- test("relativeQuartersOfYear") {
+ @Test
+ def testRelativeQuartersOfYear(): Unit = {
print(NCDateGenerator.relativeQuartersOfYear)
}
- test("relativeYearOfDecade") {
+ @Test
+ def testelativeYearOfDecade(): Unit = {
print(NCDateGenerator.relativeYearOfDecade)
}
- test("relativeFromYear") {
+ @Test
+ def testRelativeFromYear(): Unit = {
print(NCDateGenerator.relativeFromYear, cnt = 5000)
print(NCDateGenerator.relativeFromYear, cnt = 5000, asc = false)
}
- test("calendar.behaviour") {
+ @Test
+ def testCalendar(): Unit = {
Locale.setDefault(Locale.forLanguageTag("EN"))
// Sunday.
@@ -253,17 +286,19 @@ class NCDateGeneratorSpec extends FunSuite {
println(s"$s, Sunday for this day: ${c.getTime}")
- assert(c.getTime == sunday)
+ assertTrue(c.getTime == sunday)
})
}
- test("all") {
+ @Test
+ def testAll(): Unit = {
val n = (NCDateGenerator.generateFull() ++
NCDateGenerator.generateParts()).size
println(s"Summary generated $n templates.")
}
- test("last day of month command") {
+ @Test
+ def testLastDayOfMonth(): Unit = {
def test(base: String, exp: String): Unit = {
val date = new SimpleDateFormat("MM.dd.yyyy").parse(base)
@@ -276,14 +311,15 @@ class NCDateGeneratorSpec extends FunSuite {
println(s"Result: $res")
println(s"Range: $range")
- assert(range.toString == exp)
+ assertTrue(range.toString == exp)
}
test("06.10.2018", "[06-24-2018:07-01-2018]")
test("11.20.2017", "[11-26-2017:12-03-2017]")
}
- test("last day function") {
+ @Test
+ def testLastDay(): Unit = {
val date = scala.compat.Platform.currentTime
def print(f: String): Unit = {
@@ -306,7 +342,8 @@ class NCDateGeneratorSpec extends FunSuite {
print("$ds")
}
- test("parse") {
+ @Test
+ def testParse(): Unit = {
val date = scala.compat.Platform.currentTime
val f = "m, $dm, 1dw, w1"