Fix jersey conflict by using moxy
This commit is contained in:
parent
a920916829
commit
648ef893d4
31
pom.xml
31
pom.xml
|
@ -121,25 +121,24 @@
|
|||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency> -->
|
||||
<!-- <groupId>org.glassfish.jersey.media</groupId> -->
|
||||
<!-- <artifactId>jersey-media-json-jackson</artifactId> -->
|
||||
<!-- -->
|
||||
<!-- <exclusions> -->
|
||||
<!-- <exclusion> -->
|
||||
<!-- <artifactId>jackson-annotations</artifactId> -->
|
||||
<!-- <groupId>com.fasterxml.jackson.core</groupId> -->
|
||||
<!-- </exclusion> -->
|
||||
<!-- </exclusions> -->
|
||||
<!-- </dependency> -->
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
<artifactId>jersey-media-json-jackson</artifactId>
|
||||
<!-- <version>${jersey-version}</version> -->
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
<artifactId>jersey-media-moxy</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- <dependency> -->
|
||||
<!-- <groupId>org.glassfish.jersey.media</groupId> -->
|
||||
<!-- <artifactId>jersey-media-moxy</artifactId> -->
|
||||
<!-- <version>2.25.1</version> -->
|
||||
<!-- </dependency> -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
<artifactId>jersey-media-multipart</artifactId>
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.net.MalformedURLException;
|
|||
import java.net.URL;
|
||||
|
||||
import javax.ws.rs.NotFoundException;
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
import javax.ws.rs.client.Entity;
|
||||
import javax.ws.rs.client.WebTarget;
|
||||
import javax.ws.rs.core.Application;
|
||||
|
@ -23,7 +24,6 @@ import org.gcube.data.transfer.model.settings.HttpDownloadSettings;
|
|||
import org.gcube.data.transfer.service.transfers.Capabilities;
|
||||
import org.gcube.data.transfer.service.transfers.engine.CapabilitiesProvider;
|
||||
import org.gcube.data.transfer.service.transfers.engine.PersistenceProvider;
|
||||
import org.gcube.data.transfer.service.transfers.engine.PluginManager;
|
||||
import org.gcube.data.transfer.service.transfers.engine.RequestManager;
|
||||
import org.gcube.data.transfer.service.transfers.engine.TicketManager;
|
||||
import org.glassfish.hk2.utilities.binding.AbstractBinder;
|
||||
|
@ -113,7 +113,7 @@ public class TestCall extends JerseyTest {
|
|||
@Test
|
||||
public void RESTUpload(){
|
||||
FormDataMultiPart multipart = new FormDataMultiPart();
|
||||
File toSend=new File("/home/fabio/life@dev2.d4science.org");
|
||||
File toSend=getFileFromResources("logback.xml");
|
||||
Assert.assertTrue(toSend!=null);
|
||||
Assert.assertTrue(toSend.exists());
|
||||
multipart.bodyPart(new FileDataBodyPart(ServiceConstants.MULTIPART_FILE, toSend));
|
||||
|
@ -132,19 +132,19 @@ public class TestCall extends JerseyTest {
|
|||
return target(ServiceConstants.REQUESTS_SERVLET_NAME).request(MediaType.APPLICATION_JSON).post(Entity.entity(req,MediaType.APPLICATION_JSON),TransferTicket.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
public void testREAD() {
|
||||
System.out.println(target(ServiceConstants.REST_SERVLET_NAME).path("data-transfer-service/temp.txt").request().get());
|
||||
System.out.println(target(ServiceConstants.REST_SERVLET_NAME).path("data-transfer-service/some/folder/inside/temp.txt").request().get());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(expected=WebApplicationException.class)
|
||||
public void testHEAD() {
|
||||
System.out.println(target(ServiceConstants.REST_SERVLET_NAME).path("data-transfer-service/temp.txt").request(MediaType.APPLICATION_JSON).head().readEntity(RemoteFileDescriptor.class));
|
||||
System.out.println(target(ServiceConstants.REST_SERVLET_NAME).path("data-transfer-service/some/folder/inside/temp.txt").request(MediaType.APPLICATION_JSON).head().readEntity(RemoteFileDescriptor.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(expected=WebApplicationException.class)
|
||||
public void testDELETE() {
|
||||
System.out.println(target(ServiceConstants.REST_SERVLET_NAME).path("data-transfer-service/temp.txt").request(MediaType.APPLICATION_JSON).head().readEntity(RemoteFileDescriptor.class));
|
||||
System.out.println(target(ServiceConstants.REST_SERVLET_NAME).path("data-transfer-service/some/folder/inside/temp.txt").request(MediaType.APPLICATION_JSON).head().readEntity(RemoteFileDescriptor.class));
|
||||
|
@ -153,4 +153,19 @@ public class TestCall extends JerseyTest {
|
|||
System.out.println(target(ServiceConstants.REST_SERVLET_NAME).path("data-transfer-service/some/folder/inside/temp.txt").request(MediaType.APPLICATION_JSON).delete().readEntity(DeletionReport.class));
|
||||
|
||||
}
|
||||
|
||||
private static File getFileFromResources(String fileName) {
|
||||
|
||||
ClassLoader classLoader =TestCall.class.getClassLoader();
|
||||
|
||||
URL resource = classLoader.getResource(fileName);
|
||||
if (resource == null) {
|
||||
throw new IllegalArgumentException("file is not found!");
|
||||
} else {
|
||||
return new File(resource.getFile());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue