Revision 58341
Added by Argiro Kokogiannaki about 4 years ago
ContextUtilsTest.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.data.claims.parser; |
2 | 2 |
|
3 | 3 |
import eu.dnetlib.data.claims.utils.ContextUtils; |
4 |
import org.apache.log4j.BasicConfigurator; |
|
4 | 5 |
import org.junit.Assert; |
6 |
import org.junit.Before; |
|
5 | 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; |
|
6 | 11 |
|
7 | 12 |
/** |
8 | 13 |
* Created by argirok on 29/5/2018. |
9 | 14 |
*/ |
10 | 15 |
public class ContextUtilsTest { |
16 |
ContextUtils contextUtils; |
|
11 | 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 |
} |
|
12 | 27 |
@Test |
13 | 28 |
public void dmf2ContextTest() throws Exception { |
14 | 29 |
|
15 | 30 |
String id= "egi::country::gr"; |
16 | 31 |
|
17 |
Assert.assertEquals("EGI Federation> EGI Countries> Greece", ContextUtils.extractLabel(id, false));
|
|
32 |
Assert.assertEquals("EGI Federation> EGI Countries> Greece", contextUtils.extractLabel(id));
|
|
18 | 33 |
id= "egi"; |
19 |
Assert.assertEquals("EGI Federation", ContextUtils.extractLabel(id, false));
|
|
34 |
Assert.assertEquals("EGI Federation", contextUtils.extractLabel(id));
|
|
20 | 35 |
id="egi::classification"; |
21 |
Assert.assertEquals("EGI Federation> EGI classification scheme", ContextUtils.extractLabel(id, false));
|
|
36 |
Assert.assertEquals("EGI Federation> EGI classification scheme", contextUtils.extractLabel(id));
|
|
22 | 37 |
id="egi::classification::natsc"; |
23 |
Assert.assertEquals("EGI Federation> EGI classification scheme> Natural Sciences", ContextUtils.extractLabel(id, false));
|
|
38 |
Assert.assertEquals("EGI Federation> EGI classification scheme> Natural Sciences", contextUtils.extractLabel(id));
|
|
24 | 39 |
id="egi::classification::natsc::math"; |
25 |
Assert.assertEquals("EGI Federation> EGI classification scheme> Mathematics", ContextUtils.extractLabel(id, false));
|
|
40 |
Assert.assertEquals("EGI Federation> EGI classification scheme> Mathematics", contextUtils.extractLabel(id));
|
|
26 | 41 |
id="egi::classification::natsc::math::applied"; |
27 |
Assert.assertEquals("EGI Federation> EGI classification scheme> Applied Mathematics", ContextUtils.extractLabel(id, false));
|
|
42 |
Assert.assertEquals("EGI Federation> EGI classification scheme> Applied Mathematics", contextUtils.extractLabel(id));
|
|
28 | 43 |
id="egi::classification::natsc::math::applied"; |
29 |
Assert.assertEquals("EGI Federation> EGI classification scheme> Applied Mathematics", ContextUtils.extractLabel(id, false));
|
|
44 |
Assert.assertEquals("EGI Federation> EGI classification scheme> Applied Mathematics", contextUtils.extractLabel(id));
|
|
30 | 45 |
|
31 | 46 |
/* |
32 | 47 |
|
Also available in: Unified diff
ClaimEntity: Add information about the dashboard where the claim was created
Properties:
add properties for the different services
create beans properly
production or beta is decided from the services urls in properties
Migration:
create migration method: CopyFromBetaToProduction for communities