From 1a7e7c053b13d0a46c05e4ef778db2f0eacc4f24 Mon Sep 17 00:00:00 2001 From: Stoyan Tzenkov Date: Mon, 12 Nov 2018 15:26:49 +0200 Subject: [PATCH 1/2] NY-5089: avatar type changed to String Signed-off-by: Stoyan Tzenkov --- pom.xml | 2 +- src/main/java/biz/nynja/account/models/Account.java | 8 ++++---- .../account/models/AccountByAuthenticationProvider.java | 8 ++++---- .../java/biz/nynja/account/models/AccountByProfileId.java | 8 ++++---- .../java/biz/nynja/account/models/AccountByQrCode.java | 8 ++++---- .../java/biz/nynja/account/models/AccountByUsername.java | 8 ++++---- .../repositories/AccountRepositoryAdditionalImpl.java | 4 ++-- .../biz/nynja/account/services/AccountServiceImpl.java | 6 ++---- src/test/java/biz/nynja/account/utils/Util.java | 8 ++++---- 9 files changed, 29 insertions(+), 31 deletions(-) diff --git a/pom.xml b/pom.xml index ad665e6..520ab58 100644 --- a/pom.xml +++ b/pom.xml @@ -101,7 +101,7 @@ libs-snapshot-local.biz.nynja.protos - account-service-intracoldev + account-service-ny-5089-update-avatar 1.0-SNAPSHOT diff --git a/src/main/java/biz/nynja/account/models/Account.java b/src/main/java/biz/nynja/account/models/Account.java index 6920d9d..a5f54e2 100644 --- a/src/main/java/biz/nynja/account/models/Account.java +++ b/src/main/java/biz/nynja/account/models/Account.java @@ -29,7 +29,7 @@ public class Account { private String authenticationProviderType; private String firstName; private String lastName; - private ByteBuffer avatar; + private String avatar; private String accountName; private String username; private String qrCode; @@ -96,11 +96,11 @@ public class Account { this.lastName = lastName; } - public ByteBuffer getAvatar() { + public String getAvatar() { return avatar; } - public void setAvatar(ByteBuffer avatar) { + public void setAvatar(String avatar) { this.avatar = avatar; } @@ -354,7 +354,7 @@ public class Account { builder.setQrCode(getQrCode()); } if (getAvatar() != null) { - builder.setAvatar(com.google.protobuf.ByteString.copyFrom(avatar)); + builder.setAvatar(avatar); } if (getRoles() != null) { for (String role : getRoles()) { diff --git a/src/main/java/biz/nynja/account/models/AccountByAuthenticationProvider.java b/src/main/java/biz/nynja/account/models/AccountByAuthenticationProvider.java index bdfa04f..92788cc 100644 --- a/src/main/java/biz/nynja/account/models/AccountByAuthenticationProvider.java +++ b/src/main/java/biz/nynja/account/models/AccountByAuthenticationProvider.java @@ -22,7 +22,7 @@ public class AccountByAuthenticationProvider { private String authenticationProviderType; private String firstName; private String lastName; - private ByteBuffer avatar; + private String avatar; private String accountName; private String username; private Long creationTimestamp; @@ -89,11 +89,11 @@ public class AccountByAuthenticationProvider { this.lastName = lastName; } - public ByteBuffer getAvatar() { + public String getAvatar() { return avatar; } - public void setAvatar(ByteBuffer avatar) { + public void setAvatar(String avatar) { this.avatar = avatar; } @@ -339,7 +339,7 @@ public class AccountByAuthenticationProvider { builder.setQrCode(getQrCode()); } if (avatar != null) { - builder.setAvatar(com.google.protobuf.ByteString.copyFrom(avatar)); + builder.setAvatar(avatar); } if (contactsInfo != null) { for (ContactInfo c : contactsInfo) { diff --git a/src/main/java/biz/nynja/account/models/AccountByProfileId.java b/src/main/java/biz/nynja/account/models/AccountByProfileId.java index fe37f19..adf01aa 100644 --- a/src/main/java/biz/nynja/account/models/AccountByProfileId.java +++ b/src/main/java/biz/nynja/account/models/AccountByProfileId.java @@ -23,7 +23,7 @@ public class AccountByProfileId { private String authenticationProviderType; private String firstName; private String lastName; - private ByteBuffer avatar; + private String avatar; private String accountName; private String username; private Long creationTimestamp; @@ -90,11 +90,11 @@ public class AccountByProfileId { this.lastName = lastName; } - public ByteBuffer getAvatar() { + public String getAvatar() { return avatar; } - public void setAvatar(ByteBuffer avatar) { + public void setAvatar(String avatar) { this.avatar = avatar; } @@ -341,7 +341,7 @@ public class AccountByProfileId { builder.setQrCode(getQrCode()); } if (getAvatar() != null) { - builder.setAvatar(com.google.protobuf.ByteString.copyFrom(avatar)); + builder.setAvatar(avatar); } if (getContactsInfo() != null) { for (ContactInfo c : contactsInfo) { diff --git a/src/main/java/biz/nynja/account/models/AccountByQrCode.java b/src/main/java/biz/nynja/account/models/AccountByQrCode.java index f80d84f..e2b8f68 100644 --- a/src/main/java/biz/nynja/account/models/AccountByQrCode.java +++ b/src/main/java/biz/nynja/account/models/AccountByQrCode.java @@ -21,7 +21,7 @@ public class AccountByQrCode { private String authenticationProviderType; private String firstName; private String lastName; - private ByteBuffer avatar; + private String avatar; private String accountName; private String username; private Long creationTimestamp; @@ -87,11 +87,11 @@ public class AccountByQrCode { this.lastName = lastName; } - public ByteBuffer getAvatar() { + public String getAvatar() { return avatar; } - public void setAvatar(ByteBuffer avatar) { + public void setAvatar(String avatar) { this.avatar = avatar; } @@ -322,7 +322,7 @@ public class AccountByQrCode { builder.setQrCode(getQrCode()); } if (getAvatar() != null) { - builder.setAvatar(com.google.protobuf.ByteString.copyFrom(avatar)); + builder.setAvatar(avatar); } if (getRoles() != null) { for (String role : getRoles()) { diff --git a/src/main/java/biz/nynja/account/models/AccountByUsername.java b/src/main/java/biz/nynja/account/models/AccountByUsername.java index ed40828..52a1a12 100644 --- a/src/main/java/biz/nynja/account/models/AccountByUsername.java +++ b/src/main/java/biz/nynja/account/models/AccountByUsername.java @@ -22,7 +22,7 @@ public class AccountByUsername { private String authenticationProviderType; private String firstName; private String lastName; - private ByteBuffer avatar; + private String avatar; private String accountName; private String username; private Long creationTimestamp; @@ -89,11 +89,11 @@ public class AccountByUsername { this.lastName = lastName; } - public ByteBuffer getAvatar() { + public String getAvatar() { return avatar; } - public void setAvatar(ByteBuffer avatar) { + public void setAvatar(String avatar) { this.avatar = avatar; } @@ -340,7 +340,7 @@ public class AccountByUsername { builder.setQrCode(getQrCode()); } if (getAvatar() != null) { - builder.setAvatar(com.google.protobuf.ByteString.copyFrom(avatar)); + builder.setAvatar(avatar); } if (getRoles() != null) { for (String role : getRoles()) { diff --git a/src/main/java/biz/nynja/account/repositories/AccountRepositoryAdditionalImpl.java b/src/main/java/biz/nynja/account/repositories/AccountRepositoryAdditionalImpl.java index 3254ff1..38f4bff 100644 --- a/src/main/java/biz/nynja/account/repositories/AccountRepositoryAdditionalImpl.java +++ b/src/main/java/biz/nynja/account/repositories/AccountRepositoryAdditionalImpl.java @@ -140,7 +140,7 @@ public class AccountRepositoryAdditionalImpl implements AccountRepositoryAdditio newAccount.setAuthenticationProviderType(pendingAccount.getAuthenticationProviderType()); newAccount.setFirstName(request.getFirstName()); newAccount.setLastName(request.getLastName()); - newAccount.setAvatar(request.getAvatar().asReadOnlyByteBuffer()); + newAccount.setAvatar(request.getAvatar()); newAccount.setAccountName(request.getAccountName()); newAccount.setUsername(request.getUsername()); newAccount.setCreationTimestamp(creationTimestamp); @@ -322,7 +322,7 @@ public class AccountRepositoryAdditionalImpl implements AccountRepositoryAdditio private void updateAccountData(CassandraBatchOperations batchOps, UpdateAccountRequest request, Account existingAccount, Long lastUpdateTimestamp) { Account updatedAccount = existingAccount; - updatedAccount.setAvatar(request.getAvatar().asReadOnlyByteBuffer()); + updatedAccount.setAvatar(request.getAvatar()); updatedAccount.setAccountMark(request.getAccountMark()); updatedAccount.setAccountName(request.getAccountName()); updatedAccount.setFirstName(request.getFirstName()); diff --git a/src/main/java/biz/nynja/account/services/AccountServiceImpl.java b/src/main/java/biz/nynja/account/services/AccountServiceImpl.java index 6502596..b9fdf4a 100644 --- a/src/main/java/biz/nynja/account/services/AccountServiceImpl.java +++ b/src/main/java/biz/nynja/account/services/AccountServiceImpl.java @@ -3,7 +3,6 @@ */ package biz.nynja.account.services; -import java.nio.ByteBuffer; import java.util.Optional; import java.util.UUID; @@ -766,13 +765,12 @@ public class AccountServiceImpl extends AccountServiceGrpc.AccountServiceImplBas return; } - private SearchResultDetails buildSearchResultDetails(String id, ByteBuffer avatar, String firstName, - String lastName) { + private SearchResultDetails buildSearchResultDetails(String id, String avatar, String firstName, String lastName) { SearchResultDetails.Builder searchResultDetails = SearchResultDetails.newBuilder(); searchResultDetails.setFirstName(firstName).setLastName(lastName); if (avatar != null) { - searchResultDetails.setAvatar(com.google.protobuf.ByteString.copyFrom(avatar)); + searchResultDetails.setAvatar(avatar); } return searchResultDetails.build(); diff --git a/src/test/java/biz/nynja/account/utils/Util.java b/src/test/java/biz/nynja/account/utils/Util.java index 11d213e..a55aa71 100644 --- a/src/test/java/biz/nynja/account/utils/Util.java +++ b/src/test/java/biz/nynja/account/utils/Util.java @@ -44,7 +44,7 @@ public class Util { public static final String UPDATED_ACCOUNT_MARK = "PRIVATE"; public static final String AUTHENTICATION_PROVIDER = "Provider"; public static final String AUTHENTICATION_PROVIDER_TYPE = "ProviderType"; - public static final ByteBuffer AVATAR = ByteBuffer.allocate(42); + public static final String AVATAR = "avatar"; public static final String ACCOUNT_NAME = "AccountName"; public static final String ACCOUNT_STATUS = "active"; public static final long CREATION_TIMESTAMP = 45; @@ -283,7 +283,7 @@ public class Util { public AccountByUsername savedResponse() { AccountByUsername response = new AccountByUsername(); response.setAccountId(Util.ACCOUNT_ID); - response.setAvatar(ByteBuffer.wrap(S_AVATAR_STRING.getBytes())); + response.setAvatar(S_AVATAR_STRING); response.setFirstName(Util.S_FIRST_NAME); response.setLastName(Util.S_LAST_NAME); return response; @@ -293,7 +293,7 @@ public class Util { public AccountByAuthenticationProvider savedResponseProvider() { AccountByAuthenticationProvider response = new AccountByAuthenticationProvider(); response.setAccountId(Util.ACCOUNT_ID); - response.setAvatar(ByteBuffer.wrap(S_AVATAR_STRING.getBytes())); + response.setAvatar(S_AVATAR_STRING); response.setFirstName(Util.S_FIRST_NAME); response.setLastName(Util.S_LAST_NAME); return response; @@ -303,7 +303,7 @@ public class Util { public AccountByQrCode savedResponseQrCode() { AccountByQrCode response = new AccountByQrCode(); response.setAccountId(Util.ACCOUNT_ID); - response.setAvatar(ByteBuffer.wrap(S_AVATAR_STRING.getBytes())); + response.setAvatar(S_AVATAR_STRING); response.setFirstName(Util.S_FIRST_NAME); response.setLastName(Util.S_LAST_NAME); response.setQrCode(Util.S_QR_CODE); -- GitLab From f7cc51c43fa4f12efc72580408f180393fefa03a Mon Sep 17 00:00:00 2001 From: Stoyan Tzenkov Date: Mon, 12 Nov 2018 15:59:21 +0200 Subject: [PATCH 2/2] NY-5089: Use account-service-intracoldev jar instead of the temporary one Signed-off-by: Stoyan Tzenkov --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 520ab58..ad665e6 100644 --- a/pom.xml +++ b/pom.xml @@ -101,7 +101,7 @@ libs-snapshot-local.biz.nynja.protos - account-service-ny-5089-update-avatar + account-service-intracoldev 1.0-SNAPSHOT -- GitLab