Fixed test

This commit is contained in:
Luca Frosini 2022-05-12 16:29:00 +02:00
parent e3e8ffd393
commit eff29b0176
1 changed files with 9 additions and 21 deletions

View File

@ -28,6 +28,7 @@ import org.gcube.gcat.persistence.ckan.CKANPackageTest;
import org.gcube.gcat.persistence.ckan.CKANUser; import org.gcube.gcat.persistence.ckan.CKANUser;
import org.gcube.gcat.persistence.ckan.CKANUtility; import org.gcube.gcat.persistence.ckan.CKANUtility;
import org.junit.Assert; import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -45,17 +46,16 @@ public class GRSFUtilities extends ContextTest {
public static final String PREPROD_GRSF_PRE = "/pred4s/preprod/GRSF_Pre"; public static final String PREPROD_GRSF_PRE = "/pred4s/preprod/GRSF_Pre";
public GRSFUtilities() throws ObjectNotFound, Exception { @BeforeClass
ContextTest.setContextByName(PREPROD_GRSF_PRE); public void before() throws Exception {
}
@Test
public void test() throws ObjectNotFound, Exception {
ContextTest.setContextByName(PREPROD_GRSF_PRE); ContextTest.setContextByName(PREPROD_GRSF_PRE);
// //
// ContextTest.setContextByName(PRODUCTION_GRSF); // ContextTest.setContextByName(PRODUCTION_GRSF);
// ContextTest.setContextByName(PRODUCTION_GRSF_ADMIN); // ContextTest.setContextByName(PRODUCTION_GRSF_ADMIN);
// ContextTest.setContextByName(PRODUCTION_GRSF_PRE); // ContextTest.setContextByName(PRODUCTION_GRSF_PRE);
logger.debug(SecretManagerProvider.instance.get().getUser().getUsername());
logger.debug(SecretManagerProvider.instance.get().getContext());
} }
private void create(Set<String> createdGroup, Map<String, String> groups, String name) throws JsonProcessingException, IOException { private void create(Set<String> createdGroup, Map<String, String> groups, String name) throws JsonProcessingException, IOException {
@ -149,8 +149,6 @@ public class GRSFUtilities extends ContextTest {
// @Test // @Test
public void createNewGRSFGroups() throws ObjectNotFound, Exception { public void createNewGRSFGroups() throws ObjectNotFound, Exception {
// ContextTest.setContext("");
logger.debug(SecretManagerProvider.instance.get().getUser().getUsername());
String sysAdminAPI = CKANUtility.getSysAdminAPI(); String sysAdminAPI = CKANUtility.getSysAdminAPI();
String[] groupNames = new String[] { String[] groupNames = new String[] {
"GRSF", "Legacy", "Fishery", "Stock", "FIRMS", "FishSource", "RAM", "GRSF", "Legacy", "Fishery", "Stock", "FIRMS", "FishSource", "RAM",
@ -177,10 +175,6 @@ public class GRSFUtilities extends ContextTest {
// @Test // @Test
public void deleteNewGRSFGroups() throws ObjectNotFound, Exception { public void deleteNewGRSFGroups() throws ObjectNotFound, Exception {
ContextTest.setContext("");
logger.debug(SecretManagerProvider.instance.get().getUser().getUsername());
logger.debug(SecretManagerProvider.instance.get().getContext());
String sysAdminAPI = CKANUtility.getSysAdminAPI(); String sysAdminAPI = CKANUtility.getSysAdminAPI();
// String[] groupNames = new String[] { // String[] groupNames = new String[] {
// "GRSF", "Legacy", "Fishery", "Stock", "FIRMS", "FishSource", "RAM", // "GRSF", "Legacy", "Fishery", "Stock", "FIRMS", "FishSource", "RAM",
@ -192,6 +186,8 @@ public class GRSFUtilities extends ContextTest {
// }; // };
// //
List<String> groupNames = CKANGroupTest.listGroup(); List<String> groupNames = CKANGroupTest.listGroup();
logger.debug(SecretManagerProvider.instance.get().getUser().getUsername());
logger.debug(SecretManagerProvider.instance.get().getContext());
for(String name : groupNames) { for(String name : groupNames) {
CKANGroup ckanGroupToCreate = new CKANGroup(); CKANGroup ckanGroupToCreate = new CKANGroup();
@ -207,14 +203,9 @@ public class GRSFUtilities extends ContextTest {
} }
@Test // @Test
public void associateUserToAllCKANGroupsAndOrganization() throws ObjectNotFound, Exception { public void associateUserToAllCKANGroupsAndOrganization() throws ObjectNotFound, Exception {
ContextTest.setContext("");
logger.debug(SecretManagerProvider.instance.get().getUser().getUsername());
logger.debug(SecretManagerProvider.instance.get().getContext());
String[] usernames = new String[] { "grsf_publisher", "luca_frosini", "francesco_mangiacrapa"}; String[] usernames = new String[] { "grsf_publisher", "luca_frosini", "francesco_mangiacrapa"};
String sysAdminAPI = CKANUtility.getSysAdminAPI(); String sysAdminAPI = CKANUtility.getSysAdminAPI();
List<String> groupNames = CKANGroupTest.listGroup(); List<String> groupNames = CKANGroupTest.listGroup();
@ -299,9 +290,6 @@ public class GRSFUtilities extends ContextTest {
// @Test // @Test
public void purgeAllGRSFRecords() throws Exception { public void purgeAllGRSFRecords() throws Exception {
ContextTest.setContext("");
logger.debug(SecretManagerProvider.instance.get().getUser().getUsername());
logger.debug(SecretManagerProvider.instance.get().getContext());
purgeGRSFRecords(100, 0); purgeGRSFRecords(100, 0);
} }