exchange.Collection FinishPopulation function removed (#436)

* removal of FinishPopulation() method.
* graph_connector disconnected from exchange collection internal functions.
This commit is contained in:
Danny 2022-07-28 14:08:35 -04:00 committed by GitHub
parent 4862d5b800
commit 992504ed36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 12 deletions

View File

@ -67,15 +67,6 @@ 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`
// TODO: This will be removed as the channel will be filled from calls from exchange.Collection
func (eoc *Collection) FinishPopulation() {
if eoc.data != nil {
close(eoc.data)
}
}
// NOTE: Refactor has not happened moving into folders // NOTE: Refactor has not happened moving into folders
// populateFromTaskList async call to fill DataCollection via channel implementation // populateFromTaskList async call to fill DataCollection via channel implementation
func PopulateFromTaskList( func PopulateFromTaskList(
@ -117,8 +108,7 @@ func PopulateFromTaskList(
break break
} }
} }
close(edc.data)
edc.FinishPopulation()
attemptedItems += len(tasks) attemptedItems += len(tasks)
} }

View File

@ -76,6 +76,7 @@ func (suite *GraphConnectorIntegrationSuite) TestGraphConnector_ExchangeDataColl
suite.Greater(len(exchangeData.FullPath()), 2) suite.Greater(len(exchangeData.FullPath()), 2)
} }
//TODO add mockdata for this test... Will not pass as is
func (suite *GraphConnectorIntegrationSuite) TestGraphConnector_restoreMessages() { func (suite *GraphConnectorIntegrationSuite) TestGraphConnector_restoreMessages() {
user := "TEST_GRAPH_USER" // user.GetId() user := "TEST_GRAPH_USER" // user.GetId()
file := "TEST_GRAPH_FILE" // Test file should be sent or received by the user file := "TEST_GRAPH_FILE" // Test file should be sent or received by the user
@ -92,7 +93,7 @@ func (suite *GraphConnectorIntegrationSuite) TestGraphConnector_restoreMessages(
edc := exchange.NewCollection("tenant", []string{"tenantId", evs[user], mailCategory, "Inbox"}) edc := exchange.NewCollection("tenant", []string{"tenantId", evs[user], mailCategory, "Inbox"})
edc.PopulateCollection(&ds) edc.PopulateCollection(&ds)
edc.FinishPopulation() //edc.FinishPopulation()
err = suite.connector.RestoreMessages(context.Background(), []data.Collection{&edc}) err = suite.connector.RestoreMessages(context.Background(), []data.Collection{&edc})
assert.NoError(suite.T(), err) assert.NoError(suite.T(), err)
} }