Skip to content

Commit 3f42745

Browse files
richarda23otter606
andauthored
Update libraries (#20)
* update apachecommons2->3.12 * bump spring 4.3->5.3.24 * update lombok->1.18.24, junit -> 4.13.2, slf4j->1.7.36 * include java17 in feature matrix * fix it tests * run it on java17 * docs and schedule monthly build * fix typo in prs.yml Co-authored-by: richard <ra22597@gmail.com>
1 parent 3763b42 commit 3f42745

11 files changed

Lines changed: 71 additions & 58 deletions

File tree

.github/workflows/prs.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ on:
33
pull_request:
44
push:
55
branches:
6-
- main
6+
- master
7+
schedule:
8+
- cron: '12 4 13 * *'
79
jobs:
810
test:
911
runs-on: ubuntu-latest
1012
strategy:
1113
matrix:
12-
java: [ '8', '11' ]
14+
java: [ '8', '11', '17' ]
1315
steps:
1416
- uses: actions/checkout@v3
1517
- uses: actions/setup-java@v3
@@ -23,7 +25,7 @@ jobs:
2325
needs: test
2426
strategy:
2527
matrix:
26-
java: [ '8', '11' ]
28+
java: [ '8', '11', '17' ]
2729
steps:
2830
- uses: actions/checkout@v3
2931
- uses: actions/setup-java@v3

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
Significant changes since 0.1.0
22

3-
0.2.0 in progress
3+
1.0.0 2022-11-21
4+
5+
Increasing major version due to major updates to dependencies. However, there are no
6+
breaking API changes in this library.
7+
8+
- dependencies: Major dependency updates to Spring 5.3, Lombok 18.24.
9+
- build: fix integration tests
10+
- build: enable integration test running through Github actions
11+
- build: test build and test on Java 8, 11, and 17
12+
13+
0.2.0 2022-11-20
414

515
- build: update gradlew to use gradle 7.5
616
- build: Basic Github action to run tests on pull request

Contributing.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Requests for features, bug-fixes and any improvements are always welcome, as are constructive suggestions.
2+
3+
Please raise an issue or submit a pull request.

Contributors.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
## Contributors
22

3-
43
Initial code contribution: Richard Adams (otter606).
54
PRs and contributions: Aleix Mariné Tena (AleixMT)

Readme.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@ It was initially contributed by [ResearchSpace](www.researchspace.com) in Octobe
77

88
### Dependencies
99

10-
This project requires Java 8 to compile and run.
11-
It also uses Spring-web (to provide low-level HTTP request/response parsing.)
12-
The Sword client library is included in this project as a jar file as it is not available
10+
This project requires Java 8 minimum to compile and run.
11+
12+
It is built and tested on Java 11 and Java 17.
13+
14+
It also uses Spring-web (to provide low-level HTTP request/response parsing.)
15+
16+
The Sword client library is included in this project as a jar file, as it is not available
1317
in a public maven repository.
1418

15-
### Building
19+
### Gradle
1620

1721
This project is built using Gradle. You can build straight away without needing to install anything:
1822

@@ -22,7 +26,7 @@ which will compile, run unit tests (but not integration tests) and build a jar f
2226

2327
### Running integration tests
2428

25-
Integration tests require a connection to a Dataverse instance.
29+
Integration tests require a connection to a Dataverse instance.
2630
In order to connect to a Dataverse for running tests, the following configuration is set up in `test.properties`.
2731

2832
dataverseServerURL=https://demo.dataverse.org
@@ -59,7 +63,6 @@ If using Maven, add this to your pom.xml file (thanks AleixMT).
5963
</dependencies>`
6064
```
6165

62-
6366
Or, you can run:
6467

6568
./gradlew clean install
@@ -101,9 +104,18 @@ Searching uses a builder pattern to build a search query:
101104
There is no explicit synchronisation performed in this library. The Dataverse configuration is stored in the
102105
internal state of implementation classes, so new instances of `DataverseAPIImpl` should be used for each request if running in a multi-threaded environment connecting to different Dataverses.
103106

107+
## Github actions
108+
109+
Tests and integration tests run on:
110+
- pull request
111+
- merge to master,
112+
- once a month, to detect regressions in API calls to https://demo.dataverse.org.
113+
104114
## Developing
105115

106-
This project makes use of [Project Lombok](https://projectlombok.org) which greatly speeds up the development of POJO classes to wrap JSON data structures. There are [instructions](https://projectlombok.org/features/index.html) on how to add it to your IDE.
116+
This project makes use of [Project Lombok](https://projectlombok.org) which greatly speeds up the development of POJO classes to wrap JSON data structures.
117+
118+
There are [instructions](https://projectlombok.org/features/index.html) on how to add it to your IDE.
107119

108120
### Coding standards
109121

build.gradle

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ apply plugin: 'java'
22

33
group = 'com.researchspace'
44
sourceCompatibility = 1.8
5-
version = '0.2.0'
6-
def springVersion='4.3.15.RELEASE'
7-
def jacksonVersion='2.6.7'
5+
version = '1.0.0'
6+
def springVersion='5.3.24'
7+
def jacksonVersion='2.11.1'
8+
def lombokVersion='1.18.24'
89

910
repositories {
1011
mavenCentral()
@@ -38,23 +39,24 @@ configurations {
3839

3940
dependencies {
4041
implementation 'org.springframework:spring-web:'+springVersion
42+
implementation 'org.springframework:spring-context:'+springVersion
4143
implementation 'org.springframework:spring-core:'+springVersion
4244
implementation 'com.fasterxml.jackson.core:jackson-annotations:'+jacksonVersion
4345
implementation 'com.fasterxml.jackson.core:jackson-core:'+jacksonVersion
4446
implementation 'com.fasterxml.jackson.core:jackson-databind:'+jacksonVersion
4547

46-
implementation 'org.projectlombok:lombok:1.18.4'
47-
annotationProcessor 'org.projectlombok:lombok:1.18.4'
48-
implementation 'commons-lang:commons-lang:2.6'
48+
implementation 'org.projectlombok:lombok:' + lombokVersion
49+
annotationProcessor 'org.projectlombok:lombok:' + lombokVersion
50+
implementation 'org.apache.commons:commons-lang3:3.12.0'
4951
implementation 'org.slf4j:slf4j-api:1.7.21'
5052

5153
//for SWORD-API.
5254
implementation 'org.swordapp:sword2-client:0.9.3'
5355
implementation 'org.apache.abdera:abdera-client:1.1.1'
5456

55-
testImplementation 'junit:junit:4.12'
57+
testImplementation 'junit:junit:4.13.2'
5658
testImplementation 'org.springframework:spring-test:'+springVersion
57-
testImplementation 'org.slf4j:slf4j-simple:1.7.21'
59+
testImplementation 'org.slf4j:slf4j-simple:1.7.36'
5860
}
5961

6062
test{

src/integration-test/java/com/researchspace/dataverse/http/AbstractIntegrationTest.java

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,21 @@
33
*/
44
package com.researchspace.dataverse.http;
55

6-
import static org.junit.Assert.assertTrue;
7-
8-
import java.net.URL;
9-
10-
import org.apache.commons.lang.StringUtils;
11-
import org.apache.commons.lang.Validate;
6+
import com.researchspace.dataverse.api.v1.*;
7+
import com.researchspace.dataverse.spring.config.DataverseSpringConfig;
8+
import lombok.extern.slf4j.Slf4j;
9+
import org.apache.commons.lang3.StringUtils;
10+
import org.apache.commons.lang3.Validate;
1211
import org.junit.Test;
1312
import org.springframework.beans.factory.annotation.Autowired;
1413
import org.springframework.beans.factory.annotation.Value;
1514
import org.springframework.test.context.ContextConfiguration;
1615
import org.springframework.test.context.TestPropertySource;
1716
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
1817

19-
import com.researchspace.dataverse.api.v1.DatasetOperations;
20-
import com.researchspace.dataverse.api.v1.DataverseAPI;
21-
import com.researchspace.dataverse.api.v1.DataverseConfig;
22-
import com.researchspace.dataverse.api.v1.DataverseOperations;
23-
import com.researchspace.dataverse.api.v1.InfoOperations;
24-
import com.researchspace.dataverse.api.v1.MetadataOperations;
25-
import com.researchspace.dataverse.api.v1.SearchOperations;
26-
import com.researchspace.dataverse.spring.config.DataverseSpringConfig;
18+
import java.net.URL;
2719

28-
import lombok.extern.slf4j.Slf4j;
20+
import static org.junit.Assert.assertTrue;
2921
/** <pre>
3022
Copyright 2016 ResearchSpace
3123

src/integration-test/java/com/researchspace/dataverse/http/DataverseOperationsTest.java

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,16 @@
33
*/
44
package com.researchspace.dataverse.http;
55

6-
import static org.junit.Assert.assertNotNull;
7-
import static org.junit.Assert.assertNull;
8-
import static org.junit.Assert.assertTrue;
9-
10-
import java.util.Arrays;
11-
6+
import com.researchspace.dataverse.entities.*;
127
import org.apache.commons.lang.RandomStringUtils;
138
import org.junit.After;
9+
import org.junit.Assert;
1410
import org.junit.Before;
1511
import org.junit.Test;
1612

17-
import com.researchspace.dataverse.entities.DataverseContacts;
18-
import com.researchspace.dataverse.entities.DataverseGet;
19-
import com.researchspace.dataverse.entities.DataversePost;
20-
import com.researchspace.dataverse.entities.DataverseResponse;
21-
import com.researchspace.dataverse.entities.DvMessage;
13+
import java.util.Arrays;
14+
15+
import static org.junit.Assert.*;
2216
/** <pre>
2317
Copyright 2016 ResearchSpace
2418
@@ -85,12 +79,12 @@ public void createDataverseValidation () {
8579
dv.setAlias("");
8680
dataverseOps.createNewDataverse("rspace", dv);
8781
}
88-
@Test(expected=IllegalArgumentException.class)
89-
public void createDataverseValidationContactREquired () {
82+
@Test
83+
public void createDataverseValidationContactRequired () {
9084
String dvName = RandomStringUtils.randomAlphabetic(10);
9185
DataversePost dv = createADataverse(dvName);
9286
dv.setDataverseContacts(null);
93-
dataverseOps.createNewDataverse("rspace", dv);
87+
Assert.assertThrows(NullPointerException.class, ()->dataverseOps.createNewDataverse("rspace", dv));
9488
}
9589

9690
@Test

src/main/java/com/researchspace/dataverse/http/DataverseOperationsImplV1.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
*/
44
package com.researchspace.dataverse.http;
55

6-
import static org.apache.commons.lang.StringUtils.isEmpty;
7-
import static org.apache.commons.lang.Validate.isTrue;
8-
import static org.apache.commons.lang.Validate.noNullElements;
6+
import static org.apache.commons.lang3.StringUtils.isEmpty;
7+
import static org.apache.commons.lang3.Validate.isTrue;
8+
import static org.apache.commons.lang3.Validate.noNullElements;
99

1010
import java.io.*;
1111
import java.net.URI;
1212
import java.net.URISyntaxException;
1313
import java.util.List;
1414

15-
import org.apache.commons.lang.StringUtils;
15+
import org.apache.commons.lang3.StringUtils;
1616
import org.springframework.core.ParameterizedTypeReference;
1717
import org.springframework.http.HttpEntity;
1818
import org.springframework.http.HttpHeaders;

src/main/java/com/researchspace/dataverse/search/entities/SearchConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import java.util.EnumSet;
77

8-
import org.apache.commons.lang.Validate;
8+
import org.apache.commons.lang3.Validate;
99

1010
import lombok.Builder;
1111
import lombok.NonNull;

0 commit comments

Comments
 (0)