03-simulation
Use this to add Company specific Simulation stuff like the configuration of the auth method.
The following structure is generated by ./helperCompany.scala init
:
03-simulation/src
| main/resources
| main/scala/company/simulation
| | CompanySimulation.scala
| test/scala/company/simulation
CompanySimulation
The Company's base class to run the Simulations.
Example (generated by ./helperCompany.scala init
):
package mycompany.camundala.simulation
import camundala.simulation.custom.*
/**
* Add here company specific stuff, to run the Simulations.
*/
trait CompanySimulation extends BasicSimulationDsl:
override def config =
super.config //TODO Adjust config if needed
end CompanySimulation
SimulationConfig
You can customize the Simulation Configuration.
super.config
.withTenantId("myTenant")
Default Config
// define tenant if you have one
tenantId: Option[String] = None,
// the Camunda Port
// there are Requests that wait until the process is ready - like getTask.
// the Simulation waits 1 second between the Requests.
// so with a timeout of 10 sec it will try 10 times (retryDuration = 1.second)
maxCount: Int = 10,
// REST endpoint of Camunda
endpoint: String = "http://localhost:8080/engine-rest",
// you can add authentication with this - default there is none.
// see BasicSimulationDsl / OAuthSimulationDsl for examples
authHeader: B => B = (b: B) => b,
// the maximum LogLevel you want to print the LogEntries.
logLevel: LogLevel = LogLevel.INFO
Authentication
We provide at the moment the following authentication methods:
Basic Authentication
import camundala.simulation.custom.*
trait CompanySimulation extends BasicSimulationDsl:
override lazy val username = sys.env.getOrElse("CAMUNDA_USER", "demo")
override lazy val password = sys.env.getOrElse("CAMUNDA_PASSWORD", "demo")
//...
You can override the username
and password
to use your credentials,
default is demo
/demo
.
OAuth2 Authentication
import camundala.simulation.custom.*
trait CompanySimulation extends OAuthSimulationDsl:
lazy val fsso: Fsso = Fsso(
s"$fssoBaseUrl/auth/realms/${config.tenantId.get}/protocol/openid-connect",
Map(
"grant_type" -> "password",
"client_id" -> "bpf",
"client_secret" -> fssoClientSecret,
"username" -> fssoUser,
"password" -> fssoPassword,
"scope" -> "fcs"
))
//...
private lazy val fssoBaseUrl = sys.env.getOrElse("FSSO_BASE_URL", "http://host.lima.internal:8090")
//...
Here you have to provide the FSSO configuration.
Fsso.url
is the URL of the FSSO Server.Fsso.bodyForm
is the body of the POST request to get the token.