2021-09-02 18:11:36 +02:00
|
|
|
package org.gcube.application.geoportal.clients.legacy;
|
2020-11-19 11:25:45 +01:00
|
|
|
|
|
|
|
import java.util.ArrayList;
|
2020-11-24 12:40:22 +01:00
|
|
|
import java.util.concurrent.atomic.AtomicLong;
|
2020-11-19 11:25:45 +01:00
|
|
|
|
|
|
|
import org.gcube.application.geoportal.client.legacy.ConcessioniManager;
|
2021-09-02 18:11:36 +02:00
|
|
|
import org.gcube.application.geoportal.clients.BasicVreTests;
|
2020-11-19 11:25:45 +01:00
|
|
|
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
2020-12-10 12:50:57 +01:00
|
|
|
import org.gcube.application.geoportal.common.model.legacy.GeoServerContent;
|
|
|
|
import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
|
|
|
|
import org.gcube.application.geoportal.common.model.legacy.PersistedContent;
|
2020-11-24 12:40:22 +01:00
|
|
|
import org.gcube.application.geoportal.common.model.legacy.report.ValidationReport.ValidationStatus;
|
2020-11-19 11:25:45 +01:00
|
|
|
import org.junit.Test;
|
|
|
|
|
2021-09-02 18:11:36 +02:00
|
|
|
public class ConcessioniTests extends BasicVreTests {
|
2020-11-19 11:25:45 +01:00
|
|
|
|
2020-11-24 12:40:22 +01:00
|
|
|
static boolean STOP_ON_FAIL=true;
|
|
|
|
|
2021-01-14 12:48:52 +01:00
|
|
|
|
2020-11-19 11:25:45 +01:00
|
|
|
|
|
|
|
@Test
|
|
|
|
public void readAll() throws Exception {
|
2020-11-24 12:40:22 +01:00
|
|
|
ConcessioniManager manager=new ConcessioniManager();
|
2020-11-19 11:25:45 +01:00
|
|
|
ArrayList<Concessione> found=manager.getList();
|
2020-11-24 12:40:22 +01:00
|
|
|
System.out.println("Found "+found.size()+" elements.");
|
|
|
|
final AtomicLong byId=new AtomicLong(0);
|
2020-11-30 15:16:41 +01:00
|
|
|
|
|
|
|
final ArrayList<Long> validIDs=new ArrayList<>();
|
|
|
|
|
|
|
|
final ArrayList<Long> imgs=new ArrayList<Long>();
|
2020-11-24 12:40:22 +01:00
|
|
|
final AtomicLong error=new AtomicLong(0);
|
2020-12-10 12:50:57 +01:00
|
|
|
|
|
|
|
final ArrayList<Long> piante=new ArrayList<Long>();
|
|
|
|
final ArrayList<Long> pos=new ArrayList<Long>();
|
|
|
|
final ArrayList<Long> wmsLink=new ArrayList<Long>();
|
|
|
|
|
2020-11-24 12:40:22 +01:00
|
|
|
found.forEach((Concessione c )->{
|
|
|
|
try {
|
|
|
|
manager.getById(c.getId()+"");
|
|
|
|
byId.incrementAndGet();
|
|
|
|
if(c.validate().getStatus().equals(ValidationStatus.PASSED))
|
2020-11-30 15:16:41 +01:00
|
|
|
validIDs.add(c.getId());
|
|
|
|
if(c.getImmaginiRappresentative()!=null&&c.getImmaginiRappresentative().size()>0)
|
|
|
|
imgs.add(c.getId());
|
2020-12-10 12:50:57 +01:00
|
|
|
if(c.getPianteFineScavo()!=null)
|
|
|
|
c.getPianteFineScavo().forEach((LayerConcessione l)->{
|
|
|
|
if(l.getActualContent()!=null)
|
|
|
|
l.getActualContent().forEach((PersistedContent p)->{
|
|
|
|
if(p instanceof GeoServerContent) piante.add(c.getId());
|
|
|
|
});
|
|
|
|
if(l.getWmsLink()!=null) wmsLink.add(c.getId());
|
|
|
|
});
|
|
|
|
|
|
|
|
if(c.getPosizionamentoScavo()!=null) {
|
|
|
|
LayerConcessione l=c.getPosizionamentoScavo();
|
|
|
|
l.getActualContent().forEach((PersistedContent p)->{
|
|
|
|
if(p instanceof GeoServerContent) pos.add(c.getId());
|
|
|
|
});
|
|
|
|
if(l.getWmsLink()!=null) wmsLink.add(c.getId());
|
|
|
|
}
|
2020-11-24 12:40:22 +01:00
|
|
|
}catch(Throwable t) {
|
|
|
|
error.incrementAndGet();
|
|
|
|
if(STOP_ON_FAIL) {
|
|
|
|
throw new RuntimeException(t);
|
|
|
|
}else t.printStackTrace(System.err);
|
|
|
|
}
|
|
|
|
});
|
2020-11-30 15:16:41 +01:00
|
|
|
System.out.println("Valid count "+validIDs.size()+ "Load BY ID : "+byId.get()+" Error : "+error.get()+" OUT OF "+found.size());
|
|
|
|
System.out.println("Valid IDS "+validIDs);
|
|
|
|
System.out.println("With imgs : "+imgs);
|
2020-12-10 12:50:57 +01:00
|
|
|
System.out.println("With piante : "+piante);
|
|
|
|
System.out.println("With pos : "+pos);
|
|
|
|
System.out.println("With wmsLink : "+wmsLink);
|
2020-11-19 11:25:45 +01:00
|
|
|
}
|
2020-11-30 15:16:41 +01:00
|
|
|
|
2020-12-10 12:50:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-09-02 18:11:36 +02:00
|
|
|
|
2020-11-19 11:25:45 +01:00
|
|
|
}
|