|
|
|
@ -17,9 +17,9 @@ import org.junit.Test;
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
public class UriResolverManagerTest {
|
|
|
|
|
|
|
|
|
|
//@Test
|
|
|
|
|
public void testUriResolverManger(){
|
|
|
|
|
|
|
|
|
|
// @Test
|
|
|
|
|
public void testUriResolverManger() {
|
|
|
|
|
UriResolverManager manager;
|
|
|
|
|
try {
|
|
|
|
|
ScopeProvider.instance.set("/gcube/devsec/devVRE");
|
|
|
|
@ -35,29 +35,49 @@ public class UriResolverManagerTest {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//@Test
|
|
|
|
|
public void testCTLG(){
|
|
|
|
|
public void testCTLG() {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
try {
|
|
|
|
|
ScopeProvider.instance.set("/gcube/devsec/devVRE");
|
|
|
|
|
UriResolverManager resolver;
|
|
|
|
|
resolver = new UriResolverManager("CTLG");
|
|
|
|
|
Map<String, String> params = new HashMap<String, String>();
|
|
|
|
|
params.put("gcube_scope","/gcube/devsec/devVRE");
|
|
|
|
|
params.put("entity_context","dataset");
|
|
|
|
|
params.put("entity_name","sarda-sarda");
|
|
|
|
|
String shortLink = resolver.getLink(params, true); //true, link is shorted otherwise none
|
|
|
|
|
params.put("gcube_scope", "/gcube/devsec/devVRE");
|
|
|
|
|
params.put("entity_context", "dataset");
|
|
|
|
|
params.put("entity_name", "sarda-sarda");
|
|
|
|
|
String shortLink = resolver.getLink(params, true); // true, link is shorted otherwise none
|
|
|
|
|
System.out.println(shortLink);
|
|
|
|
|
} catch (UriResolverMapException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
} catch (IllegalArgumentException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//@Test
|
|
|
|
|
public void testSHUB() {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
ScopeProvider.instance.set("/gcube/devsec/devVRE");
|
|
|
|
|
UriResolverManager resolver;
|
|
|
|
|
resolver = new UriResolverManager("SHUB");
|
|
|
|
|
Map<String, String> params = new HashMap<String, String>();
|
|
|
|
|
params.put("id", "1dac6703-8eb0-4838-83a8-5006f5074e9b");
|
|
|
|
|
params.put("content-disposition", "inline");
|
|
|
|
|
String shortLink = resolver.getLink(params, true); // true, link is shorted otherwise none
|
|
|
|
|
System.out.println(shortLink);
|
|
|
|
|
} catch (UriResolverMapException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
} catch (IllegalArgumentException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//@Test
|
|
|
|
|
public void testGIS() {
|
|
|
|
@ -69,59 +89,59 @@ public class UriResolverManagerTest {
|
|
|
|
|
params.put("gis-UUID", "1a657005-29c6-4528-a115-69640c4c2900");
|
|
|
|
|
params.put("scope", "/pred4s/preprod/preVRE");
|
|
|
|
|
String shortLink = resolver.getLink(params, false);
|
|
|
|
|
System.out.println(shortLink); //true, link is shorted otherwise none
|
|
|
|
|
System.out.println(shortLink); // true, link is shorted otherwise none
|
|
|
|
|
} catch (UriResolverMapException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
} catch (IllegalArgumentException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// @Test
|
|
|
|
|
// @Test
|
|
|
|
|
public void testSMP() {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
ScopeProvider.instance.set("/gcube/devsec/devVRE");
|
|
|
|
|
UriResolverManager resolver = new UriResolverManager("SMP");
|
|
|
|
|
Map<String, String> params = new HashMap<String, String>();
|
|
|
|
|
params.put("smp-uri","smp://Wikipedia_logo_silver.png?5ezvFfBOLqaqBlwCEtAvz4ch5BUu1ag3yftpCvV gayz9bAtSsnO1/sX6pemTKbDe0qbchLexXeWgGcJlskYE8td9QSDXSZj5VSl9kdN9SN0/LRYaWUZuP4Q1J7lEiwkU4GKPsiD6PDRVcT4QAqTEy5hSIbr6o4Y");
|
|
|
|
|
params.put("smp-uri",
|
|
|
|
|
"smp://Wikipedia_logo_silver.png?5ezvFfBOLqaqBlwCEtAvz4ch5BUu1ag3yftpCvV gayz9bAtSsnO1/sX6pemTKbDe0qbchLexXeWgGcJlskYE8td9QSDXSZj5VSl9kdN9SN0/LRYaWUZuP4Q1J7lEiwkU4GKPsiD6PDRVcT4QAqTEy5hSIbr6o4Y");
|
|
|
|
|
params.put("fileName", "wikipediaLogo");
|
|
|
|
|
params.put("contentType", "");
|
|
|
|
|
String shortLink = resolver.getLink(params, true); //true, link is shorted otherwise none
|
|
|
|
|
String shortLink = resolver.getLink(params, true); // true, link is shorted otherwise none
|
|
|
|
|
System.out.println(shortLink);
|
|
|
|
|
} catch (UriResolverMapException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
} catch (IllegalArgumentException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Thread safe
|
|
|
|
|
*/
|
|
|
|
|
// @Test
|
|
|
|
|
public void testSMPID(){
|
|
|
|
|
// @Test
|
|
|
|
|
public void testSMPID() {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
try {
|
|
|
|
|
ScopeProvider.instance.set("/gcube/devsec/devVRE");
|
|
|
|
|
UriResolverManager resolver;
|
|
|
|
|
resolver = new UriResolverManager("SMP-ID");
|
|
|
|
|
Map<String, String> params = new HashMap<String, String>();
|
|
|
|
|
params.put("geo-exp","553f9265e4b0567b75021fce");
|
|
|
|
|
params.put("geo-exp", "553f9265e4b0567b75021fce");
|
|
|
|
|
// params.put("fileName", "dog");
|
|
|
|
|
// params.put("contentType", "image/jpg");
|
|
|
|
|
String shortLink = resolver.getLink(params, true); //true, link is shorted otherwise none
|
|
|
|
|
String shortLink = resolver.getLink(params, true); // true, link is shorted otherwise none
|
|
|
|
|
System.out.println(shortLink);
|
|
|
|
|
} catch (UriResolverMapException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
} catch (IllegalArgumentException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -129,45 +149,45 @@ public class UriResolverManagerTest {
|
|
|
|
|
/**
|
|
|
|
|
* Thread safe
|
|
|
|
|
*/
|
|
|
|
|
//@Test
|
|
|
|
|
public void test2(){
|
|
|
|
|
|
|
|
|
|
// @Test
|
|
|
|
|
public void test2() {
|
|
|
|
|
|
|
|
|
|
//create thread to print counter value
|
|
|
|
|
Thread t = new Thread(new Runnable() {
|
|
|
|
|
// create thread to print counter value
|
|
|
|
|
Thread t = new Thread(new Runnable() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
while (true) {
|
|
|
|
|
try {
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
while (true) {
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
ScopeProvider.instance.set("/gcube/devsec/devVRE");
|
|
|
|
|
UriResolverManager resolver;
|
|
|
|
|
ScopeProvider.instance.set("/gcube/devsec/devVRE");
|
|
|
|
|
UriResolverManager resolver;
|
|
|
|
|
resolver = new UriResolverManager("GIS");
|
|
|
|
|
|
|
|
|
|
Map<String, String> params = new HashMap<String, String>();
|
|
|
|
|
params.put("gis-UUID", "eb1a1b63-f324-47ee-9522-b8f5803e19ec");
|
|
|
|
|
params.put("scope", "/gcube/devsec/devVRE");
|
|
|
|
|
String shortLink = resolver.getLink(params, true);
|
|
|
|
|
System.out.println(shortLink); //true, link is shorted otherwise none
|
|
|
|
|
|
|
|
|
|
System.out.println("Thread "+Thread.currentThread().getId() +" reading counter is: " + resolver.countReaders());
|
|
|
|
|
Thread.sleep(1000);
|
|
|
|
|
} catch (InterruptedException ex) {
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
}catch (UriResolverMapException e) {
|
|
|
|
|
Map<String, String> params = new HashMap<String, String>();
|
|
|
|
|
params.put("gis-UUID", "eb1a1b63-f324-47ee-9522-b8f5803e19ec");
|
|
|
|
|
params.put("scope", "/gcube/devsec/devVRE");
|
|
|
|
|
String shortLink = resolver.getLink(params, true);
|
|
|
|
|
System.out.println(shortLink); // true, link is shorted otherwise none
|
|
|
|
|
|
|
|
|
|
System.out.println("Thread " + Thread.currentThread().getId() + " reading counter is: "
|
|
|
|
|
+ resolver.countReaders());
|
|
|
|
|
Thread.sleep(1000);
|
|
|
|
|
} catch (InterruptedException ex) {
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
} catch (UriResolverMapException e) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
} catch (IllegalArgumentException e) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
t.start();
|
|
|
|
|
t.start();
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
Thread.sleep(1000);
|
|
|
|
|