fixed pom

This commit is contained in:
Massimiliano Assante 2022-04-06 16:03:52 +02:00
parent 4ce15287fc
commit a3dc89b6d7
5 changed files with 59 additions and 48 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>social-networking-client-library</name>
<name>social-service-client</name>
<comment></comment>
<projects>
</projects>

50
pom.xml
View File

@ -1,6 +1,4 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@ -11,9 +9,9 @@
<groupId>org.gcube.social-networking</groupId>
<artifactId>social-networking-client-library</artifactId>
<artifactId>social-service-client</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>social-networking-client-library</name>
<name>social-networking-service-client</name>
<packaging>jar</packaging>
<description>The social networking web service client library</description>
@ -22,14 +20,14 @@
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>gcube-bom</artifactId>
<version>2.0.2</version>
<version>2.0.2-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>3.6.3</version>
<artifactId>gcube-smartgears-bom</artifactId>
<version>2.1.1-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -47,16 +45,16 @@
</properties>
<scm>
<connection>scm:git:https://code-repo.d4science.org/gCubeSystem/social-networking-library-ws.git</connection>
<developerConnection>scm:git:https://code-repo.d4science.org/gCubeSystem/social-networking-library-ws.git</developerConnection>
<url>https://code-repo.d4science.org/gCubeSystem/social-networking-library-ws</url>
<connection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</connection>
<developerConnection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</developerConnection>
<url>https://code-repo.d4science.org/gCubeSystem/${project.artifactId}</url>
</scm>
<dependencies>
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>social-networking-library</artifactId>
<version>[1.16.0, 2.0.0)</version>
<scope>compile</scope>
</dependency>
<dependency>
@ -67,11 +65,12 @@
<dependency>
<groupId>org.gcube.social-networking</groupId>
<artifactId>social-service-model</artifactId>
<version>[1.0.0-SNAPSHOT,)</version>
<version>[1.0.0-SNAPSHOT, 2.0.0)</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
<scope>compile</scope>
</dependency>
<dependency>
@ -89,17 +88,19 @@
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>provided</scope>
</dependency>
<!-- Test libraries -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
@ -107,17 +108,20 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exploded</goal>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<webappDirectory>${webappDirectory}</webappDirectory>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>

View File

