From 6325dc49331039c802ff91c1c84e92551f6d03cd Mon Sep 17 00:00:00 2001 From: Arek Burdach Date: Tue, 21 Jan 2025 11:04:54 +0100 Subject: [PATCH] removed SimpleProcessConfigCreator to allow run tests from IDE --- build.sbt | 5 +- ...er.engine.api.process.ProcessConfigCreator | 1 - .../FlinkProcessTestRunnerSpec.scala | 2 - .../SimpleProcessConfigCreator.scala | 59 ------------------- 4 files changed, 3 insertions(+), 64 deletions(-) delete mode 100644 engine/flink/management/src/test/resources/META-INF/services/pl.touk.nussknacker.engine.api.process.ProcessConfigCreator delete mode 100644 engine/flink/management/src/test/scala/pl/touk/nussknacker/engine/management/testsmechanism/SimpleProcessConfigCreator.scala diff --git a/build.sbt b/build.sbt index e43de9f0c93..b19adb77a37 100644 --- a/build.sbt +++ b/build.sbt @@ -631,7 +631,8 @@ lazy val flinkDeploymentManager = (project in flink("management")) componentsApi % Provided, httpUtils % Provided, flinkScalaUtils % Provided, - flinkExecutor % Test, + // test->test dependency is needed to load SimpleProcessConfigCreator + flinkExecutor % "test,test->test", flinkTestUtils % "it,test", kafkaTestUtils % "it,test" ) @@ -721,7 +722,7 @@ lazy val flinkTests = (project in flink("tests")) kafkaTestUtils % Test, flinkComponentsTestkit % Test, flinkDeploymentManager % Test, - // TODO: cleanup kafka testsmechanism tests in order to remove test->test dependency + // test->test dependencies are needed to load components from these modules flinkKafkaComponentsUtils % "test->test", flinkSchemedKafkaComponentsUtils % "test->test", // for local development diff --git a/engine/flink/management/src/test/resources/META-INF/services/pl.touk.nussknacker.engine.api.process.ProcessConfigCreator b/engine/flink/management/src/test/resources/META-INF/services/pl.touk.nussknacker.engine.api.process.ProcessConfigCreator deleted file mode 100644 index dc12680791f..00000000000 --- a/engine/flink/management/src/test/resources/META-INF/services/pl.touk.nussknacker.engine.api.process.ProcessConfigCreator +++ /dev/null @@ -1 +0,0 @@ -pl.touk.nussknacker.engine.management.testsmechanism.SimpleProcessConfigCreator diff --git a/engine/flink/management/src/test/scala/pl/touk/nussknacker/engine/management/testsmechanism/FlinkProcessTestRunnerSpec.scala b/engine/flink/management/src/test/scala/pl/touk/nussknacker/engine/management/testsmechanism/FlinkProcessTestRunnerSpec.scala index 181f226cb5a..9e64878a596 100644 --- a/engine/flink/management/src/test/scala/pl/touk/nussknacker/engine/management/testsmechanism/FlinkProcessTestRunnerSpec.scala +++ b/engine/flink/management/src/test/scala/pl/touk/nussknacker/engine/management/testsmechanism/FlinkProcessTestRunnerSpec.scala @@ -429,8 +429,6 @@ class FlinkProcessTestRunnerSpec results.exceptions should have length 1 results.exceptions.head.nodeId shouldBe Some("out") results.exceptions.head.throwable.getMessage should include("message: / by zero") - - SimpleProcessConfigCreator.sinkForIntsResultsHolder.results should have length 0 } "be able to test process with time windows" in { diff --git a/engine/flink/management/src/test/scala/pl/touk/nussknacker/engine/management/testsmechanism/SimpleProcessConfigCreator.scala b/engine/flink/management/src/test/scala/pl/touk/nussknacker/engine/management/testsmechanism/SimpleProcessConfigCreator.scala deleted file mode 100644 index 4e142dcdf25..00000000000 --- a/engine/flink/management/src/test/scala/pl/touk/nussknacker/engine/management/testsmechanism/SimpleProcessConfigCreator.scala +++ /dev/null @@ -1,59 +0,0 @@ -package pl.touk.nussknacker.engine.management.testsmechanism - -import pl.touk.nussknacker.engine.api.process._ -import pl.touk.nussknacker.engine.api.{CustomStreamTransformer, Service} -import pl.touk.nussknacker.engine.management.testsmechanism.SimpleProcessConfigCreator.{ - sinkForIntsResultsHolder, - valueMonitorResultsHolder -} -import pl.touk.nussknacker.engine.process.helpers.SampleNodes._ -import pl.touk.nussknacker.engine.process.helpers.TestResultsHolder - -import java.net.ConnectException - -class SimpleProcessConfigCreator extends EmptyProcessConfigCreator { - - override def services(modelDependencies: ProcessObjectDependencies): Map[String, WithCategories[Service]] = - Map( - "logService" -> WithCategories(LogService, "c1"), - "throwingService" -> WithCategories(new ThrowingService(new RuntimeException("Thrown as expected")), "c1"), - "throwingTransientService" -> WithCategories(new ThrowingService(new ConnectException()), "c1"), - "returningDependentTypeService" -> WithCategories(ReturningDependentTypeService, "c1"), - "collectingEager" -> WithCategories(CollectingEagerService, "c1"), - "returningComponentUseCaseService" -> WithCategories(ReturningComponentUseCaseService, "c1") - ) - - override def sinkFactories( - modelDependencies: ProcessObjectDependencies - ): Map[String, WithCategories[SinkFactory]] = Map( - "monitor" -> WithCategories(SinkFactory.noParam(MonitorEmptySink), "c2"), - "valueMonitor" -> WithCategories(SinkForAny(valueMonitorResultsHolder), "c2"), - "sinkForInts" -> WithCategories.anyCategory(SinkForInts(sinkForIntsResultsHolder)) - ) - - override def customStreamTransformers( - modelDependencies: ProcessObjectDependencies - ): Map[String, WithCategories[CustomStreamTransformer]] = Map( - "stateCustom" -> WithCategories.anyCategory(StateCustomNode), - "transformWithTime" -> WithCategories.anyCategory(TransformerWithTime), - "joinBranchExpression" -> WithCategories.anyCategory(CustomJoinUsingBranchExpressions), - "transformerAddingComponentUseCase" -> WithCategories.anyCategory(TransformerAddingComponentUseCase) - ) - - override def sourceFactories( - modelDependencies: ProcessObjectDependencies - ): Map[String, WithCategories[SourceFactory]] = Map( - "input" -> WithCategories(simpleRecordSource(Nil), "cat2"), - "jsonInput" -> WithCategories(jsonSource, "cat2"), - "typedJsonInput" -> WithCategories(TypedJsonSource, "cat2"), - "genericSourceWithCustomVariables" -> WithCategories.anyCategory(GenericSourceWithCustomVariables) - ) - -} - -object SimpleProcessConfigCreator extends Serializable { - - val valueMonitorResultsHolder = new TestResultsHolder[AnyRef] - val sinkForIntsResultsHolder = new TestResultsHolder[java.lang.Integer] - -}