Using a dedicated class to set token and scope for tests
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry-publisher@140071 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
67913ea482
commit
cf92502c5f
|
@ -153,7 +153,7 @@ public class MultiContextTest {
|
||||||
|
|
||||||
|
|
||||||
logger.debug("Changing token to test add to scope");
|
logger.debug("Changing token to test add to scope");
|
||||||
ScopedTest.setContext(ScopedTest.SECOND_TOKEN);
|
ScopedTest.setContext(ScopedTest.GCUBE_DEVNEXT_NEXTNEXT);
|
||||||
|
|
||||||
UUID uuid = createdHN.getHeader().getUUID();
|
UUID uuid = createdHN.getHeader().getUUID();
|
||||||
boolean addedToContext = resourceRegistryPublisher.addResourceToContext(uuid);
|
boolean addedToContext = resourceRegistryPublisher.addResourceToContext(uuid);
|
||||||
|
|
|
@ -25,14 +25,22 @@ public class ScopedTest {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ScopedTest.class);
|
private static final Logger logger = LoggerFactory.getLogger(ScopedTest.class);
|
||||||
|
|
||||||
protected static final String PROPERTIES_FILENAME = "config.properties";
|
protected static final String PROPERTIES_FILENAME = "token.properties";
|
||||||
|
|
||||||
private static final String TOKEN_VARNAME = "TOKEN";
|
private static final String GCUBE_DEVNEXT_VARNAME = "GCUBE_DEVNEXT";
|
||||||
public static final String TOKEN;
|
public static final String GCUBE_DEVNEXT;
|
||||||
|
|
||||||
private static final String SECOND_TOKEN_VARNAME = "SECOND_TOKEN";
|
private static final String GCUBE_DEVNEXT_NEXTNEXT_VARNAME = "GCUBE_DEVNEXT_NEXTNEXT";
|
||||||
public static final String SECOND_TOKEN;
|
public static final String GCUBE_DEVNEXT_NEXTNEXT;
|
||||||
|
|
||||||
|
public static final String GCUBE_DEVSEC_VARNAME = "GCUBE_DEVSEC";
|
||||||
|
public static final String GCUBE_DEVSEC;
|
||||||
|
|
||||||
|
public static final String GCUBE_DEVSEC_DEVVRE_VARNAME = "GCUBE_DEVSEC_DEVVRE";
|
||||||
|
public static final String GCUBE_DEVSEC_DEVVRE;
|
||||||
|
|
||||||
|
public static final String DEFAULT_TEST_SCOPE;
|
||||||
|
public static final String ALTERNATIVE_TEST_SCOPE;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
|
@ -45,8 +53,14 @@ public class ScopedTest {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
TOKEN = properties.getProperty(TOKEN_VARNAME);
|
GCUBE_DEVNEXT = properties.getProperty(GCUBE_DEVNEXT_VARNAME);
|
||||||
SECOND_TOKEN = properties.getProperty(SECOND_TOKEN_VARNAME);
|
GCUBE_DEVNEXT_NEXTNEXT = properties.getProperty(GCUBE_DEVNEXT_NEXTNEXT_VARNAME);
|
||||||
|
|
||||||
|
GCUBE_DEVSEC = properties.getProperty(GCUBE_DEVSEC_VARNAME);
|
||||||
|
GCUBE_DEVSEC_DEVVRE = properties.getProperty(GCUBE_DEVSEC_DEVVRE_VARNAME);
|
||||||
|
|
||||||
|
DEFAULT_TEST_SCOPE = GCUBE_DEVNEXT;
|
||||||
|
ALTERNATIVE_TEST_SCOPE = GCUBE_DEVSEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getCurrentScope(String token) throws ObjectNotFound, Exception{
|
public static String getCurrentScope(String token) throws ObjectNotFound, Exception{
|
||||||
|
@ -64,7 +78,7 @@ public class ScopedTest {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() throws Exception{
|
public static void beforeClass() throws Exception{
|
||||||
setContext(TOKEN);
|
setContext(DEFAULT_TEST_SCOPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
|
|
Loading…
Reference in New Issue