Fixed context creation

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/private/luca.frosini/resource-registry-database-creator@171337 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2018-09-06 12:48:30 +00:00
parent d94a7a4436
commit 837e7d9abd
2 changed files with 8 additions and 2 deletions

View File

@ -12,6 +12,7 @@ import org.gcube.informationsystem.impl.utils.ISMapper;
import org.gcube.informationsystem.model.entity.Context;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -59,7 +60,12 @@ public class ContextCreator extends ContextElaborator {
@Override
protected void elaborateContext(ScopeBean scopeBean) throws Exception {
UUID uuid = getContextUUID(scopeBean);
UUID uuid = null;
try {
uuid = getContextUUID(scopeBean);
}catch (ContextNotFoundException e) {
// The context has to be created
}
if(uuid==null) {
logger.info("Parent Context of {} is {}", scopeBean, scopeBean.enclosingScope());
UUID parentUUID = getContextUUID(scopeBean.enclosingScope());

View File

@ -12,7 +12,7 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ContextManagementTest {
public class ContextManagementTest extends ScopedTest {
private static Logger logger = LoggerFactory.getLogger(ContextManagementTest.class);