You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by se...@apache.org on 2021/05/18 09:21:34 UTC

[incubator-nlpcraft-java-client] branch ver-0.8.0 created (now 8728991)

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

sergeykamov pushed a change to branch ver-0.8.0
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft-java-client.git.


      at 8728991  WIP.

This branch includes the following new commits:

     new 8728991  WIP.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[incubator-nlpcraft-java-client] 01/01: WIP.

Posted by se...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 87289910895ceb526b82895ec1750813c13b1cd9
Author: Sergey Kamov <sk...@gmail.com>
AuthorDate: Tue May 18 12:21:21 2021 +0300

    WIP.
---
 pom.xml                                            |  2 +-
 .../java/org/apache/nlpcraft/client/NCClient.java  |  8 ++---
 .../java/org/apache/nlpcraft/client/NCCompany.java |  2 +-
 .../java/org/apache/nlpcraft/client/NCResult.java  |  3 ++
 .../java/org/apache/nlpcraft/client/NCUser.java    |  2 +-
 .../apache/nlpcraft/client/impl/NCClientImpl.java  | 34 ++++++++++++++-------
 .../nlpcraft/client/impl/beans/NCCompanyBean.java  |  4 +--
 .../client/impl/beans/NCRequestStateBean.java      | 15 ++++++++--
 .../nlpcraft/client/impl/beans/NCUserBean.java     |  4 +--
 .../org/apache/nlpcraft/client/NCAskSyncTest.java  |  3 +-
 .../java/org/apache/nlpcraft/client/NCAskTest.java |  3 +-
 .../nlpcraft/client/NCClearConversationTest.java   |  4 +--
 .../apache/nlpcraft/client/NCClearDialogTest.java  |  8 ++---
 .../org/apache/nlpcraft/client/NCCompanyTest.java  | 12 ++++----
 .../org/apache/nlpcraft/client/NCTestAdapter.java  | 35 ++++++++++++++--------
 .../org/apache/nlpcraft/client/NCUserTest.java     | 14 ++++-----
 .../nlpcraft/client/models/NCCommonSpecModel.java  | 31 ++++++++++++++++++-
 17 files changed, 123 insertions(+), 61 deletions(-)

diff --git a/pom.xml b/pom.xml
index 2337b9c..7937092 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@
         <commons.validator.ver>1.7</commons.validator.ver>
         <gson.ver>2.8.6</gson.ver>
         <log4j.ver>2.14.0</log4j.ver>
-        <nlpcraft.ver>0.7.5</nlpcraft.ver>
+        <nlpcraft.ver>0.8.0</nlpcraft.ver>
         <junit.ver>5.7.0</junit.ver>
         <maven.compiler.version>3.8.0</maven.compiler.version>
         <maven.shade.plugin.ver>3.2.4</maven.shade.plugin.ver>
diff --git a/src/main/java/org/apache/nlpcraft/client/NCClient.java b/src/main/java/org/apache/nlpcraft/client/NCClient.java
index 85d8552..3fbc0ca 100644
--- a/src/main/java/org/apache/nlpcraft/client/NCClient.java
+++ b/src/main/java/org/apache/nlpcraft/client/NCClient.java
@@ -220,7 +220,7 @@ public interface NCClient {
         String lastName,
         String avatarUrl,
         boolean isAdmin,
-        Map<String, String> properties,
+        Map<String, Object> properties,
         String extId
     ) throws NCClientException, IOException;
 
@@ -240,7 +240,7 @@ public interface NCClient {
         String firstName,
         String lastName,
         String avatarUrl,
-        Map<String, String> properties
+        Map<String, Object> properties
     ) throws NCClientException, IOException;
 
     /**
@@ -485,7 +485,7 @@ public interface NCClient {
         String adminFirstName,
         String adminLastName,
         String adminAvatarUrl,
-        Map<String, String> properties
+        Map<String, Object> properties
     ) throws NCClientException, IOException;
 
     /**
@@ -521,7 +521,7 @@ public interface NCClient {
         String city,
         String address,
         String postalCode,
-        Map<String, String> properties
+        Map<String, Object> properties
     ) throws NCClientException, IOException;
 
     /**
diff --git a/src/main/java/org/apache/nlpcraft/client/NCCompany.java b/src/main/java/org/apache/nlpcraft/client/NCCompany.java
index 93baac5..68be2d0 100644
--- a/src/main/java/org/apache/nlpcraft/client/NCCompany.java
+++ b/src/main/java/org/apache/nlpcraft/client/NCCompany.java
@@ -86,5 +86,5 @@ public interface NCCompany {
      *
      * @return Optional company properties (metadata).
      */
