1
|
package eu.dnetlib.parthenos.virtuoso;
|
2
|
|
3
|
import java.io.IOException;
|
4
|
import java.util.List;
|
5
|
|
6
|
import eu.dnetlib.parthenos.CRM;
|
7
|
import eu.dnetlib.parthenos.CRMdig;
|
8
|
import eu.dnetlib.parthenos.CRMpe;
|
9
|
import eu.dnetlib.parthenos.publisher.ParthenosPublisherException;
|
10
|
import freemarker.template.TemplateException;
|
11
|
import org.junit.Ignore;
|
12
|
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
|
import static org.junit.Assert.assertFalse;
|
20
|
import static org.junit.Assert.assertTrue;
|
21
|
|
22
|
/**
|
23
|
* Created by Alessia Bardi on 24/03/2018.
|
24
|
*
|
25
|
* @author Alessia Bardi
|
26
|
*/
|
27
|
@Ignore
|
28
|
@RunWith(SpringJUnit4ClassRunner.class)
|
29
|
@SpringBootTest
|
30
|
@TestPropertySource(
|
31
|
locations = "classpath:application-integrationtest.properties")
|
32
|
public class VirtuosoReadAPIIntegrationTest {
|
33
|
|
34
|
private static String TIMEOUT = "3000";
|
35
|
|
36
|
@Autowired
|
37
|
private VirtuosoReadAPI virtuosoReadAPI;
|
38
|
|
39
|
@Test
|
40
|
public void testVolatileDataset1() throws IOException, TemplateException, ParthenosPublisherException {
|
41
|
virtuosoReadAPI.getSubject("http://parthenos.d4science.org/handle/Parthenos/REG/Dataset/CoCoON%20Dataset", CRMpe.PE18_Dataset.getLocalName(), TIMEOUT, System.out);
|
42
|
}
|
43
|
|
44
|
@Test
|
45
|
public void testSoftware() throws IOException, TemplateException, ParthenosPublisherException {
|
46
|
virtuosoReadAPI.getSubject("http://parthenos.d4science.org/handle/Parthenos/REG/Software/ACDM", CRMdig.D14_Software.getLocalName(), TIMEOUT, System.out);
|
47
|
}
|
48
|
|
49
|
@Test
|
50
|
public void testRIConsortium() throws IOException, TemplateException, ParthenosPublisherException {
|
51
|
virtuosoReadAPI.getSubject("http://parthenos.d4science.org/handle/Parthenos/REG/Actor/Cendari%20Consortium", CRM.E39_Actor.getLocalName(), TIMEOUT, System.out);
|
52
|
}
|
53
|
|
54
|
@Test
|
55
|
public void testPerson() throws IOException, TemplateException, ParthenosPublisherException {
|
56
|
virtuosoReadAPI.getSubject("http://parthenos.d4science.org/handle/Parthenos/REG/Actor/Eleni%20Vernardaki", CRM.E39_Actor.getLocalName(), TIMEOUT, System.out);
|
57
|
}
|
58
|
|
59
|
@Test
|
60
|
public void testService() throws IOException, TemplateException, ParthenosPublisherException {
|
61
|
virtuosoReadAPI.getSubject("http://parthenos.d4science.org/handle/Parthenos/REG/Service/Isidore", CRMpe.PE1_Service.getLocalName(), TIMEOUT, System.out);
|
62
|
}
|
63
|
|
64
|
@Test
|
65
|
public void testService2() throws IOException, TemplateException, ParthenosPublisherException {
|
66
|
virtuosoReadAPI.getSubject("http://parthenos.d4science.org/handle/Parthenos/REG/Service/LRE%20Map", CRMpe.PE1_Service.getLocalName(), TIMEOUT, System.out);
|
67
|
}
|
68
|
|
69
|
@Test
|
70
|
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
|
public void testCurationPlan() throws IOException, TemplateException, ParthenosPublisherException {
|
76
|
virtuosoReadAPI.getSubject("http://parthenos.d4science.org/handle/Parthenos/REG/thing/provided%20by%20DCU", CRMpe.PE28_Curation_Plan.getLocalName(), TIMEOUT, System.out);
|
77
|
}
|
78
|
|
79
|
@Test
|
80
|
public void testProject() throws IOException, TemplateException, ParthenosPublisherException {
|
81
|
virtuosoReadAPI
|
82
|
.getSubject("http://parthenos.d4science.org/handle/Parthenos/REG/Project/Cendari", CRMpe.PE35_Project.getLocalName(), TIMEOUT, System.out);
|
83
|
}
|
84
|
|
85
|
@Test
|
86
|
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
|
public void testCollection() throws IOException, TemplateException, ParthenosPublisherException {
|
92
|
virtuosoReadAPI.getSubject("http://parthenos.d4science.org/handle/EHRI/PORTAL/Thing/164", CRM.E78_Collection.getLocalName(), TIMEOUT, System.out);
|
93
|
}
|
94
|
|
95
|
@Test
|
96
|
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
|
}
|