Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
remove ++

baseflowtest fixes
  • Loading branch information
Marcel Philipiak committed Aug 20, 2024
1 parent 2fe8a6e commit 5a5f47d
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import scala.concurrent.{ExecutionContext, Future}
class DefinitionsService(
modelData: ModelData,
staticDefinitionForDynamicComponents: Map[ComponentId, ComponentStaticDefinition],
scenarioPropertiesConfig: ScenarioProperties,
scenarioProperties: ScenarioProperties,
fragmentPropertiesConfig: Map[String, SingleScenarioPropertyConfig],
deploymentManager: DeploymentManager,
alignedComponentsDefinitionProvider: AlignedComponentsDefinitionProvider,
Expand Down Expand Up @@ -55,7 +55,7 @@ class DefinitionsService(
}

val finalizedScenarioPropertiesConfig = scenarioPropertiesConfigFinalizer
.finalizePropertiesConfig(scenarioPropertiesConfig)
.finalizePropertiesConfig(scenarioProperties)

prepareUIDefinitions(
withStaticDefinition,
Expand All @@ -76,8 +76,8 @@ class DefinitionsService(
classes = modelData.modelDefinitionWithClasses.classDefinitions.all.toList.map(_.clazzName),
scenarioProperties = {
val (props, url) =
(if (forFragment) (FragmentPropertiesConfig.properties, None) ++ fragmentPropertiesConfig
else (finalizedScenarioPropertiesConfig.propertiesConfig, finalizedScenarioPropertiesConfig.docsUrl))
if (forFragment) (FragmentPropertiesConfig.properties ++ fragmentPropertiesConfig, None)
else (finalizedScenarioPropertiesConfig.propertiesConfig, finalizedScenarioPropertiesConfig.docsUrl)
val transformedProps = props.mapValuesNow(createUIScenarioAdditionalFieldConfig)
UiScenarioProperties(propertiesConfig = transformedProps, docsUrl = url)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ object FragmentPropertiesConfig {
FixedExpressionValueWithIcon(VariableIcon, "Variable", VariableIcon),
)

val iconConfig: (String, ScenarioPropertyConfig) = FragmentSpecificData.iconName ->
ScenarioPropertyConfig(
val iconConfig: (String, SingleScenarioPropertyConfig) = FragmentSpecificData.iconName ->
SingleScenarioPropertyConfig(
defaultValue = None,
editor = Some(FixedValuesWithIconParameterEditor(icons)),
validators = Some(List(MandatoryParameterValidator)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ object ProcessingTypeData {
DeploymentData(
validDeploymentManager,
metaDataInitializer,
scenarioProperties,
runtimeScenarioProps,
fragmentProperties,
deploymentManagerProvider.additionalValidators(deploymentConfig),
DeploymentManagerType(deploymentManagerProvider.name),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ class DefinitionsServiceSpec extends AnyFunSuite with Matchers with PatientScala
modelData = model,
staticDefinitionForDynamicComponents = Map.empty,
fragmentPropertiesConfig = Map.empty,
scenarioPropertiesConfig = ScenarioProperties.empty(),
scenarioProperties = ScenarioProperties.empty(),
deploymentManager = new MockDeploymentManager,
alignedComponentsDefinitionProvider = alignedComponentsDefinitionProvider,
scenarioPropertiesConfigFinalizer =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ class BaseFlowTest
)
response.code shouldEqual StatusCode.Ok

val settingsJson = response.extractFieldJsonValue("scenarioPropertiesConfig")
val settingsJson = response.extractFieldJsonValue("scenarioProperties")
val fixedPossibleValues = List(FixedExpressionValue("1", "1"), FixedExpressionValue("2", "2"))

val settings = Decoder[UiScenarioProperties].decodeJson(settingsJson).toOption.get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ components {
}


scenarioPropertiesConfig {
scenarioProperties {
propertiesConfig {
environment: {
editor: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import cats.data.ValidatedNel
import com.typesafe.config.Config
import com.typesafe.scalalogging.LazyLogging
import pl.touk.nussknacker.engine.api.component.SingleScenarioPropertyConfig
import pl.touk.nussknacker.engine.api.definition.{MandatoryParameterValidator, StringParameterEditor}
import pl.touk.nussknacker.engine.api.deployment.DeploymentManager
import pl.touk.nussknacker.engine.api.properties.ScenarioProperties
import pl.touk.nussknacker.engine.deployment.EngineSetupName
Expand All @@ -24,7 +25,7 @@ class FlinkPeriodicDeploymentManagerProvider extends DeploymentManagerProvider w

private val delegate = new FlinkStreamingDeploymentManagerProvider()

private val cronConfig = CronSchedulePropertyExtractor.CronPropertyDefaultName -> ScenarioPropertyConfig(
private val cronConfig = CronSchedulePropertyExtractor.CronPropertyDefaultName -> SingleScenarioPropertyConfig(
defaultValue = None,
editor = Some(StringParameterEditor),
validators = Some(List(MandatoryParameterValidator, CronParameterValidator.delegate)),
Expand Down Expand Up @@ -68,8 +69,10 @@ class FlinkPeriodicDeploymentManagerProvider extends DeploymentManagerProvider w
override def metaDataInitializer(config: Config): MetaDataInitializer =
delegate.metaDataInitializer(config)

override def scenarioPropertiesConfig(config: Config): ScenarioProperties =
Map(cronConfig) ++ delegate.scenarioPropertiesConfig(config)
override def scenarioPropertiesConfig(config: Config): ScenarioProperties = {
val props = delegate.scenarioPropertiesConfig(config)
props.copy(props.propertiesConfig ++ Map(cronConfig))
}

override def defaultEngineSetupName: EngineSetupName =
delegate.defaultEngineSetupName
Expand Down

0 comments on commit 5a5f47d

Please sign in to comment.