Fixed Client default init

This commit is contained in:
Fabio Sinibaldi 2022-04-22 11:04:25 +02:00
parent d6521900b5
commit 417a014fe7
5 changed files with 24 additions and 12 deletions

View File

@ -134,7 +134,8 @@ public class DefaultDocumentsClient<T extends Project> implements Projects<T> {
return Serialization.readCollection(jsonString,clazz); return Serialization.readCollection(jsonString,clazz);
} catch (IOException e) { } catch (IOException e) {
log.error("Unable to deserialize result as "+clazz,e); log.error("Unable to deserialize result as "+clazz,e);
log.debug("Query request was ",request); log.debug("Query request was {} ",request);
log.debug("Query result was {} ",jsonString);
throw new RemoteException("Invalid format for submitted query"); throw new RemoteException("Invalid format for submitted query");
} }
} }

View File

@ -2,6 +2,7 @@ package org.gcube.application.geoportal.client.plugins;
import javax.ws.rs.client.WebTarget; import javax.ws.rs.client.WebTarget;
import org.gcube.application.geoportal.client.DefaultDocumentsClient;
import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI; import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
import org.gcube.application.geoportal.client.legacy.ConcessioniPlugin; import org.gcube.application.geoportal.client.legacy.ConcessioniPlugin;
import org.gcube.application.geoportal.client.legacy.MongoConcessioniPlugin; import org.gcube.application.geoportal.client.legacy.MongoConcessioniPlugin;

View File

@ -28,11 +28,10 @@ public class ProjectsInterfacePlugin<C extends DefaultDocumentsClient,P extends
private String profileID; private String profileID;
@Setter @Setter
private Class<C> customClientImplementation; private Class<C> customClientImplementation= (Class<C>) DefaultDocumentsClient.class;
//=DefaultProfiledDocuments.class;
@Setter @Setter
private Class<P> profiledModel; private Class<P> profiledModel= (Class<P>) Project.class;
@Override @Override
public Exception convert(Exception fault, ProxyConfig<?, ?> config) { public Exception convert(Exception fault, ProxyConfig<?, ?> config) {

View File

@ -6,24 +6,34 @@ import org.gcube.application.cms.tests.model.concessioni.TestConcessioniModel;
import org.gcube.application.geoportal.client.utils.Serialization; import org.gcube.application.geoportal.client.utils.Serialization;
import org.gcube.application.geoportal.common.model.document.Project; import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest; import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
import org.gcube.application.geoportal.common.rest.Projects; import org.gcube.application.geoportal.common.rest.Projects;
import org.gcube.application.geoportal.common.utils.FileSets; import org.gcube.application.geoportal.common.utils.FileSets;
import org.gcube.application.geoportal.common.utils.StorageUtils; import org.gcube.application.geoportal.common.utils.StorageUtils;
import javax.jws.soap.SOAPBinding;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.projects; import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.projects;
public class GenericUseCases { public abstract class GenericUseCases extends BasicVreTests{
public Projects<Project> getClient(String profileID){ protected String getUCID(){ return "basic";}
protected Projects<Project> getClient(String profileID){
return projects(profileID).build(); return projects(profileID).build();
} }
protected Projects<Project> getClient(){
return getClient(getUCID());
}
public void createNew () throws RemoteException, FileNotFoundException, JsonProcessingException { public void createNew () throws RemoteException, FileNotFoundException, JsonProcessingException {
String profileID=null; String profileID=getUCID();
String myJSON=null; String myJSON=null;
Document myDocument = Document.parse(myJSON); Document myDocument = Document.parse(myJSON);

View File

@ -7,6 +7,7 @@ import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportal.common.rest.Projects; import org.gcube.application.geoportal.common.rest.Projects;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest; import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.junit.Test; import org.junit.Test;
import sun.net.www.content.text.Generic;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
@ -15,13 +16,13 @@ import static junit.framework.TestCase.assertTrue;
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.*; import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.*;
import static org.junit.Assume.assumeTrue; import static org.junit.Assume.assumeTrue;
public class ProfiledDocumentsTest<M extends Project,C extends Projects<M>> extends BasicVreTests{ public class ProfiledDocumentsTest<M extends Project,C extends Projects<M>> extends GenericUseCases {
protected String getProfileID(){return "profiledConcessioni";} // protected String getProfileID(){return "basic";}
protected C getClient(){ // protected C getClient(){
return (C) customModel(getProfileID(), Project.class, DefaultDocumentsClient.class).build(); // return (C) customModel(getProfileID(), Project.class, DefaultDocumentsClient.class).build();
} // }
@Test @Test