|
|
|
@ -5,6 +5,9 @@ package org.gcube.resourcemanagement.manager.webapp.context;
|
|
|
|
|
|
|
|
|
|
import static org.junit.Assert.*;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
import java.util.Properties;
|
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
|
|
import org.gcube.common.authorization.client.Constants;
|
|
|
|
@ -35,12 +38,26 @@ public class QueriesTest {
|
|
|
|
|
|
|
|
|
|
private final static String RR = "http://manuele-registry.dev.d4science.org/resource-registry";
|
|
|
|
|
|
|
|
|
|
public static final String DEFAULT_TEST_SCOPE ="";
|
|
|
|
|
public static String DEFAULT_TEST_SCOPE ="";
|
|
|
|
|
|
|
|
|
|
public static final UUID uuid = UUID.fromString("5f86dc81-2f59-486b-8aa9-3ab5486313c4");
|
|
|
|
|
public static final UUID context1UUID = UUID.fromString("5f86dc81-2f59-486b-8aa9-3ab5486313c4");
|
|
|
|
|
|
|
|
|
|
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 {
|
|
|
|
|
setContext(DEFAULT_TEST_SCOPE);
|
|
|
|
@ -87,9 +104,9 @@ public class QueriesTest {
|
|
|
|
|
return;
|
|
|
|
|
ResourceRegistryContextClient client = new ResourceRegistryContextClientImpl(RR);
|
|
|
|
|
Queries queries = new Queries();
|
|
|
|
|
Context context = queries.fetchContext(uuid,client);
|
|
|
|
|
Context context = queries.fetchContext(context1UUID,client);
|
|
|
|
|
assertNotNull("Context does not exist.", context);
|
|
|
|
|
assertEquals("Unexpected uuid for context", uuid, context.getHeader().getUUID());
|
|
|
|
|
assertEquals("Unexpected uuid for context", context1UUID, context.getHeader().getUUID());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|