From 45c18d6502c3d1610603cc2495b29cd158fcde6c Mon Sep 17 00:00:00 2001 From: Eugene Dubovik Date: Sat, 6 Jan 2018 21:46:20 +0200 Subject: [PATCH] Added nullable handler for JsonObject; --- README.md | 4 +- .../devicehive/client/service/User.java | 13 ++- .../client/service/UserService.java | 2 +- .../rest/adapters/NullJsonAdapter.java | 46 ++++++++ .../github/devicehive/rest/api/UserApi.java | 22 +++- .../github/devicehive/rest/model/Device.java | 4 +- .../devicehive/rest/model/DeviceCommand.java | 5 +- .../rest/model/DeviceCommandWrapper.java | 4 + .../rest/model/DeviceNotification.java | 3 + .../rest/model/DeviceNotificationWrapper.java | 5 +- .../devicehive/rest/model/DeviceUpdate.java | 3 + .../github/devicehive/rest/model/User.java | 4 +- .../devicehive/rest/model/UserInsert.java | 110 ++++++++++++++++++ .../devicehive/rest/model/UserUpdate.java | 3 + .../github/devicehive/rest/model/UserVO.java | 7 +- .../rest/model/UserWithNetwork.java | 3 + .../github/devicehive/rest/UserApiTest.java | 17 +-- .../model/repsonse/UserInsertResponse.java | 8 +- 18 files changed, 236 insertions(+), 27 deletions(-) create mode 100644 rest/src/main/java/com/github/devicehive/rest/adapters/NullJsonAdapter.java create mode 100644 rest/src/main/java/com/github/devicehive/rest/model/UserInsert.java diff --git a/README.md b/README.md index 363d0bca..5f9a31cc 100644 --- a/README.md +++ b/README.md @@ -192,7 +192,7 @@ To subscribe on notifications you just need to create `NotificationFilter` where ### Working with User - To create `User` you just need to call `createUser(String login, String password, User.RoleEnum role, StatusEnum status, JsonObject data)` method of `DeviceHive` class + To create `User` you just need to call `createUser(String lastLogin, String password, User.RoleEnum role, StatusEnum status, JsonObject data)` method of `DeviceHive` class ```java DHResponse response = deviceHive.createUser("javaLibTest", "123456", RoleEnum.ADMIN, StatusEnum.ACTIVE, null); @@ -207,7 +207,7 @@ To subscribe on notifications you just need to create `NotificationFilter` where Properties: * `id` (read only) - * `login` + * `lastLogin` * `role` * `password` (write only) * `data` diff --git a/client/src/main/java/com/github/devicehive/client/service/User.java b/client/src/main/java/com/github/devicehive/client/service/User.java index 168a8ff3..53c48f74 100644 --- a/client/src/main/java/com/github/devicehive/client/service/User.java +++ b/client/src/main/java/com/github/devicehive/client/service/User.java @@ -23,6 +23,7 @@ import com.github.devicehive.client.model.DHResponse; import com.github.devicehive.rest.model.RoleEnum; +import com.github.devicehive.rest.model.UserInsert; import com.github.devicehive.rest.model.UserUpdate; import com.github.devicehive.rest.model.UserVO; import com.github.devicehive.rest.model.UserWithNetwork; @@ -37,7 +38,7 @@ public class User { private String login; private RoleEnum role; private String password; - private JsonObject data=new JsonObject(); + private JsonObject data = new JsonObject(); private User() { } @@ -55,6 +56,16 @@ public static User create(UserWithNetwork user) { return result; } + public static User create(UserInsert user) { + if (user == null) { + return null; + } + User result = new User(); + result.setId(user.getId()); + result.setData(user.getData()); + return result; + } + public static User create(UserVO user) { if (user == null) { return null; diff --git a/client/src/main/java/com/github/devicehive/client/service/UserService.java b/client/src/main/java/com/github/devicehive/client/service/UserService.java index 4f3d92b6..272288f0 100644 --- a/client/src/main/java/com/github/devicehive/client/service/UserService.java +++ b/client/src/main/java/com/github/devicehive/client/service/UserService.java @@ -74,7 +74,7 @@ public DHResponse createUser(String login, String password, RoleEnum role, UserApi userApi = createService(UserApi.class); UserUpdate userUpdate = createUserBody(login, password, role, statusEnum, data); DHResponse response; - DHResponse result = execute(userApi.insertUser(userUpdate)); + DHResponse result = execute(userApi.insertUser(userUpdate)); response = DHResponse.create(User.create(result.getData()), result.getFailureData()); if (response.isSuccessful()) { updateUser(response, login, role, data); diff --git a/rest/src/main/java/com/github/devicehive/rest/adapters/NullJsonAdapter.java b/rest/src/main/java/com/github/devicehive/rest/adapters/NullJsonAdapter.java new file mode 100644 index 00000000..03cd1601 --- /dev/null +++ b/rest/src/main/java/com/github/devicehive/rest/adapters/NullJsonAdapter.java @@ -0,0 +1,46 @@ +/* + * + * + * NullJsonAdapter.java + * + * Copyright (C) 2018 DataArt + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.github.devicehive.rest.adapters; + +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonNull; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; + +import java.lang.reflect.Type; +import java.util.Objects; + +public class NullJsonAdapter implements JsonDeserializer { + @Override + public JsonObject deserialize(JsonElement jsonElement, Type type, + JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { + if (Objects.equals(type, JsonNull.class)) { + return new JsonObject(); + } + if (jsonElement.isJsonNull()) { + return new JsonObject(); + } + return jsonElement.getAsJsonObject(); + } +} \ No newline at end of file diff --git a/rest/src/main/java/com/github/devicehive/rest/api/UserApi.java b/rest/src/main/java/com/github/devicehive/rest/api/UserApi.java index 3369bec1..2a7c7900 100644 --- a/rest/src/main/java/com/github/devicehive/rest/api/UserApi.java +++ b/rest/src/main/java/com/github/devicehive/rest/api/UserApi.java @@ -21,14 +21,24 @@ package com.github.devicehive.rest.api; +import com.github.devicehive.rest.model.UserInsert; import com.github.devicehive.rest.model.UserNetworkResponse; import com.github.devicehive.rest.model.UserUpdate; +import com.github.devicehive.rest.model.UserVO; import com.github.devicehive.rest.model.UserWithNetwork; -import retrofit2.Call; -import retrofit2.http.*; import java.util.List; +import retrofit2.Call; +import retrofit2.http.Body; +import retrofit2.http.DELETE; +import retrofit2.http.GET; +import retrofit2.http.Headers; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Path; +import retrofit2.http.Query; + public interface UserApi { /** @@ -110,8 +120,8 @@ Call getUser( "Content-Type:application/json" }) @POST("user") - Call insertUser( - @Body com.github.devicehive.rest.model.UserUpdate body + Call insertUser( + @Body UserUpdate body ); /** @@ -131,7 +141,7 @@ Call insertUser( "Content-Type:application/json" }) @GET("user") - Call> list( + Call> list( @Query("login") String login, @Query("loginPattern") String loginPattern, @Query("role") Integer role, @Query("status") Integer status, @Query("sortField") String sortField, @Query("sortOrder") String sortOrder, @Query("take") Integer take, @Query("skip") Integer skip @@ -163,7 +173,7 @@ Call unassignNetwork( }) @PUT("user/current") Call updateCurrentUser( - @Body com.github.devicehive.rest.model.UserUpdate body + @Body UserUpdate body ); /** diff --git a/rest/src/main/java/com/github/devicehive/rest/model/Device.java b/rest/src/main/java/com/github/devicehive/rest/model/Device.java index 435035cc..2aae8416 100644 --- a/rest/src/main/java/com/github/devicehive/rest/model/Device.java +++ b/rest/src/main/java/com/github/devicehive/rest/model/Device.java @@ -34,7 +34,9 @@ package com.github.devicehive.rest.model; +import com.github.devicehive.rest.adapters.NullJsonAdapter; import com.google.gson.JsonObject; +import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; /** @@ -47,7 +49,7 @@ public class Device { @SerializedName("name") private String name = null; - + @JsonAdapter(value = NullJsonAdapter.class) @SerializedName("data") private JsonObject data = new JsonObject(); diff --git a/rest/src/main/java/com/github/devicehive/rest/model/DeviceCommand.java b/rest/src/main/java/com/github/devicehive/rest/model/DeviceCommand.java index 1b19f3a0..f955f330 100644 --- a/rest/src/main/java/com/github/devicehive/rest/model/DeviceCommand.java +++ b/rest/src/main/java/com/github/devicehive/rest/model/DeviceCommand.java @@ -34,7 +34,9 @@ package com.github.devicehive.rest.model; +import com.github.devicehive.rest.adapters.NullJsonAdapter; import com.google.gson.JsonObject; +import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import org.joda.time.DateTime; @@ -61,7 +63,7 @@ public class DeviceCommand implements Comparable { @SerializedName("networkId") private Long networkId = null; - + @JsonAdapter(value = NullJsonAdapter.class) @SerializedName("parameters") private JsonObject parameters = new JsonObject(); @@ -71,6 +73,7 @@ public class DeviceCommand implements Comparable { @SerializedName("status") private String status = null; + @JsonAdapter(value = NullJsonAdapter.class) @SerializedName("result") private JsonObject result = new JsonObject(); diff --git a/rest/src/main/java/com/github/devicehive/rest/model/DeviceCommandWrapper.java b/rest/src/main/java/com/github/devicehive/rest/model/DeviceCommandWrapper.java index 2bc34e05..7e034c8a 100644 --- a/rest/src/main/java/com/github/devicehive/rest/model/DeviceCommandWrapper.java +++ b/rest/src/main/java/com/github/devicehive/rest/model/DeviceCommandWrapper.java @@ -34,7 +34,9 @@ package com.github.devicehive.rest.model; +import com.github.devicehive.rest.adapters.NullJsonAdapter; import com.google.gson.JsonObject; +import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import org.joda.time.DateTime; @@ -50,6 +52,7 @@ public class DeviceCommandWrapper { @SerializedName("timestamp") private DateTime timestamp = null; + @JsonAdapter(value = NullJsonAdapter.class) @SerializedName("parameters") private JsonObject parameters = new JsonObject(); @@ -59,6 +62,7 @@ public class DeviceCommandWrapper { @SerializedName("status") private String status = null; + @JsonAdapter(value = NullJsonAdapter.class) @SerializedName("result") private JsonObject result = new JsonObject(); diff --git a/rest/src/main/java/com/github/devicehive/rest/model/DeviceNotification.java b/rest/src/main/java/com/github/devicehive/rest/model/DeviceNotification.java index fd7a10ff..8ed6fbe6 100644 --- a/rest/src/main/java/com/github/devicehive/rest/model/DeviceNotification.java +++ b/rest/src/main/java/com/github/devicehive/rest/model/DeviceNotification.java @@ -34,7 +34,9 @@ package com.github.devicehive.rest.model; +import com.github.devicehive.rest.adapters.NullJsonAdapter; import com.google.gson.JsonObject; +import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import org.joda.time.DateTime; @@ -59,6 +61,7 @@ public class DeviceNotification implements Comparable { @SerializedName("timestamp") private DateTime timestamp = null; + @JsonAdapter(value = NullJsonAdapter.class) @SerializedName("parameters") private JsonObject parameters = new JsonObject(); diff --git a/rest/src/main/java/com/github/devicehive/rest/model/DeviceNotificationWrapper.java b/rest/src/main/java/com/github/devicehive/rest/model/DeviceNotificationWrapper.java index 7f4059d0..c95105ed 100644 --- a/rest/src/main/java/com/github/devicehive/rest/model/DeviceNotificationWrapper.java +++ b/rest/src/main/java/com/github/devicehive/rest/model/DeviceNotificationWrapper.java @@ -34,7 +34,9 @@ package com.github.devicehive.rest.model; +import com.github.devicehive.rest.adapters.NullJsonAdapter; import com.google.gson.JsonObject; +import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import org.joda.time.DateTime; @@ -50,7 +52,8 @@ public class DeviceNotificationWrapper { @SerializedName("timestamp") private DateTime timestamp = null; - @SerializedName("parameters") + @JsonAdapter(value = NullJsonAdapter.class) + @SerializedName("data") private JsonObject parameters = new JsonObject(); public String getNotification() { diff --git a/rest/src/main/java/com/github/devicehive/rest/model/DeviceUpdate.java b/rest/src/main/java/com/github/devicehive/rest/model/DeviceUpdate.java index 3a5a55fe..aa06c5e0 100644 --- a/rest/src/main/java/com/github/devicehive/rest/model/DeviceUpdate.java +++ b/rest/src/main/java/com/github/devicehive/rest/model/DeviceUpdate.java @@ -34,7 +34,9 @@ package com.github.devicehive.rest.model; +import com.github.devicehive.rest.adapters.NullJsonAdapter; import com.google.gson.JsonObject; +import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; /** @@ -46,6 +48,7 @@ public class DeviceUpdate { @SerializedName("name") private String name = null; + @JsonAdapter(value = NullJsonAdapter.class) @SerializedName("data") private JsonObject data = new JsonObject(); diff --git a/rest/src/main/java/com/github/devicehive/rest/model/User.java b/rest/src/main/java/com/github/devicehive/rest/model/User.java index 2b1613ea..b8d5a1c1 100644 --- a/rest/src/main/java/com/github/devicehive/rest/model/User.java +++ b/rest/src/main/java/com/github/devicehive/rest/model/User.java @@ -21,7 +21,9 @@ package com.github.devicehive.rest.model; +import com.github.devicehive.rest.adapters.NullJsonAdapter; import com.google.gson.JsonObject; +import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import java.util.ArrayList; @@ -68,7 +70,7 @@ public class User { @SerializedName("entityVersion") private Long entityVersion = null; - + @JsonAdapter(value = NullJsonAdapter.class) @SerializedName("data") private JsonObject data = new JsonObject(); diff --git a/rest/src/main/java/com/github/devicehive/rest/model/UserInsert.java b/rest/src/main/java/com/github/devicehive/rest/model/UserInsert.java new file mode 100644 index 00000000..44dd47b7 --- /dev/null +++ b/rest/src/main/java/com/github/devicehive/rest/model/UserInsert.java @@ -0,0 +1,110 @@ +/* + * + * + * UserInsertResponse.java + * + * Copyright (C) 2018 DataArt + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +/* + * Device Hive REST API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 3.3.0-SNAPSHOT + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package com.github.devicehive.rest.model; + +import com.github.devicehive.rest.adapters.NullJsonAdapter; +import com.google.gson.JsonObject; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; + +import org.joda.time.DateTime; + +/** + * UserVO + */ + +public class UserInsert { + @SerializedName("id") + private Long id = null; + + @SerializedName("lastLogin") + private DateTime lastLogin = null; + @JsonAdapter(value = NullJsonAdapter.class) + @SerializedName("data") + private JsonObject data = new JsonObject(); + + @SerializedName("introReviewed") + private Boolean introReviewed = false; + + @SerializedName("allDeviceTypesAvailable") + private Boolean allDeviceTypesAvailable = false; + + public UserInsert id(Long id) { + this.id = id; + return this; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public DateTime getLastLogin() { + return lastLogin; + } + + public void setLastLogin(DateTime lastLogin) { + this.lastLogin = lastLogin; + } + + public JsonObject getData() { + return data; + } + + public void setData(JsonObject data) { + if (data != null) this.data = data; + } + + public Boolean getIntroReviewed() { + return introReviewed; + } + + public void setIntroReviewed(Boolean introReviewed) { + this.introReviewed = introReviewed; + } + + public Boolean getAllDeviceTypesAvailable() { + return allDeviceTypesAvailable; + } + + public UserInsert setAllDeviceTypesAvailable(Boolean allDeviceTypesAvailable) { + this.allDeviceTypesAvailable = allDeviceTypesAvailable; + return this; + } +} + diff --git a/rest/src/main/java/com/github/devicehive/rest/model/UserUpdate.java b/rest/src/main/java/com/github/devicehive/rest/model/UserUpdate.java index 37bf0ee2..9de6c4a2 100644 --- a/rest/src/main/java/com/github/devicehive/rest/model/UserUpdate.java +++ b/rest/src/main/java/com/github/devicehive/rest/model/UserUpdate.java @@ -34,7 +34,9 @@ package com.github.devicehive.rest.model; +import com.github.devicehive.rest.adapters.NullJsonAdapter; import com.google.gson.JsonObject; +import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; /** @@ -57,6 +59,7 @@ public class UserUpdate { @SerializedName("oldPassword") private String oldPassword = null; + @JsonAdapter(value = NullJsonAdapter.class) @SerializedName("data") private JsonObject data = new JsonObject(); diff --git a/rest/src/main/java/com/github/devicehive/rest/model/UserVO.java b/rest/src/main/java/com/github/devicehive/rest/model/UserVO.java index c36d7764..91f08cb2 100644 --- a/rest/src/main/java/com/github/devicehive/rest/model/UserVO.java +++ b/rest/src/main/java/com/github/devicehive/rest/model/UserVO.java @@ -34,7 +34,9 @@ package com.github.devicehive.rest.model; +import com.github.devicehive.rest.adapters.NullJsonAdapter; import com.google.gson.JsonObject; +import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import org.joda.time.DateTime; @@ -63,6 +65,7 @@ public class UserVO { @SerializedName("lastLogin") private DateTime lastLogin = null; + @JsonAdapter(value = NullJsonAdapter.class) @SerializedName("data") private JsonObject data = new JsonObject(); @@ -119,7 +122,9 @@ public JsonObject getData() { } public void setData(JsonObject data) { - if (data != null) this.data = data; + if (data != null) { + this.data = data; + } } public Boolean getIntroReviewed() { diff --git a/rest/src/main/java/com/github/devicehive/rest/model/UserWithNetwork.java b/rest/src/main/java/com/github/devicehive/rest/model/UserWithNetwork.java index 32dd6a04..62532647 100644 --- a/rest/src/main/java/com/github/devicehive/rest/model/UserWithNetwork.java +++ b/rest/src/main/java/com/github/devicehive/rest/model/UserWithNetwork.java @@ -34,7 +34,9 @@ package com.github.devicehive.rest.model; +import com.github.devicehive.rest.adapters.NullJsonAdapter; import com.google.gson.JsonObject; +import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import org.joda.time.DateTime; @@ -62,6 +64,7 @@ public class UserWithNetwork { @SerializedName("lastLogin") private DateTime lastLogin = null; + @JsonAdapter(value = NullJsonAdapter.class) @SerializedName("data") private JsonObject data = new JsonObject(); diff --git a/rest/src/test/java/com/github/devicehive/rest/UserApiTest.java b/rest/src/test/java/com/github/devicehive/rest/UserApiTest.java index 546e631b..369f4489 100644 --- a/rest/src/test/java/com/github/devicehive/rest/UserApiTest.java +++ b/rest/src/test/java/com/github/devicehive/rest/UserApiTest.java @@ -25,6 +25,7 @@ import com.github.devicehive.rest.model.NetworkId; import com.github.devicehive.rest.model.RoleEnum; import com.github.devicehive.rest.model.StatusEnum; +import com.github.devicehive.rest.model.UserInsert; import com.github.devicehive.rest.model.UserNetworkResponse; import com.github.devicehive.rest.model.UserResponse; import com.github.devicehive.rest.model.UserUpdate; @@ -109,7 +110,7 @@ public void insertUser() throws IOException { UserApi userApi = client.createService(UserApi.class); UserUpdate userUpdate = createNewUserUpdate(); - Response postResponse = userApi.insertUser(userUpdate).execute(); + Response postResponse = userApi.insertUser(userUpdate).execute(); Assert.assertTrue(postResponse.isSuccessful()); Long userId = postResponse.body().getId(); @@ -122,7 +123,7 @@ public void deleteUser() throws IOException { UserApi userApi = client.createService(UserApi.class); UserUpdate userUpdate = createNewUserUpdate(); - Response postResponse = userApi.insertUser(userUpdate).execute(); + Response postResponse = userApi.insertUser(userUpdate).execute(); Assert.assertTrue(postResponse.isSuccessful()); Long userId = postResponse.body().getId(); @@ -137,7 +138,7 @@ public void getUser() throws IOException { UserApi userApi = client.createService(UserApi.class); UserUpdate userUpdate = createNewUserUpdate(); - Response postResponse = userApi.insertUser(userUpdate).execute(); + Response postResponse = userApi.insertUser(userUpdate).execute(); Assert.assertTrue(postResponse.isSuccessful()); Long userId = postResponse.body().getId(); @@ -156,7 +157,7 @@ public void updateUser() throws IOException { UserApi userApi = client.createService(UserApi.class); UserUpdate userUpdate = createNewUserUpdate(); - Response postResponse = userApi.insertUser(userUpdate).execute(); + Response postResponse = userApi.insertUser(userUpdate).execute(); Assert.assertTrue(postResponse.isSuccessful()); Long userId = postResponse.body().getId(); @@ -178,7 +179,7 @@ public void assignNetwork() throws IOException { UserApi userApi = client.createService(UserApi.class); UserUpdate userUpdate = createNewUserUpdate(); - Response postResponse = userApi.insertUser(userUpdate).execute(); + Response postResponse = userApi.insertUser(userUpdate).execute(); Assert.assertTrue(postResponse.isSuccessful()); Long userId = postResponse.body().getId(); Assert.assertNotNull(userId); @@ -197,7 +198,7 @@ public void getNetwork() throws IOException { UserApi userApi = client.createService(UserApi.class); UserUpdate userUpdate = createNewUserUpdate(); - Response postResponse = userApi.insertUser(userUpdate).execute(); + Response postResponse = userApi.insertUser(userUpdate).execute(); Assert.assertTrue(postResponse.isSuccessful()); Long userId = postResponse.body().getId(); Assert.assertNotNull(userId); @@ -222,7 +223,7 @@ public void unassignNetwork() throws IOException { UserApi userApi = client.createService(UserApi.class); UserUpdate userUpdate = createNewUserUpdate(); - Response postResponse = userApi.insertUser(userUpdate).execute(); + Response postResponse = userApi.insertUser(userUpdate).execute(); Assert.assertTrue(postResponse.isSuccessful()); Long userId = postResponse.body().getId(); Assert.assertNotNull(userId); @@ -246,7 +247,7 @@ public void listUsers() throws IOException { String userLogin = String.format("%s%d_", LOGIN, j); UserUpdate userUpdate = createNewUserUpdate(userLogin); - Response postResponse = userApi.insertUser(userUpdate).execute(); + Response postResponse = userApi.insertUser(userUpdate).execute(); Assert.assertTrue(postResponse.isSuccessful()); Long userId = postResponse.body().getId(); diff --git a/websocket/src/main/java/com/github/devicehive/websocket/model/repsonse/UserInsertResponse.java b/websocket/src/main/java/com/github/devicehive/websocket/model/repsonse/UserInsertResponse.java index 402224cc..9e981c91 100644 --- a/websocket/src/main/java/com/github/devicehive/websocket/model/repsonse/UserInsertResponse.java +++ b/websocket/src/main/java/com/github/devicehive/websocket/model/repsonse/UserInsertResponse.java @@ -21,19 +21,19 @@ package com.github.devicehive.websocket.model.repsonse; -import com.github.devicehive.rest.model.UserVO; +import com.github.devicehive.rest.model.UserInsert; import com.google.gson.annotations.SerializedName; public class UserInsertResponse extends ResponseAction { @SerializedName("user") - UserVO user; + UserInsert user; - public UserVO getUser() { + public UserInsert getUser() { return user; } - public void setUser(UserVO user) { + public void setUser(UserInsert user) { this.user = user; } }