-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
48 changed files
with
382 additions
and
56 deletions.
There are no files selected for viewing
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
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
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
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
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
54 changes: 54 additions & 0 deletions
54
...rc/test/kotlin/io/holunda/polyflow/view/query/data/DataEntryQueriesDeserializationTest.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package io.holunda.polyflow.view.query.data | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper | ||
import io.holunda.polyflow.bus.jackson.configurePolyflowJacksonObjectMapper | ||
import io.holunda.polyflow.view.auth.User | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.params.ParameterizedTest | ||
import org.junit.jupiter.params.provider.Arguments | ||
import org.junit.jupiter.params.provider.MethodSource | ||
import java.util.stream.Stream | ||
|
||
/** | ||
* Test to make sure all queries and responses are deserializable. | ||
*/ | ||
internal class DataEntryQueriesDeserializationTest { | ||
|
||
private val objectMapper: ObjectMapper = jacksonObjectMapper().configurePolyflowJacksonObjectMapper() | ||
|
||
companion object { | ||
@JvmStatic | ||
fun provideDataEntryQueries(): Stream<Arguments> = Stream.of( | ||
Arguments.of( | ||
DataEntryForIdentityQuery::class.java, | ||
DataEntryForIdentityQuery(entryId = "4711", entryType = "domain.type") | ||
), Arguments.of( | ||
DataEntryForIdentityQuery::class.java, | ||
DataEntryForIdentityQuery(QueryDataIdentity(entryId = "4711", entryType = "domain.type")) | ||
), | ||
|
||
Arguments.of( | ||
DataEntriesForUserQuery::class.java, | ||
DataEntriesForUserQuery( | ||
user = User( | ||
username = "kermit", groups = setOf("muppets") | ||
), page = 1, size = 50, sort = "+name", filters = listOf("data.name=test") | ||
) | ||
), Arguments.of( | ||
DataEntriesForDataEntryTypeQuery::class.java, | ||
DataEntriesForDataEntryTypeQuery( | ||
entryType = "domain.type", page = 1, size = 50, sort = "+name" | ||
) | ||
) | ||
) | ||
} | ||
|
||
@ParameterizedTest | ||
@MethodSource("provideDataEntryQueries") | ||
fun <Q : Any> `checks serialization is not changing the query`(type: Class<Q>, query: Q) { | ||
val serialized = objectMapper.writeValueAsString(query) | ||
val deserialized: Q = objectMapper.readValue(serialized, type) | ||
assertThat(deserialized).isEqualTo(deserialized) | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...lin/io/holunda/polyflow/view/query/process/ProcessDefinitionQueriesDeserializationTest.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package io.holunda.polyflow.view.query.process | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper | ||
import io.holunda.polyflow.bus.jackson.configurePolyflowJacksonObjectMapper | ||
import io.holunda.polyflow.view.auth.User | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.params.ParameterizedTest | ||
import org.junit.jupiter.params.provider.Arguments | ||
import org.junit.jupiter.params.provider.MethodSource | ||
import java.util.stream.Stream | ||
|
||
/** | ||
* Test to make sure all queries and responses are deserializable. | ||
*/ | ||
internal class ProcessDefinitionQueriesDeserializationTest { | ||
|
||
private val objectMapper: ObjectMapper = jacksonObjectMapper().configurePolyflowJacksonObjectMapper() | ||
|
||
companion object { | ||
@JvmStatic | ||
fun provideProcessDefinitionQueries(): Stream<Arguments> = Stream.of( | ||
Arguments.of( | ||
ProcessDefinitionsStartableByUserQuery::class.java, | ||
ProcessDefinitionsStartableByUserQuery( | ||
user = User(username = "kermit", groups = setOf("muppets")) | ||
) | ||
), | ||
) | ||
} | ||
|
||
@ParameterizedTest | ||
@MethodSource("provideProcessDefinitionQueries") | ||
fun <Q : Any> `checks serialization is not changing the query`(type: Class<Q>, query: Q) { | ||
val serialized = objectMapper.writeValueAsString(query) | ||
val deserialized: Q = objectMapper.readValue(serialized, type) | ||
assertThat(deserialized).isEqualTo(deserialized) | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...otlin/io/holunda/polyflow/view/query/process/ProcessInstanceQueriesDeserializationTest.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package io.holunda.polyflow.view.query.process | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper | ||
import io.holunda.polyflow.bus.jackson.configurePolyflowJacksonObjectMapper | ||
import io.holunda.polyflow.view.ProcessInstanceState | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.params.ParameterizedTest | ||
import org.junit.jupiter.params.provider.Arguments | ||
import org.junit.jupiter.params.provider.MethodSource | ||
import java.util.stream.Stream | ||
|
||
/** | ||
* Test to make sure all queries and responses are deserializable. | ||
*/ | ||
internal class ProcessInstanceQueriesDeserializationTest { | ||
|
||
private val objectMapper: ObjectMapper = jacksonObjectMapper().configurePolyflowJacksonObjectMapper() | ||
|
||
companion object { | ||
@JvmStatic | ||
fun provideProcessInstanceQueries(): Stream<Arguments> = Stream.of( | ||
Arguments.of( | ||
ProcessInstancesByStateQuery::class.java, | ||
ProcessInstancesByStateQuery(states = setOf(ProcessInstanceState.FINISHED, ProcessInstanceState.CANCELLED)) | ||
), | ||
) | ||
} | ||
|
||
@ParameterizedTest | ||
@MethodSource("provideProcessInstanceQueries") | ||
fun <Q : Any> `checks serialization is not changing the query`(type: Class<Q>, query: Q) { | ||
val serialized = objectMapper.writeValueAsString(query) | ||
val deserialized: Q = objectMapper.readValue(serialized, type) | ||
assertThat(deserialized).isEqualTo(deserialized) | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...holunda/polyflow/view/query/process/variable/ProcessInstanceQueriesDeserializationTest.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package io.holunda.polyflow.view.query.process.variable | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper | ||
import io.holunda.polyflow.bus.jackson.configurePolyflowJacksonObjectMapper | ||
import io.holunda.polyflow.view.query.process.variable.filter.ProcessVariableFilterExactlyOne | ||
import io.holunda.polyflow.view.query.process.variable.filter.ProcessVariableFilterOneOf | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.params.ParameterizedTest | ||
import org.junit.jupiter.params.provider.Arguments | ||
import org.junit.jupiter.params.provider.MethodSource | ||
import java.util.stream.Stream | ||
|
||
/** | ||
* Test to make sure all queries and responses are deserializable. | ||
*/ | ||
internal class ProcessInstanceQueriesDeserializationTest { | ||
|
||
private val objectMapper: ObjectMapper = jacksonObjectMapper().configurePolyflowJacksonObjectMapper() | ||
|
||
companion object { | ||
@JvmStatic | ||
fun provideProcessVariableQueries(): Stream<Arguments> = Stream.of( | ||
Arguments.of( | ||
ProcessVariablesForInstanceQuery::class.java, | ||
ProcessVariablesForInstanceQuery( | ||
processInstanceId = "4712", | ||
variableFilter = listOf( | ||
ProcessVariableFilterOneOf(setOf("var1", "var2")), | ||
ProcessVariableFilterExactlyOne("var3") | ||
) | ||
) | ||
), | ||
) | ||
} | ||
|
||
@ParameterizedTest | ||
@MethodSource("provideProcessVariableQueries") | ||
fun <Q : Any> `checks serialization is not changing the query`(type: Class<Q>, query: Q) { | ||
val serialized = objectMapper.writeValueAsString(query) | ||
val deserialized: Q = objectMapper.readValue(serialized, type) | ||
assertThat(deserialized).isEqualTo(deserialized) | ||
} | ||
} |
109 changes: 109 additions & 0 deletions
109
...son/src/test/kotlin/io/holunda/polyflow/view/query/task/TaskQueriesDeserializationTest.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
package io.holunda.polyflow.view.query.task | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper | ||
import io.holunda.polyflow.bus.jackson.configurePolyflowJacksonObjectMapper | ||
import io.holunda.polyflow.view.auth.User | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.params.ParameterizedTest | ||
import org.junit.jupiter.params.provider.Arguments | ||
import org.junit.jupiter.params.provider.MethodSource | ||
import java.util.stream.Stream | ||
|
||
/** | ||
* Test to make sure all queries and responses are deserializable. | ||
*/ | ||
internal class TaskQueriesDeserializationTest { | ||
|
||
private val objectMapper: ObjectMapper = jacksonObjectMapper().configurePolyflowJacksonObjectMapper() | ||
|
||
companion object { | ||
@JvmStatic | ||
fun provideTaskQueries() = Stream.of( | ||
Arguments.of( | ||
AllTasksQuery::class.java, | ||
AllTasksQuery( | ||
page = 1, | ||
size = 50, | ||
sort = "+name", | ||
filters = listOf("task.name=test") | ||
) | ||
), | ||
Arguments.of( | ||
AllTasksWithDataEntriesQuery::class.java, | ||
AllTasksWithDataEntriesQuery( | ||
page = 1, | ||
size = 50, | ||
sort = "+name", | ||
filters = listOf("task.name=test") | ||
) | ||
), | ||
Arguments.of( | ||
TaskCountByApplicationQuery::class.java, | ||
TaskCountByApplicationQuery() | ||
), | ||
Arguments.of( | ||
TaskForIdQuery::class.java, | ||
TaskForIdQuery(id = "4712") | ||
), | ||
Arguments.of( | ||
TasksForApplicationQuery::class.java, | ||
TasksForApplicationQuery(applicationName = "appl") | ||
), | ||
Arguments.of( | ||
TasksForGroupQuery::class.java, | ||
TasksForGroupQuery( | ||
user = User(username = "kermit", groups = setOf("muppets")), | ||
page = 1, | ||
size = 50, | ||
sort = "+name", | ||
filters = listOf("task.name=test") | ||
) | ||
), | ||
Arguments.of( | ||
TasksForUserQuery::class.java, | ||
TasksForUserQuery( | ||
user = User(username = "kermit", groups = setOf("muppets")), | ||
page = 1, | ||
size = 50, | ||
sort = "+name", | ||
filters = listOf("task.name=test") | ||
) | ||
), | ||
Arguments.of( | ||
TasksWithDataEntriesForGroupQuery::class.java, | ||
TasksWithDataEntriesForGroupQuery( | ||
user = User(username = "kermit", groups = setOf("muppets")), | ||
page = 1, | ||
size = 50, | ||
sort = "+name", | ||
filters = listOf("task.name=test") | ||
) | ||
), | ||
Arguments.of( | ||
TasksWithDataEntriesForUserQuery::class.java, | ||
TasksWithDataEntriesForUserQuery( | ||
user = User(username = "kermit", groups = setOf("muppets")), | ||
page = 1, | ||
size = 50, | ||
sort = "+name", | ||
filters = listOf("task.name=test") | ||
) | ||
), | ||
Arguments.of( | ||
TaskWithDataEntriesForIdQuery::class.java, | ||
TaskWithDataEntriesForIdQuery( | ||
id = "4713" | ||
) | ||
), | ||
) | ||
} | ||
|
||
@ParameterizedTest | ||
@MethodSource("provideTaskQueries") | ||
fun <Q : Any> `checks serialization is not changing the query`(type: Class<Q>, query: Q) { | ||
val serialized = objectMapper.writeValueAsString(query) | ||
val deserialized: Q = objectMapper.readValue(serialized, type) | ||
assertThat(deserialized).isEqualTo(query) | ||
} | ||
} |
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
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
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
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
Oops, something went wrong.