From b516079fc3bf6dbcca24f1edf6929dfec32f91f2 Mon Sep 17 00:00:00 2001 From: Mike Cantelon Date: Sat, 16 Nov 2024 21:17:11 -0800 Subject: [PATCH] Add PREMIS creation preservation task (#73) [skip codecov] --- internal/workflow/preprocessing.go | 6 +++++- internal/workflow/preprocessing_test.go | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/internal/workflow/preprocessing.go b/internal/workflow/preprocessing.go index 91bd752e..c84ea50a 100644 --- a/internal/workflow/preprocessing.go +++ b/internal/workflow/preprocessing.go @@ -230,8 +230,12 @@ func (w *PreprocessingWorkflow) Execute( return result, nil } + // Write PREMIS XML. + ev = result.newEvent(ctx, "Create premis.xml") if e = writePREMISFile(ctx, identifySIP.SIP); e != nil { - return nil, e + result.systemError(ctx, e, ev, "premis.xml creation has failed") + } else { + ev.Succeed(ctx, "Created a premis.xml and stored in metadata directory") } // Re-structure SIP. diff --git a/internal/workflow/preprocessing_test.go b/internal/workflow/preprocessing_test.go index b5f3435e..05d320be 100644 --- a/internal/workflow/preprocessing_test.go +++ b/internal/workflow/preprocessing_test.go @@ -414,6 +414,13 @@ func (s *PreprocessingTestSuite) TestPreprocessingWorkflowSuccess() { StartedAt: testTime, CompletedAt: testTime, }, + { + Name: "Create premis.xml", + Message: "Created a premis.xml and stored in metadata directory", + Outcome: enums.EventOutcomeSuccess, + StartedAt: testTime, + CompletedAt: testTime, + }, { Name: "Restructure SIP", Message: "SIP has been restructured",