1
|
package eu.dnetlib.data.claims.parser;
|
2
|
|
3
|
import eu.dnetlib.data.claims.utils.ContextUtils;
|
4
|
import org.apache.log4j.BasicConfigurator;
|
5
|
import org.junit.Assert;
|
6
|
import org.junit.Before;
|
7
|
import org.junit.Test;
|
8
|
import org.springframework.beans.factory.annotation.Autowired;
|
9
|
import org.springframework.context.ApplicationContext;
|
10
|
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
11
|
|
12
|
/**
|
13
|
* Created by argirok on 29/5/2018.
|
14
|
*/
|
15
|
public class ContextUtilsTest {
|
16
|
ContextUtils contextUtils;
|
17
|
|
18
|
@Before
|
19
|
public void init() throws Exception {
|
20
|
BasicConfigurator.configure();
|
21
|
ApplicationContext context = new ClassPathXmlApplicationContext("eu/dnetlib/data/claims/springContext-claims.xml");
|
22
|
|
23
|
contextUtils = context.getBean(ContextUtils.class);
|
24
|
|
25
|
|
26
|
}
|
27
|
@Test
|
28
|
public void dmf2ContextTest() throws Exception {
|
29
|
|
30
|
String id= "egi::country::gr";
|
31
|
|
32
|
Assert.assertEquals("EGI Federation> EGI Countries> Greece", contextUtils.extractLabel(id));
|
33
|
id= "egi";
|
34
|
Assert.assertEquals("EGI Federation", contextUtils.extractLabel(id));
|
35
|
id="egi::classification";
|
36
|
Assert.assertEquals("EGI Federation> EGI classification scheme", contextUtils.extractLabel(id));
|
37
|
id="egi::classification::natsc";
|
38
|
Assert.assertEquals("EGI Federation> EGI classification scheme> Natural Sciences", contextUtils.extractLabel(id));
|
39
|
id="egi::classification::natsc::math";
|
40
|
Assert.assertEquals("EGI Federation> EGI classification scheme> Mathematics", contextUtils.extractLabel(id));
|
41
|
id="egi::classification::natsc::math::applied";
|
42
|
Assert.assertEquals("EGI Federation> EGI classification scheme> Applied Mathematics", contextUtils.extractLabel(id));
|
43
|
id="egi::classification::natsc::math::applied";
|
44
|
Assert.assertEquals("EGI Federation> EGI classification scheme> Applied Mathematics", contextUtils.extractLabel(id));
|
45
|
|
46
|
/*
|
47
|
|
48
|
0
|
49
|
id "aginfra::projects"
|
50
|
label "AGINFRA+ Projects"
|
51
|
1
|
52
|
id "aginfra::subcommunity"
|
53
|
label "AGINFRA+ communities"
|
54
|
0
|
55
|
id "aginfra::projects::1"
|
56
|
label "European Foodbusiness Transfer Laboratory for stimulating entrepreneurial skills, for fostering innovation and for business creation in the Food Sector"
|
57
|
concepts
|
58
|
*/
|
59
|
}
|
60
|
}
|