Revision 50412
Added by Alessia Bardi over 6 years ago
OpenaireApiClientTest.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.api.client; |
2 | 2 |
|
3 |
import static org.junit.Assert.assertEquals; |
|
4 |
import static org.junit.Assert.assertNull; |
|
5 |
|
|
6 | 3 |
import java.net.URI; |
7 | 4 |
import java.net.URISyntaxException; |
8 | 5 |
import java.util.List; |
9 |
|
|
10 | 6 |
import javax.annotation.Resource; |
11 | 7 |
|
8 |
import com.google.common.collect.Lists; |
|
12 | 9 |
import org.apache.http.client.utils.URIBuilder; |
13 | 10 |
import org.dom4j.Document; |
14 | 11 |
import org.dom4j.DocumentException; |
... | ... | |
18 | 15 |
import org.springframework.test.context.ContextConfiguration; |
19 | 16 |
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
20 | 17 |
|
21 |
import com.google.common.collect.Lists; |
|
18 |
import static org.junit.Assert.assertEquals; |
|
19 |
import static org.junit.Assert.assertNull; |
|
22 | 20 |
|
23 | 21 |
@RunWith(SpringJUnit4ClassRunner.class) |
24 | 22 |
@ContextConfiguration(locations = { "/eu/dnetlib/api/client/applicationContext-dnet-openaire-http-api-client.xml" }) |
... | ... | |
28 | 26 |
private ApiClient apiClient; |
29 | 27 |
// public static String requestBaseURL = "http://api.openaire.eu"; |
30 | 28 |
// public static String basePath = "/search/"; |
31 |
public static String requestBaseURL = "http://beta.services.openaire.eu:8380";
|
|
29 |
public static String requestBaseURL = "http://beta.services.openaire.eu:8480";
|
|
32 | 30 |
public static String basePath = "/search/api/"; |
33 | 31 |
// public static String requestBaseURL = "http://rudie.di.uoa.gr:8080"; |
34 | 32 |
// public static String basePath = "/dnet-functionality-services-1.0.0-SNAPSHOT/api/"; |
35 | 33 |
public static String publicationsPath = basePath + "publications"; |
36 | 34 |
public static String datasetsPath = basePath + "datasets"; |
37 | 35 |
public static String projectsPath = basePath + "projects"; |
38 |
public static String publicationsQuery = "((deletedbyinference = false) AND (oaftype exact result)) and (resulttypeid exact publication)";
|
|
39 |
public static String datasetsQuery = "((deletedbyinference = false) AND (oaftype exact result)) and (resulttypeid exact dataset)";
|
|
36 |
public static String publicationsQuery = "(oaftype exact result) and (resulttypeid exact publication)";
|
|
37 |
public static String datasetsQuery = "(oaftype exact result) and (resulttypeid exact dataset)";
|
|
40 | 38 |
public static int defaultPageSize = 10; |
41 |
public static List<String> commonParameters = Lists.newArrayList("model", "keywords", "page", "size", "format", "sortBy", "hasECFunding", "hasUKFunding", |
|
42 |
"funder", "fundingStream", "FP7scientificArea"); |
|
39 |
|
|
40 |
//TODO: re-introduce "FP7scientificArea" when the index with relfundinglevelX_name is ready |
|
41 |
public static List<String> commonParameters = Lists.newArrayList("model", "keywords", "page", "size", "format", "sortBy", "hasECFunding", "hasWTFunding", |
|
42 |
"funder"); |
|
43 |
//TODO: re-introduce "fundingStream" when the index with relfundinglevelX_name is ready |
|
43 | 44 |
public static List<String> publicationParameters = Lists.newArrayList("author", "doi", "FP7ProjectID", "fromDateAccepted", "hasProject", "OA", |
44 | 45 |
"openaireAuthorID", "openaireProjectID", "openaireProviderID", "openairePublicationID", "projectID", "title", "toDateAccepted"); |
45 |
public static List<String> datasetParameters = Lists.newArrayList("author", "doi", "FP7ProjectID", "fromDateCollected", "hasProject", "OA", |
|
46 |
"openaireAuthorID", "openaireProjectID", "openaireProviderID", "openaireDatasetID", "projectID", "title", "toDateCollected"); |
|
46 |
//TODO: re-introduce "fundingStream" when the index with relfundinglevelX_name is ready |
|
47 |
public static List<String> datasetParameters = Lists.newArrayList("author", "doi", "FP7ProjectID", "fromDateAccepted", |
|
48 |
"funder", "hasProject", "OA", |
|
49 |
"openaireAuthorID", "openaireProjectID", "openaireProviderID", "openaireDatasetID", "projectID", "title", "toDateAccepted"); |
|
50 |
|
|
47 | 51 |
public static List<String> projectParameters = Lists.newArrayList("name", "acronym", "grantID", "callID", "startYear", "participantCountries", |
48 | 52 |
"participantAcronyms", "endYear"); |
49 |
public static List<String> sortByParams_results = Lists.newArrayList("dateofcollection", "resultstoragedate", "resultstoragedate", "resultembargoenddate", |
|
53 |
//TODO Current not existing: resultstoragedate, to be removed from the docs for datasets and publications |
|
54 |
public static List<String> sortByParams_results = Lists.newArrayList("dateofcollection", "resultembargoenddate", |
|
50 | 55 |
"resultembargoendyear", "resultdateofacceptance", "resultacceptanceyear"); |
51 | 56 |
public static List<String> sortByParams_projects = Lists.newArrayList("projectstartdate", "projectstartyear", "projectenddate", "projectendyear", |
52 | 57 |
"projectduration"); |
Also available in: Unified diff
Migrated from dnet40 and adapted to current version of the OpenAIRE Search API.