<fix>[core]: fix elaboration always using zh_CN
Currently, the elaboration msg is always using simplified chinese,
which do not care about configration item: CoreGlobalProperty.LOCALE.
Therefore, update the impl of elaboration msg init, if
CoreGlobalProperty.LOCALE is zh_CN, using simplified chinese, if not,
using en_US as elaboration msg.
Resolves:
@@ -41,6 +41,8 @@ class ElaborationCase extends SubCase {
testElaborationWithUnknownFormatConversion()
testErrorList()
testNestedError()
+ testElaborationLanguageEnglish()
+ testElaborationLanguageNotSupport()
}
}
@@ -66,6 +68,36 @@ class ElaborationCase extends SubCase {
assert err.elaboration != null
}
+ void testElaborationLanguageEnglish() {
+ Locale originLocale = Platform.locale
+ Platform.locale = Locale.US
+ testElaborationEnglish()
+ Platform.locale = originLocale
+ }
+
+ void testElaborationLanguageNotSupport() {
+ Locale originLocale = Platform.locale
+ Platform.locale = Locale.FRANCE
+ testElaborationEnglish()
+ Platform.locale = originLocale
+ }
+
+ void testElaborationEnglish() {
+ def err = operr("certificate has expired or is not yet valid") as ErrorCode
+ assert err.elaboration != null
+ assert err.elaboration.trim() == "Error message: The current system time has expired for ImageStore certificate. Possible reason: ImageStore server system time or certificate is modified."
+
+ err = operr("The state of vm[uuid:%s] is %s. Only these state[Running,Stopped] is allowed to update cpu or memory.", Platform.uuid, "Rebooting") as ErrorCode
+ assert err.elaboration != null
+ assert err.elaboration.trim() == "Error message: Only VMs with the status [Running, Stopped] support CPU/memory update. Current status: Rebooting."
+
+ err = operr("test for missed error") as ErrorCode
+ assert err.elaboration == null
+
+ err = Platform.err(IdentityErrors.INVALID_SESSION, "xxxxxxxxx") as ErrorCode
+ assert err.elaboration != null
+ }
+
void testGetElaborationCategory() {
def result = getElaborationCategories {
sessionId = adminSession()
