Compare commits
11 Commits
task/19440
...
master
Author | SHA1 | Date |
---|---|---|
Giancarlo Panichi | beb6950af0 | |
Giancarlo Panichi | 96e12ce706 | |
Giancarlo Panichi | eb4f094d16 | |
Giancarlo Panichi | c9ed703475 | |
Giancarlo Panichi | ae50538c43 | |
Giancarlo Panichi | 2827116984 | |
Giancarlo Panichi | 1045787b99 | |
Giancarlo Panichi | 5bcb672007 | |
Francesco Mangiacrapa | 0af97deb46 | |
Francesco Mangiacrapa | 046a7036b6 | |
Francesco Mangiacrapa | 0b17e8377f |
|
@ -1,12 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="target/detachedres-library-1.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
<classpathentry kind="src" output="target/detachedres-library-1.1.0/WEB-INF/classes" path="src/main/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry excluding="**" kind="src" output="target/detachedres-library-1.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
<classpathentry excluding="**" kind="src" output="target/detachedres-library-1.1.0/WEB-INF/classes" path="src/main/resources">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
@ -33,5 +33,6 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/detachedres-library-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
||||||
|
<classpathentry kind="output" path="target/detachedres-library-1.1.0/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
# Changelog
|
||||||
|
|
||||||
|
|
||||||
|
## [v1.1.0] [r4.24.0] - 2020-06-05
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- Added the property cataloguePortletURL and the method [#19440]
|
||||||
|
|
||||||
|
## [v1.0.0] - 2020-04-01
|
||||||
|
|
||||||
|
First release
|
||||||
|
|
||||||
|
|
||||||
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
@ -1,4 +1,9 @@
|
||||||
<ReleaseNotes>
|
<ReleaseNotes>
|
||||||
|
<Changeset
|
||||||
|
component="org.gcube.infrastructure.detachedres.detachedres-library.1-1-0"
|
||||||
|
date="2020-06-18">
|
||||||
|
<Change>Added the property cataloguePortletURL and the method [#19440]</Change>
|
||||||
|
</Changeset>
|
||||||
<Changeset
|
<Changeset
|
||||||
component="org.gcube.infrastructure.detachedres.detachedres-library.1-0-0"
|
component="org.gcube.infrastructure.detachedres.detachedres-library.1-0-0"
|
||||||
date="2020-04-01">
|
date="2020-04-01">
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
<includes>
|
<includes>
|
||||||
<include>README.md</include>
|
<include>README.md</include>
|
||||||
<include>LICENSE.md</include>
|
<include>LICENSE.md</include>
|
||||||
|
<include>CHANGELOG.md</include>
|
||||||
<include>changelog.xml</include>
|
<include>changelog.xml</include>
|
||||||
<include>profile.xml</include>
|
<include>profile.xml</include>
|
||||||
</includes>
|
</includes>
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -11,7 +11,7 @@
|
||||||
<groupId>org.gcube.infrastructure.detachedres</groupId>
|
<groupId>org.gcube.infrastructure.detachedres</groupId>
|
||||||
<artifactId>detachedres-library</artifactId>
|
<artifactId>detachedres-library</artifactId>
|
||||||
<name>detachedres-library</name>
|
<name>detachedres-library</name>
|
||||||
<version>1.0.0</version>
|
<version>1.1.0</version>
|
||||||
<description>Detached Resource Entities Library</description>
|
<description>Detached Resource Entities Library</description>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,14 +7,18 @@ import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.infrastructure.detachedres.detachedreslibrary.server.is.DetachedREsBuilder;
|
import org.gcube.infrastructure.detachedres.detachedreslibrary.server.is.DetachedREsBuilder;
|
||||||
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.Constants;
|
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.Constants;
|
||||||
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.DetachedREs;
|
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.DetachedREs;
|
||||||
|
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.Gateway;
|
||||||
|
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.VO;
|
||||||
|
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.VRE;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* The Class DetachedREsClient.
|
||||||
|
*
|
||||||
* @author Giancarlo Panichi
|
* @author Giancarlo Panichi
|
||||||
*
|
*
|
||||||
*
|
* @author updated by Francesco Mangiacrapa at ISTI-CNR
|
||||||
*/
|
*/
|
||||||
public class DetachedREsClient {
|
public class DetachedREsClient {
|
||||||
|
|
||||||
|
@ -24,16 +28,27 @@ public class DetachedREsClient {
|
||||||
private String scope;
|
private String scope;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Instantiates a new detached R es client.
|
||||||
*/
|
*/
|
||||||
public DetachedREsClient() {
|
public DetachedREsClient() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new detached R es client.
|
||||||
|
*
|
||||||
|
* @param token the token
|
||||||
|
*/
|
||||||
public DetachedREsClient(String token) {
|
public DetachedREsClient(String token) {
|
||||||
this.token = token;
|
this.token = token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the detached R es.
|
||||||
|
*
|
||||||
|
* @return the detached R es
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
public DetachedREs getDetachedREs() throws Exception {
|
public DetachedREs getDetachedREs() throws Exception {
|
||||||
retrieveAuthInfo();
|
retrieveAuthInfo();
|
||||||
logger.debug("Use: [userName={}, scope={}, token={}]",userName,scope,token);
|
logger.debug("Use: [userName={}, scope={}, token={}]",userName,scope,token);
|
||||||
|
@ -41,6 +56,13 @@ public class DetachedREsClient {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the detached R es in scope.
|
||||||
|
*
|
||||||
|
* @param scope the scope
|
||||||
|
* @return the detached R es in scope
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
public DetachedREs getDetachedREsInScope(String scope) throws Exception {
|
public DetachedREs getDetachedREsInScope(String scope) throws Exception {
|
||||||
retrieveAuthInfo();
|
retrieveAuthInfo();
|
||||||
this.scope=scope;
|
this.scope=scope;
|
||||||
|
@ -49,6 +71,11 @@ public class DetachedREsClient {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve auth info.
|
||||||
|
*
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
private void retrieveAuthInfo() throws Exception {
|
private void retrieveAuthInfo() throws Exception {
|
||||||
if (Constants.DEBUG_MODE) {
|
if (Constants.DEBUG_MODE) {
|
||||||
logger.debug("Debug Mode");
|
logger.debug("Debug Mode");
|
||||||
|
@ -77,5 +104,39 @@ public class DetachedREsClient {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find detached VRE for VRE name.
|
||||||
|
*
|
||||||
|
* @param vreName the vre name
|
||||||
|
* @return the vre detached if it is found.
|
||||||
|
*/
|
||||||
|
public VRE findDetachedVREforVREName(String vreName) {
|
||||||
|
logger.debug("Find the VRE name: "+vreName+" called");
|
||||||
|
try {
|
||||||
|
|
||||||
|
DetachedREs detachedREs = getDetachedREs();
|
||||||
|
|
||||||
|
for (Gateway gateway : detachedREs.getGateways().values()) {
|
||||||
|
for (VO vo : gateway.getVos().values()) {
|
||||||
|
for (VRE vre : vo.getVres().values()) {
|
||||||
|
logger.trace("Does the scope: "+vre.getScope() +" ends with "+vreName +"?");
|
||||||
|
if(vre.getScope().toLowerCase().endsWith(vreName)){
|
||||||
|
logger.info("The scope: "+vre.getScope() +" ends with: "+vreName);
|
||||||
|
return vre;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.info("The VRE name "+vreName+" was not found in the detached VREs");
|
||||||
|
return null;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(e.getLocalizedMessage(), e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,6 +192,7 @@ public class DetachedREsBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vre.setCatalogUrl(vreJAXB.getCatalogUrl());
|
vre.setCatalogUrl(vreJAXB.getCatalogUrl());
|
||||||
|
vre.setCatalogPortletURL(vreJAXB.getCatalogPortletURL());
|
||||||
vre.setManagers(vreJAXB.getManagers());
|
vre.setManagers(vreJAXB.getManagers());
|
||||||
vres.put(key,vre);
|
vres.put(key,vre);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,8 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Giancarlo Panichi
|
* @author Giancarlo Panichi
|
||||||
*
|
*
|
||||||
*
|
* @author updated by Francesco Mangiacrapa at ISTI-CNR
|
||||||
*/
|
*/
|
||||||
@XmlRootElement(name = "vre")
|
@XmlRootElement(name = "vre")
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
@ -43,6 +43,9 @@ public class VREJAXB {
|
||||||
@XmlElement(name = "catalogurl", required = false)
|
@XmlElement(name = "catalogurl", required = false)
|
||||||
private String catalogUrl;
|
private String catalogUrl;
|
||||||
|
|
||||||
|
@XmlElement(name = "catalogportleturl", required = false)
|
||||||
|
private String catalogPortletURL;
|
||||||
|
|
||||||
public String getScope() {
|
public String getScope() {
|
||||||
return scope;
|
return scope;
|
||||||
}
|
}
|
||||||
|
@ -99,10 +102,19 @@ public class VREJAXB {
|
||||||
this.catalogUrl = catalogUrl;
|
this.catalogUrl = catalogUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCatalogPortletURL() {
|
||||||
|
return catalogPortletURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCatalogPortletURL(String catalogPortletURL) {
|
||||||
|
this.catalogPortletURL = catalogPortletURL;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "VREJAXB [scope=" + scope + ", name=" + name + ", description=" + description + ", managers=" + managers
|
return "VREJAXB [scope=" + scope + ", name=" + name + ", description=" + description + ", managers=" + managers
|
||||||
+ ", startDate=" + startDate + ", endDate=" + endDate + ", catalogUrl=" + catalogUrl + "]";
|
+ ", startDate=" + startDate + ", endDate=" + endDate + ", catalogUrl=" + catalogUrl
|
||||||
|
+ ", catalogPortletURL=" + catalogPortletURL + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ public class VRE implements Serializable, Comparable<VRE> {
|
||||||
private String startDate;
|
private String startDate;
|
||||||
private String endDate;
|
private String endDate;
|
||||||
private String catalogUrl;
|
private String catalogUrl;
|
||||||
|
private String catalogPortletURL;
|
||||||
|
|
||||||
public VRE() {
|
public VRE() {
|
||||||
super();
|
super();
|
||||||
|
@ -92,6 +93,16 @@ public class VRE implements Serializable, Comparable<VRE> {
|
||||||
this.catalogUrl = catalogUrl;
|
this.catalogUrl = catalogUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public String getCatalogPortletURL() {
|
||||||
|
return catalogPortletURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCatalogPortletURL(String catalogPortletURL) {
|
||||||
|
this.catalogPortletURL = catalogPortletURL;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(VRE vre) {
|
public int compareTo(VRE vre) {
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
|
@ -108,7 +119,10 @@ public class VRE implements Serializable, Comparable<VRE> {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "VRE [scope=" + scope + ", name=" + name + ", description=" + description + ", managers=" + managers
|
return "VRE [scope=" + scope + ", name=" + name + ", description=" + description + ", managers=" + managers
|
||||||
+ ", startDate=" + startDate + ", endDate=" + endDate + ", catalogUrl=" + catalogUrl + "]";
|
+ ", startDate=" + startDate + ", endDate=" + endDate + ", catalogUrl=" + catalogUrl
|
||||||
|
+ ", catalogPortletURL=" + catalogPortletURL + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -16,6 +16,8 @@ import javax.xml.bind.JAXBContext;
|
||||||
import javax.xml.bind.Marshaller;
|
import javax.xml.bind.Marshaller;
|
||||||
import javax.xml.bind.Unmarshaller;
|
import javax.xml.bind.Unmarshaller;
|
||||||
|
|
||||||
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.infrastructure.detachedres.detachedreslibrary.server.DetachedREsClient;
|
import org.gcube.infrastructure.detachedres.detachedreslibrary.server.DetachedREsClient;
|
||||||
import org.gcube.infrastructure.detachedres.detachedreslibrary.server.is.obj.DetachedREsJAXB;
|
import org.gcube.infrastructure.detachedres.detachedreslibrary.server.is.obj.DetachedREsJAXB;
|
||||||
import org.gcube.infrastructure.detachedres.detachedreslibrary.server.is.obj.GatewayJAXB;
|
import org.gcube.infrastructure.detachedres.detachedreslibrary.server.is.obj.GatewayJAXB;
|
||||||
|
@ -23,6 +25,9 @@ import org.gcube.infrastructure.detachedres.detachedreslibrary.server.is.obj.VOJ
|
||||||
import org.gcube.infrastructure.detachedres.detachedreslibrary.server.is.obj.VREJAXB;
|
import org.gcube.infrastructure.detachedres.detachedreslibrary.server.is.obj.VREJAXB;
|
||||||
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.Constants;
|
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.Constants;
|
||||||
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.DetachedREs;
|
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.DetachedREs;
|
||||||
|
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.Gateway;
|
||||||
|
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.VO;
|
||||||
|
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.VRE;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -45,9 +50,57 @@ public class DetachedREsTest extends TestCase {
|
||||||
logger.debug("Test Enabled");
|
logger.debug("Test Enabled");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
ScopeProvider.instance.set(Constants.DEFAULT_SCOPE);
|
||||||
|
SecurityTokenProvider.instance.set(Constants.DEFAULT_TOKEN);
|
||||||
DetachedREsClient detachedREsClient = new DetachedREsClient();
|
DetachedREsClient detachedREsClient = new DetachedREsClient();
|
||||||
DetachedREs detachedREs = detachedREsClient.getDetachedREs();
|
DetachedREs detachedREs = detachedREsClient.getDetachedREs();
|
||||||
logger.debug("DetachedREs: " + detachedREs);
|
|
||||||
|
int totalVREDimissed = 0;
|
||||||
|
for (Gateway gateway : detachedREs.getGateways().values()) {
|
||||||
|
logger.debug("\n\n");
|
||||||
|
logger.debug("Gateway: " + gateway.getName());
|
||||||
|
int vreDismissedPerGatew = 0;
|
||||||
|
for (VO vo : gateway.getVos().values()) {
|
||||||
|
logger.debug("VO: " + vo.getName());
|
||||||
|
for (VRE vre : vo.getVres().values()) {
|
||||||
|
logger.debug("VRE name: " + vre.getName() + " scope: " + vre.getScope()
|
||||||
|
+ " VRE catalogue url: " + vre.getCatalogUrl() + " VRE catalog Portlet URL: "
|
||||||
|
+ vre.getCatalogPortletURL());
|
||||||
|
vreDismissedPerGatew++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logger.debug("\n\t\t\t******** VREs dismissed per " + gateway.getName() + " are: "
|
||||||
|
+ vreDismissedPerGatew);
|
||||||
|
totalVREDimissed += vreDismissedPerGatew;
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.debug("\n\nTotal VREs dismissed: " + totalVREDimissed);
|
||||||
|
|
||||||
|
assertTrue(true);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(e.getLocalizedMessage(), e);
|
||||||
|
assertTrue("Error searching the resource!", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
logger.debug("Test Disabled");
|
||||||
|
assertTrue(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFindDetachedVREForVREName() {
|
||||||
|
if (Constants.TEST_ENABLE) {
|
||||||
|
logger.debug("Test Enabled");
|
||||||
|
|
||||||
|
try {
|
||||||
|
String vreName = "bluebridgeproject";
|
||||||
|
ScopeProvider.instance.set(Constants.DEFAULT_SCOPE);
|
||||||
|
SecurityTokenProvider.instance.set(Constants.DEFAULT_TOKEN);
|
||||||
|
DetachedREsClient detachedREsClient = new DetachedREsClient();
|
||||||
|
VRE vre = detachedREsClient.findDetachedVREforVREName(vreName);
|
||||||
|
logger.debug("The detached VRE for name: " + vreName + " found as: " + vre);
|
||||||
assertTrue(true);
|
assertTrue(true);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -186,6 +239,13 @@ public class DetachedREsTest extends TestCase {
|
||||||
|
|
||||||
createEOSCSecretariatDetachedGateway(eoscSecretariatDetachedGateway);
|
createEOSCSecretariatDetachedGateway(eoscSecretariatDetachedGateway);
|
||||||
|
|
||||||
|
// ------ DESCRAMBLE Gateway begin
|
||||||
|
GatewayJAXB descrambleGateway = new GatewayJAXB();
|
||||||
|
descrambleGateway.setScope("-6");
|
||||||
|
descrambleGateway.setName("DESCRAMBLE Gateway");
|
||||||
|
|
||||||
|
createDescrambleGateway(descrambleGateway);
|
||||||
|
|
||||||
// Gateway Add
|
// Gateway Add
|
||||||
// -------------------
|
// -------------------
|
||||||
|
|
||||||
|
@ -195,6 +255,7 @@ public class DetachedREsTest extends TestCase {
|
||||||
gateways.put("-3", parthenosDetachedGateway);
|
gateways.put("-3", parthenosDetachedGateway);
|
||||||
gateways.put("-4", aginfraPlusDetachedGateway);
|
gateways.put("-4", aginfraPlusDetachedGateway);
|
||||||
gateways.put("-5", eoscSecretariatDetachedGateway);
|
gateways.put("-5", eoscSecretariatDetachedGateway);
|
||||||
|
gateways.put("-6", descrambleGateway);
|
||||||
|
|
||||||
DetachedREsJAXB detachedREs = new DetachedREsJAXB();
|
DetachedREsJAXB detachedREs = new DetachedREsJAXB();
|
||||||
detachedREs.setEnabled(true);
|
detachedREs.setEnabled(true);
|
||||||
|
@ -216,13 +277,14 @@ public class DetachedREsTest extends TestCase {
|
||||||
|
|
||||||
logger.info("Check Unmarshalling");
|
logger.info("Check Unmarshalling");
|
||||||
Path path = Files.createTempFile("DetachedREsData", ".xml");
|
Path path = Files.createTempFile("DetachedREsData", ".xml");
|
||||||
|
logger.info("Create file: " + path.toAbsolutePath());
|
||||||
File file = path.toFile();
|
File file = path.toFile();
|
||||||
jaxbMarshaller.marshal(detachedREs, file);
|
jaxbMarshaller.marshal(detachedREs, file);
|
||||||
|
|
||||||
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
|
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
|
||||||
DetachedREsJAXB configUnmarshalled = (DetachedREsJAXB) jaxbUnmarshaller.unmarshal(file);
|
DetachedREsJAXB configUnmarshalled = (DetachedREsJAXB) jaxbUnmarshaller.unmarshal(file);
|
||||||
logger.debug("DetachedREs unmarshallded: " + configUnmarshalled);
|
logger.debug("DetachedREs unmarshallded: " + configUnmarshalled);
|
||||||
file.delete();
|
// file.delete();
|
||||||
logger.info("Success!");
|
logger.info("Success!");
|
||||||
assertTrue(true);
|
assertTrue(true);
|
||||||
|
|
||||||
|
@ -382,7 +444,17 @@ public class DetachedREsTest extends TestCase {
|
||||||
gCubeAppsVREJAXB.setName(new String(vre).replace("_", " "));
|
gCubeAppsVREJAXB.setName(new String(vre).replace("_", " "));
|
||||||
gCubeAppsVREJAXB.setStartDate(new GregorianCalendar(2018, GregorianCalendar.JANUARY, 1).getTime());
|
gCubeAppsVREJAXB.setStartDate(new GregorianCalendar(2018, GregorianCalendar.JANUARY, 1).getTime());
|
||||||
gCubeAppsVREJAXB.setEndDate(new GregorianCalendar(2020, GregorianCalendar.MARCH, 3).getTime());
|
gCubeAppsVREJAXB.setEndDate(new GregorianCalendar(2020, GregorianCalendar.MARCH, 3).getTime());
|
||||||
gCubeAppsVREJAXB.setCatalogUrl("http://data.d4science.org/ctlg/" + vre);
|
|
||||||
|
// UPDATED BY FRANCESCO
|
||||||
|
if (vre.compareToIgnoreCase("BlueBridgeProject") == 0 || vre.compareToIgnoreCase("SIASPA") == 0) {
|
||||||
|
gCubeAppsVREJAXB.setCatalogUrl("https://ckan-imarine.d4science.org");
|
||||||
|
gCubeAppsVREJAXB
|
||||||
|
.setCatalogPortletURL("https://i-marine.d4science.org/group/imarine-gateway/data-catalogue");
|
||||||
|
} else {
|
||||||
|
// not usable
|
||||||
|
gCubeAppsVREJAXB.setCatalogUrl("http://data.d4science.org/ctlg/" + vre);
|
||||||
|
}
|
||||||
|
|
||||||
gCubeAppsVREJAXB.setManagers(new ArrayList<String>(Arrays.asList("Leonardo Candela", "Pasquale Pagano")));
|
gCubeAppsVREJAXB.setManagers(new ArrayList<String>(Arrays.asList("Leonardo Candela", "Pasquale Pagano")));
|
||||||
gCubeAppsVREsOfBlueBridgeGateway.put(
|
gCubeAppsVREsOfBlueBridgeGateway.put(
|
||||||
"/d4science.research-infrastructures.eu/" + VOProduction.GCUBEAPPS.getId() + "/" + vre,
|
"/d4science.research-infrastructures.eu/" + VOProduction.GCUBEAPPS.getId() + "/" + vre,
|
||||||
|
@ -464,7 +536,8 @@ public class DetachedREsTest extends TestCase {
|
||||||
|
|
||||||
LinkedHashMap<String, VREJAXB> gCubeAppsVREsOfD4ScienceOrgDetachedGateway = new LinkedHashMap<>();
|
LinkedHashMap<String, VREJAXB> gCubeAppsVREsOfD4ScienceOrgDetachedGateway = new LinkedHashMap<>();
|
||||||
|
|
||||||
String[] gCubeAppsVREsOfD4ScienceOrgDetachedGatewayArray = { "CNR_OpenScienceTF", "EGIEngage", "ICOS_ETC" };
|
String[] gCubeAppsVREsOfD4ScienceOrgDetachedGatewayArray = { "CNR_OpenScienceTF", "EcologicalModelling",
|
||||||
|
"EGIEngage", "EGIP", "ICOS_ETC", "IGDI", "rScience", "TCom" };
|
||||||
|
|
||||||
for (String vre : gCubeAppsVREsOfD4ScienceOrgDetachedGatewayArray) {
|
for (String vre : gCubeAppsVREsOfD4ScienceOrgDetachedGatewayArray) {
|
||||||
VREJAXB gCubeAppsVREJAXB = new VREJAXB();
|
VREJAXB gCubeAppsVREJAXB = new VREJAXB();
|
||||||
|
@ -513,8 +586,8 @@ public class DetachedREsTest extends TestCase {
|
||||||
|
|
||||||
LinkedHashMap<String, VREJAXB> d4ResearchVREsOfD4ScienceOrgDetachedGateway = new LinkedHashMap<>();
|
LinkedHashMap<String, VREJAXB> d4ResearchVREsOfD4ScienceOrgDetachedGateway = new LinkedHashMap<>();
|
||||||
|
|
||||||
String[] d4ResearchVREsOfD4ScienceOrgDetachedGatewayArray = { "EOSC_Services", "FAIR_DM",
|
String[] d4ResearchVREsOfD4ScienceOrgDetachedGatewayArray = { "EISCAT", "ENVRI", "EOSC_Services", "FAIR_DM",
|
||||||
"FisheriesAndEcosystemAtMii", "ISTIOpenAccess" };
|
"FisheriesAndEcosystemAtMii", "ICOSEddyCovarianceProcessing", "ISTIOpenAccess", "QCAPI" };
|
||||||
|
|
||||||
for (String vre : d4ResearchVREsOfD4ScienceOrgDetachedGatewayArray) {
|
for (String vre : d4ResearchVREsOfD4ScienceOrgDetachedGatewayArray) {
|
||||||
VREJAXB d4ResearchVREJAXB = new VREJAXB();
|
VREJAXB d4ResearchVREJAXB = new VREJAXB();
|
||||||
|
@ -531,7 +604,33 @@ public class DetachedREsTest extends TestCase {
|
||||||
}
|
}
|
||||||
d4ResearchOfD4ScienceOrgDetachedGateway.setVres(d4ResearchVREsOfD4ScienceOrgDetachedGateway);
|
d4ResearchOfD4ScienceOrgDetachedGateway.setVres(d4ResearchVREsOfD4ScienceOrgDetachedGateway);
|
||||||
|
|
||||||
|
// D4OS
|
||||||
|
VOJAXB d4osOfD4ScienceOrgDetachedGateway = new VOJAXB();
|
||||||
|
d4osOfD4ScienceOrgDetachedGateway
|
||||||
|
.setScope("/d4science.research-infrastructures.eu/" + VOProduction.D4OS.getId());
|
||||||
|
d4osOfD4ScienceOrgDetachedGateway.setName(VOProduction.D4OS.getId());
|
||||||
|
|
||||||
|
LinkedHashMap<String, VREJAXB> d4osVREsOfD4ScienceOrgDetachedGateway = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
String[] d4osVREsOfD4ScienceOrgDetachedGatewayArray = { "CNROutreach", "RicAt" };
|
||||||
|
|
||||||
|
for (String vre : d4osVREsOfD4ScienceOrgDetachedGatewayArray) {
|
||||||
|
VREJAXB d4osVREJAXB = new VREJAXB();
|
||||||
|
d4osVREJAXB.setScope("/d4science.research-infrastructures.eu/" + VOProduction.D4OS.getId() + "/" + vre);
|
||||||
|
d4osVREJAXB.setName(new String(vre).replace("_", " "));
|
||||||
|
d4osVREJAXB.setStartDate(new GregorianCalendar(2018, GregorianCalendar.JANUARY, 1).getTime());
|
||||||
|
d4osVREJAXB.setEndDate(new GregorianCalendar(2020, GregorianCalendar.MARCH, 3).getTime());
|
||||||
|
d4osVREJAXB.setCatalogUrl("http://data.d4science.org/ctlg/" + vre);
|
||||||
|
d4osVREJAXB.setManagers(new ArrayList<String>(Arrays.asList("Leonardo Candela", "Pasquale Pagano")));
|
||||||
|
d4osVREsOfD4ScienceOrgDetachedGateway.put(
|
||||||
|
"/d4science.research-infrastructures.eu/" + VOProduction.D4OS.getId() + "/" + vre, d4osVREJAXB);
|
||||||
|
}
|
||||||
|
d4osOfD4ScienceOrgDetachedGateway.setVres(d4osVREsOfD4ScienceOrgDetachedGateway);
|
||||||
|
|
||||||
|
//
|
||||||
LinkedHashMap<String, VOJAXB> vosOfD4ScienceOrgDetachedGateway = new LinkedHashMap<>();
|
LinkedHashMap<String, VOJAXB> vosOfD4ScienceOrgDetachedGateway = new LinkedHashMap<>();
|
||||||
|
vosOfD4ScienceOrgDetachedGateway.put("/d4science.research-infrastructures.eu/" + VOProduction.D4OS.getId(),
|
||||||
|
d4osOfD4ScienceOrgDetachedGateway);
|
||||||
vosOfD4ScienceOrgDetachedGateway.put(
|
vosOfD4ScienceOrgDetachedGateway.put(
|
||||||
"/d4science.research-infrastructures.eu/" + VOProduction.D4RESEARCH.getId(),
|
"/d4science.research-infrastructures.eu/" + VOProduction.D4RESEARCH.getId(),
|
||||||
d4ResearchOfD4ScienceOrgDetachedGateway);
|
d4ResearchOfD4ScienceOrgDetachedGateway);
|
||||||
|
@ -543,4 +642,37 @@ public class DetachedREsTest extends TestCase {
|
||||||
d4ScienceOrgDetachedGateway.setVos(vosOfD4ScienceOrgDetachedGateway);
|
d4ScienceOrgDetachedGateway.setVos(vosOfD4ScienceOrgDetachedGateway);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createDescrambleGateway(GatewayJAXB descrambleGateway) {
|
||||||
|
// gCubeApps
|
||||||
|
VOJAXB gCubeAppsOfDescrambleGateway = new VOJAXB();
|
||||||
|
gCubeAppsOfDescrambleGateway
|
||||||
|
.setScope("/d4science.research-infrastructures.eu/" + VOProduction.GCUBEAPPS.getId());
|
||||||
|
gCubeAppsOfDescrambleGateway.setName(VOProduction.GCUBEAPPS.getId());
|
||||||
|
|
||||||
|
LinkedHashMap<String, VREJAXB> gCubeAppsVREsOfDescrambleGateway = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
String[] gCubeAppsVREsOfDescrambleGatewayArray = { "DESCRAMBLE" };
|
||||||
|
|
||||||
|
for (String vre : gCubeAppsVREsOfDescrambleGatewayArray) {
|
||||||
|
VREJAXB gCubeAppsVREJAXB = new VREJAXB();
|
||||||
|
gCubeAppsVREJAXB
|
||||||
|
.setScope("/d4science.research-infrastructures.eu/" + VOProduction.GCUBEAPPS.getId() + "/" + vre);
|
||||||
|
gCubeAppsVREJAXB.setName(new String(vre).replace("_", " "));
|
||||||
|
gCubeAppsVREJAXB.setStartDate(new GregorianCalendar(2014, GregorianCalendar.JANUARY, 1).getTime());
|
||||||
|
gCubeAppsVREJAXB.setEndDate(new GregorianCalendar(2020, GregorianCalendar.SEPTEMBER, 25).getTime());
|
||||||
|
gCubeAppsVREJAXB.setCatalogUrl("http://data.d4science.org/ctlg/" + vre);
|
||||||
|
gCubeAppsVREJAXB.setManagers(new ArrayList<String>(Arrays.asList("Leonardo Candela", "Pasquale Pagano")));
|
||||||
|
gCubeAppsVREsOfDescrambleGateway.put(
|
||||||
|
"/d4science.research-infrastructures.eu/" + VOProduction.GCUBEAPPS.getId() + "/" + vre,
|
||||||
|
gCubeAppsVREJAXB);
|
||||||
|
}
|
||||||
|
gCubeAppsOfDescrambleGateway.setVres(gCubeAppsVREsOfDescrambleGateway);
|
||||||
|
|
||||||
|
LinkedHashMap<String, VOJAXB> vosOfDescrambleGateway = new LinkedHashMap<>();
|
||||||
|
vosOfDescrambleGateway.put("/d4science.research-infrastructures.eu/" + VOProduction.GCUBEAPPS.getId(),
|
||||||
|
gCubeAppsOfDescrambleGateway);
|
||||||
|
|
||||||
|
descrambleGateway.setVos(vosOfDescrambleGateway);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue