Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ on:
pull_request:
push:
branches:
- main
- master
schedule:
- cron: '12 4 13 * *'
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '8', '11' ]
java: [ '8', '11', '17' ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
Expand All @@ -23,7 +25,7 @@ jobs:
needs: test
strategy:
matrix:
java: [ '8', '11' ]
java: [ '8', '11', '17' ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
Expand Down
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Significant changes since 0.1.0

0.2.0 in progress
1.0.0 2022-11-21

Increasing major version due to major updates to dependencies. However, there are no
breaking API changes in this library.

- dependencies: Major dependency updates to Spring 5.3, Lombok 18.24.
- build: fix integration tests
- build: enable integration test running through Github actions
- build: test build and test on Java 8, 11, and 17

0.2.0 2022-11-20

- build: update gradlew to use gradle 7.5
- build: Basic Github action to run tests on pull request
Expand Down
3 changes: 3 additions & 0 deletions Contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Requests for features, bug-fixes and any improvements are always welcome, as are constructive suggestions.

Please raise an issue or submit a pull request.
1 change: 0 additions & 1 deletion Contributors.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
## Contributors


Initial code contribution: Richard Adams (otter606).
PRs and contributions: Aleix Mariné Tena (AleixMT)
26 changes: 19 additions & 7 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ It was initially contributed by [ResearchSpace](www.researchspace.com) in Octobe

### Dependencies

This project requires Java 8 to compile and run.
It also uses Spring-web (to provide low-level HTTP request/response parsing.)
The Sword client library is included in this project as a jar file as it is not available
This project requires Java 8 minimum to compile and run.

It is built and tested on Java 11 and Java 17.

It also uses Spring-web (to provide low-level HTTP request/response parsing.)

The Sword client library is included in this project as a jar file, as it is not available
in a public maven repository.

### Building
### Gradle

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

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

### Running integration tests

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

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


Or, you can run:

./gradlew clean install
Expand Down Expand Up @@ -101,9 +104,18 @@ Searching uses a builder pattern to build a search query:
There is no explicit synchronisation performed in this library. The Dataverse configuration is stored in the
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.

## Github actions

Tests and integration tests run on:
- pull request
- merge to master,
- once a month, to detect regressions in API calls to https://demo.dataverse.org.

## Developing

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.
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.

### Coding standards

Expand Down
18 changes: 10 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ apply plugin: 'java'

group = 'com.researchspace'
sourceCompatibility = 1.8
version = '0.2.0'
def springVersion='4.3.15.RELEASE'
def jacksonVersion='2.6.7'
version = '1.0.0'
def springVersion='5.3.24'
def jacksonVersion='2.11.1'
def lombokVersion='1.18.24'

repositories {
mavenCentral()
Expand Down Expand Up @@ -38,23 +39,24 @@ configurations {

dependencies {
implementation 'org.springframework:spring-web:'+springVersion
implementation 'org.springframework:spring-context:'+springVersion
implementation 'org.springframework:spring-core:'+springVersion
implementation 'com.fasterxml.jackson.core:jackson-annotations:'+jacksonVersion
implementation 'com.fasterxml.jackson.core:jackson-core:'+jacksonVersion
implementation 'com.fasterxml.jackson.core:jackson-databind:'+jacksonVersion

implementation 'org.projectlombok:lombok:1.18.4'
annotationProcessor 'org.projectlombok:lombok:1.18.4'
implementation 'commons-lang:commons-lang:2.6'
implementation 'org.projectlombok:lombok:' + lombokVersion
annotationProcessor 'org.projectlombok:lombok:' + lombokVersion
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'org.slf4j:slf4j-api:1.7.21'

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

testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.springframework:spring-test:'+springVersion
testImplementation 'org.slf4j:slf4j-simple:1.7.21'
testImplementation 'org.slf4j:slf4j-simple:1.7.36'
}

test{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,21 @@
*/
package com.researchspace.dataverse.http;

import static org.junit.Assert.assertTrue;

import java.net.URL;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.Validate;
import com.researchspace.dataverse.api.v1.*;
import com.researchspace.dataverse.spring.config.DataverseSpringConfig;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;

import com.researchspace.dataverse.api.v1.DatasetOperations;
import com.researchspace.dataverse.api.v1.DataverseAPI;
import com.researchspace.dataverse.api.v1.DataverseConfig;
import com.researchspace.dataverse.api.v1.DataverseOperations;
import com.researchspace.dataverse.api.v1.InfoOperations;
import com.researchspace.dataverse.api.v1.MetadataOperations;
import com.researchspace.dataverse.api.v1.SearchOperations;
import com.researchspace.dataverse.spring.config.DataverseSpringConfig;
import java.net.URL;

import lombok.extern.slf4j.Slf4j;
import static org.junit.Assert.assertTrue;
/** <pre>
Copyright 2016 ResearchSpace

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,16 @@
*/
package com.researchspace.dataverse.http;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import java.util.Arrays;

import com.researchspace.dataverse.entities.*;
import org.apache.commons.lang.RandomStringUtils;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import com.researchspace.dataverse.entities.DataverseContacts;
import com.researchspace.dataverse.entities.DataverseGet;
import com.researchspace.dataverse.entities.DataversePost;
import com.researchspace.dataverse.entities.DataverseResponse;
import com.researchspace.dataverse.entities.DvMessage;
import java.util.Arrays;

import static org.junit.Assert.*;
/** <pre>
Copyright 2016 ResearchSpace

Expand Down Expand Up @@ -85,12 +79,12 @@ public void createDataverseValidation () {
dv.setAlias("");
dataverseOps.createNewDataverse("rspace", dv);
}
@Test(expected=IllegalArgumentException.class)
public void createDataverseValidationContactREquired () {
@Test
public void createDataverseValidationContactRequired () {
String dvName = RandomStringUtils.randomAlphabetic(10);
DataversePost dv = createADataverse(dvName);
dv.setDataverseContacts(null);
dataverseOps.createNewDataverse("rspace", dv);
Assert.assertThrows(NullPointerException.class, ()->dataverseOps.createNewDataverse("rspace", dv));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
*/
package com.researchspace.dataverse.http;

import static org.apache.commons.lang.StringUtils.isEmpty;
import static org.apache.commons.lang.Validate.isTrue;
import static org.apache.commons.lang.Validate.noNullElements;
import static org.apache.commons.lang3.StringUtils.isEmpty;
import static org.apache.commons.lang3.Validate.isTrue;
import static org.apache.commons.lang3.Validate.noNullElements;

import java.io.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import java.util.EnumSet;

import org.apache.commons.lang.Validate;
import org.apache.commons.lang3.Validate;

import lombok.Builder;
import lombok.NonNull;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
*/
package com.researchspace.dataverse.search;

import static com.researchspace.dataverse.search.entities.SearchConfig.MAX_RESULTS_PER_PAGE;
import static org.junit.Assert.assertEquals;

import com.researchspace.dataverse.search.entities.SearchConfig;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import com.researchspace.dataverse.search.entities.SearchConfig;
import static com.researchspace.dataverse.search.entities.SearchConfig.MAX_RESULTS_PER_PAGE;
import static org.junit.Assert.assertEquals;
/** <pre>
Copyright 2016 ResearchSpace

Expand Down