Fixed test methods

This commit is contained in:
Fabio Sinibaldi 2021-09-21 18:03:18 +02:00
parent 7bc1cba00b
commit 2b9b4dede0
1 changed files with 16 additions and 11 deletions

View File

@ -3,6 +3,7 @@ package org.gcube.application.geoportal.clients;
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.statefulMongoConcessioni;
import static org.junit.Assert.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@ -37,28 +38,32 @@ public class StatefulClientTests extends BasicVreTests{
UploadedImage toRegisterImg= TestModel.prepareConcessione().getImmaginiRappresentative().get(0);
// TEMP Files are hosted in INFRASTRUCTURE's VOLATILE AREA
TempFile toUpload=storage.putOntoStorage(new FileInputStream(Files.getFileFromResources("test-data/concessioni/immagine.png")), "immagine.png");
TempFile toUpload=storage.putOntoStorage(
new File(TestModel.getBaseFolder(),"immagine.png"), "immagine.png");
manager.addImmagineRappresentativa(toRegisterImg, toUpload);
//Alternative Method
InputStreamDescriptor isDesc=new InputStreamDescriptor(new FileInputStream(Files.getFileFromResources("test-data/concessioni/immagine.png")), "immagine.png");
InputStreamDescriptor isDesc=
new InputStreamDescriptor(new FileInputStream(new File(TestModel.getBaseFolder(),
"immagine.png")), "immagine.png");
manager.addImmagineRappresentativa(toRegisterImg, isDesc);
//Relazione
manager.setRelazioneScavo(TestModel.prepareConcessione().getRelazioneScavo(),
storage.putOntoStorage(new FileInputStream(Files.getFileFromResources("test-data/concessioni/relazione.pdf")), "relazione_it.pdf"),
storage.putOntoStorage(new FileInputStream(Files.getFileFromResources("test-data/concessioni/relazione.pdf")), "relazione_en.pdf"));
storage.putOntoStorage(new File(TestModel.getBaseFolder(),"relazione.pdf"), "relazione_it.pdf"),
storage.putOntoStorage(new File(TestModel.getBaseFolder(),"relazione.pdf"), "relazione_en.pdf"));
// Posizionamento scavo
manager.setPosizionamento(TestModel.prepareConcessione().getPosizionamentoScavo(),
storage.putOntoStorage(new FileInputStream(Files.getFileFromResources("test-data/concessioni/pos.shp")), "pos.shp"));
storage.putOntoStorage(new File(TestModel.getBaseFolder(),"pos.shp"), "pos.shp"));
// Piante
manager.addPiantaFineScavo(TestModel.prepareConcessione().getPianteFineScavo().get(0),
storage.putOntoStorage(new FileInputStream(Files.getFileFromResources("test-data/concessioni/pianta.shp")), "pianta.shp"),
storage.putOntoStorage(new FileInputStream(Files.getFileFromResources("test-data/concessioni/pianta.shx")), "pianta.shx"));
storage.putOntoStorage(new File(TestModel.getBaseFolder(),"pianta.shp"), "pianta.shp"),
storage.putOntoStorage(new File(TestModel.getBaseFolder(),"pianta.shx"), "pianta.shx"));
return manager.publish();
}