This commit is contained in:
Fabio Sinibaldi 2022-09-20 12:20:04 +02:00
parent dfbc6e0ea2
commit 26e6350178
5 changed files with 61 additions and 45 deletions

View File

@ -125,34 +125,6 @@
</exclusions>
</dependency>
<!-- DEPRECATED LEGACY LOGIC SUPPORT -->
<!-- POSTGRES DRIVERS -->
<dependency>
<groupId>net.postgis</groupId>
<artifactId>postgis-jdbc</artifactId>
<version>2.5.0</version>
</dependency>
<!-- SDI -->
<dependency>
<groupId>org.gcube.spatial.data</groupId>
<artifactId>gis-interface</artifactId>
<version>[2.4.6,3.0.0)</version>
</dependency>
<!-- DT -->
<dependency>
<groupId>org.gcube.data.transfer</groupId>
<artifactId>data-transfer-library</artifactId>
<version>[1.2.1,2.0.0]</version>
</dependency>
<!-- TEST -->
<dependency>

View File

@ -0,0 +1,30 @@
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 {
@Test
public void deleteByQuery() throws ConfigurationException {
MongoTester tester = new MongoTester("profiledConcessioni");
System.out.println("Using builders..");
tester.getCollection().
find(type("_profileID", BsonType.NULL))
// find(exists("profileID",false))
.forEach(printBlock);
// deleteMany(type("_profileID", BsonType.NULL));
}
}

View File

@ -0,0 +1,28 @@
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 {
public static final MongoTester getLegacy() throws ConfigurationException {
return new MongoTester("legacyConcessioni",ID);}
private String theID=null;
public MongoTester(String profile) throws ConfigurationException {
this(profile,ID);
}
public MongoTester(String profile,String id) throws ConfigurationException {
init(profile);
theID=id;
}
@Override
protected String mongoIDFieldName() {
return theID;
}
}

View File

@ -2,14 +2,11 @@ package org.gcube.application.geoportal.service.engine.mongo;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.mongodb.Block;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
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.geoportal.common.utils.tests.GCubeTest;
import org.gcube.application.geoportal.service.engine.mongo.MongoManager;
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;
@ -22,18 +19,6 @@ import static org.junit.Assume.assumeTrue;
public class MongoTests {
public static class MongoTester extends MongoManager {
public MongoTester() throws ConfigurationException {
init("legacyConcessioni");
}
@Override
protected String mongoIDFieldName() {
return ID;
}
}
@BeforeClass
public static final void init() {
@ -73,7 +58,7 @@ public class MongoTests {
@Test
public void queries() throws ConfigurationException {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
MongoTester tester=new MongoTester();
MongoTester tester=MongoTester.getLegacy();
System.out.println("Using builders..");
tester.getCollection().find(Document.parse("{\"report.status\" : \"WARNING\"}")).
projection(Projections.include("nome")).forEach(printBlock);

View File

@ -68,7 +68,8 @@ public class ProfiledConcessioniTests extends AbstractProfiledDocumentsTests{
// invoke step SUBMIT-FOR-REVIEW
StepExecutionRequest submitReq=new StepExecutionRequest();
submitReq.setStepID("SUBMIT-FOR-REVIEW");
doc=step(doc.getId(),submitReq);
// doc=step(doc.getId(),submitReq);
doc=step("630f912755e2947b0278c1be",submitReq);
System.out.println(doc);
assertTrue(doc.getLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK));