Project

General

Profile

« Previous | Next » 

Revision 61341

When the label of the context cannot be resolved, the context tag is not added.
To ensure tests do not make any external calls, the code has been refactored so that the proper mock could be defined.

View differences:

modules/dnet-directindex-api/trunk/src/test/java/eu/dnetlib/msro/openaireplus/api/OpenAIRESubmitterUtilsTest.java
1
package eu.dnetlib.msro.openaireplus.api;
2

  
3
import java.util.ArrayList;
4
import java.util.List;
5
import java.util.Map;
6
import java.util.Map.Entry;
7

  
8
import org.junit.Assert;
9
import org.junit.Test;
10

  
11
import eu.dnetlib.openaire.directindex.api.OpenAIRESubmitterUtils;
12

  
13
/**
14
 * Created by Alessia Bardi on 26/05/2017.
15
 *
16
 * @author Alessia Bardi
17
 */
18
public class OpenAIRESubmitterUtilsTest {
19

  
20
	private OpenAIRESubmitterUtils utils = new OpenAIRESubmitterUtils(
21
			"http://beta.services.openaire.eu/openaire/community/"
22
	);
23

  
24
	final String fullProject = "info:eu-repo/grantAgreement/EC/FP7/244909/EU/Making Capabilities Work/WorkAble";
25
	final String minimalProject = "info:eu-repo/grantAgreement/EC/FP7/244909///WorkAble";
26
	final String onlyId = "info:eu-repo/grantAgreement/EC/FP7/244909/";
27
	final String onlyTitle = "info:eu-repo/grantAgreement/EC/FP7/244909/EU/Making Capabilities Work";
28
	final String escapedId = "info:eu-repo/grantAgreement/RCUK//NE%2FL003066%2F1/";
29

  
30
	@Test
31
	public void testCalculateProjectInfoEscaped() {
32
		final Map<String, String> project = utils.calculateProjectInfo(escapedId);
33
		print(project);
34
	}
35

  
36
	@Test
37
	public void testCalculateProjectInfoFull() {
38
		final Map<String, String> project = utils.calculateProjectInfo(fullProject);
39
		print(project);
40
	}
41

  
42
	@Test
43
	public void testCalculateProjectInfoOnlyId() {
44
		final Map<String, String> project = utils.calculateProjectInfo(onlyId);
45
		print(project);
46
	}
47

  
48
	@Test
49
	public void testCalculateProjectInfoMinimalAcro() {
50
		final Map<String, String> project = utils.calculateProjectInfo(minimalProject);
51
		print(project);
52
	}
53

  
54
	@Test
55
	public void testCalculateProjectInfoOnlyTitle() {
56
		final Map<String, String> project = utils.calculateProjectInfo(onlyTitle);
57
		print(project);
58
	}
59

  
60
	@Test
61
	public void testJerusalem(){
62
		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";
63
		final Map<String, String> project = utils.calculateProjectInfo(s);
64
		print(project);
65
	}
66

  
67
	private void print(final Map<String, String> map) {
68
		for (final Entry e : map.entrySet()) {
69
			System.out.println(e.getKey() + " = " + e.getValue());
70
		}
71
	}
72

  
73
	@Test
74
	public void testContext(){
75
		List<String> contexts = new ArrayList<>();
76
		contexts.add("https://zenodo.org/communities/dimpo");
77
		contexts.add("https://zenodo.org/communities/aoo_beopen");
78
		List<OpenAIRESubmitterUtils.ContextInfo> tmp = utils.processContexts(contexts);
79

  
80
		Assert.assertEquals(2, tmp.size());
81

  
82
		Assert.assertTrue(tmp.get(0).getId().equals("dh-ch") || tmp.get(1).getId().equalsIgnoreCase("dh-ch"));
83
		Assert.assertTrue(tmp.get(0).getId().equals("dariah") || tmp.get(1).getId().equalsIgnoreCase("dariah"));
84
	}
85
}
modules/dnet-directindex-api/trunk/src/test/java/eu/dnetlib/msro/openaireplus/api/objects/ResultEntryTest.java
1
package eu.dnetlib.msro.openaireplus.api.objects;
2

  
3
import com.google.gson.Gson;
4
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
5
import eu.dnetlib.openaire.directindex.api.DirecIndexApiException;
6
import eu.dnetlib.openaire.directindex.objects.PidEntry;
7
import eu.dnetlib.openaire.directindex.objects.ResultEntry;
8
import org.apache.commons.lang3.StringEscapeUtils;
9
import org.apache.velocity.app.VelocityEngine;
10
import org.dom4j.Document;
11
import org.dom4j.io.OutputFormat;
12
import org.dom4j.io.SAXReader;
13
import org.dom4j.io.XMLWriter;
14
import org.junit.Before;
15
import org.junit.Test;
16
import org.junit.runner.RunWith;
17
import org.mockito.Mock;
18
import org.mockito.runners.MockitoJUnitRunner;
19

  
20
import java.io.InputStreamReader;
21
import java.io.StringReader;
22
import java.util.ArrayList;
23
import java.util.Arrays;
24
import java.util.Properties;
25

  
26
import static org.mockito.Matchers.anyString;
27
import static org.mockito.Mockito.when;
28

  
29
/**
30
 * Created by michele on 14/12/15.
31
 */
