-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
182 additions
and
9 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
99 changes: 99 additions & 0 deletions
99
.../nussknacker/engine/management/periodic/AdditionalDictComponentConfigsExtractorTest.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,99 @@ | ||
package pl.touk.nussknacker.engine.management.periodic | ||
|
||
import org.scalatest.funsuite.AnyFunSuite | ||
import org.scalatest.matchers.should.Matchers | ||
import pl.touk.nussknacker.engine.api.component.{ | ||
ComponentAdditionalConfig, | ||
ComponentGroupName, | ||
DesignerWideComponentId, | ||
ParameterAdditionalUIConfig | ||
} | ||
import pl.touk.nussknacker.engine.api.definition.FixedExpressionValue | ||
import pl.touk.nussknacker.engine.api.parameter.{ParameterName, ValueInputWithDictEditor} | ||
import pl.touk.nussknacker.engine.management.periodic.AdditionalDictComponentConfigsExtractorTest.{ | ||
componentConfigWithDictionaryEditorInParameter, | ||
componentConfigWithOnlyDictEditorParameters, | ||
componentConfigWithoutDictionaryEditorInParameter | ||
} | ||
|
||
class AdditionalDictComponentConfigsExtractorTest extends AnyFunSuite with Matchers { | ||
|
||
test("should filter only components and parameters with dictionary editors") { | ||
val additionalConfig = Map( | ||
DesignerWideComponentId("componentA") -> componentConfigWithDictionaryEditorInParameter, | ||
DesignerWideComponentId("componentB") -> componentConfigWithoutDictionaryEditorInParameter, | ||
) | ||
val filteredResult = | ||
AdditionalDictComponentConfigsExtractor.getAdditionalConfigsWithDictParametersEditors(additionalConfig) | ||
|
||
filteredResult shouldBe Map( | ||
DesignerWideComponentId("componentA") -> componentConfigWithOnlyDictEditorParameters | ||
) | ||
} | ||
|
||
} | ||
|
||
object AdditionalDictComponentConfigsExtractorTest { | ||
|
||
private val parameterAWithDictEditor = ( | ||
ParameterName("parameterA"), | ||
ParameterAdditionalUIConfig( | ||
required = true, | ||
initialValue = Some(FixedExpressionValue("'someInitialValueExpression'", "someInitialValueLabel")), | ||
hintText = None, | ||
valueEditor = Some(ValueInputWithDictEditor("someDictA", allowOtherValue = true)), | ||
valueCompileTimeValidation = None | ||
) | ||
) | ||
|
||
private val parameterBWithDictEditor = ( | ||
ParameterName("parameterB"), | ||
ParameterAdditionalUIConfig( | ||
required = false, | ||
initialValue = None, | ||
hintText = Some("someHint"), | ||
valueEditor = Some(ValueInputWithDictEditor("someDictB", allowOtherValue = false)), | ||
valueCompileTimeValidation = None | ||
) | ||
) | ||
|
||
private val parameterWithoutDictEditor = ( | ||
ParameterName("parameterC"), | ||
ParameterAdditionalUIConfig( | ||
required = true, | ||
initialValue = None, | ||
hintText = None, | ||
valueEditor = None, | ||
valueCompileTimeValidation = None | ||
) | ||
) | ||
|
||
private val componentConfigWithDictionaryEditorInParameter = ComponentAdditionalConfig( | ||
parameterConfigs = Map( | ||
parameterAWithDictEditor, | ||
parameterBWithDictEditor, | ||
parameterWithoutDictEditor | ||
), | ||
icon = Some("someIcon"), | ||
docsUrl = Some("someDocUrl"), | ||
componentGroup = Some(ComponentGroupName("Service")) | ||
) | ||
|
||
private val componentConfigWithoutDictionaryEditorInParameter = ComponentAdditionalConfig( | ||
parameterConfigs = Map(parameterWithoutDictEditor), | ||
icon = Some("someOtherIcon"), | ||
docsUrl = Some("someOtherDocUrl"), | ||
componentGroup = Some(ComponentGroupName("Service")) | ||
) | ||
|
||
private val componentConfigWithOnlyDictEditorParameters = ComponentAdditionalConfig( | ||
parameterConfigs = Map( | ||
parameterAWithDictEditor, | ||
parameterBWithDictEditor | ||
), | ||
icon = Some("someIcon"), | ||
docsUrl = Some("someDocUrl"), | ||
componentGroup = Some(ComponentGroupName("Service")) | ||
) | ||
|
||
} |