2022-03-31 15:49:22 +02:00
|
|
|
package org.gcube.gcat.moderation;
|
|
|
|
|
|
|
|
import org.gcube.gcat.ContextTest;
|
|
|
|
import org.gcube.gcat.api.moderation.CMItemStatus;
|
|
|
|
import org.gcube.gcat.moderation.thread.ModerationThread;
|
|
|
|
import org.gcube.gcat.persistence.ckan.CKANUser;
|
2022-04-07 17:00:36 +02:00
|
|
|
import org.junit.Ignore;
|
2022-03-31 15:49:22 +02:00
|
|
|
import org.junit.Test;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Luca Frosini (ISTI - CNR)
|
|
|
|
*/
|
|
|
|
public class ModerationThreadTest extends ContextTest {
|
|
|
|
|
|
|
|
@Test
|
2022-04-07 17:00:36 +02:00
|
|
|
@Ignore
|
2022-03-31 15:49:22 +02:00
|
|
|
public void test() throws Exception {
|
|
|
|
ModerationThread moderationThread = ModerationThread.getDefaultInstance();
|
2022-04-06 17:15:46 +02:00
|
|
|
moderationThread.setItemCoordinates("e31a6ba8-66ef-47b8-b61f-99a1366b4a69", "my_first_restful_transaction_model", "RESTful Transaction Model", "https://data.dev.d4science.org/ctlg/devVRE/my_first_restful_transaction_model");
|
2022-03-31 15:49:22 +02:00
|
|
|
CKANUser ckanUser = new CKANUser();
|
|
|
|
ckanUser.setName(CKANUser.getCKANUsername());
|
|
|
|
ckanUser.read();
|
|
|
|
moderationThread.setCKANUser(ckanUser);
|
|
|
|
moderationThread.postItemCreated();
|
|
|
|
moderationThread.postItemUpdated();
|
2022-04-07 16:57:35 +02:00
|
|
|
moderationThread.postItemRejected(null);
|
|
|
|
moderationThread.postItemRejected("reject con messaggio: Non mi garba");
|
|
|
|
moderationThread.postItemApproved(null);
|
|
|
|
moderationThread.postItemApproved("approve con messaggio: Ora mi garba");
|
2022-04-06 17:15:46 +02:00
|
|
|
moderationThread.setItemAuthor(true);
|
|
|
|
moderationThread.postUserMessage(CMItemStatus.APPROVED, "Grazie");
|
2022-03-31 15:49:22 +02:00
|
|
|
Thread.sleep(1000);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|