This commit is contained in:
Fabio Sinibaldi 2021-10-12 15:43:35 +02:00
parent b761b15335
commit dd2c3c64cd
16 changed files with 87 additions and 44 deletions

View File

@ -22,9 +22,9 @@
</properties>
<scm>
<connection>scm:git:${gitBaseUrl}/${project.artifactId}.git</connection>
<developerConnection>scm:git:${gitBaseUrl}/${project.artifactId}.git</developerConnection>
<url>${gitBaseUrl}/${project.artifactId}.git</url>
<connection>scm:git:${gitBaseUrl}/gcube-cms-suite</connection>
<developerConnection>scm:git:${gitBaseUrl}/gcube-cms-suite</developerConnection>
<url>${gitBaseUrl}/gcube-cms-suite</url>
</scm>

View File

@ -20,9 +20,9 @@
</properties>
<scm>
<connection>scm:git:${gitBaseUrl}/${project.artifactId}.git</connection>
<developerConnection>scm:git:${gitBaseUrl}/${project.artifactId}.git</developerConnection>
<url>${gitBaseUrl}/${project.artifactId}.git</url>
<connection>scm:git:${gitBaseUrl}/gcube-cms-suite</connection>
<developerConnection>scm:git:${gitBaseUrl}/gcube-cms-suite</developerConnection>
<url>${gitBaseUrl}/gcube-cms-suite</url>
</scm>
<dependencies>

View File

