2022-02-14 17:06:32 +01:00
|
|
|
package org.gcube.application.geoportal.service;
|
|
|
|
|
|
|
|
import org.bson.Document;
|
2022-02-15 19:02:44 +01:00
|
|
|
import org.gcube.application.cms.serialization.Serialization;
|
2022-02-14 17:06:32 +01:00
|
|
|
import org.gcube.application.cms.tests.model.concessioni.TestConcessioniModel;
|
|
|
|
import org.gcube.application.geoportal.common.model.document.ProfiledDocument;
|
|
|
|
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation;
|
|
|
|
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 javax.ws.rs.core.Response;
|
|
|
|
|
|
|
|
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-02-16 17:12:54 +01:00
|
|
|
ProfiledDocument doc = createNew(new Document());
|
|
|
|
|
2022-02-14 17:06:32 +01:00
|
|
|
// register filesets
|
|
|
|
doc = upload(
|
|
|
|
new StorageUtils(),
|
|
|
|
doc.get_id(),
|
2022-02-16 17:12:54 +01:00
|
|
|
"posizionamentoScavo","fileset",
|
2022-02-14 17:06:32 +01:00
|
|
|
"posizionamentoScavo.children[?(@.fileset)]",
|
|
|
|
Document.parse("{\"titolo\" : \"mio titolo\",\"some\" : \"something\" }"),
|
|
|
|
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
|
|
|
|
StepExecutionRequest req=new StepExecutionRequest();
|
|
|
|
req.setStepID("SUBMIT-FOR-REVIEW");
|
|
|
|
doc=step(doc.get_id(),req);
|
|
|
|
System.out.println(doc);
|
|
|
|
assertTrue(doc.getLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK));
|
|
|
|
}
|
|
|
|
}
|