From cd9788930b2c6898db00b9df5f0c2dfd796b8d9e Mon Sep 17 00:00:00 2001 From: Teryk Bellahsene Date: Wed, 20 Jan 2016 12:06:06 +0100 Subject: [PATCH] SONAR-7210 WS user_tokens/search tokenCount replaced by tokensCount in response --- .../java/org/sonar/server/user/ws/UserJsonWriter.java | 10 +++++----- .../org/sonar/server/user/ws/search-example.json | 4 ++-- .../server/user/ws/SearchActionTest/five_users.json | 10 +++++----- .../server/user/ws/SearchActionTest/user_one.json | 2 +- .../main/js/apps/users/templates/users-list-item.hbs | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/server/sonar-server/src/main/java/org/sonar/server/user/ws/UserJsonWriter.java b/server/sonar-server/src/main/java/org/sonar/server/user/ws/UserJsonWriter.java index e19fbdba8aa..b4711a075fd 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/user/ws/UserJsonWriter.java +++ b/server/sonar-server/src/main/java/org/sonar/server/user/ws/UserJsonWriter.java @@ -40,7 +40,7 @@ public class UserJsonWriter { private static final String FIELD_SCM_ACCOUNTS = "scmAccounts"; private static final String FIELD_GROUPS = "groups"; private static final String FIELD_ACTIVE = "active"; - private static final String FIELD_TOKEN_COUNT = "tokenCount"; + private static final String FIELD_TOKENS_COUNT = "tokensCount"; public static final Set FIELDS = ImmutableSet.of(FIELD_NAME, FIELD_EMAIL, FIELD_SCM_ACCOUNTS, FIELD_GROUPS, FIELD_ACTIVE); private static final Set CONCISE_FIELDS = ImmutableSet.of(FIELD_NAME, FIELD_EMAIL, FIELD_ACTIVE); @@ -61,7 +61,7 @@ public class UserJsonWriter { /** * Serializes a user to the passed JsonWriter. */ - public void write(JsonWriter json, User user, @Nullable Integer tokenCount, Collection groups, @Nullable Collection fields) { + public void write(JsonWriter json, User user, @Nullable Integer tokensCount, Collection groups, @Nullable Collection fields) { json.beginObject(); json.prop(FIELD_LOGIN, user.login()); writeIfNeeded(json, user.name(), FIELD_NAME, fields); @@ -69,7 +69,7 @@ public class UserJsonWriter { writeIfNeeded(json, user.active(), FIELD_ACTIVE, fields); writeGroupsIfNeeded(json, groups, fields); writeScmAccountsIfNeeded(json, fields, user); - writeTokenCount(json, tokenCount); + writeTokensCount(json, tokensCount); json.endObject(); } @@ -103,11 +103,11 @@ public class UserJsonWriter { } } - private static void writeTokenCount(JsonWriter json, @Nullable Integer tokenCount) { + private static void writeTokensCount(JsonWriter json, @Nullable Integer tokenCount) { if (tokenCount == null) { return; } - json.prop(FIELD_TOKEN_COUNT, tokenCount); + json.prop(FIELD_TOKENS_COUNT, tokenCount); } } diff --git a/server/sonar-server/src/main/resources/org/sonar/server/user/ws/search-example.json b/server/sonar-server/src/main/resources/org/sonar/server/user/ws/search-example.json index 43f791d247f..9f6ad704d55 100644 --- a/server/sonar-server/src/main/resources/org/sonar/server/user/ws/search-example.json +++ b/server/sonar-server/src/main/resources/org/sonar/server/user/ws/search-example.json @@ -10,7 +10,7 @@ "sonar-users", "sonar-administrators" ], - "tokenCount": 1 + "tokensCount": 1 }, { "login": "sbrandhof", @@ -24,7 +24,7 @@ "groups": [ "sonar-users" ], - "tokenCount": 3 + "tokensCount": 3 } ] } diff --git a/server/sonar-server/src/test/resources/org/sonar/server/user/ws/SearchActionTest/five_users.json b/server/sonar-server/src/test/resources/org/sonar/server/user/ws/SearchActionTest/five_users.json index 576b41ad6ce..53f48b5066c 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/user/ws/SearchActionTest/five_users.json +++ b/server/sonar-server/src/test/resources/org/sonar/server/user/ws/SearchActionTest/five_users.json @@ -10,7 +10,7 @@ "scmAccounts": [ "user-0" ], - "tokenCount": 0 + "tokensCount": 0 }, { "login": "user-1", @@ -19,7 +19,7 @@ "scmAccounts": [ "user-1" ], - "tokenCount": 1 + "tokensCount": 1 }, { "login": "user-2", @@ -28,7 +28,7 @@ "scmAccounts": [ "user-2" ], - "tokenCount": 2 + "tokensCount": 2 }, { "login": "user-3", @@ -37,7 +37,7 @@ "scmAccounts": [ "user-3" ], - "tokenCount": 3 + "tokensCount": 3 }, { "login": "user-4", @@ -46,7 +46,7 @@ "scmAccounts": [ "user-4" ], - "tokenCount": 4 + "tokensCount": 4 } ] } diff --git a/server/sonar-server/src/test/resources/org/sonar/server/user/ws/SearchActionTest/user_one.json b/server/sonar-server/src/test/resources/org/sonar/server/user/ws/SearchActionTest/user_one.json index 2f3d06e9ac6..87f7c37c97b 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/user/ws/SearchActionTest/user_one.json +++ b/server/sonar-server/src/test/resources/org/sonar/server/user/ws/SearchActionTest/user_one.json @@ -10,7 +10,7 @@ "scmAccounts": [ "user-1" ], - "tokenCount": 1 + "tokensCount": 1 } ] } diff --git a/server/sonar-web/src/main/js/apps/users/templates/users-list-item.hbs b/server/sonar-web/src/main/js/apps/users/templates/users-list-item.hbs index 771d5c987bc..fb5987fbbd8 100644 --- a/server/sonar-web/src/main/js/apps/users/templates/users-list-item.hbs +++ b/server/sonar-web/src/main/js/apps/users/templates/users-list-item.hbs @@ -40,7 +40,7 @@ - {{tokenCount}} + {{tokensCount}} -- 2.39.5