2022-02-24 18:09:30 +01:00
|
|
|
package org.gcube.application.geoportal.service.profiledDocuments;
|
2022-02-14 17:06:32 +01:00
|
|
|
|
|
|
|
import org.bson.Document;
|
2022-02-15 19:02:44 +01:00
|
|
|
import org.gcube.application.cms.serialization.Serialization;
|
2022-03-04 14:23:20 +01:00
|
|
|
import org.gcube.application.geoportal.common.model.document.Project;
|
2022-02-14 17:06:32 +01:00
|
|
|
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation;
|
2022-03-04 14:23:20 +01:00
|
|
|
import org.gcube.application.geoportal.common.model.useCaseDescriptor.Field;
|
2022-02-14 17:06:32 +01:00
|
|
|
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
|
|
|
|
import org.gcube.application.geoportal.common.model.rest.StepExecutionRequest;
|
|
|
|
import org.gcube.application.geoportal.common.rest.InterfaceConstants;
|
|
|
|
import org.gcube.application.geoportal.common.utils.StorageUtils;
|
|
|
|
import org.junit.Test;
|
|
|
|
|
|
|
|
import javax.ws.rs.client.WebTarget;
|
|
|
|
|
|
|
|
import static org.junit.Assert.assertEquals;
|
|
|
|
import static org.junit.Assert.assertTrue;
|
|
|
|
|
2022-02-16 17:12:54 +01:00
|
|
|
public class ProfiledConcessioniTests extends AbstractProfiledDocumentsTests{
|
2022-02-14 17:06:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected WebTarget baseTarget() {
|
|
|
|
String testProfileId="profiledConcessioni";
|
|
|
|
return target(InterfaceConstants.Methods.PROJECTS).path(testProfileId);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testSDI() throws Exception {
|
|
|
|
// Create new
|
2022-03-04 11:30:48 +01:00
|
|
|
Document theDoc=Document.parse("{\n" +
|
|
|
|
"\"posizionamentoScavo\" :{\n" +
|
|
|
|
"\t\"titolo\" : \"mio titolo\"}}");
|
|
|
|
|
2022-03-04 14:23:20 +01:00
|
|
|
Project doc = createNew(theDoc);
|
2022-03-04 11:30:48 +01:00
|
|
|
|
|
|
|
|
2022-02-16 17:12:54 +01:00
|
|
|
|
2022-02-14 17:06:32 +01:00
|
|
|
// register filesets
|
|
|
|
doc = upload(
|
|
|
|
new StorageUtils(),
|
2022-02-23 17:13:22 +01:00
|
|
|
doc.getId(),
|
2022-03-22 17:29:25 +01:00
|
|
|
"posizionamentoScavo",
|
|
|
|
"fileset",
|
2022-03-04 11:30:48 +01:00
|
|
|
"posizionamentoScavo."+ Field.CHILDREN+"[?(@.fileset)]",
|
|
|
|
null,
|
2022-02-14 17:06:32 +01:00
|
|
|
RegisterFileSetRequest.ClashOptions.MERGE_EXISTING,
|
|
|
|
"pos.shp");
|
|
|
|
|
2022-02-15 19:02:44 +01:00
|
|
|
|
|
|
|
System.out.println("Registered posizionamento, result is "+ Serialization.write(doc));
|
2022-02-14 17:06:32 +01:00
|
|
|
// invoke step SUBMIT-FOR-REVIEW
|
2022-03-07 17:59:06 +01:00
|
|
|
StepExecutionRequest submitReq=new StepExecutionRequest();
|
|
|
|
submitReq.setStepID("SUBMIT-FOR-REVIEW");
|
|
|
|
doc=step(doc.getId(),submitReq);
|
2022-02-14 17:06:32 +01:00
|
|
|
System.out.println(doc);
|
|
|
|
assertTrue(doc.getLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK));
|
2022-03-07 17:59:06 +01:00
|
|
|
|
|
|
|
|
|
|
|
// invoke step Publish
|
|
|
|
|
|
|
|
StepExecutionRequest approveDraftReq=new StepExecutionRequest();
|
|
|
|
approveDraftReq.setStepID("APPROVE DRAFT");
|
|
|
|
doc=step(doc.getId(),approveDraftReq);
|
|
|
|
System.out.println(doc);
|
|
|
|
assertTrue(doc.getLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK));
|
|
|
|
assertTrue(doc.getSpatialReference()!=null);
|
|
|
|
System.out.println("Project "+doc.getId()+" published with spatial reference "+doc.getSpatialReference().toJson());
|
2022-02-14 17:06:32 +01:00
|
|
|
}
|
|
|
|
}
|