Search in sources :

Example 11 with RMObject

use of com.nedap.archie.rm.RMObject in project openEHR_SDK by ehrbase.

the class SelectRMIT method testAdminEntryDrillDown.

@Test
public void testAdminEntryDrillDown() throws IOException {
    String rootPath = "a";
    RMObject referenceNode = (RMObject) aComposition.itemsAtPath("/content[openEHR-EHR-SECTION.test_all_types.v1]/items[at0001]/items[openEHR-EHR-ADMIN_ENTRY.test_all_types.v1]").get(0);
    String contains = "composition c[openEHR-EHR-COMPOSITION.test_all_types.v1]" + " contains section s[openEHR-EHR-SECTION.test_all_types.v1]" + " contains ADMIN_ENTRY a[openEHR-EHR-ADMIN_ENTRY.test_all_types.v1]";
    String csvTestSet = dirPath + "/testAdminEntryDrillDown.csv";
    assertThat(simpleSelectQueryEngine.testItemPaths(csvTestSet, rootPath, contains, referenceNode)).isTrue();
}
Also used : RMObject(com.nedap.archie.rm.RMObject) Test(org.junit.Test)

Example 12 with RMObject

use of com.nedap.archie.rm.RMObject in project openEHR_SDK by ehrbase.

the class SelectRMIT method testContextAttributesDrillDown.

@Test
public void testContextAttributesDrillDown() throws IOException {
    String rootPath = "c/context";
    RMObject referenceNode = aComposition.getContext();
    String contains = "composition c[openEHR-EHR-COMPOSITION.test_all_types.v1]";
    String csvTestSet = dirPath + "/testContextAttributesDrillDown.csv";
    assertThat(simpleSelectQueryEngine.testItemPaths(csvTestSet, rootPath, contains, referenceNode)).isTrue();
}
Also used : RMObject(com.nedap.archie.rm.RMObject) Test(org.junit.Test)

Example 13 with RMObject

use of com.nedap.archie.rm.RMObject in project openEHR_SDK by ehrbase.

the class SelectRMIT method testEvaluationDrillDown.

@Test
public void testEvaluationDrillDown() throws IOException {
    String rootPath = "eval";
    RMObject referenceNode = (RMObject) aComposition.itemsAtPath("/content[openEHR-EHR-EVALUATION.test_all_types.v1]").get(0);
    String contains = "composition c[openEHR-EHR-COMPOSITION.test_all_types.v1]" + " contains evaluation eval[openEHR-EHR-EVALUATION.test_all_types.v1]";
    String csvTestSet = dirPath + "/testEvaluationDrillDown.csv";
    assertThat(simpleSelectQueryEngine.testItemPaths(csvTestSet, rootPath, contains, referenceNode)).isTrue();
}
Also used : RMObject(com.nedap.archie.rm.RMObject) Test(org.junit.Test)

Example 14 with RMObject

use of com.nedap.archie.rm.RMObject in project openEHR_SDK by ehrbase.

the class TestQueryEngine method checkAutoWhereQuery.

protected void checkAutoWhereQuery(String csvPath, String rootPath, String contains, RMObject referenceNode) throws FileNotFoundException {
    SimplePathExpressionSettings simplePathExpressionSettings = new SimplePathExpressionSettings();
    CsvParser csvParser = new CsvParser(simplePathExpressionSettings.settings());
    csvParser.parse(new FileReader(csvPath));
    List<PathExpression> attributeDefinitions = simplePathExpressionSettings.getPathExpressionRow().getBeans();
    for (PathExpression pathExpression : attributeDefinitions) {
        if (pathExpression.getComment() == null) {
            // conventionally, if params[1] exists, this means skip the test
            String attributePath = pathExpression.getPath();
            QueryResponseData result = performQueryWithWhere(rootPath, attributePath, contains, new AutoWhereCondition(rootPath, attributePath, referenceNode).condition());
            if (result.getRows().isEmpty())
                fail(rootPath + "/" + attributePath + ": no result");
            List<Object> objectList = result.getRows().get(0);
            assertThat(valueObject(objectList.get(0))).as(rootPath + "/" + attributePath).isEqualTo(attributeValueAt(referenceNode, attributePath));
        }
    }
}
Also used : SimplePathExpressionSettings(org.ehrbase.client.openehrclient.defaultrestclient.systematic.compositionquery.queries.simple.SimplePathExpressionSettings) PathExpression(org.ehrbase.client.openehrclient.defaultrestclient.systematic.compositionquery.queries.simple.PathExpression) AutoWhereCondition(org.ehrbase.client.openehrclient.defaultrestclient.systematic.compositionquery.queries.auto.AutoWhereCondition) CsvParser(org.junit.jupiter.params.shadow.com.univocity.parsers.csv.CsvParser) FileReader(java.io.FileReader) QueryResponseData(org.ehrbase.response.openehr.QueryResponseData) RMObject(com.nedap.archie.rm.RMObject)

Example 15 with RMObject

use of com.nedap.archie.rm.RMObject in project openEHR_SDK by ehrbase.

the class TestQueryEngine method checkAutoEhrStatusWhereQuery.

protected void checkAutoEhrStatusWhereQuery(String csvPath, String rootPath, RMObject referenceNode) throws FileNotFoundException {
    SimplePathExpressionSettings simplePathExpressionSettings = new SimplePathExpressionSettings();
    CsvParser csvParser = new CsvParser(simplePathExpressionSettings.settings());
    csvParser.parse(new FileReader(csvPath));
    List<PathExpression> attributeDefinitions = simplePathExpressionSettings.getPathExpressionRow().getBeans();
    for (PathExpression pathExpression : attributeDefinitions) {
        if (pathExpression.getComment() == null) {
            String attributePath = pathExpression.getPath();
            QueryResponseData result = performEhrStatusQueryWithAutoWhere(rootPath, attributePath, referenceNode);
            if (result.getRows().isEmpty())
                fail(rootPath + "/" + attributePath + ": no result");
            List<Object> objectList = result.getRows().get(0);
            assertThat(valueObject(objectList.get(0))).as(rootPath + "/" + attributePath).isEqualTo(attributeValueAt(referenceNode, attributePath));
        }
    }
}
Also used : SimplePathExpressionSettings(org.ehrbase.client.openehrclient.defaultrestclient.systematic.compositionquery.queries.simple.SimplePathExpressionSettings) PathExpression(org.ehrbase.client.openehrclient.defaultrestclient.systematic.compositionquery.queries.simple.PathExpression) CsvParser(org.junit.jupiter.params.shadow.com.univocity.parsers.csv.CsvParser) FileReader(java.io.FileReader) QueryResponseData(org.ehrbase.response.openehr.QueryResponseData) RMObject(com.nedap.archie.rm.RMObject)

Aggregations

RMObject (com.nedap.archie.rm.RMObject)57 Test (org.junit.Test)19 Composition (com.nedap.archie.rm.composition.Composition)10 CanonicalJson (org.ehrbase.serialisation.jsonencoding.CanonicalJson)9 QueryResponseData (org.ehrbase.response.openehr.QueryResponseData)8 Locatable (com.nedap.archie.rm.archetyped.Locatable)7 List (java.util.List)7 WebTemplateNode (org.ehrbase.webtemplate.model.WebTemplateNode)6 Collectors (java.util.stream.Collectors)5 TemplateId (com.nedap.archie.rm.archetyped.TemplateId)4 IOException (java.io.IOException)4 InvocationTargetException (java.lang.reflect.InvocationTargetException)4 Map (java.util.Map)4 ImmutablePair (org.apache.commons.lang3.tuple.ImmutablePair)4 TestDataTemplateProvider (org.ehrbase.client.templateprovider.TestDataTemplateProvider)4 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 Archetyped (com.nedap.archie.rm.archetyped.Archetyped)3 Version (com.nedap.archie.rm.changecontrol.Version)3 CodePhrase (com.nedap.archie.rm.datatypes.CodePhrase)3