diff --git a/webapp/src/test/java/org/gcube/resourcemanagement/manager/webapp/context/RMContextTest.java b/webapp/src/test/java/org/gcube/resourcemanagement/manager/webapp/context/RMContextTest.java index e1caba4..826d426 100644 --- a/webapp/src/test/java/org/gcube/resourcemanagement/manager/webapp/context/RMContextTest.java +++ b/webapp/src/test/java/org/gcube/resourcemanagement/manager/webapp/context/RMContextTest.java @@ -3,6 +3,9 @@ package org.gcube.resourcemanagement.manager.webapp.context; import static org.junit.Assert.*; import java.io.IOException; +import java.io.InputStream; +import java.util.Objects; +import java.util.Properties; import java.util.UUID; import javax.ws.rs.client.Entity; @@ -19,6 +22,7 @@ import org.gcube.common.scope.api.ScopeProvider; import org.gcube.informationsystem.impl.entity.ContextImpl; import org.gcube.informationsystem.impl.utils.ISMapper; import org.gcube.informationsystem.model.entity.Context; +import org.gcube.informationsystem.resourceregistry.client.ScopedTest; import org.gcube.resourcemanagement.manager.io.codeexceptions.CodeFinder; import org.gcube.resourcemanagement.manager.io.codeexceptions.SerializableErrorCode; import org.gcube.resourcemanagement.manager.io.rs.RMCreateContextCode; @@ -59,10 +63,24 @@ public class RMContextTest extends JerseyTest { private final static String RR = "http://manuele-registry.dev.d4science.org/resource-registry"; - public static final String DEFAULT_TEST_SCOPE ="71b9ef86-76ba-4346-b16e-9a1af203f6db-98187548"; - + public static String DEFAULT_TEST_SCOPE =""; private static boolean skipTest = false; + + static { + Properties properties = new Properties(); + try (InputStream input = RMContextTest.class.getClassLoader().getResourceAsStream("token.properties")) { + // load the properties file + properties.load(input); + } catch (IOException e) { + skipTest = true; + //throw new RuntimeException(e); + } + + DEFAULT_TEST_SCOPE = properties.getProperty("DEFAULT_SCOPE_TOKEN"); + if (DEFAULT_TEST_SCOPE.isEmpty()) + skipTest = true; + } @BeforeClass public static void beforeClass() throws Exception {