-
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.
[NU-1923] Rename source 'sample-generator' to 'event-generator' and '…
…period' to 'schedule' (#7502) rename source 'sample-generator' to 'event-generator' and 'period' to 'schedule'
- Loading branch information
Showing
34 changed files
with
161 additions
and
76 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
30 changes: 30 additions & 0 deletions
30
...defaultmodel/migrations/SampleGeneratorToEventGeneratorAndPeriodToScheduleParameter.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,30 @@ | ||
package pl.touk.nussknacker.defaultmodel.migrations | ||
|
||
import pl.touk.nussknacker.engine.api.MetaData | ||
import pl.touk.nussknacker.engine.api.parameter.ParameterName | ||
import pl.touk.nussknacker.engine.graph.node | ||
import pl.touk.nussknacker.engine.graph.node.Source | ||
import pl.touk.nussknacker.engine.graph.source.SourceRef | ||
import pl.touk.nussknacker.engine.migration.NodeMigration | ||
|
||
object SampleGeneratorToEventGeneratorAndPeriodToScheduleParameter extends NodeMigration { | ||
|
||
override val description: String = "Change name of component: sample-generator -> event-generator " + | ||
"and its parameter: period -> schedule" | ||
|
||
override def migrateNode(metaData: MetaData): PartialFunction[node.NodeData, node.NodeData] = { | ||
case source @ Source(_, ref @ SourceRef("sample-generator", _), _) => | ||
source.copy(ref = | ||
ref.copy( | ||
typ = "event-generator", | ||
parameters = ref.parameters.map { param => | ||
param.name.value match { | ||
case "period" => param.copy(name = ParameterName("schedule")) | ||
case _ => param | ||
} | ||
} | ||
) | ||
) | ||
} | ||
|
||
} |
45 changes: 45 additions & 0 deletions
45
...er/defaultModel/migrations/SampleGeneratorToEventGeneratorAndPeriodicToScheduleSpec.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,45 @@ | ||
package pl.touk.nussknacker.defaultModel.migrations | ||
|
||
import org.scalatest.freespec.AnyFreeSpecLike | ||
import org.scalatest.matchers.should.Matchers | ||
import pl.touk.nussknacker.defaultmodel.migrations.SampleGeneratorToEventGeneratorAndPeriodToScheduleParameter | ||
import pl.touk.nussknacker.engine.api.parameter.ParameterName | ||
import pl.touk.nussknacker.engine.api.{MetaData, StreamMetaData} | ||
import pl.touk.nussknacker.engine.graph.evaluatedparam.Parameter | ||
import pl.touk.nussknacker.engine.graph.node.Source | ||
import pl.touk.nussknacker.engine.graph.source.SourceRef | ||
import pl.touk.nussknacker.engine.spel.SpelExtension._ | ||
|
||
class SampleGeneratorToEventGeneratorAndPeriodicToScheduleSpec extends AnyFreeSpecLike with Matchers { | ||
|
||
"SampleGeneratorToEventGeneratorAndPeriodicToScheduleSpec should be applied" in { | ||
val metaData = MetaData("test", StreamMetaData(Some(1))) | ||
val beforeMigration = Source( | ||
id = "sample-generator", | ||
ref = SourceRef( | ||
typ = "sample-generator", | ||
parameters = List( | ||
Parameter(ParameterName("period"), "T(java.time.Duration).parse('PT1M')".spel), | ||
Parameter(ParameterName("count"), "1".spel), | ||
Parameter(ParameterName("value"), "1".spel), | ||
) | ||
) | ||
) | ||
val expectedAfterMigration = Source( | ||
id = "sample-generator", | ||
ref = SourceRef( | ||
typ = "event-generator", | ||
parameters = List( | ||
Parameter(ParameterName("schedule"), "T(java.time.Duration).parse('PT1M')".spel), | ||
Parameter(ParameterName("count"), "1".spel), | ||
Parameter(ParameterName("value"), "1".spel), | ||
) | ||
) | ||
) | ||
|
||
val migrated = SampleGeneratorToEventGeneratorAndPeriodToScheduleParameter.migrateNode(metaData)(beforeMigration) | ||
|
||
migrated shouldBe expectedAfterMigration | ||
} | ||
|
||
} |
Binary file modified
BIN
+1.26 KB
(100%)
...apshots__/electron/Linux/Components list should allow filtering by usage #1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+954 Bytes
(100%)
...mage_snapshots__/electron/Linux/Components list should display component #0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-177 Bytes
(98%)
...should display question mark when renaming a node and updating the count #0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+33.2 KB
...shots__/electron/Linux/Node window should display event-generator source #0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1.27 KB
(100%)
...ots__/electron/Linux/Process initially clean should import JSON and save #0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-311 Bytes
(100%)
...ots__/electron/Linux/Process initially clean should import JSON and save #1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
Oops, something went wrong.