Fixed GRSF utility

This commit is contained in:
Luca Frosini 2022-05-23 15:09:30 +02:00
parent ff7b8d7399
commit 08312a1a19
2 changed files with 17 additions and 13 deletions

View File

@ -518,6 +518,13 @@ public class CKANPackage extends CKAN implements Moderated {
offset = 0; offset = 0;
} }
parameters.put(START_KEY, String.valueOf(offset)); parameters.put(START_KEY, String.valueOf(offset));
// This filter by type
// StringWriter qStringWriter = new StringWriter();
// qStringWriter.append("extras_systemtype:");
// qStringWriter.append("");
// parameters.put(GCatConstants.Q_KEY, qStringWriter.toString());
return list(parameters); return list(parameters);
} }

View File

@ -28,7 +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.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -46,14 +46,14 @@ 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";
@BeforeClass @Before
public void before() throws Exception { public void before() throws 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().getUser().getUsername());
logger.debug(SecretManagerProvider.instance.get().getContext()); logger.debug(SecretManagerProvider.instance.get().getContext());
} }
@ -273,22 +273,19 @@ public class GRSFUtilities extends ContextTest {
logger.debug("Going to purge record with name {}", name); logger.debug("Going to purge record with name {}", name);
ckanPackage.setName(name); ckanPackage.setName(name);
try { try {
// ckanPackage.purgeNoCheckNoDeleteFiles(); ckanPackage.purgeNoCheckNoDeleteFiles();
if(go) {
break;
}
}catch (Exception e) { }catch (Exception e) {
// TODO: handle exception logger.error("Unable to purge record with name {}", name, e);
} }
Thread.sleep(500);
} }
Thread.sleep(500);
}else { }else {
go=false; go=false;
} }
} }
} }
// @Test @Test
public void purgeAllGRSFRecords() throws Exception { public void purgeAllGRSFRecords() throws Exception {
purgeGRSFRecords(100, 0); purgeGRSFRecords(100, 0);
} }