git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-transfer/data-transfer-library@142792 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
89a71af32b
commit
700e759ef7
24
pom.xml
24
pom.xml
|
@ -8,17 +8,17 @@
|
|||
</parent>
|
||||
<groupId>org.gcube.data.transfer</groupId>
|
||||
<artifactId>data-transfer-library</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<name>DataTransfer-library</name>
|
||||
<description>Data Transfer Service client library</description>
|
||||
|
||||
<properties>
|
||||
<description>Data Transfer Service client library</description>
|
||||
|
||||
<properties>
|
||||
<distroDirectory>${project.basedir}/distro</distroDirectory>
|
||||
<svnBaseUrl>http://svn.research-infrastructures.eu/d4science/gcube/trunk/data-transfer/${project.artifactId}</svnBaseUrl>
|
||||
</properties>
|
||||
|
||||
|
||||
<scm>
|
||||
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:${svnBaseUrl}/${project.artifactId}</connection>
|
||||
<developerConnection>scm:svn:${svnBaseUrl}/${project.artifactId}</developerConnection>
|
||||
<url>${svnBaseUrl}/${project.artifactId}</url>
|
||||
|
@ -84,10 +84,16 @@
|
|||
<version>2.22.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency> -->
|
||||
<!-- <groupId>org.glassfish.jersey.media</groupId> -->
|
||||
<!-- <artifactId>jersey-media-jaxb</artifactId> -->
|
||||
<!-- <version>2.18</version> -->
|
||||
<!-- </dependency> -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
<artifactId>jersey-media-jaxb</artifactId>
|
||||
<version>2.18</version>
|
||||
<artifactId>jersey-media-moxy</artifactId>
|
||||
<version>2.25.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
@ -7,7 +7,6 @@ import javax.ws.rs.core.MediaType;
|
|||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.gcube.data.transfer.library.faults.CommunicationException;
|
||||
import org.gcube.data.transfer.library.faults.DataTransferException;
|
||||
import org.gcube.data.transfer.library.faults.RemoteServiceException;
|
||||
import org.gcube.data.transfer.library.faults.ServiceNotFoundException;
|
||||
import org.gcube.data.transfer.model.ServiceConstants;
|
||||
|
@ -55,7 +54,7 @@ public class Client {
|
|||
WebTarget capabilitiesTarget=rootTarget.path(ServiceConstants.CAPABILTIES_SERVLET_NAME);
|
||||
log.debug("Getting capabilities from {}, path is {} ",endpoint,capabilitiesTarget.getUri());
|
||||
try{
|
||||
Response resp=capabilitiesTarget.request().accept(MediaType.APPLICATION_XML_TYPE).get();
|
||||
Response resp=capabilitiesTarget.request().accept(MediaType.APPLICATION_JSON_TYPE).get();
|
||||
checkResponse(resp);
|
||||
return resp.readEntity(TransferCapabilities.class);
|
||||
}catch(Exception e){
|
||||
|
@ -67,7 +66,7 @@ public class Client {
|
|||
public TransferTicket submit(TransferRequest request) throws RemoteServiceException{
|
||||
log.debug("Sending request {} to {}",request,endpoint);
|
||||
try{
|
||||
Response resp=rootTarget.path(ServiceConstants.REQUESTS_SERVLET_NAME).request(MediaType.APPLICATION_XML_TYPE).post(Entity.entity(request,MediaType.APPLICATION_XML));
|
||||
Response resp=rootTarget.path(ServiceConstants.REQUESTS_SERVLET_NAME).request(MediaType.APPLICATION_JSON_TYPE).post(Entity.entity(request,MediaType.APPLICATION_JSON_TYPE));
|
||||
checkResponse(resp);
|
||||
return resp.readEntity(TransferTicket.class);
|
||||
}catch(Exception e){
|
||||
|
@ -78,7 +77,7 @@ public class Client {
|
|||
public TransferTicket getTransferStatus(String transferId) throws RemoteServiceException{
|
||||
log.debug("Requesting transfer status [id = {}, endpoint={}]",transferId,endpoint);
|
||||
try{
|
||||
Response resp=rootTarget.path(ServiceConstants.STATUS_SERVLET_NAME).path(transferId).request(MediaType.APPLICATION_XML).get();
|
||||
Response resp=rootTarget.path(ServiceConstants.STATUS_SERVLET_NAME).path(transferId).request(MediaType.APPLICATION_JSON_TYPE).get();
|
||||
checkResponse(resp);
|
||||
return resp.readEntity(TransferTicket.class);
|
||||
}catch(Exception e){
|
||||
|
|
|
@ -28,8 +28,8 @@ import org.junit.Test;
|
|||
|
||||
public class TestClientCalls {
|
||||
|
||||
static String hostname="http://node3-d-d4s.d4science.org:80";
|
||||
// static String hostname="http://pc-fabio.isti.cnr.it:8080";
|
||||
static String hostname="http://node3-d-d4s.d4science.org";
|
||||
// static String hostname="https://geoserver1-spatial-dev.d4science.org";
|
||||
static String scope="/gcube/devNext";
|
||||
static Client client;
|
||||
|
||||
|
@ -54,7 +54,7 @@ public class TestClientCalls {
|
|||
dest.setSubFolder("bla/bla/bllaaa");
|
||||
dest.setOnExistingFileName(DestinationClashPolicy.ADD_SUFFIX);
|
||||
dest.setOnExistingSubFolder(DestinationClashPolicy.APPEND);
|
||||
TransferRequest request= new TransferRequest("", new HttpDownloadSettings(new URL("http://goo.gl/oLP7zG"), HttpDownloadOptions.DEFAULT),dest);
|
||||
TransferRequest request= new TransferRequest("", new HttpDownloadSettings(new URL("http://goo.gl/H4lDjo"), HttpDownloadOptions.DEFAULT),dest);
|
||||
System.out.println("Submitting "+request);
|
||||
TransferTicket ticket=client.submit(request);
|
||||
System.out.println("Ticket is "+ticket);
|
||||
|
@ -79,7 +79,7 @@ public class TestClientCalls {
|
|||
// WebTarget target=client.target(hostname+"/data-transfer-service/gcube/service/Capabilities");
|
||||
System.out.println("Asking capabilities to target : "+target.getUri());
|
||||
System.out.println(target.
|
||||
request(MediaType.APPLICATION_XML).get(TransferCapabilities.class));
|
||||
request(MediaType.APPLICATION_JSON_TYPE).get(TransferCapabilities.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue