-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- This converts `CloneAndProcessDirectoryAction`, `GitRepositoryProcessor`, and `CloneResult` into classes/interfaces. - Additionally, `fetch()` now returns a `Flux<TestSuiteValidationResult>` instead of `Mono<Unit>`. - Related: #1096
- Loading branch information
1 parent
2fa8b61
commit 4df2a8c
Showing
7 changed files
with
270 additions
and
91 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
...rc/main/kotlin/com/saveourtool/save/preprocessor/common/CloneAndProcessDirectoryAction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.saveourtool.save.preprocessor.common | ||
|
||
import com.saveourtool.save.entities.GitDto | ||
import com.saveourtool.save.preprocessor.service.GitPreprocessorService | ||
import org.reactivestreams.Publisher | ||
|
||
/** | ||
* Uses [GitPreprocessorService] to clone and process a repository. | ||
*/ | ||
fun interface CloneAndProcessDirectoryAction<T : Publisher<*>> { | ||
/** | ||
* Clones and processes a repository identified by [gitDto]. | ||
* | ||
* @param gitDto the _Git_ URL along with optional credentials. | ||
* @param branchOrTagOrCommit either a branch name, or a tag name, or a | ||
* commit hash. | ||
* @param repositoryProcessor the custom process action. | ||
* @return a custom [Publisher] returned by [repositoryProcessor]. | ||
*/ | ||
fun GitPreprocessorService.cloneAndProcessDirectoryAsync( | ||
gitDto: GitDto, | ||
branchOrTagOrCommit: String, | ||
repositoryProcessor: GitRepositoryProcessor<T>, | ||
): T | ||
} |
15 changes: 15 additions & 0 deletions
15
save-preprocessor/src/main/kotlin/com/saveourtool/save/preprocessor/common/CloneResult.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.saveourtool.save.preprocessor.common | ||
|
||
import com.saveourtool.save.preprocessor.utils.GitCommitInfo | ||
import java.nio.file.Path | ||
|
||
/** | ||
* The result of running `git clone`. | ||
* | ||
* @property directory the local directory the repository has been cloned into. | ||
* @property gitCommitInfo the _Git_ commit metadata. | ||
*/ | ||
data class CloneResult( | ||
val directory: Path, | ||
val gitCommitInfo: GitCommitInfo, | ||
) |
16 changes: 16 additions & 0 deletions
16
...cessor/src/main/kotlin/com/saveourtool/save/preprocessor/common/GitRepositoryProcessor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.saveourtool.save.preprocessor.common | ||
|
||
import org.reactivestreams.Publisher | ||
|
||
/** | ||
* Asynchronously processes a local _Git_ repository. | ||
*/ | ||
fun interface GitRepositoryProcessor<T : Publisher<*>> { | ||
/** | ||
* Processes the cloned _Git_ repository, returning a `Mono` or a `Flux`. | ||
* | ||
* @param cloneResult the local directory along with _Git_ metadata. | ||
* @return the result of the processing as a custom [Publisher]. | ||
*/ | ||
fun processAsync(cloneResult: CloneResult): T | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.