updated some log levels

This commit is contained in:
Francesco Mangiacrapa 2022-11-25 14:35:59 +01:00
parent df334c45a8
commit 7656bc01ed
5 changed files with 51 additions and 47 deletions

View File

@ -634,7 +634,7 @@ public class ConvertToDataValueObjectModel {
if (project == null)
return null;
LOG.info("toResultDocumentDV called for project id: {}", project.getId());
LOG.debug("toResultDocumentDV called for project id: {}", project.getId());
if (LOG.isTraceEnabled())
LOG.trace("Source project is: " + project);
@ -680,7 +680,7 @@ public class ConvertToDataValueObjectModel {
if (LOG.isDebugEnabled())
LOG.debug("Returning: " + rd);
LOG.info("Returning " + ResultDocumentDV.class.getSimpleName() + " with id: " + rd.getId());
LOG.debug("Returning " + ResultDocumentDV.class.getSimpleName() + " with id: " + rd.getId());
return rd;
} catch (Exception e) {
LOG.error("Error on converting " + ResultDocumentDV.class.getSimpleName() + ": " + project, e);
@ -989,7 +989,7 @@ public class ConvertToDataValueObjectModel {
for (String possibleDate : KEYSET_POSSIBLE_DATE) {
if (keyLower.contains(possibleDate)) {
try {
LOG.debug("value " + value + " is instance of: " + value.getClass());
LOG.trace("value " + value + " is instance of: " + value.getClass());
String asDate = instantToDateFormatString(value.toString());
value = asDate;

View File

@ -4,8 +4,6 @@ import org.gcube.application.geoportalcommon.GNADataEntryConfigProfileReader;
import org.gcube.application.geoportalcommon.shared.GNADataEntryConfigProfile;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.scope.api.ScopeProvider;
import org.junit.Before;
import org.junit.Test;
public class IS_Read_Configurations_Tests {
@ -19,7 +17,7 @@ public class IS_Read_Configurations_Tests {
SecurityTokenProvider.instance.set(TOKEN);
}
@Test
//@Test
public void loadGNA_DataEntry_Configs() throws Exception{
ScopeProvider.instance.set(CONTEXT);
GNADataEntryConfigProfileReader dataEntryConfigs = new GNADataEntryConfigProfileReader();

View File

@ -1,26 +1,23 @@
package org.gcube.application;
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.projects;
import java.io.IOException;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import org.bson.Document;
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.document.relationships.Relationship;
import org.gcube.application.geoportal.common.model.document.relationships.RelationshipNavigationObject;
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
import org.gcube.application.geoportalcommon.ProjectDVBuilder;
import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller;
@ -29,7 +26,6 @@ import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.SearchingFilter.LOGICAL_OP;
import org.gcube.application.geoportalcommon.shared.WhereClause;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.PhaseDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
@ -51,11 +47,14 @@ public class Project_Tests {
// private static String CONTEXT = "/pred4s/preprod/preVRE";
// private static String TOKEN = ""; //preVRE
private static String CONTEXT = "/gcube/devsec/devVRE";
private static String TOKEN = ""; // devVRE
//private static String CONTEXT = "/gcube/devsec/devVRE";
//private static String TOKEN = ""; // devVRE
private static String PROFILE_ID = "profiledConcessioni";
private static String PROJECT_ID = "6365485fa8d67f4c82794cc4";
private static String CONTEXT = "/pred4s/preprod/preVRE";
private static String TOKEN = ""; //preVRE
@Before
public void getClient() {
// assumeTrue(GCubeTest.isTestInfrastructureEnabled());
@ -132,38 +131,47 @@ public class Project_Tests {
// searchInto.put("_theDocument.editore", "scavo");
// searchInto.put("_theDocument.paroleChiaveICCD", "scavo");
// searchInto.put("_theDocument.responsabile", "scavo");
searchInto.put("_theDocument.dataInizioProgetto", "2019");
WhereClause whereClause = new WhereClause(LOGICAL_OP.OR, searchInto);
conditions.add(whereClause);
filter.setConditions(conditions);
List<ItemFieldDV> orderByFields = new ArrayList<ItemFieldDV>();
List<String> jsonFields = Arrays.asList("_theDocument.dataInizioProgetto");
ItemFieldDV itemField = new ItemFieldDV("dataInizioProgetto", jsonFields, "$or", false, false, false);
orderByFields.add(itemField);
filter.setOrderByFields(orderByFields);
/* ORDER BY */
// List<ItemFieldDV> orderByFields = new ArrayList<ItemFieldDV>();
// List<String> jsonFields = Arrays.asList("_theDocument.dataInizioProgetto");
// ItemFieldDV itemField = new ItemFieldDV("dataInizioProgetto", jsonFields, "$or", false, false, false);
// orderByFields.add(itemField);
// filter.setOrderByFields(orderByFields);
LinkedHashMap<String, Object> projection = new LinkedHashMap<String, Object>();
// default
projection.put("_theDocument.nome", 1);
projection.put("_profileID", 1);
projection.put("_profileVersion", 1);
projection.put("_version", 1);
projection.put("_theDocument", 1);
projection.put("_theDocument.paroleChiaveLibere", 1);
projection.put("_theDocument.editore", 1);
projection.put("_theDocument.paroleChiaveICCD", 1);
projection.put("_theDocument.responsabile", 1);
projection.put("_theDocument.introduzione", 1);
projection.put("_theDocument.authors", 1);
projection.put("_theDocument.dataInizioProgetto", 1);
//PROJECTION
projection.put(Project.ID, 1);
// projection.put("_theDocument.nome", 1);
// projection.put("_profileID", 1);
// projection.put("_profileVersion", 1);
// projection.put("_version", 1);
// projection.put("_theDocument", 1);
//
// projection.put("_theDocument.paroleChiaveLibere", 1);
// projection.put("_theDocument.editore", 1);
// projection.put("_theDocument.paroleChiaveICCD", 1);
// projection.put("_theDocument.responsabile", 1);
//
// projection.put("_theDocument.introduzione", 1);
// projection.put("_theDocument.authors", 1);
// projection.put("_theDocument.dataInizioProgetto", 1);
filter.setProjection(projection);
Integer totalDocs = client.getTotalDocument(PROFILE_ID);
Iterator<Project> projects = client.queryOnMongo(PROFILE_ID, totalDocs, 0, null, filter);
Iterable<Project> itP = () -> projects;
Stream<Project> targetStream = StreamSupport.stream(itP.spliterator(), false);
List<String> listProjectIDs = targetStream.map(Project::getId).collect(Collectors.toList());
Iterator<Project> projects = client.queryOnMongo(PROFILE_ID, totalDocs, 0, 10, filter);
List<ResultDocumentDV> results = ConvertToDataValueObjectModel.toListResultDocument(projects);
int i = 0;

View File

@ -5,7 +5,6 @@ import org.gcube.application.geoportalcommon.shared.GNADataEntryConfigProfile;
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.config.RoleRights;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.scope.api.ScopeProvider;

View File

@ -26,8 +26,6 @@ import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.scope.api.ScopeProvider;
import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.Before;
import org.junit.Test;
import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.spi.json.JsonOrgJsonProvider;
@ -43,11 +41,11 @@ public class UCD_Tests {
private UseCaseDescriptorCaller client = null;
// private static String CONTEXT = "/pred4s/preprod/preVRE";
// private static String TOKEN = ""; //preVRE
private static String CONTEXT = "/pred4s/preprod/preVRE";
private static String TOKEN = ""; //preVRE
private static String CONTEXT = "/gcube/devsec/devVRE";
private static String TOKEN = ""; // devVRE
//private static String CONTEXT = "/gcube/devsec/devVRE";
//private static String TOKEN = ""; // devVRE
private static String PROFILE_ID = "profiledConcessioni";
@ -56,7 +54,7 @@ public class UCD_Tests {
*
* @return the client
*/
@Before
//@Before
public void getClient() {
// assumeTrue(GCubeTest.isTestInfrastructureEnabled());
ScopeProvider.instance.set(CONTEXT);
@ -211,7 +209,7 @@ public class UCD_Tests {
try {
UseCaseDescriptorCaller client = GeoportalClientCaller.useCaseDescriptors();
ucd = client.getUCDForId(PROFILE_ID);
handlers = client.getHandlersByType(PROFILE_ID, GEOPORTAL_DATA_HANDLER.gna_concessioni_lc.getType());
handlers = client.getHandlersByType(PROFILE_ID, GEOPORTAL_DATA_HANDLER.geoportal_basic_data_list.getType());
} catch (Exception e) {
e.printStackTrace();
@ -220,6 +218,7 @@ public class UCD_Tests {
for (HandlerDeclaration handlerDeclaration : handlers) {
System.out.println(handlerDeclaration);
System.out.println("Config json: "+handlerDeclaration.getConfiguration().toJson());
}
}