This commit is contained in:
Fabio Sinibaldi 2022-09-26 16:11:20 +02:00
parent d05db92597
commit e56aed85f8
99 changed files with 281 additions and 1084 deletions

View File

@ -110,6 +110,12 @@
<artifactId>reflections</artifactId>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<!-- <version>2.3.0</version>-->
</dependency>
</dependencies>
</project>

View File

@ -1,17 +1,9 @@
package org.gcube.application.cms.caches;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.Synchronized;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.geoportal.common.utils.ContextUtils;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import java.time.LocalDateTime;
import java.time.temporal.TemporalAmount;
import java.util.concurrent.ConcurrentHashMap;
import org.gcube.application.geoportal.common.utils.ContextUtils;
@Slf4j
/**

View File

@ -6,12 +6,9 @@ import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.common.utils.ContextUtils;
import java.time.LocalDateTime;
import java.time.temporal.TemporalAmount;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Slf4j

View File

@ -3,7 +3,6 @@ package org.gcube.application.cms.implementations;
import lombok.Synchronized;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.caches.Cache;
import org.gcube.application.cms.caches.Engine;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.common.storagehub.client.dsl.StorageHubClient;

View File

@ -2,18 +2,15 @@ package org.gcube.application.cms.implementations;
import lombok.*;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.geoportal.common.model.configuration.Archive;
import org.gcube.application.geoportal.common.model.document.filesets.RegisteredFile;
import org.gcube.application.geoportal.common.model.legacy.WorkspaceContent;
import org.gcube.application.geoportal.common.utils.Files;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.common.utils.Files;
import org.gcube.common.storagehub.client.dsl.FileContainer;
import org.gcube.common.storagehub.client.dsl.FolderContainer;
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
import org.gcube.common.storagehub.model.exceptions.StorageHubException;
import java.io.FileNotFoundException;
import java.io.InputStream;
@Slf4j
@ -100,18 +97,18 @@ public class WorkspaceManager {
}
public WorkspaceContent storeToWS(FileOptions opts) throws FileNotFoundException, StorageHubException {
FileContainer item=createFileRoutine(opts);
item=sgClient.open(item.getId()).asFile();
WorkspaceContent content=new WorkspaceContent();
content.setLink(item.getPublicLink().toString());
content.setMimetype(item.get().getContent().getMimeType());
content.setStorageID(item.getId());
content.setName(item.get().getName());
return content;
}
// public WorkspaceContent storeToWS(FileOptions opts) throws FileNotFoundException, StorageHubException {
// FileContainer item=createFileRoutine(opts);
// item=sgClient.open(item.getId()).asFile();
//
// WorkspaceContent content=new WorkspaceContent();
// content.setLink(item.getPublicLink().toString());
// content.setMimetype(item.get().getContent().getMimeType());
// content.setStorageID(item.getId());
// content.setName(item.get().getName());
// return content;
//
// }
public RegisteredFile registerFile(FileOptions opts) throws StorageHubException {
FileContainer item=createFileRoutine(opts);
@ -129,9 +126,9 @@ public class WorkspaceManager {
}
public void deleteFromWS(WorkspaceContent toDelete) throws StorageHubException {
sgClient.open(toDelete.getStorageID()).asFile().forceDelete();
}
// public void deleteFromWS(WorkspaceContent toDelete) throws StorageHubException {
// sgClient.open(toDelete.getStorageID()).asFile().forceDelete();
// }
public void deleteItem(String itemId)throws StorageHubException{
sgClient.open(itemId).asItem().forceDelete();

View File

@ -1,13 +1,11 @@
package org.gcube.application.cms.plugins;
import org.bson.Document;
import org.gcube.application.cms.plugins.faults.InvalidPluginRequestException;
import org.gcube.application.cms.plugins.reports.IndexDocumentReport;
import org.gcube.application.cms.plugins.requests.BaseRequest;
import org.gcube.application.cms.plugins.requests.IndexDocumentRequest;
import org.gcube.application.geoportal.common.model.configuration.Index;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
public interface IndexerPluginInterface extends InitializablePlugin{

View File

@ -8,7 +8,6 @@ import org.gcube.application.cms.plugins.requests.EventExecutionRequest;
import org.gcube.application.cms.plugins.requests.StepExecutionRequest;
import org.gcube.application.geoportal.common.model.configuration.Configuration;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
public interface LifecycleManager extends InitializablePlugin{

View File

@ -1,6 +1,5 @@
package org.gcube.application.cms.plugins;
import org.gcube.application.cms.plugins.Plugin;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import java.util.Map;

View File

@ -8,7 +8,6 @@ import org.reflections.util.FilterBuilder;
import java.lang.reflect.Modifier;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@Slf4j
public class PluginsReflections {

View File

@ -6,10 +6,13 @@ import org.bson.Document;
import org.gcube.application.cms.plugins.IndexerPluginInterface;
import org.gcube.application.cms.plugins.LifecycleManager;
import org.gcube.application.cms.plugins.MaterializationPlugin;
import org.gcube.application.cms.plugins.faults.*;
import org.gcube.application.cms.plugins.faults.EventException;
import org.gcube.application.cms.plugins.faults.InvalidPluginRequestException;
import org.gcube.application.cms.plugins.faults.MaterializationException;
import org.gcube.application.cms.plugins.implementations.executions.GuardedStepExecution;
import org.gcube.application.cms.plugins.reports.*;
import org.gcube.application.cms.plugins.requests.*;
import org.gcube.application.cms.plugins.reports.EventExecutionReport;
import org.gcube.application.cms.plugins.reports.StepExecutionReport;
import org.gcube.application.cms.plugins.requests.BaseRequest;
import org.gcube.application.geoportal.common.model.configuration.Configuration;
import org.gcube.application.geoportal.common.model.configuration.Index;
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation;

View File

@ -5,10 +5,15 @@ import org.bson.Document;
import org.gcube.application.cms.plugins.IndexerPluginInterface;
import org.gcube.application.cms.plugins.LifecycleManager;
import org.gcube.application.cms.plugins.MaterializationPlugin;
import org.gcube.application.cms.plugins.faults.*;
import org.gcube.application.cms.plugins.faults.EventException;
import org.gcube.application.cms.plugins.faults.InvalidPluginRequestException;
import org.gcube.application.cms.plugins.faults.MaterializationException;
import org.gcube.application.cms.plugins.implementations.executions.GuardedStepExecution;
import org.gcube.application.cms.plugins.reports.*;
import org.gcube.application.cms.plugins.requests.*;
import org.gcube.application.cms.plugins.requests.BaseExecutionRequest;
import org.gcube.application.cms.plugins.requests.BaseRequest;
import org.gcube.application.cms.plugins.requests.IndexDocumentRequest;
import org.gcube.application.cms.plugins.requests.MaterializationRequest;
import org.gcube.application.geoportal.common.model.JSONPathWrapper;
import org.gcube.application.geoportal.common.model.configuration.Configuration;
import org.gcube.application.geoportal.common.model.configuration.Index;

View File

@ -7,9 +7,6 @@ import org.gcube.application.cms.plugins.reports.StepExecutionReport;
import org.gcube.application.cms.plugins.requests.StepExecutionRequest;
import org.gcube.application.geoportal.common.model.plugins.OperationDescriptor;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.Field;
import java.util.Map;
public abstract class GuardedStepExecution extends GuardedExecution<StepExecutionRequest, StepExecutionReport>{

View File

@ -22,14 +22,7 @@ package org.gcube.application.cms.plugins.model;
import lombok.*;
import java.math.BigInteger;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Deque;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Properties;
import java.util.*;
/**
* <p>

View File

@ -11,7 +11,6 @@ import org.gcube.application.cms.plugins.requests.BaseExecutionRequest;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.document.identification.IdentificationReference;
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation;
import org.gcube.application.geoportal.common.model.document.identification.TemporalReference;
import java.util.ArrayList;
import java.util.List;

View File

@ -1,19 +1,10 @@
package org.gcube.application.cms.plugins.reports;
import com.fasterxml.jackson.core.JsonProcessingException;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
import org.bson.Document;
import org.gcube.application.cms.plugins.faults.InvalidPluginRequestException;
import org.gcube.application.cms.plugins.faults.PluginExecutionException;
import org.gcube.application.cms.plugins.requests.IndexDocumentRequest;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.document.identification.IdentificationReference;
import org.gcube.application.geoportal.common.model.document.identification.TemporalReference;
import java.util.ArrayList;
import java.util.List;
@Getter
@Setter

View File

@ -1,6 +1,5 @@
package org.gcube.application.cms.plugins.reports;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

View File

@ -1,7 +1,10 @@
package org.gcube.application.cms.plugins.reports;
import com.fasterxml.jackson.core.JsonProcessingException;
import lombok.*;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
import org.gcube.application.cms.plugins.faults.InvalidPluginRequestException;
import org.gcube.application.cms.plugins.faults.PluginExecutionException;
import org.gcube.application.cms.plugins.requests.EventExecutionRequest;

View File

@ -1,7 +1,9 @@
package org.gcube.application.cms.plugins.requests;
import lombok.*;
import org.bson.Document;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
import org.gcube.application.cms.plugins.faults.InvalidPluginRequestException;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.document.accounting.Context;

View File

@ -1,12 +1,9 @@
package org.gcube.application.cms.plugins.requests;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ser.Serializers;
import lombok.*;
import org.bson.Document;
import org.gcube.application.cms.plugins.faults.InvalidPluginRequestException;
import org.gcube.application.cms.serialization.Serialization;
import org.gcube.application.geoportal.common.faults.InvalidRequestException;
import org.gcube.application.geoportal.common.model.document.accounting.Context;
import org.gcube.application.geoportal.common.model.document.accounting.User;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;

View File

@ -1,6 +1,9 @@
package org.gcube.application.cms.plugins.requests;
import lombok.*;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.document.accounting.Context;
import org.gcube.application.geoportal.common.model.document.accounting.User;

View File

@ -1,6 +1,9 @@
package org.gcube.application.cms.plugins.requests;
import lombok.*;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.document.accounting.Context;
import org.gcube.application.geoportal.common.model.document.accounting.User;

View File

@ -1,11 +1,5 @@
package org.gcube.application.cms.plugins;
import com.sun.org.apache.xpath.internal.axes.BasicTestIterator;
import org.gcube.application.cms.plugins.implementations.SimpleLifeCycleManager;
import org.gcube.application.cms.plugins.requests.EventExecutionRequest;
import org.gcube.application.cms.plugins.requests.StepExecutionRequest;
import org.gcube.application.geoportal.common.model.document.Project;
public class SimpleLifecycleTests{
// NB cannot use test commons, need to separate modules

View File

@ -0,0 +1,9 @@
package org.gcube.application.cms.tests;
import java.io.File;
public class Tests {
public static File BASE_FOLDER =new File("../test-data");
public static File FOLDER_CONCESSIONI =new File("../test-data/concessioni");
}

View File

@ -2,7 +2,6 @@ package org.gcube.application.cms.tests.model;
import com.vdurmont.semver4j.Semver;
import org.bson.Document;
import org.bson.types.ObjectId;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.document.access.Access;
import org.gcube.application.geoportal.common.model.document.access.AccessPolicy;
@ -16,7 +15,6 @@ import org.gcube.application.geoportal.common.model.useCaseDescriptor.DataAccess
import org.gcube.application.geoportal.common.model.useCaseDescriptor.HandlerDeclaration;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
import javax.jws.soap.SOAPBinding;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.UUID;

View File

@ -6,12 +6,11 @@ import org.gcube.application.cms.plugins.LifecycleManager;
import org.gcube.application.cms.plugins.MaterializationPlugin;
import org.gcube.application.cms.plugins.PluginManagerInterface;
import org.gcube.application.cms.plugins.faults.*;
import org.gcube.application.cms.plugins.model.ComparableVersion;
import org.gcube.application.geoportal.common.model.plugins.PluginDescriptor;
import org.gcube.application.cms.plugins.reports.*;
import org.gcube.application.cms.plugins.requests.*;
import org.gcube.application.geoportal.common.model.configuration.Configuration;
import org.gcube.application.geoportal.common.model.configuration.Index;
import org.gcube.application.geoportal.common.model.plugins.PluginDescriptor;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
public class DummyPlugin implements LifecycleManager, IndexerPluginInterface, MaterializationPlugin {

View File

@ -1,29 +0,0 @@
package org.gcube.application.cms.tests.model.concessioni;
import org.gcube.application.geoportal.common.utils.Files;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.HashMap;
public class TestConcessioniFilters {
public static final HashMap<String,String> filters=new HashMap<>();
static{
for(File f:new File(TestConcessioniModel.getBaseFolder(),"filters").listFiles()){
try {
filters.put(f.getName(), Files.readFileAsString(f.getAbsolutePath(), Charset.defaultCharset()));
} catch (IOException e) {
throw new RuntimeException("Unable to read "+f.getAbsolutePath(),e);
}
}
}
}

View File

@ -1,135 +0,0 @@
package org.gcube.application.cms.tests.model.concessioni;
import java.io.File;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import org.bson.types.ObjectId;
import org.gcube.application.geoportal.common.model.legacy.*;
public class TestConcessioniModel {
public static File getBaseFolder(){
File toReturn =new File("../test-data/concessioni");
if(!toReturn.exists()) toReturn = new File("test-data/concessioni");
if(!toReturn.exists()) throw new RuntimeException("Unable to find test data");
return toReturn;
}
public static Concessione prepareEmptyConcessione() {
Concessione concessione=new Concessione();
// Generic fields
// Concessione fields
concessione.setNome("MONGO Italia, forse, ma su ");
concessione.setIntroduzione("This is my MONGO project");
concessione.setDescrizioneContenuto("It contains this and that");
concessione.setAuthors(Arrays.asList(new String[] {"Some one","Some, oneelse"}));
concessione.setContributore("Contrib 1");
concessione.setTitolari(Arrays.asList(new String[] {"Some one","Some, oneelse"}));
concessione.setResponsabile("Someone");
concessione.setEditore("Editore");
concessione.setFontiFinanziamento(Arrays.asList(new String[] {"Big pharma","Pentagon"}));
concessione.setSoggetto(Arrays.asList(new String[] {"Research Excavation","Archeology"}));
concessione.setDataInizioProgetto(LocalDateTime.now());
concessione.setDataFineProgetto(LocalDateTime.now());
concessione.setLicenzaID("CC-BY");
concessione.setTitolareLicenza(Arrays.asList(new String[] {"Qualcun altro"}));
concessione.setTitolareCopyright(Arrays.asList(new String[] {"Chiedilo in giro"}));
concessione.setParoleChiaveLibere(Arrays.asList(new String[] {"Robba","Stuff"}));
concessione.setParoleChiaveICCD(Arrays.asList(new String[] {"vattelapesca","somthing something"}));
// concessione.setCentroidLat(43.0); //N-S
// concessione.setCentroidLong(9.0); //E-W
//
return concessione;
}
public static final Concessione setIds(Concessione c) {
// c.setMongo_id(rnd());
c.getRelazioneScavo().setMongo_id(rnd());
c.getPosizionamentoScavo().setMongo_id(rnd());
c.getPianteFineScavo().forEach((LayerConcessione l)->{l.setMongo_id(rnd());});
c.getImmaginiRappresentative().forEach((UploadedImage i)->{i.setMongo_id(rnd());});
return c;
}
public static final String rnd() {
return new ObjectId().toHexString();
}
public static Concessione prepareConcessione() {
return prepareConcessione(4,2);
}
public static Concessione prepareConcessione(int pianteCount ,int imgsCount) {
Concessione concessione=prepareEmptyConcessione();
// Attachments
// Relazione scavo
RelazioneScavo relScavo=new RelazioneScavo();
relScavo.setResponsabili(concessione.getAuthors());
concessione.setRelazioneScavo(relScavo);
//Abstract
AbstractRelazione abstractRelazione=new AbstractRelazione();
abstractRelazione.setAbstractIta("Il mio abstract");
abstractRelazione.setAbstractEng("My abstract");
concessione.setAbstractRelazione(abstractRelazione);
//Immagini rappresentative
ArrayList<UploadedImage> imgs=new ArrayList<>();
for(int i=0;i<imgsCount;i++) {
UploadedImage img=new UploadedImage();
img.setTitolo("My image number "+i);
img.setDidascalia("You can see my image number "+i);
img.setFormat("TIFF");
img.setCreationTime(LocalDateTime.now());
img.setResponsabili(concessione.getAuthors());
imgs.add(img);
}
concessione.setImmaginiRappresentative(imgs);
//Posizionamento
LayerConcessione posizionamento=new LayerConcessione();
posizionamento.setValutazioneQualita("Secondo me si");
posizionamento.setMetodoRaccoltaDati("Fattobbene");
posizionamento.setScalaAcquisizione("1:10000");
posizionamento.setAuthors(concessione.getAuthors());
concessione.setPosizionamentoScavo(posizionamento);
// Piante fine scavo
ArrayList<LayerConcessione> piante=new ArrayList<LayerConcessione>();
for(int i=0;i<pianteCount;i++) {
LayerConcessione pianta=new LayerConcessione();
pianta.setValutazioneQualita("Secondo me si");
pianta.setMetodoRaccoltaDati("Fattobbene");
pianta.setScalaAcquisizione("1:10000");
pianta.setAuthors(concessione.getAuthors());
pianta.setPolicy(AccessPolicy.RESTRICTED);
piante.add(pianta);
}
concessione.setPianteFineScavo(piante);
return concessione;
}
}

View File

@ -1,24 +0,0 @@
package org.gcube.application.cms.tests.model.concessioni;
import org.gcube.application.geoportal.common.utils.Files;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.HashMap;
public class TestConcessioniQueries {
public static final HashMap<String,String> queries =new HashMap<>();
static{
for(File f:new File(TestConcessioniModel.getBaseFolder(),"queries").listFiles()){
try {
queries.put(f.getName(), Files.readFileAsString(f.getAbsolutePath(), Charset.defaultCharset()));
} catch (IOException e) {
throw new RuntimeException("Unable to read "+f.getAbsolutePath(),e);
}
}
}
}

View File

@ -1,25 +0,0 @@
package org.gcube.application.cms.commons.model.concessioni;
import org.gcube.application.cms.tests.model.concessioni.TestConcessioniFilters;
import org.gcube.application.cms.tests.model.concessioni.TestConcessioniModel;
import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
public class Models {
@Test
public void checkFilters(){
assertTrue(TestConcessioniFilters.filters.size()>0);
TestConcessioniFilters.filters.keySet().forEach(f -> {
System.out.println(f);});
}
@Test
public void checkConcessione(){
Concessione c= TestConcessioniModel.prepareConcessione(3,5);
assertTrue(c.getPianteFineScavo().size()==3);
assertTrue(c.getImmaginiRappresentative().size()==5);
}
}

View File

@ -1,67 +0,0 @@
package org.gcube.application.cms.commons.model.concessioni;
import static org.junit.Assert.assertEquals;
import org.gcube.application.cms.tests.model.concessioni.TestConcessioniModel;
import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.gcube.application.geoportal.common.model.legacy.Concessione.Paths;
import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
import org.gcube.application.geoportal.common.model.legacy.RelazioneScavo;
import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
import org.junit.Assert;
import org.junit.Test;
public class PathsTest {
@Test
public void embeddedPaths() {
Concessione c= TestConcessioniModel.prepareConcessione();
c= TestConcessioniModel.setIds(c);
LayerConcessione p=(LayerConcessione) c.getContentByPath(Paths.POSIZIONAMENTO);
Assert.assertEquals(c.getPosizionamentoScavo(), p);
RelazioneScavo rel=(RelazioneScavo) c.getContentByPath(Paths.RELAZIONE);
Assert.assertEquals(c.getRelazioneScavo(), rel);
for(int i=0;i<c.getPianteFineScavo().size();i++) {
LayerConcessione l=(LayerConcessione) c.getContentByPath(Paths.piantaByIndex(i));
Assert.assertEquals(c.getPianteFineScavo().get(i),l);
}
for(int i=0;i<c.getImmaginiRappresentative().size();i++) {
UploadedImage l=(UploadedImage) c.getContentByPath(Paths.imgByIndex(i));
Assert.assertEquals(c.getImmaginiRappresentative().get(i),l);
}
for(int i=0;i<c.getPianteFineScavo().size();i++) {
LayerConcessione layer=c.getPianteFineScavo().get(i);
LayerConcessione l=(LayerConcessione) c.getContentByPath(Paths.piantaById(layer.getMongo_id()));
Assert.assertEquals(layer,l);
}
for(int i=0;i<c.getImmaginiRappresentative().size();i++) {
UploadedImage layer=c.getImmaginiRappresentative().get(i);
UploadedImage l=(UploadedImage) c.getContentByPath(Paths.imgById(layer.getMongo_id()));
Assert.assertEquals(layer,l);
}
System.out.println();
System.out.println();
}
}

View File

@ -1,72 +0,0 @@
package org.gcube.application.cms.commons.model.concessioni;
import java.io.File;
import java.io.IOException;
import org.gcube.application.cms.tests.model.concessioni.TestConcessioniModel;
import org.gcube.application.geoportal.common.model.legacy.AccessPolicy;
import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.junit.Test;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import static org.junit.Assert.assertEquals;
public class SerializationTest {
private static ObjectMapper mapper = new ObjectMapper();
static {
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,false);
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS,false);
mapper.configure(SerializationFeature.WRITE_EMPTY_JSON_ARRAYS, false);
mapper.setSerializationInclusion(Include.NON_NULL);
// mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
mapper.registerModule(new JavaTimeModule());
}
// @Test
// public void readProfile() throws JsonProcessingException, IOException {
//
// UseCaseDescriptor concessione=mapper.readerFor(UseCaseDescriptor.class).readValue(new File(TestConcessioniModel.getBaseFolder(),"ProfileConcessioni.json"));
//
// System.out.println("UseCaseDescriptor is "+mapper.writeValueAsString(concessione));
//
// //Assert.assertTrue(concessione .getFields().size()>0);
//
// }
@Test
public void readConcessione() throws JsonProcessingException, IOException {
Concessione concessione=mapper.readerFor(Concessione.class).readValue(new File(TestConcessioniModel.getBaseFolder(),"Concessione.json"));
System.out.println("Concessione is "+concessione.toString());
concessione.getRelazioneScavo().setPolicy(AccessPolicy.EMBARGOED);
assertEquals(AccessPolicy.EMBARGOED,concessione.getRelazioneScavo().getPolicy());
concessione=mapper.readerFor(Concessione.class).readValue(mapper.writeValueAsString(concessione));
assertEquals(AccessPolicy.EMBARGOED,concessione.getRelazioneScavo().getPolicy());
}
@Test
public void generic() throws JsonProcessingException, IOException {
Concessione conc= TestConcessioniModel.prepareConcessione();
conc.validate();
full(conc);
}
public void full(Object obj) throws JsonProcessingException, IOException {
String asString=mapper.writeValueAsString(obj);
Object other=mapper.readerFor(obj.getClass()).readValue(asString);
}
}

View File

@ -47,6 +47,13 @@
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-ri</artifactId>
<version>2.3.2</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>common-jaxrs-client</artifactId>

View File

@ -108,7 +108,11 @@
<artifactId>registry-publisher</artifactId>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<!-- <version>2.3.0</version>-->
</dependency>
</dependencies>
</project>

View File

@ -153,6 +153,19 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.gcube.data.transfer</groupId>
<artifactId>data-transfer-library</artifactId>
<version>1.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -1,7 +1,6 @@
package org.gcube.application.geoportal.service;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.implementations.ImplementationProvider;
@Slf4j

View File

@ -9,10 +9,10 @@ import com.mongodb.client.model.ReturnDocument;
import lombok.extern.slf4j.Slf4j;
import org.bson.Document;
import org.bson.types.ObjectId;
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.geoportal.service.model.internal.db.Mongo;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportal.service.model.internal.db.Mongo;
import static com.mongodb.client.model.Filters.eq;
import static com.mongodb.client.model.Sorts.ascending;

View File

@ -8,9 +8,9 @@ import org.gcube.application.cms.plugins.faults.StepException;
import org.gcube.application.geoportal.common.faults.StorageException;
import org.gcube.application.geoportal.common.model.configuration.Configuration;
import org.gcube.application.geoportal.common.model.document.access.Access;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.service.model.internal.faults.*;
import org.gcube.common.storagehub.model.exceptions.StorageHubException;

View File

@ -11,22 +11,26 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.bson.Document;
import org.bson.types.ObjectId;
import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.cms.implementations.WorkspaceManager;
import org.gcube.application.cms.plugins.LifecycleManager;
import org.gcube.application.cms.plugins.faults.EventException;
import org.gcube.application.cms.plugins.faults.InsufficientPrivileges;
import org.gcube.application.cms.plugins.faults.StepException;
import org.gcube.application.cms.plugins.faults.UnrecognizedStepException;
import org.gcube.application.geoportal.common.model.document.relationships.Relationship;
import org.gcube.application.geoportal.common.model.plugins.LifecycleManagerDescriptor;
import org.gcube.application.cms.plugins.reports.DocumentHandlingReport;
import org.gcube.application.cms.plugins.reports.StepExecutionReport;
import org.gcube.application.cms.plugins.requests.BaseRequest;
import org.gcube.application.cms.plugins.requests.EventExecutionRequest;
import org.gcube.application.cms.plugins.requests.StepExecutionRequest;
import org.gcube.application.cms.serialization.Serialization;
import org.gcube.application.geoportal.common.faults.StorageException;
import org.gcube.application.geoportal.common.model.JSONPathWrapper;
import org.gcube.application.geoportal.common.model.configuration.Archive;
import org.gcube.application.geoportal.common.model.configuration.Configuration;
import org.gcube.application.geoportal.common.model.configuration.Index;
import org.gcube.application.geoportal.common.model.document.*;
import org.gcube.application.geoportal.common.model.document.Lock;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.document.access.Access;
import org.gcube.application.geoportal.common.model.document.access.AccessPolicy;
import org.gcube.application.geoportal.common.model.document.accounting.AccountingInfo;
@ -35,23 +39,20 @@ import org.gcube.application.geoportal.common.model.document.accounting.User;
import org.gcube.application.geoportal.common.model.document.filesets.RegisteredFile;
import org.gcube.application.geoportal.common.model.document.filesets.RegisteredFileSet;
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation;
import org.gcube.application.geoportal.common.model.document.relationships.Relationship;
import org.gcube.application.geoportal.common.model.plugins.LifecycleManagerDescriptor;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
import org.gcube.application.geoportal.common.model.rest.TempFile;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.DataAccessPolicy;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.Field;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.HandlerDeclaration;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
import org.gcube.application.geoportal.common.model.configuration.Configuration;
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
import org.gcube.application.geoportal.common.model.rest.TempFile;
import org.gcube.application.geoportal.common.model.JSONPathWrapper;
import org.gcube.application.geoportal.common.utils.ContextUtils;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.cms.implementations.WorkspaceManager;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.service.engine.providers.PluginManager;
import org.gcube.application.geoportal.service.model.internal.faults.*;
import org.gcube.application.cms.serialization.Serialization;
import org.gcube.application.geoportal.service.utils.UserUtils;
import org.gcube.common.storagehub.client.dsl.FolderContainer;
import org.gcube.common.storagehub.model.exceptions.StorageHubException;
@ -68,7 +69,8 @@ import java.util.concurrent.LinkedBlockingQueue;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import static org.gcube.application.cms.serialization.Serialization.*;
import static org.gcube.application.cms.serialization.Serialization.asDocumentWithId;
import static org.gcube.application.cms.serialization.Serialization.convert;
@Slf4j
public class ProfiledMongoManager extends MongoManager implements MongoManagerI<Project>{

View File

@ -1,9 +1,8 @@
package org.gcube.application.geoportal.service.engine.mongo;
import org.bson.Document;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
import org.gcube.application.geoportal.service.model.internal.faults.RegistrationException;
public interface UCDManagerI {

View File

@ -8,9 +8,9 @@ import lombok.extern.slf4j.Slf4j;
import org.bson.Document;
import org.bson.types.ObjectId;
import org.gcube.application.cms.serialization.Serialization;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
import org.gcube.application.geoportal.common.utils.ContextUtils;
import org.gcube.application.geoportal.service.model.internal.faults.RegistrationException;

View File

@ -1,21 +1,16 @@
package org.gcube.application.geoportal.service.engine.providers;
import jdk.nashorn.internal.runtime.regexp.joni.Config;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.caches.AbstractScopedMap;
import org.gcube.application.cms.caches.Cache;
import org.gcube.application.cms.caches.TimedMap;
import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.geoportal.common.model.configuration.Configuration;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.service.engine.mongo.ProfiledMongoManager;
import org.gcube.application.geoportal.service.model.internal.faults.RegistrationException;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAmount;
import java.time.temporal.TemporalUnit;
@Slf4j
public class ConfigurationCache extends AbstractScopedMap<ConfigurationCache.ConfigurationMap> {

View File

@ -3,11 +3,11 @@ package org.gcube.application.geoportal.service.engine.providers;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.caches.AbstractScopedMap;
import org.gcube.application.cms.implementations.ISInterface;
import org.gcube.application.geoportal.service.ServiceConstants;
import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.geoportal.service.model.internal.db.Mongo;
import org.gcube.application.geoportal.common.model.configuration.MongoConnection;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.service.ServiceConstants;
import org.gcube.application.geoportal.service.model.internal.db.Mongo;
import org.gcube.common.resources.gcore.ServiceEndpoint;
import java.util.List;

View File

@ -7,7 +7,6 @@ import org.gcube.application.cms.plugins.faults.InitializationException;
import org.gcube.application.cms.plugins.faults.PluginExecutionException;
import org.gcube.application.cms.plugins.faults.ShutDownException;
import org.gcube.application.cms.plugins.reports.InitializationReport;
import org.gcube.application.geoportal.common.utils.ContextUtils;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import java.util.HashMap;

View File

@ -1,10 +1,9 @@
package org.gcube.application.geoportal.service.engine.providers;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.caches.AbstractScopedMap;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.common.utils.StorageUtils;
@Slf4j
public class StorageClientProvider extends AbstractScopedMap<StorageUtils> {

View File

@ -1,16 +1,14 @@
package org.gcube.application.geoportal.service.engine.providers.ucd;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.mongodb.util.JSON;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.caches.AbstractScopedMap;
import org.gcube.application.cms.serialization.Serialization;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
import org.gcube.application.geoportal.common.utils.Files;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.cms.serialization.Serialization;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.nio.charset.Charset;

View File

@ -6,11 +6,11 @@ import org.gcube.application.cms.caches.AbstractScopedMap;
import org.gcube.application.cms.caches.ObjectManager;
import org.gcube.application.cms.implementations.ISInterface;
import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.cms.implementations.WorkspaceManager;
import org.gcube.application.cms.serialization.Serialization;
import org.gcube.application.geoportal.common.model.document.filesets.RegisteredFile;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
import org.gcube.application.cms.implementations.WorkspaceManager;
import org.gcube.common.resources.gcore.GenericResource;
import org.gcube.common.storagehub.client.dsl.FolderContainer;

View File

@ -3,7 +3,6 @@ package org.gcube.application.geoportal.service.rest;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.plugins.faults.InsufficientPrivileges;
import org.gcube.application.cms.plugins.faults.UnrecognizedStepException;
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.service.model.internal.faults.InvalidLockException;
import org.gcube.application.geoportal.service.model.internal.faults.InvalidUserRoleException;

View File

@ -5,18 +5,18 @@ import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
import lombok.extern.slf4j.Slf4j;
import org.bson.Document;
import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.cms.serialization.Serialization;
import org.gcube.application.geoportal.common.model.configuration.Configuration;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.document.access.Access;
import org.gcube.application.geoportal.common.model.document.relationships.Relationship;
import org.gcube.application.geoportal.common.model.document.relationships.RelationshipNavigationObject;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportal.common.rest.InterfaceConstants;
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.service.engine.mongo.ProfiledMongoManager;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.cms.serialization.Serialization;
import org.gcube.application.geoportal.service.engine.providers.ConfigurationCache;
import javax.ws.rs.*;

View File

@ -13,7 +13,10 @@ import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.scope.api.ScopeProvider;
import java.time.LocalDateTime;
import java.util.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@Slf4j
public class UserUtils {

View File

@ -1,29 +1,24 @@
package org.gcube.application.geoportal.service;
import com.fasterxml.jackson.databind.cfg.ContextAttributes;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.caches.Engine;
import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.cms.serialization.Serialization;
import org.gcube.application.cms.tests.TestProfiles;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.gcube.application.geoportal.service.engine.providers.ucd.LocalFolderProfileMapCache;
import org.gcube.application.geoportal.service.engine.providers.ucd.ProfileMap;
import org.gcube.application.geoportal.service.rest.GuardedMethod;
import org.gcube.application.cms.serialization.Serialization;
import org.glassfish.jersey.test.JerseyTest;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.opengis.annotation.Profile;
import javax.ws.rs.core.Application;
import javax.ws.rs.core.Response;
import java.util.Collections;
import java.util.Map;
import static org.junit.Assume.assumeTrue;
@Slf4j
public class BasicServiceTestUnit extends JerseyTest {

View File

@ -5,11 +5,8 @@ import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.gcube.application.geoportal.service.profiledDocuments.AbstractProfiledDocumentsTests;
import org.junit.Test;
import javax.ws.rs.InternalServerErrorException;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Response;
import java.util.UUID;
import static org.junit.Assert.assertEquals;

View File

@ -1,10 +1,10 @@
package org.gcube.application.geoportal.service;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.geoportal.service.engine.providers.StorageClientProvider;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.geoportal.service.engine.providers.StorageClientProvider;
import java.io.IOException;

View File

@ -3,10 +3,7 @@ package org.gcube.application.geoportal.service;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.serialization.Serialization;
import org.gcube.application.cms.tests.TestProfiles;
import org.gcube.application.cms.tests.TestSchemas;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.cms.tests.model.BasicTests;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
import org.gcube.application.geoportal.common.rest.InterfaceConstants;
@ -17,7 +14,6 @@ import org.junit.Test;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import java.util.Iterator;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicLong;

View File

@ -3,8 +3,8 @@ package org.gcube.application.geoportal.service.engine.caches;
import com.mongodb.MongoWaitQueueFullException;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.cms.tests.Tests;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.cms.tests.model.concessioni.TestConcessioniModel;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
@ -113,7 +113,7 @@ public class Caches extends BasicServiceTestUnit {
final StorageUtils storage=ImplementationProvider.get().getProvidedObjectByClass(StorageUtils.class);
String id =storage.putOntoStorage(new File(TestConcessioniModel.getBaseFolder(),"relazione.pdf"))[0].getId();
String id =storage.putOntoStorage(new File(Tests.FOLDER_CONCESSIONI,"relazione.pdf"))[0].getId();
//for 100 secs
while(Duration.between(start,LocalDateTime.now()).

View File

@ -4,13 +4,12 @@ import org.bson.Document;
import org.gcube.application.cms.plugins.faults.EventException;
import org.gcube.application.cms.plugins.faults.InsufficientPrivileges;
import org.gcube.application.cms.plugins.faults.StepException;
import org.gcube.application.cms.tests.Tests;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.cms.tests.model.concessioni.TestConcessioniModel;
import org.gcube.application.geoportal.common.faults.StorageException;
import org.gcube.application.geoportal.common.model.document.Lock;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.Field;
import org.gcube.application.geoportal.common.utils.FileSets;
import org.gcube.application.geoportal.common.utils.StorageUtils;
@ -19,7 +18,6 @@ import org.gcube.application.geoportal.service.BasicServiceTestUnit;
import org.gcube.application.geoportal.service.model.internal.faults.*;
import org.gcube.application.geoportal.service.utils.UserUtils;
import org.gcube.common.storagehub.model.exceptions.StorageHubException;
import org.geotoolkit.referencing.operation.provider.PolarStereographic;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@ -105,7 +103,7 @@ public class LockTests extends BasicServiceTestUnit {
"$.relazioneScavo","fileset","relazioneScavo."+ Field.CHILDREN+"[?(@.fileset)]");
StorageUtils s= new StorageUtils();
builder.add(
s.putOntoStorage(new File(TestConcessioniModel.getBaseFolder(),"pos.shp"),"pos.shp"));
s.putOntoStorage(new File(Tests.FOLDER_CONCESSIONI,"pos.shp"),"pos.shp"));
p= managerInterface.registerFileSet(p.getId(),builder.getTheRequest());
checkIsLockCleaned(p.getId());

View File

@ -1,12 +1,9 @@
package org.gcube.application.geoportal.service.engine.mongo;
import com.mongodb.client.model.Projections;
import org.bson.BsonType;
import org.bson.Document;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.junit.Test;
import static com.mongodb.client.model.Filters.exists;
import static com.mongodb.client.model.Filters.type;
public class ManagementUseCases extends MongoTests {

View File

@ -1,7 +1,6 @@
package org.gcube.application.geoportal.service.engine.mongo;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.service.model.internal.db.Mongo;
public class MongoTester extends MongoManager {

View File

@ -4,12 +4,12 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.mongodb.Block;
import com.mongodb.client.model.Projections;
import org.bson.Document;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.gcube.application.geoportal.service.engine.providers.MongoClientProvider;
import org.gcube.application.geoportal.service.model.internal.db.Mongo;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.junit.BeforeClass;
import org.junit.Test;

View File

@ -1,6 +1,5 @@
package org.gcube.application.geoportal.service.engine.profiles;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.bson.Document;
import org.gcube.application.cms.serialization.Serialization;
import org.gcube.application.cms.tests.TokenSetter;
@ -9,7 +8,6 @@ import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDes
import org.gcube.application.geoportal.common.rest.InterfaceConstants;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.gcube.application.geoportal.service.BasicServiceTestUnit;
import org.gcube.common.storagehub.model.query.Queries;
import org.junit.Before;
import org.junit.Test;

View File

@ -1,424 +0,0 @@
package org.gcube.application.geoportal.service.legacy;
import org.bson.Document;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.cms.tests.model.concessioni.TestConcessioniFilters;
import org.gcube.application.cms.tests.model.concessioni.TestConcessioniModel;
import org.gcube.application.cms.tests.model.concessioni.TestConcessioniQueries;
import org.gcube.application.geoportal.common.model.legacy.AccessPolicy;
import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.gcube.application.geoportal.common.model.legacy.Concessione.Paths;
import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
import org.gcube.application.geoportal.common.model.legacy.report.ValidationReport.ValidationStatus;
import org.gcube.application.geoportal.common.model.rest.AddSectionToConcessioneRequest;
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportal.common.rest.InterfaceConstants;
import org.gcube.application.geoportal.common.utils.FileSets;
import org.gcube.application.geoportal.common.utils.Files;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.cms.serialization.Serialization;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.gcube.application.geoportal.service.BasicServiceTestUnit;
import org.geotoolkit.referencing.operation.provider.PolarStereographic;
import org.json.JSONObject;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
import static org.junit.Assert.*;
import static org.junit.Assume.assumeTrue;
public class ConcessioniOverMongoTest extends BasicServiceTestUnit {
private static final String PATH=InterfaceConstants.Methods.MONGO_CONCESSIONI;
private static final String PUBLISH_PATH=InterfaceConstants.Methods.PUBLISH_PATH;
private static final String FILES_PATH=InterfaceConstants.Methods.REGISTER_FILES_PATH;
@Before
public void setContext(){
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
TokenSetter.set(GCubeTest.getContext());
}
//Used for local test data
private static Concessione upload(StorageUtils storage, WebTarget target,String id, String path, String ...files) throws Exception {
AddSectionToConcessioneRequest request = new AddSectionToConcessioneRequest();
request.setDestinationPath(path);
request.setStreams(new ArrayList<>());
for(String file:files)
request.getStreams()
.add(storage.putOntoStorage(new File(TestConcessioniModel.getBaseFolder(),file),file));
return check(target.path(FILES_PATH).path(id).request(MediaType.APPLICATION_JSON).
post(Entity.entity(Serialization.write(request),
MediaType.APPLICATION_JSON)),Concessione.class);
}
//generic
private static Concessione upload(StorageUtils storage, WebTarget target,String id, String path, File ...files) throws Exception {
AddSectionToConcessioneRequest request = new AddSectionToConcessioneRequest();
request.setDestinationPath(path);
request.setStreams(new ArrayList<>());
for(File file:files)
request.getStreams().add(storage.putOntoStorage(file,file.getName()));
return check(target.path(FILES_PATH).path(id).request(MediaType.APPLICATION_JSON).
post(Entity.entity(Serialization.write(request),
MediaType.APPLICATION_JSON)),Concessione.class);
}
private static Concessione update(Concessione c, WebTarget target) throws Exception {
return check(target.path(c.getMongo_id()).request(MediaType.APPLICATION_JSON).
put(Entity.entity(Serialization.write(c),
MediaType.APPLICATION_JSON)),Concessione.class);
}
private static Concessione publish(WebTarget target, String id) throws Exception {
Response resp=target.path(PUBLISH_PATH).path(id).request(MediaType.APPLICATION_JSON).
put(Entity.entity(Serialization.write(id), MediaType.APPLICATION_JSON));
return check(resp,Concessione.class);
}
private static Concessione unpublish(WebTarget target, String id) throws Exception {
Response resp=target.path(PUBLISH_PATH).path(id).request(MediaType.APPLICATION_JSON).
delete();
return check(resp,Concessione.class);
}
private static Concessione register(WebTarget target, Concessione c) throws Exception {
Response resp=target.request(MediaType.APPLICATION_JSON).post(Entity.entity(Serialization.write(c), MediaType.APPLICATION_JSON));
return check(resp,Concessione.class);
}
private static Concessione get(WebTarget target) throws Exception {
return register(target, TestConcessioniModel.prepareConcessione());
}
private static Concessione getById(WebTarget target ,String id) throws Exception {
return check(target.path(id).request(MediaType.APPLICATION_JSON).get(),Concessione.class);
}
private static Iterator<Concessione> search(String query, WebTarget target) throws Exception {
String result= check(target.path(InterfaceConstants.Methods.SEARCH_PATH).request(MediaType.APPLICATION_JSON_TYPE).post(
Entity.entity(query,MediaType.APPLICATION_JSON)),String.class);
return Serialization.readCollection(result,Concessione.class);
}
private static <T> Iterator<T> queryFile(String filename, WebTarget target, Class<T> clazz) throws Exception {
QueryRequest req= Serialization.parseQuery(TestConcessioniQueries.queries.get(filename));
String result = check(target.path(InterfaceConstants.Methods.QUERY_PATH).request(MediaType.APPLICATION_JSON_TYPE).post(
Entity.entity(Serialization.write(req),MediaType.APPLICATION_JSON)),String.class);
return Serialization.readCollection(result,clazz);
}
private static Iterator<Concessione> queryFile(String filename, WebTarget target) throws Exception {
return queryFile(filename,target,Concessione.class);
}
// ********** TESTS
@Test
public void list() {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
WebTarget target=target(PATH);
System.out.println(target.request(MediaType.APPLICATION_JSON).get(List.class));
}
@Test
public void search() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
WebTarget target=target(PATH);
AtomicLong validatedCount= new AtomicLong(0);
Iterator<Concessione> it=search(TestConcessioniFilters.filters.get("validated.json"),target);
it.forEachRemaining(concessione -> {validatedCount.incrementAndGet();});
System.out.println("Validated : "+ validatedCount.get());
}
@Test
public void query() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
WebTarget target=target(PATH);
Iterator<Concessione> it;
assertEquals(1, count( queryFile("lastRegistered.json", target)));
assertEquals(0, count( queryFile("emptyresult.json",target)));
it=queryFile("firstRegistered.json", target);
assertEquals(1, count(it));
System.out.println("Last Names by Fabio : ");
queryFile("lastNameRegisteredByFabio.json", target, JSONObject.class).forEachRemaining(c -> {System.out.println(c);});
System.out.println("Publication warning messages : ");
queryFile("publicationWarningMessages.json", target, JSONObject.class).forEachRemaining(c -> {System.out.println(c);});
}
@Test
public void getConfiguration() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
WebTarget target=target(PATH);
System.out.println(check(target.path(InterfaceConstants.Methods.CONFIGURATION_PATH).request(MediaType.APPLICATION_JSON).get(),String.class));
}
@Test
public void createNew() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
WebTarget target=target(PATH);
Concessione c=register(target,TestConcessioniModel.prepareConcessione());
Assert.assertTrue(c.getMongo_id()!=null&&!c.getMongo_id().isEmpty());
}
@Test
public void delete() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
WebTarget target=target(PATH);
Concessione c = get(target);
check(target.path(c.getMongo_id()).request(MediaType.APPLICATION_JSON).delete(),null);
Concessione published=getFullPublished(target);
check(target.path(published.getMongo_id()).request(MediaType.APPLICATION_JSON).delete(),null);
}
@Test
public void republish() throws Exception{
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
WebTarget target=target(PATH);
Concessione published=getFullPublished(target);
//Concessione published=getById(target,"6155ba6002ad3d2c23b72b5a");
published = unpublish(target,published.getMongo_id());
System.out.println("Republishing..");
published=publish(target,published.getMongo_id());
Assert.assertEquals(published.getReport().getStatus(),ValidationStatus.PASSED);
}
@Test
public void handlePrecise() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
//Republishing
WebTarget target=target(PATH);
//String id="61e6d5212f7b172ac9874879";
// Query & delete
QueryRequest req = new QueryRequest();
// req.setFilter(Document.parse("{ \"report.objectName\" : { \"$eq\" : \"Unpublish report\" },\n" +
// " \"report.status\" : { \"$eq\" : \"PASSED\" } }"));
req.setFilter(Document.parse("{ \"creationUser\" : { \"$eq\" : \"francesco.mangiacrapa\" }}"));
Iterator<Concessione> it= Serialization.readCollection(check(target.path(InterfaceConstants.Methods.QUERY_PATH).request(MediaType.APPLICATION_JSON_TYPE).post(
Entity.entity(Serialization.write(req),MediaType.APPLICATION_JSON)),String.class),Concessione.class);
AtomicLong totCount=new AtomicLong(0);
List<String> errMessages=new ArrayList<>();
it.forEachRemaining(c->{
try {
totCount.incrementAndGet();
check(target.path(c.getMongo_id()).
queryParam(InterfaceConstants.Parameters.FORCE,false).request(MediaType.APPLICATION_JSON).delete(),String.class);
} catch (Exception e) {
errMessages.add("ERROR with "+c.getMongo_id()+" folder : "+c.getFolderId()+" author : "+c.getCreationUser()+". Message : "+e.getMessage());
}
});
System.out.println(errMessages.size()+" errors out of "+totCount.get()+" found items");
errMessages.forEach(s -> { System.err.println(s); });
//publish(target,unpublish(target,id).getMongo_id());
}
@Test
public void getById() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
WebTarget target=target(PATH);
Concessione c = get(target);
Response resp=target.path(c.getMongo_id()).request(MediaType.APPLICATION_JSON).get();
Concessione loaded=check(resp,Concessione.class);
Assert.assertTrue(loaded.getMongo_id()!=null&&!loaded.getMongo_id().isEmpty());
System.out.println("Got by ID "+loaded);
}
@Test
public void update() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
WebTarget target=target(PATH);
Concessione c = get(target);
String newTitle="Questo titolo l'ho modificato mo nel test quello proprio apposta pewr questa cosa'";
c.setNome(newTitle);
Response resp=target.request(MediaType.APPLICATION_JSON).put(Entity.entity(Serialization.write(c), MediaType.APPLICATION_JSON));
Assert.assertTrue(check(resp,Concessione.class).getNome().equals(newTitle));
}
@Test
public void uploadFile() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
WebTarget target=target(PATH);
Response resp=target.request(MediaType.APPLICATION_JSON).post(Entity.entity(Serialization.write(TestConcessioniModel.prepareEmptyConcessione()), MediaType.APPLICATION_JSON));
Concessione c=check(resp,Concessione.class);
Assert.assertTrue(c.getMongo_id()!=null&&!c.getMongo_id().isEmpty());
System.out.println("ID IS "+c.getMongo_id());
// Insert section
c.setRelazioneScavo(TestConcessioniModel.prepareConcessione().getRelazioneScavo());
// c.getRelazioneScavo().setMongo_id(TestConcessioniModel.rnd());
resp=target.request(MediaType.APPLICATION_JSON).put(Entity.entity(Serialization.write(c), MediaType.APPLICATION_JSON));
c=upload(new StorageUtils(),target,c.getMongo_id(),Paths.RELAZIONE,"relazione.pdf");
assertNotNull(c.getRelazioneScavo().getActualContent());
assertTrue(c.getRelazioneScavo().getActualContent().size()>0);
System.out.println("File is "+c.getRelazioneScavo().getActualContent().get(0));
}
@Test
public void testClearFileSet() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
WebTarget target=target(PATH);
Concessione published=getFullPublished(target);
String path=Paths.POSIZIONAMENTO;
Response resp=
target.path(InterfaceConstants.Methods.DELETE_FILES_PATH).path(published.getMongo_id()).
request(MediaType.APPLICATION_JSON).put(Entity.entity(path, MediaType.APPLICATION_JSON));
//Expecting error for deletion
assertTrue(resp.getStatus()>=300);
System.out.println("Error for deletion is "+resp.readEntity(String.class));
//unpublish
unpublish(target,published.getMongo_id());
//Actually cleaning posizionamento
published=check(
target.path(InterfaceConstants.Methods.DELETE_FILES_PATH).path(published.getMongo_id()).
request(MediaType.APPLICATION_JSON).post(Entity.entity(path, MediaType.APPLICATION_JSON)),Concessione.class);
assertTrue(published.getPosizionamentoScavo().getActualContent().isEmpty());
path=Paths.piantaByIndex(0);
published=check(
target.path(InterfaceConstants.Methods.DELETE_FILES_PATH).path(published.getMongo_id()).
request(MediaType.APPLICATION_JSON).post(Entity.entity(path, MediaType.APPLICATION_JSON)),Concessione.class);
assertTrue(published.getPianteFineScavo().get(0).getActualContent().isEmpty());
}
@Test
public void publish() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
WebTarget target=target(PATH);
Concessione published=getFullPublished(target);
System.out.println("Published : "+published);
System.out.println("Report is : "+published.getReport());
assertNotNull(published.getReport());
assertEquals(ValidationStatus.PASSED,published.getReport().getStatus());
assertNotNull(published.getPosizionamentoScavo().getWmsLink());
for(LayerConcessione l : published.getPianteFineScavo()) {
assertNotNull(l.getWmsLink());
}
assertNotNull(published.getCentroidLat());
assertNotNull(published.getCentroidLong());
}
private Concessione getFullPublished(WebTarget target) throws Exception {
File layerFolder=TestConcessioniModel.getBaseFolder();
Map<String, List<File>> layers = Files.getAllShapeSet(layerFolder,true);
Concessione c=TestConcessioniModel.prepareConcessione(layers.size(),1);
c.getRelazioneScavo().setPolicy(AccessPolicy.EMBARGOED);
assertEquals(AccessPolicy.EMBARGOED,c.getRelazioneScavo().getPolicy());
c.setNome("Concessione : publish test ");
StorageUtils storage=new StorageUtils();
// Register new
c=register(target,c);
assertEquals(AccessPolicy.EMBARGOED,c.getRelazioneScavo().getPolicy());
//Upload files
c=upload(storage,target,c.getMongo_id(),Paths.RELAZIONE,"relazione.pdf");
assertEquals(AccessPolicy.EMBARGOED,c.getRelazioneScavo().getPolicy());
c=upload(storage,target,c.getMongo_id(),Paths.ABSTRACT_RELAZIONE,"relazione.pdf");
String[] keys=layers.keySet().toArray(new String [0]);
c=upload(storage,target,c.getMongo_id(),Paths.POSIZIONAMENTO,
// TestConcessioniModel.getBaseFolder().list((file,name)->{return name.startsWith("pianta.shp");}));
layers.get(keys[0]).toArray(new File[0]));
assertEquals(AccessPolicy.EMBARGOED,c.getRelazioneScavo().getPolicy());
// Clash on workspaces
for(int i=0;i<c.getPianteFineScavo().size();i++) {
String key=keys[0];
String path=Paths.piantaByIndex(i);
c.getContentByPath(path).setTitolo("Pianta from "+key.replace(layerFolder.getAbsolutePath(),""));
c=update(c,target);
c=upload(storage, target, c.getMongo_id(), path,
// TestConcessioniModel.getBaseFolder().list((file,name)->{return name.startsWith("pianta.shp");}));
layers.get(key).toArray(new File[0]));
}
assertEquals(AccessPolicy.EMBARGOED,c.getRelazioneScavo().getPolicy());
// Immagini
for (int i = 0; i <c.getImmaginiRappresentative().size() ; i++) {
c=upload(storage,target,c.getMongo_id(),Paths.imgByIndex(0),"immagine"+(i+1)+".png");
}
assertEquals(AccessPolicy.EMBARGOED,c.getRelazioneScavo().getPolicy());
Concessione toReturn= publish(target, c.getMongo_id());
assertEquals(AccessPolicy.EMBARGOED,toReturn.getRelazioneScavo().getPolicy());
return toReturn;
}
public static long count(Iterator<?> iterator){
AtomicLong l=new AtomicLong(0);
iterator.forEachRemaining(el->{l.incrementAndGet();});
return l.get();
}
}

View File

@ -4,12 +4,14 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
import org.bson.Document;
import org.gcube.application.cms.serialization.Serialization;
import org.gcube.application.cms.tests.TestDocuments;
import org.gcube.application.cms.tests.Tests;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.cms.tests.model.BasicTests;
import org.gcube.application.cms.tests.model.concessioni.TestConcessioniModel;
import org.gcube.application.geoportal.common.model.configuration.Configuration;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation;
import org.gcube.application.geoportal.common.model.configuration.Configuration;
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
import org.gcube.application.geoportal.common.model.rest.StepExecutionRequest;
@ -20,7 +22,6 @@ import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.gcube.application.geoportal.service.BasicServiceTestUnit;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import javax.ws.rs.client.Entity;
@ -29,7 +30,6 @@ import javax.ws.rs.core.MediaType;
import java.io.File;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
@ -136,7 +136,7 @@ public abstract class AbstractProfiledDocumentsTests extends BasicServiceTestUni
builder.setClashPolicy(clashPolicy).setAttributes(attributes);
for(String file:files)
builder.add(storage.putOntoStorage(new File(TestConcessioniModel.getBaseFolder(),file),file));
builder.add(storage.putOntoStorage(new File(Tests.BASE_FOLDER,file),file));
Project doc = check(baseTarget().path(InterfaceConstants.Methods.REGISTER_FILES_PATH).path(id).request(MediaType.APPLICATION_JSON).
post(Entity.entity(Serialization.write(builder.getTheRequest()),

View File

@ -2,24 +2,21 @@ package org.gcube.application.geoportal.service.profiledDocuments;
import org.bson.Document;
import org.gcube.application.cms.serialization.Serialization;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.geoportal.common.model.JSONPathWrapper;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.document.filesets.RegisteredFileSet;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.Field;
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.Field;
import org.gcube.application.geoportal.common.rest.InterfaceConstants;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.gcube.application.geoportal.service.BasicServiceTestUnit;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import java.time.LocalDateTime;
import static org.junit.Assert.assertNull;

View File

@ -6,19 +6,16 @@ import org.gcube.application.cms.serialization.Serialization;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.document.identification.SpatialReference;
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.Field;
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.model.useCaseDescriptor.Field;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.geoportal.service.utils.UserUtils;
import org.junit.Test;
import javax.ws.rs.client.WebTarget;
import java.time.LocalDateTime;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@Slf4j

View File

@ -1,7 +1,6 @@
package org.gcube.application.geoportal.service.profiledDocuments;
import org.gcube.application.cms.tests.TestProfiles;
import org.gcube.application.geoportal.common.model.document.accounting.User;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.DataAccessPolicy;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
import org.gcube.application.geoportal.common.rest.InterfaceConstants;

View File

@ -4,7 +4,9 @@ import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.common.storagehub.client.dsl.FolderContainer;
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
import org.gcube.common.storagehub.model.exceptions.StorageHubException;
import org.gcube.common.storagehub.model.items.*;
import org.gcube.common.storagehub.model.items.AbstractFileItem;
import org.gcube.common.storagehub.model.items.FolderItem;
import org.gcube.common.storagehub.model.items.Item;
import java.text.CharacterIterator;
import java.text.StringCharacterIterator;

View File

@ -1,7 +1,7 @@
package org.gcube.application.geoportal.service.ws;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.cms.implementations.WorkspaceManager;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.common.storagehub.client.dsl.FolderContainer;
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
import org.gcube.common.storagehub.model.exceptions.StorageHubException;

View File

@ -1,7 +1,7 @@
package org.gcube.application.geoportal.service.ws;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.cms.implementations.WorkspaceManager;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.common.storagehub.client.dsl.FolderContainer;
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
import org.gcube.common.storagehub.model.exceptions.StorageHubException;

View File

@ -199,7 +199,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
<version>1.18.4</version>
</dependency>
<dependency>

View File

@ -1,9 +1,9 @@
package org.gcube.application.cms.sdi.engine;
import static org.gcube.application.cms.sdi.engine.PostgisTable.*;
import java.util.ArrayList;
import static org.gcube.application.cms.sdi.engine.PostgisTable.*;
public class DBConstants {
public static enum TYPE{

View File

@ -1,12 +1,13 @@
package org.gcube.application.cms.sdi.engine;
import lombok.Synchronized;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.sdi.faults.DataParsingException;
import org.gcube.application.geoportal.common.model.legacy.BBOX;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.common.model.rest.DatabaseConnection;
import java.sql.*;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

View File

@ -1,10 +1,5 @@
package org.gcube.application.cms.sdi.engine;
import org.gcube.application.cms.sdi.faults.DataParsingException;
import org.gcube.application.geoportal.common.model.rest.DatabaseConnection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

View File

@ -7,8 +7,8 @@ import org.gcube.application.cms.sdi.faults.SDIInteractionException;
import org.gcube.application.cms.sdi.model.CrossReferencedLayer;
import org.gcube.application.geoportal.common.model.configuration.Index;
import org.gcube.application.geoportal.common.model.document.filesets.sdi.GCubeSDILayer;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
import org.gcube.application.geoportal.common.model.rest.DatabaseConnection;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

View File

@ -5,7 +5,6 @@ import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.sdi.faults.DataParsingException;
import org.gcube.application.geoportal.common.model.legacy.BBOX;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.text.DecimalFormat;

View File

@ -5,11 +5,7 @@ import it.geosolutions.geoserver.rest.encoder.datastore.GSPostGISDatastoreEncode
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.sdi.faults.SDIInteractionException;
import org.gcube.application.cms.serialization.Serialization;
import org.gcube.application.geoportal.common.model.document.filesets.RegisteredFile;
import org.gcube.application.geoportal.common.model.document.filesets.RegisteredFileSet;
import org.gcube.application.geoportal.common.model.rest.DatabaseConnection;
import org.gcube.application.geoportal.common.utils.Files;
import org.gcube.data.transfer.library.DataTransferClient;
import org.gcube.spatial.data.gis.GISInterface;
import org.gcube.spatial.data.gis.is.AbstractGeoServerDescriptor;

View File

@ -2,29 +2,22 @@ package org.gcube.application.cms.sdi.engine;
import it.geosolutions.geoserver.rest.GeoServerRESTPublisher;
import it.geosolutions.geoserver.rest.GeoServerRESTReader;
import it.geosolutions.geoserver.rest.decoder.RESTFeatureType;
import it.geosolutions.geoserver.rest.decoder.RESTLayer;
import it.geosolutions.geoserver.rest.encoder.GSLayerEncoder;
import it.geosolutions.geoserver.rest.encoder.coverage.GSCoverageEncoder;
import it.geosolutions.geoserver.rest.encoder.feature.GSFeatureTypeEncoder;
import lombok.extern.slf4j.Slf4j;
import org.bson.Document;
import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.cms.implementations.WorkspaceManager;
import org.gcube.application.cms.plugins.requests.BaseExecutionRequest;
import org.gcube.application.cms.sdi.faults.SDIInteractionException;
import org.gcube.application.cms.sdi.model.GCubeSDILayerBuilder;
import org.gcube.application.cms.sdi.model.SupportedFormat;
import org.gcube.application.cms.serialization.Serialization;
import org.gcube.application.geoportal.common.model.document.filesets.sdi.GCubeSDILayer;
import org.gcube.application.geoportal.common.model.document.filesets.RegisteredFile;
import org.gcube.application.geoportal.common.model.document.filesets.RegisteredFileSet;
import org.gcube.application.geoportal.common.model.document.filesets.sdi.GCubeSDILayer;
import org.gcube.application.geoportal.common.model.document.filesets.sdi.GeoServerPlatform;
import org.gcube.application.geoportal.common.model.document.filesets.sdi.PlatformInfo;
import org.gcube.application.geoportal.common.model.rest.DatabaseConnection;
import org.gcube.application.geoportal.common.utils.Files;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
import org.gcube.data.transfer.library.TransferResult;
import org.gcube.data.transfer.library.faults.*;
import org.gcube.data.transfer.model.Destination;

View File

@ -1,7 +1,6 @@
package org.gcube.application.cms.sdi.engine.bboxes;
import lombok.Data;
import lombok.Getter;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import org.bson.Document;

View File

@ -5,13 +5,10 @@ import lombok.RequiredArgsConstructor;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import org.bson.Document;
import org.gcube.application.cms.serialization.Serialization;
import org.gcube.application.geoportal.common.model.JSONPathWrapper;
import org.gcube.application.geoportal.common.model.document.filesets.sdi.GCubeSDILayer;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
import java.util.List;
@RequiredArgsConstructor
@ToString
@Slf4j

View File

@ -1,6 +1,5 @@
package org.gcube.application.cms.sdi.engine.bboxes;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import org.bson.Document;
import org.gcube.application.cms.serialization.Serialization;

View File

@ -3,11 +3,13 @@ package org.gcube.application.cms.sdi.model;
import lombok.Getter;
import org.bson.Document;
import org.gcube.application.geoportal.common.model.document.filesets.sdi.GCubeSDILayer;
import org.gcube.application.geoportal.common.model.document.filesets.Materialization;
import org.gcube.application.geoportal.common.model.document.filesets.sdi.GeoServerPlatform;
import org.gcube.application.geoportal.common.model.document.filesets.sdi.PlatformInfo;
import java.util.*;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class GCubeSDILayerBuilder {

View File

@ -1,9 +1,9 @@
package org.gcube.application.cms.sdi.model;
import lombok.*;
import lombok.extern.slf4j.Slf4j;
import lombok.Getter;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import org.gcube.application.geoportal.common.model.document.filesets.RegisteredFile;
import org.gcube.application.geoportal.common.model.document.filesets.RegisteredFileSet;
import java.util.ArrayList;
@Getter

View File

@ -5,10 +5,10 @@ import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.caches.AbstractScopedMap;
import org.gcube.application.cms.implementations.ISInterface;
import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.cms.plugins.implementations.AbstractPlugin;
import org.gcube.application.cms.plugins.InitializablePlugin;
import org.gcube.application.cms.plugins.faults.InitializationException;
import org.gcube.application.cms.plugins.faults.ShutDownException;
import org.gcube.application.cms.plugins.implementations.AbstractPlugin;
import org.gcube.application.cms.plugins.reports.InitializationReport;
import org.gcube.application.cms.plugins.reports.Report;
import org.gcube.application.cms.sdi.engine.PostgisIndexer;

View File

@ -9,13 +9,6 @@ import org.gcube.application.cms.plugins.faults.IndexingException;
import org.gcube.application.cms.plugins.faults.InitializationException;
import org.gcube.application.cms.plugins.faults.InvalidPluginRequestException;
import org.gcube.application.cms.plugins.faults.InvalidProfileException;
import org.gcube.application.cms.sdi.engine.bboxes.BBOXByCoordinatePaths;
import org.gcube.application.cms.sdi.engine.bboxes.BBOXEvaluator;
import org.gcube.application.cms.sdi.engine.bboxes.BBOXPathScanner;
import org.gcube.application.geoportal.common.model.document.identification.IdentificationReference;
import org.gcube.application.geoportal.common.model.document.identification.SpatialReference;
import org.gcube.application.geoportal.common.model.plugins.IndexerPluginDescriptor;
import org.gcube.application.geoportal.common.model.plugins.PluginDescriptor;
import org.gcube.application.cms.plugins.reports.IndexDocumentReport;
import org.gcube.application.cms.plugins.reports.InitializationReport;
import org.gcube.application.cms.plugins.reports.Report;
@ -23,12 +16,19 @@ import org.gcube.application.cms.plugins.requests.BaseRequest;
import org.gcube.application.cms.plugins.requests.IndexDocumentRequest;
import org.gcube.application.cms.sdi.engine.PostgisIndexer;
import org.gcube.application.cms.sdi.engine.PostgisTable;
import org.gcube.application.cms.sdi.engine.bboxes.BBOXByCoordinatePaths;
import org.gcube.application.cms.sdi.engine.bboxes.BBOXEvaluator;
import org.gcube.application.cms.sdi.engine.bboxes.BBOXPathScanner;
import org.gcube.application.cms.sdi.faults.SDIInteractionException;
import org.gcube.application.cms.serialization.Serialization;
import org.gcube.application.geoportal.common.model.JSONPathWrapper;
import org.gcube.application.geoportal.common.model.configuration.Index;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.document.filesets.sdi.GCubeSDILayer;
import org.gcube.application.geoportal.common.model.document.identification.IdentificationReference;
import org.gcube.application.geoportal.common.model.document.identification.SpatialReference;
import org.gcube.application.geoportal.common.model.plugins.IndexerPluginDescriptor;
import org.gcube.application.geoportal.common.model.plugins.PluginDescriptor;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
import org.geojson.Crs;

View File

@ -11,9 +11,6 @@ import org.gcube.application.cms.plugins.faults.InvalidPluginRequestException;
import org.gcube.application.cms.plugins.faults.MaterializationException;
import org.gcube.application.cms.plugins.faults.ShutDownException;
import org.gcube.application.cms.plugins.implementations.AbstractPlugin;
import org.gcube.application.cms.plugins.model.ComparableVersion;
import org.gcube.application.geoportal.common.model.plugins.MaterializerPluginDescriptor;
import org.gcube.application.geoportal.common.model.plugins.PluginDescriptor;
import org.gcube.application.cms.plugins.reports.InitializationReport;
import org.gcube.application.cms.plugins.reports.MaterializationReport;
import org.gcube.application.cms.plugins.reports.Report;
@ -26,6 +23,8 @@ import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.document.filesets.Materialization;
import org.gcube.application.geoportal.common.model.document.filesets.RegisteredFileSet;
import org.gcube.application.geoportal.common.model.document.filesets.sdi.GCubeSDILayer;
import org.gcube.application.geoportal.common.model.plugins.MaterializerPluginDescriptor;
import org.gcube.application.geoportal.common.model.plugins.PluginDescriptor;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.Field;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
import org.gcube.application.geoportal.common.utils.ContextUtils;

View File

@ -1,6 +1,5 @@
package org.gcube.application.cms.sdi.plugins;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.gcube.application.cms.serialization.Serialization;
import org.gcube.application.geoportal.common.model.document.filesets.sdi.GCubeSDILayer;
import org.gcube.application.geoportal.common.model.document.identification.SpatialReference;
@ -8,7 +7,6 @@ import org.geojson.Crs;
import org.geojson.GeoJsonObject;
import org.geojson.LngLatAlt;
import org.geojson.Point;
import org.geotoolkit.referencing.CRS;
import org.junit.Test;
import java.io.IOException;

View File

@ -10,13 +10,13 @@ import org.gcube.application.cms.plugins.requests.BaseRequest;
import org.gcube.application.cms.plugins.requests.IndexDocumentRequest;
import org.gcube.application.cms.sdi.engine.PostgisIndexer;
import org.gcube.application.cms.serialization.Serialization;
import org.gcube.application.cms.tests.plugins.BasicPluginTest;
import org.gcube.application.cms.tests.TestDocuments;
import org.gcube.application.cms.tests.TestProfiles;
import org.gcube.application.cms.tests.plugins.BasicPluginTest;
import org.gcube.application.geoportal.common.model.configuration.Index;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.document.filesets.sdi.GCubeSDILayer;
import org.gcube.application.geoportal.common.model.document.filesets.Materialization;
import org.gcube.application.geoportal.common.model.document.filesets.sdi.GCubeSDILayer;
import org.gcube.application.geoportal.common.model.document.filesets.sdi.GeoServerPlatform;
import org.gcube.application.geoportal.common.model.document.identification.SpatialReference;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;

View File

@ -2,9 +2,6 @@ package org.gcube.application.cms.sdi.plugins;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.bson.Document;
import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.cms.plugins.faults.InvalidPluginRequestException;
import org.gcube.application.cms.plugins.faults.MaterializationException;
import org.gcube.application.cms.plugins.faults.PluginExecutionException;
import org.gcube.application.cms.plugins.reports.MaterializationReport;
import org.gcube.application.cms.plugins.reports.Report;
@ -20,7 +17,6 @@ import org.gcube.application.geoportal.common.model.document.filesets.Registered
import org.gcube.application.geoportal.common.model.document.filesets.RegisteredFileSet;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.common.utils.Files;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.junit.Test;

View File

@ -195,7 +195,6 @@
"_id": "org.gcube.portlets.user.geoportal-data-list",
"_type": "DATA_LIST_GUI",
"_configuration": {
"projection": "{\"_theDocument\" : 1, \"lifecycleInformation.phase\" : 1}",
"itemFields": [
{
"label": "Name",
@ -292,6 +291,65 @@
"sortable": true,
"asResult": false
}
],
"actionsDefinition": [
{
"id": "submit_for_review",
"title": "Submit for Review",
"call_STEPS": [
"SUBMIT-FOR-REVIEW"
],
"description": "Submit the Project (for review)",
"display_on_phase": [
"REJECTED",
"DRAFT"
]
},
{
"id": "reject",
"title": "Reject",
"call_STEPS": [
"REJECT-DRAFT"
],
"description": "Reject the Project",
"display_on_phase": [
"DRAFT"
]
},
{
"id": "approve",
"title": "Approve",
"call_STEPS": [
"APPROVE-SUBMITTED"
],
"description": "Approve the Project",
"display_on_phase": [
"DRAFT"
]
},
{
"id": "publish",
"title": "Publish",
"call_STEPS": [
"PUBLISH"
],
"description": "Publish the Project",
"display_on_phase": [
"DRAFT",
"APPROVED"
]
},
{
"id": "unpublish",
"title": "Unpublish",
"call_STEPS": [
"UNPUBLISH"
],
"description": "Unpublish the Project",
"display_on_phase": [
"PUBLISHED"
]
}
]
}
}

View File

@ -1,7 +1,6 @@
package org.gcube.application.cms.usecases;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.tests.TestProfiles;
import org.gcube.application.cms.tests.TestSchemas;
import org.junit.Test;

View File

@ -3,7 +3,6 @@ package org.gcube.application.cms.usecases;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
import org.gcube.application.geoportal.common.model.legacy.Concessione;
import java.util.ArrayList;

View File

@ -2,21 +2,20 @@ package org.gcube.application.cms.usecases;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportal.common.rest.Projects;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.*;
import java.util.concurrent.ConcurrentSkipListSet;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.projects;
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.statefulMongoConcessioni;
@Slf4j
public class ClearProjects {

View File

@ -2,10 +2,7 @@ package org.gcube.application.cms.usecases;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.cms.usecases.mocks.ConcessionPublisherThread;
import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.gcube.application.geoportal.common.model.rest.AddSectionToConcessioneRequest;
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
import org.gcube.application.geoportal.common.utils.StorageUtils;

View File

@ -17,12 +17,8 @@ import org.gcube.application.geoportal.common.model.useCaseDescriptor.Field;
import org.gcube.application.geoportal.common.rest.Projects;
import org.gcube.application.geoportal.common.utils.FileSets;
import org.gcube.application.geoportal.common.utils.Files;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.nio.charset.Charset;
import java.rmi.RemoteException;
import java.util.ArrayList;
@ -30,7 +26,6 @@ import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors;

View File

@ -5,9 +5,7 @@ import org.bson.Document;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
import org.gcube.application.geoportal.client.utils.Serialization;
import org.gcube.application.geoportal.common.model.legacy.*;
import org.gcube.application.geoportal.common.model.legacy.report.ValidationReport;
import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.gcube.application.geoportal.common.model.rest.TempFile;
import org.gcube.application.geoportal.common.utils.Files;
import org.gcube.application.geoportal.common.utils.StorageUtils;
@ -20,7 +18,6 @@ import java.nio.charset.Charset;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.statefulMongoConcessioni;

View File

@ -1,20 +1,22 @@
package org.gcube.application.cms.usecases;
import ch.qos.logback.core.helpers.ThrowableToStringArray;
import ch.qos.logback.core.net.SyslogOutputStream;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.geoportal.client.legacy.ConcessioniManager;
import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
import org.gcube.application.geoportal.client.utils.Serialization;
import org.gcube.application.geoportal.common.model.legacy.*;
import org.gcube.application.geoportal.common.model.legacy.AssociatedContent;
import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.gcube.application.geoportal.common.model.legacy.PersistedContent;
import org.gcube.application.geoportal.common.model.legacy.WorkspaceContent;
import org.gcube.common.storagehub.client.dsl.FileContainer;
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
import org.gcube.common.storagehub.model.exceptions.StorageHubException;
import java.io.*;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

View File

@ -2,7 +2,6 @@ package org.gcube.application.cms.usecases;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
import org.gcube.application.geoportal.common.model.legacy.Concessione;
import java.util.ArrayList;

View File

@ -1,11 +1,8 @@
package org.gcube.application.cms.usecases;
import jdk.nashorn.internal.parser.Token;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.mongoConcessioni;

View File

@ -3,22 +3,11 @@ package org.gcube.application.cms.usecases;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.cms.tests.model.concessioni.TestConcessioniModel;
import org.gcube.application.cms.usecases.mocks.ConcessionPublisherThread;
import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.gcube.application.geoportal.common.model.rest.AddSectionToConcessioneRequest;
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.mongoConcessioni;
@Slf4j
public class StressTest {
@ -29,39 +18,39 @@ public class StressTest {
TokenSetter.set("/pred4s/preprod/preVRE");
AtomicLong executed=new AtomicLong(0);
AddSectionToConcessioneRequest request= ConcessionPublisherThread.prepareRequest(
new StorageUtils(), Concessione.Paths.RELAZIONE,new File(TestConcessioniModel.getBaseFolder(),"relazione.pdf"));
// AddSectionToConcessioneRequest request= ConcessionPublisherThread.prepareRequest(
// new StorageUtils(), Concessione.Paths.RELAZIONE,new File(TestConcessioniModel.getBaseFolder(),"relazione.pdf"));
int numRequests=100000;
for(int i=0;i<numRequests;i++){
service.submit(new Runnable() {
@Override
public void run() {
try{
MongoConcessioni client=mongoConcessioni().build();
Concessione c =TestConcessioniModel.prepareConcessione(1,1);
c.setNome("Stress test");
c.setDefaults();
c=client.createNew(c);
// client.registerFileSet(c.getMongo_id(),request);
}catch(Throwable t){
System.err.println(t);
try {Thread.sleep(1000);} catch (InterruptedException i) {}
}finally {
log.info("Executed "+executed.incrementAndGet());
try {Thread.sleep(1000);} catch (InterruptedException i) {}
}
}
});
}
// int numRequests=100000;
// for(int i=0;i<numRequests;i++){
// service.submit(new Runnable() {
// @Override
// public void run() {
// try{
// MongoConcessioni client=mongoConcessioni().build();
// Concessione c =TestConcessioniModel.prepareConcessione(1,1);
// c.setNome("Stress test");
// c.setDefaults();
// c=client.createNew(c);
//// client.registerFileSet(c.getMongo_id(),request);
// }catch(Throwable t){
// System.err.println(t);
// try {Thread.sleep(1000);} catch (InterruptedException i) {}
// }finally {
// log.info("Executed "+executed.incrementAndGet());
// try {Thread.sleep(1000);} catch (InterruptedException i) {}
// }
// }
// });
// }
try{
while(!service.awaitTermination(1, TimeUnit.MINUTES)){
log.info("Waiting termination, executed {} out of {}",executed.get(),numRequests);
}
}catch (InterruptedException e){
// try{
// while(!service.awaitTermination(1, TimeUnit.MINUTES)){
// log.info("Waiting termination, executed {} out of {}",executed.get(),numRequests);
// }
// }catch (InterruptedException e){
}
// }
System.out.println("DONE");
}
}

View File

@ -1,10 +1,6 @@
package org.gcube.application.cms.usecases.UCDs;
import org.gcube.application.geoportal.common.utils.ContextUtils;
import java.io.File;
public class RegisterUCD {
//TODO read from args

View File

@ -2,17 +2,16 @@ package org.gcube.application.cms.usecases.mocks;
import com.opencsv.CSVReader;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.tests.Tests;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.cms.tests.model.concessioni.TestConcessioniModel;
import org.gcube.application.geoportal.common.model.legacy.Concessione;
import java.io.*;
import java.util.*;
import java.io.File;
import java.io.FileReader;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Consumer;
import static org.junit.Assert.assertTrue;
@Slf4j
public class MockFromFolder {
@ -22,7 +21,7 @@ public class MockFromFolder {
String context = "/pred4s/preprod/preVRE";
File descriptorsBaseFolder=new File(TestConcessioniModel.getBaseFolder(),"packages");
File descriptorsBaseFolder=new File(Tests.BASE_FOLDER,"packages");
// config csv -> base folder
Map<String,String> configurations=new HashMap<>();