Skip to content

Commit

Permalink
Use temporal-activities/archivezip
Browse files Browse the repository at this point in the history
[skip-codecov]
  • Loading branch information
jraddaoui committed Aug 27, 2024
1 parent c1d9c1e commit d54fcc4
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 203 deletions.
7 changes: 3 additions & 4 deletions cmd/enduro-am-worker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"entgo.io/ent/dialect/sql"
bagit_gython "github.com/artefactual-labs/bagit-gython"
"github.com/artefactual-sdps/temporal-activities/archiveextract"
"github.com/artefactual-sdps/temporal-activities/archivezip"
"github.com/artefactual-sdps/temporal-activities/bagcreate"
"github.com/artefactual-sdps/temporal-activities/bagvalidate"
"github.com/artefactual-sdps/temporal-activities/removepaths"
Expand Down Expand Up @@ -251,10 +252,8 @@ func main() {
temporalsdk_activity.RegisterOptions{Name: bagcreate.Name},
)
w.RegisterActivityWithOptions(
activities.NewZipActivity(
logger,
).Execute,
temporalsdk_activity.RegisterOptions{Name: activities.ZipActivityName},
archivezip.New().Execute,
temporalsdk_activity.RegisterOptions{Name: archivezip.Name},
)
w.RegisterActivityWithOptions(
am.NewUploadTransferActivity(logger, sftpClient, cfg.AM.PollInterval).Execute,
Expand Down
98 changes: 0 additions & 98 deletions internal/workflow/activities/zip.go

This file was deleted.

93 changes: 0 additions & 93 deletions internal/workflow/activities/zip_test.go

This file was deleted.

7 changes: 4 additions & 3 deletions internal/workflow/processing.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"time"

"github.com/artefactual-sdps/temporal-activities/archiveextract"
"github.com/artefactual-sdps/temporal-activities/archivezip"
"github.com/artefactual-sdps/temporal-activities/bagcreate"
"github.com/artefactual-sdps/temporal-activities/bagvalidate"
"github.com/artefactual-sdps/temporal-activities/removepaths"
Expand Down Expand Up @@ -859,11 +860,11 @@ func (w *ProcessingWorkflow) transferAM(ctx temporalsdk_workflow.Context, tinfo

// Zip PIP.
activityOpts := withActivityOptsForLocalAction(ctx)
var zipResult activities.ZipActivityResult
var zipResult archivezip.Result
err = temporalsdk_workflow.ExecuteActivity(
activityOpts,
activities.ZipActivityName,
&activities.ZipActivityParams{SourceDir: tinfo.TempPath},
archivezip.Name,
&archivezip.Params{SourceDir: tinfo.TempPath},
).Get(activityOpts, &zipResult)
if err != nil {
return err
Expand Down
11 changes: 6 additions & 5 deletions internal/workflow/processing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"time"

"github.com/artefactual-sdps/temporal-activities/archiveextract"
"github.com/artefactual-sdps/temporal-activities/archivezip"
"github.com/artefactual-sdps/temporal-activities/bagcreate"
"github.com/artefactual-sdps/temporal-activities/bagvalidate"
"github.com/artefactual-sdps/temporal-activities/removepaths"
Expand Down Expand Up @@ -159,8 +160,8 @@ func (s *ProcessingWorkflowTestSuite) setupAMWorkflowTest(
temporalsdk_activity.RegisterOptions{Name: bagcreate.Name},
)
s.env.RegisterActivityWithOptions(
activities.NewZipActivity(logger).Execute,
temporalsdk_activity.RegisterOptions{Name: activities.ZipActivityName},
archivezip.New().Execute,
temporalsdk_activity.RegisterOptions{Name: archivezip.Name},
)
s.env.RegisterActivityWithOptions(
am.NewUploadTransferActivity(logger, sftpc, 10*time.Second).Execute,
Expand Down Expand Up @@ -614,10 +615,10 @@ func (s *ProcessingWorkflowTestSuite) TestAMWorkflow() {
&bagcreate.Result{BagPath: extractPath}, nil,
)

s.env.OnActivity(activities.ZipActivityName, sessionCtx,
&activities.ZipActivityParams{SourceDir: extractPath},
s.env.OnActivity(archivezip.Name, sessionCtx,
&archivezip.Params{SourceDir: extractPath},
).Return(
&activities.ZipActivityResult{Path: extractPath + "/transfer.zip"}, nil,
&archivezip.Result{Path: extractPath + "/transfer.zip"}, nil,
)

s.env.OnActivity(am.UploadTransferActivityName, sessionCtx,
Expand Down

0 comments on commit d54fcc4

Please sign in to comment.