From b1786b53d2d41f1cb8ac7b54e849e0bc384636b7 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Thu, 9 Apr 2020 17:25:48 +0200 Subject: [PATCH] ref 18964: Create a Generic Resource to record Dismissed VREs https://support.d4science.org/issues/18964 Create a library to support the resource access --- .../detachedreslibrary/DetachedREsTest.java | 422 ++++++++++++++---- .../detachedreslibrary/VOProduction.java | 23 + 2 files changed, 366 insertions(+), 79 deletions(-) create mode 100644 src/test/java/org/gcube/infrastructure/detachedres/detachedreslibrary/VOProduction.java diff --git a/src/test/java/org/gcube/infrastructure/detachedres/detachedreslibrary/DetachedREsTest.java b/src/test/java/org/gcube/infrastructure/detachedres/detachedreslibrary/DetachedREsTest.java index 68ff73f..c1f829b 100644 --- a/src/test/java/org/gcube/infrastructure/detachedres/detachedreslibrary/DetachedREsTest.java +++ b/src/test/java/org/gcube/infrastructure/detachedres/detachedreslibrary/DetachedREsTest.java @@ -85,7 +85,7 @@ public class DetachedREsTest extends TestCase { blueBridgeProject.setCatalogUrl("http://data.d4science.org/ctlg/BlueBridgeProject"); blueBridgeProject .setManagers(new ArrayList(Arrays.asList("Leonardo Candela", "Pasquale Pagano"))); - + LinkedHashMap vres = new LinkedHashMap<>(); vres.put("/d4science.research-infrastructures.eu/gcubeApps/BlueBridgeProject", blueBridgeProject); gCubeApps.setVres(vres); @@ -145,99 +145,56 @@ public class DetachedREsTest extends TestCase { try { logger.info("Check Marshalling"); + // final String GCUBEAPPS = "gCubeApps"; + // final String FARM = "FARM"; + // final String D4RESEARCH = "D4Research"; + // final String PARTHENOSVO = "ParthenosVO"; + // final String D4OS = "D4OS"; + + // ------ BlueBridge Gateway begin GatewayJAXB blueBridgeGateway = new GatewayJAXB(); blueBridgeGateway.setScope("-1"); blueBridgeGateway.setName("BlueBridge Gateway"); - // gCubeApps - final String GCUBEAPPS = "gCubeApps"; - VOJAXB gCubeApps = new VOJAXB(); - gCubeApps.setScope("/d4science.research-infrastructures.eu/" + GCUBEAPPS); - gCubeApps.setName(GCUBEAPPS); + createBlueBridgeGateway(blueBridgeGateway); - LinkedHashMap gCubeAppsVREs = new LinkedHashMap<>(); + // ------ D4Science.org Detached Gateway begin + GatewayJAXB d4ScienceOrgDetachedGateway = new GatewayJAXB(); + d4ScienceOrgDetachedGateway.setScope("-2"); + d4ScienceOrgDetachedGateway.setName("D4Science.org Detached Gateway"); - String[] gCubeAppsVREsArray = { "AquacultureTrainingLab", "BlueBRIDGE-PSC", "BlueBridgeProject", - "CES_TCRE", "ICES_DALSA", "ICES_DASC", "ICES_FIACO", "ICES_StockAssessmentAdvanced", - "ICES_TCSSM", "iSearch", "SIASPA" }; + createD4ScienceOrgDetachedGateway(d4ScienceOrgDetachedGateway); - for (String vre : gCubeAppsVREsArray) { - VREJAXB gCubeAppsVREJAXB = new VREJAXB(); - gCubeAppsVREJAXB.setScope("/d4science.research-infrastructures.eu/" + GCUBEAPPS + "/" + vre); - gCubeAppsVREJAXB.setName(new String(vre).replace("_", " ")); - gCubeAppsVREJAXB.setStartDate(new GregorianCalendar(2018, GregorianCalendar.JANUARY, 1).getTime()); - gCubeAppsVREJAXB.setEndDate(new GregorianCalendar(2020, GregorianCalendar.MARCH, 3).getTime()); - gCubeAppsVREJAXB.setCatalogUrl("http://data.d4science.org/ctlg/"+vre); - gCubeAppsVREJAXB - .setManagers(new ArrayList(Arrays.asList("Leonardo Candela", "Pasquale Pagano"))); - gCubeAppsVREs.put("/d4science.research-infrastructures.eu/" + GCUBEAPPS + "/" + vre, - gCubeAppsVREJAXB); - } - gCubeApps.setVres(gCubeAppsVREs); + // ------ PARTHENOS Detached Gateway begin + GatewayJAXB parthenosDetachedGateway = new GatewayJAXB(); + parthenosDetachedGateway.setScope("-3"); + parthenosDetachedGateway.setName("PARTHENOS Detached Gateway"); - // FARM - final String FARM = "FARM"; - VOJAXB farm = new VOJAXB(); - farm.setScope("/d4science.research-infrastructures.eu/" + FARM); - farm.setName(FARM); + createParthenosDetachedGateway(parthenosDetachedGateway); - LinkedHashMap farmVREs = new LinkedHashMap<>(); + // ------ AGINFRAPlus Detached Gateway begin + GatewayJAXB aginfraPlusDetachedGateway = new GatewayJAXB(); + aginfraPlusDetachedGateway.setScope("-4"); + aginfraPlusDetachedGateway.setName("AGINFRAPlus Detached Gateway"); - String[] farmVREsArray = { "AlieiaVRE", "Aquabiotech", "ARDAG_Aquaculture", "EllinikaPsariaVRE", - "ForkysVRE", "GALAXIDI", "iLKNAK_Aquaculture", "KIMAGRO_Fishfarming", "MARKELLOS_Aquaculture", - "NHREUS_Aquaculture", "STRATOS_AQUACULTURES", "SustainableBlueEconomy", "TBTI_VRE" }; + createAginfraPlusDetachedGateway(aginfraPlusDetachedGateway); - for (String vre : farmVREsArray) { - VREJAXB farmVREJAXB = new VREJAXB(); - farmVREJAXB.setScope("/d4science.research-infrastructures.eu/" + FARM + "/" + vre); - farmVREJAXB.setName(new String(vre).replace("_", " ")); - farmVREJAXB.setStartDate(new GregorianCalendar(2018, GregorianCalendar.JANUARY, 1).getTime()); - farmVREJAXB.setEndDate(new GregorianCalendar(2020, GregorianCalendar.MARCH, 3).getTime()); - farmVREJAXB.setCatalogUrl("http://data.d4science.org/ctlg/"+vre); - farmVREJAXB - .setManagers(new ArrayList(Arrays.asList("Leonardo Candela", "Pasquale Pagano"))); - farmVREs.put("/d4science.research-infrastructures.eu/" + FARM + "/" + vre, farmVREJAXB); - } - farm.setVres(farmVREs); + // ------ EOSC-Secretriat Detached Gateway begin + GatewayJAXB eoscSecretariatDetachedGateway = new GatewayJAXB(); + eoscSecretariatDetachedGateway.setScope("-5"); + eoscSecretariatDetachedGateway.setName("EOSC-Secretariat Detached Gateway"); - // D4Research - final String D4RESEARCH = "D4Research"; - VOJAXB d4Research = new VOJAXB(); - d4Research.setScope("/d4science.research-infrastructures.eu/" + D4RESEARCH); + createEOSCSecretariatDetachedGateway(eoscSecretariatDetachedGateway); - d4Research.setName(D4RESEARCH); - - LinkedHashMap d4ResearchVREs = new LinkedHashMap<>(); - - String[] d4ResearchVREsArray = { "Blue-Datathon", "BlueBRIDGEReview", "DRuMFISH", - "ICES_AbundanceEstimationFromAcoustic", "ICES_BNetworkAnalysis", "ICES_FIACO2017", - "ICES_IntroStockAssessment", "ICES_IntroToREnv", "ICES_LogbookData", "ICES_MSE", "ICES_MSY", - "InfraTraining" }; - - for (String vre : d4ResearchVREsArray) { - VREJAXB d4ResearchVREJAXB = new VREJAXB(); - d4ResearchVREJAXB.setScope("/d4science.research-infrastructures.eu/" + D4RESEARCH + "/" + vre); - d4ResearchVREJAXB.setName(new String(vre).replace("_", " ")); - d4ResearchVREJAXB.setStartDate(new GregorianCalendar(2018, GregorianCalendar.JANUARY, 1).getTime()); - d4ResearchVREJAXB.setEndDate(new GregorianCalendar(2020, GregorianCalendar.MARCH, 3).getTime()); - d4ResearchVREJAXB.setCatalogUrl("http://data.d4science.org/ctlg/"+vre); - d4ResearchVREJAXB - .setManagers(new ArrayList(Arrays.asList("Leonardo Candela", "Pasquale Pagano"))); - d4ResearchVREs.put("/d4science.research-infrastructures.eu/" + D4RESEARCH + "/" + vre, - d4ResearchVREJAXB); - } - d4Research.setVres(d4ResearchVREs); - - // Gateway - LinkedHashMap vos = new LinkedHashMap<>(); - vos.put("/d4science.research-infrastructures.eu/" + D4RESEARCH, d4Research); - vos.put("/d4science.research-infrastructures.eu/" + FARM, farm); - vos.put("/d4science.research-infrastructures.eu/" + GCUBEAPPS, gCubeApps); - - blueBridgeGateway.setVos(vos); + // Gateway Add + // ------------------- LinkedHashMap gateways = new LinkedHashMap<>(); gateways.put("-1", blueBridgeGateway); + gateways.put("-2", d4ScienceOrgDetachedGateway); + gateways.put("-3", parthenosDetachedGateway); + gateways.put("-4", aginfraPlusDetachedGateway); + gateways.put("-5", eoscSecretariatDetachedGateway); DetachedREsJAXB detachedREs = new DetachedREsJAXB(); detachedREs.setEnabled(true); @@ -265,7 +222,7 @@ public class DetachedREsTest extends TestCase { Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); DetachedREsJAXB configUnmarshalled = (DetachedREsJAXB) jaxbUnmarshaller.unmarshal(file); logger.debug("DetachedREs unmarshallded: " + configUnmarshalled); - file.delete(); + //file.delete(); logger.info("Success!"); assertTrue(true); @@ -279,4 +236,311 @@ public class DetachedREsTest extends TestCase { } } + private void createEOSCSecretariatDetachedGateway(GatewayJAXB eoscSecretariatDetachedGateway) { + // D4OS + VOJAXB d4osOfEOSCSecretariatDetachedGateway = new VOJAXB(); + d4osOfEOSCSecretariatDetachedGateway + .setScope("/d4science.research-infrastructures.eu/" + VOProduction.D4OS.getId()); + d4osOfEOSCSecretariatDetachedGateway.setName(VOProduction.D4OS.getId()); + + LinkedHashMap d4osVREsOfEOSCSecretariatDetachedGateway = new LinkedHashMap<>(); + + String[] d4osVREsOfEOSCSecretariatDetachedGatewayArray = { "INFRAEOSC5ProjectsCollaboratory" }; + + for (String vre : d4osVREsOfEOSCSecretariatDetachedGatewayArray) { + 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(Arrays.asList("Leonardo Candela", "Pasquale Pagano"))); + d4osVREsOfEOSCSecretariatDetachedGateway.put( + "/d4science.research-infrastructures.eu/" + VOProduction.D4OS.getId() + "/" + vre, d4osVREJAXB); + } + d4osOfEOSCSecretariatDetachedGateway.setVres(d4osVREsOfEOSCSecretariatDetachedGateway); + + LinkedHashMap vosOfEOSCSecretariatDetachedGateway = new LinkedHashMap<>(); + vosOfEOSCSecretariatDetachedGateway.put("/d4science.research-infrastructures.eu/" + VOProduction.D4OS.getId(), + d4osOfEOSCSecretariatDetachedGateway); + + eoscSecretariatDetachedGateway.setVos(vosOfEOSCSecretariatDetachedGateway); + } + + private void createAginfraPlusDetachedGateway(GatewayJAXB aginfraPlusDetachedGateway) { + // FARM + VOJAXB farmOfAginfraPlusDetachedGateway = new VOJAXB(); + farmOfAginfraPlusDetachedGateway + .setScope("/d4science.research-infrastructures.eu/" + VOProduction.FARM.getId()); + farmOfAginfraPlusDetachedGateway.setName(VOProduction.FARM.getId()); + + LinkedHashMap farmVREsOfAginfraPlusDetachedGateway = new LinkedHashMap<>(); + + String[] farmVREsOfAginfraPlusDetachedGatewayArray = { "EOSCFood" }; + + for (String vre : farmVREsOfAginfraPlusDetachedGatewayArray) { + VREJAXB farmVREJAXB = new VREJAXB(); + farmVREJAXB.setScope("/d4science.research-infrastructures.eu/" + VOProduction.FARM.getId() + "/" + vre); + farmVREJAXB.setName(new String(vre).replace("_", " ")); + farmVREJAXB.setStartDate(new GregorianCalendar(2018, GregorianCalendar.JANUARY, 1).getTime()); + farmVREJAXB.setEndDate(new GregorianCalendar(2020, GregorianCalendar.MARCH, 3).getTime()); + farmVREJAXB.setCatalogUrl("http://data.d4science.org/ctlg/" + vre); + farmVREJAXB.setManagers(new ArrayList(Arrays.asList("Leonardo Candela", "Pasquale Pagano"))); + farmVREsOfAginfraPlusDetachedGateway.put( + "/d4science.research-infrastructures.eu/" + VOProduction.FARM.getId() + "/" + vre, farmVREJAXB); + } + farmOfAginfraPlusDetachedGateway.setVres(farmVREsOfAginfraPlusDetachedGateway); + + LinkedHashMap vosOfAginfraPlusDetachedGateway = new LinkedHashMap<>(); + vosOfAginfraPlusDetachedGateway.put("/d4science.research-infrastructures.eu/" + VOProduction.FARM.getId(), + farmOfAginfraPlusDetachedGateway); + + aginfraPlusDetachedGateway.setVos(vosOfAginfraPlusDetachedGateway); + + } + + private void createParthenosDetachedGateway(GatewayJAXB parthenosDetachedGateway) { + + // ParthenosVO + VOJAXB parthenosVOOfParthenosDetachedGateway = new VOJAXB(); + parthenosVOOfParthenosDetachedGateway + .setScope("/d4science.research-infrastructures.eu/" + VOProduction.PARTHENOSVO.getId()); + parthenosVOOfParthenosDetachedGateway.setName(VOProduction.PARTHENOSVO.getId()); + + LinkedHashMap parthenosVOVREsOfParthenosDetachedGateway = new LinkedHashMap<>(); + + String[] parthenosVOVREsOfParthenosDetachedGatewayArray = { "RubRIcA" }; + + for (String vre : parthenosVOVREsOfParthenosDetachedGatewayArray) { + VREJAXB parthenosVOVREJAXB = new VREJAXB(); + parthenosVOVREJAXB + .setScope("/d4science.research-infrastructures.eu/" + VOProduction.PARTHENOSVO.getId() + "/" + vre); + parthenosVOVREJAXB.setName(new String(vre).replace("_", " ")); + parthenosVOVREJAXB.setStartDate(new GregorianCalendar(2018, GregorianCalendar.JANUARY, 1).getTime()); + parthenosVOVREJAXB.setEndDate(new GregorianCalendar(2020, GregorianCalendar.MARCH, 3).getTime()); + parthenosVOVREJAXB.setCatalogUrl("http://data.d4science.org/ctlg/" + vre); + parthenosVOVREJAXB.setManagers(new ArrayList(Arrays.asList("Leonardo Candela", "Pasquale Pagano"))); + parthenosVOVREsOfParthenosDetachedGateway.put( + "/d4science.research-infrastructures.eu/" + VOProduction.PARTHENOSVO.getId() + "/" + vre, + parthenosVOVREJAXB); + } + parthenosVOOfParthenosDetachedGateway.setVres(parthenosVOVREsOfParthenosDetachedGateway); + + // D4Research + VOJAXB d4ResearchOfParthenosDetachedGateway = new VOJAXB(); + d4ResearchOfParthenosDetachedGateway + .setScope("/d4science.research-infrastructures.eu/" + VOProduction.D4RESEARCH.getId()); + + d4ResearchOfParthenosDetachedGateway.setName(VOProduction.D4RESEARCH.getId()); + + LinkedHashMap d4ResearchVREsOfParthenosDetachedGateway = new LinkedHashMap<>(); + + String[] d4ResearchVREsOfParthenosDetachedGatewayArray = { "NERLiX" }; + + for (String vre : d4ResearchVREsOfParthenosDetachedGatewayArray) { + VREJAXB d4ResearchVREJAXB = new VREJAXB(); + d4ResearchVREJAXB + .setScope("/d4science.research-infrastructures.eu/" + VOProduction.D4RESEARCH.getId() + "/" + vre); + d4ResearchVREJAXB.setName(new String(vre).replace("_", " ")); + d4ResearchVREJAXB.setStartDate(new GregorianCalendar(2018, GregorianCalendar.JANUARY, 1).getTime()); + d4ResearchVREJAXB.setEndDate(new GregorianCalendar(2020, GregorianCalendar.MARCH, 3).getTime()); + d4ResearchVREJAXB.setCatalogUrl("http://data.d4science.org/ctlg/" + vre); + d4ResearchVREJAXB.setManagers(new ArrayList(Arrays.asList("Leonardo Candela", "Pasquale Pagano"))); + d4ResearchVREsOfParthenosDetachedGateway.put( + "/d4science.research-infrastructures.eu/" + VOProduction.D4RESEARCH.getId() + "/" + vre, + d4ResearchVREJAXB); + } + d4ResearchOfParthenosDetachedGateway.setVres(d4ResearchVREsOfParthenosDetachedGateway); + + LinkedHashMap vosOfParthenosDetachedGateway = new LinkedHashMap<>(); + vosOfParthenosDetachedGateway.put("/d4science.research-infrastructures.eu/" + VOProduction.D4RESEARCH.getId(), + d4ResearchOfParthenosDetachedGateway); + vosOfParthenosDetachedGateway.put("/d4science.research-infrastructures.eu/" + VOProduction.PARTHENOSVO.getId(), + parthenosVOOfParthenosDetachedGateway); + + parthenosDetachedGateway.setVos(vosOfParthenosDetachedGateway); + + } + + private void createBlueBridgeGateway(GatewayJAXB blueBridgeGateway) { + // gCubeApps + VOJAXB gCubeAppsOfBlueBridgeGateway = new VOJAXB(); + gCubeAppsOfBlueBridgeGateway + .setScope("/d4science.research-infrastructures.eu/" + VOProduction.GCUBEAPPS.getId()); + gCubeAppsOfBlueBridgeGateway.setName(VOProduction.GCUBEAPPS.getId()); + + LinkedHashMap gCubeAppsVREsOfBlueBridgeGateway = new LinkedHashMap<>(); + + String[] gCubeAppsVREsOfBluebridgeGatewayArray = { "AquacultureTrainingLab", "BlueBRIDGE-PSC", + "BlueBridgeProject", "CES_TCRE", "ICES_DALSA", "ICES_DASC", "ICES_FIACO", + "ICES_StockAssessmentAdvanced", "ICES_TCSSM", "iSearch", "SIASPA" }; + + for (String vre : gCubeAppsVREsOfBluebridgeGatewayArray) { + VREJAXB gCubeAppsVREJAXB = new VREJAXB(); + gCubeAppsVREJAXB + .setScope("/d4science.research-infrastructures.eu/" + VOProduction.GCUBEAPPS.getId() + "/" + vre); + gCubeAppsVREJAXB.setName(new String(vre).replace("_", " ")); + gCubeAppsVREJAXB.setStartDate(new GregorianCalendar(2018, GregorianCalendar.JANUARY, 1).getTime()); + gCubeAppsVREJAXB.setEndDate(new GregorianCalendar(2020, GregorianCalendar.MARCH, 3).getTime()); + gCubeAppsVREJAXB.setCatalogUrl("http://data.d4science.org/ctlg/" + vre); + gCubeAppsVREJAXB.setManagers(new ArrayList(Arrays.asList("Leonardo Candela", "Pasquale Pagano"))); + gCubeAppsVREsOfBlueBridgeGateway.put( + "/d4science.research-infrastructures.eu/" + VOProduction.GCUBEAPPS.getId() + "/" + vre, + gCubeAppsVREJAXB); + } + gCubeAppsOfBlueBridgeGateway.setVres(gCubeAppsVREsOfBlueBridgeGateway); + + // FARM + VOJAXB farmOfBlueBridgeGateway = new VOJAXB(); + farmOfBlueBridgeGateway.setScope("/d4science.research-infrastructures.eu/" + VOProduction.FARM.getId()); + farmOfBlueBridgeGateway.setName(VOProduction.FARM.getId()); + + LinkedHashMap farmVREsOfBlueBridgeGateway = new LinkedHashMap<>(); + + String[] farmVREsOfBlueBridgeGatewayArray = { "AlieiaVRE", "Aquabiotech", "ARDAG_Aquaculture", + "EllinikaPsariaVRE", "ForkysVRE", "GALAXIDI", "iLKNAK_Aquaculture", "KIMAGRO_Fishfarming", + "MARKELLOS_Aquaculture", "NHREUS_Aquaculture", "STRATOS_AQUACULTURES", "SustainableBlueEconomy", + "TBTI_VRE" }; + + for (String vre : farmVREsOfBlueBridgeGatewayArray) { + VREJAXB farmVREJAXB = new VREJAXB(); + farmVREJAXB.setScope("/d4science.research-infrastructures.eu/" + VOProduction.FARM.getId() + "/" + vre); + farmVREJAXB.setName(new String(vre).replace("_", " ")); + farmVREJAXB.setStartDate(new GregorianCalendar(2018, GregorianCalendar.JANUARY, 1).getTime()); + farmVREJAXB.setEndDate(new GregorianCalendar(2020, GregorianCalendar.MARCH, 3).getTime()); + farmVREJAXB.setCatalogUrl("http://data.d4science.org/ctlg/" + vre); + farmVREJAXB.setManagers(new ArrayList(Arrays.asList("Leonardo Candela", "Pasquale Pagano"))); + farmVREsOfBlueBridgeGateway.put( + "/d4science.research-infrastructures.eu/" + VOProduction.FARM.getId() + "/" + vre, farmVREJAXB); + } + farmOfBlueBridgeGateway.setVres(farmVREsOfBlueBridgeGateway); + + // D4Research + VOJAXB d4ResearchOfBlueBridgeGateway = new VOJAXB(); + d4ResearchOfBlueBridgeGateway + .setScope("/d4science.research-infrastructures.eu/" + VOProduction.D4RESEARCH.getId()); + + d4ResearchOfBlueBridgeGateway.setName(VOProduction.D4RESEARCH.getId()); + + LinkedHashMap d4ResearchVREsOfBlueBridgeGateway = new LinkedHashMap<>(); + + String[] d4ResearchVREsOfBlueBridgeGatewayArray = { "Blue-Datathon", "BlueBRIDGEReview", "BOBLME_HilsaAWG", + "DRuMFISH", "ICES_AbundanceEstimationFromAcoustic", "ICES_BNetworkAnalysis", "ICES_FIACO2017", + "ICES_IntroStockAssessment", "ICES_IntroToREnv", "ICES_LogbookData", "ICES_MSE", "ICES_MSY", + "InfraTraining", "Sinay", "StatnMap" }; + + for (String vre : d4ResearchVREsOfBlueBridgeGatewayArray) { + VREJAXB d4ResearchVREJAXB = new VREJAXB(); + d4ResearchVREJAXB + .setScope("/d4science.research-infrastructures.eu/" + VOProduction.D4RESEARCH.getId() + "/" + vre); + d4ResearchVREJAXB.setName(new String(vre).replace("_", " ")); + d4ResearchVREJAXB.setStartDate(new GregorianCalendar(2018, GregorianCalendar.JANUARY, 1).getTime()); + d4ResearchVREJAXB.setEndDate(new GregorianCalendar(2020, GregorianCalendar.MARCH, 3).getTime()); + d4ResearchVREJAXB.setCatalogUrl("http://data.d4science.org/ctlg/" + vre); + d4ResearchVREJAXB.setManagers(new ArrayList(Arrays.asList("Leonardo Candela", "Pasquale Pagano"))); + d4ResearchVREsOfBlueBridgeGateway.put( + "/d4science.research-infrastructures.eu/" + VOProduction.D4RESEARCH.getId() + "/" + vre, + d4ResearchVREJAXB); + } + d4ResearchOfBlueBridgeGateway.setVres(d4ResearchVREsOfBlueBridgeGateway); + + LinkedHashMap vosOfBlueBridgeGateway = new LinkedHashMap<>(); + vosOfBlueBridgeGateway.put("/d4science.research-infrastructures.eu/" + VOProduction.D4RESEARCH.getId(), + d4ResearchOfBlueBridgeGateway); + vosOfBlueBridgeGateway.put("/d4science.research-infrastructures.eu/" + VOProduction.FARM.getId(), + farmOfBlueBridgeGateway); + vosOfBlueBridgeGateway.put("/d4science.research-infrastructures.eu/" + VOProduction.GCUBEAPPS.getId(), + gCubeAppsOfBlueBridgeGateway); + + blueBridgeGateway.setVos(vosOfBlueBridgeGateway); + } + + private void createD4ScienceOrgDetachedGateway(GatewayJAXB d4ScienceOrgDetachedGateway) { + // gCubeApps + VOJAXB gCubeAppsOfD4ScienceOrgDetachedGateway = new VOJAXB(); + gCubeAppsOfD4ScienceOrgDetachedGateway + .setScope("/d4science.research-infrastructures.eu/" + VOProduction.GCUBEAPPS.getId()); + gCubeAppsOfD4ScienceOrgDetachedGateway.setName(VOProduction.GCUBEAPPS.getId()); + + LinkedHashMap gCubeAppsVREsOfD4ScienceOrgDetachedGateway = new LinkedHashMap<>(); + + String[] gCubeAppsVREsOfD4ScienceOrgDetachedGatewayArray = { "CNR_OpenScienceTF", "EGIEngage", "ICOS_ETC" }; + + for (String vre : gCubeAppsVREsOfD4ScienceOrgDetachedGatewayArray) { + VREJAXB gCubeAppsVREJAXB = new VREJAXB(); + gCubeAppsVREJAXB + .setScope("/d4science.research-infrastructures.eu/" + VOProduction.GCUBEAPPS.getId() + "/" + vre); + gCubeAppsVREJAXB.setName(new String(vre).replace("_", " ")); + gCubeAppsVREJAXB.setStartDate(new GregorianCalendar(2018, GregorianCalendar.JANUARY, 1).getTime()); + gCubeAppsVREJAXB.setEndDate(new GregorianCalendar(2020, GregorianCalendar.MARCH, 3).getTime()); + gCubeAppsVREJAXB.setCatalogUrl("http://data.d4science.org/ctlg/" + vre); + gCubeAppsVREJAXB.setManagers(new ArrayList(Arrays.asList("Leonardo Candela", "Pasquale Pagano"))); + gCubeAppsVREsOfD4ScienceOrgDetachedGateway.put( + "/d4science.research-infrastructures.eu/" + VOProduction.GCUBEAPPS.getId() + "/" + vre, + gCubeAppsVREJAXB); + } + gCubeAppsOfD4ScienceOrgDetachedGateway.setVres(gCubeAppsVREsOfD4ScienceOrgDetachedGateway); + + // FARM + VOJAXB farmOfD4ScienceOrgDetachedGateway = new VOJAXB(); + farmOfD4ScienceOrgDetachedGateway + .setScope("/d4science.research-infrastructures.eu/" + VOProduction.FARM.getId()); + farmOfD4ScienceOrgDetachedGateway.setName(VOProduction.FARM.getId()); + + LinkedHashMap farmVREsOfD4ScienceOrgDetachedGateway = new LinkedHashMap<>(); + + String[] farmVREsOfD4ScienceOrgDetachedGatewayArray = { "EUChinaFoodSTAR" }; + + for (String vre : farmVREsOfD4ScienceOrgDetachedGatewayArray) { + VREJAXB farmVREJAXB = new VREJAXB(); + farmVREJAXB.setScope("/d4science.research-infrastructures.eu/" + VOProduction.FARM.getId() + "/" + vre); + farmVREJAXB.setName(new String(vre).replace("_", " ")); + farmVREJAXB.setStartDate(new GregorianCalendar(2018, GregorianCalendar.JANUARY, 1).getTime()); + farmVREJAXB.setEndDate(new GregorianCalendar(2020, GregorianCalendar.MARCH, 3).getTime()); + farmVREJAXB.setCatalogUrl("http://data.d4science.org/ctlg/" + vre); + farmVREJAXB.setManagers(new ArrayList(Arrays.asList("Leonardo Candela", "Pasquale Pagano"))); + farmVREsOfD4ScienceOrgDetachedGateway.put( + "/d4science.research-infrastructures.eu/" + VOProduction.FARM.getId() + "/" + vre, farmVREJAXB); + } + farmOfD4ScienceOrgDetachedGateway.setVres(farmVREsOfD4ScienceOrgDetachedGateway); + + // D4Research + VOJAXB d4ResearchOfD4ScienceOrgDetachedGateway = new VOJAXB(); + d4ResearchOfD4ScienceOrgDetachedGateway + .setScope("/d4science.research-infrastructures.eu/" + VOProduction.D4RESEARCH.getId()); + + d4ResearchOfD4ScienceOrgDetachedGateway.setName(VOProduction.D4RESEARCH.getId()); + + LinkedHashMap d4ResearchVREsOfD4ScienceOrgDetachedGateway = new LinkedHashMap<>(); + + String[] d4ResearchVREsOfD4ScienceOrgDetachedGatewayArray = { "EOSC_Services", "FAIR_DM", + "FisheriesAndEcosystemAtMii", "ISTIOpenAccess" }; + + for (String vre : d4ResearchVREsOfD4ScienceOrgDetachedGatewayArray) { + VREJAXB d4ResearchVREJAXB = new VREJAXB(); + d4ResearchVREJAXB + .setScope("/d4science.research-infrastructures.eu/" + VOProduction.D4RESEARCH.getId() + "/" + vre); + d4ResearchVREJAXB.setName(new String(vre).replace("_", " ")); + d4ResearchVREJAXB.setStartDate(new GregorianCalendar(2018, GregorianCalendar.JANUARY, 1).getTime()); + d4ResearchVREJAXB.setEndDate(new GregorianCalendar(2020, GregorianCalendar.MARCH, 3).getTime()); + d4ResearchVREJAXB.setCatalogUrl("http://data.d4science.org/ctlg/" + vre); + d4ResearchVREJAXB.setManagers(new ArrayList(Arrays.asList("Leonardo Candela", "Pasquale Pagano"))); + d4ResearchVREsOfD4ScienceOrgDetachedGateway.put( + "/d4science.research-infrastructures.eu/" + VOProduction.D4RESEARCH.getId() + "/" + vre, + d4ResearchVREJAXB); + } + d4ResearchOfD4ScienceOrgDetachedGateway.setVres(d4ResearchVREsOfD4ScienceOrgDetachedGateway); + + LinkedHashMap vosOfD4ScienceOrgDetachedGateway = new LinkedHashMap<>(); + vosOfD4ScienceOrgDetachedGateway.put( + "/d4science.research-infrastructures.eu/" + VOProduction.D4RESEARCH.getId(), + d4ResearchOfD4ScienceOrgDetachedGateway); + vosOfD4ScienceOrgDetachedGateway.put("/d4science.research-infrastructures.eu/" + VOProduction.FARM.getId(), + farmOfD4ScienceOrgDetachedGateway); + vosOfD4ScienceOrgDetachedGateway.put("/d4science.research-infrastructures.eu/" + VOProduction.GCUBEAPPS.getId(), + gCubeAppsOfD4ScienceOrgDetachedGateway); + + d4ScienceOrgDetachedGateway.setVos(vosOfD4ScienceOrgDetachedGateway); + } + } diff --git a/src/test/java/org/gcube/infrastructure/detachedres/detachedreslibrary/VOProduction.java b/src/test/java/org/gcube/infrastructure/detachedres/detachedreslibrary/VOProduction.java new file mode 100644 index 0000000..6345c9a --- /dev/null +++ b/src/test/java/org/gcube/infrastructure/detachedres/detachedreslibrary/VOProduction.java @@ -0,0 +1,23 @@ +package org.gcube.infrastructure.detachedres.detachedreslibrary; + +/** + * + * @author Giancarlo Panichi + * + */ +public enum VOProduction { + + GCUBEAPPS("gCubeApps"), FARM("FARM"), D4RESEARCH("D4Research"), PARTHENOSVO("ParthenosVO"), D4OS("D4OS"); + + String id; + + VOProduction(String id) { + this.id = id; + } + + public String getId() { + return this.id; + } + + +}