Commit e9eeb00c2c328dc2cf9209576d52bd047e226f61

Authored by Paulo Graça
1 parent ba2839768e
Exists in tests

Maven optimizations and minor fixes

ptcrisync-test/pom.xml
1 1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2 2 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3 3 <modelVersion>4.0.0</modelVersion>
4   - <groupId>PTCRISyncTest</groupId>
5   - <artifactId>PTCRISyncTest</artifactId>
  4 + <artifactId>ptcrisync-test</artifactId>
  5 + <groupId>pt.ptcris</groupId>
  6 + <packaging>jar</packaging>
6 7 <version>0.0.1-SNAPSHOT</version>
7 8  
8 9 <properties>
9 10 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
10   - <java.version>1.8</java.version>
11   - <jersey.version>2.22.1</jersey.version>
12   - <restlet-version>2.3.5</restlet-version>
13   - <jaxb2-basics.version>0.9.5</jaxb2-basics.version>
14   - <log4j.version>2.4</log4j.version>
15 11 <junit.version>4.12</junit.version>
16   - <xml-bind.version>2.2.12</xml-bind.version>
  12 + <orcid-api-client.version>2.0-rc1</orcid-api-client.version>
17 13 </properties>
18 14  
19 15 <dependencies>
20   - <!-- Log4J -->
21 16 <dependency>
22   - <groupId>org.apache.logging.log4j</groupId>
23   - <artifactId>log4j-core</artifactId>
24   - <version>${log4j.version}</version>
  17 + <groupId>pt.ptcris</groupId>
  18 + <artifactId>ptcrisync</artifactId>
  19 + <version>0.0.1</version>
25 20 </dependency>
26   - <!-- Jersey Client -->
27   - <dependency>
28   - <groupId>org.glassfish.jersey.core</groupId>
29   - <artifactId>jersey-client</artifactId>
30   - <version>${jersey.version}</version>
31   - </dependency>
32   - <dependency>
33   - <groupId>org.glassfish.jersey.containers</groupId>
34   - <artifactId>jersey-container-servlet</artifactId>
35   - <version>${jersey.version}</version>
36   - </dependency>
37   - <dependency>
38   - <groupId>org.glassfish.jersey.media</groupId>
39   - <artifactId>jersey-media-json-jackson</artifactId>
40   - <version>${jersey.version}</version>
41   - </dependency>
42   - <dependency>
43   - <groupId>org.glassfish.jersey.media</groupId>
44   - <artifactId>jersey-media-jaxb</artifactId>
45   - <version>${jersey.version}</version>
46   - </dependency>
47   - <!-- JAXB2 -->
48   - <dependency>
49   - <groupId>org.jvnet.jaxb2_commons</groupId>
50   - <artifactId>jaxb2-basics-runtime</artifactId>
51   - <version>${jaxb2-basics.version}</version>
52   - </dependency>
53   - <!-- javax -->
54   - <dependency>
55   - <groupId>javax.servlet</groupId>
56   - <artifactId>javax.servlet-api</artifactId>
57   - <version>3.1.0</version>
58   - <scope>provided</scope>
59   - </dependency>
60   - <dependency>
61   - <groupId>javax.ws.rs</groupId>
62   - <artifactId>javax.ws.rs-api</artifactId>
63   - <version>2.0.1</version>
64   - </dependency>
65   - <dependency>
66   - <groupId>javax.xml.bind</groupId>
67   - <artifactId>jaxb-api</artifactId>
68   - <version>${xml-bind.version}</version>
69   - </dependency>
70   -
71 21 <dependency>
72 22 <groupId>junit</groupId>
73 23 <artifactId>junit</artifactId>
74 24 <version>${junit.version}</version>
75   - <scope>test</scope>
  25 + <!--scope>test</scope -->
  26 + </dependency>
  27 +
  28 + <!-- Apache CLI -->
  29 + <dependency>
  30 + <groupId>commons-cli</groupId>
  31 + <artifactId>commons-cli</artifactId>
  32 + <version>1.3.1</version>
76 33 </dependency>
77 34  
78 35 </dependencies>
79 36  
  37 + <!-- Build Settings -->
80 38 <build>
81   - <sourceDirectory>src</sourceDirectory>
  39 + <!--directory>main/resources</directory -->
  40 +
  41 + <resources>
  42 + <resource>
  43 + <directory>src/main/resources</directory>
  44 + <filtering>true</filtering>
  45 + </resource>
  46 + </resources>
