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

sergeykamov pushed a commit to branch master-0.7.2
in repository 
https://gitbox.apache.org/repos/asf/incubator-nlpcraft-java-client.git

commit df8c22446a23b78421d873bddbf5a38010baf32c
Author: Sergey Kamov <[email protected]>
AuthorDate: Mon Nov 23 12:44:35 2020 +0300

    WIP.
---
 pom.xml                                            | 25 +++++++++---------
 .../apache/nlpcraft/client/impl/NCClientImpl.java  |  6 ++---
 .../nlpcraft/client/impl/beans/NCProbeBean.java    |  3 ++-
 .../nlpcraft/client/impl/beans/NCUserBean.java     |  4 +--
 .../apache/nlpcraft/client/NCConversationTest.java | 18 ++++++-------
 .../org/apache/nlpcraft/client/NCTestAdapter.java  | 30 ++++++++++------------
 6 files changed, 42 insertions(+), 44 deletions(-)

diff --git a/pom.xml b/pom.xml
index 9336402..1393192 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@
         <commons.validator.ver>1.6</commons.validator.ver>
         <gson.ver>2.8.5</gson.ver>
         <log4j.ver>2.11.2</log4j.ver>
-        <nlpcraft.ver>0.5.0</nlpcraft.ver>
+        <nlpcraft.ver>0.7.2</nlpcraft.ver>
         <junit.ver>5.4.0</junit.ver>
         <maven.compiler.version>3.7.0</maven.compiler.version>
         <maven.exec.version>1.6.0</maven.exec.version>
@@ -47,7 +47,7 @@
     <name>NLPCraft - Java Client</name>
     <groupId>org.apache.nlpcraft</groupId>
     <artifactId>java-client</artifactId>
-    <version>0.5.0</version>
+    <version>0.7.2</version>
     <url>https://nlpcraft.apache.org</url>
     <description>An open source API to convert natural language into 
actions.</description>
 
@@ -84,7 +84,7 @@
         
<connection>scm:git:ssh://[email protected]/apache/incubator-nlpcraft.git</connection>
         
<developerConnection>scm:git:ssh://[email protected]/apache/incubator-nlpcraft.git</developerConnection>
         <!-- Set actual tag name here -->
-        <tag>v0.5.0</tag>
+        <tag>v0.7.2</tag>
     </scm>
 
     <dependencies>
@@ -139,8 +139,8 @@
                 <artifactId>maven-compiler-plugin</artifactId>
                 <version>${maven.compiler.version}</version>
                 <configuration>
-                    <source>1.8</source>
-                    <target>1.8</target>
+                    <source>11</source>
+                    <target>11</target>
                 </configuration>
             </plugin>
             <plugin>
@@ -151,12 +151,15 @@
                     <rules>
                         <requireJavaVersion>
                             <message>
-                                [INFO] 
------------------------------------------------------------------------
-                                [ERROR] You are trying to compile NLPCraft 
with inappropriate JDK version!
-                                [ERROR] Detected JDK Version: 
${java.runtime.version}
-                                [ERROR] JDK version should be &gt;= 1.8.0_1.
+
+                                
------------------------------------------------------------------------
+                                You are trying to compile NLPCraft with 
inappropriate JDK version!
+                                Detected JDK Version: ${java.runtime.version}
+                                JDK version should be 11 or later
+                                
------------------------------------------------------------------------
+
                             </message>
-                            <version>1.8,11</version>
+                            <version>11</version>
                         </requireJavaVersion>
                     </rules>
                 </configuration>
@@ -173,8 +176,6 @@
                 <artifactId>maven-javadoc-plugin</artifactId>
                 <version>${maven.javadoc.plugin.ver}</version>
                 <configuration>
-                    <source>1.8</source>
-                    <!-- Required as of JDK 8u121 -->
                     <additionalOptions>--allow-script-in-comments, 
-Xdoclint:none</additionalOptions>
                     
