Skip to content

Commit

Permalink
refactor: move resource into it's own domain
Browse files Browse the repository at this point in the history
Resource domain methods are generally used idependently of an
application thus can be move it an individual domain.
  • Loading branch information
hmlanigan committed Dec 3, 2024
1 parent 005f371 commit a3f51b9
Show file tree
Hide file tree
Showing 19 changed files with 745 additions and 596 deletions.
16 changes: 0 additions & 16 deletions domain/application/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,22 +132,6 @@ const (
// is found, an error is returned.
MultipleCharmHashes = errors.ConstError("multiple charm hashes found")

// ResourceNotFound describes an error that occurs when a resource is
// not found.
ResourceNotFound = errors.ConstError("resource not found")

// UnknownResourceType describes an error where the resource type is
// not oci-image or file.
UnknownResourceType = errors.ConstError("unknown resource type")

// UnknownRetrievedByType describes an error where the retrieved by type is
// neither user, unit nor application.
UnknownRetrievedByType = errors.ConstError("unknown retrieved by type")

// ResourceNameNotValid describes an error where the resource name is not
// valid, usually because it's empty.
ResourceNameNotValid = errors.ConstError("resource name not valid")

// AlreadyDownloadingCharm describes an error that occurs when a charm is
// already being downloaded.
AlreadyDownloadingCharm = errors.ConstError("already downloading charm")
Expand Down
5 changes: 0 additions & 5 deletions domain/application/service/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import (
storageerrors "github.com/juju/juju/domain/storage/errors"
domaintesting "github.com/juju/juju/domain/testing"
"github.com/juju/juju/internal/charm"
charmresource "github.com/juju/juju/internal/charm/resource"
"github.com/juju/juju/internal/errors"
loggertesting "github.com/juju/juju/internal/logger/testing"
"github.com/juju/juju/internal/storage"
Expand Down Expand Up @@ -1226,17 +1225,13 @@ func (s *applicationWatcherServiceSuite) setupMocks(c *gc.C) *gomock.Controller
}
})

resourceStoreGetter := NewMockResourceStoreGetter(ctrl)
resourceStoreGetter.EXPECT().AddStore(charmresource.TypeContainerImage, gomock.Any())

modelUUID := modeltesting.GenModelUUID(c)

s.clock = testclock.NewClock(time.Time{})
s.service = NewWatchableService(
s.state,
s.secret,
registry,
resourceStoreGetter,
modelUUID,
s.watcherFactory,
nil,
Expand Down
Loading

0 comments on commit a3f51b9

Please sign in to comment.