@ -8,6 +8,7 @@ import javax.ws.rs.core.GenericType;
import org.apache.commons.lang.Validate;
import org.gcube.social_networking.social_networking_client_library.utils.HttpClient;
import org.gcube.social_networking.socialnetworking.model.beans.Message;
import org.gcube.social_networking.socialnetworking.model.beans.MessageInbox;
import org.gcube.social_networking.socialnetworking.model.output.ResponseBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -30,12 +31,12 @@ public class MessageClient extends BaseClient{
* Get sent messages
* @return
*/
public List<Message> getSentMessages(){
public List<MessageInbox> getSentMessages(){
logger.debug("Request for sent messages");
String thisMethodSignature = "get-sent-messages";
String request = getServiceEndpoint() + thisMethodSignature + "?";
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Message>>>(){}, request);
return HttpClient.get(new GenericType<ResponseBean<ArrayList<MessageInbox>>>(){}, request);
}
@ -43,12 +44,12 @@ public class MessageClient extends BaseClient{
* Get received messages
* @return
*/
public List<Message> getReceivedMessages(){
public List<MessageInbox> getReceivedMessages(){
logger.debug("Request for received messages");
String thisMethodSignature = "get-received-messages";
String request = getServiceEndpoint() + thisMethodSignature + "?";
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Message>>>(){}, request);
return HttpClient.get(new GenericType<ResponseBean<ArrayList<MessageInbox>>>(){}, request);
}

View File

@ -12,17 +12,21 @@ import org.slf4j.LoggerFactory;
/**
* Authorization filter for the jersey client.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public class AuthorizationFilter implements ClientRequestFilter{
private final static String AUTH_TOKEN_PARAMETER = "Authorization";
private final static String LEGACY_AUTH_TOKEN_PARAMETER = "gcube-token";
private static Logger logger = LoggerFactory.getLogger(AuthorizationFilter.class);
@Override
public void filter(ClientRequestContext original) throws IOException {
logger.debug("Adding token to the request " + original.getUri());
String token = AccessTokenProvider.instance.get();
original.getHeaders().add(AUTH_TOKEN_PARAMETER, " Bearer " + token);
String legacyToken = SecurityTokenProvider.instance.get();
if (token != null)
original.getHeaders().add(AUTH_TOKEN_PARAMETER, " Bearer " + token);
if (legacyToken != null)
original.getHeaders().add(LEGACY_AUTH_TOKEN_PARAMETER, legacyToken);
}
}

View File

@ -25,6 +25,7 @@ import org.gcube.social_networking.social_networking_client_library.VREClient;
import org.gcube.social_networking.socialnetworking.model.beans.ApplicationId;
import org.gcube.social_networking.socialnetworking.model.beans.JobNotificationBean;
import org.gcube.social_networking.socialnetworking.model.beans.Message;
import org.gcube.social_networking.socialnetworking.model.beans.MessageInbox;
import org.gcube.social_networking.socialnetworking.model.beans.MyVRE;
import org.gcube.social_networking.socialnetworking.model.beans.PostInputBean;
import org.gcube.social_networking.socialnetworking.model.beans.Recipient;
@ -42,18 +43,18 @@ public class TestClientServices {
@Before
public void setContextAndToken(){
ScopeProvider.instance.set("/gcube");
AccessTokenProvider.instance.set("eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJSSklZNEpoNF9qdDdvNmREY0NlUDFfS1l0akcxVExXVW9oMkQ2Tzk1bFNBIn0.eyJleHAiOjE2NDkxNjgwNDEsImlhdCI6MTY0OTE2Nzc0MSwiYXV0aF90aW1lIjoxNjQ5MTY3NzQwLCJqdGkiOiIyMWRiOTc5Zi1kMWY1LTQxNzUtOGIzMy05NDExZGI3MjQ4NTAiLCJpc3MiOiJodHRwczovL2FjY291bnRzLmRldi5kNHNjaWVuY2Uub3JnL2F1dGgvcmVhbG1zL2Q0c2NpZW5jZSIsImF1ZCI6IiUyRmdjdWJlIiwic3ViIjoiNmE4MmY1ODctYzgwZS00OWUzLTg4YzYtYzExN2U5ZDhkM2Y3IiwidHlwIjoiQmVhcmVyIiwiYXpwIjoibmV4dC5kNHNjaWVuY2Uub3JnIiwic2Vzc2lvbl9zdGF0ZSI6ImU4YjczMGJjLWNmZGQtNGM3MS05MWU4LTI3NWIyZWYzNjE5ZCIsImFjciI6IjEiLCJhbGxvd2VkLW9yaWdpbnMiOlsiLyoiXSwicmVzb3VyY2VfYWNjZXNzIjp7IiUyRmdjdWJlIjp7InJvbGVzIjpbIkluZnJhc3RydWN0dXJlLU1hbmFnZX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naN9iEslwJJtAjeZiEdCBlnypw9Y1a8Fisc5p6f2IBBMaDtbE_omYTStBSDT84ZJMrspHIjstAinax0sY0h2tG-DBhdK6AI0D-MFiOL07FW4iQgizXh4qnpzVNL0vxIUQMYo99R4DYsZzcsrxnUL0qzhNHfN4PqdMRWpt-eRyKO15FvA7_HExAemOzYEFbRrw8JSpsXj6BNcRg9ZwRV7815WhbqhV-Cq3_PDjyiSw3mVGjeh1QmNTOSbBKniGYJo2nWBng3tP_HS0yoS1xRCS9d0PrjBEVdbRn-HlM4M43DA");
//SecurityTokenProvider.instance.set("");
}
//@Test
@Test
public void testSearch() throws Exception {
FullTextSearchClient search = new FullTextSearchClient();
ArrayList<EnhancedFeed> result = search.search("looking for test", 0, 10);
for (EnhancedFeed enhancedFeed : result) {
logger.debug("Returned feed " + enhancedFeed);
for (EnhancedFeed enhancedPost : result) {
logger.debug("Returned post " + enhancedPost);
}
}
@ -67,27 +68,28 @@ public class TestClientServices {
}
}
//@Test
@Test
public void testHashTags() throws Exception {
HashTagClient hashtags = new HashTagClient();
Map<String, Integer> hashtagsCount = hashtags.getHashtagsCount();
logger.debug("Returned tags " + hashtagsCount);
}
//@Test
@Test
public void testMessagesReceived() throws Exception {
MessageClient messagesClient = new MessageClient();
List<Message> receivedMessages = messagesClient.getReceivedMessages();
for (Message workspaceMessage : receivedMessages) {
List<MessageInbox> receivedMessages = messagesClient.getReceivedMessages();
System.out.println("Messages found # " + receivedMessages.size());
for (MessageInbox workspaceMessage : receivedMessages) {
logger.debug("Received message " + workspaceMessage.toString());
}
}
//@Test
@Test
public void testMessagesSent() throws Exception {
MessageClient messagesClient = new MessageClient();
List<Message> sentMessages = messagesClient.getSentMessages();
for (Message workspaceMessage : sentMessages) {
List<MessageInbox> sentMessages = messagesClient.getSentMessages();
for (MessageInbox workspaceMessage : sentMessages) {
logger.debug("Sent message was " + workspaceMessage);
}
}
@ -96,7 +98,7 @@ public class TestClientServices {
public void sendMessage() throws Exception{
logger.debug("Sending message ");
MessageClient messagesClient = new MessageClient();
List<Recipient> rec = Arrays.asList(new Recipient("andrea.rossi"), new Recipient("luca.frosini"));
List<Recipient> rec = Arrays.asList(new Recipient("andrea.rossi"));
Message message = new Message(
"Test message",
"Sending message via client " + System.currentTimeMillis(),
@ -114,21 +116,21 @@ public class TestClientServices {
}
}
//@Test
@Test
public void sendJobNotification() throws Exception {
NotificationClient notificationsClient = new NotificationClient();
JobNotificationBean notification = new JobNotificationBean(
"costantino.perciante",
"massimiliano.assante",
UUID.randomUUID().toString(),
"SmartExecutor Social Indexer",
"SmartExecutor",
"Workspace Application",
JobStatusType.SUCCEEDED,
"all ok");
notificationsClient.sendJobNotification(notification);
logger.debug("Sent job notification ");
}
//@Test
@Test
public void getProfile() throws Exception {
PeopleClient getProfile = new PeopleClient();
UserProfile profile = getProfile.getProfile();