Base Requests

This commit is contained in:
Fabio Sinibaldi 2022-03-14 17:04:09 +01:00
parent 49cb279664
commit 03079be06a
5 changed files with 25 additions and 13 deletions

View File

@ -7,6 +7,8 @@ import org.gcube.application.cms.plugins.Plugin;
import org.gcube.application.cms.plugins.PluginsReflections;
import org.gcube.application.cms.plugins.faults.InitializationException;
import org.gcube.application.cms.plugins.faults.PluginExecutionException;
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.utils.tests.GCubeTest;
import org.junit.Assert;
import org.junit.BeforeClass;
@ -17,7 +19,19 @@ import java.util.Map;
public class BasicPluginTest {
protected User getTestUser(){
User toReturn = new User();
toReturn.setUsername("test-user");
return toReturn;
}
protected Context getTestContext(){
Context toReturn = new Context();
String contextId =GCubeTest.getContext();
toReturn.setId(contextId);
toReturn.setName(contextId.substring(contextId.lastIndexOf("/")));
return toReturn;
}
protected static Map<String,Plugin> plugins=new HashMap<>();

View File

@ -24,7 +24,7 @@ public class DummyPlugin implements LifecycleManager, IndexerPluginInterface, Ma
}
@Override
public Index getIndex(UseCaseDescriptor ucd, Document params) throws ConfigurationException {
public Index getIndex(BaseRequest request) throws ConfigurationException {
return new Index("Dummy index");
}

View File

@ -82,9 +82,7 @@ public class PostgisIndexer {
HashMap<String,String> wmsUrls=new HashMap<>();
private String wmsByIndex(String indexName){
}
//private String wmsByIndex(String indexName){}
public Index getIndexConfiguration(){
@ -96,7 +94,7 @@ public class PostgisIndexer {
// cross reference info
toReturn.put("",);
toReturn.put("",null);
return toReturn;
}

View File

@ -1,6 +1,5 @@
package org.gcube.application.cms.sdi.plugins;
import com.sun.tools.javac.code.Type;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.bson.Document;
@ -9,6 +8,7 @@ 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.plugins.model.ComparableVersion;
import org.gcube.application.cms.plugins.model.PluginDescriptor;
import org.gcube.application.cms.plugins.reports.IndexDocumentReport;
import org.gcube.application.cms.plugins.reports.InitializationReport;
@ -20,14 +20,11 @@ import org.gcube.application.cms.sdi.engine.PostgisTable;
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.cms.plugins.model.ComparableVersion;
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.GCubeSDILayer;
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.ContextUtils;
import org.geojson.Crs;
import org.geojson.GeoJsonObject;
import org.geojson.LngLatAlt;
import org.geojson.Point;

View File

@ -12,7 +12,10 @@ import org.gcube.application.cms.tests.BasicPluginTest;
import org.gcube.application.cms.tests.TestDocuments;
import org.gcube.application.cms.tests.TestProfiles;
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;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.gcube.spatial.data.geonetwork.utils.UserUtils;
import org.junit.Test;
import static junit.framework.TestCase.assertTrue;
@ -23,11 +26,11 @@ public class IndexerTest extends BasicPluginTest {
@Test
public void testIndexRequest() throws PluginExecutionException, JsonProcessingException {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
IndexDocumentRequest request=new IndexDocumentRequest();
Project doc= TestDocuments.documentMap.get("profiledConcessioniExample.json");
request.setUseCaseDescriptor(TestProfiles.profiles.get(doc.getProfileID()));
request.setDocument(doc);
IndexDocumentRequest request=new IndexDocumentRequest(TestProfiles.profiles.get(doc.getProfileID()),
getTestUser(),getTestContext(),doc);
Document parameters = new Document();
parameters.put("workspace", "testing_workspace");
parameters.put("indexName", "unique_index"+System.currentTimeMillis());