-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TestDeploymentServiceFactory, removed ActionService -> DeploymentMana…
…gerDispatcher dependency
- Loading branch information
Showing
14 changed files
with
158 additions
and
78 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
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
102 changes: 102 additions & 0 deletions
102
...c/test/scala/pl/touk/nussknacker/ui/process/deployment/TestDeploymentServiceFactory.scala
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,102 @@ | ||
package pl.touk.nussknacker.ui.process.deployment | ||
|
||
import akka.actor.ActorSystem | ||
import pl.touk.nussknacker.engine.api.deployment.DeploymentManager | ||
import pl.touk.nussknacker.engine.api.process.ProcessingType | ||
import pl.touk.nussknacker.test.mock.TestProcessChangeListener | ||
import pl.touk.nussknacker.test.utils.domain.TestFactory | ||
import pl.touk.nussknacker.test.utils.domain.TestFactory._ | ||
import pl.touk.nussknacker.ui.api.DeploymentCommentSettings | ||
import pl.touk.nussknacker.ui.db.DbRef | ||
import pl.touk.nussknacker.ui.process.deployment.deploymentstatus.DeploymentStatusesProvider | ||
import pl.touk.nussknacker.ui.process.deployment.scenariostatus.ScenarioStatusProvider | ||
import pl.touk.nussknacker.ui.process.processingtype.ValueWithRestriction | ||
import pl.touk.nussknacker.ui.process.processingtype.provider.ProcessingTypeDataProvider.noCombinedDataFun | ||
import pl.touk.nussknacker.ui.process.processingtype.provider.{ProcessingTypeDataProvider, ProcessingTypeDataState} | ||
|
||
import java.time.Clock | ||
import scala.concurrent.duration.FiniteDuration | ||
|
||
object TestDeploymentServiceFactory { | ||
|
||
val processingType = "streaming" | ||
|
||
def create( | ||
testDbRef: DbRef, | ||
// deploymentManager is as | ||
getDeploymentManager: () => DeploymentManager, | ||
scenarioStateTimeout: Option[FiniteDuration] = None, | ||
deploymentCommentSettings: Option[DeploymentCommentSettings] = None | ||
)(implicit actorSystem: ActorSystem): TestDeploymentServiceServices = { | ||
import actorSystem.dispatcher | ||
val clock = Clock.systemUTC() | ||
val dbioRunner = newDBIOActionRunner(testDbRef) | ||
val fetchingProcessRepository = newFetchingProcessRepository(testDbRef) | ||
val actionRepository = newActionProcessRepository(testDbRef) | ||
|
||
val processingTypeDataProvider: ProcessingTypeDataProvider[DeploymentManager, Nothing] = | ||
new ProcessingTypeDataProvider[DeploymentManager, Nothing] { | ||
|
||
override val state: ProcessingTypeDataState[DeploymentManager, Nothing] = | ||
new ProcessingTypeDataState[DeploymentManager, Nothing] { | ||
|
||
override def all: Map[ProcessingType, ValueWithRestriction[DeploymentManager]] = { | ||
Map( | ||
processingType -> ValueWithRestriction.anyUser(getDeploymentManager()) | ||
) | ||
} | ||
|
||
override def getCombined: () => Nothing = noCombinedDataFun | ||
override def stateIdentity: Any = getDeploymentManager() | ||
} | ||
|
||
} | ||
|
||
val dmDispatcher = { | ||
val futureFetchingProcessRepository = newFutureFetchingScenarioRepository(testDbRef) | ||
new DeploymentManagerDispatcher(processingTypeDataProvider, futureFetchingProcessRepository) | ||
} | ||
|
||
val scenarioStatusProvider = { | ||
val deploymentsStatusesProvider = | ||
new DeploymentStatusesProvider(dmDispatcher, scenarioStateTimeout) | ||
new ScenarioStatusProvider( | ||
deploymentsStatusesProvider, | ||
dmDispatcher, | ||
fetchingProcessRepository, | ||
actionRepository, | ||
dbioRunner | ||
) | ||
} | ||
|
||
val actionService = { | ||
val listener = new TestProcessChangeListener | ||
new ActionService( | ||
fetchingProcessRepository, | ||
actionRepository, | ||
dbioRunner, | ||
listener, | ||
scenarioStatusProvider, | ||
deploymentCommentSettings, | ||
modelInfoProvider, | ||
clock | ||
) | ||
} | ||
|
||
val deploymentService = new DeploymentService( | ||
dmDispatcher, | ||
processValidatorByProcessingType, | ||
TestFactory.scenarioResolverByProcessingType, | ||
actionService, | ||
additionalComponentConfigsByProcessingType, | ||
) | ||
TestDeploymentServiceServices(scenarioStatusProvider, actionService, deploymentService) | ||
} | ||
|
||
} | ||
|
||
case class TestDeploymentServiceServices( | ||
scenarioStatusProvider: ScenarioStatusProvider, | ||
actionService: ActionService, | ||
deploymentService: DeploymentService | ||
) |
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