Project

General

Profile

1
package eu.dnetlib.msro.openaireplus.api;
2

    
3
import java.util.Map;
4
import java.util.Map.Entry;
5

    
6
import org.junit.Test;
7

    
8
import eu.dnetlib.openaire.directindex.api.OpenAIRESubmitterUtils;
9

    
10
/**
11
 * Created by Alessia Bardi on 26/05/2017.
12
 *
13
 * @author Alessia Bardi
14
 */
15
public class OpenAIRESubmitterUtilsTest {
16

    
17
	private OpenAIRESubmitterUtils utils = new OpenAIRESubmitterUtils(
18
			"http://beta.services.openaire.eu/openaire/community/"
19
	);
20

    
21
	final String fullProject = "info:eu-repo/grantAgreement/EC/FP7/244909/EU/Making Capabilities Work/WorkAble";
22
	final String minimalProject = "info:eu-repo/grantAgreement/EC/FP7/244909///WorkAble";
23
	final String onlyId = "info:eu-repo/grantAgreement/EC/FP7/244909/";
24
	final String onlyTitle = "info:eu-repo/grantAgreement/EC/FP7/244909/EU/Making Capabilities Work";
25

    
26
	@Test
27
	public void testCalculateProjectInfoFull() {
28
		final Map<String, String> project = utils.calculateProjectInfo(fullProject);
29
		print(project);
30
	}
31

    
32
	@Test
33
	public void testCalculateProjectInfoOnlyId() {
34
		final Map<String, String> project = utils.calculateProjectInfo(onlyId);
35
		print(project);
36
	}
37

    
38
	@Test
39
	public void testCalculateProjectInfoMinimalAcro() {
40
		final Map<String, String> project = utils.calculateProjectInfo(minimalProject);
41
		print(project);
42
	}
43

    
44
	@Test
45
	public void testCalculateProjectInfoOnlyTitle() {
46
		final Map<String, String> project = utils.calculateProjectInfo(onlyTitle);
47
		print(project);
48
	}
49

    
50
	@Test
51
	public void testJerusalem(){
52
		String s = "info:eu-repo/grantAgreement/EC/FP7/337895/EU/Opening Jerusalem Archives: For a connected History of ‘Citadinité’ in the Holy City (1840-1940)/OPEN-JERUSALEM";
53
		final Map<String, String> project = utils.calculateProjectInfo(s);
54
		print(project);
55
	}
56

    
57
	private void print(final Map<String, String> map) {
58
		for (final Entry e : map.entrySet()) {
59
			System.out.println(e.getKey() + " = " + e.getValue());
60
		}
61
	}
62
}
    (1-1/1)