32
@RunWith(MockitoJUnitRunner.class)
33
public class ResultEntryTest {
34

  
35
	private VelocityEngine ve;
36

  
37
	private final String community_api = "https://dev-openaire.d4science.org/openaire/community/";
38

  
39
	@Mock
40
	private ISLookUpService lookUpService;
41

  
42
	@Before
43
	public void setUp() throws Exception {
44

  
45
		final Properties props = new Properties();
46
		props.setProperty("resource.loader", "class");
47
		props.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
48
		props.setProperty("runtime.log.logsystem.class", "org.apache.velocity.runtime.log.Log4JLogChute");
49
		ve = new VelocityEngine();
50
		ve.init(props);
51

  
52
		when(lookUpService.quickSearchProfile(anyString())).thenAnswer(invocation -> {
53
			final String query = invocation.getArguments()[0].toString();
54
			if (query.contains("dnet:result_typologies")) {
55
				return Arrays.asList("publication @@@ publication", "dataset @@@ dataset", "software @@@ software", "other @@@ other");
56
			} else if (query.contains("dnet:access_modes")) {
57
				return Arrays.asList("OPEN @@@ Open Access");
58
			} else if (query.contains("dnet:publication_resource")) {
59
				return Arrays.asList("0001 @@@ Journal Article");
60
			} else if (query.contains("dnet:pid_types")) {
61
				return Arrays.asList("oai @@@ Open Archive Initiative", "doi @@@ Digital object identifier");
62
			} else if (query.contains("dnet:languages")) {
63
				return Arrays.asList("ita @@@ Italian");
64
			} else if (query.contains("ContextDSResourceType")) {
65
				return Arrays.asList(
66
						"egi::classification::natsc::math::stats @@@ Statistics and Probability",
67
						"egi::classification::natsc::math::pure @@@ Pure Mathematics",
68
						"egi::classification::natsc::math @@@ Mathematics",
69
						"egi::classification::natsc @@@ Natural Sciences",
70
						"egi::classification @@@ EGI classification scheme",
71
						"egi @@@ EGI",
72
						"enermaps::selection @@@ Selected by the H2020 EnerMaps project");
73
			} else {
74
				return new ArrayList<String>();
75
			}
76
		});
77

  
78
		when(lookUpService.getResourceProfileByQuery(anyString())).thenAnswer(invocation -> "REPO NAME @@@ repo________");
79
	}
80

  
81
	@Test
82
	public void testAsIndexRecord() throws Exception {
83
		final ResultEntry pub = new ResultEntry();
84
		pub.setOriginalId("ORIG_ID_1234");
85
		pub.setTitle("TEST TITLE <test>");
86
		pub.getAuthors().add("Michele Artini");
87
		pub.getAuthors().add("Claudio Atzori");
88
		pub.getAuthors().add("Alessia Bardi");
89
		pub.setPublisher("Test publisher");
90
		pub.setDescription("DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION ");
91
		pub.setLanguage("ita");
92
		pub.setLicenseCode("OPEN");
93
		pub.setResourceType("0001");
94
		pub.setUrl("http://test.it/a=1&b=2");
95
		pub.getPids().add(new PidEntry("doi", "10.000/xyz-123"));
96
		pub.getPids().add(new PidEntry("oai", "oai:1234"));
97
		pub.setCollectedFromId("test________::zenodo");
98
		pub.setHostedById("test________::UNKNOWN");
99
		pub.getLinksToProjects().add("info:eu-repo/grantAgreement/EC/FP7/283595/EU//OpenAIREplus");
100
		pub.getLinksToProjects().add("info:eu-repo/grantAgreement/RCUK//244%2F909/EU/Making Capabilities Work/WorkAble");
101
		pub.getContexts().add("egi::classification::natsc::math::pure");
102
		pub.getContexts().add("egi::classification::natsc::math::stats");
103
		pub.getContexts().add("enermaps");
104
		pub.getContexts().add("enermaps::selection");
105
		final String xml = pub.asOafRecord(ve, lookUpService, "http://oaf/oaf.xsd",community_api);
106

  
107
		final Document doc = new SAXReader().read(new StringReader(xml));
108

  
109
		final OutputFormat format = OutputFormat.createPrettyPrint();
110

  
111
		final XMLWriter writer = new XMLWriter(System.out, format);
112

  
113
		writer.write(doc);
114

  
115
		/* writer.close(); */
116

  
117
	}
118

  
119
	@Test
120
	public void testAsIndexRecordAccessRight() throws Exception {
121
		final ResultEntry pub = new ResultEntry();
122
		pub.setOriginalId("ORIG_ID_1234");
123
		pub.setTitle("TEST TITLE <test>");
124
		pub.getAuthors().add("Michele Artini");
125
		pub.getAuthors().add("Claudio Atzori");
126
		pub.getAuthors().add("Alessia Bardi");
127
		pub.setPublisher("Test publisher");
128
		pub.setDescription("DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION ");
129
		pub.setLanguage("ita");
130
		pub.setLicenseCode("CLOSED");
131
		pub.setAccessRightCode("OPEN");
132
		pub.setResourceType("0001");
133
		pub.setUrl("http://test.it/a=1&b=2");
134
		pub.getPids().add(new PidEntry("doi", "10.000/xyz-123"));
135
		pub.getPids().add(new PidEntry("oai", "oai:1234"));
136
		pub.setCollectedFromId("test________::zenodo");
137
		pub.setHostedById("test________::UNKNOWN");
138
		pub.getLinksToProjects().add("info:eu-repo/grantAgreement/EC/FP7/283595/EU//OpenAIREplus");
139
		pub.getLinksToProjects().add("info:eu-repo/grantAgreement/EC/FP7/244909/EU/Making Capabilities Work/WorkAble");
140
		pub.getContexts().add("egi::classification::natsc::math::pure");
141
		pub.getContexts().add("egi::classification::natsc::math::stats");
142
		final String xml = pub.asOafRecord(ve, lookUpService, "http://oaf/oaf.xsd",community_api);
143

  
144
		final Document doc = new SAXReader().read(new StringReader(xml));
145

  
146
		final OutputFormat format = OutputFormat.createPrettyPrint();
147

  
148
		final XMLWriter writer = new XMLWriter(System.out, format);
149

  
150
		writer.write(doc);
151

  
152
		/* writer.close(); */
153

  
154
	}
155

  
156
	@Test
157
	public void testAsORP() throws Exception {
158
		final ResultEntry pub = new ResultEntry();
159
		pub.setOriginalId("ORIG_ID_1234");
160
		pub.setTitle("TEST TITLE <test>");
161
		pub.getAuthors().add("Michele Artini");
162
		pub.getAuthors().add("Claudio Atzori");
163
		pub.getAuthors().add("Alessia Bardi");
164
		pub.setPublisher("Test publisher");
165
		pub.setDescription("DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION ");
166
		pub.setLanguage("ita");
167
		pub.setLicenseCode("CLOSED");
168
		pub.setAccessRightCode("OPEN");
169
		pub.setResourceType("0020");
170
		pub.setType("other");
171
		pub.setUrl("http://test.it/a=1&b=2");
172
		pub.getPids().add(new PidEntry("doi", "10.000/xyz-123"));
173
		pub.getPids().add(new PidEntry("oai", "oai:1234"));
174
		pub.setCollectedFromId("test________::zenodo");
175
		pub.setHostedById("test________::UNKNOWN");
176
		pub.getLinksToProjects().add("info:eu-repo/grantAgreement/EC/FP7/283595/EU//OpenAIREplus");
177
		pub.getLinksToProjects().add("info:eu-repo/grantAgreement/EC/FP7/244909/EU/Making Capabilities Work/WorkAble");
178
		pub.getContexts().add("egi::classification::natsc::math::pure");
179
		pub.getContexts().add("egi::classification::natsc::math::stats");
180
		final String xml = pub.asOafRecord(ve, lookUpService, "http://oaf/oaf.xsd",community_api);
181

  
182
		final Document doc = new SAXReader().read(new StringReader(xml));
183

  
184
		final OutputFormat format = OutputFormat.createPrettyPrint();
185

  
186
		final XMLWriter writer = new XMLWriter(System.out, format);
187

  
188
		writer.write(doc);
189

  
190
		/* writer.close(); */
191

  
192
	}
193

  
194
	@Test
195
	public void testAsIndexRecord_json() throws Exception {
196
		testAsIndexRecord_json("test_record.json");
197

  
198
	}
199

  
200
	@Test
201
	public void testAsIndexRecord_json_with_greek_chars() throws Exception {
202

  
203
		testAsIndexRecord_json("test_record_with_greek_chars.json");
204

  
205
	}
206

  
207
	@Test
208
	public void testAsIndexRecord_openaireId() throws Exception {
209

  
210
		testAsIndexRecord_json("test_record_openaireId.json");
211

  
212
	}
213

  
214
	@Test(expected = DirecIndexApiException.class)
215
	public void testAsIndexRecord_wrongOpenaireId() throws Exception {
216

  
217
		testAsIndexRecord_json("test_record_wrong_openaireId.json");
218

  
219
	}
220

  
221
	@Test
222
	public void testAsIndexRecord_json_zenodo() throws Exception {
223

  
224
		testAsIndexRecord_json("test_zenodo.json");
225

  
226
	}
227

  
228
	@Test
229
	public void testAsIndexRecord_json_zenodoWithAmpersand() throws Exception {
230

  
231
		testAsIndexRecord_json("test_zenodoAmpersandEverywhere.json");
232

  
233
	}
234

  
235
	@Test
236
	public void testAsIndexRecord_json_software() throws Exception {
237

  
238
		testAsIndexRecord_json("test_record_software.json");
239

  
240
	}
241

  
242
	@Test
243
	public void testAsIndexRecord_json_orp() throws Exception {
244

  
245
		testAsIndexRecord_json("test_record_orp.json");
246

  
247
	}
248

  
249
	private void testAsIndexRecord_json(final String filename) throws Exception {
250
		final ResultEntry pub =
251
				new Gson().fromJson(new InputStreamReader(getClass().getResourceAsStream(filename)), ResultEntry.class);
252

  
253

  
254
		final String xml = pub.asOafRecord(ve, lookUpService, "http://oaf/oaf.xsd",community_api);
255
		//System.out.println(xml);
256

  
257
		final Document doc = new SAXReader().read(new StringReader(xml));
258

  
259
		final OutputFormat format = OutputFormat.createPrettyPrint();
260

  
261
		final XMLWriter writer = new XMLWriter(System.out, format);
262

  
263
		writer.write(doc);
264

  
265
		/* writer.close(); */
266
	}
267

  
268
	@Test
269
	public void testAsIndexRecord_json_zenodocommunities()throws Exception{
270
		testAsIndexRecord_json("test_zenodo_community.json");
271
	}
272

  
273
	@Test
274
	public void testAsIndexRecordFromSandbox_json_zenodocommunities()throws Exception{
275
		testAsIndexRecord_json("test_zenodo_community2.json");
276
	}
277

  
278
	@Test
279
	public void testEscapeUnicode() {
280
		final String unicodeTxt =
281
				"i.e. closed curves of the form $t\ud835\udfc4 [0,2\u03c0] \u21a6 (\\cos t)u + (\\sin t)v$ for suitable orthogonal vectors $u$";
282
		System.out.println(StringEscapeUtils.escapeXml11(unicodeTxt));
283
	}
284

  
285
}
modules/dnet-directindex-api/trunk/src/test/java/eu/dnetlib/openaire/directindex/api/OpenAIRESubmitterUtilsTest.java
1
package eu.dnetlib.openaire.directindex.api;
2

  
3
import java.util.ArrayList;
4
import java.util.Collection;
5
import java.util.List;
6
import java.util.Map;
7
import java.util.Map.Entry;
8

  
9
import com.google.common.collect.Lists;
10
import com.google.common.collect.Maps;
11
import org.junit.Assert;
12
import org.junit.Before;
13
import org.junit.Test;
14

  
15
import org.junit.runner.RunWith;
16
import org.mockito.runners.MockitoJUnitRunner;
17

  
18
import static org.mockito.Mockito.*;
19

  
20
/**
21
 * Created by Alessia Bardi on 26/05/2017.
22
 *
23
 * @author Alessia Bardi
24
 */
