From b36ffbe43e8c74e7d28cf4933533d7a1fcac785f Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Tue, 11 Jan 2022 11:51:49 +0100 Subject: [PATCH] Content Moderator System (CMS) interface implemented --- .../utillibrary/gcat/GCatCaller.java | 301 +++++++++++++----- .../utillibrary/server/DataCatalogueImpl.java | 11 +- .../cms/CatalogueContentModeratorSystem.java | 42 +-- .../server/cms/DataCatalogueCMSImpl.java | 167 ++++++---- .../test/TestDataCatalogueCMS.java | 7 +- 5 files changed, 361 insertions(+), 167 deletions(-) diff --git a/src/main/java/org/gcube/datacatalogue/utillibrary/gcat/GCatCaller.java b/src/main/java/org/gcube/datacatalogue/utillibrary/gcat/GCatCaller.java index f5624dc..2a94e13 100644 --- a/src/main/java/org/gcube/datacatalogue/utillibrary/gcat/GCatCaller.java +++ b/src/main/java/org/gcube/datacatalogue/utillibrary/gcat/GCatCaller.java @@ -4,9 +4,14 @@ package org.gcube.datacatalogue.utillibrary.gcat; import java.net.MalformedURLException; +import java.util.HashMap; +import java.util.Map; import javax.ws.rs.WebApplicationException; +import javax.xml.ws.WebServiceException; +import org.gcube.gcat.api.moderation.CMItemStatus; +import org.gcube.gcat.api.moderation.Moderated; import org.gcube.gcat.client.Group; import org.gcube.gcat.client.Item; import org.gcube.gcat.client.Resource; @@ -17,15 +22,14 @@ import org.slf4j.LoggerFactory; /** * The Class GCatCaller. * - * @author Francesco Mangiacrapa at ISTI-CNR Pisa (Italy) - * May 29, 2020 + * @author Francesco Mangiacrapa at ISTI-CNR Pisa (Italy) May 29, 2020 */ public class GCatCaller { - + private String catalogueURL; - + private static final Logger LOG = LoggerFactory.getLogger(GCatCaller.class); - + /** * Instantiates a new g cat caller. * @@ -34,68 +38,7 @@ public class GCatCaller { public GCatCaller(String catalogueURL) { this.catalogueURL = catalogueURL; } - - - /** - * Gets the dataset for name. - * - * @param datasetName the dataset name - * @return the jsonValue - * @throws WebApplicationException the web application exception - * @throws MalformedURLException the malformed URL exception - */ - public String getDatasetForName(String datasetName) throws WebApplicationException, MalformedURLException { - LOG.debug("GetDatasetForName called"); - LOG.info("Get dataset for name "+datasetName+ "called"); - return new Item().read(datasetName); - } - - - /** - * Creates the dataset. - * - * @param jsonDataset the json dataset - * @param socialPost if true sends the social post - * @return the jsonValue - * @throws WebApplicationException the web application exception - * @throws MalformedURLException the malformed URL exception - */ - public String createDataset(String jsonDataset, boolean socialPost) throws WebApplicationException, MalformedURLException { - LOG.debug("Create dataset called"); - LOG.info("Calling create on: "+jsonDataset); - return new Item().create(jsonDataset,socialPost); - } - - - /** - * Adds the resource to dataset. - * - * @param datasetId the dataset id - * @param jsonValueResource the json value resource - * @return the string - * @throws MalformedURLException the malformed URL exception - */ - public String addResourceToDataset(String datasetId, String jsonValueResource) throws MalformedURLException { - LOG.debug("Create resource called"); - LOG.info("Calling create resource: "+jsonValueResource+ " for dataset id: "+datasetId); - return new Resource().create(datasetId, jsonValueResource); - } - - - /** - * Delete resource. - * - * @param datasetId the dataset id - * @param resourceId the resource id - * @throws MalformedURLException the malformed URL exception - */ - public void deleteResource(String datasetId, String resourceId) throws MalformedURLException { - LOG.debug("Delete resource called"); - LOG.info("Calling delete resource with: "+resourceId+ " for dataset id: "+datasetId); - new Resource().delete(datasetId, resourceId); - } - - + /** * Gets the catalogue URL. * @@ -105,7 +48,63 @@ public class GCatCaller { return catalogueURL; } - + /** + * Gets the dataset for name. + * + * @param datasetName the dataset name + * @return the jsonValue + * @throws WebApplicationException the web application exception + * @throws MalformedURLException the malformed URL exception + */ + public String getDatasetForName(String datasetName) throws WebApplicationException, MalformedURLException { + LOG.debug("GetDatasetForName called"); + LOG.info("Get dataset for name " + datasetName + "called"); + return new Item().read(datasetName); + } + + /** + * Creates the dataset. + * + * @param jsonDataset the json dataset + * @param socialPost if true sends the social post + * @return the jsonValue + * @throws WebApplicationException the web application exception + * @throws MalformedURLException the malformed URL exception + */ + public String createDataset(String jsonDataset, boolean socialPost) + throws WebApplicationException, MalformedURLException { + LOG.debug("Create dataset called"); + LOG.info("Calling create on: " + jsonDataset); + return new Item().create(jsonDataset, socialPost); + } + + /** + * Adds the resource to dataset. + * + * @param datasetId the dataset id + * @param jsonValueResource the json value resource + * @return the string + * @throws MalformedURLException the malformed URL exception + */ + public String addResourceToDataset(String datasetId, String jsonValueResource) throws MalformedURLException { + LOG.debug("Create resource called"); + LOG.info("Calling create resource: " + jsonValueResource + " for dataset id: " + datasetId); + return new Resource().create(datasetId, jsonValueResource); + } + + /** + * Delete resource. + * + * @param datasetId the dataset id + * @param resourceId the resource id + * @throws MalformedURLException the malformed URL exception + */ + public void deleteResource(String datasetId, String resourceId) throws MalformedURLException { + LOG.debug("Delete resource called"); + LOG.info("Calling delete resource with: " + resourceId + " for dataset id: " + datasetId); + new Resource().delete(datasetId, resourceId); + } + /** * Creates the group. * @@ -113,27 +112,177 @@ public class GCatCaller { * @return the string * @throws MalformedURLException the malformed URL exception */ - public String createGroup(String jsonGroup) throws MalformedURLException { + public String createGroup(String jsonGroup) throws MalformedURLException { LOG.debug("Create group called"); - LOG.info("Calling create group: "+jsonGroup); + LOG.info("Calling create group: " + jsonGroup); return new Group().create(jsonGroup); } - /** * Patch dataset. * * @param datasetName the dataset name - * @param jsonObj the json obj + * @param jsonObj the json obj * @return the string * @throws WebApplicationException the web application exception - * @throws MalformedURLException the malformed URL exception + * @throws MalformedURLException the malformed URL exception */ - public String patchDataset(String datasetName, JSONObject jsonObj) throws WebApplicationException, MalformedURLException { + public String patchDataset(String datasetName, JSONObject jsonObj) + throws WebApplicationException, MalformedURLException { LOG.debug("Patch dataset called"); - LOG.info("Calling patch dataset with name: "+datasetName); + LOG.info("Calling patch dataset with name: " + datasetName); + return new Item().patch(datasetName, jsonObj.toJSONString()); - + } + /** + * Approve item. + * + * @param datasetName the dataset name + * @param moderatorMessage the moderator message + * @return the string + * @throws WebApplicationException the web application exception + * @throws MalformedURLException the malformed URL exception + */ + public String approveItem(String datasetName, String moderatorMessage) + throws WebApplicationException, MalformedURLException { + LOG.debug("Approve item called"); + LOG.info("Calling approve item with name: " + datasetName + ", and msg: " + moderatorMessage); + + return new Item().approve(datasetName, moderatorMessage); + + } + + /** + * Reject item. + * + * @param datasetName the dataset name + * @param permanentlyDelete the permanently delete + * @param moderatorMessage the moderator message + * @return the string + * @throws WebServiceException the web service exception + * @throws MalformedURLException the malformed URL exception + */ + public String rejectItem(String datasetName, boolean permanentlyDelete, String moderatorMessage) + throws WebServiceException, MalformedURLException { + LOG.debug("Reject item called"); + LOG.info("Calling reject item with name: " + datasetName + ", and msg: " + moderatorMessage); + + String toReturnMsg = new Item().reject(datasetName, moderatorMessage); + + if (permanentlyDelete) { + deleteItem(datasetName, true); + } + + return toReturnMsg; + } + + /** + * Delete item. + * + * @param datasetName the dataset name + * @param purge the purge + * @throws WebServiceException the web service exception + * @throws MalformedURLException the malformed URL exception + */ + public void deleteItem(String datasetName, boolean purge) throws WebServiceException, MalformedURLException { + LOG.debug("Delete item called"); + LOG.info("Calling delete item with name: " + datasetName + ", and purge: " + purge); + + new Item().delete(datasetName, purge); + return; + } + + /** + * Gets the list items for CM status. + * + * @param status the status + * @param limit the limit + * @param offset the offset + * @return the list items for CM status + * @throws WebServiceException the web service exception + * @throws MalformedURLException the malformed URL exception + */ + public String getListItemsForCMStatus(CMItemStatus status, int limit, int offset) + throws WebServiceException, MalformedURLException { + LOG.debug("getListItemsForStatus called"); + LOG.info("Calling list items for status: " + status); + + Map queryParams = new HashMap(); + // queryParams.put(Moderated.SYSTEM_CM_ITEM_STATUS, status.getValue()); + + String modStatusField = Moderated.SYSTEM_CM_ITEM_STATUS.replaceAll(":", "_"); + queryParams.put("q", "extras_" + modStatusField + ":" + status.getValue()); + + if (limit < 0) + limit = 10; + if (offset < 0) + offset = 0; + + queryParams.put("limit", limit + ""); + queryParams.put("offset", offset + ""); + + return getListItemsForQuery(queryParams); + } + + /** + * Count list items for CM status. + * + * @param status the status + * @return the int + * @throws WebServiceException the web service exception + * @throws MalformedURLException the malformed URL exception + */ + public int countListItemsForCMStatus(CMItemStatus status) throws WebServiceException, MalformedURLException { + LOG.debug("countListItemsForCMStatus called"); + LOG.info("Calling coun list items for status: " + status); + + Map queryParams = new HashMap(); + // queryParams.put(Moderated.SYSTEM_CM_ITEM_STATUS, status.getValue()); + + String modStatusField = Moderated.SYSTEM_CM_ITEM_STATUS.replaceAll(":", "_"); + queryParams.put("q", "extras_" + modStatusField + ":" + status.getValue()); + queryParams.put("count", "true"); + String theSize = getListItemsForQuery(queryParams); + int count = 0; + try { + count = Integer.parseInt(theSize); + } catch (Exception e) { + LOG.warn("Size retured by gCat is not an integer, returning: " + count); + } + return count; + } + + /** + * Gets the list items. + * + * @param limit the limit + * @param offset the offset + * @return the list items + * @throws WebServiceException the web service exception + * @throws MalformedURLException the malformed URL exception + */ + public String getListItems(int limit, int offset) throws WebServiceException, MalformedURLException { + LOG.debug("getListItems called"); + LOG.info("Calling list items with limit: " + limit + ", offset: " + offset); + + return new Item().list(limit, offset); + } + + /** + * Gets the list items for query. + * + * @param queryParams the query params + * @return the list items for query + * @throws WebServiceException the web service exception + * @throws MalformedURLException the malformed URL exception + */ + public String getListItemsForQuery(Map queryParams) + throws WebServiceException, MalformedURLException { + LOG.debug("getListItems forQuery called"); + LOG.info("Calling list items for query: " + queryParams); + + return new Item().list(queryParams); + } } diff --git a/src/main/java/org/gcube/datacatalogue/utillibrary/server/DataCatalogueImpl.java b/src/main/java/org/gcube/datacatalogue/utillibrary/server/DataCatalogueImpl.java index 7a57688..00a2028 100644 --- a/src/main/java/org/gcube/datacatalogue/utillibrary/server/DataCatalogueImpl.java +++ b/src/main/java/org/gcube/datacatalogue/utillibrary/server/DataCatalogueImpl.java @@ -58,13 +58,11 @@ import org.json.simple.parser.JSONParser; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - -// TODO: Auto-generated Javadoc /** * This is the Ckan Utils implementation class. * * revisited by - * @author Francesco Mangiacrapa at ISTI-CNR + * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) * * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) */ @@ -326,17 +324,16 @@ public class DataCatalogueImpl implements DataCatalogue { return null; } - /** * Gets the catalogue content moderator system * * @return the catalogue content moderator */ public CatalogueContentModeratorSystem getCatalogueContentModerator() { - if(dataCatalogueCMSImpl==null) { - dataCatalogueCMSImpl = new DataCatalogueCMSImpl(); + if (dataCatalogueCMSImpl == null) { + dataCatalogueCMSImpl = new DataCatalogueCMSImpl(CONTEXT, MANAGE_PRODUCT_BUTTON, gCatCaller); } - + return dataCatalogueCMSImpl; } diff --git a/src/main/java/org/gcube/datacatalogue/utillibrary/server/cms/CatalogueContentModeratorSystem.java b/src/main/java/org/gcube/datacatalogue/utillibrary/server/cms/CatalogueContentModeratorSystem.java index 28b3710..90df727 100644 --- a/src/main/java/org/gcube/datacatalogue/utillibrary/server/cms/CatalogueContentModeratorSystem.java +++ b/src/main/java/org/gcube/datacatalogue/utillibrary/server/cms/CatalogueContentModeratorSystem.java @@ -5,17 +5,17 @@ import java.net.MalformedURLException; import java.util.List; import javax.ws.rs.WebApplicationException; +import javax.xml.ws.WebServiceException; import org.gcube.datacatalogue.utillibrary.shared.ItemStatus; import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanDataset; -// TODO: Auto-generated Javadoc /** * The Interface CatalogueContentModeratorSystem. * * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it * - * Jun 14, 2021 + * Jan 10, 2022 */ public interface CatalogueContentModeratorSystem { @@ -26,14 +26,6 @@ public interface CatalogueContentModeratorSystem { */ boolean isContentModeratorEnabled(); - /** - * Sets the status. - * - * @param itemId the item id - * @param theStatus the the status - */ - void setStatus(String itemId, ItemStatus theStatus); - /** * Gets the list items for status. * @@ -48,28 +40,26 @@ public interface CatalogueContentModeratorSystem { public List getListItemsForStatus(ItemStatus theStatus, int limit, int offset) throws WebApplicationException, MalformedURLException, InvalidObjectException; - /** - * Approve item. - * - * @param itemId the item id - */ - void approveItem(String itemId); - /** * Reject item. * - * @param itemId the item id + * @param itemName the item name * @param permanentlyDelete the permanently delete * @param reasonMsg the reason msg + * @throws WebServiceException the web service exception + * @throws MalformedURLException the malformed URL exception */ - void rejectItem(String itemId, boolean permanentlyDelete, String reasonMsg); + void rejectItem(String itemName, boolean permanentlyDelete, String reasonMsg) + throws WebServiceException, MalformedURLException; /** * Permanently delete. * - * @param itemId the item id + * @param itemName the item name + * @throws WebServiceException the web service exception + * @throws MalformedURLException the malformed URL exception */ - void permanentlyDelete(String itemId); + void permanentlyDelete(String itemName) throws WebServiceException, MalformedURLException; /** * Count list items for status. @@ -79,4 +69,14 @@ public interface CatalogueContentModeratorSystem { */ long countListItemsForStatus(ItemStatus theStatus); + /** + * Approve item. + * + * @param itemName the item name + * @param moderatorMessage the moderator message + * @throws WebApplicationException the web application exception + * @throws MalformedURLException the malformed URL exception + */ + void approveItem(String itemName, String moderatorMessage) throws WebApplicationException, MalformedURLException; + } diff --git a/src/main/java/org/gcube/datacatalogue/utillibrary/server/cms/DataCatalogueCMSImpl.java b/src/main/java/org/gcube/datacatalogue/utillibrary/server/cms/DataCatalogueCMSImpl.java index ee37c90..772d575 100644 --- a/src/main/java/org/gcube/datacatalogue/utillibrary/server/cms/DataCatalogueCMSImpl.java +++ b/src/main/java/org/gcube/datacatalogue/utillibrary/server/cms/DataCatalogueCMSImpl.java @@ -9,12 +9,14 @@ import java.util.ArrayList; import java.util.List; import javax.ws.rs.WebApplicationException; +import javax.xml.ws.WebServiceException; import org.gcube.datacatalogue.utillibrary.ckan.MarshUnmarshCkanObject; import org.gcube.datacatalogue.utillibrary.ckan.MarshUnmarshCkanObject.METHOD; +import org.gcube.datacatalogue.utillibrary.gcat.GCatCaller; import org.gcube.datacatalogue.utillibrary.shared.ItemStatus; import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanDataset; -import org.gcube.gcat.client.Item; +import org.gcube.gcat.api.moderation.CMItemStatus; import org.json.simple.JSONArray; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; @@ -32,6 +34,25 @@ public class DataCatalogueCMSImpl implements CatalogueContentModeratorSystem { private static final Logger LOG = LoggerFactory.getLogger(DataCatalogueCMSImpl.class); + private String runningScope; + + private boolean isContentModeratorEnabled; + + private GCatCaller gCatCaller; + + /** + * Instantiates a new data catalogue CMS impl. + * + * @param runningScope the running scope + * @param isContentModeratorEnabled the is content moderator enabled + * @param gCatCaller the g cat caller + */ + public DataCatalogueCMSImpl(String runningScope, boolean isContentModeratorEnabled, GCatCaller gCatCaller) { + this.runningScope = runningScope; + this.isContentModeratorEnabled = isContentModeratorEnabled; + this.gCatCaller = gCatCaller; + } + /** * Checks if is content moderator enabled. * @@ -39,22 +60,62 @@ public class DataCatalogueCMSImpl implements CatalogueContentModeratorSystem { */ @Override public boolean isContentModeratorEnabled() { - // TODO Auto-generated method stub - return false; + return isContentModeratorEnabled; } /** - * Sets the status. + * Approve item. * - * @param itemId the item id - * @param theStatus the the status + * @param datasetName the dataset name + * @param moderatorMessage the moderator message + * @throws WebApplicationException the web application exception + * @throws MalformedURLException the malformed URL exception */ @Override - public void setStatus(String itemId, ItemStatus theStatus) { - // TODO Auto-generated method stub + public void approveItem(String datasetName, String moderatorMessage) + throws WebApplicationException, MalformedURLException { + gCatCaller.approveItem(datasetName, moderatorMessage); } + /** + * Reject item. + * + * @param datasetName the dataset name + * @param permanentlyDelete the permanently delete + * @param moderatorMessage the moderator message + * @throws WebServiceException the web service exception + * @throws MalformedURLException the malformed URL exception + */ + @Override + public void rejectItem(String datasetName, boolean permanentlyDelete, String moderatorMessage) + throws WebServiceException, MalformedURLException { + gCatCaller.rejectItem(datasetName, permanentlyDelete, moderatorMessage); + + } + + /** + * Permanently delete. + * + * @param datasetName the dataset name + * @throws WebServiceException the web service exception + * @throws MalformedURLException the malformed URL exception + */ + @Override + public void permanentlyDelete(String datasetName) throws WebServiceException, MalformedURLException { + gCatCaller.deleteItem(datasetName, true); + + } + + /** + * Gets the running scope. + * + * @return the running scope + */ + public String getRunningScope() { + return runningScope; + } + /** * Gets the list items for status. * @@ -64,7 +125,7 @@ public class DataCatalogueCMSImpl implements CatalogueContentModeratorSystem { * @return the list items for status * @throws WebApplicationException the web application exception * @throws MalformedURLException the malformed URL exception - * @throws JSONException + * @throws InvalidObjectException the invalid object exception */ @Override public List getListItemsForStatus(ItemStatus theStatus, int limit, int offset) @@ -84,7 +145,7 @@ public class DataCatalogueCMSImpl implements CatalogueContentModeratorSystem { try { datasetName = (String) jsonArray.get(i); LOG.debug("reading dataset: " + datasetName); - String jsonValueDataset = new Item().read(datasetName); + String jsonValueDataset = gCatCaller.getDatasetForName(datasetName); LOG.trace("the JSON dataset is: " + jsonValueDataset); CkanDataset toCkanDataset = MarshUnmarshCkanObject.toCkanDataset(jsonValueDataset, METHOD.TO_READ); LOG.debug("converted as dataset: " + toCkanDataset); @@ -104,6 +165,30 @@ public class DataCatalogueCMSImpl implements CatalogueContentModeratorSystem { return listDataset; } + + /** + * Count list items for status. + * + * @param theStatus the the status + * @return the number of items with the input status + */ + @Override + public long countListItemsForStatus(ItemStatus theStatus) { + LOG.info("called countListItemsForStatus with [status: " + theStatus + "]"); + checkNotNull(theStatus); + int count = 0; + try { + CMItemStatus cmStatus = toCMStatus(theStatus); + count = gCatCaller.countListItemsForCMStatus(cmStatus); + } catch (Exception e) { + LOG.error("Error on counting the items for status " + theStatus, e); + return -1; + } + + return count; + + } + /** * Gets the source array of items for status read by gCatClient. * @@ -113,6 +198,7 @@ public class DataCatalogueCMSImpl implements CatalogueContentModeratorSystem { * @return the source array of items for status * @throws WebApplicationException the web application exception * @throws MalformedURLException the malformed URL exception + * @throws InvalidObjectException the invalid object exception */ protected org.json.simple.JSONArray getSourceArrayOfItemsForStatus(ItemStatus theStatus, int limit, int offset) throws WebApplicationException, MalformedURLException, InvalidObjectException { @@ -121,14 +207,16 @@ public class DataCatalogueCMSImpl implements CatalogueContentModeratorSystem { checkNotNull(theStatus); // TODO MUST BE CHANGED FOR THE STATUS org.json.simple.JSONArray jsonArray = null; - String datasetNames = new Item().list(limit, offset); + + CMItemStatus cmiStatus = toCMStatus(theStatus); + String datasetNames = gCatCaller.getListItemsForCMStatus(cmiStatus, limit, offset); if (datasetNames != null) { LOG.debug("for status " + theStatus + " found dataset: " + datasetNames); JSONParser parser = new JSONParser(); try { jsonArray = (JSONArray) parser.parse(datasetNames); } catch (ParseException e) { - LOG.error("error occurred reading " + datasetNames + " as JSONArray",e); + LOG.error("error occurred reading " + datasetNames + " as JSONArray", e); throw new InvalidObjectException(e.getMessage()); } } @@ -138,60 +226,19 @@ public class DataCatalogueCMSImpl implements CatalogueContentModeratorSystem { } /** - * Count list items for status. + * To CM status. * * @param theStatus the the status - * @return the long + * @return the CM item status + * @throws WebApplicationException the web application exception */ - @Override - public long countListItemsForStatus(ItemStatus theStatus) { - LOG.info("called countListItemsForStatus with [status: " + theStatus + "]"); - checkNotNull(theStatus); - int count = 0; + private CMItemStatus toCMStatus(ItemStatus theStatus) throws WebApplicationException { try { - // TODO MUST BE CHANGED FOR THE STATUS - count = new Item().count(); + return CMItemStatus.valueOf(theStatus.name()); } catch (Exception e) { - LOG.error("Error on couting list items for status " + theStatus, e); - return -1; + throw new WebApplicationException( + "No value of " + theStatus.name() + " into enumerator: " + CMItemStatus.values()); } - - return count; - } - /** - * Approve item. - * - * @param itemId the item id - */ - @Override - public void approveItem(String itemId) { - // TODO Auto-generated method stub - - } - - /** - * Reject item. - * - * @param itemId the item id - * @param permanentlyDelete the permanently delete - * @param reasonMsg the reason msg - */ - @Override - public void rejectItem(String itemId, boolean permanentlyDelete, String reasonMsg) { - // TODO Auto-generated method stub - - } - - /** - * Permanently delete. - * - * @param itemId the item id - */ - @Override - public void permanentlyDelete(String itemId) { - // TODO Auto-generated method stub - - } } diff --git a/src/test/java/org/gcube/datacatalogue/utillibrary/test/TestDataCatalogueCMS.java b/src/test/java/org/gcube/datacatalogue/utillibrary/test/TestDataCatalogueCMS.java index 24b5ab4..c0e3e38 100644 --- a/src/test/java/org/gcube/datacatalogue/utillibrary/test/TestDataCatalogueCMS.java +++ b/src/test/java/org/gcube/datacatalogue/utillibrary/test/TestDataCatalogueCMS.java @@ -9,6 +9,7 @@ import org.gcube.datacatalogue.utillibrary.server.DataCatalogueImpl; import org.gcube.datacatalogue.utillibrary.server.cms.CatalogueContentModeratorSystem; import org.gcube.datacatalogue.utillibrary.shared.ItemStatus; import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanDataset; +import org.junit.Before; import org.junit.Test; import org.slf4j.LoggerFactory; @@ -31,7 +32,7 @@ public class TestDataCatalogueCMS { * * @throws Exception the exception */ - // @Before + //@Before public void before() throws Exception { factory = DataCatalogueFactory.getFactory(); } @@ -57,7 +58,7 @@ public class TestDataCatalogueCMS { * @return the scope per url * @throws Exception */ - @Test + //@Test public void getListItemsForStatus() throws Exception { try { @@ -68,7 +69,7 @@ public class TestDataCatalogueCMS { CatalogueContentModeratorSystem cCMS = dImpl.getCatalogueContentModerator(); LOG.debug(CatalogueContentModeratorSystem.class.getName() + " instancied correclty"); - List listDatasets = cCMS.getListItemsForStatus(ItemStatus.PENDING, 20, 0); + List listDatasets = cCMS.getListItemsForStatus(ItemStatus.REJECTED, 20, 0); for (CkanDataset ckanDataset : listDatasets) { LOG.debug("CkanDataset read: " + ckanDataset);