diff --git a/cmd/worker/workercmd/cmd.go b/cmd/worker/workercmd/cmd.go index 2aa2522d..483e0816 100644 --- a/cmd/worker/workercmd/cmd.go +++ b/cmd/worker/workercmd/cmd.go @@ -70,6 +70,10 @@ func (m *Main) Run(ctx context.Context) error { activities.NewMetadataValidationActivity().Execute, temporalsdk_activity.RegisterOptions{Name: activities.MetadataValidationName}, ) + w.RegisterActivityWithOptions( + activities.NewCombinePremisActivity().Execute, + temporalsdk_activity.RegisterOptions{Name: activities.CombinePremisName}, + ) w.RegisterActivityWithOptions( activities.NewSipCreationActivity().Execute, temporalsdk_activity.RegisterOptions{Name: activities.SipCreationName}, diff --git a/internal/activities/combine_premis.go b/internal/activities/combine_premis.go new file mode 100644 index 00000000..6039afb2 --- /dev/null +++ b/internal/activities/combine_premis.go @@ -0,0 +1,30 @@ +package activities + +import ( + "context" +) + +const CombinePremisName = "combine-premis" + +type CombinePremisActivity struct{} + +func NewCombinePremisActivity() *CombinePremisActivity { + return &CombinePremisActivity{} +} + +type CombinePremisParams struct { + SipPath string +} + +type CombinePremisResult struct { + Out string +} + +func (md *CombinePremisActivity) Execute( + ctx context.Context, + params *CombinePremisParams, +) (*CombinePremisResult, error) { + res := &CombinePremisResult{} + res.Out = "OK" + return res, nil +} diff --git a/internal/workflow/preprocessing.go b/internal/workflow/preprocessing.go index 40be3d33..106d2edf 100644 --- a/internal/workflow/preprocessing.go +++ b/internal/workflow/preprocessing.go @@ -102,6 +102,16 @@ func (w *PreprocessingWorkflow) Execute( return nil, e } + // Combine PREMIS files into one. + var combinePremis activities.CombinePremisResult + e = temporalsdk_workflow.ExecuteActivity(withLocalActOpts(ctx), activities.CombinePremisName, &activities.CombinePremisParams{ + SipPath: localPath, + }). + Get(ctx, &combinePremis) + if e != nil { + return nil, e + } + // Repackage SFA SIP into a Bag. var sipCreation activities.SipCreationResult e = temporalsdk_workflow.ExecuteActivity(withLocalActOpts(ctx), activities.SipCreationName, &activities.SipCreationParams{ diff --git a/internal/workflow/preprocessing_test.go b/internal/workflow/preprocessing_test.go index b5cfa17b..3c68f3c0 100644 --- a/internal/workflow/preprocessing_test.go +++ b/internal/workflow/preprocessing_test.go @@ -41,6 +41,10 @@ func (s *PreprocessingTestSuite) SetupTest(cfg config.Configuration) { activities.NewMetadataValidationActivity().Execute, temporalsdk_activity.RegisterOptions{Name: activities.MetadataValidationName}, ) + s.env.RegisterActivityWithOptions( + activities.NewCombinePremisActivity().Execute, + temporalsdk_activity.RegisterOptions{Name: activities.CombinePremisName}, + ) s.env.RegisterActivityWithOptions( activities.NewSipCreationActivity().Execute, temporalsdk_activity.RegisterOptions{Name: activities.SipCreationName}, @@ -91,6 +95,13 @@ func (s *PreprocessingTestSuite) TestExecute() { ).Return( &activities.MetadataValidationResult{}, nil, ) + s.env.OnActivity( + activities.CombinePremisName, + sessionCtx, + &activities.CombinePremisParams{SipPath: sipPath}, + ).Return( + &activities.CombinePremisResult{}, nil, + ) s.env.OnActivity( activities.SipCreationName, sessionCtx,