Fixed tests
This commit is contained in:
parent
0949e44ccb
commit
a4ee7d0812
|
@ -17,7 +17,6 @@ import org.gcube.common.authorization.library.utils.Caller;
|
|||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -32,7 +31,11 @@ public class ContextTest {
|
|||
protected static Properties properties;
|
||||
protected static final String PROPERTIES_FILENAME = "token.properties";
|
||||
|
||||
public static final String DEFAULT_TEST_SCOPE_NAME;
|
||||
public static final String PARENT_DEFAULT_TEST_SCOPE;
|
||||
public static final String DEFAULT_TEST_SCOPE;
|
||||
public static final String ALTERNATIVE_TEST_SCOPE;
|
||||
|
||||
public static final String DEFAULT_TEST_SCOPE_ANOTHER_USER;
|
||||
|
||||
static {
|
||||
properties = new Properties();
|
||||
|
@ -45,13 +48,22 @@ public class ContextTest {
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
//DEFAULT_TEST_SCOPE_NAME = "/pred4s/preprod/preVRE";
|
||||
DEFAULT_TEST_SCOPE_NAME = "/gcube";
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() throws ObjectNotFound, Exception {
|
||||
ContextTest.setContext("a34b486c-874c-4539-97c9-be8d9e00fd7f-98187548");
|
||||
// PARENT_DEFAULT_TEST_SCOPE = "/pred4s"
|
||||
// DEFAULT_TEST_SCOPE_NAME = PARENT_DEFAULT_TEST_SCOPE + "/preprod";
|
||||
// ALTERNATIVE_TEST_SCOPE = DEFAULT_TEST_SCOPE_NAME + "/preVRE";
|
||||
|
||||
|
||||
PARENT_DEFAULT_TEST_SCOPE = "/gcube";
|
||||
DEFAULT_TEST_SCOPE = PARENT_DEFAULT_TEST_SCOPE + "/devNext";
|
||||
ALTERNATIVE_TEST_SCOPE = DEFAULT_TEST_SCOPE + "/NextNext";
|
||||
|
||||
DEFAULT_TEST_SCOPE_ANOTHER_USER = "lucio.lelii_" + DEFAULT_TEST_SCOPE;
|
||||
|
||||
try {
|
||||
setContextByName(DEFAULT_TEST_SCOPE);
|
||||
} catch(Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getCurrentScope(String token) throws ObjectNotFound, Exception {
|
||||
|
@ -66,7 +78,7 @@ public class ContextTest {
|
|||
setContext(token);
|
||||
}
|
||||
|
||||
public static void setContext(String token) throws ObjectNotFound, Exception {
|
||||
private static void setContext(String token) throws ObjectNotFound, Exception {
|
||||
SecurityTokenProvider.instance.set(token);
|
||||
AuthorizationEntry authorizationEntry = Constants.authorizationService().get(token);
|
||||
ClientInfo clientInfo = authorizationEntry.getClientInfo();
|
||||
|
@ -79,7 +91,7 @@ public class ContextTest {
|
|||
|
||||
@BeforeClass
|
||||
public static void beforeClass() throws Exception {
|
||||
setContextByName(DEFAULT_TEST_SCOPE_NAME);
|
||||
setContextByName(DEFAULT_TEST_SCOPE);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
|
|
Loading…
Reference in New Issue