updated junit test

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-transfer/uri-resolver@176263 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2018-12-28 14:02:22 +00:00
parent 63c81e26c5
commit 0915833a4d
1 changed files with 5 additions and 3 deletions

View File

@ -20,6 +20,7 @@ import org.apache.commons.io.IOUtils;
import org.apache.http.HttpStatus; import org.apache.http.HttpStatus;
import org.gcube.datatransfer.resolver.applicationprofile.ApplicationProfileReader; import org.gcube.datatransfer.resolver.applicationprofile.ApplicationProfileReader;
import org.gcube.datatransfer.resolver.util.HTTPCallsUtils; import org.gcube.datatransfer.resolver.util.HTTPCallsUtils;
import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -45,7 +46,7 @@ public class TestResolvers {
//@Test //@Test
public void testStorageHub() throws Exception{ public void testStorageHub() throws Exception{
String storageHubId = "2019b881-083b-444a-81be-8abee4b91020"; String storageHubId = "E_RHdYOUxBSGJ3dU1ESjEyMXNuc2ZMRm5HbXh0d1ZqaWJ4MHBaN0lOZ0dBR1dCQlVhWnVIS0hrdmN2VDhkTXk0UA==";
String url = String.format("%s/shub/%s",URI_RESOLVER_SERVICE_ENDPOINT,storageHubId); String url = String.format("%s/shub/%s",URI_RESOLVER_SERVICE_ENDPOINT,storageHubId);
logger.info("Request to URL: "+url); logger.info("Request to URL: "+url);
URL toURL; URL toURL;
@ -56,6 +57,7 @@ public class TestResolvers {
con.setRequestMethod("GET"); con.setRequestMethod("GET");
con.connect(); con.connect();
status = con.getResponseCode(); status = con.getResponseCode();
System.out.println("header fields: "+con.getHeaderFields());
String fileName = getFilename(con.getHeaderFields()); String fileName = getFilename(con.getHeaderFields());
System.out.println("Response status is: "+status); System.out.println("Response status is: "+status);
if(status==HttpStatus.SC_OK){ if(status==HttpStatus.SC_OK){
@ -169,7 +171,7 @@ public class TestResolvers {
* *
* @throws Exception the exception * @throws Exception the exception
*/ */
//@Test @Test
public void testCatalogueResolver() throws Exception{ public void testCatalogueResolver() throws Exception{
String entityName = "sarda-sarda"; String entityName = "sarda-sarda";
@ -393,7 +395,7 @@ public class TestResolvers {
public static String getFilename(Map<String, List<String>> map){ public static String getFilename(Map<String, List<String>> map){
String fileName = "filename"; String fileName = "filename";
List<String> contentDispValue = map.get("content-disposition"); List<String> contentDispValue = map.get("Content-Disposition");
if(contentDispValue==null) if(contentDispValue==null)
return fileName; return fileName;