03-dmn

Use this to add Company specific DMNTester stuff like the configuration of the projects within the Company.

The following structure is generated by ./helperCompany.scala init:

03-dmn/src
         | main/resources
         | main/scala/company/dmn
         |                     | CompanyDmnTester.scala          
         | test/scala/company/dmn       

CompanyDmnTester

The Company's base class for the projects' DMN Tester apps. It only says where things are - the projects say what shall be tested.

The DMN Tester runs in the same JVM as your project - there is no Docker image and no container any more.

Example (generated by ./helperCompany.scala init):

package mycompany.orchescala.dmn

trait CompanyDmnTester extends DmnTesterApp:

  override protected def starterConfig: DmnTesterStarterConfig =
    DmnTesterStarterConfig(companyName = "mycompany")

end CompanyDmnTester

A project then only describes its DMNs:

object ProjectDmnTester extends CompanyDmnTester:

  override protected def dmnTesterObjects = Seq(
    InvoiceAssignApproverDMN
      .testValues(_.amount, 249, 250, 999, 1000, 1001)
      .dmnPath("invoiceBusinessDecisions")
  )

end ProjectDmnTester

dmn/runMain mycompany.myproject.dmn.ProjectDmnTester writes the configurations, starts the tester and keeps it running until you stop it (Ctrl-C).

DMNs of several platforms - one tester

If a project has DMNs for Camunda 7 and Camunda 8, name the sources:

trait CompanyDmnTester extends DmnTesterApp:

  override protected def starterConfig: DmnTesterStarterConfig =
    DmnTesterStarterConfig(
      companyName = "mycompany",
      dmnSources = Seq(
        DmnSource("c7", projectBasePath / "src" / "main" / "resources" / "camunda"),
        DmnSource("c8", projectBasePath / "c8" / "src" / "main" / "resources")
      )
    )

A project describes each decision once - the tester looks it up in every source and writes ONE configuration that references every DMN it found:

override protected def dmnTesterObjects = Seq(
  DocumentInfoDmn.example.testUnit.acceptMissingRules,
  StaticDocumentsDmn.example.testUnit
)

If documents-documentInfo.dmn exists in both sources, that one line yields a configuration with both DMNs:

decisionId=mycompany-documentInfo
dmnPaths {
    c7="src/main/resources/camunda/documents-documentInfo.dmn"
    c8="c8/src/main/resources/documents-documentInfo.dmn"
}

A run evaluates both and shows one result per platform - the same test inputs against both versions, which is what you want while migrating.

Nothing is guessed - what is missing is reported:

WARNING: There is no DMN 'documents-oldStuff.dmn' in any DMN source (…) - 'mycompany-oldStuff' is not tested.
WARNING: 2 DMN(s) in 'c8' …/c8/src/main/resources have no test configuration: a.dmn, b.dmn

Use .from("c8") if a decision shall be tested on ONE platform only.

Because both DMNs share the same testCases, you can accept what Camunda 7 does and immediately see where Camunda 8 differs.

One tester per project - no second app and no second port any more.

DmnTesterStarterConfig

You can customize the DmnTester Configuration.

DmnTesterStarterConfig(
  companyName = "valiant",
  dmnSources = Seq(DmnSource(localDmnPath))
)

Default Config

Except for the companyName all other values are optional and preconfigured, and should not be adjusted.

Especially the dmnSources might change in the future.

// path to where the configs should be created in
dmnConfigPaths: Seq[os.Path] = Seq(
  projectBasePath / "03-dmn" / "src" / "main" / "resources" / "dmnConfigs"
),
// where the DMNs are - name a source if there is more than one platform
dmnSources: Seq[DmnSource] = Seq(
  DmnSource(projectBasePath / "src" / "main" / "resources")
),
// the port the DMN Tester is started - e.g. http://localhost:8883
exposedPort: Int = 8883

If you run two testers next to each other (e.g. one for Camunda 7 and one for the migrated Camunda 8 DMNs), give the second one its own exposedPort.

containerName and imageVersion still exist, but they do nothing - they are only kept so that existing projects keep compiling.