Added useful test

This commit is contained in:
Luca Frosini 2022-02-17 17:35:07 +01:00
parent d4725aeea5
commit 6bdbf5bd8c
2 changed files with 25 additions and 2 deletions

View File

@ -40,8 +40,11 @@ public class ContextTest {
// DEFAULT_TEST_SCOPE_NAME = "/gcube/devsec/devVRE"; // DEFAULT_TEST_SCOPE_NAME = "/gcube/devsec/devVRE";
ROOT = "/gcube"; ROOT = "/gcube";
VO = ROOT + "/devsec"; // VO = ROOT + "/devsec";
VRE = VO + "/devVRE"; // VRE = VO + "/devVRE";
VO = ROOT + "/devNext";
VRE = VO + "/NextNext";
} }
public static void set(Secret secret) throws Exception { public static void set(Secret secret) throws Exception {

View File

@ -3,7 +3,10 @@ package org.gcube.gcat.persistence.ckan;
import org.gcube.com.fasterxml.jackson.databind.JsonNode; import org.gcube.com.fasterxml.jackson.databind.JsonNode;
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper; import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode; import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode;
import org.gcube.common.authorization.utils.manager.SecretManager;
import org.gcube.common.scope.impl.ScopeBean;
import org.gcube.gcat.ContextTest; import org.gcube.gcat.ContextTest;
import org.gcube.gcat.api.configuration.CatalogueConfiguration;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -52,6 +55,23 @@ public class CKANOrganizationTest extends ContextTest {
// ckanOrganization.delete(true); // ckanOrganization.delete(true);
} }
@Ignore
@Test
public void createOrganization() throws Exception {
ContextTest.setContextByName("/gcube/devNext/NextNext");
String context = SecretManager.instance.get().getContext();
ScopeBean scopeBean = new ScopeBean(context);
CKANOrganization ckanOrganization = new CKANOrganization();
ckanOrganization.setApiKey(CKANUtility.getSysAdminAPI());
String name = CatalogueConfiguration.getOrganizationName(scopeBean);
ckanOrganization.setName(name);
String json = "{\"display_name\": \"" + scopeBean.name() + "\",\"description\": \"" + context + " Organization\",\"name\": \"" + name + "\"}";
logger.info("Going to create Organization {} : {}", name, json);
// ckanOrganization.create(json);
}
//@Ignore //@Ignore
@Test @Test
public void deleteAllOrganizations() throws Exception { public void deleteAllOrganizations() throws Exception {