Calling EVSClient from a remote application
EVSClient exposes a servlet to handle the validation requests from other applications. A new module entitled gazelle-evsclient-connector will help you with sending your validation queries to the EVSClient tool.
Module identification
groupId | net.ihe.gazelle |
artifactId | gazelle-evsclient-connector |
type | jar |
version | 1.0.0 |
Content
This module contains two main classes and an interface.
- net.ihe.gazelle.evsclient.connector.api.EVSClientResults : Queries the REST web service of the EVSClient tool to retrieve the validation results
- net.ihe.gazelle.evsclient.connector.api.EVSClientServletConnector : Sends your validation request to EVSClient
- net.ihe.gazelle.evsclient.conector.model.EVSClientValidatedObject : Must be implemented by the java object that you intent to send to EVSClient
Usage
First of all, the Java classes which defines objects that you want to send to the EVSClient shall implement EVSClientValidatedObject and override the 3 methods. Below is an example from gazelle-model-tm
public class TestStepsData extends AuditedObject implements Serializable, Comparable, EVSClientValidatedObject { // [...] // this is the value used as externalId by EVSClient, the couple (externalId, toolOid) SHALL // be unique through EVSClient to ensure the retrieval of results @Override public String getUniqueKey() { return "stepdata_" + id; } @Override public PartSource getPartSource() { String filepath = getCompleteFilePath(); File fileToValidate = new File(filepath); if (fileToValidate.exists()) { String content = null; content = Base64.encodeFromFile(filepath); return new ByteArrayPartSource(getType(), content.getBytes(Charset.forName("UTF-8"))); } else { return null; } } @Override public String getType() { return "stepdata"; }
Then, simply call the sendToValidation method:
public void getValidationLink(TestStepsData tsd) { if (tsd.isFile()) { EVSClientServletConnector.sendToValidation(tsd, FacesContext.getCurrentInstance().getExternalContext(), getEvsClientUrl(), ApplicationPreferenceManager.getStringValue("app_instance_oid")); } }
or retrieve results by using one of the static methods from EVSClientResults
public String getLastResultStatus(String proxyId) { String result = EVSClientResults.getLastResultStatusByExternalId(proxyId, ApplicationPreferenceManager.getStringValue("gazelle_proxy_oid"), getEvsClientUrl()); if (result == null) { result = "not performed"; } return result; } public String getLastResultStatusByTmId(String tmId) { String result = EVSClientResults.getLastResultStatusByExternalId(tmId, ApplicationPreferenceManager.getStringValue("app_instance_oid"), getEvsClientUrl()); if (result == null) { result = "not performed"; } return result; } public String getValidationStatus(String oid) { String result = EVSClientResults.getValidationStatus(oid, getEvsClientUrl()); if (result == null) { result = "not performed"; } return result; } public String getValidationPermanentLink(String oid) { String result = EVSClientResults.getValidationPermanentLink(oid, getEvsClientUrl()); if (result == null) { result = "not performed"; } return result; } public String getValidationPermanentLinkByProxyId(String proxyId) { String result = EVSClientResults.getLastResultPermanentLinkByExternalId(proxyId, ApplicationPreferenceManager.getStringValue("gazelle_proxy_oid"), getEvsClientUrl()); if (result == null) { result = "not performed"; } return result; }
Nothing else to do !
EVSClient configuration
In EVSClient, you need to add an entry in the Calling Tool list (from Administration menu) in order to tell the tool from where the results come. In this way, the EVSClient will be able to send back the result of the validation to your tool (only the OID is sent and can be reused in the future to retrieve the status and link of the validation report).
If your tool is neither a Gazelle proxy nor a Gazelle Test Management instance and you want the EVSClient to send back the result, you need to update the sendBackResultToTool() method from XMLResultDisplayManager and AbstractResultDisplayManager classes.