1 |
51465
|
alessia.ba
|
package eu.dnetlib.parthenos.virtuoso;
|
2 |
|
|
|
3 |
|
|
import java.io.IOException;
|
4 |
51767
|
alessia.ba
|
import java.util.List;
|
5 |
51465
|
alessia.ba
|
|
6 |
|
|
import eu.dnetlib.parthenos.CRM;
|
7 |
|
|
import eu.dnetlib.parthenos.CRMdig;
|
8 |
|
|
import eu.dnetlib.parthenos.CRMpe;
|
9 |
51473
|
alessia.ba
|
import eu.dnetlib.parthenos.publisher.ParthenosPublisherException;
|
10 |
51465
|
alessia.ba
|
import freemarker.template.TemplateException;
|
11 |
52531
|
alessia.ba
|
import org.junit.Ignore;
|
12 |
51465
|
alessia.ba
|
import org.junit.Test;
|
13 |
|
|
import org.junit.runner.RunWith;
|
14 |
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
15 |
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
16 |
|
|
import org.springframework.test.context.TestPropertySource;
|
17 |
|
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
18 |
|
|
|
19 |
51767
|
alessia.ba
|
import static org.junit.Assert.assertFalse;
|
20 |
|
|
import static org.junit.Assert.assertTrue;
|
21 |
|
|
|
22 |
51465
|
alessia.ba
|
/**
|
23 |
|
|
* Created by Alessia Bardi on 24/03/2018.
|
24 |
|
|
*
|
25 |
|
|
* @author Alessia Bardi
|
26 |
|
|
*/
|
27 |
52531
|
alessia.ba
|
@Ignore
|
28 |
51465
|
alessia.ba
|
@RunWith(SpringJUnit4ClassRunner.class)
|
29 |
|
|
@SpringBootTest
|
30 |
|
|
@TestPropertySource(
|
31 |
|
|
locations = "classpath:application-integrationtest.properties")
|
32 |
|
|
public class VirtuosoReadAPIIntegrationTest {
|
33 |
|
|
|
34 |
52532
|
alessia.ba
|
private static String TIMEOUT = "3000";
|
35 |
52530
|
alessia.ba
|
|
36 |
51465
|
alessia.ba
|
@Autowired
|
37 |
|
|
private VirtuosoReadAPI virtuosoReadAPI;
|
38 |
|
|
|
39 |
|
|
@Test
|
40 |
51481
|
alessia.ba
|
public void testVolatileDataset1() throws IOException, TemplateException, ParthenosPublisherException {
|
41 |
52530
|
alessia.ba
|
virtuosoReadAPI.getSubject("http://parthenos.d4science.org/handle/Parthenos/REG/Dataset/CoCoON%20Dataset", CRMpe.PE18_Dataset.getLocalName(), TIMEOUT, System.out);
|
42 |
51465
|
alessia.ba
|
}
|
43 |
|
|
|
44 |
|
|
@Test
|
45 |
51481
|
alessia.ba
|
public void testSoftware() throws IOException, TemplateException, ParthenosPublisherException {
|
46 |
52530
|
alessia.ba
|
virtuosoReadAPI.getSubject("http://parthenos.d4science.org/handle/Parthenos/REG/Software/ACDM", CRMdig.D14_Software.getLocalName(), TIMEOUT, System.out);
|
47 |
51481
|
alessia.ba
|
}
|
48 |
|
|
|
49 |
|
|
@Test
|
50 |
51473
|
alessia.ba
|
public void testRIConsortium() throws IOException, TemplateException, ParthenosPublisherException {
|
51 |
52530
|
alessia.ba
|
virtuosoReadAPI.getSubject("http://parthenos.d4science.org/handle/Parthenos/REG/Actor/Cendari%20Consortium", CRM.E39_Actor.getLocalName(), TIMEOUT, System.out);
|
52 |
51465
|
alessia.ba
|
}
|
53 |
|
|
|
54 |
|
|
@Test
|
55 |
51473
|
alessia.ba
|
public void testPerson() throws IOException, TemplateException, ParthenosPublisherException {
|
56 |
52530
|
alessia.ba
|
virtuosoReadAPI.getSubject("http://parthenos.d4science.org/handle/Parthenos/REG/Actor/Eleni%20Vernardaki", CRM.E39_Actor.getLocalName(), TIMEOUT, System.out);
|
57 |
51465
|
alessia.ba
|
}
|
58 |
|
|
|
59 |
|
|
@Test
|
60 |
51473
|
alessia.ba
|
public void testService() throws IOException, TemplateException, ParthenosPublisherException {
|
61 |
52530
|
alessia.ba
|
virtuosoReadAPI.getSubject("http://parthenos.d4science.org/handle/Parthenos/REG/Service/Isidore", CRMpe.PE1_Service.getLocalName(), TIMEOUT, System.out);
|
62 |
51465
|
alessia.ba
|
}
|
63 |
|
|
|
64 |
|
|
@Test
|
65 |
51691
|
alessia.ba
|
public void testService2() throws IOException, TemplateException, ParthenosPublisherException {
|
66 |
52530
|
alessia.ba
|
virtuosoReadAPI.getSubject("http://parthenos.d4science.org/handle/Parthenos/REG/Service/LRE%20Map", CRMpe.PE1_Service.getLocalName(), TIMEOUT, System.out);
|
67 |
51691
|
alessia.ba
|
}
|
68 |
|
|
|
69 |
|
|
@Test
|
70 |
52530
|
alessia.ba
|
public void testService3() throws IOException, TemplateException, ParthenosPublisherException {
|
71 |
|
|
virtuosoReadAPI.getSubject("http://parthenos.d4science.org/handle/Parthenos/REG/Service/ARIADNE%20Visual%20Media%20Service", CRMpe.PE1_Service.getLocalName(), TIMEOUT, System.out);
|
72 |
|
|
}
|
73 |
|
|
|
74 |
|
|
@Test
|
75 |
51473
|
alessia.ba
|
public void testCurationPlan() throws IOException, TemplateException, ParthenosPublisherException {
|
76 |
52530
|
alessia.ba
|
virtuosoReadAPI.getSubject("http://parthenos.d4science.org/handle/Parthenos/REG/thing/provided%20by%20DCU", CRMpe.PE28_Curation_Plan.getLocalName(), TIMEOUT, System.out);
|
77 |
51465
|
alessia.ba
|
}
|
78 |
|
|
|
79 |
|
|
@Test
|
80 |
51473
|
alessia.ba
|
public void testProject() throws IOException, TemplateException, ParthenosPublisherException {
|
81 |
52530
|
alessia.ba
|
virtuosoReadAPI
|
82 |
|
|
.getSubject("http://parthenos.d4science.org/handle/Parthenos/REG/Project/Cendari", CRMpe.PE35_Project.getLocalName(), TIMEOUT, System.out);
|
83 |
51465
|
alessia.ba
|
}
|
84 |
|
|
|
85 |
51767
|
alessia.ba
|
@Test
|
86 |
52530
|
alessia.ba
|
public void testProject2() throws ParthenosPublisherException, TemplateException, IOException {
|
87 |
|
|
virtuosoReadAPI.getSubject("http://parthenos.d4science.org/handle/Parthenos/REG/Project/Ariadne%20Project", CRMpe.PE35_Project.getLocalName(), TIMEOUT, System.out);
|
88 |
|
|
}
|
89 |
|
|
|
90 |
|
|
@Test
|
91 |
51803
|
alessia.ba
|
public void testCollection() throws IOException, TemplateException, ParthenosPublisherException {
|
92 |
52530
|
alessia.ba
|
virtuosoReadAPI.getSubject("http://parthenos.d4science.org/handle/EHRI/PORTAL/Thing/164", CRM.E78_Collection.getLocalName(), TIMEOUT, System.out);
|
93 |
51803
|
alessia.ba
|
}
|
94 |
|
|
|
95 |
|
|
@Test
|
96 |
51767
|
alessia.ba
|
public void testGetSubjectsApiWithType(){
|
97 |
|
|
List<String> list = virtuosoReadAPI.getSubjectsForApiWithType("api_________::ariadne::CYI", CRMpe.getURI(), CRMpe.PE18_Dataset.getLocalName(), 100, 0);
|
98 |
|
|
assertFalse(list.isEmpty());
|
99 |
|
|
list.forEach(s -> System.out.println(s));
|
100 |
|
|
}
|
101 |
|
|
|
102 |
|
|
@Test
|
103 |
|
|
public void testGetSubjectsApiWithTypeAndTooLargeOffset(){
|
104 |
|
|
List<String> list = virtuosoReadAPI.getSubjectsForApiWithType("api_________::ariadne::CYI", CRMpe.getURI(), CRMpe.PE18_Dataset.getLocalName(), 100, 100);
|
105 |
|
|
assertTrue(list.isEmpty());
|
106 |
|
|
}
|
107 |
|
|
|
108 |
|
|
@Test
|
109 |
|
|
public void testGetSubjectsApiWithTypeOffset(){
|
110 |
|
|
List<String> list = virtuosoReadAPI.getSubjectsForApiWithType("api_________::ariadne::CYI", CRMpe.getURI(), CRMpe.PE18_Dataset.getLocalName(), 2, 4);
|
111 |
|
|
list.forEach(s -> System.out.println(s));
|
112 |
|
|
}
|
113 |
|
|
|
114 |
51465
|
alessia.ba
|
}
|