Fixed tests

This commit is contained in:
Luca Frosini 2021-01-29 17:29:49 +01:00
parent 55b79bc835
commit 6082e3a0d6
1 changed files with 18 additions and 10 deletions

View File

@ -593,10 +593,13 @@ public class BasicTest extends ContextTest {
logger.debug("Setting back default scope");
ContextTest.setContextByName(DEFAULT_TEST_SCOPE);
resourceManagement = new ResourceManagement();
resourceManagement.setUUID(eServiceUUID);
deleted = resourceManagement.delete();
Assert.assertTrue(deleted);
try {
resourceManagement = new ResourceManagement();
resourceManagement.setUUID(eServiceUUID);
deleted = resourceManagement.delete();
}catch (ResourceNotFoundException e) {
// OK
}
}
@ -666,9 +669,6 @@ public class BasicTest extends ContextTest {
/* ------------------------------------------------------------------ */
logger.debug("Switching to alternative scope");
ContextTest.setContextByName(ALTERNATIVE_TEST_SCOPE);
/*
* resourceManagement = new ResourceManagement();
* resourceManagement.setUUID(hnUUID);
@ -686,7 +686,11 @@ public class BasicTest extends ContextTest {
isRelatedToManagement = new IsRelatedToManagement();
isRelatedToManagement.setUUID(activatesUUID);
isRelatedToManagement.addToContext(ContextUtility.getCurrentSecurityContext().getUUID());
UUID contextUUID = ContextUtility.getInstance().getSecurityContextByFullName(ALTERNATIVE_TEST_SCOPE).getUUID();
isRelatedToManagement.addToContext(contextUUID);
logger.debug("Switching to alternative scope");
ContextTest.setContextByName(ALTERNATIVE_TEST_SCOPE);
/* The addTocontext on the relation adds the source and target too.
* So that I MUST be able to read HostinNode and EService
@ -707,7 +711,7 @@ public class BasicTest extends ContextTest {
resourceManagement = new ResourceManagement();
resourceManagement.setUUID(hnUUID);
Map<UUID,JsonNode> affectedInstances = resourceManagement.removeFromContext(ContextUtility.getCurrentSecurityContext().getUUID());
logger.debug("Remove from Context afffects the following instances {}", affectedInstances.values());
logger.debug("Remove from Context affects the following instances {}", affectedInstances.values());
// Assert.assertTrue(affectedInstaces);
@ -839,13 +843,17 @@ public class BasicTest extends ContextTest {
/* ------------------------------------------------------------------ */
addToContextThenTestIfBehaveProperly(hostingNode, false, ALTERNATIVE_TEST_SCOPE);
logger.debug("Switching to alternative scope");
ContextTest.setContextByName(ALTERNATIVE_TEST_SCOPE);
hostingNodeManagement = new ResourceManagement();
hostingNodeManagement.setUUID(hostingNode.getHeader().getUUID());
hostingNodeManagement.setElementType(Utility.getTypeName(hostingNode.getClass()));
hostingNodeManagement.addToContext(ContextUtility.getCurrentSecurityContext().getUUID());
String hostingNodeContexts = hostingNodeManagement.getContexts();
logger.debug("Contexts of {} with UUID {} have the following UUID {}", HostingNode.NAME, hostingNodeManagement.getUUID(), hostingNodeContexts);