From 44cb16d5dac5f0b4b0047bbcc6fbe95be3dc0a94 Mon Sep 17 00:00:00 2001 From: Mark Patton Date: Wed, 4 Dec 2024 09:34:27 -0500 Subject: [PATCH] Give TransportSession.send access to PASS model of deposit --- .../provider/dspace/DSpaceMetadataMapper.java | 22 ++++++++++--------- .../pass/deposit/service/DepositTask.java | 2 +- .../pass/deposit/transport/Transport.java | 22 +++++++++---------- .../deposit/transport/TransportSession.java | 6 +++-- .../transport/devnull/DevNullTransport.java | 4 +++- .../transport/dspace/DSpaceSession.java | 9 ++++++-- .../transport/dspace/DSpaceTransport.java | 6 ++++- .../transport/fs/FilesystemTransport.java | 4 +++- .../transport/ftp/FtpTransportSession.java | 3 ++- .../inveniordm/InvenioRdmSession.java | 3 ++- .../transport/sftp/SftpTransportSession.java | 3 ++- .../transport/sword2/Sword2Transport.java | 2 +- .../sword2/Sword2TransportSession.java | 4 +++- .../pass/deposit/service/DepositTaskTest.java | 2 +- .../pass/deposit/transport/sftp/SftpTest.java | 4 ++-- 15 files changed, 59 insertions(+), 37 deletions(-) diff --git a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/provider/dspace/DSpaceMetadataMapper.java b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/provider/dspace/DSpaceMetadataMapper.java index c579aac60..6fc50f6a7 100644 --- a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/provider/dspace/DSpaceMetadataMapper.java +++ b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/provider/dspace/DSpaceMetadataMapper.java @@ -42,6 +42,9 @@ */ @Component public class DSpaceMetadataMapper { + // Section of workspace item form to add metadata + private static final String SECTION = "traditionalpageone"; + @Value("${dspace.field.embargo.lift}") private String dspaceFieldEmbargoLift; @@ -59,45 +62,44 @@ public String patchWorkspaceItem(DepositSubmission submission) { String title = manuscriptMd.getTitle(); // Required by DSpace - metadata.add(add_array("traditionalpageone", "dc.title", title)); + metadata.add(add_array(SECTION, "dc.title", title)); if (journalMd != null && journalMd.getPublisherName() != null) { - metadata.add(add_array("traditionalpageone", "dc.publisher", journalMd.getPublisherName())); + metadata.add(add_array(SECTION, "dc.publisher", journalMd.getPublisherName())); } if (articleMd.getDoi() != null) { - metadata.add(add_array("traditionalpageone", "dc.identifier.doi", articleMd.getDoi().toString())); + metadata.add(add_array(SECTION, "dc.identifier.doi", articleMd.getDoi().toString())); } if (manuscriptMd.getMsAbstract() != null) { - metadata.add(add_array("traditionalpageone", "dc.description.abstract", manuscriptMd.getMsAbstract())); + metadata.add(add_array(SECTION, "dc.description.abstract", manuscriptMd.getMsAbstract())); } String citation = createCitation(submission); if (!citation.isEmpty()) { - metadata.add(add_array("traditionalpageone", "dc.identifier.citation", citation)); + metadata.add(add_array(SECTION, "dc.identifier.citation", citation)); } // Required by DSpace as ISO 8601 local date - metadata.add(add_array("traditionalpageone", "dc.date.issued", journalMd.getPublicationDate(). + metadata.add(add_array(SECTION, "dc.date.issued", journalMd.getPublicationDate(). format(DateTimeFormatter.ISO_LOCAL_DATE))); // Add non-submitters as authors - // TODO This is different from before String[] authors = depositMd.getPersons().stream().filter( p -> p.getType() != DepositMetadata.PERSON_TYPE.submitter). map(Person::getName).toArray(String[]::new); - metadata.add(add_array("traditionalpageone", "dc.contributor.author", authors)); + metadata.add(add_array(SECTION, "dc.contributor.author", authors)); ZonedDateTime embargoLiftDate = articleMd.getEmbargoLiftDate(); if (embargoLiftDate != null) { String liftDate = embargoLiftDate.format(DateTimeFormatter.ISO_LOCAL_DATE); - metadata.add(add_array("traditionalpageone", dspaceFieldEmbargoLift, liftDate)); - metadata.add(add_array("traditionalpageone", dspaceFieldEmbargoTerms, liftDate)); + metadata.add(add_array(SECTION, dspaceFieldEmbargoLift, liftDate)); + metadata.add(add_array(SECTION, dspaceFieldEmbargoTerms, liftDate)); } // Required by DSpace diff --git a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/service/DepositTask.java b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/service/DepositTask.java index 3e7a5243c..79aee2eb2 100644 --- a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/service/DepositTask.java +++ b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/service/DepositTask.java @@ -437,7 +437,7 @@ static Function performDeposit(DepositWorkerContext Transport transport = getTransport(packager, dc); try (TransportSession transportSession = transport.open(packagerConfig)) { - TransportResponse tr = transportSession.send(packageStream, packagerConfig); + TransportResponse tr = transportSession.send(packageStream, packagerConfig, dc); deposit.setDepositStatus(DepositStatus.SUBMITTED); deposit.setDepositStatusRef(packageStream.metadata().packageDepositStatusRef()); return tr; diff --git a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/Transport.java b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/Transport.java index 222a3473b..a54e5cfe9 100644 --- a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/Transport.java +++ b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/Transport.java @@ -24,7 +24,7 @@ * Abstracts the transport protocol used to deposit a package with a target submission system. Callers are able to * {@link #open(Map) open} a {@link TransportSession} by supplying configuration hints, which allows the implementation * to perform necessary connection initialization, prior to a package being transported using - * {@link TransportSession#send(PackageStream, Map)}. + * {@link TransportSession#send(PackageStream, Map, DepositWorkerContext)}. */ public interface Transport { @@ -68,36 +68,36 @@ public interface Transport { /** * Property key identifying the base64 encoded checksum of the {@code InputStream} being deposited by {@link - * TransportSession#send(PackageStream, Map)}. N.B.: The preferred form of obtaining the checksum of the - * {@code InputStream} would be {@link PackageStream.Metadata#checksums()}. + * TransportSession#send(PackageStream, Map, DepositWorkerContext)}. N.B.: The preferred form of obtaining + * the checksum of the {@code InputStream} would be {@link PackageStream.Metadata#checksums()}. */ String TRANSPORT_CHECKSUM_SHA256 = "deposit.transport.checksum.sha256"; /** * Property key identifying the base64 encoded checksum of the {@code InputStream} being deposited by {@link - * TransportSession#send(PackageStream, Map)}. N.B.: The preferred form of obtaining the checksum of the - * {@code InputStream} would be {@link PackageStream.Metadata#checksums()}. + * TransportSession#send(PackageStream, Map, DepositWorkerContext)}. N.B.: The preferred form of obtaining + * the checksum of the {@code InputStream} would be {@link PackageStream.Metadata#checksums()}. */ String TRANSPORT_CHECKSUM_SHA512 = "deposit.transport.checksum.sha512"; /** * Property key identifying the base64 encoded checksum of the {@code InputStream} being deposited by {@link - * TransportSession#send(PackageStream, Map)}. N.B.: The preferred form of obtaining the checksum of the - * {@code InputStream} would be {@link PackageStream.Metadata#checksums()}. + * TransportSession#send(PackageStream, Map, DepositWorkerContext)}. N.B.: The preferred form of obtaining + * the checksum of the {@code InputStream} would be {@link PackageStream.Metadata#checksums()}. */ String TRANSPORT_CHECKSUM_MD5 = "deposit.transport.checksum.md5"; /** * Property key identifying the mime type of the {@code InputStream} being deposited by - * {@link TransportSession#send(PackageStream, Map)}. N.B.: The preferred form of obtaining the name of + * {@link TransportSession#send(PackageStream, Map, DepositWorkerContext)}. N.B.: The preferred form of obtaining the name of * the {@code InputStream} would be {@link PackageStream.Metadata#name()}. */ String TRANSPORT_MIME_TYPE = "deposit.transport.mime-type"; /** * Property key identifying the packaging spec of the {@code InputStream} being deposited by {@link - * TransportSession#send(PackageStream, Map)}. N.B.: The preferred form of obtaining the packaging - * specification of the {@code InputStream} would be {@link PackageStream.Metadata#spec()}. + * TransportSession#send(PackageStream, Map, DepositWorkerContext)}. N.B.: The preferred form + * of obtaining the packaging specification of the {@code InputStream} would be {@link PackageStream.Metadata#spec()}. */ String TRANSPORT_PACKAGE_SPEC = "deposit.transport.package-spec"; @@ -144,7 +144,7 @@ enum PROTOCOL { /** * Open a {@link TransportSession} with the underlying transport. The returned {@code TransportSession} should be * ready to use by the caller, without the caller having to perform any further setup (the implementation of this - * method should perform all necessary actions to allow {@link TransportSession#send(PackageStream, Map)} to + * method should perform all necessary actions to allow {@link TransportSession#send(PackageStream, Map, DepositWorkerContext)} to * succeed). The supplied {@code hints} may be used by the implementation to configure and open the session. Well * known properties include those documented in {@link Transport}, and individual implementations may document * properties as well. diff --git a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/TransportSession.java b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/TransportSession.java index 7b96383f5..d980ff3d3 100644 --- a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/TransportSession.java +++ b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/TransportSession.java @@ -20,6 +20,7 @@ import java.util.Map; import org.eclipse.pass.deposit.assembler.PackageStream; +import org.eclipse.pass.deposit.service.DepositUtil.DepositWorkerContext; /** * Represents an open connection, or the promise of a successful connection, with a service or system that will accept @@ -33,7 +34,6 @@ *

*/ public interface TransportSession extends AutoCloseable { - /** * Transfer the bytes of the supplied package to the remote system. Metadata can be optionally supplied which may * help the underlying transport correctly configure itself for the transfer. @@ -45,12 +45,14 @@ public interface TransportSession extends AutoCloseable { * * @param packageStream the package and package metadata * @param metadata transport-related metadata, or any "extra" package metadata + * @param dc information about PASS objects * @return a response indicating success or failure of the transfer */ - TransportResponse send(PackageStream packageStream, Map metadata); + TransportResponse send(PackageStream packageStream, Map metadata, DepositWorkerContext dc); boolean closed(); + @Override void close() throws IOException; } diff --git a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/devnull/DevNullTransport.java b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/devnull/DevNullTransport.java index a91bdfcbf..76b718757 100644 --- a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/devnull/DevNullTransport.java +++ b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/devnull/DevNullTransport.java @@ -23,6 +23,7 @@ import org.eclipse.pass.deposit.cri.CriticalRepositoryInteraction; import org.eclipse.pass.deposit.cri.CriticalRepositoryInteraction.CriticalResult; import org.eclipse.pass.deposit.service.DepositUtil; +import org.eclipse.pass.deposit.service.DepositUtil.DepositWorkerContext; import org.eclipse.pass.deposit.transport.Transport; import org.eclipse.pass.deposit.transport.TransportResponse; import org.eclipse.pass.deposit.transport.TransportSession; @@ -66,7 +67,8 @@ public TransportSession open(Map hints) { class DevNullTransportSession implements TransportSession { @Override - public TransportResponse send(PackageStream packageStream, Map metadata) { + public TransportResponse send(PackageStream packageStream, Map metadata, + DepositWorkerContext dc) { // no-op, just return successful response return new TransportResponse() { @Override diff --git a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/dspace/DSpaceSession.java b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/dspace/DSpaceSession.java index 456f4edf1..71dee4bd2 100644 --- a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/dspace/DSpaceSession.java +++ b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/dspace/DSpaceSession.java @@ -21,10 +21,12 @@ import org.eclipse.pass.deposit.assembler.PackageStream; import org.eclipse.pass.deposit.model.DepositSubmission; import org.eclipse.pass.deposit.provider.dspace.DSpaceMetadataMapper; +import org.eclipse.pass.deposit.service.DepositUtil.DepositWorkerContext; import org.eclipse.pass.deposit.support.dspace.DspaceDepositService; import org.eclipse.pass.deposit.support.dspace.DspaceDepositService.AuthContext; import org.eclipse.pass.deposit.transport.TransportResponse; import org.eclipse.pass.deposit.transport.TransportSession; +import org.eclipse.pass.support.client.PassClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -38,14 +40,17 @@ class DSpaceSession implements TransportSession { private final DspaceDepositService dspaceDepositService; private final DSpaceMetadataMapper dspaceMetadataMapper; + private final PassClient passClient; - public DSpaceSession(DspaceDepositService dspaceDepositService, DSpaceMetadataMapper dspaceMetadataMapper) { + public DSpaceSession(DspaceDepositService dspaceDepositService, DSpaceMetadataMapper dspaceMetadataMapper, + PassClient passClient) { this.dspaceDepositService = dspaceDepositService; this.dspaceMetadataMapper = dspaceMetadataMapper; + this.passClient = passClient; } @Override - public TransportResponse send(PackageStream packageStream, Map metadata) { + public TransportResponse send(PackageStream packageStream, Map metadata, DepositWorkerContext dc) { try { DepositSubmission depositSubmission = packageStream.getDepositSubmission(); diff --git a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/dspace/DSpaceTransport.java b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/dspace/DSpaceTransport.java index 5faa53f11..cc68111e5 100644 --- a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/dspace/DSpaceTransport.java +++ b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/dspace/DSpaceTransport.java @@ -21,6 +21,7 @@ import org.eclipse.pass.deposit.support.dspace.DspaceDepositService; import org.eclipse.pass.deposit.transport.Transport; import org.eclipse.pass.deposit.transport.TransportSession; +import org.eclipse.pass.support.client.PassClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -32,6 +33,9 @@ public class DSpaceTransport implements Transport { @Autowired private DSpaceMetadataMapper dspaceMetadataMapper; + @Autowired + private PassClient passClient; + @Override public PROTOCOL protocol() { return PROTOCOL.DSpace; @@ -39,6 +43,6 @@ public PROTOCOL protocol() { @Override public TransportSession open(Map hints) { - return new DSpaceSession(dspaceDepositService, dspaceMetadataMapper); + return new DSpaceSession(dspaceDepositService, dspaceMetadataMapper, passClient); } } diff --git a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/fs/FilesystemTransport.java b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/fs/FilesystemTransport.java index 719c25bd3..96e33fb1d 100644 --- a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/fs/FilesystemTransport.java +++ b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/fs/FilesystemTransport.java @@ -33,6 +33,7 @@ import org.eclipse.pass.deposit.cri.CriticalRepositoryInteraction; import org.eclipse.pass.deposit.cri.CriticalRepositoryInteraction.CriticalResult; import org.eclipse.pass.deposit.service.DepositUtil; +import org.eclipse.pass.deposit.service.DepositUtil.DepositWorkerContext; import org.eclipse.pass.deposit.transport.Transport; import org.eclipse.pass.deposit.transport.TransportResponse; import org.eclipse.pass.deposit.transport.TransportSession; @@ -109,7 +110,8 @@ public TransportSession open(Map hints) { class FilesystemTransportSession implements TransportSession { @Override - public TransportResponse send(PackageStream packageStream, Map metadata) { + public TransportResponse send(PackageStream packageStream, Map metadata, + DepositWorkerContext dc) { String filename = packageStream.metadata().name(); AtomicReference transportException = new AtomicReference<>(); diff --git a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/ftp/FtpTransportSession.java b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/ftp/FtpTransportSession.java index 6f8d0d6a7..554da4cd6 100644 --- a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/ftp/FtpTransportSession.java +++ b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/ftp/FtpTransportSession.java @@ -36,6 +36,7 @@ import org.apache.commons.net.ftp.FTPClient; import org.eclipse.pass.deposit.assembler.PackageStream; +import org.eclipse.pass.deposit.service.DepositUtil.DepositWorkerContext; import org.eclipse.pass.deposit.transport.TransportResponse; import org.eclipse.pass.deposit.transport.TransportSession; import org.slf4j.Logger; @@ -85,7 +86,7 @@ private FtpTransportSession(FTPClient ftpClient, ExecutorService executorService } @Override - public TransportResponse send(PackageStream packageStream, Map metadata) { + public TransportResponse send(PackageStream packageStream, Map metadata, DepositWorkerContext dc) { PackageStream.Metadata streamMetadata = packageStream.metadata(); diff --git a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/inveniordm/InvenioRdmSession.java b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/inveniordm/InvenioRdmSession.java index d4e3310bb..846d71e4c 100644 --- a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/inveniordm/InvenioRdmSession.java +++ b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/inveniordm/InvenioRdmSession.java @@ -39,6 +39,7 @@ import org.eclipse.pass.deposit.assembler.PackageStream; import org.eclipse.pass.deposit.model.DepositSubmission; import org.eclipse.pass.deposit.provider.inveniordm.InvenioRdmMetadataMapper; +import org.eclipse.pass.deposit.service.DepositUtil.DepositWorkerContext; import org.eclipse.pass.deposit.transport.TransportResponse; import org.eclipse.pass.deposit.transport.TransportSession; import org.slf4j.Logger; @@ -81,7 +82,7 @@ class InvenioRdmSession implements TransportSession { } @Override - public TransportResponse send(PackageStream packageStream, Map metadata) { + public TransportResponse send(PackageStream packageStream, Map metadata, DepositWorkerContext dc) { try { DepositSubmission depositSubmission = packageStream.getDepositSubmission(); LOG.warn("Processing InvenioRDM Deposit for Submission: {}", depositSubmission.getId()); diff --git a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/sftp/SftpTransportSession.java b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/sftp/SftpTransportSession.java index 760afec9d..980e04cce 100644 --- a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/sftp/SftpTransportSession.java +++ b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/sftp/SftpTransportSession.java @@ -42,6 +42,7 @@ import org.apache.sshd.sftp.common.SftpException; import org.eclipse.pass.deposit.DepositServiceRuntimeException; import org.eclipse.pass.deposit.assembler.PackageStream; +import org.eclipse.pass.deposit.service.DepositUtil.DepositWorkerContext; import org.eclipse.pass.deposit.transport.TransportResponse; import org.eclipse.pass.deposit.transport.TransportSession; @@ -57,7 +58,7 @@ class SftpTransportSession implements TransportSession { } @Override - public TransportResponse send(PackageStream packageStream, Map metadata) { + public TransportResponse send(PackageStream packageStream, Map metadata, DepositWorkerContext dc) { PackageStream.Metadata streamMetadata = packageStream.metadata(); String fileName = streamMetadata.name(); diff --git a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/sword2/Sword2Transport.java b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/sword2/Sword2Transport.java index e2edc17fc..3915b20c3 100644 --- a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/sword2/Sword2Transport.java +++ b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/sword2/Sword2Transport.java @@ -54,7 +54,7 @@ *
A URL to the SWORD version 2 service document
*
{@link Sword2TransportHints#SWORD_COLLECTION_URL}
*
A URL to the SWORD version 2 collection that packages will be deposited to upon - * {@link Sword2TransportSession#send(PackageStream, Map) send}
+ * {@link Sword2TransportSession#send(PackageStream, Map, DepositWorkerContext) send} *
Optional: {@link Sword2TransportHints#SWORD_ON_BEHALF_OF_USER}
*
The username this session is being opened for
*
Optional: {@link Sword2TransportHints#SWORD_CLIENT_USER_AGENT}
diff --git a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/sword2/Sword2TransportSession.java b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/sword2/Sword2TransportSession.java index 6923a1493..e040328a9 100644 --- a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/sword2/Sword2TransportSession.java +++ b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/transport/sword2/Sword2TransportSession.java @@ -29,6 +29,7 @@ import com.google.gson.JsonElement; import org.eclipse.pass.deposit.assembler.PackageOptions.Checksum; import org.eclipse.pass.deposit.assembler.PackageStream; +import org.eclipse.pass.deposit.service.DepositUtil.DepositWorkerContext; import org.eclipse.pass.deposit.transport.TransportResponse; import org.eclipse.pass.deposit.transport.TransportSession; import org.slf4j.Logger; @@ -104,6 +105,7 @@ public Sword2TransportSession(SWORDClient client, ServiceDocument serviceDocumen * * @param packageStream {@inheritDoc} * @param metadata {@inheritDoc} + * @param dc {@inheritDoc} * @return {@inheritDoc} * @throws IllegalStateException if this session has been {@link #close() closed} * @see @@ -111,7 +113,7 @@ public Sword2TransportSession(SWORDClient client, ServiceDocument serviceDocumen * SWORD v2 Profile */ @Override - public TransportResponse send(PackageStream packageStream, Map metadata) { + public TransportResponse send(PackageStream packageStream, Map metadata, DepositWorkerContext dc) { if (closed) { throw new IllegalStateException("SWORDv2 transport session has been closed."); } diff --git a/pass-deposit-services/deposit-core/src/test/java/org/eclipse/pass/deposit/service/DepositTaskTest.java b/pass-deposit-services/deposit-core/src/test/java/org/eclipse/pass/deposit/service/DepositTaskTest.java index 627792d7f..c21560146 100644 --- a/pass-deposit-services/deposit-core/src/test/java/org/eclipse/pass/deposit/service/DepositTaskTest.java +++ b/pass-deposit-services/deposit-core/src/test/java/org/eclipse/pass/deposit/service/DepositTaskTest.java @@ -192,7 +192,7 @@ private static Deposit depositContext(DepositUtil.DepositWorkerContext depositCo when(stream.metadata()).thenReturn(metadata); when(packager.getTransport()).thenReturn(transport); when(transport.open(anyMap())).thenReturn(session); - when(session.send(eq(stream), any())).thenReturn(tr); + when(session.send(eq(stream), any(), any())).thenReturn(tr); when(depositContext.packager()).thenReturn(packager); diff --git a/pass-deposit-services/deposit-core/src/test/java/org/eclipse/pass/deposit/transport/sftp/SftpTest.java b/pass-deposit-services/deposit-core/src/test/java/org/eclipse/pass/deposit/transport/sftp/SftpTest.java index f4bc0c138..1f7dd24ae 100644 --- a/pass-deposit-services/deposit-core/src/test/java/org/eclipse/pass/deposit/transport/sftp/SftpTest.java +++ b/pass-deposit-services/deposit-core/src/test/java/org/eclipse/pass/deposit/transport/sftp/SftpTest.java @@ -101,7 +101,7 @@ public void testCreateFile() { TransportSession transportSession = sftpTransport.open(hints); // WHEN - TransportResponse transportResponse = transportSession.send(stream, new HashMap<>()); + TransportResponse transportResponse = transportSession.send(stream, new HashMap<>(), null); // THEN assertTrue(transportResponse.success()); @@ -131,7 +131,7 @@ public void testCreateFile_Fail_MissingBaseDir() { // WHEN DepositServiceRuntimeException ex = assertThrows(DepositServiceRuntimeException.class, () -> { - transportSession.send(stream, new HashMap<>()); + transportSession.send(stream, new HashMap<>(), null); }); // THEN