Skip to content

Commit

Permalink
chore: remove unused messaging implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
Muchogoc committed Aug 26, 2021
1 parent 57a445c commit cc159a3
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 136 deletions.
6 changes: 0 additions & 6 deletions go.sum
Expand Up @@ -117,10 +117,8 @@ github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcju
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down Expand Up @@ -364,9 +362,7 @@ github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
github.com/rs/xid v1.3.0 h1:6NjYksEUlhurdVehpc7S7dk6DAmcKv8V9gG0FsVN2U4=
github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/savannahghi/converterandformatter v0.0.3/go.mod h1:0o7yieYU10WabPqKuqj+5QL52eTL1eGElxjb+A68bbA=
Expand Down Expand Up @@ -415,7 +411,6 @@ github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNX
github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ=
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/shurcooL/vfsgen v0.0.0-20180121065927-ffb13db8def0/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
Expand Down Expand Up @@ -449,7 +444,6 @@ github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGr
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/urfave/cli/v2 v2.1.1 h1:Qt8FeAtxE/vfdrLmR3rxR6JRE0RoVmbXu8+6kZtYU4k=
github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ=
github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
Expand Down
Expand Up @@ -35,7 +35,6 @@ import (

"github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/engagement"

"github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/messaging"
pubsubmessaging "github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/pubsub"
"github.com/savannahghi/onboarding/pkg/onboarding/presentation/interactor"
"github.com/savannahghi/onboarding/pkg/onboarding/usecases"
Expand Down Expand Up @@ -151,10 +150,9 @@ func InitializeTestService(ctx context.Context) (*interactor.Interactor, error)
if err != nil {
return nil, fmt.Errorf("unable to initialize new pubsub messaging service: %w", err)
}
mes := messaging.NewServiceMessagingImpl(ext)
pinExt := extension.NewPINExtensionImpl()
profile := usecases.NewProfileUseCase(fr, ext, engage, ps)
supplier := usecases.NewSupplierUseCases(fr, profile, engage, mes, ext, ps)
supplier := usecases.NewSupplierUseCases(fr, profile, engage, ext, ps)
login := usecases.NewLoginUseCases(fr, profile, ext, pinExt)
survey := usecases.NewSurveyUseCases(fr, ext)
userpin := usecases.NewUserPinUseCase(fr, profile, ext, pinExt, engage)
Expand Down

This file was deleted.

66 changes: 0 additions & 66 deletions pkg/onboarding/infrastructure/services/messaging/service.go

This file was deleted.

6 changes: 2 additions & 4 deletions pkg/onboarding/presentation/config.go
Expand Up @@ -19,7 +19,6 @@ import (
"github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/database/fb"
"github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/engagement"

"github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/messaging"
pubsubmessaging "github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/pubsub"
"github.com/savannahghi/onboarding/pkg/onboarding/repository"
"github.com/savannahghi/onboarding/pkg/onboarding/usecases"
Expand Down Expand Up @@ -104,7 +103,6 @@ func Router(ctx context.Context) (*mux.Router, error) {

// Initialize new instance of our infrastructure services
engage := engagement.NewServiceEngagementImpl(engagementClient, baseExt)
mes := messaging.NewServiceMessagingImpl(baseExt)
pinExt := extension.NewPINExtensionImpl()

pubSub, err := pubsubmessaging.NewServicePubSubMessaging(
Expand All @@ -118,7 +116,7 @@ func Router(ctx context.Context) (*mux.Router, error) {

// Initialize the usecases
profile := usecases.NewProfileUseCase(repo, baseExt, engage, pubSub)
supplier := usecases.NewSupplierUseCases(repo, profile, engage, mes, baseExt, pubSub)
supplier := usecases.NewSupplierUseCases(repo, profile, engage, baseExt, pubSub)
login := usecases.NewLoginUseCases(repo, profile, baseExt, pinExt)
survey := usecases.NewSurveyUseCases(repo, baseExt)
userpin := usecases.NewUserPinUseCase(repo, profile, baseExt, pinExt, engage)
Expand All @@ -129,7 +127,7 @@ func Router(ctx context.Context) (*mux.Router, error) {

i, err := interactor.NewOnboardingInteractor(
profile, su, supplier, login, survey,
userpin, engage, mes, nhif, pubSub,
userpin, engage, nhif, pubSub,
adminSrv, role,
)
if err != nil {
Expand Down
4 changes: 0 additions & 4 deletions pkg/onboarding/presentation/interactor/interactor.go
Expand Up @@ -5,7 +5,6 @@ package interactor
import (
"github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/engagement"

"github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/messaging"
pubsubmessaging "github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/pubsub"
"github.com/savannahghi/onboarding/pkg/onboarding/usecases"
"github.com/savannahghi/onboarding/pkg/onboarding/usecases/admin"
Expand All @@ -20,7 +19,6 @@ type Interactor struct {
Survey usecases.SurveyUseCases
UserPIN usecases.UserPINUseCases
Engagement engagement.ServiceEngagement
Messaging messaging.ServiceMessaging
NHIF usecases.NHIFUseCases
PubSub pubsubmessaging.ServicePubSub
AdminSrv admin.Usecase
Expand All @@ -36,7 +34,6 @@ func NewOnboardingInteractor(
survey usecases.SurveyUseCases,
userpin usecases.UserPINUseCases,
engage engagement.ServiceEngagement,
mes messaging.ServiceMessaging,
nhif usecases.NHIFUseCases,
pubsub pubsubmessaging.ServicePubSub,
admin admin.Usecase,
Expand All @@ -51,7 +48,6 @@ func NewOnboardingInteractor(
Survey: survey,
UserPIN: userpin,
Engagement: engage,
Messaging: mes,
NHIF: nhif,
PubSub: pubsub,
AdminSrv: admin,
Expand Down
7 changes: 2 additions & 5 deletions pkg/onboarding/presentation/rest/handlers_test.go
Expand Up @@ -24,8 +24,6 @@ import (
"github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/engagement"
engagementMock "github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/engagement/mock"

"github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/messaging"
messagingMock "github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/messaging/mock"
pubsubmessaging "github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/pubsub"
pubsubmessagingMock "github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/pubsub/mock"
"github.com/savannahghi/onboarding/pkg/onboarding/presentation/interactor"
Expand All @@ -47,7 +45,6 @@ var fakePubSub pubsubmessagingMock.FakeServicePubSub
func InitializeFakeOnboardingInteractor() (*interactor.Interactor, error) {
var r repository.OnboardingRepository = &fakeRepo
var engagementSvc engagement.ServiceEngagement = &fakeEngagementSvs
var messagingSvc messaging.ServiceMessaging = &messagingMock.FakeServiceMessaging{}
var ext extension.BaseExtension = &fakeBaseExt
var pinExt extension.PINExtension = &fakePinExt
var ps pubsubmessaging.ServicePubSub = &fakePubSub
Expand All @@ -56,7 +53,7 @@ func InitializeFakeOnboardingInteractor() (*interactor.Interactor, error) {
login := usecases.NewLoginUseCases(r, profile, ext, pinExt)
survey := usecases.NewSurveyUseCases(r, ext)
supplier := usecases.NewSupplierUseCases(
r, profile, engagementSvc, messagingSvc, ext, ps,
r, profile, engagementSvc, ext, ps,
)
userpin := usecases.NewUserPinUseCase(r, profile, ext, pinExt, engagementSvc)
su := usecases.NewSignUpUseCases(r, profile, userpin, supplier, ext, engagementSvc, ps)
Expand All @@ -68,7 +65,7 @@ func InitializeFakeOnboardingInteractor() (*interactor.Interactor, error) {
i, err := interactor.NewOnboardingInteractor(
profile, su, supplier, login,
survey, userpin,
engagementSvc, messagingSvc, nhif, ps, adminSrv,
engagementSvc, nhif, ps, adminSrv,
role,
)
if err != nil {
Expand Down
12 changes: 3 additions & 9 deletions pkg/onboarding/usecases/login_test.go
Expand Up @@ -29,16 +29,13 @@ import (

"github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/engagement"

"github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/messaging"

"github.com/savannahghi/onboarding/pkg/onboarding/application/extension"

mockRepo "github.com/savannahghi/onboarding/pkg/onboarding/repository/mock"

extMock "github.com/savannahghi/onboarding/pkg/onboarding/application/extension/mock"
engagementMock "github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/engagement/mock"

messagingMock "github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/messaging/mock"
pubsubmessaging "github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/pubsub"
pubsubmessagingMock "github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/pubsub/mock"
adminSrv "github.com/savannahghi/onboarding/pkg/onboarding/usecases/admin"
Expand Down Expand Up @@ -188,11 +185,10 @@ func InitializeTestService(ctx context.Context) (*interactor.Interactor, error)
if err != nil {
return nil, fmt.Errorf("unable to initialize new pubsub messaging service: %w", err)
}
mes := messaging.NewServiceMessagingImpl(ext)
pinExt := extension.NewPINExtensionImpl()
profile := usecases.NewProfileUseCase(repo, ext, engage, ps)

supplier := usecases.NewSupplierUseCases(repo, profile, engage, mes, ext, ps)
supplier := usecases.NewSupplierUseCases(repo, profile, engage, ext, ps)
login := usecases.NewLoginUseCases(repo, profile, ext, pinExt)
survey := usecases.NewSurveyUseCases(repo, ext)
userpin := usecases.NewUserPinUseCase(repo, profile, ext, pinExt, engage)
Expand Down Expand Up @@ -412,14 +408,12 @@ var fakeRepo mockRepo.FakeOnboardingRepository
var fakeBaseExt extMock.FakeBaseExtensionImpl
var fakePinExt extMock.PINExtensionImpl
var fakeEngagementSvs engagementMock.FakeServiceEngagement
var fakeMessagingSvc messagingMock.FakeServiceMessaging
var fakePubSub pubsubmessagingMock.FakeServicePubSub

// InitializeFakeOnboaridingInteractor represents a fakeonboarding interactor
func InitializeFakeOnboardingInteractor() (*interactor.Interactor, error) {
var r repository.OnboardingRepository = &fakeRepo
var engagementSvc engagement.ServiceEngagement = &fakeEngagementSvs
var messagingSvc messaging.ServiceMessaging = &fakeMessagingSvc
var ext extension.BaseExtension = &fakeBaseExt
var pinExt extension.PINExtension = &fakePinExt
var ps pubsubmessaging.ServicePubSub = &fakePubSub
Expand All @@ -428,7 +422,7 @@ func InitializeFakeOnboardingInteractor() (*interactor.Interactor, error) {
login := usecases.NewLoginUseCases(r, profile, ext, pinExt)
survey := usecases.NewSurveyUseCases(r, ext)
supplier := usecases.NewSupplierUseCases(
r, profile, engagementSvc, messagingSvc, ext, ps,
r, profile, engagementSvc, ext, ps,
)
userpin := usecases.NewUserPinUseCase(r, profile, ext, pinExt, engagementSvc)
su := usecases.NewSignUpUseCases(r, profile, userpin, supplier, ext, engagementSvc, ps)
Expand All @@ -439,7 +433,7 @@ func InitializeFakeOnboardingInteractor() (*interactor.Interactor, error) {
i, err := interactor.NewOnboardingInteractor(
profile, su, supplier, login,
survey, userpin,
engagementSvc, messagingSvc, nhif, ps,
engagementSvc, nhif, ps,
adminSrv, role,
)
if err != nil {
Expand Down
4 changes: 0 additions & 4 deletions pkg/onboarding/usecases/supplier.go
Expand Up @@ -28,7 +28,6 @@ import (
"github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/engagement"
"github.com/savannahghi/onboarding/pkg/onboarding/repository"

"github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/messaging"
pubsubmessaging "github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/pubsub"
)

Expand Down Expand Up @@ -159,7 +158,6 @@ type SupplierUseCasesImpl struct {
repo repository.OnboardingRepository
profile ProfileUseCase
engagement engagement.ServiceEngagement
messaging messaging.ServiceMessaging
baseExt extension.BaseExtension
pubsub pubsubmessaging.ServicePubSub
}
Expand All @@ -169,7 +167,6 @@ func NewSupplierUseCases(
r repository.OnboardingRepository,
p ProfileUseCase,
eng engagement.ServiceEngagement,
messaging messaging.ServiceMessaging,
ext extension.BaseExtension,
pubsub pubsubmessaging.ServicePubSub,
) SupplierUseCases {
Expand All @@ -178,7 +175,6 @@ func NewSupplierUseCases(
repo: r,
profile: p,
engagement: eng,
messaging: messaging,
baseExt: ext,
pubsub: pubsub,
}
Expand Down
3 changes: 0 additions & 3 deletions pkg/onboarding/usecases/supplier_internal_test.go
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/database/fb"
"github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/engagement"

"github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/messaging"
pubsubmessaging "github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/pubsub"
)

Expand Down Expand Up @@ -78,14 +77,12 @@ func TestParseKYCAsMap(t *testing.T) {
t.Errorf("unable to initialize new pubsub messaging service: %w", err)
return
}
mes := messaging.NewServiceMessagingImpl(ext)
profile := NewProfileUseCase(repo, ext, engage, ps)

supplier := SupplierUseCasesImpl{
repo: repo,
profile: profile,
engagement: engage,
messaging: mes,
}

tests := []struct {
Expand Down
4 changes: 1 addition & 3 deletions tests/config_test.go
Expand Up @@ -31,7 +31,6 @@ import (
"github.com/savannahghi/serverutils"
"github.com/sirupsen/logrus"

"github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/messaging"
pubsubmessaging "github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/pubsub"
"github.com/savannahghi/onboarding/pkg/onboarding/presentation"
"github.com/savannahghi/onboarding/pkg/onboarding/repository"
Expand Down Expand Up @@ -123,11 +122,10 @@ func InitializeTestService(ctx context.Context) (*interactor.Interactor, error)
if err != nil {
return nil, fmt.Errorf("unable to initialize new pubsub messaging service: %w", err)
}
mes := messaging.NewServiceMessagingImpl(ext)
pinExt := extension.NewPINExtensionImpl()
profile := usecases.NewProfileUseCase(repo, ext, engage, ps)

supplier := usecases.NewSupplierUseCases(repo, profile, engage, mes, ext, ps)
supplier := usecases.NewSupplierUseCases(repo, profile, engage, ext, ps)
login := usecases.NewLoginUseCases(repo, profile, ext, pinExt)
survey := usecases.NewSurveyUseCases(repo, ext)
userpin := usecases.NewUserPinUseCase(repo, profile, ext, pinExt, engage)
Expand Down

0 comments on commit cc159a3

Please sign in to comment.