Skip to content

Commit

Permalink
Fixing only.badScenarios / only.incidentScenarios.
Browse files Browse the repository at this point in the history
  • Loading branch information
pme123 committed Jan 9, 2025
1 parent 74a860a commit 1899a56
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -303,20 +303,24 @@ trait SimulationDsl[T] extends TestOverrideExtensions:
): Seq[ExternalTaskScenario] =
serviceScenario(task, task.out, task.defaultServiceOutMock)

def badScenario(
scen: SScenario,
status: Int,
errorMsg: Optable[String] = None
): SScenario =
scen.only

def incidentScenario(scen: SScenario, incidentMsg: String): SScenario =
scen.only

def incidentScenario(scen: SScenario, incidentMsg: String)(
body: SStep*
): SScenario =
scen.only
inline def badScenario(
inline process: Process[?, ?, ?],
status: Int,
errorMsg: Optable[String] = None
): BadScenario =
BadScenario(nameOfVariable(process), process, status, errorMsg.value, isOnly = true)

inline def incidentScenario(
inline process: Process[?, ?, ?],
incidentMsg: String
)(body: SStep*): IncidentScenario =
IncidentScenario(nameOfVariable(process), process, body.toList, incidentMsg, isOnly = true)

inline def incidentScenario(
inline process: Process[?, ?, ?],
incidentMsg: String
): IncidentScenario =
incidentScenario(process, incidentMsg)()
end only

end SimulationDsl
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ object TestDomain extends BpmnProcessDsl:
// Out
case class Out(
success: ValueWrapper = ValueWrapper(),
// TODO isBoolean: String = "false",
successStr: String = "What a CallActivity!",
optionResult: Option[String] = Some("optionValue"),
listResult: Seq[String] = List("a", "b")
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@ import camundala.simulation.custom.CustomSimulation
// exampleDemosSimulation/testOnly *BadScenarioExampleSimulation
class BadScenarioExampleSimulation extends DemosSimulation:

simulate {
simulate(
badScenario(
`Bad Scenario with Message`,
500,
Some("Unknown property used in expression: ${nonExistingVariable}")
)
),
badScenario(
`Bad Scenario without Message`,
`Bad Scenario without Message 2`,
500
)
}
)

lazy val `Bad Scenario without Message 2` =
`Bad Scenario with Message`

end BadScenarioExampleSimulation
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ class BasicAuthExampleSimulation extends BasicSimulationDsl:
)

override def config =
super.config.withPort(8033)
super.config.withPort(8887)
end BasicAuthExampleSimulation
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class EnumWorkerExampleSimulation extends CustomSimulation:

override implicit def config =
super.config
.withPort(8034)
.withPort(8887)
// .withLogLevel(LogLevel.DEBUG)

end EnumWorkerExampleSimulation
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import camundala.simulation.custom.*
*/
class OAuthExampleSimulation extends OAuthSimulationDsl:

simulate {
simulate (
badScenario(
CamundalaGenerateTestP,
404,
"No matching process definition with key: camundala-generate-test and tenant-id: 0949"
)
}
)

override implicit def config =
super.config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import camundala.simulation.*
// exampleDemosSimulation/testOnly *SignalMessageExampleSimulation
class SignalMessageExampleSimulation extends DemosSimulation:

simulate {
simulate (
scenario(messageExample.startWithMsg)(
messageIntermediateExample,
messageIntermediateExample
.waitFor("messageReady", true)
)
),
// TODO in doc:
// .startWithSignal not supported as it is fire and forget
// - but we need the processInstanceId as reference
Expand All @@ -24,7 +24,7 @@ class SignalMessageExampleSimulation extends DemosSimulation:
.waitFor("signalReady", true)
)

}
)

private lazy val messageIntermediateExample = receiveMessageEvent(
"intermediate-message-for-example",
Expand Down

This file was deleted.

40 changes: 31 additions & 9 deletions 05-examples/demos/03-worker/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,41 @@
spring.application.name: camundala-examples-demos
server:
port: 8093
camunda.bpm:
job-execution:
wait-time-in-millis: 200 # this is for speedup testing
client:
base-url: ${CAMUNDA_REST_URL:http://localhost:8034/engine-rest}
base-url: ${CAMUNDA_BASE_URL:http://localhost:8887/engine-rest}
worker-id: ${WORKER_ID:my-worker}
disable-backoff-strategy: true # only during testing - faster topic
async-response-timeout: 10000
# default configuration for bpf-apps
spring:
security:
oauth2:
client:
registration:
worker:
provider: keycloak-primary
client-id: bpf
client-secret: ${FSSO_CLIENT_SECRET:c352a25e-c6d0-4e27-a75d-efedd0c5ec3a}
clientName: ${FSSO_CLIENT_NAME:bpf}
authorization-grant-type: client_credentials
redirect-uri: '{baseUrl}/login/oauth2/code/{registrationId}'
scope:
- openid
- profile
- email
provider:
keycloak-primary:
authorization-uri: ${FSSO_BASE_URL:http://kubernetes.docker.internal:8090/auth}/realms/${FSSO_REALM:master}/protocol/openid-connect/auth
token-uri: ${FSSO_BASE_URL:http://kubernetes.docker.internal:8090/auth}/realms/${FSSO_REALM:master}/protocol/openid-connect/token
user-info-uri: ${FSSO_BASE_URL:http://kubernetes.docker.internal:8090/auth}/realms/${FSSO_REALM:master}/protocol/openid-connect/userinfo
jwk-set-uri: ${FSSO_BASE_URL:http://kubernetes.docker.internal:8090/auth}/realms/${FSSO_REALM:master}/protocol/openid-connect/certs
user-name-attribute: preferred_username

logging:
level:
root: warn
"camundala": info
"valiant": info
"org.camunda.bpm.client": info
"org.camunda.bpm.client.spring": info

management:
endpoints:
web:
exposure:
include: "health"
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import org.springframework.context.annotation.ComponentScan
@ConfigurationPropertiesScan
@ComponentScan(basePackages =
Array(
"camundala.camunda7.worker.oauth",
"camundala.camunda7.worker", // for context
"camundala.examples.demos.worker"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ camunda:
enforceHistoryTimeToLive: false

# Uncomment if you need to run the application on a non-standard port
server.port: 8034
server.port: 8887

# logging:
# level.root: INFO
Expand Down

0 comments on commit 1899a56

Please sign in to comment.