Skip to content

feat: implement StreamService class - #32

Merged
y-lakhdar merged 19 commits into
mainfrom
LEN-838
May 31, 2023
Merged

y-lakhdar merged 19 commits into
mainfrom
LEN-838

Conversation

@y-lakhdar

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

Copy link
Copy Markdown
Contributor

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

github-actions Bot commented May 25, 2023

Copy link
Copy Markdown

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 <54454747+btaillon@users.noreply.github.com>

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
Comment thread src/main/java/com/coveo/pushapiclient/StreamService.java Outdated
Comment thread pom.xml Outdated
Comment thread src/main/java/com/coveo/pushapiclient/StreamService.java Outdated
Comment thread src/main/java/com/coveo/pushapiclient/StreamService.java Outdated
Comment thread src/main/java/com/coveo/pushapiclient/StreamService.java Outdated
Comment thread src/main/java/com/coveo/pushapiclient/StreamService.java Outdated
Comment thread src/main/java/com/coveo/pushapiclient/StreamService.java Outdated
Comment thread src/main/java/com/coveo/pushapiclient/StreamService.java Outdated
Comment thread src/main/java/com/coveo/pushapiclient/StreamService.java Outdated
y-lakhdar and others added 6 commits May 26, 2023 08:30
Co-authored-by: Benjamin Taillon <54454747+btaillon@users.noreply.github.com>
Co-authored-by: jpmarceau <39384459+jpmarceau@users.noreply.github.com>
Co-authored-by: jpmarceau <39384459+jpmarceau@users.noreply.github.com>
Comment thread .github/workflows/build.yml
Comment thread src/main/java/com/coveo/pushapiclient/DocumentUploadQueue.java Outdated
Comment thread src/main/java/com/coveo/pushapiclient/PlatformClient.java
Comment thread src/main/java/com/coveo/pushapiclient/PlatformClient.java
Comment thread src/main/java/com/coveo/pushapiclient/PlatformClient.java
@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.

5 participants