Project

General

Profile

« Previous | Next » 

Revision 60371

changed settings for FCT rest api

View differences:

RestCollectorPluginTest.java
20 20
 */
21 21
public class RestCollectorPluginTest {
22 22

  
23
	private String baseUrl = "https://share.osf.io/api/v2/search/creativeworks/_search";
24
	private String resumptionType = "count";
25
	private String resumptionParam = "from";
26
	private String entityXpath = "//hits/hits";
27
	private String resumptionXpath = "//hits";
28
	private String resultTotalXpath = "//hits/total";
29
	private String resultFormatParam = "format";
30
	private String resultFormatValue = "json";
31
	private String resultSizeParam = "size";
32
        private String resultSizeValue = "10";
33
	// private String query = "q=%28sources%3ASocArXiv+AND+type%3Apreprint%29";
34
	private String query = "q=%28sources%3AengrXiv+AND+type%3Apreprint%29";
35
    // private String query = "=(sources:engrXiv AND type:preprint)";
23
	//Settings for FCT rest endpoint
24

  
25
	private String baseUrl = "https://etl.ptcris.pt/services/searches/projects";
26
	private String resumptionType = "page";
27
	private String resumptionParam = "page";
28
	private String resumptionXpath = "";
29
	private String resultTotalXpath = "//*[local-name()='paging']/*[local-name()='maxPages']";
30
	private String entityXpath = "//*[local-name()='ListRecords']/*[local-name()='record']";
31
	private String resultFormatParam = "";
32
	private String resultFormatValue = "xml";              //  Change from lowerCase to one UpperCase
33
	private String resultSizeParam = "recordsPerPage";
34
	private String resultSizeValue = "100";
35
	private String authMethod = "basic";
36
	private String authToken = "T1BFTkFJUkVfQURNSU46NC01ITM1NkZNOQ==";
37
	private String resultOffsetParam = "";
38
	private String query = "startDateFrom=1999-01-01&startDateTo=1999-12-31&pagination=true";
39

  
40
	//private String baseUrl = "https://share.osf.io/api/v2/search/creativeworks/_search";
41
	//private String resumptionType = "count";
42
	//private String resumptionParam = "from";
43
	//private String entityXpath = "//hits/hits";
44
	//private String resumptionXpath = "//hits";
45
	//private String resultTotalXpath = "//hits/total";
46
	//private String resultFormatParam = "format";
47
	//private String resultFormatValue = "json";
48
	//private String resultSizeParam = "size";
49
    //    private String resultSizeValue = "10";
50
	//// private String query = "q=%28sources%3ASocArXiv+AND+type%3Apreprint%29";
51
	//private String query = "q=%28sources%3AengrXiv+AND+type%3Apreprint%29";
52
    //// private String query = "=(sources:engrXiv AND type:preprint)";
36 53
    
37 54
	private String protocolDescriptor = "rest_json2xml"; 
38 55
	private InterfaceDescriptor ifDesc = new InterfaceDescriptor();
......
51 68
                params.put("resultSizeValue", resultSizeValue);
52 69
		params.put("queryParams", query);
53 70
		params.put("entityXpath", entityXpath);
71

  
72
		params.put("authMethod", authMethod);
73
		params.put("authToken", authToken);
54 74
		
55 75
		ifDesc.setBaseUrl(baseUrl);
56 76
		ifDesc.setParams(params);
......
70 90
			Assert.assertTrue(s.length() > 0);
71 91
			i++;
72 92
			System.out.println(s);
73
			if (i > 200)
74
				break;
93
//			if (i > 200)
94
//				break;
75 95
		}
76 96
		System.out.println(i);
77 97
		Assert.assertTrue(i > 0);
78 98
	}
99

  
100

  
101

  
79 102
}
80 103

  

Also available in: Unified diff