Project

General

Profile

« Previous | Next » 

Revision 46977

creating methods for direct index claim | use https in ulrs for datacite & crossref | add a check in parsing project for contact person email

View differences:

TestClass.java
33 33
import javax.xml.transform.TransformerException;
34 34
import javax.xml.xpath.XPathExpressionException;
35 35
import java.io.IOException;
36
import java.math.BigInteger;
37
import java.security.MessageDigest;
36 38
import java.sql.ResultSet;
37 39
import java.util.*;
38 40

  
......
56 58
    RelationHandler relationHandler = null;
57 59
    ContextRelationHandler contextRelationHandler = null;
58 60
    ProjectHandler projectHandler = null;
61
    DirectIndexHandler directIndexHandler = null;
59 62
    FetchProjectHandler fetchProjectHandler = null;
60 63
    DMFContextHandler dmfContextHandler = null;
61 64
    DMFResultHandler dmfResultHandler = null;
......
73 76
		BasicConfigurator.configure();
74 77
        ApplicationContext context = new ClassPathXmlApplicationContext("eu/dnetlib/data/claims/migration/springContext-claimsDemo.xml");
75 78
        relationHandler = context.getBean(RelationHandler.class);
79
        directIndexHandler = context.getBean(DirectIndexHandler.class);
76 80
        contextRelationHandler = context.getBean(ContextRelationHandler.class);
77 81
        projectHandler = context.getBean(ProjectHandler.class);
78 82
        fetchProjectHandler = context.getBean(FetchProjectHandler.class);
......
178 182
 //acm_________::31e0e5e7cbd6e2556336d7e795f55c49
179 183
//dedup_wf_001::64ca1e3a4d1590456ad3dd7df8a18cd7
180 184
 
181
//        String id=claimHandler.buildAndInsertClaim("argirok@di.uoa.gr", "project", "corda_______::2c37878a0cede85dbbd1081bb9b4a2f8", "openaire", null, null,"publication", "10.1093/oxfordhb/9780199603329.013.0040", "crossref", "EMBARGO","2017-05-01");
185
        String id=claimHandler.buildAndInsertClaim("argirok@di.uoa.gr", "project", "corda_______::2c37878a0cede85dbbd1081bb9b4a2f8", "openaire", "OPEN", null,"dataset", "10.5281/ZENODO.154647", "datacite", "EMBARGO","2017-05-01");
182 186

  
183 187

  
184
        String id=claimHandler.buildAndInsertClaim("argirok@di.uoa.gr", "context", "egi::country::gr",
185
                "openaire", null, null,"dataset", "datacite____::05418b13284ac02b62c8b114dee80d37", "openaire", "OPEN","2017-05-01");
188
//        String id=claimHandler.buildAndInsertClaim("argirok@di.uoa.gr", "context", "egi::country::gr",
189
//                "openaire", null, null,"dataset", "datacite____::05418b13284ac02b62c8b114dee80d37", "openaire", "OPEN","2017-05-01");
186 190
    }
187 191
    @Test
188 192
    public void testDelete() throws Exception {
......
193 197

  
194 198
    @Test
195 199
	public void testJob() throws Exception {
196
        String selectcountDMFClaims =" Select count(*) from claims_view  where type='dmf2actions' and xml NOT ILIKE '%<oaf:concept%' ";
197
        String selectCountConceptClaims =" Select count(*) from claims_view  where ( type='dmf2actions' or type='updates2actions' ) and xml LIKE '%<oaf:concept%' ";
198
        String selectCountRelationClaims =" Select count(*) from claims_view  where type='rels2actions'  ";
200
        String selectcountDMFClaims =" Select count(*) from claims  where type='dmf2actions' and xml NOT ILIKE '%<oaf:concept%' ";
201
        String selectCountConceptClaims =" Select count(*) from claims  where ( type='dmf2actions' or type='updates2actions' ) and xml LIKE '%<oaf:concept%' ";
202
        String selectCountRelationClaims =" Select count(*) from claims  where type='rels2actions'  ";
199 203

  
200 204
        ResultSet rs = sqlDAO.executePreparedQuery(selectCountConceptClaims);
201 205

  
......
277 281
    }
278 282
    @Test
279 283
    public void createClaimTables() throws Exception {
280
        sqlDAO.executeUpdateQuery(queryGenerator.generateCreateClaimTablesQuery());
284
//        sqlDAO.executeUpdateQuery(queryGenerator.generateCreateClaimTablesQuery());
281 285
    }
282 286

  
283 287
    @Test
......
388 392

  
389 393

  
390 394
    }
395
    @Test
396
    public void testMD5() throws Exception {
397
        String id = "10.1371/journal.pone.0130756";
398
        MessageDigest m = MessageDigest.getInstance("MD5");
399
        m.update(id.getBytes(), 0, id.length());
400
        id = new BigInteger(1, m.digest()).toString(16);
401
        System.out.println(id);
402
    }
403
    @Test
404
    public void directIndexClaim() throws Exception {
405
        directIndexHandler.test();
391 406

  
407
        String json = "{\"originalId\":\"user:claim__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\"]}";
408
//        System.out.println("\n\nFeed Response is: "+directIndexHandler.insertRecord(json));
409

  
410
//        System.out.println("\n\nDelete Response is: "+directIndexHandler.deleteRecord("user:claim__d1e668dc81fa714aa98a558d9ce515fa","openaire____::crossref"));
411
    }
412

  
392 413
    @Test
393 414
    public void testJsonToClaimsCuration() throws Exception {
394 415

  
......
423 444
        this.fetchClaimHandler.updateClaimsCurationInfo(jsonstr);
424 445
    }
425 446

  
447

  
426 448
}

Also available in: Unified diff