diff --git a/cmd/processor/main.go b/cmd/processor/main.go index 05bbd30..abbfd05 100644 --- a/cmd/processor/main.go +++ b/cmd/processor/main.go @@ -56,7 +56,10 @@ func main() { panic(err) } - p, err := processor.NewProcessor(filesClient, sfClient, natsClient, cfg, nil) + salesforceClientFactory := &common.BaseSalesforceClientFactory{} + filesComClientFactory := &common.BaseFilesComClientFactory{} + + p, err := processor.NewProcessor(filesClient, sfClient, filesComClientFactory, salesforceClientFactory, natsClient, cfg, nil) if err != nil { panic(err) } diff --git a/pkg/processor/processor.go b/pkg/processor/processor.go index e23bb4f..91939b8 100644 --- a/pkg/processor/processor.go +++ b/pkg/processor/processor.go @@ -118,7 +118,7 @@ func (runner *ReportRunner) UploadAndSaveReport(report *ReportToExecute, caseNum log.Debugf("Fetching files for path '%s' from db", filePath) result := runner.Db.Where("path = ?", filePath).First(&file) if result.Error != nil { - return fmt.Errorf("File not found with path '%s' in database", filePath) + return fmt.Errorf("file not found with path '%s' in database", filePath) } log.Infof("Fetching case with number '%s' from Salesforce", caseNumber) @@ -363,7 +363,8 @@ func NewBaseSubscriber(filesClient common.FilesComClient, salesforceClient commo AutoAck: false, JSON: true, Deadline: defaultHandlerDeadline, - }, Reports: reports, + }, + Reports: reports, } subscriber.FilesComClient = filesClient @@ -376,6 +377,7 @@ func NewBaseSubscriber(filesClient common.FilesComClient, salesforceClient commo } func NewProcessor(filesClient common.FilesComClient, salesforceClient common.SalesforceClient, + filesComClientFactory common.FilesComClientFactory, salesforceClientFactory common.SalesforceClientFactory, provider pubsub.Provider, cfg *config.Config, dbConn *gorm.DB) (*Processor, error) { var err error if dbConn == nil { diff --git a/pkg/processor/processor_test.go b/pkg/processor/processor_test.go index 45d6a11..f88cbce 100644 --- a/pkg/processor/processor_test.go +++ b/pkg/processor/processor_test.go @@ -52,7 +52,7 @@ func (s *ProcessorTestSuite) TestRunProcessor() { salesforceClient := test.SalesforceClient{} provider := &memory.MemoryProvider{} - processor, _ := NewProcessor(&filesComClient, &salesforceClient, provider, s.config, s.db) + processor, _ := NewProcessor(&filesComClient, &salesforceClient, &test.FilesComClientFactory{}, &test.SalesforceClientFactory{}, provider, s.config, s.db) ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second) defer cancel()