Refs #10238: Refactor Context Port Type

Task-Url: https://support.d4science.org/issues/10238

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@158775 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-11-23 09:14:28 +00:00
parent 33f4264348
commit c4116ed127
1 changed files with 1 additions and 123 deletions

View File

@ -3,8 +3,6 @@
*/ */
package org.gcube.informationsystem.resourceregistry.context; package org.gcube.informationsystem.resourceregistry.context;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID; import java.util.UUID;
import org.gcube.informationsystem.impl.utils.ISMapper; import org.gcube.informationsystem.impl.utils.ISMapper;
@ -14,7 +12,6 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.context.Conte
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextException; import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -181,127 +178,8 @@ public class ContextManagementImplTest {
logger.debug("The DB should be now clean"); logger.debug("The DB should be now clean");
} }
// @Test
public void createContext() throws Exception {
String name = "test";
String testJson = contextManagementImpl.create(null, name);
Context testContext = ISMapper.unmarshal(Context.class, testJson);
Assert.assertTrue(testContext.getName().compareTo(name) == 0);
UUID testUUID = testContext.getHeader().getUUID();
logger.trace("/test : {}", testUUID);
boolean deleted = contextManagementImpl.delete(testUUID);
Assert.assertTrue(deleted);
logger.debug("The DB should be now clean");
}
//@Test
public void createPARTHENOSContext() throws Exception {
// /d4science.research-infrastructures.eu/ParthenosVO/PARTHENOS_Registry
String d4scienceJson = contextManagementImpl.create(null, "d4science.research-infrastructures.eu");
Context d4scienceContext = ISMapper.unmarshal(Context.class, d4scienceJson);
UUID d4science = d4scienceContext.getHeader().getUUID();
logger.trace("/d4science.research-infrastructures.eu : {}", d4scienceJson);
String parthenosVOJson = contextManagementImpl.create(d4science, "ParthenosVO");
Context parthenosVOContex = ISMapper.unmarshal(Context.class, parthenosVOJson);
UUID parthenosVO = parthenosVOContex.getHeader().getUUID();
logger.trace("/d4science.research-infrastructures.eu/ParthenosVO : {}", parthenosVOJson);
String PARTHENOS_RegistryJson = contextManagementImpl.create(parthenosVO, "PARTHENOS_Registry");
Context PARTHENOS_RegistryContex = ISMapper.unmarshal(Context.class, PARTHENOS_RegistryJson);
@SuppressWarnings("unused")
UUID PARTHENOS_Registry = PARTHENOS_RegistryContex.getHeader().getUUID();
logger.trace("/d4science.research-infrastructures.eu/ParthenosVO/PARTHENOS_Registry : {}", PARTHENOS_RegistryJson);
}
// @Test
public void createProductionMissingContext() throws Exception {
UUID d4ResearchUUID = UUID.fromString("8b926d1c-4460-4d7a-adab-c75ad2770a21");
UUID farmUUID = UUID.fromString("dbafdb3e-f7f9-4039-ad1c-3432c041f53c");
Map<String, UUID> contexts = new HashMap<>();
contexts.put("ICES_FIACO2017", d4ResearchUUID);
//contexts.put("ICES_BNetworkAnalysis", d4ResearchUUID);
//contexts.put("KIMAGRO_Fishfarming", farmUUID);
contexts.put("D4STeam", farmUUID);
for(String contextName : contexts.keySet()){
String contextJson = contextManagementImpl.create(contexts.get(contextName), contextName);
Context context = ISMapper.unmarshal(Context.class, contextJson);
UUID conetexUUID = context.getHeader().getUUID();
logger.trace("{} : {}", contextName, conetexUUID);
}
}
// @Test
public void createDevContext() throws Exception {
String gcubeJson = contextManagementImpl.create(null, "gcube");
Context gcubeContext = ISMapper.unmarshal(Context.class, gcubeJson);
UUID gcube = gcubeContext.getHeader().getUUID();
logger.trace("/gcube : {}", gcubeJson);
String devsecJson = contextManagementImpl.create(gcube, "devsec");
Context devsecContex = ISMapper.unmarshal(Context.class, devsecJson);
UUID devsec = devsecContex.getHeader().getUUID();
logger.trace("/gcube/devsec : {}", devsecJson);
String devVREJson = contextManagementImpl.create(devsec, "devVRE");
Context devVREContex = ISMapper.unmarshal(Context.class, devVREJson);
@SuppressWarnings("unused")
UUID devVRE = devVREContex.getHeader().getUUID();
logger.trace("/gcube/devsec/devVRE : {}", devVREJson);
String devNextJson = contextManagementImpl.create(gcube, "devNext");
Context devNextContex = ISMapper.unmarshal(Context.class, devNextJson);
UUID devNext = devNextContex.getHeader().getUUID();
logger.trace("/gcube/devNext : {}", devNextJson);
String NextNextJson = contextManagementImpl.create(devNext, "NextNext");
Context NextNextContex = ISMapper
.unmarshal(Context.class, NextNextJson);
@SuppressWarnings("unused")
UUID NextNext = NextNextContex.getHeader().getUUID();
logger.trace("/gcube/devNext/NextNext : {}", NextNextJson);
String preprodJson = contextManagementImpl.create(gcube, "preprod");
Context preprodContex = ISMapper.unmarshal(Context.class, preprodJson);
UUID preprod = preprodContex.getHeader().getUUID();
logger.trace("/gcube/devsec : {}", preprodJson);
String preVREJson = contextManagementImpl.create(preprod, "preVRE");
Context preVREContex = ISMapper.unmarshal(Context.class, preVREJson);
@SuppressWarnings("unused")
UUID preVRE = preVREContex.getHeader().getUUID();
logger.trace("/gcube/devsec/devVRE : {}", preVREJson);
/*
* contextManagementImpl.delete(NextNext);
* contextManagementImpl.delete(devNext);
* contextManagementImpl.delete(devVRE);
* contextManagementImpl.delete(devsec);
* contextManagementImpl.delete(gcube);
*/
// logger.debug("The DB should be now clean");
}
//@Test
public void removeContext() throws Exception {
/*
contextManagementImpl.delete(UUID .fromString(""));
contextManagementImpl.delete(UUID .fromString(""));
contextManagementImpl.delete(UUID .fromString(""));
contextManagementImpl.delete(UUID .fromString(""));
contextManagementImpl.delete(UUID .fromString(""));
*/
}
// @Test // @Test
public void readTest() throws Exception { public void readTest() throws Exception {