25
@RunWith(MockitoJUnitRunner.class)
26
public class OpenAIRESubmitterUtilsTest {
27

  
28
	private OpenAIRESubmitterUtils utils;
29

  
30
	final String fullProject = "info:eu-repo/grantAgreement/EC/FP7/244909/EU/Making Capabilities Work/WorkAble";
31
	final String minimalProject = "info:eu-repo/grantAgreement/EC/FP7/244909///WorkAble";
32
	final String onlyId = "info:eu-repo/grantAgreement/EC/FP7/244909/";
33
	final String onlyTitle = "info:eu-repo/grantAgreement/EC/FP7/244909/EU/Making Capabilities Work";
34
	final String escapedId = "info:eu-repo/grantAgreement/RCUK//NE%2FL003066%2F1/";
35

  
36

  
37
	@Before
38
	public void setup(){
39
		utils = mock(OpenAIRESubmitterUtils.class, withSettings().defaultAnswer(CALLS_REAL_METHODS));
40
		doReturn(Lists.newArrayList("dh-ch", "dariah", "bar", "x")).when(utils).translateZenodoCommunity("https://zenodo.org/communities/dimpo");
41
		doReturn(Lists.newArrayList()).when(utils).translateZenodoCommunity("https://zenodo.org/communities/dumbo");
42

  
43
	}
44

  
45
	@Test
46
	public void testCalculateProjectInfoEscaped() {
47
		final Map<String, String> project = utils.calculateProjectInfo(escapedId);
48
		print(project);
49
		Assert.assertEquals("NE/L003066/1", project.get("code"));
50
	}
51

  
52
	@Test
53
	public void testCalculateProjectInfoFull() {
54
		final Map<String, String> project = utils.calculateProjectInfo(fullProject);
55
		print(project);
56
		Assert.assertEquals(10, project.size());
57
		for(String k : project.keySet()){
58
			Assert.assertNotNull(project.get(k));
59
			Assert.assertNotSame("", project.get(k));
60
		}
61
	}
62

  
63
	@Test
64
	public void testCalculateProjectInfoOnlyId() {
65
		final Map<String, String> project = utils.calculateProjectInfo(onlyId);
66
		print(project);
67
		Assert.assertEquals("44909", project.get("code"));
68
	}
69

  
70
	@Test
71
	public void testCalculateProjectInfoMinimalAcro() {
72
		final Map<String, String> project = utils.calculateProjectInfo(minimalProject);
73
		print(project);
74
		Assert.assertEquals("44909", project.get("code"));
75
		Assert.assertEquals("WorkAble", project.get("acronym"));
76
	}
77

  
78
	@Test
79
	public void testCalculateProjectInfoOnlyTitle() {
80
		final Map<String, String> project = utils.calculateProjectInfo(onlyTitle);
81
		print(project);
82
		Assert.assertEquals("44909", project.get("code"));
83
		Assert.assertEquals("Making Capabilities Work", project.get("title"));
84
	}
85

  
86
	@Test
87
	public void testJerusalem(){
88
		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";
89
		final Map<String, String> project = utils.calculateProjectInfo(s);
90
		print(project);
91
		Assert.assertEquals("337895", project.get("code"));
92
		Assert.assertEquals("Opening Jerusalem Archives: For a connected History of ‘Citadinité’ in the Holy City (1840-1940)", project.get("title"));
93
		Assert.assertEquals("OPEN-JERUSALEM", project.get("acronym"));
94
	}
95

  
96
	private void print(final Map<String, String> map) {
97
		for (final Entry e : map.entrySet()) {
98
			System.out.println(e.getKey() + " = " + e.getValue());
99
		}
100
	}
101

  
102
	@Test
103
	public void testContext(){
104
		List<String> zenodoCommunities = new ArrayList<>();
105
		zenodoCommunities.add("https://zenodo.org/communities/dimpo");
106
		zenodoCommunities.add("https://zenodo.org/communities/dumbo");
107
		Map<String, String> labelMap = Maps.newHashMap();
108
		labelMap.put("dariah", "DARIAH" );
109
		labelMap.put("dh-ch", "DH-CH" );
110
		labelMap.put("foo", "FOO" );
111
		labelMap.put("bar", "" );
112

  
113
		List<OpenAIRESubmitterUtils.ContextInfo> tmp = utils.processContexts(zenodoCommunities, labelMap);
114
		Assert.assertEquals(2, tmp.size());
115

  
116
		Assert.assertTrue(tmp.get(0).getId().equals("dh-ch") || tmp.get(1).getId().equalsIgnoreCase("dh-ch"));
117
		Assert.assertTrue(tmp.get(0).getId().equals("dariah") || tmp.get(1).getId().equalsIgnoreCase("dariah"));
118
	}
119

  
120
}
modules/dnet-directindex-api/trunk/src/test/java/eu/dnetlib/openaire/directindex/objects/ResultEntryToOafTest.java
1
package eu.dnetlib.openaire.directindex.objects;
2

  
3
import com.google.common.collect.Lists;
4
import com.google.gson.Gson;
5
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
6
import eu.dnetlib.openaire.directindex.api.DirecIndexApiException;
7
import eu.dnetlib.openaire.directindex.api.OpenAIRESubmitterUtils;
8
import eu.dnetlib.openaire.directindex.objects.PidEntry;
9
import eu.dnetlib.openaire.directindex.objects.ResultEntry;
10
import org.apache.commons.lang3.StringEscapeUtils;
11
import org.apache.velocity.app.VelocityEngine;
12
import org.dom4j.Document;
13
import org.dom4j.io.OutputFormat;
14
import org.dom4j.io.SAXReader;
15
import org.dom4j.io.XMLWriter;
16
import org.junit.Before;
17
import org.junit.Test;
18
import org.junit.runner.RunWith;
19
import org.mockito.Mock;
20
import org.mockito.runners.MockitoJUnitRunner;
21

  
22
import java.io.InputStreamReader;
23
import java.io.StringReader;
24
import java.util.ArrayList;
25
import java.util.Arrays;
26
import java.util.Properties;
27

  
28
import static org.mockito.Matchers.anyString;
29
import static org.mockito.Mockito.*;
30
import static org.mockito.Mockito.doReturn;
31

  
32
/**
33
 * Created by michele on 14/12/15.
34
 */
