From 11f052ebef245082928deaf5dfce8e71fefbab31 Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Fri, 1 Dec 2023 15:13:38 +0100 Subject: [PATCH 1/3] new beta version --- .classpath | 2 +- .../UserClient.java | 2 +- .../TestClientServices.java | 23 +++++++++++++++---- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.classpath b/.classpath index 439a925..df3014d 100644 --- a/.classpath +++ b/.classpath @@ -18,7 +18,7 @@ - + diff --git a/src/main/java/org/gcube/social_networking/social_networking_client_library/UserClient.java b/src/main/java/org/gcube/social_networking/social_networking_client_library/UserClient.java index a0b1b41..2453355 100644 --- a/src/main/java/org/gcube/social_networking/social_networking_client_library/UserClient.java +++ b/src/main/java/org/gcube/social_networking/social_networking_client_library/UserClient.java @@ -135,7 +135,7 @@ public class UserClient extends BaseClient{ Validate.isTrue(localRole != null, "role cannot be null"); - logger.debug("Request for getting usernames with global role"); + logger.debug("Request for getting usernames by role role"); String thisMethodSignature = "get-usernames-by-role"; String request = getServiceEndpoint() + thisMethodSignature + "?role-name=" + localRole; return HttpClient.get(new GenericType>>(){}, request); diff --git a/src/test/java/org/gcube/portal/social_networking_client_library/TestClientServices.java b/src/test/java/org/gcube/portal/social_networking_client_library/TestClientServices.java index b1eea2b..0adca25 100644 --- a/src/test/java/org/gcube/portal/social_networking_client_library/TestClientServices.java +++ b/src/test/java/org/gcube/portal/social_networking_client_library/TestClientServices.java @@ -3,6 +3,7 @@ package org.gcube.portal.social_networking_client_library; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; +import java.util.Date; import java.util.List; import java.util.Map; import java.util.Set; @@ -54,8 +55,11 @@ public class TestClientServices { @Before public void setContextAndToken(){ + //ScopeProvider.instance.set("/d4science.research-infrastructures.eu/gCubeApps/gCube"); + //String umaToken = "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJySUJPYjZZY3p2ZE4xNVpuNHFkUTRLdEQ5VUhyY1dwNWJCT3NaLXp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1lIjoiRnJvc2luaSIsImVtYWlsIjoibHVjYS5mcm9zaW5pQGlzdGkuY25yLml0In0.jt43mGeSm_4hVNFThTBmmOxzotsTHPp0DKDzBNAgESFkzNRb7ZE1j7Ab_1M6fqjpciLsk093XTEpws0OksUEAWUgxj5iAOXopJKRr6cCnmQXitWTa8WpwWZyj6AiI8PSgHCQhY3-CU8mptmd4acDtagHSbhZ320aNx7rLTaZ_7KEdRmErmgzWhnPwD3O2ONcnxIuAL1rqu4o8SJl-cj5ppFc2V54VSY56AT2IK2GmP_he9R32_0K_F0SAwsuDmv7eF1MwQM7j27H9ewfEKP8w9RooZtZYj3Pm7-Ac4XSir9w5eG1xKOyiGbIlvJZU4FQwXINntUVTVPVfPaXZ_ZbOw"; AccessTokenProvider.instance.set(umaToken); SecurityTokenProvider.instance.set(""); } @@ -220,6 +224,12 @@ public class TestClientServices { Set vreManagers = userClient.getAllUsernamesByRole("Data-Manager"); assert(vreManagers != null && !vreManagers.isEmpty()); System.out.println("Data Managers are " + vreManagers); + + List moderators = userClient.getAllUsernamesByLocalRole("VRE-Managers"); + assert(moderators != null && !moderators.isEmpty()); + System.out.println("Catalogue-Moderators are " + moderators); + + String myEmail = userClient.getEmail(); @@ -301,13 +311,16 @@ public class TestClientServices { } } - //@Test + @Test public void writeUserPost() throws Exception{ PostClient postClient = new PostClient(); - PostInputBean toWrite = new PostInputBean("Testing social networking rest client", null, null, null, null, null, false, null); - Post written = postClient.writeUserPost(toWrite); - logger.debug("Written post is " + written); + PostInputBean postInputBean = new PostInputBean(); + postInputBean.setText("Testing social networking rest client at " + new Date()); + //Post post = postClient.writeApplicationPost(postInputBean); + PostInputBean post = new PostInputBean("Testing social networking rest client", null, null, null, null, null, false, null); + Post written = postClient.writeUserPost(postInputBean); + logger.debug("Written post is " + post); } From 04fef1f26dc84809b359fc803b3a616dfdf6d292 Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Fri, 1 Dec 2023 15:14:37 +0100 Subject: [PATCH 2/3] fixed changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cff262e..90c7689 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## [v1.3.1] - 2023-11-20 +## [v1.3.1-SNAPSHOT] - 2023-11-20 - Corresponding API calls for all the public functions in Social Networking Library From 23daa62c05d11d7c67e111290ee8a5f44183c165 Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Fri, 1 Dec 2023 15:17:11 +0100 Subject: [PATCH 3/3] version 2.0 Snapshot --- CHANGELOG.md | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90c7689..cf0db01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## [v1.3.1-SNAPSHOT] - 2023-11-20 +## [v2.0.0-SNAPSHOT] - 2023-11-01 - Corresponding API calls for all the public functions in Social Networking Library diff --git a/pom.xml b/pom.xml index 76deeb1..fba9467 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ org.gcube.social-networking social-service-client - 1.3.1-SNAPSHOT + 2.0.0-SNAPSHOT social-networking-service-client jar The social networking web service client library