Skip to content

Conversation

@y-lakhdar
Copy link
Contributor

@y-lakhdar y-lakhdar commented May 25, 2023

Proposed change

Implement the StreamService class, which is responsible of uploading documents into the source using the "Stream mode" (aka full source rebuild).

Testing

### TL;dr
I also added new dependencies (org.powermock) to be able to test classes without having to do dependency injection.

### Full explanation:
StreamService class depends on 2 other classes:

  1. DocumentUploadQueue
  2. PlatformClient

Ideally, these 2 classes would have to be injected to into StreamService during its initialization to facilitate testing:

public StreamService(StreamEnabledSource source, DocumentUploadQueue queue, PlatformClient client) {
    // ...
}

However, this would lead to bad user experience as the user would have to manually instantiate both objects before using the StreamService. PowerMock allows to mock objects instantiated within the StreamService class.

I also had to downgrade Mockito so it can properly work with PowerMockito

Edit

Created an internal class StreamServiceInternal to facilitate unit testing.

@y-lakhdar y-lakhdar requested review from a team, btaillon-coveo, hdhayneCoveo, mrrajamanickam-coveo and olamothe and removed request for a team May 25, 2023 18:32
@github-actions
Copy link

github-actions bot commented May 25, 2023

Dependency Review

✅ No vulnerabilities or license issues found.

Scanned Manifest Files

Update src/main/java/com/coveo/pushapiclient/ApiUrl.java

Co-authored-by: Benjamin Taillon <[email protected]>

add new getter to source classes

feat: create `PushSource` and `catalogSource` classes (#30)

https://coveord.atlassian.net/browse/LENS-839

update StreamService

add platformClient tests

add PowerMockito dependencies

remove unused import

remove unecessary method

downgrade build to Java 11

revert codeql deletion

lint

lint
@y-lakhdar y-lakhdar marked this pull request as draft May 25, 2023 18:50
@y-lakhdar y-lakhdar marked this pull request as ready for review May 25, 2023 18:52
@y-lakhdar y-lakhdar requested a review from jpmarceau May 25, 2023 18:53
@y-lakhdar y-lakhdar enabled auto-merge (squash) May 31, 2023 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants