Merge pull request #1732 from gjergjsheldija/test_language_concurrency_bug
unit tests to check the concurrency bug
This commit is contained in:
commit
88075e6ac9
|
@ -0,0 +1,37 @@
|
||||||
|
package org.hl7.fhir.r5.elementmodel;
|
||||||
|
|
||||||
|
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||||
|
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
||||||
|
import org.hl7.fhir.utilities.i18n.LanguageFileProducer;
|
||||||
|
import org.hl7.fhir.utilities.i18n.PoGetTextProducer;
|
||||||
|
import org.hl7.fhir.utilities.tests.ResourceLoaderTests;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
class LanguageUtilsTest implements ResourceLoaderTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void importFromTranslations() throws Exception {
|
||||||
|
|
||||||
|
IWorkerContext context = TestingUtilities.getSharedWorkerContext();
|
||||||
|
|
||||||
|
org.hl7.fhir.r5.elementmodel.JsonParser jp = new org.hl7.fhir.r5.elementmodel.JsonParser(context);
|
||||||
|
InputStream resource = getResourceAsInputStream("languageUtils", "CodeSystem-answer.json");
|
||||||
|
Element element = jp.parseSingle(resource, null);
|
||||||
|
|
||||||
|
PoGetTextProducer lp = new PoGetTextProducer();
|
||||||
|
List<LanguageFileProducer.TranslationUnit> res = new ArrayList<>();
|
||||||
|
res.addAll(lp.loadSource(getResourceAsInputStream("languageUtils", "CodeSystem-answer.po")));
|
||||||
|
|
||||||
|
LanguageUtils languageUtils = new LanguageUtils(context);
|
||||||
|
int result = languageUtils.importFromTranslations(element, res, null);
|
||||||
|
|
||||||
|
assert result == 3;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"resourceType": "CodeSystem",
|
||||||
|
"status": "active",
|
||||||
|
"content": "complete",
|
||||||
|
"name": "BasicAnswer",
|
||||||
|
"id": "basic-answer",
|
||||||
|
"title": "Administration-Method",
|
||||||
|
"description": "Basic answers for any kind of questions.",
|
||||||
|
"url": "https://example.com/CodeSystem/basic-answer",
|
||||||
|
"concept": [
|
||||||
|
{
|
||||||
|
"code": "ok",
|
||||||
|
"display": "OK",
|
||||||
|
"definition": "KO"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "yes",
|
||||||
|
"display": "Yes",
|
||||||
|
"definition": "seY"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "no",
|
||||||
|
"display": "No",
|
||||||
|
"definition": "oN"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"language": "en",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"date": "2024-04-07",
|
||||||
|
"publisher": "Sample",
|
||||||
|
"caseSensitive": false,
|
||||||
|
"count": 3
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
# en -> it
|
||||||
|
|
||||||
|
#: CanonicalResource.name
|
||||||
|
#. A natural language name identifying the code system. This name should be usable as an identifier for the module by machine processing applications such as code generation.
|
||||||
|
msgid "BasicAnswer"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: CanonicalResource.title
|
||||||
|
#. A short, descriptive, user-friendly title for the code system.
|
||||||
|
msgid "Administration-Method"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: CanonicalResource.publisher
|
||||||
|
#. The name of the organization or individual that published the code system.
|
||||||
|
msgid "Example Publisher"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: CanonicalResource.description
|
||||||
|
#. A free text natural language description of the code system from a consumer's perspective.
|
||||||
|
msgid "Basic answers for any kind of questions."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: CodeSystem.concept.display
|
||||||
|
#. A human readable string that is the recommended default way to present this concept to a user.
|
||||||
|
msgid "OK"
|
||||||
|
msgstr "OK"
|
||||||
|
|
||||||
|
#: CodeSystem.concept.display
|
||||||
|
#. A human readable string that is the recommended default way to present this concept to a user.
|
||||||
|
msgid "Yes"
|
||||||
|
msgstr "Si"
|
||||||
|
|
||||||
|
#: CodeSystem.concept.display
|
||||||
|
#. A human readable string that is the recommended default way to present this concept to a user.
|
||||||
|
msgid "No"
|
||||||
|
msgstr "No"
|
||||||
|
|
Loading…
Reference in New Issue