diff --git a/src/internal/connector/exchange/exchange_data_collection.go b/src/internal/connector/exchange/exchange_data_collection.go index 2f1769de3..0d9f285df 100644 --- a/src/internal/connector/exchange/exchange_data_collection.go +++ b/src/internal/connector/exchange/exchange_data_collection.go @@ -35,8 +35,8 @@ const ( // It implements the DataCollection interface type Collection struct { // M365 user - User string // M365 user - Data chan data.Stream + user string // M365 user + data chan data.Stream // FullPath is the slice representation of the action context passed down through the hierarchy. //The original request can be gleaned from the slice. (e.g. {, , "emails"}) @@ -46,22 +46,22 @@ type Collection struct { // NewExchangeDataCollection creates an ExchangeDataCollection with fullPath is annotated func NewCollection(aUser string, pathRepresentation []string) Collection { collection := Collection{ - User: aUser, - Data: make(chan data.Stream, collectionChannelBufferSize), + user: aUser, + data: make(chan data.Stream, collectionChannelBufferSize), fullPath: pathRepresentation, } return collection } func (eoc *Collection) PopulateCollection(newData *Stream) { - eoc.Data <- newData + eoc.data <- newData } // FinishPopulation is used to indicate data population of the collection is complete // TODO: This should be an internal method once we move the message retrieval logic into `ExchangeDataCollection` func (eoc *Collection) FinishPopulation() { - if eoc.Data != nil { - close(eoc.Data) + if eoc.data != nil { + close(eoc.data) } } @@ -90,16 +90,16 @@ func PopulateFromTaskList( } for _, task := range tasks { - response, err := service.Client().UsersById(edc.User).MessagesById(task).Get() + response, err := service.Client().UsersById(edc.user).MessagesById(task).Get() if err != nil { details := support.ConnectorStackErrorTrace(err) - errs = support.WrapAndAppend(edc.User, errors.Wrapf(err, "unable to retrieve %s, %s", task, details), errs) + errs = support.WrapAndAppend(edc.user, errors.Wrapf(err, "unable to retrieve %s, %s", task, details), errs) continue } - err = messageToDataCollection(service.Client(), ctx, objectWriter, edc.Data, response, edc.User) + err = messageToDataCollection(service.Client(), ctx, objectWriter, edc.data, response, edc.user) success++ if err != nil { - errs = support.WrapAndAppendf(edc.User, err, errs) + errs = support.WrapAndAppendf(edc.user, err, errs) success-- } if errs != nil && service.ErrPolicy() { @@ -170,7 +170,7 @@ func messageToDataCollection( } func (eoc *Collection) Items() <-chan data.Stream { - return eoc.Data + return eoc.data } func (edc *Collection) FullPath() []string { diff --git a/src/internal/connector/exchange/exchange_data_collection_test.go b/src/internal/connector/exchange/exchange_data_collection_test.go index ed423e3c2..5d3f90a3c 100644 --- a/src/internal/connector/exchange/exchange_data_collection_test.go +++ b/src/internal/connector/exchange/exchange_data_collection_test.go @@ -57,7 +57,7 @@ func (suite *ExchangeDataCollectionSuite) TestExchangeData_FullPath() { func (suite *ExchangeDataCollectionSuite) TestExchangeDataCollection_NewExchangeDataCollection() { name := "User" edc := NewCollection(name, []string{"Directory", "File", "task"}) - suite.Equal(name, edc.User) + suite.Equal(name, edc.user) suite.True(contains(edc.FullPath(), "Directory")) suite.True(contains(edc.FullPath(), "File")) suite.True(contains(edc.FullPath(), "task")) @@ -71,7 +71,7 @@ func (suite *ExchangeDataCollectionSuite) TestExchangeDataCollection_PopulateCol for i := 0; i < expected; i++ { edc.PopulateCollection(&Stream{id: inputStrings[i*2], message: []byte(inputStrings[i*2+1])}) } - suite.Equal(expected, len(edc.Data)) + suite.Equal(expected, len(edc.data)) } func (suite *ExchangeDataCollectionSuite) TestExchangeDataCollection_Items() { @@ -80,10 +80,10 @@ func (suite *ExchangeDataCollectionSuite) TestExchangeDataCollection_Items() { expected := len(inputStrings) / 2 // We are using pairs edc := NewCollection("Fletcher", []string{"sugar", "horses", "painted red"}) for i := 0; i < expected; i++ { - edc.Data <- &Stream{id: inputStrings[i*2], message: []byte(inputStrings[i*2+1])} + edc.data <- &Stream{id: inputStrings[i*2], message: []byte(inputStrings[i*2+1])} } - close(edc.Data) - suite.Equal(expected, len(edc.Data)) + close(edc.data) + suite.Equal(expected, len(edc.data)) streams := edc.Items() suite.Equal(expected, len(streams)) count := 0