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@158776 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c4116ed127
commit
96b98199e8
|
@ -1,7 +1,9 @@
|
||||||
package org.gcube.informationsystem.resourceregistry.context;
|
package org.gcube.informationsystem.resourceregistry.context;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.gcube.informationsystem.impl.embedded.HeaderImpl;
|
import org.gcube.informationsystem.impl.embedded.HeaderImpl;
|
||||||
|
@ -118,7 +120,7 @@ public class ContextManagementTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.assertTrue(pre.getName().compareTo(post.getName()) == 0);
|
Assert.assertTrue(pre.getName().compareTo(post.getName()) == 0);
|
||||||
if (checkParent && pre.getParent()!=null && post.getParent()!=null) {
|
if (checkParent && pre.getParent() != null && post.getParent() != null) {
|
||||||
Context preParent = pre.getParent().getSource();
|
Context preParent = pre.getParent().getSource();
|
||||||
Context postParent = post.getParent().getSource();
|
Context postParent = post.getParent().getSource();
|
||||||
assertions(preParent, postParent, false, false);
|
assertions(preParent, postParent, false, false);
|
||||||
|
@ -232,7 +234,7 @@ public class ContextManagementTest {
|
||||||
invalidCreate(contextB3); // Trying to recreate B3. Fails
|
invalidCreate(contextB3); // Trying to recreate B3. Fails
|
||||||
invalidCreate(contextB4); // Trying to recreate B4. Fails
|
invalidCreate(contextB4); // Trying to recreate B4. Fails
|
||||||
invalidCreate(contextA5); // Trying to recreate A5. Fails
|
invalidCreate(contextA5); // Trying to recreate A5. Fails
|
||||||
|
|
||||||
// Trying to move A5 as child of A1. It fails due to A2.
|
// Trying to move A5 as child of A1. It fails due to A2.
|
||||||
Context nullContext = null;
|
Context nullContext = null;
|
||||||
contextA5.setParent(nullContext);
|
contextA5.setParent(nullContext);
|
||||||
|
@ -241,23 +243,20 @@ public class ContextManagementTest {
|
||||||
// ________A1________
|
// ________A1________
|
||||||
// ___A2_______B4____
|
// ___A2_______B4____
|
||||||
// B3______________A5
|
// B3______________A5
|
||||||
|
|
||||||
|
|
||||||
nullContext = null;
|
nullContext = null;
|
||||||
contextB4.setParent(nullContext);
|
contextB4.setParent(nullContext);
|
||||||
update(contextB4);
|
update(contextB4);
|
||||||
// _____A1____B4_____
|
// _____A1____B4_____
|
||||||
// __A2__________A5__
|
// __A2__________A5__
|
||||||
// B3
|
// B3
|
||||||
|
|
||||||
|
|
||||||
contextB4.setParent(contextA1);
|
contextB4.setParent(contextA1);
|
||||||
update(contextB4);
|
update(contextB4);
|
||||||
// ________A1________
|
// ________A1________
|
||||||
// ___A2_______B4____
|
// ___A2_______B4____
|
||||||
// B3______________A5
|
// B3______________A5
|
||||||
|
|
||||||
|
|
||||||
// Trying to rename with the new name A. It fails due to A5.
|
// Trying to rename with the new name A. It fails due to A5.
|
||||||
contextB3.setName(CTX_NAME_A);
|
contextB3.setName(CTX_NAME_A);
|
||||||
update(contextB3);
|
update(contextB3);
|
||||||
|
@ -375,7 +374,7 @@ public class ContextManagementTest {
|
||||||
Context contextC = new ContextImpl(CTX_NAME_C);
|
Context contextC = new ContextImpl(CTX_NAME_C);
|
||||||
contextC.setHeader(new HeaderImpl(contextA1.getHeader().getUUID()));
|
contextC.setHeader(new HeaderImpl(contextA1.getHeader().getUUID()));
|
||||||
invalidCreate(contextC);
|
invalidCreate(contextC);
|
||||||
|
|
||||||
delete(contextA1);
|
delete(contextA1);
|
||||||
logger.debug("The DB should be now clean");
|
logger.debug("The DB should be now clean");
|
||||||
}
|
}
|
||||||
|
@ -392,7 +391,7 @@ public class ContextManagementTest {
|
||||||
Context devVRE = new ContextImpl("devVRE");
|
Context devVRE = new ContextImpl("devVRE");
|
||||||
devVRE.setParent(devsec);
|
devVRE.setParent(devsec);
|
||||||
devVRE = create(devVRE);
|
devVRE = create(devVRE);
|
||||||
|
|
||||||
Context devNext = new ContextImpl("devNext");
|
Context devNext = new ContextImpl("devNext");
|
||||||
devNext.setParent(gcube);
|
devNext.setParent(gcube);
|
||||||
devNext = create(devNext);
|
devNext = create(devNext);
|
||||||
|
@ -410,4 +409,39 @@ public class ContextManagementTest {
|
||||||
preVRE = create(preVRE);
|
preVRE = create(preVRE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Test
|
||||||
|
public void createPARTHENOSContext() throws Exception {
|
||||||
|
// /d4science.research-infrastructures.eu/ParthenosVO/PARTHENOS_Registry
|
||||||
|
|
||||||
|
Context d4science = new ContextImpl("d4science.research-infrastructures.eu");
|
||||||
|
create(d4science);
|
||||||
|
|
||||||
|
Context parthenosVO = new ContextImpl("ParthenosVO");
|
||||||
|
parthenosVO.setParent(d4science);
|
||||||
|
create(parthenosVO);
|
||||||
|
|
||||||
|
Context parthenosRegistry = new ContextImpl("PARTHENOS_Registry");
|
||||||
|
parthenosRegistry.setParent(parthenosVO);
|
||||||
|
create(parthenosRegistry);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// @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("D4STeam", farmUUID);
|
||||||
|
|
||||||
|
for (String contextName : contexts.keySet()) {
|
||||||
|
Context parent = read(contexts.get(contextName));
|
||||||
|
Context context = new ContextImpl(contextName);
|
||||||
|
context.setParent(parent);
|
||||||
|
create(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue