1
|
package eu.dnetlib.data.mdstore.plugins.objects;
|
2
|
|
3
|
import static org.junit.Assert.assertEquals;
|
4
|
import static org.junit.Assert.assertNotNull;
|
5
|
|
6
|
import java.util.Set;
|
7
|
import java.util.TreeSet;
|
8
|
|
9
|
import org.junit.Test;
|
10
|
|
11
|
import eu.dnetlib.data.utils.XsltFunctions;
|
12
|
|
13
|
public class ProjectTest {
|
14
|
|
15
|
@Test
|
16
|
public void testNewInstanceString_1() {
|
17
|
final String longId = "info:eu-repo/grantAgreement/EC/FP7/231167//Emergent Connectors for Eternal Software Intensive Networked Systems/CONNECT";
|
18
|
|
19
|
final Project p = Project.newInstance(longId);
|
20
|
assertNotNull(p);
|
21
|
assertEquals(p.getFunder(), "EC");
|
22
|
assertEquals(p.getProgram(), "FP7");
|
23
|
assertEquals(p.getCode(), "231167");
|
24
|
assertEquals(p.getJurisdiction(), "");
|
25
|
assertEquals(p.getName(), "Emergent Connectors for Eternal Software Intensive Networked Systems");
|
26
|
assertEquals(p.getAcronym(), "CONNECT");
|
27
|
assertEquals(p.getOpenaireId(), "");
|
28
|
|
29
|
assertEquals(longId, XsltFunctions.projectLongId(p.getFunder(), p.getProgram(), p.getCode(), p.getJurisdiction(), p.getName(), p.getAcronym()));
|
30
|
}
|
31
|
|
32
|
@Test
|
33
|
public void testNewInstanceString_2() {
|
34
|
final String longId = "info:eu-repo/grantAgreement/EC/FP7/231167/EU/Emergent Connectors for Eternal Software Intensive Networked Systems/CONNECT";
|
35
|
|
36
|
final Project p = Project.newInstance(longId);
|
37
|
assertNotNull(p);
|
38
|
assertEquals(p.getFunder(), "EC");
|
39
|
assertEquals(p.getProgram(), "FP7");
|
40
|
assertEquals(p.getCode(), "231167");
|
41
|
assertEquals(p.getJurisdiction(), "EU");
|
42
|
assertEquals(p.getName(), "Emergent Connectors for Eternal Software Intensive Networked Systems");
|
43
|
assertEquals(p.getAcronym(), "CONNECT");
|
44
|
assertEquals(p.getOpenaireId(), "");
|
45
|
|
46
|
assertEquals(longId, XsltFunctions.projectLongId(p.getFunder(), p.getProgram(), p.getCode(), p.getJurisdiction(), p.getName(), p.getAcronym()));
|
47
|
}
|
48
|
|
49
|
@Test
|
50
|
public void testNewInstanceString_3() {
|
51
|
final String longId =
|
52
|
"info:eu-repo/grantAgreement/EC/H2020/871793//Adaptive edge%2Fcloud compute and network continuum over a heterogeneous sparse edge infrastructure to support nextgen applications/ACCORDION";
|
53
|
|
54
|
final Project p = Project.newInstance(longId);
|
55
|
assertNotNull(p);
|
56
|
assertEquals(p.getFunder(), "EC");
|
57
|
assertEquals(p.getProgram(), "H2020");
|
58
|
assertEquals(p.getCode(), "871793");
|
59
|
assertEquals(p.getJurisdiction(), "");
|
60
|
assertEquals(p.getName(),
|
61
|
"Adaptive edge/cloud compute and network continuum over a heterogeneous sparse edge infrastructure to support nextgen applications");
|
62
|
assertEquals(p.getAcronym(), "ACCORDION");
|
63
|
assertEquals(p.getOpenaireId(), "");
|
64
|
|
65
|
assertEquals(longId, XsltFunctions.projectLongId(p.getFunder(), p.getProgram(), p.getCode(), p.getJurisdiction(), p.getName(), p.getAcronym()));
|
66
|
}
|
67
|
|
68
|
@Test
|
69
|
public void testNewInstanceString_4() {
|
70
|
final Project p = Project.newInstance(
|
71
|
"info:eu-repo/grantAgreement/EC/FP4/FMBI983160//Algorithms for analysis of cosmic microwave background data from the very small array and the Planck surveyor satellite/");
|
72
|
System.out.println(p);
|
73
|
assertNotNull(p);
|
74
|
}
|
75
|
|
76
|
@Test
|
77
|
public void test_1() {
|
78
|
final Project pr1 = new Project();
|
79
|
pr1.setName("1");
|
80
|
final Project pr2 = new Project();
|
81
|
pr2.setName("2");
|
82
|
|
83
|
final Set<Project> projects = new TreeSet<>((p1, p2) -> p1.getName().compareTo(p2.getName()));
|
84
|
|
85
|
projects.add(pr1);
|
86
|
projects.add(pr2);
|
87
|
|
88
|
assertEquals(2, projects.size());
|
89
|
}
|
90
|
|
91
|
}
|