Revision 32788
Added by Alessia Bardi over 9 years ago
OpenaireProjectsApiClientTest.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.api.client; |
2 | 2 |
|
3 |
import static org.junit.Assert.assertNotNull; |
|
4 |
|
|
3 | 5 |
import java.net.URI; |
4 | 6 |
import java.net.URISyntaxException; |
5 | 7 |
|
6 | 8 |
import org.apache.http.client.utils.URIBuilder; |
7 | 9 |
import org.dom4j.DocumentException; |
10 |
import org.dom4j.DocumentHelper; |
|
8 | 11 |
import org.junit.Test; |
9 | 12 |
|
13 |
import eu.dnetlib.api.utils.OpenAireDocumentPage; |
|
14 |
|
|
10 | 15 |
public class OpenaireProjectsApiClientTest extends OpenaireApiClientTest { |
11 | 16 |
|
12 | 17 |
@Test |
13 |
public void testProjectsOpenaire() throws URISyntaxException { |
|
18 |
public void testProjectsOpenaire() throws URISyntaxException, DocumentException {
|
|
14 | 19 |
URIBuilder builder = new URIBuilder(requestBaseURL).setPath(projectsPath); |
15 |
String results = getApiClient().doRequest(EntityType.project, ApiModel.openaire, builder.build()); |
|
16 |
System.out.println(results); |
|
20 |
String results = getApiClient().doRequest(EntityType.project, ApiModel.none, builder.build()); |
|
21 |
OpenAireDocumentPage page = new OpenAireDocumentPage(DocumentHelper.parseText(results)); |
|
22 |
assertNotNull(page); |
|
17 | 23 |
} |
18 | 24 |
|
19 | 25 |
@Test |
... | ... | |
23 | 29 |
URIBuilder builder = new URIBuilder(requestBaseURL).setPath(projectsPath).addParameter(param, "test"); |
24 | 30 |
URI uri = builder.build(); |
25 | 31 |
System.out.println(uri); |
26 |
String results = getApiClient().doRequest(EntityType.project, ApiModel.openaire, uri);
|
|
32 |
String results = getApiClient().doRequest(EntityType.project, ApiModel.none, uri);
|
|
27 | 33 |
checkNotException(results); |
28 | 34 |
} |
29 | 35 |
} |
... | ... | |
32 | 38 |
URIBuilder builder = new URIBuilder(requestBaseURL).setPath(projectsPath).addParameter(param, "test"); |
33 | 39 |
URI uri = builder.build(); |
34 | 40 |
System.out.println(uri); |
35 |
String results = getApiClient().doRequest(EntityType.project, ApiModel.openaire, uri);
|
|
41 |
String results = getApiClient().doRequest(EntityType.project, ApiModel.none, uri);
|
|
36 | 42 |
checkNotException(results); |
37 | 43 |
} |
38 | 44 |
} |
39 | 45 |
} |
46 |
|
|
47 |
@Test |
|
48 |
public void testSortByProjectsParameters() throws URISyntaxException, DocumentException { |
|
49 |
checkSortByParamaters(EntityType.project); |
|
50 |
} |
|
40 | 51 |
} |
Also available in: Unified diff
more tests