From 6bdbf5bd8cd626a313be7ead652cc50fe8f61ec4 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Thu, 17 Feb 2022 17:35:07 +0100 Subject: [PATCH] Added useful test --- src/test/java/org/gcube/gcat/ContextTest.java | 7 +++++-- .../ckan/CKANOrganizationTest.java | 20 +++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/gcube/gcat/ContextTest.java b/src/test/java/org/gcube/gcat/ContextTest.java index 41f9de8..6c3e89f 100644 --- a/src/test/java/org/gcube/gcat/ContextTest.java +++ b/src/test/java/org/gcube/gcat/ContextTest.java @@ -40,8 +40,11 @@ public class ContextTest { // DEFAULT_TEST_SCOPE_NAME = "/gcube/devsec/devVRE"; ROOT = "/gcube"; - VO = ROOT + "/devsec"; - VRE = VO + "/devVRE"; +// VO = ROOT + "/devsec"; +// VRE = VO + "/devVRE"; + VO = ROOT + "/devNext"; + VRE = VO + "/NextNext"; + } public static void set(Secret secret) throws Exception { diff --git a/src/test/java/org/gcube/gcat/persistence/ckan/CKANOrganizationTest.java b/src/test/java/org/gcube/gcat/persistence/ckan/CKANOrganizationTest.java index bf3ea2f..f456237 100644 --- a/src/test/java/org/gcube/gcat/persistence/ckan/CKANOrganizationTest.java +++ b/src/test/java/org/gcube/gcat/persistence/ckan/CKANOrganizationTest.java @@ -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.ObjectMapper; 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.api.configuration.CatalogueConfiguration; import org.junit.Ignore; import org.junit.Test; import org.slf4j.Logger; @@ -52,6 +55,23 @@ public class CKANOrganizationTest extends ContextTest { // 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 @Test public void deleteAllOrganizations() throws Exception {