Skip to content

Commit

Permalink
work
Browse files Browse the repository at this point in the history
  • Loading branch information
mcantelon committed May 14, 2024
1 parent 21ef7eb commit de9647e
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/worker/workercmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
)

Check warning on line 76 in cmd/worker/workercmd/cmd.go

View check run for this annotation

Codecov / codecov/patch

cmd/worker/workercmd/cmd.go#L73-L76

Added lines #L73 - L76 were not covered by tests
w.RegisterActivityWithOptions(
activities.NewSipCreationActivity().Execute,
temporalsdk_activity.RegisterOptions{Name: activities.SipCreationName},
Expand Down
30 changes: 30 additions & 0 deletions internal/activities/combine_premis.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package activities

import (
"context"
)

const CombinePremisName = "combine-premis"

type CombinePremisActivity struct{}

func NewCombinePremisActivity() *CombinePremisActivity {
return &CombinePremisActivity{}

Check warning on line 12 in internal/activities/combine_premis.go

View check run for this annotation

Codecov / codecov/patch

internal/activities/combine_premis.go#L11-L12

Added lines #L11 - L12 were not covered by tests
}

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

Check warning on line 29 in internal/activities/combine_premis.go

View check run for this annotation

Codecov / codecov/patch

internal/activities/combine_premis.go#L26-L29

Added lines #L26 - L29 were not covered by tests
}
10 changes: 10 additions & 0 deletions internal/workflow/preprocessing.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check warning on line 112 in internal/workflow/preprocessing.go

View check run for this annotation

Codecov / codecov/patch

internal/workflow/preprocessing.go#L112

Added line #L112 was not covered by tests
}

// Repackage SFA SIP into a Bag.
var sipCreation activities.SipCreationResult
e = temporalsdk_workflow.ExecuteActivity(withLocalActOpts(ctx), activities.SipCreationName, &activities.SipCreationParams{
Expand Down
11 changes: 11 additions & 0 deletions internal/workflow/preprocessing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit de9647e

Please sign in to comment.