2022-05-18 18:24:57 +02:00
|
|
|
package org.gcube.application.cms.plugins;
|
|
|
|
|
2023-03-03 12:33:27 +01:00
|
|
|
import org.gcube.application.cms.plugins.faults.StepException;
|
|
|
|
import org.gcube.application.cms.plugins.implementations.Default3PhaseManager;
|
|
|
|
import org.gcube.application.geoportal.common.model.plugins.OperationDescriptor;
|
|
|
|
|
2022-10-05 16:17:34 +02:00
|
|
|
public class SimpleLifecycleTests {
|
2022-05-18 18:24:57 +02:00
|
|
|
|
2023-03-03 12:33:27 +01:00
|
|
|
// NB cannot use test commons, need to separate modules
|
2022-05-18 18:24:57 +02:00
|
|
|
// extends
|
|
|
|
// BasicPluginTest {
|
|
|
|
//
|
|
|
|
// @Test
|
|
|
|
// public void testFullCycle(){
|
|
|
|
// SimpleLifeCycleManager manager = plugins.get(SimpleLifeCycleManager.PLUGIN_ID);
|
|
|
|
//
|
|
|
|
// StepExecutionRequest request = new StepExecutionRequest();
|
|
|
|
//
|
|
|
|
// Project p = null;
|
|
|
|
//
|
|
|
|
// EventExecutionRequest eventRequest = new EventExecutionRequest();
|
|
|
|
//
|
|
|
|
// manager.onEvent()
|
|
|
|
//
|
|
|
|
// manager.performStep()
|
|
|
|
// }
|
|
|
|
|
2023-03-03 12:33:27 +01:00
|
|
|
public static void main(String[] args) {
|
|
|
|
|
|
|
|
System.out.println("Check start");
|
|
|
|
OperationDescriptor op = Default3PhaseManager.STEPS.APPROVE;
|
|
|
|
|
|
|
|
try {
|
|
|
|
// Check document phase
|
|
|
|
if (op.getAppliableToPhases() != null && !op.getAppliableToPhases().isEmpty()) {
|
|
|
|
String currentPhase = "Pending Approval";
|
|
|
|
if (!op.getAppliableToPhases().contains(currentPhase)) {
|
|
|
|
System.out.println("check KO");
|
|
|
|
throw new StepException(
|
|
|
|
"Document must be in one of the following phases : " + op.getAppliableToPhases());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
System.out.println("check OK");
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-05-18 18:24:57 +02:00
|
|
|
}
|