Skip to content

Commit

Permalink
feat(#358): support List<Map<*,*>> variable factory
Browse files Browse the repository at this point in the history
  • Loading branch information
mmiikkkkaa committed Jan 19, 2024
1 parent d71245e commit 031af43
Show file tree
Hide file tree
Showing 16 changed files with 696 additions and 9 deletions.
30 changes: 28 additions & 2 deletions example/itest/src/test/kotlin/itest/CamundaBpmDataITestBase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import io.holunda.camunda.bpm.data.CamundaBpmDataKotlin.customVariable
import io.holunda.camunda.bpm.data.CamundaBpmDataKotlin.dateVariable
import io.holunda.camunda.bpm.data.CamundaBpmDataKotlin.doubleVariable
import io.holunda.camunda.bpm.data.CamundaBpmDataKotlin.intVariable
import io.holunda.camunda.bpm.data.CamundaBpmDataKotlin.listOfMapsVariable
import io.holunda.camunda.bpm.data.CamundaBpmDataKotlin.listVariable
import io.holunda.camunda.bpm.data.CamundaBpmDataKotlin.mapVariable
import io.holunda.camunda.bpm.data.CamundaBpmDataKotlin.setVariable
Expand All @@ -32,6 +33,8 @@ import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Value
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.DOUBLE_LOCAL
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.INT
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.INT_LOCAL
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.LIST_MAP_STRING_OBJECT
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.LIST_MAP_STRING_OBJECT_LOCAL
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.LIST_STRING
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.LIST_STRING_LOCAL
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.LONG
Expand Down Expand Up @@ -88,6 +91,7 @@ abstract class CamundaBpmDataITestBase : SpringScenarioTest<ActionStage, ActionS
val LIST_STRING_VAR: VariableFactory<List<String>> = listVariable("List Of String Variable")
val SET_STRING_VAR: VariableFactory<Set<String>> = setVariable("Set Of String Variable")
val MAP_STRING_LONG_VAR: VariableFactory<Map<String, String>> = mapVariable("Map Of String to String Variable")
val LIST_MAP_STRING_OBJECT_VAR: VariableFactory<List<Map<String, Any>>> = listOfMapsVariable("List Of Maps Of String to Any")
val COMPLEX_SET_VAR: VariableFactory<Set<ComplexDataStructure>> = setVariable("Complex Set")
val COMPLEX_LIST_VAR: VariableFactory<List<ComplexDataStructure>> = listVariable("Complex List")
val COMPLEX_MAP_VAR: VariableFactory<Map<String, ComplexDataStructure>> = mapVariable("Complex Map")
Expand All @@ -107,6 +111,12 @@ abstract class CamundaBpmDataITestBase : SpringScenarioTest<ActionStage, ActionS
val LIST_STRING = VariableValue(LIST_STRING_VAR, listOf("Hello", "World"))
val SET_STRING = VariableValue(SET_STRING_VAR, setOf("Kermit", "Piggy"))
val MAP_STRING_LONG = VariableValue(MAP_STRING_LONG_VAR, mapOf("Twelve" to now.toString(), "Eleven" to now.toString()))
val LIST_MAP_STRING_OBJECT = VariableValue(
LIST_MAP_STRING_OBJECT_VAR, listOf(
mapOf("1" to "one"),
mapOf("2" to "two")
)
)
val COMPLEX_SET = VariableValue(
COMPLEX_SET_VAR, setOf(
ComplexDataStructure("one", 1, now),
Expand Down Expand Up @@ -137,6 +147,12 @@ abstract class CamundaBpmDataITestBase : SpringScenarioTest<ActionStage, ActionS
val LIST_STRING_LOCAL = VariableValue(LIST_STRING_VAR, listOf("Foo", "Bar"))
val SET_STRING_LOCAL = VariableValue(SET_STRING_VAR, setOf("Homer", "Marge"))
val MAP_STRING_DATE_LOCAL = VariableValue(MAP_STRING_LONG_VAR, mapOf("Ten" to yesterday.toString(), "Nine" to yesterday.toString()))
val LIST_MAP_STRING_OBJECT_LOCAL = VariableValue(
LIST_MAP_STRING_OBJECT_VAR, listOf(
mapOf("1" to "one local"),
mapOf("2" to "two local")
)
)
val COMPLEX_SET_LOCAL = VariableValue(
COMPLEX_SET_VAR, setOf(
ComplexDataStructure("one local", 1, now),
Expand Down Expand Up @@ -171,7 +187,8 @@ abstract class CamundaBpmDataITestBase : SpringScenarioTest<ActionStage, ActionS
COMPLEX_VAR to COMPLEX,
LIST_STRING_VAR to LIST_STRING,
SET_STRING_VAR to SET_STRING,
MAP_STRING_LONG_VAR to MAP_STRING_LONG
MAP_STRING_LONG_VAR to MAP_STRING_LONG,
LIST_MAP_STRING_OBJECT_VAR to LIST_MAP_STRING_OBJECT
)

private val allLocalValues = mapOf(
Expand All @@ -188,7 +205,8 @@ abstract class CamundaBpmDataITestBase : SpringScenarioTest<ActionStage, ActionS
COMPLEX_VAR to COMPLEX_LOCAL,
LIST_STRING_VAR to LIST_STRING_LOCAL,
SET_STRING_VAR to SET_STRING_LOCAL,
MAP_STRING_LONG_VAR to MAP_STRING_DATE_LOCAL
MAP_STRING_LONG_VAR to MAP_STRING_DATE_LOCAL,
LIST_MAP_STRING_OBJECT_VAR to LIST_MAP_STRING_OBJECT_LOCAL
)

fun createVariableMapUntyped(): VariableMap {
Expand Down Expand Up @@ -233,6 +251,7 @@ abstract class CamundaBpmDataITestBase : SpringScenarioTest<ActionStage, ActionS
optionalVars[LIST_STRING_VAR.name] = LIST_STRING_VAR.from(delegateExecution).getOptional()
optionalVars[SET_STRING_VAR.name] = SET_STRING_VAR.from(delegateExecution).getOptional()
optionalVars[MAP_STRING_LONG_VAR.name] = MAP_STRING_LONG_VAR.from(delegateExecution).getOptional()
optionalVars[LIST_MAP_STRING_OBJECT_VAR.name] = LIST_MAP_STRING_OBJECT_VAR.from(delegateExecution).getOptional()
optionalVars[COMPLEX_SET_VAR.name] = COMPLEX_SET_VAR.from(delegateExecution).getOptional()
optionalVars[COMPLEX_LIST_VAR.name] = COMPLEX_LIST_VAR.from(delegateExecution).getOptional()
optionalVars[COMPLEX_MAP_VAR.name] = COMPLEX_MAP_VAR.from(delegateExecution).getOptional()
Expand All @@ -251,6 +270,7 @@ abstract class CamundaBpmDataITestBase : SpringScenarioTest<ActionStage, ActionS
vars[LIST_STRING_VAR.name] = LIST_STRING_VAR.from(delegateExecution).get()
vars[SET_STRING_VAR.name] = SET_STRING_VAR.from(delegateExecution).get()
vars[MAP_STRING_LONG_VAR.name] = MAP_STRING_LONG_VAR.from(delegateExecution).get()
vars[LIST_MAP_STRING_OBJECT_VAR.name] = LIST_MAP_STRING_OBJECT_VAR.from(delegateExecution).get()
vars[COMPLEX_SET_VAR.name] = COMPLEX_SET_VAR.from(delegateExecution).get()
vars[COMPLEX_LIST_VAR.name] = COMPLEX_LIST_VAR.from(delegateExecution).get()
vars[COMPLEX_MAP_VAR.name] = COMPLEX_MAP_VAR.from(delegateExecution).get()
Expand Down Expand Up @@ -281,6 +301,7 @@ abstract class CamundaBpmDataITestBase : SpringScenarioTest<ActionStage, ActionS
vars[LIST_STRING_VAR.name] = LIST_STRING_VAR.from(variableScope).getLocal()
vars[SET_STRING_VAR.name] = SET_STRING_VAR.from(variableScope).getLocal()
vars[MAP_STRING_LONG_VAR.name] = MAP_STRING_LONG_VAR.from(variableScope).getLocal()
vars[LIST_MAP_STRING_OBJECT_VAR.name] = LIST_MAP_STRING_OBJECT_VAR.from(variableScope).getLocal()
vars[COMPLEX_SET_VAR.name] = COMPLEX_SET_VAR.from(variableScope).getLocal()
vars[COMPLEX_LIST_VAR.name] = COMPLEX_LIST_VAR.from(variableScope).getLocal()
vars[COMPLEX_MAP_VAR.name] = COMPLEX_MAP_VAR.from(variableScope).getLocal()
Expand Down Expand Up @@ -309,6 +330,7 @@ abstract class CamundaBpmDataITestBase : SpringScenarioTest<ActionStage, ActionS
vars[LIST_STRING_VAR.name] = LIST_STRING_VAR.from(variableMap).get()
vars[SET_STRING_VAR.name] = SET_STRING_VAR.from(variableMap).get()
vars[MAP_STRING_LONG_VAR.name] = MAP_STRING_LONG_VAR.from(variableMap).get()
vars[LIST_MAP_STRING_OBJECT_VAR.name] = LIST_MAP_STRING_OBJECT_VAR.from(variableMap).get()
vars[COMPLEX_SET_VAR.name] = COMPLEX_SET_VAR.from(variableMap).get()
vars[COMPLEX_LIST_VAR.name] = COMPLEX_LIST_VAR.from(variableMap).get()
vars[COMPLEX_MAP_VAR.name] = COMPLEX_MAP_VAR.from(variableMap).get()
Expand All @@ -327,6 +349,7 @@ abstract class CamundaBpmDataITestBase : SpringScenarioTest<ActionStage, ActionS
LIST_STRING_VAR.on(delegateExecution).set(LIST_STRING.value)
SET_STRING_VAR.on(delegateExecution).set(SET_STRING.value)
MAP_STRING_LONG_VAR.on(delegateExecution).set(MAP_STRING_LONG.value)
LIST_MAP_STRING_OBJECT_VAR.on(delegateExecution).set(LIST_MAP_STRING_OBJECT.value)
COMPLEX_SET_VAR.on(delegateExecution).set(COMPLEX_SET.value)
COMPLEX_LIST_VAR.on(delegateExecution).set(COMPLEX_LIST.value)
COMPLEX_MAP_VAR.on(delegateExecution).set(COMPLEX_MAP.value)
Expand All @@ -346,6 +369,7 @@ abstract class CamundaBpmDataITestBase : SpringScenarioTest<ActionStage, ActionS
LIST_STRING_VAR.on(delegateExecution).set(LIST_STRING.value)
SET_STRING_VAR.on(delegateExecution).set(SET_STRING.value)
MAP_STRING_LONG_VAR.on(delegateExecution).set(MAP_STRING_LONG.value)
LIST_MAP_STRING_OBJECT_VAR.on(delegateExecution).set(LIST_MAP_STRING_OBJECT.value)
COMPLEX_SET_VAR.on(delegateExecution).set(COMPLEX_SET.value)
COMPLEX_LIST_VAR.on(delegateExecution).set(COMPLEX_LIST.value)
COMPLEX_MAP_VAR.on(delegateExecution).set(COMPLEX_MAP.value)
Expand All @@ -361,6 +385,7 @@ abstract class CamundaBpmDataITestBase : SpringScenarioTest<ActionStage, ActionS
LIST_STRING_VAR.on(delegateExecution).setLocal(LIST_STRING_LOCAL.value)
SET_STRING_VAR.on(delegateExecution).setLocal(SET_STRING_LOCAL.value)
MAP_STRING_LONG_VAR.on(delegateExecution).setLocal(MAP_STRING_DATE_LOCAL.value)
LIST_MAP_STRING_OBJECT_VAR.on(delegateExecution).setLocal(LIST_MAP_STRING_OBJECT_LOCAL.value)
COMPLEX_SET_VAR.on(delegateExecution).setLocal(COMPLEX_SET_LOCAL.value)
COMPLEX_LIST_VAR.on(delegateExecution).setLocal(COMPLEX_LIST_LOCAL.value)
COMPLEX_MAP_VAR.on(delegateExecution).setLocal(COMPLEX_MAP_LOCAL.value)
Expand All @@ -372,6 +397,7 @@ abstract class CamundaBpmDataITestBase : SpringScenarioTest<ActionStage, ActionS
LIST_STRING_VAR.on(delegateExecution).remove()
SET_STRING_VAR.on(delegateExecution).remove()
MAP_STRING_LONG_VAR.on(delegateExecution).remove()
LIST_MAP_STRING_OBJECT_VAR.on(delegateExecution).remove()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Value
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.DATE
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.DOUBLE
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.INT
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.LIST_MAP_STRING_OBJECT
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.LIST_STRING
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.LONG
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.MAP_STRING_LONG
Expand Down Expand Up @@ -52,6 +53,7 @@ class RuntimeServiceAdapterITest : CamundaBpmDataITestBase() {
COMPLEX_SET_VAR.on(runtimeService, executionId).set(COMPLEX_SET.value)
COMPLEX_LIST_VAR.on(runtimeService, executionId).set(COMPLEX_LIST.value)
COMPLEX_MAP_VAR.on(runtimeService, executionId).set(COMPLEX_MAP.value)
LIST_MAP_STRING_OBJECT_VAR.on(runtimeService, executionId).set(LIST_MAP_STRING_OBJECT.value)
}
.and()
.task_is_completed()
Expand Down Expand Up @@ -114,6 +116,7 @@ class RuntimeServiceAdapterITest : CamundaBpmDataITestBase() {
vars[LIST_STRING_VAR.name] = LIST_STRING_VAR.from(runtimeService, executionId).get()
vars[SET_STRING_VAR.name] = SET_STRING_VAR.from(runtimeService, executionId).get()
vars[MAP_STRING_LONG_VAR.name] = MAP_STRING_LONG_VAR.from(runtimeService, executionId).get()
vars[LIST_MAP_STRING_OBJECT_VAR.name] = LIST_MAP_STRING_OBJECT_VAR.from(runtimeService, executionId).get()
vars[COMPLEX_SET_VAR.name] = COMPLEX_SET_VAR.from(runtimeService, executionId).get()
vars[COMPLEX_LIST_VAR.name] = COMPLEX_LIST_VAR.from(runtimeService, executionId).get()
vars[COMPLEX_MAP_VAR.name] = COMPLEX_MAP_VAR.from(runtimeService, executionId).get()
Expand Down
14 changes: 11 additions & 3 deletions example/itest/src/test/kotlin/itest/TaskServiceAdapterITest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@ package io.holunda.camunda.bpm.data.itest
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.BOOLEAN
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.BOOLEAN_LOCAL
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.COMPLEX
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.COMPLEX_LIST_LOCAL
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.COMPLEX_LOCAL
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.COMPLEX_MAP_LOCAL
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.COMPLEX_SET_LOCAL
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.DATE
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.DATE_LOCAL
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.DOUBLE
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.DOUBLE_LOCAL
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.INT
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.INT_LOCAL
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.LIST_MAP_STRING_OBJECT
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.LIST_MAP_STRING_OBJECT_LOCAL
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.LIST_STRING
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.LIST_STRING_LOCAL
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.LONG
Expand Down Expand Up @@ -59,6 +64,7 @@ class TaskServiceAdapterITest : CamundaBpmDataITestBase() {
COMPLEX_SET_VAR.on(taskService, taskId).set(Companion.Values.COMPLEX_SET.value)
COMPLEX_LIST_VAR.on(taskService, taskId).set(Companion.Values.COMPLEX_LIST.value)
COMPLEX_MAP_VAR.on(taskService, taskId).set(Companion.Values.COMPLEX_MAP.value)
LIST_MAP_STRING_OBJECT_VAR.on(taskService, taskId).set(LIST_MAP_STRING_OBJECT.value)

}
.and()
Expand Down Expand Up @@ -130,6 +136,7 @@ class TaskServiceAdapterITest : CamundaBpmDataITestBase() {
vars[COMPLEX_SET_VAR.name] = COMPLEX_SET_VAR.from(taskService, taskId).get()
vars[COMPLEX_LIST_VAR.name] = COMPLEX_LIST_VAR.from(taskService, taskId).get()
vars[COMPLEX_MAP_VAR.name] = COMPLEX_MAP_VAR.from(taskService, taskId).get()
vars[LIST_MAP_STRING_OBJECT_VAR.name] = LIST_MAP_STRING_OBJECT_VAR.from(taskService, taskId).get()
}

then()
Expand Down Expand Up @@ -159,9 +166,10 @@ class TaskServiceAdapterITest : CamundaBpmDataITestBase() {
LIST_STRING_VAR.on(taskService, taskId).setLocal(LIST_STRING_LOCAL.value)
SET_STRING_VAR.on(taskService, taskId).setLocal(SET_STRING_LOCAL.value)
MAP_STRING_LONG_VAR.on(taskService, taskId).setLocal(MAP_STRING_DATE_LOCAL.value)
COMPLEX_SET_VAR.on(taskService, taskId).setLocal(Companion.Values.COMPLEX_SET_LOCAL.value)
COMPLEX_LIST_VAR.on(taskService, taskId).setLocal(Companion.Values.COMPLEX_LIST_LOCAL.value)
COMPLEX_MAP_VAR.on(taskService, taskId).setLocal(Companion.Values.COMPLEX_MAP_LOCAL.value)
LIST_MAP_STRING_OBJECT_VAR.on(taskService, taskId).setLocal(LIST_MAP_STRING_OBJECT_LOCAL.value)
COMPLEX_SET_VAR.on(taskService, taskId).setLocal(COMPLEX_SET_LOCAL.value)
COMPLEX_LIST_VAR.on(taskService, taskId).setLocal(COMPLEX_LIST_LOCAL.value)
COMPLEX_MAP_VAR.on(taskService, taskId).setLocal(COMPLEX_MAP_LOCAL.value)
}
.and()
.task_is_completed()
Expand Down
34 changes: 33 additions & 1 deletion example/itest/src/test/kotlin/itest/VariableMapAdapterITest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Value
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.DATE
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.DOUBLE
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.INT
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.LIST_MAP_STRING_OBJECT
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.LIST_STRING
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.LONG
import io.holunda.camunda.bpm.data.itest.CamundaBpmDataITestBase.Companion.Values.MAP_STRING_LONG
Expand Down Expand Up @@ -46,6 +47,7 @@ class VariableMapAdapterITest : CamundaBpmDataITestBase() {
LIST_STRING_VAR.on(variables).set(LIST_STRING.value)
SET_STRING_VAR.on(variables).set(SET_STRING.value)
MAP_STRING_LONG_VAR.on(variables).set(MAP_STRING_LONG.value)
LIST_MAP_STRING_OBJECT_VAR.on(variables).set(LIST_MAP_STRING_OBJECT.value)
COMPLEX_SET_VAR.on(variables).set(Companion.Values.COMPLEX_SET.value)
COMPLEX_LIST_VAR.on(variables).set(Companion.Values.COMPLEX_LIST.value)
COMPLEX_MAP_VAR.on(variables).set(Companion.Values.COMPLEX_MAP.value)
Expand Down Expand Up @@ -79,6 +81,7 @@ class VariableMapAdapterITest : CamundaBpmDataITestBase() {
LIST_STRING_VAR.on(variables).remove()
SET_STRING_VAR.on(variables).remove()
MAP_STRING_LONG_VAR.on(variables).remove()
LIST_MAP_STRING_OBJECT_VAR.on(variables).remove()

given()
.process_with_delegate_is_deployed(delegateExpression = "\${${DelegateConfiguration::readOptionalFromVariableScope.name}}")
Expand All @@ -91,7 +94,8 @@ class VariableMapAdapterITest : CamundaBpmDataITestBase() {
STRING_VAR,
LIST_STRING_VAR,
SET_STRING_VAR,
MAP_STRING_LONG_VAR
MAP_STRING_LONG_VAR,
LIST_MAP_STRING_OBJECT_VAR
)
.and()
.variables_had_value(delegateConfiguration.optionalVars,
Expand Down Expand Up @@ -121,6 +125,13 @@ class VariableMapAdapterITest : CamundaBpmDataITestBase() {
}
}

@Test
fun `should throw correct UO exception on list of maps setLocal`() {
assertThrows(UnsupportedOperationException::class.java) {
LIST_MAP_STRING_OBJECT_VAR.on(createVariableMapUntyped()).setLocal(LIST_MAP_STRING_OBJECT.value)
}
}

@Test
fun `should throw correct UO exception on set setLocal`() {
assertThrows(UnsupportedOperationException::class.java) {
Expand Down Expand Up @@ -149,6 +160,13 @@ class VariableMapAdapterITest : CamundaBpmDataITestBase() {
}
}

@Test
fun `should throw correct UO exception on list of maps removeLocal`() {
assertThrows(UnsupportedOperationException::class.java) {
LIST_MAP_STRING_OBJECT_VAR.on(createVariableMapUntyped()).removeLocal()
}
}

@Test
fun `should throw correct UO exception on set removeLocal`() {
assertThrows(UnsupportedOperationException::class.java) {
Expand Down Expand Up @@ -177,6 +195,13 @@ class VariableMapAdapterITest : CamundaBpmDataITestBase() {
}
}

@Test
fun `should throw correct UO exception on list of maps getLocal`() {
assertThrows(UnsupportedOperationException::class.java) {
LIST_MAP_STRING_OBJECT_VAR.from(createVariableMapUntyped()).getLocal()
}
}

@Test
fun `should throw correct UO exception on set getLocal`() {
assertThrows(UnsupportedOperationException::class.java) {
Expand Down Expand Up @@ -205,6 +230,13 @@ class VariableMapAdapterITest : CamundaBpmDataITestBase() {
}
}

@Test
fun `should throw correct UO exception on list of maps getLocalOptional`() {
assertThrows(UnsupportedOperationException::class.java) {
LIST_MAP_STRING_OBJECT_VAR.from(createVariableMapUntyped()).getLocalOptional()
}
}

@Test
fun `should throw correct UO exception on set getLocalOptional`() {
assertThrows(UnsupportedOperationException::class.java) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,21 @@ object CamundaBpmData {
return ListVariableFactory(variableName, clazz)
}

/**
* Creates a variable factory for list of custom type.
*
* @param variableName name of the variable.
* @param keyClazz class of specifying the key type.
* @param valueClazz class of specifying the value type.
* @param <K> factory key type.
* @param <V> factory value type.
* @return variable factory for given type.
</T> */
@JvmStatic
fun <K, V> listOfMapsVariable(variableName: String, keyClazz: Class<K>, valueClazz: Class<V>): VariableFactory<List<Map<K, V>>> {
return ListOfMapsVariableFactory(variableName, keyClazz, valueClazz)
}

/**
* Creates a variable factory for set of custom type.
*
Expand Down
Loading

0 comments on commit 031af43

Please sign in to comment.