<javadocDirectory>${project.basedir}/javadoc</javadocDirectory>
                     <docfilessubdirs>true</docfilessubdirs>
diff --git a/src/main/java/org/apache/nlpcraft/client/impl/NCClientImpl.java 
b/src/main/java/org/apache/nlpcraft/client/impl/NCClientImpl.java
index 6a5c55b..f8fec25 100644
--- a/src/main/java/org/apache/nlpcraft/client/impl/NCClientImpl.java
+++ b/src/main/java/org/apache/nlpcraft/client/impl/NCClientImpl.java
@@ -56,8 +56,8 @@ import 
org.apache.nlpcraft.client.impl.beans.NCTokenCreationBean;
 import org.apache.nlpcraft.client.impl.beans.NCUserAddBean;
 import org.apache.nlpcraft.client.impl.beans.NCUserBean;
 import org.apache.nlpcraft.client.impl.beans.NCUsersAllBean;
-import org.apache.nlpcraft.probe.embedded.NCEmbeddedProbe;
-import org.apache.nlpcraft.probe.embedded.NCEmbeddedResult;
+import org.apache.nlpcraft.model.tools.embedded.NCEmbeddedProbe;
+import org.apache.nlpcraft.model.tools.embedded.NCEmbeddedResult;
 
 import java.io.IOException;
 import java.lang.reflect.Type;
@@ -566,7 +566,7 @@ public class NCClientImpl implements NCClient {
                     "user/get",
                     Pair.of("acsTok", acsTok),
                     Pair.of("id", id),
-                    Pair.of("extId", extId)
+                    Pair.of("usrExtId", extId)
                 ),
                 NCUserBean.class
             );
diff --git 
a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCProbeBean.java 
b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCProbeBean.java
index 635a03c..9f8add9 100644
--- a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCProbeBean.java
+++ b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCProbeBean.java
@@ -21,6 +21,7 @@ import com.google.gson.annotations.SerializedName;
 import org.apache.nlpcraft.client.NCModel;
 import org.apache.nlpcraft.client.NCProbe;
 
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -140,6 +141,6 @@ public class NCProbeBean implements NCProbe {
     
     @Override
     public Set<NCModel> getModels() {
-        return new HashSet<>(models);
+        return models != null ? new HashSet<>(models) : Collections.emptySet();
     }
 }