82 47 <plugins>
83 48 <plugin>
  49 + <groupId>org.codehaus.mojo</groupId>
  50 + <artifactId>exec-maven-plugin</artifactId>
  51 + <version>1.1.1</version>
  52 + <executions>
  53 + <execution>
  54 + <phase>test</phase>
  55 + <goals>
  56 + <goal>java</goal>
  57 + </goals>
  58 + <configuration>
  59 + <mainClass>pt.ptcris.test.main.MainTester</mainClass>
  60 + <!--arguments> <argument>prepare</argument> </arguments -->
  61 + </configuration>
  62 + </execution>
  63 + </executions>
  64 + </plugin>
  65 +
  66 + <plugin>
  67 + <groupId>org.apache.maven.plugins</groupId>
  68 + <artifactId>maven-jar-plugin</artifactId>
  69 + <version>2.6</version>
  70 + <configuration>
  71 + <archive>
  72 + <manifest>
  73 + <mainClass>pt.ptcris.test.main.MainTester</mainClass>
  74 + </manifest>
  75 + </archive>
  76 + <excludes>
  77 + <exclude>**/.*</exclude>
  78 + <exclude>**/*.properties</exclude>
  79 + <exclude>**/log4j2.xml</exclude>
  80 + </excludes>
  81 +
  82 + </configuration>
  83 + </plugin>
  84 + <plugin>
84 85 <artifactId>maven-compiler-plugin</artifactId>
85 86 <version>3.3</version>
86 87 <configuration>
... ... @@ -88,6 +89,23 @@
88 89 <target />
89 90 </configuration>
90 91 </plugin>
  92 +
91 93 </plugins>
92 94 </build>
  95 +
  96 + <!-- More Project Information -->
  97 + <name>PTCRISync Test library</name>
  98 + <url>https://gitlab.fccn.pt/dev-ptcris/ptcrisync/blob/tests/ptcrisync-test/README.md</url>
  99 + <organization>
  100 + <name>FCT|FCCN</name>
  101 + <url>http://www.fccn.pt</url>
  102 + </organization>
  103 +
  104 + <!-- Environment Settings -->
  105 + <repositories>
  106 + <repository>
  107 + <id>dev-ptcris.repo</id>
  108 + <url>https://gitlab.fccn.pt/dev-ptcris/mvn-repo/raw/master</url>
  109 + </repository>
  110 + </repositories>
93 111 </project>
... ...
ptcrisync-test/src/main/java/pt/ptcris/test/PerformanceTest.java
... ... @@ -62,8 +62,9 @@ public class PerformanceTest {
62 62 }
63 63  
64 64 Date date = new Date();
  65 + _log.info("Name: " + properties.getProperty("application.name"));
65 66 _log.info("Date: " + dateFormat.format(date));
66   - _log.info("Version: " + PTCRISync.class.getPackage().getImplementationVersion());
  67 + _log.info("Version: " + properties.getProperty("application.version"));
67 68 try {
68 69 // Test cycle - perform several configured tests
69 70 ActivitiesSummary activitiesSummary = ActivitiesSummaryTestPrepare.loadFromResources();
... ... @@ -109,7 +110,8 @@ public class PerformanceTest {
109 110 _log.info("[exportTimetoOrcid] " + "PASSED");
110 111 } catch (OrcidClientException orcidException) {
111 112 testResult = false;
112   - _log.fatal(orcidException.getDeveloperMessage());
  113 + _log.fatal(orcidException.getMessage() + ": "
  114 + + orcidException.getDeveloperMessage());
113 115 _log.error("[exportTimetoOrcid] " + "FAILED");
114 116 } catch (AssertionError e) {
115 117 testResult = false;
... ... @@ -195,7 +197,8 @@ public class PerformanceTest {
195 197 } //End of For loop
196 198  
197 199 } catch (OrcidClientException orcidException) {
198   - _log.fatal(orcidException.getDeveloperMessage());
  200 + _log.fatal(orcidException.getMessage() + ": "
  201 + + orcidException.getDeveloperMessage());
199 202 _log.error("[importTimetoOrcid] " + "FAILED");
200 203 } catch (AssertionError e) {
201 204 testResult = false;
... ...
ptcrisync-test/src/main/java/pt/ptcris/test/preparation/WorkTestPrepare.java
... ... @@ -95,7 +95,7 @@ public class WorkTestPrepare {
95 95 * @param args
96 96 */
97 97 public static void main(String[] args) {
98   - Properties publicProperties = TestPropertiesLoader.loadProperties("public-api-test.properties");
  98 + Properties publicProperties = TestPropertiesLoader.loadProperties("public.properties");
99 99  
100 100 //From source
101 101 String sourceOrcidId = publicProperties.getProperty("orcid_id");
... ...
ptcrisync-test/src/main/resources/.gitignore
1 1 # special configurations
2 2 *.properties
  3 +0000-*/
... ...
ptcrisync-test/src/main/resources/log4j2.xml
... ... @@ -9,10 +9,10 @@
9 9 <Logger name="log4j.test.Log4jTest" level="trace">
10 10 <AppenderRef ref="Console"/>
11 11 </Logger>
12   - <Root level="info">
  12 + <Root level="error">
13 13 <AppenderRef ref="Console"/>
14 14 </Root>
15   - <!-- Root level="trace">
  15 + <!--Root level="trace">
16 16 <AppenderRef ref="Console"/>
17 17 </Root-->
18 18 </Loggers>
... ...
ptcrisync-test/src/main/resources/test.properties.default
  1 +# application.properties
  2 +application.name=${project.name}
  3 +application.version=${project.version}
  4 +
1 5 #########################################
2 6 # This file is a template
3 7 # you should renamed it to:
... ...