Commit 123f3dc348b88da72b6ab5ac0e34b965f857b3a8

Authored by Paulo Graça
1 parent 908dc66ad5
Exists in tests

Insert catch for threads expections

ptcrisync-test/src/main/java/pt/ptcris/test/PerformanceTest.java
... ... @@ -27,6 +27,7 @@ import java.text.SimpleDateFormat;
27 27 import java.util.Date;
28 28 import java.util.LinkedList;
29 29 import java.util.List;
  30 +import java.util.Map;
30 31 import java.util.Properties;
31 32  
32 33 import javax.xml.bind.JAXBException;
... ... @@ -89,12 +90,12 @@ public class PerformanceTest {
89 90  
90 91 _log.info("Deleting all existing works");
91 92 helper.deleteAllSourcedWorks();
92   -
93   - try {
94   -
  93 +
  94 + Map<BigInteger,Integer> returnedList;
  95 + try {
95 96 long start = System.nanoTime();
96 97 _log.info("Start testing: " + orcidId);
97   - PTCRISync.export(orcidClient, localWorks, progressHandler);
  98 + returnedList = PTCRISync.export(orcidClient, localWorks, progressHandler);
98 99 _log.info("End testing: " + (((double) (System.nanoTime() - start)) / 1E9) + " sec");
99 100  
100 101 List<WorkSummary> exportedWorkSummary = helper.getSourcedWorkSummaries();
... ... @@ -113,11 +114,16 @@ public class PerformanceTest {
113 114 _log.fatal(orcidException.getMessage() + ": "
114 115 + orcidException.getDeveloperMessage());
115 116 _log.error("[exportTimetoOrcid] " + "FAILED");
116   - } catch (AssertionError e) {
  117 + } catch (AssertionError ae) {
  118 + testResult = false;
  119 + _log.error("[exportTimetoOrcid] " + ae.getMessage());
  120 + } catch (InterruptedException ie) {
117 121 testResult = false;
118   - _log.error("[exportTimetoOrcid] " + e.getMessage());
  122 + _log.error("[exportTimetoOrcid] Thread Exception");
  123 + ie.printStackTrace();
119 124 } catch (Exception e) {
120 125 testResult = false;
  126 + _log.error("[exportTimetoOrcid] Exception" + e.getMessage());
121 127 e.printStackTrace();
122 128 } finally {
123 129 System.out.println(progressHandler.getReport());
... ...