Drools Hello world / published by https://github.com/dacr/code-examples-manager #da1c86ab-08d9-4b33-806a-85326acbc9b6/5e2e1206f4cc3fb6b50693b82cb5d41f4f632f40
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
// summary : Drools Hello world | |
// keywords : scala, drools, mvel, scalatest, ai, helloworld, @testable | |
// publish : gist | |
// authors : David Crosson | |
// license : Apache NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2) | |
// id : da1c86ab-08d9-4b33-806a-85326acbc9b6 | |
// execution : scala ammonite script (http://ammonite.io/) - run as follow 'amm scriptname.sc' | |
// created-on : 2019-09-15T23:03:44+02:00 | |
// managed-by : https://github.com/dacr/code-examples-manager | |
// run-with : scala-cli $file | |
// --------------------- | |
//> using scala "3.3.0" | |
//> using dep "fr.janalyse::drools-scripting:1.1.0" | |
//> using dep "org.scalatest::scalatest:3.2.16" | |
// --------------------- | |
import fr.janalyse.droolscripting._, org.scalatest.flatspec._, org.scalatest.matchers._ | |
object HelloTest extends AnyFlatSpec with should.Matchers { | |
"Drools" should "say hello" in { | |
val drl = | |
"""package test | |
|rule "hello" when | |
|then | |
| insert("HELLO WORLD"); | |
|end | |
|""".stripMargin | |
val engine = DroolsEngine(drl) | |
engine.fireAllRules() | |
engine.strings shouldBe List("HELLO WORLD") | |
} | |
} | |
HelloTest.execute() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment