use of org.ehrbase.client.openehrclient.defaultrestclient.systematic.compositionquery.queries.auto.AutoWhereCondition 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));
}
}
}
use of org.ehrbase.client.openehrclient.defaultrestclient.systematic.compositionquery.queries.auto.AutoWhereCondition in project openEHR_SDK by ehrbase.
the class TestQueryEngine method performEhrStatusQueryWithAutoWhere.
private QueryResponseData performEhrStatusQueryWithAutoWhere(String rootPath, String attributePath, RMObject referenceNode) {
String whereCondition = new AutoWhereCondition(rootPath, attributePath, referenceNode).condition();
Query<Record1<Map>> query = Query.buildNativeQuery(new AqlExpressionBuilder(rootPath, attributePath).ehrStatus(whereCondition), Map.class);
try {
return openEhrClient.aqlEndpoint().executeRaw(query, new ParameterValue("ehr_id", ehrUUID));
} catch (WrongStatusCodeException e) {
fail("path:" + rootPath + "/" + attributePath + ", error" + e.getMessage());
}
return null;
}
Aggregations