diff --git 
a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCUserBean.java 
b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCUserBean.java
index 84cad39..e734105 100644
--- a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCUserBean.java
+++ b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCUserBean.java
@@ -27,7 +27,7 @@ import java.util.Map;
  */
 public class NCUserBean extends NCStatusResponseBean implements NCUser {
     @SerializedName("id") private long id;
-    @SerializedName("extId") private String extId;
+    @SerializedName("usrExtId") private String usrExtId;
     @SerializedName("email") private String email;
     @SerializedName("firstName") private String firstName;
     @SerializedName("lastName") private String lastName;
@@ -67,7 +67,7 @@ public class NCUserBean extends NCStatusResponseBean 
implements NCUser {
     
     @Override
     public String getExternalId() {
-        return extId;
+        return usrExtId;
     }
     
     @Override
diff --git a/src/test/java/org/apache/nlpcraft/client/NCConversationTest.java 
b/src/test/java/org/apache/nlpcraft/client/NCConversationTest.java
index 7dcc5d0..42e0942 100644
--- a/src/test/java/org/apache/nlpcraft/client/NCConversationTest.java
+++ b/src/test/java/org/apache/nlpcraft/client/NCConversationTest.java
@@ -17,7 +17,7 @@
 
 package org.apache.nlpcraft.client;
 
-import org.apache.nlpcraft.examples.weather.WeatherModel;
+import org.apache.nlpcraft.examples.alarm.AlarmModel;
 import org.apache.nlpcraft.model.NCModel;
 import org.junit.jupiter.api.Test;
 
@@ -31,11 +31,11 @@ class NCConversationTest extends NCTestAdapter {
     /**
      *
      */
-    private static final String MDL_ID = "nlpcraft.weather.ex";
+    private static final String MDL_ID = "nlpcraft.alarm.ex";
 
     @Override
     Optional<Class<? extends NCModel>> getModelClass() {
-        return Optional.of(WeatherModel.class);
+        return Optional.of(AlarmModel.class);
     }
 
     /**
@@ -52,15 +52,15 @@ class NCConversationTest extends NCTestAdapter {
      */
     @Test
     void test1() throws Exception {
-        check("What's the weather in Moscow?", this::checkOk);
+        check("Ping me in 3 minutes", this::checkOk);
 
         // Should be answered with conversation.
-        check("Moscow", this::checkOk);
+        check("3 minutes", this::checkOk);
 
         admCli.clearConversation(MDL_ID, null, null);
 
         // Cannot be answered without conversation.
-        check("Moscow", this::checkError);
+        check("3 minutes", this::checkError);
     }
 
     /**
@@ -68,16 +68,16 @@ class NCConversationTest extends NCTestAdapter {
      */
     @Test
     void test2() throws Exception {
-        check("What's the weather in Moscow?", this::checkOk);
+        check("Ping me in 3 minutes", this::checkOk);
 
         // Should be answered with conversation.
-        check("Moscow", this::checkOk);
+        check("3 minutes", this::checkOk);
 
         admCli.clearConversation(MDL_ID,
             // Finds its own ID.
             get(admCli.getAllUsers(), (u) -> 
NCClientBuilder.DFLT_EMAIL.equals(u.getEmail())).getId(), null);
 
         // Cannot be answered without conversation.
-        check("Moscow", this::checkError);
+        check("3 minutes", this::checkError);
     }
 }
diff --git a/src/test/java/org/apache/nlpcraft/client/NCTestAdapter.java 
b/src/test/java/org/apache/nlpcraft/client/NCTestAdapter.java
index d8a329d..b173cfa 100644
--- a/src/test/java/org/apache/nlpcraft/client/NCTestAdapter.java
+++ b/src/test/java/org/apache/nlpcraft/client/NCTestAdapter.java
@@ -18,7 +18,7 @@
 package org.apache.nlpcraft.client;
 
 import org.apache.nlpcraft.model.NCModel;
-import org.apache.nlpcraft.probe.embedded.NCEmbeddedProbe;
+import org.apache.nlpcraft.model.tools.embedded.NCEmbeddedProbe;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 
@@ -163,8 +163,8 @@ abstract class NCTestAdapter {
     protected<T> T get(List<T> list, Predicate<T> p) {
         Optional<T> opt = getOpt(list, p);
     
-        if (!opt.isPresent())
-            fail("Object not found");
+        if (opt.isEmpty())
+            fail("Object not found in list: " + list);
     
         return opt.get();
     }
@@ -174,13 +174,11 @@ abstract class NCTestAdapter {
      * @param state
      */
     protected void checkOk(NCResult state) {
-        System.out.println(
-            String.format(
-                "Text: %s \ntype: %s\nresult: %s",
-                state.getText(),
-                state.getResultType(),
-                state.getResultBody()
-            )
+        System.out.printf(
+            "Text: %s \ntype: %s\nresult: %s%n",
+            state.getText(),
+            state.getResultType(),
+            state.getResultBody()
         );
     
         if (state.getLogHolder() != null)
@@ -199,13 +197,11 @@ abstract class NCTestAdapter {
     protected void checkError(NCResult state) {
         assert state != null;
         
-        System.out.println(
-            String.format(
-                "Text: %s \nerror: %s\ncode: %d",
-                state.getText(),
-                state.getErrorMessage(),
-                state.getErrorCode()
-            )
+        System.out.printf(
+            "Text: %s \nerror: %s\ncode: %d%n",
+            state.getText(),
+            state.getErrorMessage(),
+            state.getErrorCode()
         );
     
         if (state.getLogHolder() != null)

Reply via email to