Refactored tests

This commit is contained in:
Francesco Mangiacrapa 2024-04-11 09:43:09 +02:00
parent 87570b3e8c
commit 732cc92702
10 changed files with 63 additions and 65 deletions

View File

@ -1,5 +1,8 @@
# Changelog for org.gcube.application.geoportal-client # Changelog for org.gcube.application.geoportal-client
## [v1.2.2-SNAPSHOT] - 2024-04-11
- Refactored
## [v1.2.1] - 2023-09-06 ## [v1.2.1] - 2023-09-06
- Using parent version range [#25572] - Using parent version range [#25572]

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.gcube.application</groupId> <groupId>org.gcube.application</groupId>
<artifactId>geoportal-client</artifactId> <artifactId>geoportal-client</artifactId>
<version>1.2.1</version> <version>1.2.2-SNAPSHOT</version>
<name>Geoportal Client</name> <name>Geoportal Client</name>
<parent> <parent>

View File

@ -1,10 +1,10 @@
package org.gcube.application.geoportal; package org.gcube.application.geoportal;
import java.io.IOException;
import org.gcube.application.cms.tests.TokenSetter; import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.geoportal.common.utils.StorageUtils; import org.gcube.application.geoportal.common.utils.StorageUtils;
import java.io.IOException;
public class StorageTests { public class StorageTests {
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {

View File

@ -1,11 +1,11 @@
package org.gcube.application.geoportal.clients; package org.gcube.application.geoportal.clients;
import static org.junit.Assume.assumeTrue;
import org.gcube.application.cms.tests.TokenSetter; import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest; import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import static org.junit.Assume.assumeTrue;
public class BasicVreTests extends GCubeTest { public class BasicVreTests extends GCubeTest {
@BeforeClass @BeforeClass

View File

@ -1,6 +1,11 @@
package org.gcube.application.geoportal.clients; package org.gcube.application.geoportal.clients;
import com.fasterxml.jackson.core.JsonProcessingException; import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.projects;
import java.io.File;
import java.io.FileNotFoundException;
import java.rmi.RemoteException;
import org.bson.Document; import org.bson.Document;
import org.gcube.application.cms.tests.Tests; import org.gcube.application.cms.tests.Tests;
import org.gcube.application.geoportal.client.utils.Serialization; import org.gcube.application.geoportal.client.utils.Serialization;
@ -12,11 +17,7 @@ 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 org.junit.Test; import org.junit.Test;
import java.io.File; import com.fasterxml.jackson.core.JsonProcessingException;
import java.io.FileNotFoundException;
import java.rmi.RemoteException;
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.projects;
public abstract class GenericUseCases extends BasicVreTests{ public abstract class GenericUseCases extends BasicVreTests{

View File

@ -1,8 +1,15 @@
package org.gcube.application.geoportal.clients; package org.gcube.application.geoportal.clients;
import com.fasterxml.jackson.core.JsonProcessingException; import static org.junit.Assert.assertEquals;
import lombok.Data; import static org.junit.Assert.assertTrue;
import lombok.extern.slf4j.Slf4j; import static org.junit.Assume.assumeTrue;
import java.io.File;
import java.io.FileNotFoundException;
import java.nio.charset.Charset;
import java.rmi.RemoteException;
import java.util.Iterator;
import org.bson.Document; import org.bson.Document;
import org.gcube.application.cms.tests.TestDocuments; import org.gcube.application.cms.tests.TestDocuments;
import org.gcube.application.cms.tests.Tests; import org.gcube.application.cms.tests.Tests;
@ -28,16 +35,10 @@ import org.gcube.application.geoportal.common.utils.StorageUtils;
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 java.io.File; import com.fasterxml.jackson.core.JsonProcessingException;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.charset.Charset;
import java.rmi.RemoteException;
import java.util.Iterator;
import static org.junit.Assert.assertEquals; import lombok.Data;
import static org.junit.Assert.assertTrue; import lombok.extern.slf4j.Slf4j;
import static org.junit.Assume.assumeTrue;
@Slf4j @Slf4j
public class ProfiledConcessioniTest <M extends Project,C extends Projects<M>> extends GenericUseCases{ public class ProfiledConcessioniTest <M extends Project,C extends Projects<M>> extends GenericUseCases{
@ -66,8 +67,8 @@ public class ProfiledConcessioniTest <M extends Project,C extends Projects<M>> e
Project p=client.createNew(getNewDocument()); Project p=client.createNew(getNewDocument());
p=prepareWithFileSet(p); p=prepareWithFileSet(p);
String optionalMessage = null;
p = getClient().performStep(p.getId(), new StepExecutionRequest("SUBMIT-FOR-REVIEW",new Document())); p = getClient().performStep(p.getId(), new StepExecutionRequest("SUBMIT-FOR-REVIEW", optionalMessage, new Document()));
System.out.println("Result is "+Serialization.write(p)); System.out.println("Result is "+Serialization.write(p));
} }

View File

@ -1,9 +1,15 @@
package org.gcube.application.geoportal.clients; package org.gcube.application.geoportal.clients;
import com.fasterxml.jackson.core.JsonProcessingException; import static org.gcube.application.geoportal.client.utils.Serialization.write;
import lombok.extern.slf4j.Slf4j; import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeTrue;
import java.io.FileNotFoundException;
import java.rmi.RemoteException;
import java.time.LocalDateTime;
import java.util.concurrent.atomic.AtomicLong;
import org.bson.Document; import org.bson.Document;
import org.gcube.application.cms.tests.Tests;
import org.gcube.application.geoportal.client.utils.Serialization; import org.gcube.application.geoportal.client.utils.Serialization;
import org.gcube.application.geoportal.common.faults.InvalidRequestException; import org.gcube.application.geoportal.common.faults.InvalidRequestException;
import org.gcube.application.geoportal.common.model.JSONPathWrapper; import org.gcube.application.geoportal.common.model.JSONPathWrapper;
@ -12,28 +18,15 @@ import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.document.access.Access; import org.gcube.application.geoportal.common.model.document.access.Access;
import org.gcube.application.geoportal.common.model.document.access.AccessPolicy; import org.gcube.application.geoportal.common.model.document.access.AccessPolicy;
import org.gcube.application.geoportal.common.model.document.filesets.RegisteredFileSet; import org.gcube.application.geoportal.common.model.document.filesets.RegisteredFileSet;
import org.gcube.application.geoportal.common.model.document.relationships.RelationshipNavigationObject;
import org.gcube.application.geoportal.common.model.rest.CreateRelationshipRequest;
import org.gcube.application.geoportal.common.model.rest.DeleteRelationshipRequest;
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.rest.RegisterFileSetRequest; import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
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.StorageUtils;
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 java.io.File; import com.fasterxml.jackson.core.JsonProcessingException;
import java.io.FileNotFoundException;
import java.rmi.RemoteException;
import java.time.LocalDateTime;
import java.util.Iterator;
import java.util.concurrent.atomic.AtomicLong;
import static org.gcube.application.geoportal.client.utils.Serialization.write; import lombok.extern.slf4j.Slf4j;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
@Slf4j @Slf4j
public class ProfiledDocumentsTest<M extends Project,C extends Projects<M>> extends GenericUseCases { public class ProfiledDocumentsTest<M extends Project,C extends Projects<M>> extends GenericUseCases {

View File

@ -1,5 +1,13 @@
package org.gcube.application.geoportal.clients; package org.gcube.application.geoportal.clients;
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.useCaseDescriptors;
import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeTrue;
import java.util.Arrays;
import java.util.HashSet;
import java.util.concurrent.atomic.AtomicLong;
import org.bson.Document; import org.bson.Document;
import org.gcube.application.cms.tests.TokenSetter; import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.geoportal.client.utils.Serialization; import org.gcube.application.geoportal.client.utils.Serialization;
@ -12,15 +20,6 @@ import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.concurrent.atomic.AtomicLong;
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.useCaseDescriptors;
import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeTrue;
public class UCDTests{ public class UCDTests{

View File

@ -1,12 +1,13 @@
package org.gcube.application.geoportal.clients.serialization; package org.gcube.application.geoportal.clients.serialization;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.geoportal.client.utils.Serialization;
import org.junit.Test;
import java.io.IOException; import java.io.IOException;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import org.gcube.application.geoportal.client.utils.Serialization;
import org.junit.Test;
import lombok.extern.slf4j.Slf4j;
@Slf4j @Slf4j
public class SerializationTests { public class SerializationTests {

View File

@ -1,5 +1,14 @@
package org.gcube.application.geoportal.clients.serialization; package org.gcube.application.geoportal.clients.serialization;
import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertTrue;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.List;
import java.util.Map;
import org.gcube.application.cms.tests.TestProfiles; import org.gcube.application.cms.tests.TestProfiles;
import org.gcube.application.geoportal.client.utils.Serialization; import org.gcube.application.geoportal.client.utils.Serialization;
import org.gcube.application.geoportal.common.model.JSONPathWrapper; import org.gcube.application.geoportal.common.model.JSONPathWrapper;
@ -9,15 +18,6 @@ import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDes
import org.gcube.application.geoportal.common.utils.Files; import org.gcube.application.geoportal.common.utils.Files;
import org.junit.Test; import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.List;
import java.util.Map;
import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertTrue;
public class UseCaseDescriptors { public class UseCaseDescriptors {
private static UseCaseDescriptor readProfile(String file) throws IOException { private static UseCaseDescriptor readProfile(String file) throws IOException {