1 |
57029
|
argiro.kok
|
package eu.dnetlib.data.claims;
|
2 |
40005
|
argiro.kok
|
|
3 |
|
|
/**
|
4 |
41260
|
argiro.kok
|
* Created by Eri on 18/11/2015.
|
5 |
|
|
*/
|
6 |
40005
|
argiro.kok
|
|
7 |
|
|
|
8 |
57029
|
argiro.kok
|
import eu.dnetlib.data.claims.entity.Claim;
|
9 |
|
|
import eu.dnetlib.data.claims.entity.OpenaireEntity;
|
10 |
|
|
import eu.dnetlib.data.claims.entity.Project;
|
11 |
|
|
import eu.dnetlib.data.claims.entity.Result;
|
12 |
|
|
import eu.dnetlib.data.claims.handler.*;
|
13 |
|
|
import eu.dnetlib.data.claims.parser.ExternalRecordParser;
|
14 |
|
|
import eu.dnetlib.data.claims.sql.SQLStoreException;
|
15 |
|
|
import eu.dnetlib.data.claims.sql.SqlDAO;
|
16 |
|
|
import eu.dnetlib.data.claims.sql.SqlStore;
|
17 |
|
|
import eu.dnetlib.data.claims.utils.*;
|
18 |
53916
|
konstantin
|
import eu.dnetlib.data.emailSender.EmailSender;
|
19 |
62526
|
katerina.i
|
import org.apache.logging.log4j.Level;
|
20 |
|
|
import org.apache.logging.log4j.LogManager;
|
21 |
|
|
import org.apache.logging.log4j.Logger;
|
22 |
|
|
import org.apache.logging.log4j.core.config.Configurator;
|
23 |
|
|
import org.apache.logging.log4j.core.config.DefaultConfiguration;
|
24 |
40005
|
argiro.kok
|
import org.junit.Before;
|
25 |
|
|
import org.junit.Test;
|
26 |
|
|
import org.junit.runner.RunWith;
|
27 |
41444
|
argiro.kok
|
import org.springframework.context.ApplicationContext;
|
28 |
47008
|
argiro.kok
|
import org.springframework.context.annotation.PropertySource;
|
29 |
41444
|
argiro.kok
|
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
30 |
40005
|
argiro.kok
|
import org.springframework.test.context.ContextConfiguration;
|
31 |
|
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
32 |
|
|
|
33 |
41157
|
argiro.kok
|
import java.sql.ResultSet;
|
34 |
57029
|
argiro.kok
|
import java.util.ArrayList;
|
35 |
|
|
import java.util.Calendar;
|
36 |
|
|
import java.util.List;
|
37 |
40086
|
argiro.kok
|
|
38 |
40941
|
argiro.kok
|
import static junit.framework.Assert.assertNotNull;
|
39 |
|
|
|
40 |
40005
|
argiro.kok
|
/**
|
41 |
41260
|
argiro.kok
|
* @author eri
|
42 |
|
|
*/
|
43 |
40005
|
argiro.kok
|
@RunWith(SpringJUnit4ClassRunner.class)
|
44 |
57031
|
argiro.kok
|
@ContextConfiguration(locations = {"springContext-claims.xml"})
|
45 |
|
|
@PropertySource("springContext-claims.properties")
|
46 |
40005
|
argiro.kok
|
public class TestClass {
|
47 |
62526
|
katerina.i
|
private Logger log = LogManager.getLogger(this.getClass());
|
48 |
40946
|
argiro.kok
|
|
49 |
40005
|
argiro.kok
|
|
50 |
|
|
private SqlDAO sqlDAO;
|
51 |
42199
|
argiro.kok
|
private SqlStore sqlStore;
|
52 |
40005
|
argiro.kok
|
|
53 |
41162
|
argiro.kok
|
private QueryGenerator queryGenerator;
|
54 |
40773
|
argiro.kok
|
|
55 |
41444
|
argiro.kok
|
ProjectHandler projectHandler = null;
|
56 |
46977
|
argiro.kok
|
DirectIndexHandler directIndexHandler = null;
|
57 |
46918
|
argiro.kok
|
FetchProjectHandler fetchProjectHandler = null;
|
58 |
41444
|
argiro.kok
|
IndexResultHandler indexResultHandler = null;
|
59 |
|
|
ExternalRecordHandler externalRecordHandler = null;
|
60 |
|
|
ResultHandler resultHandler = null;
|
61 |
41162
|
argiro.kok
|
|
62 |
41791
|
argiro.kok
|
FetchClaimHandler fetchClaimHandler = null;
|
63 |
41444
|
argiro.kok
|
ClaimHandler claimHandler = null;
|
64 |
47039
|
argiro.kok
|
ClaimValidation claimValidation = null;
|
65 |
41444
|
argiro.kok
|
|
66 |
53916
|
konstantin
|
EmailSender emailSender = null;
|
67 |
58341
|
argiro.kok
|
ContextUtils contextUtils = null;
|
68 |
41444
|
argiro.kok
|
|
69 |
53916
|
konstantin
|
|
70 |
41162
|
argiro.kok
|
@Before
|
71 |
40005
|
argiro.kok
|
public void init() throws Exception {
|
72 |
62526
|
katerina.i
|
Configurator.initialize(new DefaultConfiguration());
|
73 |
|
|
Configurator.setRootLevel(Level.INFO);
|
74 |
57031
|
argiro.kok
|
ApplicationContext context = new ClassPathXmlApplicationContext("eu/dnetlib/data/claims/springContext-claims.xml");
|
75 |
47008
|
argiro.kok
|
|
76 |
46977
|
argiro.kok
|
directIndexHandler = context.getBean(DirectIndexHandler.class);
|
77 |
41444
|
argiro.kok
|
projectHandler = context.getBean(ProjectHandler.class);
|
78 |
46918
|
argiro.kok
|
fetchProjectHandler = context.getBean(FetchProjectHandler.class);
|
79 |
57029
|
argiro.kok
|
|
80 |
41444
|
argiro.kok
|
externalRecordHandler = context.getBean(ExternalRecordHandler.class);
|
81 |
|
|
indexResultHandler = context.getBean(IndexResultHandler.class);
|
82 |
|
|
resultHandler = context.getBean(ResultHandler.class);
|
83 |
|
|
claimHandler = context.getBean(ClaimHandler.class);
|
84 |
41791
|
argiro.kok
|
sqlDAO = context.getBean(SqlDAO.class);
|
85 |
42199
|
argiro.kok
|
sqlStore = context.getBean(SqlStore.class);
|
86 |
41791
|
argiro.kok
|
queryGenerator = context.getBean(QueryGenerator.class);
|
87 |
|
|
fetchClaimHandler = context.getBean(FetchClaimHandler.class);
|
88 |
47039
|
argiro.kok
|
claimValidation = context.getBean(ClaimValidation.class);
|
89 |
40005
|
argiro.kok
|
|
90 |
53916
|
konstantin
|
emailSender = context.getBean(EmailSender.class);
|
91 |
58341
|
argiro.kok
|
contextUtils = context.getBean(ContextUtils.class);
|
92 |
53916
|
konstantin
|
|
93 |
41791
|
argiro.kok
|
assertNotNull(sqlDAO);
|
94 |
|
|
|
95 |
40005
|
argiro.kok
|
}
|
96 |
41791
|
argiro.kok
|
@Test
|
97 |
42199
|
argiro.kok
|
public void testRollback(){
|
98 |
|
|
List <String> commands = new ArrayList<String>();
|
99 |
|
|
commands.add("UPDATE claim SET claimedBy = 'argirok1' WHERE id = 93");
|
100 |
|
|
commands.add("EXCEPTION");
|
101 |
|
|
commands.add("UPDATE claim SET claimedBy = 'argirok2' WHERE id = 95");
|
102 |
|
|
try {
|
103 |
|
|
sqlStore.executeUpdateWithRollback(commands);
|
104 |
|
|
} catch (Exception e) {
|
105 |
47219
|
argiro.kok
|
log.error("",e);
|
106 |
42199
|
argiro.kok
|
}
|
107 |
|
|
}
|
108 |
|
|
@Test
|
109 |
41791
|
argiro.kok
|
public void testJson(){
|
110 |
|
|
Claim claim = new Claim();
|
111 |
|
|
Project project= new Project();
|
112 |
|
|
claim.setDate(Calendar.getInstance().getTime());
|
113 |
|
|
claim.setId("claimId");
|
114 |
|
|
claim.setUserMail("claim mail");
|
115 |
40005
|
argiro.kok
|
|
116 |
41791
|
argiro.kok
|
project.setFunderName("EC");
|
117 |
|
|
project.setOpenaireId("openaireID1234");
|
118 |
|
|
project.setName("PrTitle");
|
119 |
|
|
claim.setSource(project);
|
120 |
|
|
Result result = new Result();
|
121 |
|
|
result.setAccessRights("accessRights");
|
122 |
|
|
result.setCollectedFrom("collectedFrom");
|
123 |
|
|
result.setExternalUrl("external_url");
|
124 |
|
|
result.setOpenaireId("openaire_id");
|
125 |
|
|
result.setTitle("title");
|
126 |
|
|
result.setResultType("type");
|
127 |
|
|
result.setMetadataRecord("xmlString");
|
128 |
|
|
claim.setTarget(result);
|
129 |
|
|
System.out.println("test");
|
130 |
|
|
System.out.println(JsonldBuilder.toJsonld(claim));
|
131 |
|
|
}
|
132 |
40005
|
argiro.kok
|
|
133 |
41791
|
argiro.kok
|
@Test
|
134 |
|
|
public void testFetch() throws Exception {
|
135 |
|
|
|
136 |
|
|
try {
|
137 |
|
|
List<Claim> claims = null;
|
138 |
42762
|
argiro.kok
|
List<String> types= new ArrayList<String>();
|
139 |
|
|
// types.add(ClaimUtils.CONTEXT);
|
140 |
50968
|
argiro.kok
|
// types.add(ClaimUtils.PROJECT);
|
141 |
|
|
// types.add(ClaimUtils.DATASET);
|
142 |
42762
|
argiro.kok
|
types.add(ClaimUtils.PUBLICATION);
|
143 |
41791
|
argiro.kok
|
|
144 |
42762
|
argiro.kok
|
|
145 |
50947
|
argiro.kok
|
// claims = fetchClaimHandler.fetchClaimsByUser("argirok_1@hotmail.com",1,0,types, false);
|
146 |
62526
|
katerina.i
|
// claims = fetchClaimHandler.fetchClaimsByContext("egi",100,0,null,"claim.claim_date",false,types,false);
|
147 |
|
|
// claims = fetchClaimHandler.fetchClaimsByContext("egi",100,0,null,"claim.claim_date",false,types,false);
|
148 |
50947
|
argiro.kok
|
// (String openaireId, Integer limit, Integer offset, String keyword, String orderField, boolean descending, List<String> types, boolean addCurationInfo) throws Exception, SQLStoreException {
|
149 |
47039
|
argiro.kok
|
// claims = fetchClaimHandler.fetchClaimsByUser("argirok@di.uoa.gr",3,0,null,"claim.claim_date",false,types,false);
|
150 |
42762
|
argiro.kok
|
//
|
151 |
42214
|
argiro.kok
|
// claims = fetchClaimHandler.fetchClaimsByProject("corda_______::ab9c77ce02967b24fc9c1a74276e4677",5,0);
|
152 |
49865
|
argiro.kok
|
// claims = fetchClaimHandler.fetchClaimsByProject("corda__h2020::94c962e736df90a5075a7f660ba3d7f6",12,0,null, "claim.claim_date",false,types,true);
|
153 |
47059
|
konstantin
|
//claims = fetchClaimHandler.fetchClaimsByToken("corda__h2020::94c962e736df90a5075a7f660ba3d7f6","argiro@gmail.com",12,0,null, "claim.claim_date",false,types,false);
|
154 |
47039
|
argiro.kok
|
|
155 |
42762
|
argiro.kok
|
// claims = fetchClaimHandler.fetchClaimsByDate("2016-01-14 14:53:50","2016-04-21",10,0);
|
156 |
47039
|
argiro.kok
|
// claims = fetchClaimHandler.fetchClaimsByDate("2016-01-14 14:53:50","2017-04-21",10,0,"", "source",true,types, false);
|
157 |
42762
|
argiro.kok
|
// // 2016-04-20 14:53:50.276
|
158 |
|
|
// claims = fetchClaimHandler.fetchClaimsByContext("egi::country::gr",5,0,null,"claim.claim_date",false,types);
|
159 |
42214
|
argiro.kok
|
// claims = fetchClaimHandler.fetchAllClaims(5,3);
|
160 |
42762
|
argiro.kok
|
// claims = fetchClaimHandler.fetchClaimsByResult("od_______233::235960bb401207cb9595a79a1bc8e867",5,0,null, "claim.claim_date",false,types);
|
161 |
|
|
// claims = fetchClaimHandler.fetchClaimsByFunder("fct_________::FCT",5,0);
|
162 |
|
|
// claims= fetchClaimHandler.fetchClaimsByUser("kiatrop@di.uoa.gr",20,0,types);
|
163 |
|
|
// claims = fetchClaimHandler.fetchAllClaims(10,0,"","date",true,types);
|
164 |
41791
|
argiro.kok
|
|
165 |
42762
|
argiro.kok
|
System.out.println(fetchClaimHandler.claims2JSON(claims)+"\n\n\n "+claims.size());
|
166 |
|
|
// Claim claim = fetchClaimHandler.fetchClaimById("5821");
|
167 |
|
|
// System.out.println(fetchClaimHandler.claim2JSON(claim) );
|
168 |
|
|
// System.out.println("ALL:"+fetchClaimHandler.countClaimsByUser("argirok@di.uoa.gr","EGI", types));
|
169 |
50968
|
argiro.kok
|
System.out.println("ALL:"+fetchClaimHandler.countClaimsByContext("egi",null, types));
|
170 |
46918
|
argiro.kok
|
// System.out.println("ALL:"+fetchClaimHandler.countClaimsByProject("corda_______::ab9c77ce02967b24fc9c1a74276e4677",null,types));
|
171 |
42762
|
argiro.kok
|
|
172 |
|
|
// System.out.println("ALL:"+fetchClaimHandler.countAllClaims("", types));
|
173 |
|
|
// +"\n Project: "+fetchClaimHandler.countClaimsByProject("corda_______::ab9c77ce02967b24fc9c1a74276e4677")+
|
174 |
42281
|
argiro.kok
|
// " \n Result:"+fetchClaimHandler.countClaimsByResult("dedup_wf_001::541b1cef0d38d519e98a3b7a5b60bc75")+" \n Context:"+fetchClaimHandler.countClaimsByContext("egi::country::de")
|
175 |
|
|
// +" \n Date:"+fetchClaimHandler.countClaimsByDate("2014-04-14","2015-04-14")+" \n Funder:"+fetchClaimHandler.countClaimsByFunder("fct_________::FCT"));
|
176 |
41791
|
argiro.kok
|
} catch (Exception e) {
|
177 |
47219
|
argiro.kok
|
log.error("",e);
|
178 |
|
|
} catch (SQLStoreException e) {
|
179 |
41791
|
argiro.kok
|
e.printStackTrace();
|
180 |
|
|
}
|
181 |
|
|
}
|
182 |
|
|
@Test
|
183 |
42789
|
argiro.kok
|
public void testContext(){
|
184 |
58341
|
argiro.kok
|
|
185 |
|
|
System.out.print(contextUtils.fetchContextById("egi::organisation::uom"));
|
186 |
42789
|
argiro.kok
|
}
|
187 |
|
|
@Test
|
188 |
47219
|
argiro.kok
|
public void testInsert() throws Exception, SQLStoreException {
|
189 |
42199
|
argiro.kok
|
//acm_________::31e0e5e7cbd6e2556336d7e795f55c49
|
190 |
41791
|
argiro.kok
|
//dedup_wf_001::64ca1e3a4d1590456ad3dd7df8a18cd7
|
191 |
49865
|
argiro.kok
|
/*
|
192 |
|
|
claimedBy argirok_1@hotmail.com
|
193 |
|
|
sourceId corda_______::2c37878a0cede85dbbd1081bb9b4a2f8
|
194 |
|
|
sourceType project
|
195 |
|
|
sourceCollectedFrom openaire
|
196 |
|
|
sourceAccessRights OPEN
|
197 |
|
|
sourceEmbargoEndDate
|
198 |
|
|
targetId 10.1007/978-3-540-76323-9_4
|
199 |
|
|
targetType software
|
200 |
|
|
targetCollectedFrom crossref
|
201 |
|
|
targetAccessRights EMBARGO
|
202 |
|
|
targetEmbargoEndDate 2028-11-10T13:55:47.935Z
|
203 |
|
|
*/
|
204 |
51939
|
argiro.kok
|
// String id=claimHandler.buildAndInsertClaim("argirok_1@hotmail.com", "project", "corda__h2020::94c962e736df90a5075a7f660ba3d7f6", "openaire", "OPEN", null,"software", "10.1007/978-3-540-76323-9_4", "crossref", "EMBARGO","2028-11-10T13:55:47.935Z");
|
205 |
54959
|
argiro.kok
|
// String id=claimHandler.buildAndInsertClaim("argirok@di.uoa.gr", "project", "corda__h2020::94c962e736df90a5075a7f660ba3d7f6", "openaire", "OPEN", null,"publication", "0000-0002-9414-646X-21755327", "orcid", "EMBARGO","2028-11-10T13:55:47.935Z");
|
206 |
58341
|
argiro.kok
|
// {user:argirok@di.uoa.gr, sourceType:project, sourceId:corda_______::2c37878a0cede85dbbd1081bb9b4a2f8, sourceCollectedFrom:openaire, sourceAccessRights:OPEN, sourceEmbargoDate:null,
|
207 |
|
|
// targetType:publication, targetId:0000-0002-3477-3082-5288650, targetCollectedFrom:orcid, targetAccessRights:OPEN, targetEmbargoDate:null}
|
208 |
|
|
// String id=claimHandler.buildAndInsertClaim("argirok@di.uoa.gr", "project", "corda_______::2c37878a0cede85dbbd1081bb9b4a2f8", "openaire", "OPEN", null,"publication", "0000-0002-3477-3082-5288651", "orcid", "OPEN",null, "development_explore");
|
209 |
46918
|
argiro.kok
|
|
210 |
|
|
|
211 |
48294
|
argiro.kok
|
// String id=claimHandler.buildAndInsertClaim("argirok@di.uoa.gr", "context", "egi::country::gr",
|
212 |
58341
|
argiro.kok
|
// "openaire", null, null,"dataset", "10.4225/41/55A111BDE741C", "datacite", "OPEN","2017-05-01","development_explore");
|
213 |
41791
|
argiro.kok
|
}
|
214 |
|
|
@Test
|
215 |
48294
|
argiro.kok
|
public void testDelete() throws Exception, SQLStoreException {
|
216 |
41791
|
argiro.kok
|
|
217 |
48294
|
argiro.kok
|
// claimHandler.deleteClaim("argirok@di.uoa.gr","2876");
|
218 |
42199
|
argiro.kok
|
// claimHandler.deleteClaim("argirok@di.uoa.gr","3101");
|
219 |
|
|
}
|
220 |
|
|
|
221 |
62527
|
katerina.i
|
//@Test fails due to org.postgresql.util.PSQLException: FATAL: database "claimsnewschema" does not exist
|
222 |
47219
|
argiro.kok
|
public void testJob() throws Exception, SQLStoreException {
|
223 |
46977
|
argiro.kok
|
String selectcountDMFClaims =" Select count(*) from claims where type='dmf2actions' and xml NOT ILIKE '%<oaf:concept%' ";
|
224 |
|
|
String selectCountConceptClaims =" Select count(*) from claims where ( type='dmf2actions' or type='updates2actions' ) and xml LIKE '%<oaf:concept%' ";
|
225 |
|
|
String selectCountRelationClaims =" Select count(*) from claims where type='rels2actions' ";
|
226 |
40005
|
argiro.kok
|
|
227 |
41791
|
argiro.kok
|
ResultSet rs = sqlDAO.executePreparedQuery(selectCountConceptClaims);
|
228 |
40005
|
argiro.kok
|
|
229 |
41621
|
argiro.kok
|
while(rs.next()) {
|
230 |
|
|
log.info("Concept claims: "+rs.getInt(1));
|
231 |
|
|
}
|
232 |
41791
|
argiro.kok
|
rs = sqlDAO.executePreparedQuery(selectCountRelationClaims);
|
233 |
40005
|
argiro.kok
|
|
234 |
41621
|
argiro.kok
|
while(rs.next()) {
|
235 |
|
|
log.info("Relation claims: "+rs.getInt(1));
|
236 |
|
|
}
|
237 |
41791
|
argiro.kok
|
rs = sqlDAO.executePreparedQuery("Select count(*) from claim");
|
238 |
41621
|
argiro.kok
|
|
239 |
41791
|
argiro.kok
|
while(rs.next()) {
|
240 |
|
|
log.info("Migrated claims: "+rs.getInt(1));
|
241 |
|
|
}
|
242 |
|
|
rs = sqlDAO.executePreparedQuery("Select count(*) from result");
|
243 |
|
|
|
244 |
|
|
while(rs.next()) {
|
245 |
|
|
log.info("Results: "+rs.getInt(1));
|
246 |
|
|
}
|
247 |
|
|
|
248 |
40005
|
argiro.kok
|
}
|
249 |
|
|
|
250 |
40086
|
argiro.kok
|
@Test
|
251 |
|
|
public void testHttpRequest() throws Exception {
|
252 |
|
|
SearchUtils searchUtils= new SearchUtils();
|
253 |
57125
|
argiro.kok
|
log.info(searchUtils.fetchPublicationXmlFromIndex("doajarticles::eb8a123eb82b25013b0001d0e2d1842b"));
|
254 |
|
|
log.info(searchUtils.fetchDatasetXmlFromIndex("doajarticles::eb8a123eb82b25013b0001d0e2d1842b"));
|
255 |
40086
|
argiro.kok
|
}
|
256 |
|
|
|
257 |
|
|
@Test
|
258 |
41444
|
argiro.kok
|
public void testXpath() throws Exception {
|
259 |
57125
|
argiro.kok
|
Result r=indexResultHandler.fetchResultById("dedup_wf_001::88a1eedd1ffce63dccf51d8ce2053c85");
|
260 |
40086
|
argiro.kok
|
}
|
261 |
|
|
|
262 |
|
|
@Test
|
263 |
49865
|
argiro.kok
|
public void testSoftwareXpath() throws Exception {
|
264 |
|
|
// http://scoobydoo.di.uoa.gr:5000/search/software?softwareId=datacite____%3A%3Aabe9e916b29d028789d7ae3c6f79f254
|
265 |
57125
|
argiro.kok
|
Result r=indexResultHandler.fetchSoftwareById("datacite____::abe9e916b29d028789d7ae3c6f79f254");
|
266 |
49865
|
argiro.kok
|
if(r!=null){
|
267 |
|
|
System.out.println(r.toString());
|
268 |
|
|
}
|
269 |
|
|
|
270 |
|
|
}
|
271 |
|
|
@Test
|
272 |
|
|
public void testPublicationXpath() throws Exception {
|
273 |
57125
|
argiro.kok
|
Result r=indexResultHandler.fetchPublicationById("od________18::5acd89ab4df2b877a7a208ea2a123a87");
|
274 |
49865
|
argiro.kok
|
if(r!=null){
|
275 |
|
|
System.out.println(r.toString());
|
276 |
|
|
}
|
277 |
|
|
|
278 |
|
|
}
|
279 |
|
|
|
280 |
|
|
@Test
|
281 |
40696
|
argiro.kok
|
public void dropClaimTables() throws Exception {
|
282 |
41444
|
argiro.kok
|
// sqlDAO.executeUpdateQuery(queryGenerator.generateDeleteClaimTablesQuery());
|
283 |
40696
|
argiro.kok
|
}
|
284 |
|
|
@Test
|
285 |
|
|
public void createClaimTables() throws Exception {
|
286 |
46977
|
argiro.kok
|
// sqlDAO.executeUpdateQuery(queryGenerator.generateCreateClaimTablesQuery());
|
287 |
40696
|
argiro.kok
|
}
|
288 |
41157
|
argiro.kok
|
|
289 |
40773
|
argiro.kok
|
|
290 |
41104
|
argiro.kok
|
@Test
|
291 |
|
|
public void buildProject() throws Exception {
|
292 |
41444
|
argiro.kok
|
String id = "arc_________::089188bbc5db213fb2b00a0d93043fc4";
|
293 |
57125
|
argiro.kok
|
Project pr = projectHandler.fetchProjectByID(id);
|
294 |
41444
|
argiro.kok
|
log.info(pr.toString());
|
295 |
41104
|
argiro.kok
|
id="corda_______::404d91e07cd4d32fddd8fc636ad4daf7";
|
296 |
57125
|
argiro.kok
|
pr = projectHandler.fetchProjectByID(id);
|
297 |
41444
|
argiro.kok
|
log.info(pr.toString());
|
298 |
41104
|
argiro.kok
|
|
299 |
|
|
}
|
300 |
46755
|
katerina.i
|
|
301 |
41350
|
argiro.kok
|
|
302 |
41199
|
argiro.kok
|
@Test
|
303 |
41444
|
argiro.kok
|
public void buildOpenaireResult() throws Exception {
|
304 |
|
|
|
305 |
57029
|
argiro.kok
|
|
306 |
|
|
OpenaireEntity r= claimHandler.buildOpenaireEntity("dedup_wf_001::9e19149f2ece7129e63638a6a52cf468",ClaimUtils.DATASET,ClaimUtils.OPENAIRE,null, null);
|
307 |
41350
|
argiro.kok
|
log.info(r);
|
308 |
41260
|
argiro.kok
|
|
309 |
41199
|
argiro.kok
|
}
|
310 |
46918
|
argiro.kok
|
@Test
|
311 |
|
|
public void buildOpenaireProject() throws Exception {
|
312 |
|
|
String projetcId = "corda_______::2c37878a0cede85dbbd1081bb9b4a2f8";
|
313 |
57029
|
argiro.kok
|
OpenaireEntity r= claimHandler.buildOpenaireEntity(projetcId,ClaimUtils.PROJECT,ClaimUtils.OPENAIRE,null, null);
|
314 |
46918
|
argiro.kok
|
log.info(r);
|
315 |
41199
|
argiro.kok
|
|
316 |
46918
|
argiro.kok
|
}
|
317 |
62527
|
katerina.i
|
//@Test org.postgresql.util.PSQLException: FATAL: database "claimsnewschema" does not exist
|
318 |
47219
|
argiro.kok
|
public void testProject() throws Exception, SQLStoreException {
|
319 |
46918
|
argiro.kok
|
// List<String> mails = new ArrayList<String>();
|
320 |
|
|
// mails.add("test1@mail.com");
|
321 |
|
|
// mails.add("test2@mail.com");
|
322 |
|
|
// mails.add("test3@mail.com");
|
323 |
|
|
// sqlDAO.executePreparedQuery(queryGenerator.generateInsertProjectQuery("123","test project","TEstP","","","",mails));
|
324 |
47039
|
argiro.kok
|
System.out.println("\n"+this.fetchProjectHandler.fetchContactEmailsByProjectId("corda__h2020::94c962e736df90a5075a7f660ba3d7f6")+"\n");
|
325 |
46918
|
argiro.kok
|
List<String> mails = new ArrayList<String>();
|
326 |
|
|
mails.add("test11111@mail.com");
|
327 |
|
|
mails.add("test122222@mail.com");
|
328 |
48294
|
argiro.kok
|
this.projectHandler.updateContactEmailsByProjectId("123",mails);
|
329 |
47059
|
konstantin
|
// System.out.println("\n"+this.projectHandler.fetchContactEmailsByProjectId("123")+"\n");
|
330 |
|
|
// String token = UUID.randomUUID().toString();
|
331 |
|
|
// this.projectHandler.updateTokenByProjectId("123",token);
|
332 |
46918
|
argiro.kok
|
|
333 |
|
|
|
334 |
|
|
|
335 |
|
|
}
|
336 |
46977
|
argiro.kok
|
@Test
|
337 |
|
|
public void testMD5() throws Exception {
|
338 |
48294
|
argiro.kok
|
String id = "10.1016/j.engstruct.2013.03.014";
|
339 |
|
|
String createdId = ExternalRecordParser.createOpenaireId(id);
|
340 |
|
|
String openaireId = "userclaim___::07ec9eb2278a11e352e3fa93a621411d";
|
341 |
|
|
System.out.println(createdId );
|
342 |
47008
|
argiro.kok
|
|
343 |
46977
|
argiro.kok
|
}
|
344 |
|
|
@Test
|
345 |
47219
|
argiro.kok
|
public void testCuration() throws Exception, SQLStoreException {
|
346 |
48294
|
argiro.kok
|
// boolean updated = claimHandler.updateClaimCurationInfo("argiro@gmail.com","1",true);
|
347 |
|
|
// System.out.println(updated);
|
348 |
47008
|
argiro.kok
|
}
|
349 |
53199
|
konstantin
|
/*
|
350 |
47008
|
argiro.kok
|
@Test
|
351 |
52619
|
konstantin
|
public void testFetchProjectIdByTokenAndEmail() throws Exception, SQLStoreException {
|
352 |
|
|
String openaireId = this.fetchProjectHandler.fetchProjectIdByTokenAndEmail("dedc6979-1967-4ea2-a2ad-5135f95285ae", "test11111@mail.com");
|
353 |
|
|
System.out.println(openaireId);
|
354 |
|
|
}
|
355 |
|
|
|
356 |
|
|
@Test
|
357 |
47219
|
argiro.kok
|
public void testFetchProjectIdByToken() throws Exception, SQLStoreException {
|
358 |
52619
|
konstantin
|
String openaireId = this.fetchProjectHandler.fetchProjectIdByToken("dedc6979-1967-4ea2-a2ad-5135f95285ae");
|
359 |
47059
|
konstantin
|
System.out.println(openaireId);
|
360 |
|
|
}
|
361 |
53199
|
konstantin
|
*/
|
362 |
47059
|
konstantin
|
@Test
|
363 |
46977
|
argiro.kok
|
public void directIndexClaim() throws Exception {
|
364 |
47039
|
argiro.kok
|
System.out.println(this.claimValidation.getPathToSaveReport());
|
365 |
48294
|
argiro.kok
|
String json = "{\"originalId\":\"userclaim____::d1e668dc81fa714aa98a558d9ce515fa\",\"title\":\"Expression of Ik6 and Ik8 Isoforms and Their Association with Relapse and Death in Mexican Children with Acute Lymphoblastic Leukemia\",\"authors\":[\"Reyes-León Adriana\",\"Juárez-Velázquez Rocío\",\"Medrano-Hernández Alma\",\"Cuenca-Roldán Teresa\",\"Salas-Labadía Consuelo\",\"del Pilar Navarrete-Meneses María\",\"Rivera-Luna Roberto\",\"López-Hernández Gerardo\",\"Paredes-Aguilera Rogelio\",\"Pérez-Vera Patricia\"],\"publisher\":\"Public Library of Science (PLoS)\",\"type\":\"publication\",\"pids\":[{\"type\":\"doi\",\"value\":\"10.1371/journal.pone.0130756\"}],\"licenseCode\":\"OPEN\",\"resourceType\":\"0001\",\"url\":\"http://dx.doi.org/10.1371/journal.pone.0130756\",\"hostedById\":\"openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18\",\"collectedFromId\":\"openaire____::crossref\",\"contexts\":[\"egi::country::gr\"]}";
|
366 |
46977
|
argiro.kok
|
// System.out.println("\n\nFeed Response is: "+directIndexHandler.insertRecord(json));
|
367 |
|
|
|
368 |
48294
|
argiro.kok
|
// System.out.println("\n\nDelete Response is: "+directIndexHandler.deleteRecord("userclaim___::d1e668dc81fa714aa98a558d9ce515fa","openaire____::crossref"));
|
369 |
46977
|
argiro.kok
|
}
|
370 |
|
|
|
371 |
53916
|
konstantin
|
// To run following tests about email: claim notifications, set all the properties inside project folder
|
372 |
|
|
@Test
|
373 |
|
|
public void forceSendEmailNotifications() throws Exception {
|
374 |
|
|
//emailSender.run();
|
375 |
|
|
}
|
376 |
|
|
|
377 |
|
|
@Test
|
378 |
|
|
public void testEmail() throws Exception {
|
379 |
|
|
ArrayList<String> list = new ArrayList<String>();
|
380 |
|
|
list.add("konstantinagalouni@gmail.com");
|
381 |
|
|
list.add("argirok@di.uoa.gr");
|
382 |
54959
|
argiro.kok
|
// emailSender.send("openaire_id_test", "openaire_name_test", "community", list);
|
383 |
53916
|
konstantin
|
}
|
384 |
|
|
|
385 |
40005
|
argiro.kok
|
}
|