Attention une mise à jour du service Gitlab va être effectuée le mardi 14 décembre entre 13h30 et 14h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes.

Commit b1373515 authored by Franck Desaize's avatar Franck Desaize
Browse files

PATREG-162/125

parent 6393053c
Pipeline #261350 failed with stages
in 69 minutes and 22 seconds
......@@ -7,7 +7,7 @@ import com.gitb.ps.ProcessingService;
import com.gitb.tr.BAR;
import com.gitb.tr.TAR;
import com.gitb.tr.TestResultType;
import net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientRegistryGITBWebserviceConstants;
import net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientProcessingWebserviceConstants;
import net.ihe.gazelle.app.patientregistryapi.application.PatientFeedException;
import net.ihe.gazelle.app.patientregistryapi.application.PatientFeedService;
import net.ihe.gazelle.app.patientregistryapi.business.Patient;
......@@ -19,7 +19,7 @@ import net.ihe.gazelle.lib.gitbutils.adapter.MappingException;
import java.net.URL;
import java.util.List;
import static net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientRegistryGITBWebserviceConstants.*;
import static net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientProcessingWebserviceConstants.*;
/**
* PatientFeed Client to be used by any application that wants to feed a patient to a remote Patient Registry.
......@@ -54,7 +54,7 @@ public class PatientFeedClient implements PatientFeedService {
@Override
public String feedPatient(Patient patient) throws PatientFeedException {
ProcessRequest processRequest = new ProcessRequest();
processRequest.setOperation(PatientRegistryGITBWebserviceConstants.PATIENT_FEED_OPERATION);
processRequest.setOperation(PatientProcessingWebserviceConstants.PATIENT_FEED_OPERATION);
AnyContent patientToFeedAnyContent = null;
try {
patientToFeedAnyContent = new MapperObjectToAnyContent().getAnyContent(PATIENT_INPUT_NAME, patient);
......
......@@ -11,8 +11,8 @@ import net.ihe.gazelle.lib.gitbutils.adapter.MappingException;
import java.math.BigInteger;
import static net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientRegistryGITBWebserviceConstants.PATIENT_INPUT_NAME;
import static net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientRegistryGITBWebserviceConstants.UUID_OUTPUT_NAME;
import static net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientProcessingWebserviceConstants.PATIENT_INPUT_NAME;
import static net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientProcessingWebserviceConstants.UUID_OUTPUT_NAME;
import static org.junit.jupiter.api.Assertions.fail;
/**
......
package net.ihe.gazelle.app.patientregistryapi.adapter.ws;
/**
* This class is used to store all constant values used by Patient Registry in X-ref Processing Service.
*/
public class CrossReferenceProcessingWebServiceConstants {
public static final String CROSS_REFERENCE_PROCESSING_SERVICE = "xref-processing-service";
public static final String CROSS_REFERENCE_PROCESSING_SERVICE_PORT = "XRefProcessingServicePort";
public static final String CROSS_REFERENCE_PATIENT_OUTPUT_NAME = "XRefPatient";
public static final String CROSS_REFERENCE_PATIENT_SEARCH_OPERATION = "XRefSearch";
public static final String CROSS_REFERENCE_INPUT_NAME = "CrossRefSourceIdentifier";
/**
* Private constructor to hide implicit one.
*/
private CrossReferenceProcessingWebServiceConstants() {
}
}
......@@ -2,11 +2,11 @@ package net.ihe.gazelle.app.patientregistryapi.adapter.ws;
/**
*
*This class is used to store all contant values used by Patient Registry Patient Feed Processing Service.
*This class is used to store all constant values used by Patient Registry Patient Feed Processing Service.
*/
public class PatientRegistryGITBWebserviceConstants {
public class PatientProcessingWebserviceConstants {
public static final String PATIENT_PROCESSING_SERVICE = "PatientProcessingServiceService";
public static final String PATIENT_PROCESSING_SERVICE = "patient-processing-service";
public static final String PATIENT_PROCESSING_SERVICE_PORT = "PatientProcessingServicePort";
public static final String PATIENT_FEED_OPERATION = "PatientFeed";
public static final String PATIENT_SEARCH_OPERATION = "PatientSearch";
......@@ -18,6 +18,6 @@ public class PatientRegistryGITBWebserviceConstants {
/**
* Private constructor to hide implicit one.
*/
private PatientRegistryGITBWebserviceConstants(){
private PatientProcessingWebserviceConstants(){
}
}
package net.ihe.gazelle.app.patientregistryapi.application;
import net.ihe.gazelle.app.patientregistryapi.business.EntityIdentifier;
import net.ihe.gazelle.app.patientregistryapi.business.PatientAliases;
import net.ihe.gazelle.lib.searchmodelapi.business.exception.SearchException;
......@@ -12,9 +13,9 @@ public interface PatientCrossReferenceSearch {
/**
* retrieve the patient alias corresponding to the requested
*
* @param key the search key
* @param sourceIdentifier identifier of the reference patient
* @return the list of patient aliases matching
* @throws SearchException if an error happens during the search processing.
*/
PatientAliases search(String key) throws SearchException;
PatientAliases search(EntityIdentifier sourceIdentifier) throws SearchException;
}
......@@ -7,7 +7,7 @@ import com.gitb.ps.ProcessingService;
import com.gitb.tr.BAR;
import com.gitb.tr.TAR;
import com.gitb.tr.TestResultType;
import net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientRegistryGITBWebserviceConstants;
import net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientProcessingWebserviceConstants;
import net.ihe.gazelle.app.patientregistryapi.application.PatientSearchService;
import net.ihe.gazelle.app.patientregistryapi.business.Patient;
import net.ihe.gazelle.lib.gitbprocessingclient.adapter.GITBClientProcessImpl;
......@@ -21,8 +21,8 @@ import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import static net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientRegistryGITBWebserviceConstants.PATIENT_PROCESSING_SERVICE;
import static net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientRegistryGITBWebserviceConstants.PATIENT_PROCESSING_SERVICE_PORT;
import static net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientProcessingWebserviceConstants.PATIENT_PROCESSING_SERVICE;
import static net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientProcessingWebserviceConstants.PATIENT_PROCESSING_SERVICE_PORT;
/**
* PatientFeed Client to be used by any application that wants to feed a patient to a remote Patient Registry.
......@@ -57,10 +57,10 @@ public class PatientSearchClient implements PatientSearchService {
@Override
public List<Patient> search(SearchCriteria searchCriteria) throws SearchException{
ProcessRequest processRequest = new ProcessRequest();
processRequest.setOperation(PatientRegistryGITBWebserviceConstants.PATIENT_SEARCH_OPERATION);
processRequest.setOperation(PatientProcessingWebserviceConstants.PATIENT_SEARCH_OPERATION);
try {
AnyContent searchCriteriaAnyContent = new MapperObjectToAnyContent()
.getAnyContent(PatientRegistryGITBWebserviceConstants.PATIENT_SEARCH_CRITERIA_INPUT_NAME, searchCriteria);
.getAnyContent(PatientProcessingWebserviceConstants.PATIENT_SEARCH_CRITERIA_INPUT_NAME, searchCriteria);
processRequest.getInput().add(searchCriteriaAnyContent);
ProcessResponse processResponse = processingClient.process(processRequest);
return extractPatientsFromProcessResponse(processResponse);
......
......@@ -14,8 +14,8 @@ import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import static net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientRegistryGITBWebserviceConstants.PATIENT_INPUT_NAME;
import static net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientRegistryGITBWebserviceConstants.PATIENT_LIST_OUTPUT_NAME;
import static net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientProcessingWebserviceConstants.PATIENT_INPUT_NAME;
import static net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientProcessingWebserviceConstants.PATIENT_LIST_OUTPUT_NAME;
import static org.junit.jupiter.api.Assertions.fail;
/**
......
package net.ihe.gazelle.app.patientregistryservice.adapter.ws;
import com.gitb.ps.Void;
import com.gitb.ps.*;
import net.ihe.gazelle.app.patientregistryapi.adapter.ws.CrossReferenceProcessingWebServiceConstants;
import net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientProcessingWebserviceConstants;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.jws.WebService;
@Stateless
@WebService(
name = CrossReferenceProcessingWebServiceConstants.CROSS_REFERENCE_PROCESSING_SERVICE,
portName = PatientProcessingWebserviceConstants.PATIENT_PROCESSING_SERVICE_PORT,
targetNamespace = "http://www.gitb.com/ps/v1/",
endpointInterface = "com.gitb.ps.ProcessingService")
public class CrossReferenceProcessingService implements ProcessingService {
private static final String UNSUPPORTED_OPERATION = "Unsupported Operation";
@Inject
CrossReferenceSearchProcessingService crossReferenceSearchProcessingService;
/**
* Default constructor, used for injection.
*/
public CrossReferenceProcessingService() {
}
/**
* Constructor with dependencies.
*
* @param crossReferenceSearchProcessingService application service to use to process X-Ref search requests.
*/
public CrossReferenceProcessingService(CrossReferenceSearchProcessingService crossReferenceSearchProcessingService) {
this.crossReferenceSearchProcessingService = crossReferenceSearchProcessingService;
}
@Override
public GetModuleDefinitionResponse getModuleDefinition(Void parameters) {
throw new UnsupportedOperationException(UNSUPPORTED_OPERATION);
}
@Override
public ProcessResponse process(ProcessRequest processRequest) {
if (processRequest != null) {
if (CrossReferenceProcessingWebServiceConstants.CROSS_REFERENCE_PATIENT_SEARCH_OPERATION.equals(processRequest.getOperation())) {
return crossReferenceSearchProcessingService.processPatientCrossReferenceSearch(processRequest);
} else {
throw new UnsupportedOperationException(String.format("ProcessRequest.operation shall be %s !",
CrossReferenceProcessingWebServiceConstants.CROSS_REFERENCE_PATIENT_SEARCH_OPERATION));
}
} else {
throw new IllegalArgumentException("ProcessRequest shall not be null !");
}
}
@Override
public BeginTransactionResponse beginTransaction(BeginTransactionRequest parameters) {
throw new UnsupportedOperationException(UNSUPPORTED_OPERATION);
}
@Override
public Void endTransaction(BasicRequest parameters) {
throw new UnsupportedOperationException(UNSUPPORTED_OPERATION);
}
}
package net.ihe.gazelle.app.patientregistryservice.adapter.ws;
import com.gitb.core.AnyContent;
import com.gitb.ps.ProcessRequest;
import com.gitb.ps.ProcessResponse;
import com.gitb.tr.TAR;
import com.gitb.tr.TestResultType;
import net.ihe.gazelle.app.patientregistryapi.adapter.ws.CrossReferenceProcessingWebServiceConstants;
import net.ihe.gazelle.app.patientregistryapi.application.PatientCrossReferenceSearch;
import net.ihe.gazelle.app.patientregistryapi.business.EntityIdentifier;
import net.ihe.gazelle.app.patientregistryapi.business.PatientAliases;
import net.ihe.gazelle.lib.gitbutils.adapter.GITBAnyContentType;
import net.ihe.gazelle.lib.gitbutils.adapter.MapperAnyContentToObject;
import net.ihe.gazelle.lib.gitbutils.adapter.MapperObjectToAnyContent;
import net.ihe.gazelle.lib.gitbutils.adapter.MappingException;
import net.ihe.gazelle.lib.searchmodelapi.business.exception.SearchException;
import javax.inject.Inject;
import java.util.List;
/**
* Processing service for Patient X-Ref Search requests.
*/
public class CrossReferenceSearchProcessingService {
private MapperAnyContentToObject mapper;
private PatientCrossReferenceSearch crossReferenceSearch;
/**
* Constructor for the class with all needed parameters
*
* @param crossReferenceSearch : Application service to search CrossReference
*/
@Inject
public CrossReferenceSearchProcessingService(PatientCrossReferenceSearch crossReferenceSearch) {
this.mapper = new MapperAnyContentToObject();
this.crossReferenceSearch = crossReferenceSearch;
}
/**
* Process the Cross Reference Patient Search .
*
* @param processRequest : GITB request received.
* @return ProcessResponse corresponding to the received request
*/
public ProcessResponse processPatientCrossReferenceSearch(ProcessRequest processRequest) {
PatientAliases patient;
List<AnyContent> searchParameter = processRequest.getInput();
if (searchParameter.size() != 1) {
throw new IllegalArgumentException("ProcessRequest.input shall contain one and only one patient !");
} else if (!CrossReferenceProcessingWebServiceConstants.CROSS_REFERENCE_INPUT_NAME.equals(searchParameter.get(0).getName())) {
throw new IllegalArgumentException(String.format("ProcessRequest.input shall have the name '%s' for a %s operation !",
CrossReferenceProcessingWebServiceConstants.CROSS_REFERENCE_INPUT_NAME,
CrossReferenceProcessingWebServiceConstants.CROSS_REFERENCE_PATIENT_SEARCH_OPERATION));
}
try {
patient = crossReferenceSearch.search(mapper.getObject(searchParameter.get(0), EntityIdentifier.class));
return createPatientSearchProcessResponse(patient);
} catch (MappingException e) {
throw new IllegalArgumentException("Cannot decode Request inputs as SourceIdentifier !", e);
} catch (SearchException e) {
return ProcessResponseWithReportCreator.createFailedProcessResponse(e, searchParameter.get(0));
}
}
/**
* Create a {@link ProcessResponse} to a {@link ProcessRequest} sent to this service after a successful processing.
* The response will contain a {@link TAR} report containing the result Status for the processing operation,
* as well as a single Output containing the X-ref returned.
*
* @param xRefPatient : List of {@link PatientAliases} returned by the search service.
* @return the process response to return to the WebService
*/
private ProcessResponse createPatientSearchProcessResponse(PatientAliases xRefPatient) throws SearchException {
AnyContent patientAliasesAnyContent;
ProcessResponse processResponse = new ProcessResponse();
if (xRefPatient == null) {
throw new IllegalArgumentException("Successful operation shall return a not null Patient Aliases as an output !");
}
try {
patientAliasesAnyContent =
new MapperObjectToAnyContent().getAnyContent(CrossReferenceProcessingWebServiceConstants.CROSS_REFERENCE_PATIENT_OUTPUT_NAME,
xRefPatient);
if (patientAliasesAnyContent == null) {
patientAliasesAnyContent = new AnyContent();
patientAliasesAnyContent.setName(CrossReferenceProcessingWebServiceConstants.CROSS_REFERENCE_PATIENT_OUTPUT_NAME);
patientAliasesAnyContent.setType(GITBAnyContentType.OBJECT.getGitbType());
}
} catch (MappingException e) {
throw new SearchException("Search request response cannot be mapped to GITB AnyContent !", e);
}
processResponse.getOutput().add(patientAliasesAnyContent);
processResponse.setReport(ProcessResponseWithReportCreator.createReport(TestResultType.SUCCESS));
return processResponse;
}
}
......@@ -5,7 +5,7 @@ import com.gitb.ps.ProcessRequest;
import com.gitb.ps.ProcessResponse;
import com.gitb.tr.TAR;
import com.gitb.tr.TestResultType;
import net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientRegistryGITBWebserviceConstants;
import net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientProcessingWebserviceConstants;
import net.ihe.gazelle.app.patientregistryapi.application.PatientFeedException;
import net.ihe.gazelle.app.patientregistryapi.application.PatientFeedService;
import net.ihe.gazelle.app.patientregistryapi.business.Patient;
......@@ -44,9 +44,9 @@ public class PatientFeedProcessingService {
List<AnyContent> patientToFeed = processRequest.getInput();
if (patientToFeed.size() != 1){
throw new IllegalArgumentException("ProcessRequest.input shall contain one and only one patient !");
} else if (!PatientRegistryGITBWebserviceConstants.PATIENT_INPUT_NAME.equals(patientToFeed.get(0).getName())){
} else if (!PatientProcessingWebserviceConstants.PATIENT_INPUT_NAME.equals(patientToFeed.get(0).getName())){
throw new IllegalArgumentException(String.format("ProcessRequest.input shall have the name '%s' for a %s operation !",
PatientRegistryGITBWebserviceConstants.PATIENT_INPUT_NAME, PatientRegistryGITBWebserviceConstants.PATIENT_FEED_OPERATION));
PatientProcessingWebserviceConstants.PATIENT_INPUT_NAME, PatientProcessingWebserviceConstants.PATIENT_FEED_OPERATION));
}
try {
uuidOfFedPatient = patientFeedService.feedPatient(mapper.getObject(patientToFeed.get(0), Patient.class));
......@@ -73,7 +73,7 @@ public class PatientFeedProcessingService {
}
AnyContent uuidAnyContent;
try {
uuidAnyContent = new MapperObjectToAnyContent().getAnyContent(PatientRegistryGITBWebserviceConstants.UUID_OUTPUT_NAME, uuid);
uuidAnyContent = new MapperObjectToAnyContent().getAnyContent(PatientProcessingWebserviceConstants.UUID_OUTPUT_NAME, uuid);
} catch (MappingException e){
throw new PatientFeedException("Cannot map assigned UUID to AnyContent !");
}
......
......@@ -2,19 +2,19 @@ package net.ihe.gazelle.app.patientregistryservice.adapter.ws;
import com.gitb.ps.Void;
import com.gitb.ps.*;
import net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientRegistryGITBWebserviceConstants;
import net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientProcessingWebserviceConstants;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.jws.WebService;
/**
* Patient Processing Service. Supports PatientFeed and PatientSearch operations.
* Patient Processing Service. Supports PatientFeed, PatientSearch and XRefSearch operations.
*/
@Stateless
@WebService(
name = "processing-service",
portName = "PatientProcessingServicePort",
name = PatientProcessingWebserviceConstants.PATIENT_PROCESSING_SERVICE,
portName = PatientProcessingWebserviceConstants.PATIENT_PROCESSING_SERVICE_PORT,
targetNamespace = "http://www.gitb.com/ps/v1/",
endpointInterface = "com.gitb.ps.ProcessingService")
public class PatientProcessingService implements ProcessingService {
......@@ -35,8 +35,9 @@ public class PatientProcessingService implements ProcessingService {
/**
* Constructor with dependencies.
* @param patientFeedService application service to use to process PatientFeed requests.
* @param patientSearchProcessingService application service to use to process PatientSearch requests.
*
* @param patientFeedService application service to use to process PatientFeed requests.
* @param patientSearchProcessingService application service to use to process PatientSearch requests.
*/
public PatientProcessingService(PatientFeedProcessingService patientFeedService,
PatientSearchProcessingService patientSearchProcessingService) {
......@@ -57,15 +58,15 @@ public class PatientProcessingService implements ProcessingService {
*/
@Override
public ProcessResponse process(ProcessRequest processRequest) {
if(processRequest != null){
if (PatientRegistryGITBWebserviceConstants.PATIENT_FEED_OPERATION.equals(processRequest.getOperation())){
if (processRequest != null) {
if (PatientProcessingWebserviceConstants.PATIENT_FEED_OPERATION.equals(processRequest.getOperation())) {
return patientFeedProcessingService.processPatientFeed(processRequest);
} else if (PatientRegistryGITBWebserviceConstants.PATIENT_SEARCH_OPERATION.equals(processRequest.getOperation())){
} else if (PatientProcessingWebserviceConstants.PATIENT_SEARCH_OPERATION.equals(processRequest.getOperation())) {
return patientSearchProcessingService.processPatientSearch(processRequest);
} else {
throw new UnsupportedOperationException(String.format("ProcessRequest.operation shall be %s or %s!",
PatientRegistryGITBWebserviceConstants.PATIENT_FEED_OPERATION,
PatientRegistryGITBWebserviceConstants.PATIENT_SEARCH_OPERATION));
PatientProcessingWebserviceConstants.PATIENT_FEED_OPERATION,
PatientProcessingWebserviceConstants.PATIENT_SEARCH_OPERATION));
}
} else {
throw new IllegalArgumentException("ProcessRequest shall not be null !");
......
......@@ -5,7 +5,7 @@ import com.gitb.ps.ProcessRequest;
import com.gitb.ps.ProcessResponse;
import com.gitb.tr.TAR;
import com.gitb.tr.TestResultType;
import net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientRegistryGITBWebserviceConstants;
import net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientProcessingWebserviceConstants;
import net.ihe.gazelle.app.patientregistryapi.application.PatientSearchService;
import net.ihe.gazelle.app.patientregistryapi.business.Patient;
import net.ihe.gazelle.lib.gitbutils.adapter.GITBAnyContentType;
......@@ -47,9 +47,9 @@ public class PatientSearchProcessingService {
List<AnyContent> searchCriteria = processRequest.getInput();
if (searchCriteria.size() != 1){
throw new IllegalArgumentException("ProcessRequest.input shall contain one and only one patient !");
} else if (!PatientRegistryGITBWebserviceConstants.PATIENT_SEARCH_CRITERIA_INPUT_NAME.equals(searchCriteria.get(0).getName())){
} else if (!PatientProcessingWebserviceConstants.PATIENT_SEARCH_CRITERIA_INPUT_NAME.equals(searchCriteria.get(0).getName())){
throw new IllegalArgumentException(String.format("ProcessRequest.input shall have the name '%s' for a %s operation !",
PatientRegistryGITBWebserviceConstants.PATIENT_SEARCH_CRITERIA_INPUT_NAME, PatientRegistryGITBWebserviceConstants.PATIENT_SEARCH_OPERATION));
PatientProcessingWebserviceConstants.PATIENT_SEARCH_CRITERIA_INPUT_NAME, PatientProcessingWebserviceConstants.PATIENT_SEARCH_OPERATION));
}
try {
patients = patientSearchService.search(mapper.getObject(searchCriteria.get(0), SearchCriteria.class));
......@@ -75,10 +75,10 @@ public class PatientSearchProcessingService {
throw new IllegalArgumentException("Successful operation shall return a not null List of Patients as an output !");
}
try {
patientListAnyContent = new MapperObjectToAnyContent().getAnyContent(PatientRegistryGITBWebserviceConstants.PATIENT_LIST_OUTPUT_NAME, patients);
patientListAnyContent = new MapperObjectToAnyContent().getAnyContent(PatientProcessingWebserviceConstants.PATIENT_LIST_OUTPUT_NAME, patients);
if (patientListAnyContent == null){
patientListAnyContent = new AnyContent();
patientListAnyContent.setName(PatientRegistryGITBWebserviceConstants.PATIENT_LIST_OUTPUT_NAME);
patientListAnyContent.setName(PatientProcessingWebserviceConstants.PATIENT_LIST_OUTPUT_NAME);
patientListAnyContent.setType(GITBAnyContentType.LIST.getGitbType());
}
} catch (MappingException e){
......
package net.ihe.gazelle.app.patientregistryservice.adapter.ws;
import com.gitb.ps.Void;
import com.gitb.ps.*;
import net.ihe.gazelle.app.patientregistryapi.adapter.ws.CrossReferenceProcessingWebServiceConstants;
import net.ihe.gazelle.app.patientregistryapi.business.EntityIdentifier;
import net.ihe.gazelle.lib.gitbutils.adapter.MapperObjectToAnyContent;
import net.ihe.gazelle.lib.gitbutils.adapter.MappingException;
import org.junit.Assert;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import javax.validation.constraints.AssertTrue;
import static org.junit.jupiter.api.Assertions.*;
/**
* Tests for class {@link CrossReferenceProcessingService}
*/
class CrossReferenceProcessingServiceTest {
private CrossReferenceProcessingService crossReferenceProcessingService;
/**
* Initialize implementations to be tested before each test.
*/
@BeforeEach
public void setUp() {
this.crossReferenceProcessingService =
new CrossReferenceProcessingService(new CrossReferenceSearchProcessingService(new PatientCrossReferenceSearchMock()));
}
/**
* Test Unsupported Operation getModuleDefinition
*/
@Test
public void getModuleDefinition() {
assertThrows(UnsupportedOperationException.class, () -> crossReferenceProcessingService.getModuleDefinition(new Void()));
}
/**
* Test Unsupported Operation beginTransaction
*/
@Test
public void beginTransaction() {
assertThrows(UnsupportedOperationException.class, () -> crossReferenceProcessingService.beginTransaction(new BeginTransactionRequest()));
}
/**
* Test Unsupported Operation endTransaction
*/
@Test
public void endTransaction() {
assertThrows(UnsupportedOperationException.class, () -> crossReferenceProcessingService.endTransaction(new BasicRequest()));
}
/**
* Test Processing a patient operation, error case using null ProcessRequest
*/
@Test
public void process_no_ProcessingRequest() {
assertThrows(IllegalArgumentException.class, () -> crossReferenceProcessingService.process(null));
}
/**
* Test Processing a patient operation, error case using wrong operation in ProcessRequest.
*/
@Test
public void process_Wrong_Operation() {
ProcessRequest processRequest = new ProcessRequest();
processRequest.setOperation("Wrong Operation");
assertThrows(UnsupportedOperationException.class, () -> crossReferenceProcessingService.process(processRequest));
}
/**
* Test Processing a x-Ref Search with mock
*/