115 lines
4.9 KiB
Java
115 lines
4.9 KiB
Java
package eu.dnetlib.ariadneplus.virtuoso;
|
|
|
|
import java.io.IOException;
|
|
import java.util.List;
|
|
|
|
import eu.dnetlib.ariadneplus.CRM;
|
|
import eu.dnetlib.ariadneplus.CRMdig;
|
|
import eu.dnetlib.ariadneplus.CRMpe;
|
|
import eu.dnetlib.ariadneplus.publisher.AriadnePlusPublisherException;
|
|
import freemarker.template.TemplateException;
|
|
import org.junit.Ignore;
|
|
import org.junit.Test;
|
|
import org.junit.runner.RunWith;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
import org.springframework.test.context.TestPropertySource;
|
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|
|
|
import static org.junit.Assert.assertFalse;
|
|
import static org.junit.Assert.assertTrue;
|
|
|
|
/**
|
|
* Created by Alessia Bardi on 24/03/2018.
|
|
*
|
|
* @author Alessia Bardi
|
|
*/
|
|
@Ignore
|
|
@RunWith(SpringJUnit4ClassRunner.class)
|
|
@SpringBootTest
|
|
@TestPropertySource(
|
|
locations = "classpath:application-integrationtest.properties")
|
|
public class VirtuosoReadAPIIntegrationTest {
|
|
|
|
private static String TIMEOUT = "3000";
|
|
|
|
@Autowired
|
|
private VirtuosoReadAPI virtuosoReadAPI;
|
|
|
|
@Test
|
|
public void testVolatileDataset1() throws IOException, TemplateException, AriadnePlusPublisherException {
|
|
virtuosoReadAPI.getSubject("http://ariadneplus.d4science.org/handle/AriadnePlus/REG/Dataset/CoCoON%20Dataset", CRMpe.PE18_Dataset.getLocalName(), TIMEOUT, System.out);
|
|
}
|
|
|
|
@Test
|
|
public void testSoftware() throws IOException, TemplateException, AriadnePlusPublisherException {
|
|
virtuosoReadAPI.getSubject("http://ariadneplus.d4science.org/handle/AriadnePlus/REG/Software/ACDM", CRMdig.D14_Software.getLocalName(), TIMEOUT, System.out);
|
|
}
|
|
|
|
@Test
|
|
public void testRIConsortium() throws IOException, TemplateException, AriadnePlusPublisherException {
|
|
virtuosoReadAPI.getSubject("http://ariadneplus.d4science.org/handle/AriadnePlus/REG/Actor/Cendari%20Consortium", CRM.E39_Actor.getLocalName(), TIMEOUT, System.out);
|
|
}
|
|
|
|
@Test
|
|
public void testPerson() throws IOException, TemplateException, AriadnePlusPublisherException {
|
|
virtuosoReadAPI.getSubject("http://ariadneplus.d4science.org/handle/AriadnePlus/REG/Actor/Eleni%20Vernardaki", CRM.E39_Actor.getLocalName(), TIMEOUT, System.out);
|
|
}
|
|
|
|
@Test
|
|
public void testService() throws IOException, TemplateException, AriadnePlusPublisherException {
|
|
virtuosoReadAPI.getSubject("http://ariadneplus.d4science.org/handle/AriadnePlus/REG/Service/Isidore", CRMpe.PE1_Service.getLocalName(), TIMEOUT, System.out);
|
|
}
|
|
|
|
@Test
|
|
public void testService2() throws IOException, TemplateException, AriadnePlusPublisherException {
|
|
virtuosoReadAPI.getSubject("http://ariadneplus.d4science.org/handle/AriadnePlus/REG/Service/LRE%20Map", CRMpe.PE1_Service.getLocalName(), TIMEOUT, System.out);
|
|
}
|
|
|
|
@Test
|
|
public void testService3() throws IOException, TemplateException, AriadnePlusPublisherException {
|
|
virtuosoReadAPI.getSubject("http://ariadneplus.d4science.org/handle/AriadnePlus/REG/Service/ARIADNE%20Visual%20Media%20Service", CRMpe.PE1_Service.getLocalName(), TIMEOUT, System.out);
|
|
}
|
|
|
|
@Test
|
|
public void testCurationPlan() throws IOException, TemplateException, AriadnePlusPublisherException {
|
|
virtuosoReadAPI.getSubject("http://ariadneplus.d4science.org/handle/AriadnePlus/REG/thing/provided%20by%20DCU", CRMpe.PE28_Curation_Plan.getLocalName(), TIMEOUT, System.out);
|
|
}
|
|
|
|
@Test
|
|
public void testProject() throws IOException, TemplateException, AriadnePlusPublisherException {
|
|
virtuosoReadAPI
|
|
.getSubject("http://ariadneplus.d4science.org/handle/AriadnePlus/REG/Project/Cendari", CRMpe.PE35_Project.getLocalName(), TIMEOUT, System.out);
|
|
}
|
|
|
|
@Test
|
|
public void testProject2() throws AriadnePlusPublisherException, TemplateException, IOException {
|
|
virtuosoReadAPI.getSubject("http://ariadneplus.d4science.org/handle/AriadnePlus/REG/Project/Ariadne%20Project", CRMpe.PE35_Project.getLocalName(), TIMEOUT, System.out);
|
|
}
|
|
|
|
@Test
|
|
public void testCollection() throws IOException, TemplateException, AriadnePlusPublisherException {
|
|
virtuosoReadAPI.getSubject("http://ariadneplus.d4science.org/handle/EHRI/PORTAL/Thing/164", CRM.E78_Collection.getLocalName(), TIMEOUT, System.out);
|
|
}
|
|
|
|
@Test
|
|
public void testGetSubjectsApiWithType(){
|
|
List<String> list = virtuosoReadAPI.getSubjectsForApiWithType("api_________::ariadne::CYI", CRMpe.getURI(), CRMpe.PE18_Dataset.getLocalName(), 100, 0);
|
|
assertFalse(list.isEmpty());
|
|
list.forEach(s -> System.out.println(s));
|
|
}
|
|
|
|
@Test
|
|
public void testGetSubjectsApiWithTypeAndTooLargeOffset(){
|
|
List<String> list = virtuosoReadAPI.getSubjectsForApiWithType("api_________::ariadne::CYI", CRMpe.getURI(), CRMpe.PE18_Dataset.getLocalName(), 100, 100);
|
|
assertTrue(list.isEmpty());
|
|
}
|
|
|
|
@Test
|
|
public void testGetSubjectsApiWithTypeOffset(){
|
|
List<String> list = virtuosoReadAPI.getSubjectsForApiWithType("api_________::ariadne::CYI", CRMpe.getURI(), CRMpe.PE18_Dataset.getLocalName(), 2, 4);
|
|
list.forEach(s -> System.out.println(s));
|
|
}
|
|
|
|
}
|