35
@RunWith(MockitoJUnitRunner.class)
36
public class ResultEntryToOafTest {
37

  
38
	private VelocityEngine ve;
39

  
40
	private final String community_api = "https://dev-openaire.d4science.org/openaire/community/";
41

  
42
	@Mock
43
	private ISLookUpService lookUpService;
44

  
45
	private ResultEntryToOaf toOaf;
46
	private OpenAIRESubmitterUtils utils;
47

  
48
	@Before
49
	public void setUp() throws Exception {
50

  
51
		utils = mock(OpenAIRESubmitterUtils.class, withSettings().defaultAnswer(CALLS_REAL_METHODS));
52
		doReturn(Lists.newArrayList("dh-ch", "dariah", "bar", "x")).when(utils).translateZenodoCommunity("https://zenodo.org/communities/dimpo");
53
		doReturn(Lists.newArrayList()).when(utils).translateZenodoCommunity("https://zenodo.org/communities/dumbo");
54
		doReturn(Lists.newArrayList("noLabel", "enermaps")).when(utils).translateZenodoCommunity("https://sandbox.zenodo.org/communities/oac-ni");
55
		doReturn(Lists.newArrayList("noLabel", "enermaps")).when(utils).translateZenodoCommunity("https://zenodo.org/communities/oac-ni");
56

  
57

  
58

  
59
		toOaf = new ResultEntryToOaf();
60
		toOaf.setUtils(utils);
61

  
62
		final Properties props = new Properties();
63
		props.setProperty("resource.loader", "class");
64
		props.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
65
		props.setProperty("runtime.log.logsystem.class", "org.apache.velocity.runtime.log.Log4JLogChute");
66
		ve = new VelocityEngine();
67
		ve.init(props);
68

  
69
		when(lookUpService.quickSearchProfile(anyString())).thenAnswer(invocation -> {
70
			final String query = invocation.getArguments()[0].toString();
71
			if (query.contains("dnet:result_typologies")) {
72
				return Arrays.asList("publication @@@ publication", "dataset @@@ dataset", "software @@@ software", "other @@@ other");
73
			} else if (query.contains("dnet:access_modes")) {
74
				return Arrays.asList("OPEN @@@ Open Access");
75
			} else if (query.contains("dnet:publication_resource")) {
76
				return Arrays.asList("0001 @@@ Journal Article");
77
			} else if (query.contains("dnet:pid_types")) {
78
				return Arrays.asList("oai @@@ Open Archive Initiative", "doi @@@ Digital object identifier");
79
			} else if (query.contains("dnet:languages")) {
80
				return Arrays.asList("ita @@@ Italian");
81
			} else if (query.contains("ContextDSResourceType")) {
82
				return Arrays.asList(
83
						"egi::classification::natsc::math::stats @@@ Statistics and Probability",
84
						"egi::classification::natsc::math::pure @@@ Pure Mathematics",
85
						"egi::classification::natsc::math @@@ Mathematics",
86
						"egi::classification::natsc @@@ Natural Sciences",
87
						"egi::classification @@@ EGI classification scheme",
88
						"egi @@@ EGI",
89
						"enermaps @@@ Energy Research",
90
						"enermaps::selection @@@ Selected by the H2020 EnerMaps project");
91
			} else {
92
				return new ArrayList<String>();
93
			}
94
		});
95

  
96
		when(lookUpService.getResourceProfileByQuery(anyString())).thenAnswer(invocation -> "REPO NAME @@@ repo________");
97

  
98

  
99
	}
100

  
101
	@Test
102
	public void testAsIndexRecord() throws Exception {
103
		final ResultEntry pub = new ResultEntry();
104
		pub.setOriginalId("ORIG_ID_1234");
105
		pub.setTitle("TEST TITLE <test>");
106
		pub.getAuthors().add("Michele Artini");
107
		pub.getAuthors().add("Claudio Atzori");
108
		pub.getAuthors().add("Alessia Bardi");
109
		pub.setPublisher("Test publisher");
110
		pub.setDescription("DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION ");
111
		pub.setLanguage("ita");
112
		pub.setLicenseCode("OPEN");
113
		pub.setResourceType("0001");
114
		pub.setUrl("http://test.it/a=1&b=2");
115
		pub.getPids().add(new PidEntry("doi", "10.000/xyz-123"));
116
		pub.getPids().add(new PidEntry("oai", "oai:1234"));
117
		pub.setCollectedFromId("test________::zenodo");
118
		pub.setHostedById("test________::UNKNOWN");
119
		pub.getLinksToProjects().add("info:eu-repo/grantAgreement/EC/FP7/283595/EU//OpenAIREplus");
120
		pub.getLinksToProjects().add("info:eu-repo/grantAgreement/RCUK//244%2F909/EU/Making Capabilities Work/WorkAble");
121
		pub.getContexts().add("egi::classification::natsc::math::pure");
122
		pub.getContexts().add("egi::classification::natsc::math::stats");
123
		pub.getContexts().add("enermaps");
124
		pub.getContexts().add("enermaps::selection");
125
		final String xml = toOaf.asOafRecord(pub, ve, lookUpService, "http://oaf/oaf.xsd",community_api);
126

  
127
		final Document doc = new SAXReader().read(new StringReader(xml));
128

  
129
		final OutputFormat format = OutputFormat.createPrettyPrint();
130

  
131
		final XMLWriter writer = new XMLWriter(System.out, format);
132

  
133
		writer.write(doc);
134

  
135
		/* writer.close(); */
136

  
137
	}
138

  
139
	@Test
140
	public void testAsIndexRecordAccessRight() throws Exception {
141
		final ResultEntry pub = new ResultEntry();
142
		pub.setOriginalId("ORIG_ID_1234");
143
		pub.setTitle("TEST TITLE <test>");
144
		pub.getAuthors().add("Michele Artini");
145
		pub.getAuthors().add("Claudio Atzori");
146
		pub.getAuthors().add("Alessia Bardi");
147
		pub.setPublisher("Test publisher");
148
		pub.setDescription("DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION ");
149
		pub.setLanguage("ita");
150
		pub.setLicenseCode("CLOSED");
151
		pub.setAccessRightCode("OPEN");
152
		pub.setResourceType("0001");
153
		pub.setUrl("http://test.it/a=1&b=2");
154
		pub.getPids().add(new PidEntry("doi", "10.000/xyz-123"));
155
		pub.getPids().add(new PidEntry("oai", "oai:1234"));
156
		pub.setCollectedFromId("test________::zenodo");
157
		pub.setHostedById("test________::UNKNOWN");
158
		pub.getLinksToProjects().add("info:eu-repo/grantAgreement/EC/FP7/283595/EU//OpenAIREplus");
159
		pub.getLinksToProjects().add("info:eu-repo/grantAgreement/EC/FP7/244909/EU/Making Capabilities Work/WorkAble");
160
		pub.getContexts().add("egi::classification::natsc::math::pure");
161
		pub.getContexts().add("egi::classification::natsc::math::stats");
162
		final String xml = toOaf.asOafRecord(pub,ve, lookUpService, "http://oaf/oaf.xsd",community_api);
163

  
164
		final Document doc = new SAXReader().read(new StringReader(xml));
165

  
166
		final OutputFormat format = OutputFormat.createPrettyPrint();
167

  
168
		final XMLWriter writer = new XMLWriter(System.out, format);
169

  
170
		writer.write(doc);
171

  
172
		/* writer.close(); */
173

  
174
	}
175

  
176
	@Test
177
	public void testAsORP() throws Exception {
178
		final ResultEntry pub = new ResultEntry();
179
		pub.setOriginalId("ORIG_ID_1234");
180
		pub.setTitle("TEST TITLE <test>");
181
		pub.getAuthors().add("Michele Artini");
182
		pub.getAuthors().add("Claudio Atzori");
183
		pub.getAuthors().add("Alessia Bardi");
184
		pub.setPublisher("Test publisher");
185
		pub.setDescription("DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION ");
186
		pub.setLanguage("ita");
187
		pub.setLicenseCode("CLOSED");
188
		pub.setAccessRightCode("OPEN");
189
		pub.setResourceType("0020");
190
		pub.setType("other");
191
		pub.setUrl("http://test.it/a=1&b=2");
192
		pub.getPids().add(new PidEntry("doi", "10.000/xyz-123"));
193
		pub.getPids().add(new PidEntry("oai", "oai:1234"));
194
		pub.setCollectedFromId("test________::zenodo");
195
		pub.setHostedById("test________::UNKNOWN");
196
		pub.getLinksToProjects().add("info:eu-repo/grantAgreement/EC/FP7/283595/EU//OpenAIREplus");
197
		pub.getLinksToProjects().add("info:eu-repo/grantAgreement/EC/FP7/244909/EU/Making Capabilities Work/WorkAble");
198
		pub.getContexts().add("egi::classification::natsc::math::pure");
199
		pub.getContexts().add("egi::classification::natsc::math::stats");
200
		final String xml = toOaf.asOafRecord(pub,ve, lookUpService, "http://oaf/oaf.xsd",community_api);
201

  
202
		final Document doc = new SAXReader().read(new StringReader(xml));
203

  
204
		final OutputFormat format = OutputFormat.createPrettyPrint();
205

  
206
		final XMLWriter writer = new XMLWriter(System.out, format);
207

  
208
		writer.write(doc);
209

  
210
		/* writer.close(); */
211

  
212
	}
213

  
214
	@Test
215
	public void testAsIndexRecord_json() throws Exception {
216
		testAsIndexRecord_json("test_record.json");
217

  
218
	}
219

  
220
	@Test
221
	public void testAsIndexRecord_json_with_greek_chars() throws Exception {
222

  
223
		testAsIndexRecord_json("test_record_with_greek_chars.json");
224

  
225
	}
226

  
227
	@Test
228
	public void testAsIndexRecord_openaireId() throws Exception {
229

  
230
		testAsIndexRecord_json("test_record_openaireId.json");
231

  
232
	}
233

  
234
	@Test(expected = DirecIndexApiException.class)
235
	public void testAsIndexRecord_wrongOpenaireId() throws Exception {
236

  
237
		testAsIndexRecord_json("test_record_wrong_openaireId.json");
238

  
239
	}
240

  
241
	@Test
242
	public void testAsIndexRecord_json_zenodo() throws Exception {
243

  
244
		testAsIndexRecord_json("test_zenodo.json");
245

  
246
	}
247

  
248
	@Test
249
	public void testAsIndexRecord_json_zenodoWithAmpersand() throws Exception {
250

  
251
		testAsIndexRecord_json("test_zenodoAmpersandEverywhere.json");
252

  
253
	}
254

  
255
	@Test
256
	public void testAsIndexRecord_json_software() throws Exception {
257

  
258
		testAsIndexRecord_json("test_record_software.json");
259

  
260
	}
261

  
262
	@Test
263
	public void testAsIndexRecord_json_orp() throws Exception {
264

  
265
		testAsIndexRecord_json("test_record_orp.json");
266

  
267
	}
268

  
269
	private void testAsIndexRecord_json(final String filename) throws Exception {
270
		final ResultEntry pub =
271
				new Gson().fromJson(new InputStreamReader(getClass().getResourceAsStream(filename)), ResultEntry.class);
272

  
273

  
274
		final String xml = toOaf.asOafRecord(pub,ve, lookUpService, "http://oaf/oaf.xsd",community_api);
275
		//System.out.println(xml);
276

  
277
		final Document doc = new SAXReader().read(new StringReader(xml));
278

  
279
		final OutputFormat format = OutputFormat.createPrettyPrint();
280

  
281
		final XMLWriter writer = new XMLWriter(System.out, format);
282

  
283
		writer.write(doc);
284

  
285
		/* writer.close(); */
286
	}
287

  
288
	@Test
289
	public void testAsIndexRecord_json_zenodocommunities()throws Exception{
290
		testAsIndexRecord_json("test_zenodo_community.json");
291
	}
292

  
293
	@Test
294
	public void testAsIndexRecordFromSandbox_json_zenodocommunities()throws Exception{
295
		testAsIndexRecord_json("test_zenodo_community2.json");
296
	}
297

  
298
	@Test
299
	public void testEscapeUnicode() {
300
		final String unicodeTxt =
301
				"i.e. closed curves of the form $t\ud835\udfc4 [0,2\u03c0] \u21a6 (\\cos t)u + (\\sin t)v$ for suitable orthogonal vectors $u$";
302
		System.out.println(StringEscapeUtils.escapeXml11(unicodeTxt));
303
	}
304

  
305
}
modules/dnet-directindex-api/trunk/src/test/resources/eu/dnetlib/msro/openaireplus/api/objects/test_record_software.json
1
{
2
  "openaireId":"od_______278::d5b39693ac6c2197e8cf48008a982951",
3
  "originalId": "oai:rudar.ruc.dk:1800/24691",
4
  "type": "software",
5
  "title": "Software test",
6
  "authors": [
7
	"Sloan, Patrick Alexander Raaby",
8
	"Strange, Gustav Valdemar"
9
  ],
10
  "publisher": "",
11
  "description": "This is for testing software",
12
  "language": "eng",
13
  "pids": [],
14
  "licenseCode": "OPEN SOURCE",
15
  "resourceType": "0000",
16
  "url": "http://rudar.ruc.dk/handle/1800/24691",
17
  "collectedFromId": "opendoar____::278",
18
  "hostedById": "opendoar____::278",
19
  "linksToProjects": [],
20
  "contexts": []
21
}
modules/dnet-directindex-api/trunk/src/test/resources/eu/dnetlib/msro/openaireplus/api/objects/test_record_wrong_openaireId.json
1
{
2
  "openaireId":"dedup_wf_001::ab42e811",
3
  "originalId": "ORIG_ID_TEST",
4
  "type": "publication",
5
  "title": "TEST TITLE",
6
  "authors": [
7
	"Michele Artini",
8
	"Claudio Atzori",
9
	"Alessia Bardi"
10
  ],
11
  "publisher": "Test publisher",
12
  "description": "DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION",
13
  "language": "ita",
14
  "pids": [
15
	{
16
	  "type": "doi",
17
	  "value": "10.000/xyz-123"
18
	},
19
	{
20
	  "type": "oai",
21
	  "value": "oai:1234"
22
	}
23
  ],
24
  "licenseCode": "EMBARGO",
25
  "embargoEndDate": "2018-02-02",
26
  "resourceType": "0001",
27
  "url": "http://test.it/xyz",
28
  "collectedFromId": "opendoar____::2659",
29
  "hostedById": "opendoar____::2659",
30
  "linksToProjects": [
31
	"info:eu-repo/grantAgreement/EC/FP7/283595/EU//OpenAIREplus",
32
	"info:eu-repo/grantAgreement/EC/FP7/244909/EU/Making Capabilities Work/WorkAble"
33
  ],
34
  "contexts": [
35
	"egi::classification::natsc::math::pure",
36
	"egi::classification::natsc::math::stats"
37
  ]
38
}
modules/dnet-directindex-api/trunk/src/test/resources/eu/dnetlib/msro/openaireplus/api/objects/test_record_openaireId.json
1
{
2
  "openaireId":"dedup_wf_001::ab42e8116f4ae3c4021fb7c643a8167a",
3
  "originalId": "ORIG_ID_TEST",
4
  "type": "publication",
5
  "title": "TEST TITLE",
6
  "authors": [
7
	"Michele Artini",
8
	"Claudio Atzori",
9
	"Alessia Bardi"
10
  ],
11
  "publisher": "Test publisher",
12
  "description": "DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION",
13
  "language": "ita",
14
  "pids": [
15
	{
16
	  "type": "doi",
17
	  "value": "10.000/xyz-123"
18
	},
19
	{
20
	  "type": "oai",
21
	  "value": "oai:1234"
22
	}
23
  ],
24
  "accessRightCode": "EMBARGO",
25
  "licenseCode": "OPEN",
26
  "embargoEndDate": "2018-02-02",
27
  "resourceType": "0001",
28
  "url": "http://test.it/xyz",
29
  "collectedFromId": "opendoar____::2659",
30
  "hostedById": "opendoar____::2659",
31
  "linksToProjects": [
32
	"info:eu-repo/grantAgreement/EC/FP7/283595/EU//OpenAIREplus",
33
	"info:eu-repo/grantAgreement/EC/FP7/244909/EU/Making Capabilities Work/WorkAble"
34
  ],
35
  "contexts": [
36
	"egi::classification::natsc::math::pure",
37
	"egi::classification::natsc::math::stats"
38
  ]
39
}
modules/dnet-directindex-api/trunk/src/test/resources/eu/dnetlib/msro/openaireplus/api/objects/test_record.json
1
{
2
  "originalId": "ORIG_ID_12345",
3
  "title": "TEST TITLE",
4
  "authors": [
5
	"Michele Artini",
6
	"Claudio Atzori",
7
	"Alessia Bardi"
8
  ],
9
  "publisher": "Test publisher",
10
  "description": "DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION",
11
  "language": "ita",
12
  "pids": [
13
	{
14
	  "type": "doi",
15
	  "value": "10.000/xyz-123"
16
	},
17
	{
18
	  "type": "oai",
19
	  "value": "oai:1234"
20
	}
21
  ],
22
  "accessRightCode": "OPEN",
23
  "resourceType": "0001",
24
  "url": "http://test.it/xyz",
25
  "collectedFromId": "opendoar____::2659",
26
  "hostedById": "opendoar____::2367",
27
  "linksToProjects": [
28
	"info:eu-repo/grantAgreement/EC/FP7/283595/EU//OpenAIREplus",
29
	"info:eu-repo/grantAgreement/EC/FP7/244909/EU/Making Capabilities Work/WorkAble"
30
  ],
31
  "contexts": [
32
	"egi::classification::natsc::math::pure",
33
	"egi::classification::natsc::math::stats"
34
  ]
35
}
modules/dnet-directindex-api/trunk/src/test/resources/eu/dnetlib/msro/openaireplus/api/objects/test_record_orp.json
1
{
2
  "openaireId":"od_______278::d5b39693ac6c2197e8cf48008a982951",
3
  "originalId": "oai:rudar.ruc.dk:1800/24691",
4
  "type": "other",
5
  "title": "Other test record",
6
  "authors": [
7
    "Sloan, Patrick Alexander Raaby",
8
    "Strange, Gustav Valdemar"
9
  ],
10
  "publisher": "",
11
  "description": "This is for testing software",
12
  "language": "eng",
13
  "pids": [],
14
  "licenseCode": "OPEN SOURCE",
15
  "resourceType": "0000",
16
  "url": "http://rudar.ruc.dk/handle/1800/24691",
17
  "collectedFromId": "opendoar____::278",
18
  "hostedById": "opendoar____::278",
19
  "linksToProjects": [],
20
  "contexts": []
21
}
modules/dnet-directindex-api/trunk/src/test/resources/eu/dnetlib/msro/openaireplus/api/objects/test_zenodo.json
1
{
2
  "authors":[
3
	"Alouges, Fran\u00e7ois",
4
	"Di Fratta, Giovanni"
5
  ],
6
  "collectedFromId":"opendoar____::2659",
7
  "description":"The paper is about the parking 3-sphere swimmer ($\\text{sPr}_3$). This is a low-Reynolds number model swimmer composed of three balls of equal radii. The three balls can move along three horizontal axes (supported in the same plane) that mutually meet at the center of $\\text{sPr}_3$ with angles of $120^{\u2218}$ . The governing dynamical system is introduced and the implications of its geometric symmetries revealed. It is then shown that, in the first order range of small strokes, optimal periodic strokes are ellipses embedded in 3d space, i.e. closed curves of the form $t\ud835\udfc4 [0,2\u03c0] \u21a6 (\\cos t)u + (\\sin t)v$ for suitable orthogonal vectors $u$ and $v$ of $\u211d^3$. A simple analytic expression for the vectors $u$ and $v$ is derived. The results of the paper are used in a second article where the real physical dynamics of $\\text{sPr}_3$ is analyzed in the asymptotic range of very long arms. ; Comment: 17 pages, 4 figures",
8
  "hostedById":"opendoar____::2659",
9
  "licenseCode":"OPEN",
10
  "originalId":"oai:zenodo.org:996201",
11
  "pids":[
12
	{
13
	  "type":"oai",
14
	  "value":"oai:zenodo.org:996201"
15
	},
16
	{
17
	  "type":"doi",
18
	  "value":"10.5281/zenodo.996201"
19
	}
20
  ],
21
  "publisher":"Zenodo",
22
  "resourceType":"0020",
23
  "title":"Parking 3-sphere swimmer. I. Energy minimizing strokes",
24
  "type":"publication",
25
  "url":"https://zenodo.org/record/996201"
26
}
modules/dnet-directindex-api/trunk/src/test/resources/eu/dnetlib/msro/openaireplus/api/objects/test_zenodoAmpersandEverywhere.json
1
{
2
  "authors": [
3
	"Conradt, Tobias",
4
	"& members of the ISIMIP project (original data provision), cf. Hempel et al. 2013, https://doi.org/10.5194/esd-4-219-2013"
5
  ],
6
  "collectedFromId": "re3data_____::r3d100010468",
7
  "description": "<p>ISIMIP-2a climate data cutout provided for Sardinia in the framework of SIM4NEXUS & X<\/p>",
8
  "hostedById": "re3data_____::r3d100010468",
9
  "licenseCode": "OPEN",
10
  "linksToProjects": ["info:eu-repo/grantAgreement/EC/H2020/689150//Sustainable Integrated Management FOR the NEXUS of water-land-food-energy-climate for a resource-efficient Europe & beyond/SIM4NEXUS"],
11
  "originalId": "10.5281/zenodo.1460665",
12
  "pids": [
13
	{
14
	  "type": "oai",
15
	  "value": "oai:zenodo.org:1460665"
16
	},
17
	{
18
	  "type": "doi",
19
	  "value": "10.5281/zenodo.1460665"
20
	}
21
  ],
22
  "publisher": "Zenodo & Zenodo",
23
  "resourceType": "0021",
24
  "title": "sardinia_tasmax_MIROC-ESM-CHEM_rcp4p5_2006-2099_daily.nc4 & the title has && in it",
25
  "type": "dataset",
26
  "url": "https://zenodo.org/record/1460665"
27
}
modules/dnet-directindex-api/trunk/src/test/resources/eu/dnetlib/msro/openaireplus/api/objects/test_record_ariadne.json
1
{
2
  "openaireId":"od_______278::d5b39693ac6c2197e8cf48008a982950",
3
  "originalId": "oai:rudar.ruc.dk:1800/24690",
4
  "type": "publication",
5
  "title": "Autofiktion",
6
  "authors": [
7
	"Sloan, Patrick Alexander Raaby",
8
	"Strange, Gustav Valdemar",
9
	"Freund-Jensen, Sofie",
10
	"Canvin, Emilie Meistrup",
11
	"Faaborg, Ida Selvejer",
12
	"Kruse, Mikkel"
13
  ],
14
  "publisher": "",
15
  "description": "The following paper is a project on the autofictional book Færdig med Eddy Bellegueule by Édouard Louis (2015). The main focus is to ascertain how the novel is an expression of the author’s effort to connect social life and literature, and what part autofiction as a genre plays in this process. A textual analysis will describe the narrator’s position, and the aesthetic grip of the novel. Furthermore, we will analyze the central themes in Louis’ novel with theories by sociologist Pierre Bourdieu, gender theorist Judith Butler and postcolonial theorist Gayatri Spivak. This includes symbolic violence, gender roles, language and suppression. With use of classic literary theory and the more recent and specific theory on autofiction, the paper concludes, that Færdig med Eddy Bellegueule is based on non-fictional events, but presents these events through a fictionalization that raise the story into a literary work of art. The genre autofiction encircles a current tendency to blend non-fictional events and characters into literature, and Færdig med Eddy Bellegueule writes itself perfectly into this twilight zone between fact and fiction.",
16
  "language": "eng",
17
  "pids": [],
18
  "licenseCode": "OPEN",
19
  "resourceType": "0006",
20
  "url": "http://rudar.ruc.dk/handle/1800/24690",
21
  "collectedFromId": "opendoar____::278",
22
  "hostedById": "opendoar____::278",
23
  "linksToProjects": [],
24
  "contexts": []
25
}
modules/dnet-directindex-api/trunk/src/test/resources/eu/dnetlib/msro/openaireplus/api/objects/test_zenodo_problems.json
1
{
2
  "authors": ["Milanese, Alessio", "Mende, Daniel", "Zeller, Georg", "Sunagawa, Shinichi"],
3
  "collectedFromId": "re3data_____::r3d100010468",
4
  "description": "<p>We simulated ten human gut metagenomic samples to assess the taxonomic quantification accuracy of the mOTUs tool (<a href=\"http: \// motu-tool.org \/\">link</a>). In this directory you can find the metagenomic samples, the gold standard (used to produce them) and the profiles obtained with four metagenomic profiler tools.</p>\\n\\n<p>Check README.txt for more information.</p>",
5
  "hostedById": "re3data_____::r3d100010468",
6
  "licenseCode": "OPEN",
7
  "originalId": "10.5281/zenodo.1473645",
8
  "pids": [
9
    {"type": "oai", "value": "oai:zenodo.org:1473645"},
10
    {"type": "doi", "value": "10.5281/zenodo.1473645"}
11
  ],
12
  "publisher": "Zenodo",
13
  "resourceType": "0021",
14
  "title": "Simulated Human gut metagenomic samples to benchmark mOTUs v2",
15
  "type": "dataset",
16
  "url": "https://zenodo.org/record/1473645",
17
  "version": "2"
18
}
modules/dnet-directindex-api/trunk/src/test/resources/eu/dnetlib/msro/openaireplus/api/objects/submit_test_record.sh
1
#!/bin/bash
2

  
3
curl -H "Content-Type: application/json" --data @test_record.json "http://localhost:8280/app/mvc/api/publications/feedObject"
modules/dnet-directindex-api/trunk/src/test/resources/eu/dnetlib/msro/openaireplus/api/objects/test_zenodo_community.json
1
{"authors": ["Dag Haug", "Marius J\xf8hndal"],
2
  "collectedFromId": "re3data_____::r3d100010468",
3
  "contexts": ["https://sandbox.zenodo.org/communities/oac-ni","pippo"],
4
  "description": "<p>Official releases of the PROIEL treebank of ancient Indo-European languages</p>",
5
  "hostedById": "re3data_____::r3d100010468",
6
  "licenseCode": "OPEN",
7
  "originalId": "10.5281/zenodo.11003",
8
  "pids": [{"type": "oai", "value": "oai:zenodo.org:11003"},
9
  {"type": "doi", "value": "10.5281/zenodo.11003"}],
10
  "publisher": "Zenodo",
11
  "resourceType": "0021",
12
  "title": "proiel-treebank: 20140723 version",
13
  "type": "dataset",
14
  "url": "https://zenodo.org/record/11003"}
