This is an automated email from the ASF dual-hosted git repository.

sergeykamov pushed a commit to branch NLPCRAFT-434
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git


The following commit(s) were added to refs/heads/NLPCRAFT-434 by this push:
     new c58c4c9  WIP.
c58c4c9 is described below

commit c58c4c99a8c4433de579ca228995a51d6361acdb
Author: Sergey Kamov <[email protected]>
AuthorDate: Thu Sep 9 17:47:12 2021 +0300

    WIP.
---
 .../mgrs/deploy1/NCElementAnnotationsSpec.scala    | 33 +++++++++++++++++-----
 .../mgrs/deploy1/pack/NCElementAnnotations2.scala  |  4 +--
 2 files changed, 28 insertions(+), 9 deletions(-)

diff --git 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/deploy1/NCElementAnnotationsSpec.scala
 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/deploy1/NCElementAnnotationsSpec.scala
index 9b2befa..ca844f5 100644
--- 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/deploy1/NCElementAnnotationsSpec.scala
+++ 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/deploy1/NCElementAnnotationsSpec.scala
@@ -23,11 +23,11 @@ import org.junit.jupiter.api.Test
 
 import java.util
 
-@NCElementDefinition("""{ "id": "e3" }""")
-@NCElementDefinition("""{ "id": "e4",  "synonyms": ["e444"] }""")
+@NCElementDefinition("""{ "id": "e5" }""")
+@NCElementDefinition("""{ "id": "e6",  "synonyms": ["e66"] }""")
 class NCElementAnnotations1 {
-    @NCElementDefinition("""{ "id": "e5" }""")
-    @NCElementDefinition("""{ "id": "e6" }""")
+    @NCElementDefinition("""{ "id": "e7" }""")
+    @NCElementDefinition("""{ "id": "e8" }""")
     def x(): Unit = ()
 }
 
@@ -36,6 +36,8 @@ class NCElementAnnotations1 {
   */
 @NCModelAddClasses(Array{classOf[NCElementAnnotations1]})
 @NCModelAddPackage(Array("org.apache.nlpcraft.probe.mgrs.deploy1.pack"))
+@NCElementDefinition("""{ "id": "e3" }""")
+@NCElementDefinition("""{ "id": "e4" }""")
 class NCElementAnnotationsSpecModel extends NCModelAdapter(
     "nlpcraft.intents.idl.test", "IDL Test Model", "1.0"
 ) {
@@ -66,6 +68,12 @@ class NCElementAnnotationsSpecModel extends NCModelAdapter(
 
     @NCIntent("intent=onE8 term={# == 'e8'}")
     def onE8(): NCResult = NCResult.text("OK")
+
+    @NCIntent("intent=onE9 term={# == 'e9'}")
+    def onE9(): NCResult = NCResult.text("OK")
+
+    @NCIntent("intent=onE10 term={# == 'e10'}")
+    def onE10(): NCResult = NCResult.text("OK")
 }
 
 /**
@@ -78,15 +86,26 @@ class NCElementAnnotationsSpec extends NCTestContext {
      */
     @Test
     def test(): Unit = {
+        // Defined in model.
         checkIntent("e1", "onE1")
+
+        // Added via annotation to model method.
         checkIntent("e2", "onE2")
-        checkIntent("e3", "onE3")
 
-        checkIntent("e444", "onE4")
+        // Added via annotation to model class.
+        checkIntent("e3", "onE3")
+        checkIntent("e4", "onE4")
 
+        // Added via annotation to class and methods, where class added via 
NCModelAddClasses.
+        // Multiple annotation tested.
+        // Complex JSON tested.
         checkIntent("e5", "onE5")
-        checkIntent("e6", "onE6")
+        checkIntent("e66", "onE6")
         checkIntent("e7", "onE7")
         checkIntent("e8", "onE8")
+
+        // Added via annotation to class and method, where class added via 
NCModelAddPackage.
+        checkIntent("e9", "onE9")
+        checkIntent("e10", "onE10")
     }
 }
\ No newline at end of file
diff --git 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/deploy1/pack/NCElementAnnotations2.scala
 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/deploy1/pack/NCElementAnnotations2.scala
index 41099b7..de06dda 100644
--- 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/deploy1/pack/NCElementAnnotations2.scala
+++ 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/deploy1/pack/NCElementAnnotations2.scala
@@ -19,8 +19,8 @@ package org.apache.nlpcraft.probe.mgrs.deploy1.pack
 
 import org.apache.nlpcraft.model.NCElementDefinition
 
-@NCElementDefinition("""{ "id": "e7" }""")
+@NCElementDefinition("""{ "id": "e9" }""")
 class NCElementAnnotations2 {
-    @NCElementDefinition("""{ "id": "e8" }""")
+    @NCElementDefinition("""{ "id": "e10" }""")
     def x(): Unit = ()
 }
\ No newline at end of file

Reply via email to