47 lines
1.4 KiB
Java
47 lines
1.4 KiB
Java
package org.gcube.application.geoportal.common.model;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.concurrent.atomic.AtomicLong;
|
|
|
|
import org.gcube.application.geoportal.client.legacy.ConcessioniManager;
|
|
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
|
import org.gcube.application.geoportal.common.model.legacy.report.ValidationReport.ValidationStatus;
|
|
import org.junit.Before;
|
|
import org.junit.Test;
|
|
|
|
public class ConcessioniTests {
|
|
|
|
static boolean STOP_ON_FAIL=true;
|
|
|
|
@Before
|
|
public void setScope(){
|
|
// TokenSetter.set("/gcube/devNext/NextNext");
|
|
TokenSetter.set("/gcube/devsec/devVRE");
|
|
}
|
|
|
|
@Test
|
|
public void readAll() throws Exception {
|
|
ConcessioniManager manager=new ConcessioniManager();
|
|
ArrayList<Concessione> found=manager.getList();
|
|
System.out.println("Found "+found.size()+" elements.");
|
|
final AtomicLong byId=new AtomicLong(0);
|
|
final AtomicLong valid=new AtomicLong(0);
|
|
final AtomicLong error=new AtomicLong(0);
|
|
found.forEach((Concessione c )->{
|
|
try {
|
|
manager.getById(c.getId()+"");
|
|
byId.incrementAndGet();
|
|
if(c.validate().getStatus().equals(ValidationStatus.PASSED))
|
|
valid.incrementAndGet();
|
|
|
|
}catch(Throwable t) {
|
|
error.incrementAndGet();
|
|
if(STOP_ON_FAIL) {
|
|
throw new RuntimeException(t);
|
|
}else t.printStackTrace(System.err);
|
|
}
|
|
});
|
|
System.out.println("Valid count "+valid.get()+"Load BY ID : "+byId.get()+" Error : "+error.get()+" OUT OF "+found.size());
|
|
}
|
|
}
|