modules/dnet-directindex-api/trunk/src/test/resources/eu/dnetlib/msro/openaireplus/api/objects/test_zenodo_community2.json
1
{"authors":["test"],
2
  "collectedFromId":"re3data_____::r3d100010468",
3
  "contexts":["https://zenodo.org/communities/oac-ni"],
4
  "description":"<p>test</p>",
5
  "hostedById":"re3data_____::r3d100010468",
6
  "licenseCode":"OPEN",
7
  "originalId":"oai:zenodo.org:315784",
8
  "pids":[{"type":"oai","value":"oai:zenodo.org:315784"},
9
    {"type":"doi","value":"10.5072/zenodo.315784"}],"resourceType":"0020","title":"test","type":"other","url":"https://zenodo.org/record/315784"}
modules/dnet-directindex-api/trunk/src/test/resources/eu/dnetlib/msro/openaireplus/api/objects/test_record_complete.json
1
{
2
  "originalId": "ORIG_ID_TEST",
3
  "type": "publication",
4
  "title": "TEST TITLE",
5
  "authors": [
6
	"Michele Artini",
7
	"Claudio Atzori",
8
	"Alessia Bardi"
9
  ],
10
  "publisher": "Test publisher",
11
  "description": "DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION",
12
  "language": "ita",
13
  "pids": [
14
	{
15
	  "type": "doi",
16
	  "value": "10.000/xyz-123"
17
	},
18
	{
19
	  "type": "oai",
20
	  "value": "oai:1234"
21
	}
22
  ],
23
  "accessRightCode": "EMBARGO",
24
  "embargoEndDate": "2018-02-02",
25
  "resourceType": "0001",
26
  "url": "http://test.it/xyz",
27
  "collectedFromId": "opendoar____::2659",
28
  "hostedById": "opendoar____::2659",
29
  "linksToProjects": [
30
	"info:eu-repo/grantAgreement/EC/FP7/283595/EU//OpenAIREplus",
31
	"info:eu-repo/grantAgreement/EC/FP7/244909/EU/Making Capabilities Work/WorkAble"
32
  ],
33
  "contexts": [
34
	"egi::classification::natsc::math::pure",
35
	"egi::classification::natsc::math::stats"
36
  ]
37
}
modules/dnet-directindex-api/trunk/src/test/resources/eu/dnetlib/msro/openaireplus/api/objects/test_record_with_greek_chars.json
1
{
2
  "originalId": "ORIG_ID_12345",
3
  "title": "TEST TITLE WITH Greek Characters",
4
  "authors": [
5
	"αβγδεζηθικλμ νξοπρσςτυφχψω",
6
	"ΑΒΓΔΕΖΗΘΙΚΛ ΜΝΞΟΠΡΣΤΥΦΧΨΩ"
7
  ],
8
  "publisher": "âââââââ",
9
  "description": "Αν περιμένατε να βρίσκεται εδώ μια σελίδα και δεν υπάρχει, η σελίδα μπορεί να μην εμφανίζεται λόγω καθυστέρησης στην ανανέωση της βάσης δεδομένων, ή μπορεί να έχει διαγραφεί. (Δείτε την γρήγορη διαγραφή σελίδων για πιθανούς λόγους). Μπορείτε να δοκιμάστε την λειτουργία εκκαθάρισης, και να ελέγξετε το αρχείο διαγραφών.",
10
  "language": "ell",
11
  "pids": [
12
	{
13
	  "type": "doi",
14
	  "value": "10.000/xyz-123-gr"
15
	}
16
  ],
17
  "licenseCode": "EMBARGO",
18
  "embargoEndDate": "2018-02-02",
19
  "resourceType": "0001",
20
  "url": "http://test.it/xyz",
21
  "collectedFromId": "opendoar____::2659",
22
  "hostedById": "opendoar____::2367",
23
  "linksToProjects": [
24
	"info:eu-repo/grantAgreement/EC/FP7/123456/EU//Test"
25
  ],
26
  "contexts": [
27
	"egi::classification::natsc::math::stats"
28
  ]
29
}
modules/dnet-directindex-api/trunk/src/test/resources/eu/dnetlib/openaire/directindex/objects/test_record_software.json
1
{
2
  "openaireId":"od_______278::d5b39693ac6c2197e8cf48008a982951",
3
  "originalId": "oai:rudar.ruc.dk:1800/24691",
4
  "type": "software",
5
  "title": "Software test",
6
  "authors": [
7
	"Sloan, Patrick Alexander Raaby",
8
	"Strange, Gustav Valdemar"
9
  ],
10
  "publisher": "",
11
  "description": "This is for testing software",
12
  "language": "eng",
13
  "pids": [],
14
  "licenseCode": "OPEN SOURCE",
15
  "resourceType": "0000",
16
  "url": "http://rudar.ruc.dk/handle/1800/24691",
17
  "collectedFromId": "opendoar____::278",
18
  "hostedById": "opendoar____::278",
19
  "linksToProjects": [],
20
  "contexts": []
21
}
modules/dnet-directindex-api/trunk/src/test/resources/eu/dnetlib/openaire/directindex/objects/test_record_wrong_openaireId.json
1
{
2
  "openaireId":"dedup_wf_001::ab42e811",
3
  "originalId": "ORIG_ID_TEST",
4
  "type": "publication",
5
  "title": "TEST TITLE",
6
  "authors": [
7
	"Michele Artini",
8
	"Claudio Atzori",
9
	"Alessia Bardi"
10
  ],
11
  "publisher": "Test publisher",
12
  "description": "DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION",
13
  "language": "ita",
14
  "pids": [
15
	{
16
	  "type": "doi",
17
	  "value": "10.000/xyz-123"
18
	},
19
	{
20
	  "type": "oai",
21
	  "value": "oai:1234"
22
	}
23
  ],
24
  "licenseCode": "EMBARGO",
25
  "embargoEndDate": "2018-02-02",
26
  "resourceType": "0001",
27
  "url": "http://test.it/xyz",
28
  "collectedFromId": "opendoar____::2659",
29
  "hostedById": "opendoar____::2659",
30
  "linksToProjects": [
31
	"info:eu-repo/grantAgreement/EC/FP7/283595/EU//OpenAIREplus",
32
	"info:eu-repo/grantAgreement/EC/FP7/244909/EU/Making Capabilities Work/WorkAble"
33
  ],
34
  "contexts": [
35
	"egi::classification::natsc::math::pure",
36
	"egi::classification::natsc::math::stats"
37
  ]
38
}
modules/dnet-directindex-api/trunk/src/test/resources/eu/dnetlib/openaire/directindex/objects/test_record_openaireId.json
1
{
2
  "openaireId":"dedup_wf_001::ab42e8116f4ae3c4021fb7c643a8167a",
3
  "originalId": "ORIG_ID_TEST",
4
  "type": "publication",
5
  "title": "TEST TITLE",
6
  "authors": [
7
	"Michele Artini",
8
	"Claudio Atzori",
9
	"Alessia Bardi"
10
  ],
11
  "publisher": "Test publisher",
12
  "description": "DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION",
13
  "language": "ita",
14
  "pids": [
15
	{
16
	  "type": "doi",
17
	  "value": "10.000/xyz-123"
18
	},
19
	{
20
	  "type": "oai",
21
	  "value": "oai:1234"
22
	}
23
  ],
24
  "accessRightCode": "EMBARGO",
25
  "licenseCode": "OPEN",
26
  "embargoEndDate": "2018-02-02",
27
  "resourceType": "0001",
28
  "url": "http://test.it/xyz",
29
  "collectedFromId": "opendoar____::2659",
30
  "hostedById": "opendoar____::2659",
31
  "linksToProjects": [
32
	"info:eu-repo/grantAgreement/EC/FP7/283595/EU//OpenAIREplus",
33
	"info:eu-repo/grantAgreement/EC/FP7/244909/EU/Making Capabilities Work/WorkAble"
34
  ],
35
  "contexts": [
36
	"egi::classification::natsc::math::pure",
37
	"egi::classification::natsc::math::stats"
38
  ]
39
}
modules/dnet-directindex-api/trunk/src/test/resources/eu/dnetlib/openaire/directindex/objects/test_record.json
1
{
2
  "originalId": "ORIG_ID_12345",
3
  "title": "TEST TITLE",
4
  "authors": [
5
	"Michele Artini",
6
	"Claudio Atzori",
7
	"Alessia Bardi"
8
  ],
9
  "publisher": "Test publisher",
10
  "description": "DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION",
11
  "language": "ita",
12
  "pids": [
13
	{
14
	  "type": "doi",
15
	  "value": "10.000/xyz-123"
16
	},
17
	{
18
	  "type": "oai",
19
	  "value": "oai:1234"
20
	}
21
  ],
22
  "accessRightCode": "OPEN",
23
  "resourceType": "0001",
24
  "url": "http://test.it/xyz",
25
  "collectedFromId": "opendoar____::2659",
26
  "hostedById": "opendoar____::2367",
27
  "linksToProjects": [
28
	"info:eu-repo/grantAgreement/EC/FP7/283595/EU//OpenAIREplus",
29
	"info:eu-repo/grantAgreement/EC/FP7/244909/EU/Making Capabilities Work/WorkAble"
30
  ],
31
  "contexts": [
32
	"egi::classification::natsc::math::pure",
33
	"egi::classification::natsc::math::stats"
34
  ]
35
}
modules/dnet-directindex-api/trunk/src/test/resources/eu/dnetlib/openaire/directindex/objects/test_record_orp.json
1
{
2
  "openaireId":"od_______278::d5b39693ac6c2197e8cf48008a982951",
3
  "originalId": "oai:rudar.ruc.dk:1800/24691",
4
  "type": "other",
5
  "title": "Other test record",
6
  "authors": [
7
    "Sloan, Patrick Alexander Raaby",
8
    "Strange, Gustav Valdemar"
9
  ],
10
  "publisher": "",
11
  "description": "This is for testing software",
12
  "language": "eng",
13
  "pids": [],
14
  "licenseCode": "OPEN SOURCE",
15
  "resourceType": "0000",
16
  "url": "http://rudar.ruc.dk/handle/1800/24691",
17
  "collectedFromId": "opendoar____::278",
18
  "hostedById": "opendoar____::278",
19
  "linksToProjects": [],
20
  "contexts": []
21
}
modules/dnet-directindex-api/trunk/src/test/resources/eu/dnetlib/openaire/directindex/objects/test_zenodo.json
1
{
2
  "authors":[
3
	"Alouges, Fran\u00e7ois",
4
	"Di Fratta, Giovanni"
5
  ],
6
  "collectedFromId":"opendoar____::2659",
7
  "description":"The paper is about the parking 3-sphere swimmer ($\\text{sPr}_3$). This is a low-Reynolds number model swimmer composed of three balls of equal radii. The three balls can move along three horizontal axes (supported in the same plane) that mutually meet at the center of $\\text{sPr}_3$ with angles of $120^{\u2218}$ . The governing dynamical system is introduced and the implications of its geometric symmetries revealed. It is then shown that, in the first order range of small strokes, optimal periodic strokes are ellipses embedded in 3d space, i.e. closed curves of the form $t\ud835\udfc4 [0,2\u03c0] \u21a6 (\\cos t)u + (\\sin t)v$ for suitable orthogonal vectors $u$ and $v$ of $\u211d^3$. A simple analytic expression for the vectors $u$ and $v$ is derived. The results of the paper are used in a second article where the real physical dynamics of $\\text{sPr}_3$ is analyzed in the asymptotic range of very long arms. ; Comment: 17 pages, 4 figures",
8
  "hostedById":"opendoar____::2659",
9
  "licenseCode":"OPEN",
10
  "originalId":"oai:zenodo.org:996201",
11
  "pids":[
12
	{
13
	  "type":"oai",
14
	  "value":"oai:zenodo.org:996201"
15
	},
16
	{
17
	  "type":"doi",
18
	  "value":"10.5281/zenodo.996201"
19
	}
20
  ],
21
  "publisher":"Zenodo",
22
  "resourceType":"0020",
23
  "title":"Parking 3-sphere swimmer. I. Energy minimizing strokes",
24
  "type":"publication",
25
  "url":"https://zenodo.org/record/996201"
26
}
modules/dnet-directindex-api/trunk/src/test/resources/eu/dnetlib/openaire/directindex/objects/test_zenodoAmpersandEverywhere.json
1
{
2
  "authors": [
3
	"Conradt, Tobias",
4
	"& members of the ISIMIP project (original data provision), cf. Hempel et al. 2013, https://doi.org/10.5194/esd-4-219-2013"
5
  ],
6
  "collectedFromId": "re3data_____::r3d100010468",
7
  "description": "<p>ISIMIP-2a climate data cutout provided for Sardinia in the framework of SIM4NEXUS & X<\/p>",
8
  "hostedById": "re3data_____::r3d100010468",
9
  "licenseCode": "OPEN",
10
  "linksToProjects": ["info:eu-repo/grantAgreement/EC/H2020/689150//Sustainable Integrated Management FOR the NEXUS of water-land-food-energy-climate for a resource-efficient Europe & beyond/SIM4NEXUS"],
11
  "originalId": "10.5281/zenodo.1460665",
12
  "pids": [
13
	{
14
	  "type": "oai",
15
	  "value": "oai:zenodo.org:1460665"
16
	},
17
	{
18
	  "type": "doi",
19
	  "value": "10.5281/zenodo.1460665"
20
	}
21
  ],
22
  "publisher": "Zenodo & Zenodo",
23
  "resourceType": "0021",
24
  "title": "sardinia_tasmax_MIROC-ESM-CHEM_rcp4p5_2006-2099_daily.nc4 & the title has && in it",
25
  "type": "dataset",
26
  "url": "https://zenodo.org/record/1460665"
27
}
modules/dnet-directindex-api/trunk/src/test/resources/eu/dnetlib/openaire/directindex/objects/test_record_ariadne.json
1
{
2
  "openaireId":"od_______278::d5b39693ac6c2197e8cf48008a982950",
3
  "originalId": "oai:rudar.ruc.dk:1800/24690",
4
  "type": "publication",
5
  "title": "Autofiktion",
6
  "authors": [
7
	"Sloan, Patrick Alexander Raaby",
8
	"Strange, Gustav Valdemar",
9
	"Freund-Jensen, Sofie",
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff