Added new Data_Handler and UCD test cases
This commit is contained in:
parent
ab11f34bee
commit
1593755ee2
|
@ -3,28 +3,57 @@ package org.gcube.application.geoportalcommon.geoportal;
|
||||||
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.useCaseDescriptors;
|
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.useCaseDescriptors;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.bson.Document;
|
import org.bson.Document;
|
||||||
|
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.document.Project;
|
||||||
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
|
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
|
||||||
|
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.useCaseDescriptor.UseCaseDescriptor;
|
||||||
|
import org.gcube.application.geoportal.common.rest.Projects;
|
||||||
import org.gcube.application.geoportal.common.rest.UseCaseDescriptorsI;
|
import org.gcube.application.geoportal.common.rest.UseCaseDescriptorsI;
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import com.jayway.jsonpath.JsonPath;
|
||||||
|
import com.jayway.jsonpath.spi.json.JsonOrgJsonProvider;
|
||||||
import com.mongodb.BasicDBList;
|
import com.mongodb.BasicDBList;
|
||||||
import com.mongodb.BasicDBObject;
|
import com.mongodb.BasicDBObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class UseCaseDescriptorCaller.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Sep 14, 2022
|
||||||
|
*/
|
||||||
public class UseCaseDescriptorCaller {
|
public class UseCaseDescriptorCaller {
|
||||||
|
|
||||||
private static Logger LOG = LoggerFactory.getLogger(UseCaseDescriptorCaller.class);
|
private static Logger LOG = LoggerFactory.getLogger(UseCaseDescriptorCaller.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use case descriptors client.
|
||||||
|
*
|
||||||
|
* @return the use case descriptors I
|
||||||
|
*/
|
||||||
public UseCaseDescriptorsI useCaseDescriptorsClient() {
|
public UseCaseDescriptorsI useCaseDescriptorsClient() {
|
||||||
LOG.info("useCaseDescriptorsClient called");
|
LOG.info("useCaseDescriptorsClient called");
|
||||||
return useCaseDescriptors().build();
|
return useCaseDescriptors().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the list.
|
||||||
|
*
|
||||||
|
* @return the list
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
public List<UseCaseDescriptor> getList() throws Exception {
|
public List<UseCaseDescriptor> getList() throws Exception {
|
||||||
LOG.info("getList called");
|
LOG.info("getList called");
|
||||||
UseCaseDescriptorsI client = useCaseDescriptorsClient();
|
UseCaseDescriptorsI client = useCaseDescriptorsClient();
|
||||||
|
@ -35,16 +64,31 @@ public class UseCaseDescriptorCaller {
|
||||||
listUCD.add(prg);
|
listUCD.add(prg);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.info("returning {} {}", listUCD.size(), UseCaseDescriptor.class.getName());
|
LOG.info("returning {} {}", listUCD.size(), UseCaseDescriptor.class.getName());
|
||||||
return listUCD;
|
return listUCD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the list for handler ids.
|
||||||
|
*
|
||||||
|
* @param listHandlersIds the list handlers ids
|
||||||
|
* @return the list for handler ids
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
public List<UseCaseDescriptor> getListForHandlerIds(List<String> listHandlersIds) throws Exception {
|
public List<UseCaseDescriptor> getListForHandlerIds(List<String> listHandlersIds) throws Exception {
|
||||||
LOG.info("getListForHandlerIds called");
|
LOG.info("getListForHandlerIds called");
|
||||||
return getListForJSONPath("_handlers._id", listHandlersIds);
|
return getListForJSONPath("_handlers._id", listHandlersIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the list for JSON path.
|
||||||
|
*
|
||||||
|
* @param jsonPath the json path
|
||||||
|
* @param listValues the list values
|
||||||
|
* @return the list for JSON path
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
public List<UseCaseDescriptor> getListForJSONPath(String jsonPath, List<String> listValues) throws Exception {
|
public List<UseCaseDescriptor> getListForJSONPath(String jsonPath, List<String> listValues) throws Exception {
|
||||||
LOG.info("getListForJSONPath called for jsonPath: {}, with listValues: {}", jsonPath, listValues);
|
LOG.info("getListForJSONPath called for jsonPath: {}, with listValues: {}", jsonPath, listValues);
|
||||||
UseCaseDescriptorsI client = useCaseDescriptorsClient();
|
UseCaseDescriptorsI client = useCaseDescriptorsClient();
|
||||||
|
@ -65,13 +109,13 @@ public class UseCaseDescriptorCaller {
|
||||||
Document doc = new Document(jsonPath, value);
|
Document doc = new Document(jsonPath, value);
|
||||||
list.add(doc);
|
list.add(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryRequest queryRequest = new QueryRequest();
|
QueryRequest queryRequest = new QueryRequest();
|
||||||
Document queryDoc = new Document();
|
Document queryDoc = new Document();
|
||||||
queryDoc.put("$and", list);
|
queryDoc.put("$and", list);
|
||||||
LOG.debug("Performing query: {}", queryDoc.toJson());
|
LOG.debug("Performing query: {}", queryDoc.toJson());
|
||||||
queryRequest.setFilter(queryDoc);
|
queryRequest.setFilter(queryDoc);
|
||||||
|
|
||||||
// QueryRequest queryRequest = new QueryRequest();
|
// QueryRequest queryRequest = new QueryRequest();
|
||||||
// Document queryDoc = new Document();
|
// Document queryDoc = new Document();
|
||||||
// BasicDBObject bs = new BasicDBObject();
|
// BasicDBObject bs = new BasicDBObject();
|
||||||
|
@ -81,18 +125,25 @@ public class UseCaseDescriptorCaller {
|
||||||
// queryRequest.setFilter(queryDoc);
|
// queryRequest.setFilter(queryDoc);
|
||||||
|
|
||||||
Iterator<UseCaseDescriptor> useCaseDescrsIt = client.query(queryRequest);
|
Iterator<UseCaseDescriptor> useCaseDescrsIt = client.query(queryRequest);
|
||||||
|
|
||||||
if(useCaseDescrsIt!=null) {
|
if (useCaseDescrsIt != null) {
|
||||||
while(useCaseDescrsIt.hasNext()) {
|
while (useCaseDescrsIt.hasNext()) {
|
||||||
UseCaseDescriptor prg = (UseCaseDescriptor) useCaseDescrsIt.next();
|
UseCaseDescriptor prg = (UseCaseDescriptor) useCaseDescrsIt.next();
|
||||||
listUCD.add(prg);
|
listUCD.add(prg);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG.info("getListForJSONPath returning {} {}", listUCD.size(), UseCaseDescriptor.class.getName());
|
LOG.info("getListForJSONPath returning {} {}", listUCD.size(), UseCaseDescriptor.class.getName());
|
||||||
return listUCD;
|
return listUCD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the UCD for id.
|
||||||
|
*
|
||||||
|
* @param profileID the profile ID
|
||||||
|
* @return the UCD for id
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
public UseCaseDescriptor getUCDForId(String profileID) throws Exception {
|
public UseCaseDescriptor getUCDForId(String profileID) throws Exception {
|
||||||
LOG.info("getUCDForId called for profileID: {}", profileID);
|
LOG.info("getUCDForId called for profileID: {}", profileID);
|
||||||
UseCaseDescriptorsI client = useCaseDescriptorsClient();
|
UseCaseDescriptorsI client = useCaseDescriptorsClient();
|
||||||
|
@ -117,4 +168,19 @@ public class UseCaseDescriptorCaller {
|
||||||
return ucd;
|
return ucd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the handlers by type.
|
||||||
|
*
|
||||||
|
* @param profileID the profile ID
|
||||||
|
* @param theHandlerType the the handler type
|
||||||
|
* @return the handlers by type
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
public List<HandlerDeclaration> getHandlersByType(String profileID, String theHandlerType) throws Exception {
|
||||||
|
LOG.info("getHandlersByType called for profileID: {}", profileID);
|
||||||
|
UseCaseDescriptorsI client = useCaseDescriptorsClient();
|
||||||
|
UseCaseDescriptor ucd = client.getById(profileID);
|
||||||
|
return ucd.getHandlersByType(theHandlerType);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,8 @@ public enum GEOPORTAL_DATA_HANDLER {
|
||||||
|
|
||||||
geoportal_data_list("org.gcube.portlets.user.geoportal-data-list", "DATA_LIST_GUI"),
|
geoportal_data_list("org.gcube.portlets.user.geoportal-data-list", "DATA_LIST_GUI"),
|
||||||
geoportal_data_entry("org.gcube.portlets.user.geoportal-data-entry-app", "DATA_ENTRY_GUI"),
|
geoportal_data_entry("org.gcube.portlets.user.geoportal-data-entry-app", "DATA_ENTRY_GUI"),
|
||||||
geoportal_workflow_action_list("org.gcube.portlets.user.geoportal-workflow-action-list", "WORKFLOW_ACTION_LIST_GUI");
|
geoportal_workflow_action_list("org.gcube.portlets.user.geoportal-workflow-action-list","WORKFLOW_ACTION_LIST_GUI"),
|
||||||
|
gna_concessionio_lc("GNA-CONCESSIONI-LC", "LifecycleManagement");
|
||||||
|
|
||||||
String id;
|
String id;
|
||||||
String type;
|
String type;
|
||||||
|
|
|
@ -2,8 +2,11 @@ package org.gcube.application;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
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.useCaseDescriptor.UseCaseDescriptor;
|
||||||
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
|
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
|
||||||
import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller;
|
import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller;
|
||||||
|
@ -17,15 +20,20 @@ import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclara
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.jayway.jsonpath.JsonPath;
|
||||||
|
import com.jayway.jsonpath.spi.json.JsonOrgJsonProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class UCD_Tests.
|
* The Class UCD_Tests.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
*
|
*
|
||||||
* Sep 9, 2022
|
* Sep 9, 2022
|
||||||
*/
|
*/
|
||||||
public class UCD_Tests {
|
public class UCD_Tests {
|
||||||
|
|
||||||
|
@ -58,7 +66,7 @@ public class UCD_Tests {
|
||||||
* @return the list
|
* @return the list
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
@Test
|
//@Test
|
||||||
public void getList() throws Exception {
|
public void getList() throws Exception {
|
||||||
ScopeProvider.instance.set(CONTEXT);
|
ScopeProvider.instance.set(CONTEXT);
|
||||||
SecurityTokenProvider.instance.set(TOKEN);
|
SecurityTokenProvider.instance.set(TOKEN);
|
||||||
|
@ -109,13 +117,13 @@ public class UCD_Tests {
|
||||||
* @return the UCD for data entry handler ids
|
* @return the UCD for data entry handler ids
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
//@Test
|
// @Test
|
||||||
public void getUCDFor_DataEntry_HandlerIds() throws Exception {
|
public void getUCDFor_DataEntry_HandlerIds() throws Exception {
|
||||||
ScopeProvider.instance.set(CONTEXT);
|
ScopeProvider.instance.set(CONTEXT);
|
||||||
SecurityTokenProvider.instance.set(TOKEN);
|
SecurityTokenProvider.instance.set(TOKEN);
|
||||||
|
|
||||||
List<String> handlersIds = null;
|
List<String> handlersIds = null;
|
||||||
List<UseCaseDescriptor> listUseCaseDescriptor;
|
List<UseCaseDescriptor> listUseCaseDescriptor = null;
|
||||||
try {
|
try {
|
||||||
UseCaseDescriptorCaller client = GeoportalClientCaller.useCaseDescriptors();
|
UseCaseDescriptorCaller client = GeoportalClientCaller.useCaseDescriptors();
|
||||||
|
|
||||||
|
@ -125,10 +133,7 @@ public class UCD_Tests {
|
||||||
}
|
}
|
||||||
listUseCaseDescriptor = client.getListForHandlerIds(handlersIds);
|
listUseCaseDescriptor = client.getListForHandlerIds(handlersIds);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String error = "Error on contacting the Geoportal service";
|
e.printStackTrace();
|
||||||
System.out.println(error + " for handlers: " + handlersIds);
|
|
||||||
throw new Exception(
|
|
||||||
"Error when contacting the Geoportal service. Refresh and try again or contact the support", e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listUseCaseDescriptor == null) {
|
if (listUseCaseDescriptor == null) {
|
||||||
|
@ -152,13 +157,14 @@ public class UCD_Tests {
|
||||||
* @return the UCD for data list handler ids
|
* @return the UCD for data list handler ids
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
//@Test
|
// @Test
|
||||||
public void getUCDFor_DataList_HandlerIds() throws Exception {
|
public void getUCDFor_DataList_HandlerIds() throws Exception {
|
||||||
ScopeProvider.instance.set(CONTEXT);
|
ScopeProvider.instance.set(CONTEXT);
|
||||||
SecurityTokenProvider.instance.set(TOKEN);
|
SecurityTokenProvider.instance.set(TOKEN);
|
||||||
|
|
||||||
List<String> handlersIds = null;
|
List<String> handlersIds = null;
|
||||||
List<UseCaseDescriptor> listUseCaseDescriptor;
|
List<UseCaseDescriptor> listUseCaseDescriptor;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
UseCaseDescriptorCaller client = GeoportalClientCaller.useCaseDescriptors();
|
UseCaseDescriptorCaller client = GeoportalClientCaller.useCaseDescriptors();
|
||||||
|
|
||||||
|
@ -168,10 +174,8 @@ public class UCD_Tests {
|
||||||
}
|
}
|
||||||
listUseCaseDescriptor = client.getListForHandlerIds(handlersIds);
|
listUseCaseDescriptor = client.getListForHandlerIds(handlersIds);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String error = "Error on contacting the Geoportal service";
|
e.printStackTrace();
|
||||||
System.out.println(error + " for handlers: " + handlersIds);
|
return;
|
||||||
throw new Exception(
|
|
||||||
"Error when contacting the Geoportal service. Refresh and try again or contact the support", e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listUseCaseDescriptor == null) {
|
if (listUseCaseDescriptor == null) {
|
||||||
|
@ -187,33 +191,111 @@ public class UCD_Tests {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the UCD for handler types.
|
||||||
|
*
|
||||||
|
* @return the UCD for handler types
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
// @Test
|
||||||
|
public void getUCDForHandlerTypes() throws Exception {
|
||||||
|
ScopeProvider.instance.set(CONTEXT);
|
||||||
|
SecurityTokenProvider.instance.set(TOKEN);
|
||||||
|
|
||||||
|
UseCaseDescriptor ucd = null;
|
||||||
|
List<HandlerDeclaration> handlers = null;
|
||||||
|
try {
|
||||||
|
UseCaseDescriptorCaller client = GeoportalClientCaller.useCaseDescriptors();
|
||||||
|
ucd = client.getUCDForId(PROFILE_ID);
|
||||||
|
handlers = client.getHandlersByType(PROFILE_ID, GEOPORTAL_DATA_HANDLER.gna_concessionio_lc.getType());
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (HandlerDeclaration handlerDeclaration : handlers) {
|
||||||
|
System.out.println(handlerDeclaration);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the roles for STEP id.
|
||||||
|
*
|
||||||
|
* @return the roles for STEP id
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void getRolesForSTEPId() throws Exception {
|
||||||
|
ScopeProvider.instance.set(CONTEXT);
|
||||||
|
SecurityTokenProvider.instance.set(TOKEN);
|
||||||
|
|
||||||
|
try {
|
||||||
|
UseCaseDescriptor ucd = null;
|
||||||
|
List<HandlerDeclaration> handlers = null;
|
||||||
|
String stepID = "REJECT-DRAFT";
|
||||||
|
|
||||||
|
UseCaseDescriptorCaller client = GeoportalClientCaller.useCaseDescriptors();
|
||||||
|
ucd = client.getUCDForId(PROFILE_ID);
|
||||||
|
handlers = client.getHandlersByType(PROFILE_ID, GEOPORTAL_DATA_HANDLER.gna_concessionio_lc.getType());
|
||||||
|
|
||||||
|
com.jayway.jsonpath.Configuration configuration = com.jayway.jsonpath.Configuration.builder()
|
||||||
|
.jsonProvider(new JsonOrgJsonProvider()).build();
|
||||||
|
|
||||||
|
for (HandlerDeclaration handler : handlers) {
|
||||||
|
|
||||||
|
String toJSON = handler.getConfiguration().toJson();
|
||||||
|
System.out.println("Handler to JSON: " + toJSON);
|
||||||
|
JSONObject jObject = new JSONObject(toJSON);
|
||||||
|
JsonPath jsonPath = JsonPath.compile("$.step_access[?(@.STEP == '"+ stepID +"' )].roles");
|
||||||
|
System.out.println("jsonPath: " + jsonPath.getPath());
|
||||||
|
// $..book[?(@.price <= $['expensive'])]
|
||||||
|
JSONArray data = jsonPath.read(jObject, configuration);
|
||||||
|
System.out.println("matching data lenght: " + data.length());
|
||||||
|
HashSet<String> listdata = new HashSet<String>(data.length());
|
||||||
|
for (int i = 0; i < data.length(); i++) {
|
||||||
|
listdata.add(data.get(i).toString());
|
||||||
|
}
|
||||||
|
List<String> roles = listdata.stream().collect(Collectors.toList());
|
||||||
|
System.out.println("getRole returning: " + roles);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the configurations for UC D data handlers.
|
* Gets the configurations for UC D data handlers.
|
||||||
*
|
*
|
||||||
* @return the configurations for UC D data handlers
|
* @return the configurations for UC D data handlers
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
//@Test
|
// @Test
|
||||||
public void getConfigurations_ForUCD_Data_Handlers() throws Exception {
|
public void getConfigurations_ForUCD_Data_Handlers() throws Exception {
|
||||||
ScopeProvider.instance.set(CONTEXT);
|
ScopeProvider.instance.set(CONTEXT);
|
||||||
SecurityTokenProvider.instance.set(TOKEN);
|
SecurityTokenProvider.instance.set(TOKEN);
|
||||||
|
|
||||||
List<String> handlersIds = null;
|
List<String> handlersIds = null;
|
||||||
List<UseCaseDescriptor> listUseCaseDescriptor;
|
List<UseCaseDescriptor> listUseCaseDescriptor = null;
|
||||||
try {
|
try {
|
||||||
UseCaseDescriptorCaller client = GeoportalClientCaller.useCaseDescriptors();
|
UseCaseDescriptorCaller client = GeoportalClientCaller.useCaseDescriptors();
|
||||||
|
|
||||||
if (handlersIds == null) {
|
if (handlersIds == null) {
|
||||||
//handlersIds = Arrays.asList(GEOPORTAL_DATA_HANDLER.geoportal_data_list.getId(), GEOPORTAL_DATA_HANDLER.geoportal_data_entry.getId());
|
// handlersIds =
|
||||||
|
// Arrays.asList(GEOPORTAL_DATA_HANDLER.geoportal_data_list.getId(),
|
||||||
|
// GEOPORTAL_DATA_HANDLER.geoportal_data_entry.getId());
|
||||||
handlersIds = Arrays.asList(GEOPORTAL_DATA_HANDLER.geoportal_workflow_action_list.getId());
|
handlersIds = Arrays.asList(GEOPORTAL_DATA_HANDLER.geoportal_workflow_action_list.getId());
|
||||||
System.out.println("handlersIds is null, so using default: " + handlersIds);
|
System.out.println("handlersIds is null, so using default: " + handlersIds);
|
||||||
}
|
}
|
||||||
listUseCaseDescriptor = client.getListForHandlerIds(handlersIds);
|
listUseCaseDescriptor = client.getListForHandlerIds(handlersIds);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String error = "Error on contacting the Geoportal service";
|
e.printStackTrace();
|
||||||
System.out.println(error + " for handlers: " + handlersIds);
|
return;
|
||||||
throw new Exception(
|
|
||||||
"Error when contacting the Geoportal service. Refresh and try again or contact the support", e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listUseCaseDescriptor == null) {
|
if (listUseCaseDescriptor == null) {
|
||||||
|
@ -233,25 +315,25 @@ public class UCD_Tests {
|
||||||
for (HandlerDeclarationDV handler : handlers) {
|
for (HandlerDeclarationDV handler : handlers) {
|
||||||
ConfigurationDV<?> config = handler.getConfiguration();
|
ConfigurationDV<?> config = handler.getConfiguration();
|
||||||
System.out.println("\tConfig type:" + config.getConfigurationType());
|
System.out.println("\tConfig type:" + config.getConfigurationType());
|
||||||
//System.out.println("\tConfig:" + config.getConfiguration());
|
// System.out.println("\tConfig:" + config.getConfiguration());
|
||||||
switch (config.getConfigurationType()) {
|
switch (config.getConfigurationType()) {
|
||||||
case gcube_profiles:
|
case gcube_profiles:
|
||||||
List<GcubeProfileDV> listProfiles = toListGcubeProfiles(config);
|
List<GcubeProfileDV> listProfiles = toListGcubeProfiles(config);
|
||||||
System.out.println("\t\t"+listProfiles);
|
System.out.println("\t\t" + listProfiles);
|
||||||
break;
|
break;
|
||||||
case item_fields:
|
case item_fields:
|
||||||
List<ItemFieldDV> listItems = toListItemFields(config);
|
List<ItemFieldDV> listItems = toListItemFields(config);
|
||||||
System.out.println("\t\t"+listItems);
|
System.out.println("\t\t" + listItems);
|
||||||
break;
|
break;
|
||||||
case actions_definition:
|
case actions_definition:
|
||||||
List<ActionDefinitionDV> listActions = toListActionsDefinition(config);
|
List<ActionDefinitionDV> listActions = toListActionsDefinition(config);
|
||||||
System.out.println("\t\t"+listActions);
|
System.out.println("\t\t" + listActions);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
System.out.println("\n\n");
|
System.out.println("\n\n");
|
||||||
}
|
}
|
||||||
|
@ -290,7 +372,6 @@ public class UCD_Tests {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To list actions definition.
|
* To list actions definition.
|
||||||
|
|
Loading…
Reference in New Issue