Merge remote-tracking branch 'origin/Feature/26044' into Feature/26044

This commit is contained in:
Ahmed Salah Tawfik Ibrahim 2023-12-04 16:06:39 +01:00
commit 39b76c1476
5 changed files with 22 additions and 9 deletions

View File

@ -18,7 +18,7 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/Java 8"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes> <attributes>
<attribute name="module" value="true"/> <attribute name="module" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>

View File

@ -1,6 +1,6 @@
# Changelog # Changelog
## [v1.3.1] - 2023-11-20 ## [v2.0.0-SNAPSHOT] - 2023-11-01
- Corresponding API calls for all the public functions in Social Networking Library - Corresponding API calls for all the public functions in Social Networking Library

View File

@ -12,7 +12,7 @@
<groupId>org.gcube.social-networking</groupId> <groupId>org.gcube.social-networking</groupId>
<artifactId>social-service-client</artifactId> <artifactId>social-service-client</artifactId>
<version>1.3.1-SNAPSHOT</version> <version>2.0.0-SNAPSHOT</version>
<name>social-networking-service-client</name> <name>social-networking-service-client</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<description>The social networking web service client library</description> <description>The social networking web service client library</description>

View File

@ -135,7 +135,7 @@ public class UserClient extends BaseClient{
Validate.isTrue(localRole != null, "role cannot be null"); 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 thisMethodSignature = "get-usernames-by-role";
String request = getServiceEndpoint() + thisMethodSignature + "?role-name=" + localRole; String request = getServiceEndpoint() + thisMethodSignature + "?role-name=" + localRole;
return HttpClient.get(new GenericType<ResponseBean<ArrayList<String>>>(){}, request); return HttpClient.get(new GenericType<ResponseBean<ArrayList<String>>>(){}, request);

View File

@ -3,6 +3,7 @@ package org.gcube.portal.social_networking_client_library;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -54,8 +55,11 @@ public class TestClientServices {
@Before @Before
public void setContextAndToken(){ public void setContextAndToken(){
//ScopeProvider.instance.set("/d4science.research-infrastructures.eu/gCubeApps/gCube");
//String umaToken = "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJySUJPYjZZY3p2ZE4xNVpuNHFkUTRLdEQ5VUhyY1dwNWJCT3NaLXpYbXM0In0.eyJleHAiOjE2NjM2NjU2NTgsImlhdCI6MTY2MzY2NTM1OCwiYXV0aF90aW1lIjoxNjYzNjY0MTg1LCJqdGkiOiIxMjNhYmY0MS1lZmE1LTQ4ZjEtYmE2Zi03MjNkOWZjNDAwMWQiLCJpc3MiOiJodHRwczovL2FjY291bnRzLmQ0c2NpZW5jZS5vcmcvYXV0aC9yZWFsbXMvZDRzY2llbmNlIiwiYXVkIjoiJTJGZDRzY2llbmNlLnJlc2VhcmNoLWluZnJhc3RydWN0dXJlcy5ldSUyRmdDdWJlQXBwcyUyRmdDdWJlIiwic3ViIjoiMzM4OGQwZjgtM2E0OS00ZGEwLWE3OGUtN2I2MjI1OTI2M2U2IiwidHlwIjoiQmVhcmVyIiwiYXpwIjoidmxhYi5pc3RpLmNuci5pdCIsInNlc3Npb25fc3RhdGUiOiI3MjRkMmJmOS00NjQ2LTQwZjAtOTY1ZC02MzFlODJiZWZkMmEiLCJhY3IiOiIxIiwiYWxsb3dlZC1vcmlnaW5zIjpbIi8qIl0sInJlc291cmNlX2FjY2VzcyI6eyIlMkZkNHNjaWVuY2UucmVzZWFyY2gtaW5mcmFzdHJ1Y3R1cmVzLmV1JTJGZ0N1YmVBcHBzJTJGZ0N1YmUiOnsicm9sZXMiOlsiVlJFLU1hbmFnZXIiLCJNZW1iZXIiXX19LCJhdXRob3JpemF0aW9uIjp7InBlcm1pc3Npb25zIjpbeyJyc2lkIjoiYWNlM2ZmNWQtYjU2ZS00MDgzLTljMzAtMjY0NTJiODc3YWIzIiwicnNuYW1lIjoiRGVmYXVsdCBSZXNvdXJjZSJ9XX0sInNjb3BlIjoicHJvZmlsZSBlbWFpbCIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJuYW1lIjoiTWFzc2ltaWxpYW5vIEFzc2FudGUiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJtYXNzaW1pbGlhbm8uYXNzYW50ZSIsImdpdmVuX25hbWUiOiJNYXNzaW1pbGlhbm8iLCJmYW1pbHlfbmFtZSI6IkFzc2FudGUiLCJlbWFpbCI6Im1hc3NpbWlsaWFuby5hc3NhbnRlQGlzdGkuY25yLml0In0.KIxC9QYGZCp6jAdye_82q648JjZli9KMxe-lqyFWkuA-HaZ-Ig2lWyn747iKp3UmstQgCTTonmOsVANHp1Feu_U1CuiWqRZ8OhmrTj8Q5v-FKwVtN2GfbjOF9b4aMXySFPd1HtCGHJ4o57uUrIQvvOV_SJOK5SOjG0YzOmsrOcXzSPl97ZZLKwio-Py0rxN6fdK8Obx7TL1eGgllhAI7ZDFRfoZrbz-F1YL1IPlQ6RI76rb7sbt6oL-T6LirP92AmUaW_nTLBBqrFR7uCaZdZKIDd4zxBmyzXjkNHncMKg8yFl-i1SRe58EcucMwEN0O-kUkhIb2CzaClsiWcLjP5g";
ScopeProvider.instance.set("/gcube/devsec/devVRE"); ScopeProvider.instance.set("/gcube/devsec/devVRE");
String umaToken = ""; String umaToken = "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJSSklZNEpoNF9qdDdvNmREY0NlUDFfS1l0akcxVExXVW9oMkQ2Tzk1bFNBIn0.eyJleHAiOjE2NjYyODUxMDYsImlhdCI6MTY2NjI4NDgwNiwiYXV0aF90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3VlLU1vZGVyYXRvciIsIk1lbWJlciJdfX0sImF1dGhvcml6YXRpb24iOnsicGVybWlzc2lvbnMiOlt7InJzaWQiOiI1NzI4NTUxMC0zOTM5LTRkZTctOGZjMS1lM2E5ZDNjY2UyODEiLCJyc25hbWUiOiJEZWZhdWx0IFJlc291cmNlIn1dfSwic2NvcGUiOiJlbWFpbCBwcm9maWxlIiwic2lkIjoiZjI2MjU0MjAtNzRjNS00NTQ0LWI2NmEtZGZhMDhkNjdkNDU0IiwiZW1haWxfdmVyaWZpZWQiOnRydWUsIm5hbWUiOiJMdWNhIEZyb3NpbmkiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJsdWNhLmZyb3NpbmkiLCJnaXZlbl9uYW1lIjoiTHVjYSIsImZhbWlseV9uYW1lIjoiRnJvc2luaSIsImVtYWlsIjoibHVjYS5mcm9zaW5pQGlzdGkuY25yLml0In0.jt43mGeSm_4hVNFThTBmmOxzotsTHPp0DKDzBNAgESFkzNRb7ZE1j7Ab_1M6fqjpciLsk093XTEpws0OksUEAWUgxj5iAOXopJKRr6cCnmQXitWTa8WpwWZyj6AiI8PSgHCQhY3-CU8mptmd4acDtagHSbhZ320aNx7rLTaZ_7KEdRmErmgzWhnPwD3O2ONcnxIuAL1rqu4o8SJl-cj5ppFc2V54VSY56AT2IK2GmP_he9R32_0K_F0SAwsuDmv7eF1MwQM7j27H9ewfEKP8w9RooZtZYj3Pm7-Ac4XSir9w5eG1xKOyiGbIlvJZU4FQwXINntUVTVPVfPaXZ_ZbOw";
AccessTokenProvider.instance.set(umaToken); AccessTokenProvider.instance.set(umaToken);
SecurityTokenProvider.instance.set(""); SecurityTokenProvider.instance.set("");
} }
@ -221,6 +225,12 @@ public class TestClientServices {
assert(vreManagers != null && !vreManagers.isEmpty()); assert(vreManagers != null && !vreManagers.isEmpty());
System.out.println("Data Managers are " + vreManagers); System.out.println("Data Managers are " + vreManagers);
List<String> moderators = userClient.getAllUsernamesByLocalRole("VRE-Managers");
assert(moderators != null && !moderators.isEmpty());
System.out.println("Catalogue-Moderators are " + moderators);
String myEmail = userClient.getEmail(); String myEmail = userClient.getEmail();
assert(myEmail != null && !myEmail.isEmpty()); assert(myEmail != null && !myEmail.isEmpty());
@ -301,13 +311,16 @@ public class TestClientServices {
} }
} }
//@Test @Test
public void writeUserPost() throws Exception{ public void writeUserPost() throws Exception{
PostClient postClient = new PostClient(); PostClient postClient = new PostClient();
PostInputBean toWrite = new PostInputBean("Testing social networking rest client", null, null, null, null, null, false, null); PostInputBean postInputBean = new PostInputBean();
Post written = postClient.writeUserPost(toWrite); postInputBean.setText("Testing social networking rest client at " + new Date());
logger.debug("Written post is " + written); //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);
} }