Open jrgriffiniii opened 4 years ago
In order to synchronize items from Symplectic Elements, one must invoke the "item-release" scripts.
I have initialized https://github.com/jrgriffiniii/pulibrary-dspace-cli as a basis from which to being developing an experimental CLI task for replacing the OAR mailer procedure.
https://github.com/jrgriffiniii/pulibrary-dspace-cli/tree/introduce-tests advances JUnit and Jupiter unit test support.
There are still bugs with this, but https://github.com/jrgriffiniii/pulibrary-dspace-cli/commit/d01fa1c0b967431393de9f8d92a9035f9cadba9b is advancing to the point where DSpace installations are used for unit and integration tests (this is a pattern offered by DSpace core).
I'm still encountering bugs with the build for this, and this relates to a Maven configuration settings which is preventing DSpace configuration options from being parsed in https://github.com/DSpace/DSpace/blob/dspace-5.3/dspace-api/src/main/java/org/dspace/core/ConfigurationManager.java#L136
This is available as a system-level property, so I am uncertain why this is still failing:
main[1] dump java.lang.System.getProperty("dspace.dir")
java.lang.System.getProperty("dspace.dir") = "/Users/griffinj/src/github.com/jrgriffiniii/pulibrary-dspace-cli/target/testing/dspace/"
main[1] dump org.dspace.core.ConfigurationManager.getProperty("dspace.dir")
org.dspace.core.ConfigurationManager.getProperty("dspace.dir") = ""
https://github.com/jrgriffiniii/pulibrary-dspace-cli/commit/94e86439600e94d5c13a11be06af1761213dc982 gets tests running, but in the name, I've disabled H2 database seeding (there are problems with the database that do not work well with the jdb
debugger).
https://github.com/jrgriffiniii/pulibrary-dspace-cli/commit/740cc7d0d9f6286c07040feb11e93514c4f19c18 should provide an initial testing environment, along with support for CircleCI (https://app.circleci.com/pipelines/github/jrgriffiniii/pulibrary-dspace-cli/3/workflows/01e9db5f-1943-42ad-b305-2c6ae6b534c3/jobs/3).
Trying to built in custom tests atop of the existing test harness architecture is a considerable effort, and this seems to be very difficult for me to understand. Following https://github.com/DSpace/DSpace/blob/dspace-5.3/dspace-api/pom.xml#L12 does seem to work for existing DSpace unit tests, but some underlying configuration prevents me from adding any more for the surefire
testing plugin.
https://github.com/DSpace/dspace-replicate/blob/master/src/test/java/org/dspace/TestDSpaceKernelImpl.java seems to be the only pattern which I could investigate for testing using core DSpace Classes. Beyond this pattern, I am not certain what could be supported.
I have rewritten a solution for this at the following: https://github.com/jrgriffiniii/dspace-example-modules.
It does work consistently between my local environment and CircleCI, and requires far less overhead for testing.
https://github.com/jrgriffiniii/dspace-example-modules/tree/issues-4-jrgriffiniii-dspace-build structures Ant build tasks for deploying the WAR on a DSpace host.
https://github.com/jrgriffiniii/dspace-example-modules/pull/5 was tested against a base DSpace 5.3 installation.
https://github.com/jrgriffiniii/pulibrary-dspace-modules has been created for supporting migrated DSpace Modules.
@kmcelwee found https://github.com/PrincetonUniversityLibrary/dspace-api-pu/commit/acf2b276bf0921846295e781314507b0edb88b41, which showcases some progress which Monika was making in the extension of the Mailer CLI task.
This needs to be updated in priority following a meeting on 12/16/20, and the dspace-cli with the Scholarly Communications Librarian. They shall provide the body for the e-mail being sent in response to submissions and releases.
One should be able to support asynchronous listening with the following PostgreSQL statements:
NOTIFY workflowitem_transaction;
CREATE TRIGGER "on_workflowitem_transaction"
AFTER INSERT OR DELETE OR UPDATE
ON public.workflowitem
FOR EACH ROW
NOTIFY workflowitem_transaction, json_build_object('table', TG_TABLE_NAME, 'action', TG_OP, 'old_data', OLD, 'new_data', NEW);
A client would the subscribe using the following:
LISTEN workflowitem_transaction;
Listening for these updates can be supported in Ruby using https://github.com/ged/ruby-pg/blob/master/spec/pg/connection_spec.rb#L477
Implementing a new daemon process for systemd
should involve the following:
$stdout.reopen('/var/log/dspace-listener.log', 'a')
$stdout.sync = true
loop.with_index do |_, i|
# ...
sleep(3)
end
For the systemd
service file:
[Unit]
Description=DSpace JRuby Event Listener
[Service]
User=username
Group=username
WorkingDirectory=/home/username
Restart=always
ExecStart=/usr/bin/ruby dspace_listener.rb
$ systemctl start dspace-listener
# ...
$ systemctl status dspace-listener
● dspace-listener.service - DSpace JRuby Event Listener
E-mails should be generated with department-specific templated text for e-mail messages sent from
sendmail
when items are synchronized into the OAR from Symplectic Elements.As it cannot be determined precisely what kind of functionality could be sustainably implemented in order to fulfill the acceptance criteria for this request, this is considered to be a spike. Please see https://medium.com/@anca_51481/how-spikes-help-to-improve-your-agile-product-delivery-a0f104305911 for an explanation of the usage of this term.