-    Map<String, String> getProperties();
+    Map<String, Object> getProperties();
 }
diff --git a/src/main/java/org/apache/nlpcraft/client/NCResult.java b/src/main/java/org/apache/nlpcraft/client/NCResult.java
index 802e890..e14a7da 100644
--- a/src/main/java/org/apache/nlpcraft/client/NCResult.java
+++ b/src/main/java/org/apache/nlpcraft/client/NCResult.java
@@ -112,4 +112,7 @@ public interface NCResult {
      * @return Optional processing log. Can be {@code null}.
      */
     String getLogHolder();
+
+    // TODO:
+    Map<String, Object> getResultMeta();
 }
diff --git a/src/main/java/org/apache/nlpcraft/client/NCUser.java b/src/main/java/org/apache/nlpcraft/client/NCUser.java
index 14989b1..6943bf1 100644
--- a/src/main/java/org/apache/nlpcraft/client/NCUser.java
+++ b/src/main/java/org/apache/nlpcraft/client/NCUser.java
@@ -80,5 +80,5 @@ public interface NCUser {
      *
      * @return Optional user properties (metadata).
      */
-    Map<String, String> getProperties();
+    Map<String, Object> getProperties();
 }
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 1d7055b..a9bef16 100644
--- a/src/main/java/org/apache/nlpcraft/client/impl/NCClientImpl.java
+++ b/src/main/java/org/apache/nlpcraft/client/impl/NCClientImpl.java
@@ -22,6 +22,7 @@ import com.google.gson.GsonBuilder;
 import com.google.gson.JsonDeserializer;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
+import com.google.gson.reflect.TypeToken;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.http.HttpEntity;
 import org.apache.http.client.ResponseHandler;
