Skip to content

Commit

Permalink
Merge branch 'develop' into 10242-set-featured-dv-via-api
Browse files Browse the repository at this point in the history
  • Loading branch information
sekmiller committed Apr 12, 2024
2 parents 98cd85c + 8974574 commit 3ddb72d
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 64 deletions.
3 changes: 3 additions & 0 deletions doc/release-notes/10339-workflow.md
@@ -0,0 +1,3 @@
The computational workflow metadata block has been updated to present a clickable link for the External Code Repository URL field.

Release notes should include the usual instructions, for those who have installed this optional block, to update the computational_workflow block. (PR#10441)
11 changes: 7 additions & 4 deletions doc/sphinx-guides/source/developers/testing.rst
Expand Up @@ -142,6 +142,8 @@ Generally speaking, unit tests have been flagged as non-essential because they a
You should not feel obligated to run these tests continuously but you can use the ``mvn`` command above to run them.
To iterate on the unit test in Netbeans and execute it with "Run -> Test File", you must temporarily comment out the annotation flagging the test as non-essential.

.. _integration-tests:

Integration Tests
-----------------

Expand Down Expand Up @@ -392,10 +394,10 @@ Run this as the "dataverse" user.
Note that after deployment the file "/usr/local/payara6/glassfish/domains/domain1/config/jacoco.exec" exists and is empty.

Run API Tests
~~~~~~~~~~~~~
Run API Tests to Determine Code Coverage
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Note that even though you see "docker-aio" in the command below, we assume you are not necessarily running the test suite within Docker. (Some day we'll probably move this script to another directory.) For this reason, we pass the URL with the normal port (8080) that app servers run on to the ``run-test-suite.sh`` script.
Note that if you are looking for how to run API tests generally, you should refer to :ref:`integration-tests`.

Note that "/usr/local/payara6/glassfish/domains/domain1/config/jacoco.exec" will become non-empty after you stop and start Payara. You must stop and start Payara before every run of the integration test suite.

Expand All @@ -405,7 +407,8 @@ Note that "/usr/local/payara6/glassfish/domains/domain1/config/jacoco.exec" will
/usr/local/payara6/bin/asadmin start-domain
git clone https://github.com/IQSS/dataverse.git
cd dataverse
conf/docker-aio/run-test-suite.sh http://localhost:8080
TESTS=$(<tests/integration-tests.txt)
mvn test -Dtest=$TESTS
(As an aside, you are not limited to API tests for the purposes of learning which code paths are being executed. You could click around the GUI, for example. Jacoco doesn't know or care how you exercise the application.)

Expand Down
2 changes: 1 addition & 1 deletion scripts/api/data/metadatablocks/computational_workflow.tsv
Expand Up @@ -2,7 +2,7 @@
computationalworkflow Computational Workflow Metadata
#datasetField name title description watermark fieldType displayOrder displayFormat advancedSearchField allowControlledVocabulary allowmultiples facetable displayoncreate required parent metadatablock_id termURI
workflowType Computational Workflow Type The kind of Computational Workflow, which is designed to compose and execute a series of computational or data manipulation steps in a scientific application text 0 TRUE TRUE TRUE TRUE TRUE FALSE computationalworkflow
workflowCodeRepository External Code Repository URL A link to the repository where the un-compiled, human readable code and related code is located (e.g. GitHub, GitLab, SVN) https://... url 1 FALSE FALSE TRUE FALSE TRUE FALSE computationalworkflow
workflowCodeRepository External Code Repository URL A link to the repository where the un-compiled, human readable code and related code is located (e.g. GitHub, GitLab, SVN) https://... url 1 <a href="#VALUE" target="_blank">#VALUE</a> FALSE FALSE TRUE FALSE TRUE FALSE computationalworkflow
workflowDocumentation Documentation A link (URL) to the documentation or text describing the Computational Workflow and its use textbox 2 FALSE FALSE TRUE FALSE TRUE FALSE computationalworkflow
#controlledVocabulary DatasetField Value identifier displayOrder
workflowType Common Workflow Language (CWL) workflowtype_cwl 1
Expand Down
114 changes: 64 additions & 50 deletions src/main/java/edu/harvard/iq/dataverse/FileDownloadServiceBean.java
Expand Up @@ -382,28 +382,26 @@ public void explore(GuestbookResponse guestbookResponse, FileMetadata fmd, Exter
}
}

public void downloadDatasetCitationXML(Dataset dataset) {
downloadCitationXML(null, dataset, false);
public void downloadDatasetCitationXML(DatasetVersion version) {
// DatasetVersion-level citation:
DataCitation citation=null;
citation = new DataCitation(version);
String fileNameString;
fileNameString = "attachment;filename=" + getFileNameFromPid(citation.getPersistentId()) + ".xml";
downloadXML(citation, fileNameString);
}

public void downloadDatafileCitationXML(FileMetadata fileMetadata) {
downloadCitationXML(fileMetadata, null, false);
downloadCitationXML(fileMetadata, false);
}

public void downloadDirectDatafileCitationXML(FileMetadata fileMetadata) {
downloadCitationXML(fileMetadata, null, true);
downloadCitationXML(fileMetadata, true);
}

public void downloadCitationXML(FileMetadata fileMetadata, Dataset dataset, boolean direct) {
DataCitation citation=null;
if (dataset != null){
citation = new DataCitation(dataset.getLatestVersion());
} else {
citation= new DataCitation(fileMetadata, direct);
}
FacesContext ctx = FacesContext.getCurrentInstance();
HttpServletResponse response = (HttpServletResponse) ctx.getExternalContext().getResponse();
response.setContentType("text/xml");
public void downloadCitationXML(FileMetadata fileMetadata, boolean direct) {
DataCitation citation=null;
citation= new DataCitation(fileMetadata, direct);
String fileNameString;
if (fileMetadata == null || fileMetadata.getLabel() == null) {
// Dataset-level citation:
Expand All @@ -412,43 +410,46 @@ public void downloadCitationXML(FileMetadata fileMetadata, Dataset dataset, bool
// Datafile-level citation:
fileNameString = "attachment;filename=" + getFileNameFromPid(citation.getPersistentId()) + "-" + FileUtil.getCiteDataFileFilename(citation.getFileTitle(), FileUtil.FileCitationExtension.ENDNOTE);
}
downloadXML(citation, fileNameString);
}

public void downloadXML(DataCitation citation, String fileNameString) {
FacesContext ctx = FacesContext.getCurrentInstance();
HttpServletResponse response = (HttpServletResponse) ctx.getExternalContext().getResponse();
response.setContentType("text/xml");
response.setHeader("Content-Disposition", fileNameString);

try {
ServletOutputStream out = response.getOutputStream();
citation.writeAsEndNoteCitation(out);
out.flush();
ctx.responseComplete();
} catch (IOException e) {

}
}

public void downloadDatasetCitationRIS(Dataset dataset) {

downloadCitationRIS(null, dataset, false);
public void downloadDatasetCitationRIS(DatasetVersion version) {
// DatasetVersion-level citation:
DataCitation citation=null;
citation = new DataCitation(version);

String fileNameString;
fileNameString = "attachment;filename=" + getFileNameFromPid(citation.getPersistentId()) + ".ris";
downloadRIS(citation, fileNameString);
}

public void downloadDatafileCitationRIS(FileMetadata fileMetadata) {
downloadCitationRIS(fileMetadata, null, false);
downloadCitationRIS(fileMetadata, false);
}

public void downloadDirectDatafileCitationRIS(FileMetadata fileMetadata) {
downloadCitationRIS(fileMetadata, null, true);
downloadCitationRIS(fileMetadata, true);
}

public void downloadCitationRIS(FileMetadata fileMetadata, Dataset dataset, boolean direct) {
DataCitation citation=null;
if (dataset != null){
citation = new DataCitation(dataset.getLatestVersion());
} else {
citation= new DataCitation(fileMetadata, direct);
}

FacesContext ctx = FacesContext.getCurrentInstance();
HttpServletResponse response = (HttpServletResponse) ctx.getExternalContext().getResponse();
response.setContentType("application/download");

public void downloadCitationRIS(FileMetadata fileMetadata, boolean direct) {
DataCitation citation=null;
citation= new DataCitation(fileMetadata, direct);

String fileNameString;
if (fileMetadata == null || fileMetadata.getLabel() == null) {
// Dataset-level citation:
Expand All @@ -457,6 +458,14 @@ public void downloadCitationRIS(FileMetadata fileMetadata, Dataset dataset, bool
// Datafile-level citation:
fileNameString = "attachment;filename=" + getFileNameFromPid(citation.getPersistentId()) + "-" + FileUtil.getCiteDataFileFilename(citation.getFileTitle(), FileUtil.FileCitationExtension.RIS);
}
downloadRIS(citation, fileNameString);
}

public void downloadRIS(DataCitation citation, String fileNameString) {
//SEK 12/3/2018 changing this to open the json in a new tab.
FacesContext ctx = FacesContext.getCurrentInstance();
HttpServletResponse response = (HttpServletResponse) ctx.getExternalContext().getResponse();
response.setContentType("application/download");
response.setHeader("Content-Disposition", fileNameString);

try {
Expand All @@ -468,38 +477,33 @@ public void downloadCitationRIS(FileMetadata fileMetadata, Dataset dataset, bool

}
}

private String getFileNameFromPid(GlobalId id) {
return id.asString();
}

public void downloadDatasetCitationBibtex(Dataset dataset) {

downloadCitationBibtex(null, dataset, false);
public void downloadDatasetCitationBibtex(DatasetVersion version) {
// DatasetVersion-level citation:
DataCitation citation=null;
citation = new DataCitation(version);

String fileNameString;
fileNameString = "inline;filename=" + getFileNameFromPid(citation.getPersistentId()) + ".bib";
downloadBibtex(citation, fileNameString);
}

public void downloadDatafileCitationBibtex(FileMetadata fileMetadata) {
downloadCitationBibtex(fileMetadata, null, false);
downloadCitationBibtex(fileMetadata, false);
}

public void downloadDirectDatafileCitationBibtex(FileMetadata fileMetadata) {
downloadCitationBibtex(fileMetadata, null, true);
downloadCitationBibtex(fileMetadata, true);
}

public void downloadCitationBibtex(FileMetadata fileMetadata, Dataset dataset, boolean direct) {
DataCitation citation=null;
if (dataset != null){
citation = new DataCitation(dataset.getLatestVersion());
} else {
citation= new DataCitation(fileMetadata, direct);
}
//SEK 12/3/2018 changing this to open the json in a new tab.
FacesContext ctx = FacesContext.getCurrentInstance();
HttpServletResponse response = (HttpServletResponse) ctx.getExternalContext().getResponse();

//Fix for 6029 FireFox was failing to parse it when content type was set to json
response.setContentType("text/plain");
public void downloadCitationBibtex(FileMetadata fileMetadata, boolean direct) {
DataCitation citation=null;
citation= new DataCitation(fileMetadata, direct);

String fileNameString;
if (fileMetadata == null || fileMetadata.getLabel() == null) {
Expand All @@ -509,6 +513,16 @@ public void downloadCitationBibtex(FileMetadata fileMetadata, Dataset dataset, b
// Datafile-level citation:
fileNameString = "inline;filename=" + getFileNameFromPid(citation.getPersistentId()) + "-" + FileUtil.getCiteDataFileFilename(citation.getFileTitle(), FileUtil.FileCitationExtension.BIBTEX);
}
downloadBibtex(citation, fileNameString);
}

public void downloadBibtex(DataCitation citation, String fileNameString) {
//SEK 12/3/2018 changing this to open the json in a new tab.
FacesContext ctx = FacesContext.getCurrentInstance();
HttpServletResponse response = (HttpServletResponse) ctx.getExternalContext().getResponse();

//Fix for 6029 FireFox was failing to parse it when content type was set to json
response.setContentType("text/plain");
response.setHeader("Content-Disposition", fileNameString);

try {
Expand Down
6 changes: 3 additions & 3 deletions src/main/webapp/dataset-citation.xhtml
Expand Up @@ -33,13 +33,13 @@
</button>
<ul class="dropdown-menu">
<li>
<h:commandLink id="endNoteLink" value="#{bundle['dataset.cite.downloadBtn.xml']}" action="#{DatasetPage.fileDownloadService.downloadDatasetCitationXML(DatasetPage.dataset)}"/>
<h:commandLink id="endNoteLink" value="#{bundle['dataset.cite.downloadBtn.xml']}" action="#{DatasetPage.fileDownloadService.downloadDatasetCitationXML(DatasetPage.workingVersion)}"/>
</li>
<li>
<h:commandLink id="risLink" value="#{bundle['dataset.cite.downloadBtn.ris']}" action="#{DatasetPage.fileDownloadService.downloadDatasetCitationRIS(DatasetPage.dataset)}"/>
<h:commandLink id="risLink" value="#{bundle['dataset.cite.downloadBtn.ris']}" action="#{DatasetPage.fileDownloadService.downloadDatasetCitationRIS(DatasetPage.workingVersion)}"/>
</li>
<li>
<h:commandLink id="bibLink" value="#{bundle['dataset.cite.downloadBtn.bib']}" action="#{DatasetPage.fileDownloadService.downloadDatasetCitationBibtex(DatasetPage.dataset)}" target="_blank"/>
<h:commandLink id="bibLink" value="#{bundle['dataset.cite.downloadBtn.bib']}" action="#{DatasetPage.fileDownloadService.downloadDatasetCitationBibtex(DatasetPage.workingVersion)}" target="_blank"/>
</li>
</ul>
</div>
Expand Down
12 changes: 6 additions & 6 deletions src/main/webapp/file.xhtml
Expand Up @@ -112,19 +112,19 @@
<li>
<h:commandLink
id="endNoteLink-2" value="#{bundle['dataset.cite.downloadBtn.xml']}"
action="#{FilePage.fileDownloadService.downloadCitationXML(FilePage.fileMetadata, null, FilePage.fileMetadata.dataFile.isIdentifierRegistered())}"
action="#{FilePage.fileDownloadService.downloadCitationXML(FilePage.fileMetadata, FilePage.fileMetadata.dataFile.isIdentifierRegistered())}"
/>
</li>
<li>
<h:commandLink
id="risLink-2" value="#{bundle['dataset.cite.downloadBtn.ris']}"
action="#{FilePage.fileDownloadService.downloadCitationRIS(FilePage.fileMetadata, null, FilePage.fileMetadata.dataFile.isIdentifierRegistered())}"
action="#{FilePage.fileDownloadService.downloadCitationRIS(FilePage.fileMetadata, FilePage.fileMetadata.dataFile.isIdentifierRegistered())}"
/>
</li>
<li>
<h:commandLink
id="bibLink-2" value="#{bundle['dataset.cite.downloadBtn.bib']}" target="_blank"
action="#{FilePage.fileDownloadService.downloadCitationBibtex(FilePage.fileMetadata, null, FilePage.fileMetadata.dataFile.isIdentifierRegistered())}"
action="#{FilePage.fileDownloadService.downloadCitationBibtex(FilePage.fileMetadata, FilePage.fileMetadata.dataFile.isIdentifierRegistered())}"
/>
</li>
</ul>
Expand Down Expand Up @@ -161,19 +161,19 @@
<li>
<h:commandLink
id="endNoteLink" value="#{bundle['dataset.cite.downloadBtn.xml']}"
action="#{FilePage.fileDownloadService.downloadDatasetCitationXML(FilePage.fileMetadata.datasetVersion.dataset)}"
action="#{FilePage.fileDownloadService.downloadDatasetCitationXML(FilePage.fileMetadata.datasetVersion)}"
/>
</li>
<li>
<h:commandLink
id="risLink" value="#{bundle['dataset.cite.downloadBtn.ris']}"
action="#{FilePage.fileDownloadService.downloadDatasetCitationRIS(FilePage.fileMetadata.datasetVersion.dataset)}"
action="#{FilePage.fileDownloadService.downloadDatasetCitationRIS(FilePage.fileMetadata.datasetVersion)}"
/>
</li>
<li>
<h:commandLink
id="bibLink" value="#{bundle['dataset.cite.downloadBtn.bib']}" target="_blank"
action="#{FilePage.fileDownloadService.downloadDatasetCitationBibtex(FilePage.fileMetadata.datasetVersion.dataset)}"
action="#{FilePage.fileDownloadService.downloadDatasetCitationBibtex(FilePage.fileMetadata.datasetVersion)}"
/>
</li>
</ul>
Expand Down

0 comments on commit 3ddb72d

Please sign in to comment.