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
18 changes: 18 additions & 0 deletions .github/workflows/prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,21 @@ jobs:
java-version: ${{matrix.java}}
cache: 'gradle'
- run: ./gradlew test --no-daemon
integration-test:
runs-on: ubuntu-latest
needs: test
strategy:
matrix:
java: [ '8', '11' ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: ${{matrix.java}}
cache: 'gradle'
- name: Run integration tests
env:
DV_KEY: ${{ secrets.DEMO_DATAVERSE_OTTER606 }}
run: |
./gradlew clean integrationTest -DdataverseApiKey="$DV_KEY"
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ 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
dataverseAlias=rspace-demo
dataverseAlias=otter606

As a minimum, you'll need to specify an API key on the command line to run the tests:

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ configurations {
all*.exclude group: 'javax.jms'
all*.exclude group: 'com.sun.jdmk'
all*.exclude group: 'com.sun.jmx'
integrationTestCompile.extendsFrom testCompile
integrationTestImplementation.extendsFrom testImplementation
integrationTestRuntime.extendsFrom testRuntime
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public class AbstractIntegrationTest extends AbstractJUnit4SpringContextTests {

public void setUp() throws Exception {
validateServerCredentials();
log.info("serverURL: [{}], apiKey: [{}], dataverseId=[{}]", serverURL, apiKey, dataverseAlias);
// log.info("serverURL: [{}], apiKey: [{}], dataverseId=[{}]", serverURL, apiKey, dataverseAlias);
URL uri = new URL(serverURL);
DataverseConfig cfg = new DataverseConfig(uri, apiKey, dataverseAlias);
dataverseAPI.configure(cfg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,21 @@
*/
package com.researchspace.dataverse.http;

import static com.researchspace.dataverse.entities.facade.DatasetTestFactory.createFacade;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.List;

import com.researchspace.dataverse.entities.*;
import com.researchspace.dataverse.entities.facade.DatasetFacade;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.RandomStringUtils;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;

import com.researchspace.dataverse.entities.Dataset;
import com.researchspace.dataverse.entities.DatasetVersion;
import com.researchspace.dataverse.entities.DataverseObject;
import com.researchspace.dataverse.entities.DataversePost;
import com.researchspace.dataverse.entities.DataverseResponse;
import com.researchspace.dataverse.entities.Identifier;
import com.researchspace.dataverse.entities.PublishedDataset;
import com.researchspace.dataverse.entities.Version;
import com.researchspace.dataverse.entities.facade.DatasetFacade;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.List;

import static com.researchspace.dataverse.entities.facade.DatasetTestFactory.createFacade;
import static org.junit.Assert.*;


/** <pre>
Expand Down Expand Up @@ -64,7 +52,9 @@ public void testListDatasets() {

}

//TODO figure out why data is invalid
@Test
@Ignore("this test fails with message: Error parsing Json: incorrect multiple for field collectionMode")
public void testPostSampleDataset() throws IOException, InterruptedException, URISyntaxException {
String toPost = FileUtils.readFileToString(exampleDatasetJson);
Identifier datasetId = dataverseOps.createDataset(toPost, dataverseAlias);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@
*/
package com.researchspace.dataverse.http;

import static org.junit.Assert.assertTrue;

import java.io.IOException;

import com.researchspace.dataverse.entities.DVField;
import com.researchspace.dataverse.entities.MetadataBlock;
import lombok.extern.slf4j.Slf4j;
import org.junit.Before;
import org.junit.Test;
import org.springframework.web.client.RestClientException;

import com.researchspace.dataverse.entities.DVField;
import com.researchspace.dataverse.entities.MetadataBlock;
import java.io.IOException;

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

Expand Down Expand Up @@ -56,7 +54,7 @@ public void testGetMetdataByIdBlockInfoWithInvalidId() throws IOException {
public void testGetMetdataByIdBlockInfo() throws IOException {
MetadataBlock block = metadataOPs.getMetadataById("biomedical");
for (DVField fld : block.getFields().values()) {
log.info(fld.toString());
// log.info(fld.toString());
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"datasetVersion": {
"license": "CC0",
"license": "CC0 1.0",
"termsOfUse": "CC0 Waiver",
"metadataBlocks": {
"citation": {
Expand Down
2 changes: 1 addition & 1 deletion src/integration-test/resources/test.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
dataverseServerURL=https://demo.dataverse.org
dataverseAlias=rspace-demo
dataverseAlias=otter606
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,6 @@
import java.net.URL;
import java.util.Arrays;
import java.util.Date;

import com.researchspace.dataverse.entities.facade.ContributorType;
import com.researchspace.dataverse.entities.facade.DatasetAuthor;
import com.researchspace.dataverse.entities.facade.DatasetContact;
import com.researchspace.dataverse.entities.facade.DatasetContributor;
import com.researchspace.dataverse.entities.facade.DatasetDescription;
import com.researchspace.dataverse.entities.facade.DatasetFacade;
import com.researchspace.dataverse.entities.facade.DatasetKeyword;
import com.researchspace.dataverse.entities.facade.DatasetProducer;
import com.researchspace.dataverse.entities.facade.DatasetPublication;
import com.researchspace.dataverse.entities.facade.DatasetTopicClassification;
import com.researchspace.dataverse.entities.facade.PublicationIDType;
/**
* /** <pre>
Copyright 2016 ResearchSpace
Expand Down Expand Up @@ -65,7 +53,7 @@ public static DatasetFacade createFacade() throws MalformedURLException, URISynt
.depositor("A depositor")
.subtitle(" A subtitle")
.alternativeTitle("altTitle")
.alternativeURL(new URL("http://www.myrepo.com"))
.alternativeURL(new URL("https://www.myrepo.com"))
.note("Some note")
.languages(Arrays.asList(new String []{"English", "French"}))
.build();
Expand All @@ -83,8 +71,8 @@ private static DatasetProducer buildAProducer() throws MalformedURLException {
.name("a producer")
.abbreviation("abbr")
.affiliation("UoE")
.logoURL(new URL("http:///pubmed.logo.com/1234"))
.url(new URL("http:///pubmed.com/1234"))
.logoURL(new URL("https://pubmed.logo.com/1234"))
.url(new URL("https://pubmed.com/1234"))
.build();
}

Expand All @@ -93,19 +81,19 @@ private static DatasetPublication buildAPublication() throws MalformedURLExcepti
.publicationCitation("citation")
.publicationIdNumber("12435")
.publicationIDType(PublicationIDType.ean13)
.publicationURL(new URL("http:///pubmed.com/1234"))
.publicationURL(new URL("https://pubmed.com/1234"))
.build();
}

private static DatasetTopicClassification buildATopicClassification(String value) throws URISyntaxException {
return DatasetTopicClassification.builder().topicClassValue(value)
.topicClassVocab("a topic vocab").topicClassVocabURI(new URI("http://www.vocab.org"))
.topicClassVocab("a topic vocab").topicClassVocabURI(new URI("https://www.vocab.org"))
.build();
}

private static DatasetKeyword buildAKeyword(String key) throws URISyntaxException {
return DatasetKeyword.builder().value(key).vocabulary("keywordVocab")
.vocabularyURI(new URI("http://vocab.com")).build();
.vocabularyURI(new URI("https://vocab.com")).build();
}

private static DatasetDescription buildADesc() {
Expand Down