-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: update Spring Boot to 3.1.3 and Spring Cloud to 2022.0.4
- Loading branch information
1 parent
7cdfab3
commit 82e5c88
Showing
10 changed files
with
96 additions
and
24 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
8 changes: 8 additions & 0 deletions
8
...center-biz/src/test/resources/permission/get-permission-list-by-role-id-list-payload.json
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,8 @@ | ||
{ | ||
"roleIdList": [ | ||
1 | ||
], | ||
"permissionTypeList": [ | ||
"BUTTON" | ||
] | ||
} |
7 changes: 7 additions & 0 deletions
7
auth-center/auth-center-biz/src/test/resources/permission/permission.json
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,7 @@ | ||
{ | ||
"deleted": "N", | ||
"url": "/fake/permissions", | ||
"type": 2, | ||
"permissionExpression": "FakePermissionExpression", | ||
"method": "GET" | ||
} |
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
63 changes: 63 additions & 0 deletions
63
common/src/main/kotlin/com/jmsoftware/maf/common/test/UnitTestHelper.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,63 @@ | ||
package com.jmsoftware.maf.common.test | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL | ||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule | ||
import com.fasterxml.jackson.module.kotlin.KotlinFeature | ||
import com.fasterxml.jackson.module.kotlin.KotlinModule | ||
import com.fasterxml.jackson.module.kotlin.readValue | ||
import com.jmsoftware.maf.common.test.UnitTestHelper.Companion.OBJECT_MAPPER | ||
import com.jmsoftware.maf.common.test.UnitTestHelper.Companion.log | ||
import com.jmsoftware.maf.common.util.logger | ||
|
||
/** | ||
* # UnitTestHelper | ||
* | ||
* change description here. | ||
* | ||
* @author Johnny Miller, email: johnnysviva@outlook.com, date: 7/25/2023 8:52 PM | ||
**/ | ||
class UnitTestHelper { | ||
companion object { | ||
val log = logger() | ||
val OBJECT_MAPPER: ObjectMapper = ObjectMapper().registerModules( | ||
JavaTimeModule(), | ||
KotlinModule.Builder() | ||
.withReflectionCacheSize(512) | ||
.configure(KotlinFeature.NullToEmptyCollection, false) | ||
.configure(KotlinFeature.NullToEmptyMap, false) | ||
.configure(KotlinFeature.NullIsSameAsDefault, false) | ||
.configure(KotlinFeature.SingletonSupport, false) | ||
.configure(KotlinFeature.StrictNullChecks, false) | ||
.build() | ||
).also { | ||
it.setSerializationInclusion(NON_NULL) | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Parse JSON string to an object. | ||
* | ||
* @param T the type of the object | ||
* @param context the context object, which could be an instance of KClass, or `this` when calling this method | ||
* @param jsonPath the path to the JSON file under `resources` directory | ||
* @return the object deserialized from the JSON file | ||
*/ | ||
inline fun <reified T : Any> parseJson(context: Any, jsonPath: String): T { | ||
return context.javaClass.classLoader.getResourceAsStream(jsonPath).use { | ||
if (it == null) { | ||
log.warn("Could not find the resource: $jsonPath") | ||
throw IllegalArgumentException("Could not find the resource: $jsonPath") | ||
} | ||
OBJECT_MAPPER.readValue<T>(it.readBytes()) | ||
} | ||
} | ||
|
||
/** | ||
* Stringify an object to a JSON string. | ||
* | ||
* @param any the object | ||
* @return the JSON string | ||
*/ | ||
fun jsonStringify(any: Any): String = OBJECT_MAPPER.writeValueAsString(any) |
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