@ -15,7 +15,7 @@ import org.gcube.application.cms.tests.model.TestFilters;
import org.gcube.application.cms.tests.model.TestModel;
import org.gcube.application.cms.tests.model.TestQueries;
import org.gcube.application.geoportal.client.utils.Queries;
import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.gcube.application.geoportal.common.model.legacy.*;
import org.gcube.application.geoportal.common.model.legacy.Concessione.Paths;
import org.gcube.application.geoportal.common.model.legacy.report.ValidationReport.ValidationStatus;
import org.gcube.application.geoportal.common.model.rest.AddSectionToConcessioneRequest;
@ -142,12 +142,23 @@ public class StatelessClientTests extends BasicVreTests{
public void testCleanFileSet() throws Exception {
Concessione testObject=prepare();
System.out.println("Object is "+testObject.getPosizionamentoScavo());
//Precheck to be sure
assertFalse(testObject.getPosizionamentoScavo().getActualContent().isEmpty());
assertFalse(testObject.getPianteFineScavo().get(0).getActualContent().isEmpty());
client.unPublish(testObject.getMongo_id());
// check unpublish
testObject= client.getById(testObject.getMongo_id());
for(LayerConcessione l:testObject.getPianteFineScavo())
for(PersistedContent pc: l.getActualContent())
if(pc instanceof GeoServerContent) throw new Exception ("Concessione not properly unpublished");
for(PersistedContent pc: testObject.getPosizionamentoScavo().getActualContent())
if(pc instanceof GeoServerContent) throw new Exception ("Concessione not properly unpublished");
//Clear pos
testObject=client.cleanFileSet(testObject.getMongo_id(),Paths.POSIZIONAMENTO);
assertTrue(testObject.getPosizionamentoScavo().getActualContent().isEmpty());
@ -159,7 +170,7 @@ public class StatelessClientTests extends BasicVreTests{
private Concessione prepare() throws Exception {
int numImgs=5;
int numImgs=1;
Concessione c= client.createNew(TestModel.prepareConcessione(1,numImgs));
StorageUtils storage = new StorageUtils();
@ -171,10 +182,12 @@ public class StatelessClientTests extends BasicVreTests{
client.registerFileSet(mongoId,
FileSets.prepareRequest(storage,Paths.RELAZIONE,new File(TestModel.getBaseFolder(),"relazione.pdf")));
for(int i=0;i<numImgs;i++)
client.registerFileSet(mongoId,
FileSets.build(Paths.imgByIndex(i)).
add(storage.putOntoStorage(new File(TestModel.getBaseFolder(),"immagine.png"),
add(storage.putOntoStorage(new File(TestModel.getBaseFolder(),"immagine"+(i+1)+".png"),
i+"San Mauro_drone totale.JPG")).getTheRequest());

View File

@ -22,9 +22,9 @@
<scm>
<connection>scm:git:${gitBaseUrl}/${project.artifactId}.git</connection>
<developerConnection>scm:git:${gitBaseUrl}/${project.artifactId}.git</developerConnection>
<url>${gitBaseUrl}/${project.artifactId}.git</url>
<connection>scm:git:${gitBaseUrl}/gcube-cms-suite</connection>
<developerConnection>scm:git:${gitBaseUrl}/gcube-cms-suite</developerConnection>
<url>${gitBaseUrl}/gcube-cms-suite</url>
</scm>

View File

@ -312,25 +312,31 @@ public class Concessione extends Record{
setLicenzaID(ConstraintCheck.defaultFor(getLicenzaID(), "CC0-1.0").evaluate());
if(relazioneScavo!=null) {
if(relazioneScavo == null) relazioneScavo=new RelazioneScavo();
relazioneScavo.setTitolo(ConstraintCheck.defaultFor(relazioneScavo.getTitolo(),getNome()+" relazione di scavo").evaluate());
relazioneScavo.setSoggetto(ConstraintCheck.defaultFor(relazioneScavo.getSoggetto(),getSoggetto()).evaluate());
relazioneScavo.setCreationTime(ConstraintCheck.defaultFor(relazioneScavo.getCreationTime(),getCreationTime()).evaluate());
relazioneScavo.setLicenseID(ConstraintCheck.defaultFor(getLicenzaID(), "CC-BY-4.0").evaluate());
relazioneScavo.setPolicy(getPolicy());
}
if(abstractRelazione!=null) {
if(abstractRelazione == null) abstractRelazione = new AbstractRelazione();
abstractRelazione.setTitolo(ConstraintCheck.defaultFor(abstractRelazione.getTitolo(),getNome()+" abstract relazione di scavo").evaluate());
abstractRelazione.setCreationTime(ConstraintCheck.defaultFor(abstractRelazione.getCreationTime(),getCreationTime()).evaluate());
abstractRelazione.setLicenseID(ConstraintCheck.defaultFor(getLicenzaID(), "CC-BY-4.0").evaluate());
abstractRelazione.setPolicy(getPolicy());
}
if(immaginiRappresentative!=null)
for(UploadedImage img : immaginiRappresentative) {
// String evaluatedTitle="Empty img";
// img.setTitolo(ConstraintCheck.defaultFor(img.getTitolo(),
// getNome()+" abstract relazione di scavo").evaluate());
//
// if(!img.getActualContent().isEmpty()){
//
// }
img.setSoggetto(ConstraintCheck.defaultFor(img.getSoggetto(),getSoggetto()).evaluate());
img.setCreationTime(ConstraintCheck.defaultFor(img.getCreationTime(),getCreationTime()).evaluate());
img.setPolicy(ConstraintCheck.defaultFor(img.getPolicy(),getPolicy()).evaluate());

View File

@ -4,7 +4,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
## [v1.0.6] 2021-09-20
Refactored repositories
Fixes #22193
## [v1.0.5-SNAPSHOT] 2021-07-23
Upgrade to gcube-smartgears-bom 2.1.0

View File

@ -23,9 +23,9 @@
<scm>
<connection>scm:git:${gitBaseUrl}/${project.artifactId}.git</connection>
<developerConnection>scm:git:${gitBaseUrl}/${project.artifactId}.git</developerConnection>
<url>${gitBaseUrl}/${project.artifactId}.git</url>
<connection>scm:git:${gitBaseUrl}/gcube-cms-suite</connection>
<developerConnection>scm:git:${gitBaseUrl}/gcube-cms-suite</developerConnection>
<url>${gitBaseUrl}/gcube-cms-suite</url>
</scm>

View File

@ -316,7 +316,7 @@ public class ConcessioniMongoManager extends MongoManager{
index.removeCentroid(record);
report.addMessage(ValidationStatus.PASSED, "Removed centroid");
} catch (SDIInteractionException | SQLException | ConfigurationException e) {
log.error("Unable to reove from index {} ",record,e);
log.error("Unable to remove from index {} ",record,e);
report.addMessage(ValidationStatus.WARNING, "Internal error while removing from index.");
}
return record;
@ -386,16 +386,24 @@ public class ConcessioniMongoManager extends MongoManager{
try {
sdi.deleteContent((GeoServerContent) p);
toRemove.add(p);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (RemoteServiceException e) {
e.printStackTrace();
} catch (Throwable t) {
report.addMessage(ValidationStatus.WARNING,"Cannot delete "+((GeoServerContent) p).getFeatureType());
}
}
}
// Remove GIS coordinates
((LayerConcessione) c).setLayerID(null);
((LayerConcessione) c).setBbox(null);
((LayerConcessione) c).setWmsLink(null);
((LayerConcessione) c).setWorkspace(null);
//Remove reference to removed content
c.getActualContent().removeAll(toRemove);
}
}
concessione.setCentroidLat(null);
concessione.setCentroidLong(null);
}catch(SDIInteractionException e){
report.addMessage(ValidationStatus.WARNING, "Unable to unpublish layers "+e.getMessage());
}

View File

@ -268,6 +268,8 @@ public class ConcessioniOverMongoTest extends BasicServiceTestUnit{
//Expecting error for deletion
assertTrue(resp.getStatus()>=300);
System.out.println("Error for deletion is "+resp.readEntity(String.class));
//unpublish
resp=
target.path(InterfaceConstants.Methods.PUBLISH_PATH).path(published.getMongo_id()).
request(MediaType.APPLICATION_JSON).delete();

View File

@ -123,10 +123,11 @@ public class Caches extends BasicServiceTestUnit {
@Override
public void run() {
try {
// System.out.println(ImplementationProvider.get().getStorageProvider().getObject().getURL(id));
storage.getURL(id);
// } catch (ConfigurationException e) {
// e.printStackTrace();
try {Thread.sleep(1000);} catch (InterruptedException i) {}
System.out.println(ImplementationProvider.get().getStorageProvider().getObject().getURL(id));
// storage.getURL(id);
} catch (ConfigurationException e) {
e.printStackTrace();
} catch (MongoWaitQueueFullException e) {
log.info("Too many connections... ");
}finally{

View File

@ -10,7 +10,7 @@
<logger name="org.gcube.application" level="DEBUG">
</logger>
<root level="ERROR">
<root level="DEBUG">
<appender-ref ref="STDOUT" />
</root>

View File

@ -25,9 +25,9 @@
<scm>
<connection>scm:git:${gitBaseUrl}/${project.artifactId}.git</connection>
<developerConnection>scm:git:${gitBaseUrl}/${project.artifactId}.git</developerConnection>
<url>${gitBaseUrl}/${project.artifactId}.git</url>
<connection>scm:git:${gitBaseUrl}/gcube-cms-suite</connection>
<developerConnection>scm:git:${gitBaseUrl}/gcube-cms-suite</developerConnection>
<url>${gitBaseUrl}/gcube-cms-suite</url>
</scm>

View File

@ -3,4 +3,4 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for org.gcube.application.geoportal-client
## [v1.0.0] - 2021-09-20
First release, extracted from client
First release, extracted from client

View File

@ -18,9 +18,9 @@
</properties>
<scm>
<connection>scm:git:${gitBaseUrl}/${project.artifactId}.git</connection>
<developerConnection>scm:git:${gitBaseUrl}/${project.artifactId}.git</developerConnection>
<url>${gitBaseUrl}/${project.artifactId}.git</url>
<connection>scm:git:${gitBaseUrl}/gcube-cms-suite</connection>
<developerConnection>scm:git:${gitBaseUrl}/gcube-cms-suite</developerConnection>
<url>${gitBaseUrl}/gcube-cms-suite</url>
</scm>

View File

@ -35,7 +35,7 @@ public class ClearConcessioni {
Iterator<Concessione> it=null;
// it=manager.getList();
it=manager.search("{\"creationUser\" : {\"$ne\" : \"francesco.mangiacrapa\"}}");
it=manager.search("{\"creationUser\" : {\"$exists\" : \"false\"}}");
ExecutorService service = Executors.newFixedThreadPool(10);
@ -62,6 +62,7 @@ public class ClearConcessioni {
}catch(Throwable throwable){
System.err.println(throwable);
errCount.incrementAndGet();
try {Thread.sleep(1000);} catch (InterruptedException i) {}
}finally {
count.incrementAndGet();
}

View File

@ -4,8 +4,13 @@ import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.cms.tests.model.TestModel;
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.FileSets;
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;
@ -17,26 +22,33 @@ import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.mon
public class StressTest {
private static ExecutorService service = Executors.newFixedThreadPool(100);
private static ExecutorService service = Executors.newFixedThreadPool(5);
public static void main(String[] args) {
public static void main(String[] args) throws FileNotFoundException {
TokenSetter.set("/gcube/devsec/devVRE");
AtomicLong executed=new AtomicLong(0);
int numRequests=10000;
AddSectionToConcessioneRequest request= FileSets.prepareRequest(
new StorageUtils(), Concessione.Paths.RELAZIONE,new File(TestModel.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 =TestModel.prepareEmptyConcessione();
Concessione c =TestModel.prepareConcessione(1,1);
c.setNome("Stress test");
client.createNew(c);
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) {}
}
}
});