-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(stages): extraction hellowork (#359)
- Loading branch information
1 parent
8faf728
commit 3ee031d
Showing
16 changed files
with
165 additions
and
7 deletions.
There are no files selected for viewing
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
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
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
13 changes: 13 additions & 0 deletions
13
apps/stages/src/extraction/application-service/extraire-hellowork.usecase.ts
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,13 @@ | ||
import { Usecase } from "@shared/src/application-service/usecase"; | ||
|
||
import { FluxExtraction } from "@stages/src/extraction/domain/model/flux"; | ||
import { ExtraireFluxDomainService } from "@stages/src/extraction/domain/service/extraire-flux.domain-service"; | ||
|
||
export class ExtraireHellowork implements Usecase { | ||
constructor(private readonly extraireFluxDomainService: ExtraireFluxDomainService) { | ||
} | ||
|
||
public executer<T>(flux: Readonly<FluxExtraction>): Promise<void | T> { | ||
return this.extraireFluxDomainService.extraire(flux); | ||
} | ||
} |
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
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
1 change: 1 addition & 0 deletions
1
apps/stages/src/extraction/infrastructure/configuration/logger.strategy.ts
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
|
||
import { | ||
Logger, | ||
LoggerFactory, | ||
|
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
27 changes: 27 additions & 0 deletions
27
apps/stages/src/extraction/infrastructure/sub-command/extract-flow-hellowork.sub-command.ts
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,27 @@ | ||
import { CommandRunner, SubCommand } from "nest-commander"; | ||
|
||
import { ExtraireHellowork } from "@stages/src/extraction/application-service/extraire-hellowork.usecase"; | ||
import { FluxExtraction } from "@stages/src/extraction/domain/model/flux"; | ||
import { Configuration } from "@stages/src/extraction/infrastructure/configuration/configuration"; | ||
import { CommandLog } from "@stages/src/extraction/infrastructure/configuration/log.decorator"; | ||
|
||
@SubCommand({ name: ExtractFlowHelloworkSubCommand.FLOW_NAME }) | ||
export class ExtractFlowHelloworkSubCommand extends CommandRunner { | ||
private static readonly FLOW_NAME = "hellowork"; | ||
|
||
constructor(private readonly usecase: ExtraireHellowork, private readonly configuration: Configuration) { | ||
super(); | ||
} | ||
|
||
@CommandLog(ExtractFlowHelloworkSubCommand.FLOW_NAME) | ||
public override async run(): Promise<void> { | ||
await this.usecase.executer( | ||
new FluxExtraction( | ||
this.configuration.HELLOWORK.NAME, | ||
this.configuration.HELLOWORK.RAW_FILE_EXTENSION, | ||
this.configuration.MINIO.HISTORY_DIRECTORY_NAME, | ||
this.configuration.HELLOWORK.FLUX_URL, | ||
), | ||
); | ||
} | ||
} |
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
38 changes: 38 additions & 0 deletions
38
apps/stages/test/extraction/usecase/extraire-hellowork.usecase.test.ts
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,38 @@ | ||
import { expect, StubbedClass, stubClass } from "@test/library"; | ||
|
||
import { ExtraireHellowork } from "@stages/src/extraction/application-service/extraire-hellowork.usecase"; | ||
import { FluxExtraction } from "@stages/src/extraction/domain/model/flux"; | ||
import { ExtraireFluxDomainService } from "@stages/src/extraction/domain/service/extraire-flux.domain-service"; | ||
|
||
const flux: FluxExtraction = new FluxExtraction( | ||
"hellowork", | ||
".xml", | ||
"history", | ||
"http://some.url", | ||
); | ||
|
||
let extraireFluxDomainService: StubbedClass<ExtraireFluxDomainService>; | ||
let extraireHellowork: ExtraireHellowork; | ||
|
||
describe("ExtraireHelloworkTest", () => { | ||
beforeEach(() => { | ||
extraireFluxDomainService = stubClass(ExtraireFluxDomainService); | ||
extraireHellowork = new ExtraireHellowork(extraireFluxDomainService); | ||
}); | ||
|
||
context("Lorsque j'extrais le flux en provenant de Hellowork", () => { | ||
it("j'extrais le flux", async () => { | ||
await extraireHellowork.executer(flux); | ||
|
||
expect(extraireFluxDomainService.extraire).to.have.been.calledOnce; | ||
expect(extraireFluxDomainService.extraire).to.have.been.calledWith( | ||
new FluxExtraction( | ||
"hellowork", | ||
".xml", | ||
"history", | ||
"http://some.url", | ||
), | ||
); | ||
}); | ||
}); | ||
}); |
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