Skip tests that require a connection to Resource Registry when the token is not set.

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/resource-management/resource-manager@161893 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Manuele Simi 2017-12-22 20:27:25 +00:00
parent 57d6749dea
commit 4dccab1032
1 changed files with 9 additions and 0 deletions

View File

@ -46,6 +46,9 @@ public class RMContextTest extends JerseyTest {
private final static String RR = ""; private final static String RR = "";
private static boolean skipTest = false;
public static final String DEFAULT_TEST_SCOPE =""; public static final String DEFAULT_TEST_SCOPE ="";
@BeforeClass @BeforeClass
@ -54,6 +57,10 @@ public class RMContextTest extends JerseyTest {
} }
public static void setContext(String token) throws ObjectNotFound, Exception{ public static void setContext(String token) throws ObjectNotFound, Exception{
if (DEFAULT_TEST_SCOPE.isEmpty()) {
skipTest = true;
return;
}
SecurityTokenProvider.instance.set(token); SecurityTokenProvider.instance.set(token);
ScopeProvider.instance.set(getCurrentScope(token)); ScopeProvider.instance.set(getCurrentScope(token));
} }
@ -98,6 +105,7 @@ public class RMContextTest extends JerseyTest {
*/ */
@Test @Test
public void step1_Create() { public void step1_Create() {
if (skipTest) return;
Context newContext = new ContextImpl(contextName); Context newContext = new ContextImpl(contextName);
try { try {
System.out.print(ISMapper.marshal(newContext)); System.out.print(ISMapper.marshal(newContext));
@ -122,6 +130,7 @@ public class RMContextTest extends JerseyTest {
*/ */
@Test @Test
public void step1_CreateWithInvalidParent() { public void step1_CreateWithInvalidParent() {
if (skipTest) return;
Context newContext = new ContextImpl(contextName); Context newContext = new ContextImpl(contextName);
newContext.setParent(new ContextImpl("DoNotExist")); newContext.setParent(new ContextImpl("DoNotExist"));
try { try {