@@ -80,32 +81,40 @@ import java.util.stream.Collectors;
 @SuppressWarnings("JavaDoc")
 public class NCClientImpl implements NCClient {
     private static final String STATUS_API_OK = "API_OK";
-    
+
+    private static final Type MAP_TYPE = new TypeToken<Map<String, Object>>(){}.getType();
+
+    private static final Gson gsonExt = new Gson();
     private static final Gson gson =
         new GsonBuilder().registerTypeAdapter(
             NCRequestStateBean.class,
             (JsonDeserializer<NCRequestStateBean>) (e, type, ctx) -> {
                 JsonObject o = e.getAsJsonObject();
                 NCRequestStateBean b = new NCRequestStateBean();
-    
+
                 b.setSrvReqId(o.get("srvReqId").getAsString());
                 b.setTxt(o.get("txt").getAsString());
                 b.setUsrId(o.get("usrId").getAsLong());
                 b.setMdlId(o.get("mdlId").getAsString());
                 b.setProbeId(convert(o, "probeId", JsonElement::getAsString));
-                b.setResType(convert(o, "resType", JsonElement::getAsString));
-                b.setResBody(
+                b.setResultType(convert(o, "resType", JsonElement::getAsString));
+                b.setResultBody(
                     convert(o, "resBody", (resBody) -> resBody == null ?
                         null :
                         resBody.isJsonObject() ?
                             resBody.getAsJsonObject().toString() :
                             resBody.getAsString())
                 );
+                b.setResultMeta(convert(o, "resMeta", e1 -> {
+                    Map<String, Object> m = gsonExt.fromJson(e1, MAP_TYPE);
+
+                    return m == null || m.isEmpty() ? null : m;
+                }));
                 b.setStatus(o.get("status").getAsString());
                 b.setErrorCode(convert(o, "errorCode", JsonElement::getAsInt));
                 b.setError(convert(o, "error", JsonElement::getAsString));
                 b.setLogHolder(convert(o, "logHolder", (logHolder) -> logHolder.getAsJsonObject().toString()));
-    
+
                 return b;
             }).create();
     
@@ -469,7 +478,7 @@ public class NCClientImpl implements NCClient {
         String lastName,
         String avatarUrl,
         boolean isAdmin,
-        Map<String, String> properties,
+        Map<String, Object> properties,
         String extId
     ) throws NCClientException, IOException {
         notNull(email, "email");
@@ -514,7 +523,7 @@ public class NCClientImpl implements NCClient {
     
     @Override
     public void updateUser(
-        long id, String firstName, String lastName, String avatarUrl, Map<String, String> properties
+        long id, String firstName, String lastName, String avatarUrl, Map<String, Object> properties
     ) throws NCClientException, IOException {
         notNull(firstName, "firstName");
         notNull(lastName, "lastName");
@@ -753,7 +762,12 @@ public class NCClientImpl implements NCClient {
 
                         @Override
                         public String getLogHolder() {
-                            return res.getLogHolderJson();
+                            return res.getLogJson();
+                        }
+
+                        @Override
+                        public Map<String, Object> getResultMeta() {
+                            return res.getMetadata();
                         }
                     };
 
@@ -882,7 +896,7 @@ public class NCClientImpl implements NCClient {
     @Override
     public NCNewCompany addCompany(String name, String website, String country, String region, String city,
         String address, String postalCode, String adminEmail, String adminPasswd, String adminFirstName,
-        String adminLastName, String adminAvatarUrl, Map<String, String> props) throws IOException, NCClientException {
+        String adminLastName, String adminAvatarUrl, Map<String, Object> props) throws IOException, NCClientException {
         notNull(name, "name");
         notNull(adminEmail, "adminEmail");
         notNull(adminPasswd, "adminPasswd");
@@ -934,7 +948,7 @@ public class NCClientImpl implements NCClient {
         String city,
         String address,
         String postalCode,
-        Map<String, String> props
+        Map<String, Object> props
     ) throws IOException, NCClientException {
         notNull(name, "name");
     
diff --git a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCCompanyBean.java b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCCompanyBean.java
index 9d3157e..9fdf5b6 100644
--- a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCCompanyBean.java
+++ b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCCompanyBean.java
@@ -34,7 +34,7 @@ public class NCCompanyBean extends NCStatusResponseBean implements NCCompany {
     @SerializedName("city") private String city;
     @SerializedName("address") private String address;
     @SerializedName("postalCode") private String postalCode;
-    @SerializedName("properties") private Map<String, String> properties;
+    @SerializedName("properties") private Map<String, Object> properties;
     
     @Override public long getId() {
         return id;
@@ -60,7 +60,7 @@ public class NCCompanyBean extends NCStatusResponseBean implements NCCompany {
     @Override public String getPostalCode() {
         return postalCode;
     }
-    @Override public Map<String, String> getProperties() {
+    @Override public Map<String, Object> getProperties() {
         return properties;
     }
 }
diff --git a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCRequestStateBean.java b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCRequestStateBean.java
index f50f9cf..ac03e65 100644
--- a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCRequestStateBean.java
+++ b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCRequestStateBean.java
@@ -19,6 +19,8 @@ package org.apache.nlpcraft.client.impl.beans;
 
 import org.apache.nlpcraft.client.NCResult;
 
+import java.util.Map;
+
 /**
  * REST bean.
  */
@@ -34,6 +36,7 @@ public class NCRequestStateBean implements NCResult {
     private Integer errorCode;
     private String error;
     private String logHolder;
+    private Map<String, Object> resMeta;
     
     @Override public String getServerRequestId() {
         return srvReqId;
@@ -68,7 +71,10 @@ public class NCRequestStateBean implements NCResult {
     @Override public String getLogHolder() {
         return logHolder;
     }
-    
+    @Override public Map<String, Object> getResultMeta() {
+        return resMeta;
+    }
+
     public void setSrvReqId(String srvReqId) {
         this.srvReqId = srvReqId;
     }
@@ -84,10 +90,10 @@ public class NCRequestStateBean implements NCResult {
     public void setProbeId(String probeId) {
         this.probeId = probeId;
     }
-    public void setResType(String resType) {
+    public void setResultType(String resType) {
         this.resType = resType;
     }
-    public void setResBody(String resBody) {
+    public void setResultBody(String resBody) {
         this.resBody = resBody;
     }
     public void setStatus(String status) {
@@ -102,4 +108,7 @@ public class NCRequestStateBean implements NCResult {
     public void setLogHolder(String logHolder) {
         this.logHolder = logHolder;
     }
+    public void setResultMeta(Map<String, Object> resMeta) {
+        this.resMeta = resMeta;
+    }
 }
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 4f9b5df..769353f 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
@@ -33,7 +33,7 @@ public class NCUserBean extends NCStatusResponseBean implements NCUser {
     @SerializedName("lastName") private String lastName;
     @SerializedName("avatarUrl") private String avatarUrl;
     @SerializedName("isAdmin") private boolean isAdmin;
-    @SerializedName("properties") private Map<String, String> properties;
+    @SerializedName("properties") private Map<String, Object> properties;
     
     @Override public long getId() {
         return id;
@@ -56,7 +56,7 @@ public class NCUserBean extends NCStatusResponseBean implements NCUser {
     @Override public String getExternalId() {
     return usrExtId;
 }
-    @Override public Map<String, String> getProperties() {
+    @Override public Map<String, Object> getProperties() {
         return properties;
     }
 }
diff --git a/src/test/java/org/apache/nlpcraft/client/NCAskSyncTest.java b/src/test/java/org/apache/nlpcraft/client/NCAskSyncTest.java
index 8bef883..eb852ec 100644
--- a/src/test/java/org/apache/nlpcraft/client/NCAskSyncTest.java
+++ b/src/test/java/org/apache/nlpcraft/client/NCAskSyncTest.java
@@ -73,6 +73,7 @@ class NCAskSyncTest extends NCTestAdapter {
         // Only latin charset is supported.
         check("El tiempo en España", this::checkError);
 
-        check("test", this::checkOk);
+        check("test", res -> checkOk(res, null));
+        check("meta", res -> checkOk(res, NCCommonSpecModel.MAP));
     }
 }
diff --git a/src/test/java/org/apache/nlpcraft/client/NCAskTest.java b/src/test/java/org/apache/nlpcraft/client/NCAskTest.java
index 78e0d1a..8a97a5d 100644
--- a/src/test/java/org/apache/nlpcraft/client/NCAskTest.java
+++ b/src/test/java/org/apache/nlpcraft/client/NCAskTest.java
@@ -83,7 +83,8 @@ class NCAskTest extends NCTestAdapter {
      */
     @Test
     void test() throws Exception {
-        test0("test", this::checkOk);
+        test0("test", res -> checkOk(res, null));
+        test0("meta", res -> checkOk(res, NCCommonSpecModel.MAP));
         test0("El tiempo en España", this::checkError);
     }
 }
diff --git a/src/test/java/org/apache/nlpcraft/client/NCClearConversationTest.java b/src/test/java/org/apache/nlpcraft/client/NCClearConversationTest.java
index 7dc0e49..b29e6ae 100644
--- a/src/test/java/org/apache/nlpcraft/client/NCClearConversationTest.java
+++ b/src/test/java/org/apache/nlpcraft/client/NCClearConversationTest.java
@@ -46,10 +46,10 @@ class NCClearConversationTest extends NCTestAdapter {
         // missed 'test1'
         check("test2", this::checkError);
 
-        check("test1 test2", this::checkOk);
+        check("test1 test2", res -> checkOk(res, null));
 
         // 'test1' received from conversation.
-        check("test2", this::checkOk);
+        check("test2", res -> checkOk(res, null));
     }
 
     /**
diff --git a/src/test/java/org/apache/nlpcraft/client/NCClearDialogTest.java b/src/test/java/org/apache/nlpcraft/client/NCClearDialogTest.java
index ec8d55f..848d4ca 100644
--- a/src/test/java/org/apache/nlpcraft/client/NCClearDialogTest.java
+++ b/src/test/java/org/apache/nlpcraft/client/NCClearDialogTest.java
@@ -51,14 +51,14 @@ class NCClearDialogTest extends NCTestAdapter {
         check("test2", this::checkError);
 
         // `test1` is always ok.
-        check("test1", this::checkOk);
+        check("test1", res -> checkOk(res, null));
 
         // There is one `test1` before.
-        check("test2", this::checkOk);
+        check("test2", res -> checkOk(res, null));
 
         // `test1` is always ok.
-        check("test1", this::checkOk);
-        check("test1", this::checkOk);
+        check("test1", res -> checkOk(res, null));
+        check("test1", res -> checkOk(res, null));
 
         // There are too much `test1` before.
         check("test2", this::checkError);
diff --git a/src/test/java/org/apache/nlpcraft/client/NCCompanyTest.java b/src/test/java/org/apache/nlpcraft/client/NCCompanyTest.java
index 0225602..2cb91ec 100644
--- a/src/test/java/org/apache/nlpcraft/client/NCCompanyTest.java
+++ b/src/test/java/org/apache/nlpcraft/client/NCCompanyTest.java
@@ -50,7 +50,7 @@ class NCCompanyTest extends NCTestAdapter {
         String city,
         String address,
         String postalCode,
-        Map<String, String> props
+        Map<String, Object> props
     ) {
         assertEquals(comp.getName(), name);
         assertEquals(comp.getWebsite(), website);
@@ -69,7 +69,7 @@ class NCCompanyTest extends NCTestAdapter {
      * @param other
      * @throws Exception
      */
-    private void test0(String name, Map<String, String> props, String other) throws Exception {
+    private void test0(String name, Map<String, Object> props, String other) throws Exception {
         String adminEmail = "test@" + UUID.randomUUID() + ".com";
         String adminPwd = "test";
     
@@ -103,6 +103,8 @@ class NCCompanyTest extends NCTestAdapter {
             other = "new " + other;
 
             if (props != null) {
+                props = new HashMap<>(props);
+
                 props.put("new", "new");
             }
     
@@ -137,11 +139,7 @@ class NCCompanyTest extends NCTestAdapter {
      */
     @Test
     void test() throws Exception {
-        Map<String, String> props = new HashMap<>();
-
-        props.put("k1", "v1");
-
-        test0("company", props, "company");
+        test0("company", MAP, "company");
         test0("company", null, null);
     }
 }
diff --git a/src/test/java/org/apache/nlpcraft/client/NCTestAdapter.java b/src/test/java/org/apache/nlpcraft/client/NCTestAdapter.java
index b09cc71..933b4dc 100644
--- a/src/test/java/org/apache/nlpcraft/client/NCTestAdapter.java
+++ b/src/test/java/org/apache/nlpcraft/client/NCTestAdapter.java
@@ -24,14 +24,13 @@ import org.junit.jupiter.api.BeforeEach;
 
 import java.io.IOException;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Optional;
 import java.util.function.Predicate;
 
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.*;
 
 /**
  * REST client test adapter.
@@ -47,14 +46,11 @@ abstract class NCTestAdapter {
          */
         void run() throws Exception;
     }
-    
     /** */
     protected NCClient admCli;
-    
     /** */
     protected long admUsrId;
 
-    /** */
     private Class<? extends NCModel> mdlClass;
 
     /**
@@ -64,6 +60,20 @@ abstract class NCTestAdapter {
     Optional<Class<? extends NCModel>> getModelClass() {
         return Optional.empty();
     }
+
+    protected static Map<String, Object> MAP = new HashMap<>();
+
+    static {
+        MAP.put("k1", "v1");
+        MAP.put("k2", 2.2);
+
+        Map<String, Object> m = new HashMap<>();
+
+        m.put("k11", "v11");
+        m.put("k12", 2.22);
+
+        MAP.put("k3", m);
+    }
     
     /**
      *
@@ -172,28 +182,29 @@ abstract class NCTestAdapter {
     
         return opt.get();
     }
-    
+
     /**
      *
      * @param state
      */
-    protected void checkOk(NCResult state) {
+    protected void checkOk(NCResult state, Map<String, Object> meta) {
         System.out.printf(
             "Text: %s \ntype: %s\nresult: %s%n",
             state.getText(),
             state.getResultType(),
             state.getResultBody()
         );
-    
+
         if (state.getLogHolder() != null)
             System.out.printf("log:\n%s%n", state.getLogHolder());
-        
+
         assertNotNull(state.getResultBody(), "Error: " + state.getErrorMessage());
         assertNotNull(state.getResultType());
         assertNull(state.getErrorMessage());
         assertNull(state.getErrorCode());
+        assertEquals(meta, state.getResultMeta());
     }
-    
+
     /**
      *
      * @param state
diff --git a/src/test/java/org/apache/nlpcraft/client/NCUserTest.java b/src/test/java/org/apache/nlpcraft/client/NCUserTest.java
index 2fa8981..83cc442 100644
--- a/src/test/java/org/apache/nlpcraft/client/NCUserTest.java
+++ b/src/test/java/org/apache/nlpcraft/client/NCUserTest.java
@@ -58,7 +58,7 @@ class NCUserTest extends NCTestAdapter {
         String avatar,
         boolean isAdmin,
         String extId,
-        Map<String, String> props
+        Map<String, Object> props
     ) {
         assertEquals(u.getEmail(), email);
         assertEquals(u.getFirstName(), firstName);
@@ -99,13 +99,13 @@ class NCUserTest extends NCTestAdapter {
         
         admCli.resetUserPassword(usrId1, "pswd2");
         admCli.updateUserAdmin(usrId1, false);
-        admCli.updateUser(usrId1, "first2", "last2", "av2", null);
+        admCli.updateUser(usrId1, "first2", "last2", "av2", MAP);
     
         users = admCli.getAllUsers();
     
         user = get(users, (u) -> usrId1 == u.getId());
         
-        check(user, "email1@test.com", "first2", "last2", "av2", false, null, null);
+        check(user, "email1@test.com", "first2", "last2", "av2", false, null, MAP);
     
         admCli.deleteUser(usrId1, null);
     
@@ -113,20 +113,16 @@ class NCUserTest extends NCTestAdapter {
     
         assertFalse(getOpt(users, (u) -> usrId1 == u.getId()).isPresent());
 
-        Map<String, String> props = new HashMap<>();
-
-        props.put("k1", "v1");
-    
         long usrId2 =
             admCli.addUser(
-                "email1@test.com", "pswd1", "first1", "last1", "av1", false, props, null
+                "email1@test.com", "pswd1", "first1", "last1", "av1", false, MAP, null
             );
     
         users = admCli.getAllUsers();
     
         user = get(users, (u) -> usrId2 == u.getId());
     
-        check(user, "email1@test.com", "first1", "last1", "av1", false, null, props);
+        check(user, "email1@test.com", "first1", "last1", "av1", false, null, MAP);
     
         admCli.deleteUser(usrId2, null);
     
diff --git a/src/test/java/org/apache/nlpcraft/client/models/NCCommonSpecModel.java b/src/test/java/org/apache/nlpcraft/client/models/NCCommonSpecModel.java
index aaac1b3..7708a62 100644
--- a/src/test/java/org/apache/nlpcraft/client/models/NCCommonSpecModel.java
+++ b/src/test/java/org/apache/nlpcraft/client/models/NCCommonSpecModel.java
@@ -19,14 +19,33 @@ package org.apache.nlpcraft.client.models;
 
 import org.apache.nlpcraft.model.NCElement;
 import org.apache.nlpcraft.model.NCIntent;
+import org.apache.nlpcraft.model.NCResult;
 
+import java.util.Arrays;
 import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
 import java.util.Set;
 
 /**
  * Test model.
  */
 public class NCCommonSpecModel extends NCSpecModelAdapter {
+    public static Map<String, Object> MAP = new HashMap<>();
+
+    static {
+        MAP.put("k1", "v1");
+        MAP.put("k2", 2.2);
+
+        Map<String, Object> m = new HashMap<>();
+
+        m.put("k11", "v11");
+        m.put("k12", 2.22);
+
+        MAP.put("k3", m);
+    }
+
     public static final String MDL_ID = NCCommonSpecModel.class.getSimpleName();
 
     @Override
@@ -36,11 +55,21 @@ public class NCCommonSpecModel extends NCSpecModelAdapter {
 
     @Override
     public Set<NCElement> getElements() {
-        return Collections.singleton(mkElement("test"));
+        return new HashSet<>(Arrays.asList(mkElement("test"), mkElement("meta")));
     }
 
     @NCIntent("intent=intentId term~{tok_id() == 'test'}")
     public org.apache.nlpcraft.model.NCResult onTest() {
         return org.apache.nlpcraft.model.NCResult.text("OK");
     }
+
+    @NCIntent("intent=intentMetaId term~{tok_id() == 'meta'}")
+    public org.apache.nlpcraft.model.NCResult onTestMeta() {
+        NCResult res = NCResult.text("OK");
+
+        res.getMetadata().putAll(MAP);
+
+        return res;
+    }
+
 }