Commit 4aae0e25 authored by Franck Desaize's avatar Franck Desaize
Browse files

Add targetDomains

parent f5b74cd8
Pipeline #263875 failed with stages
in 6 minutes and 49 seconds
......@@ -11,6 +11,7 @@ public class CrossReferenceProcessingWebServiceConstants {
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";
public static final String CROSS_REFERENCE_INPUT_TARGET_NAME = "CrossRefTargetDomains";
/**
* Private constructor to hide implicit one.
......
......@@ -16,10 +16,10 @@ public interface PatientCrossReferenceSearch {
* retrieve the patient alias corresponding to the requested
*
* @param sourceIdentifier identifier of the reference patient
* @param targetDomains list of TargetDomains to pro
* @return a patient aliases that match the patient with sourceIdentifier
* @throws SearchCrossReferenceException if an error happens during the search processing.
*/
PatientAliases search(EntityIdentifier sourceIdentifier, List<String> targetDomains) throws SearchCrossReferenceException, UnrecognizedDomainException;
PatientAliases search(EntityIdentifier sourceIdentifier, List<String> targetDomains) throws SearchCrossReferenceException;
// PatientAliases searchInTargetDomain(EntityIdentifier sourceIdentifier, List<String> targetDomains) throws SearchCrossReferenceException, UnrecognizedDomainException;
}
......@@ -16,6 +16,7 @@ import net.ihe.gazelle.lib.gitbutils.adapter.MapperObjectToAnyContent;
import net.ihe.gazelle.lib.gitbutils.adapter.MappingException;
import javax.inject.Inject;
import java.util.Collections;
import java.util.List;
/**
......@@ -47,15 +48,16 @@ public class CrossReferenceSearchProcessingService {
public ProcessResponse processPatientCrossReferenceSearch(ProcessRequest processRequest) {
PatientAliases patientAliases;
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())) {
if (searchParameter.size() != 2) {
throw new IllegalArgumentException("ProcessRequest.input shall contain two parameters to retrieve Xref !");
} else if (!CrossReferenceProcessingWebServiceConstants.CROSS_REFERENCE_INPUT_NAME.equals(searchParameter.get(0).getName()) || !CrossReferenceProcessingWebServiceConstants.CROSS_REFERENCE_INPUT_TARGET_NAME.equals(searchParameter.get(1).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 {
patientAliases = crossReferenceSearch.search(mapper.getObject(searchParameter.get(0), EntityIdentifier.class));
patientAliases = crossReferenceSearch.search(mapper.getObject(searchParameter.get(0), EntityIdentifier.class),
mapper.getObjectCollection(searchParameter.get(1), List.class,String.class));
return createPatientSearchProcessResponse(patientAliases);
} catch (MappingException e) {
throw new IllegalArgumentException("Cannot decode Request inputs as SourceIdentifier !", e);
......
......@@ -38,7 +38,7 @@ public class PatientCrossReferenceSearchImpl implements PatientCrossReferenceSea
* @throws SearchCrossReferenceException
*/
@Override
public PatientAliases search(EntityIdentifier sourceIdentifier) throws SearchCrossReferenceException {
public PatientAliases search(EntityIdentifier sourceIdentifier,List<String>targetDomains) throws SearchCrossReferenceException {
checkSourceIdentifier(sourceIdentifier);
PatientDB patientDB = null;
......@@ -57,34 +57,15 @@ public class PatientCrossReferenceSearchImpl implements PatientCrossReferenceSea
throw new SearchCrossReferenceException("Error in the sourceIdentifier : it doesn't match any Patient");
}
if (searchCrossReferenceException.getMessage().equals("Search error : No X-ref for given Patient")) {
//TODO create a patient / patientAliases via the DAO ?
return convertPatientDBToPatientAliases(patientDB);
}
} catch (Exception exception) {
// }catch (UnrecognizedDomainException exception) {
// throw new SearchCrossReferenceException("An Error occurred during CrossReference Search",exception);
}catch(Exception exception) {
throw new SearchCrossReferenceException("An Error occurred during CrossReference Search", exception);
}
return patientAlias;
}
/**
* Search for a patient alias by a source identifier, in a list of target domain.
* Any patient that do not match the list of target domain will be deleted
*
* @param sourceIdentifier
* @param entityIdentifiers
* @return
* @throws SearchCrossReferenceException
* @throws UnrecognizedDomainException
*/
@Override
public PatientAliases searchInTargetDomain(EntityIdentifier sourceIdentifier, List<EntityIdentifier> entityIdentifiers) throws SearchCrossReferenceException, UnrecognizedDomainException {
checkSourceIdentifier(sourceIdentifier);
checkTargetDomains(sourceIdentifier, entityIdentifiers);
PatientAliases patientAlias = search(sourceIdentifier);
return removePatientWithNonMatchingTargetDomain(patientAlias, entityIdentifiers);
}
/**
* Delete every patient (of a patient aliases) where its uuid does not match the system identifier of any currently in the list
*
......
......@@ -2,6 +2,7 @@ package net.ihe.gazelle.app.patientregistryservice.adapter.ws;
import com.gitb.ps.Void;
import com.gitb.ps.*;
import io.cucumber.java.it.Ma;
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;
......@@ -9,6 +10,9 @@ import net.ihe.gazelle.lib.gitbutils.adapter.MappingException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;
import static org.junit.jupiter.api.Assertions.*;
/**
......@@ -80,10 +84,14 @@ class CrossReferenceProcessingServiceTest {
EntityIdentifier sourceIdentifier = new EntityIdentifier();
sourceIdentifier.setSystemIdentifier("identifierSystem");
sourceIdentifier.setValue("identifierValue");
List<String> targetDomains = new ArrayList<>();
targetDomains.add("test");
ProcessRequest processRequest = new ProcessRequest();
processRequest.setOperation(CrossReferenceProcessingWebServiceConstants.CROSS_REFERENCE_PATIENT_SEARCH_OPERATION);
try {
processRequest.getInput().add(new MapperObjectToAnyContent().getAnyContent(CrossReferenceProcessingWebServiceConstants.CROSS_REFERENCE_INPUT_NAME, sourceIdentifier));
processRequest.getInput().add(new MapperObjectToAnyContent().getAnyContent(CrossReferenceProcessingWebServiceConstants.CROSS_REFERENCE_INPUT_TARGET_NAME,targetDomains));
} catch (MappingException e) {
fail("No exception is supposed to be thrown when transforming test patient to AnyContent !", e);
}
......
......@@ -54,6 +54,7 @@ class CrossReferenceSearchProcessingServiceTest {
EntityIdentifier sourceIdentifier2 = new EntityIdentifier();
sourceIdentifier2.setSystemIdentifier("identifierSystem2");
sourceIdentifier2.setValue("identifierValue2");
try {
processRequest.getInput().add(new MapperObjectToAnyContent().getAnyContent(CrossReferenceProcessingWebServiceConstants.CROSS_REFERENCE_INPUT_NAME, sourceIdentifier));
processRequest.getInput().add(new MapperObjectToAnyContent().getAnyContent(CrossReferenceProcessingWebServiceConstants.CROSS_REFERENCE_INPUT_NAME, sourceIdentifier2));
......
......@@ -13,7 +13,7 @@ import java.util.List;
public class PatientCrossReferenceSearchMock implements PatientCrossReferenceSearch {
@Override
public PatientAliases search(EntityIdentifier sourceIdentifier) throws SearchCrossReferenceException {
public PatientAliases search(EntityIdentifier sourceIdentifier,List<String>targetDomains) throws SearchCrossReferenceException {
if (sourceIdentifier.getSystemIdentifier().equals("identifierSystem")) {
PatientAliases patientAliases = new PatientAliases();
patientAliases.setUuid("123456789");
......@@ -30,9 +30,4 @@ public class PatientCrossReferenceSearchMock implements PatientCrossReferenceSea
}
}
@Override
public PatientAliases searchInTargetDomain(EntityIdentifier sourceIdentifier, List<EntityIdentifier> entityIdentifierList) throws SearchCrossReferenceException, UnrecognizedDomainException {
return null;
}
}
......@@ -6,8 +6,6 @@ import net.ihe.gazelle.app.patientregistryapi.application.UnrecognizedDomainExce
import net.ihe.gazelle.app.patientregistryapi.business.EntityIdentifier;
import net.ihe.gazelle.app.patientregistryapi.business.Patient;
import net.ihe.gazelle.app.patientregistryapi.business.PatientAliases;
import net.ihe.gazelle.app.patientregistryservice.adapter.dao.pamsimulator.model.patient.PatientDB;
import net.ihe.gazelle.app.patientregistryservice.adapter.dao.pamsimulator.model.references.CrossReferenceDB;
import org.junit.Assert;
import org.junit.jupiter.api.Test;
......@@ -15,7 +13,8 @@ import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.fail;
public class PatientCrossReferenceSearchImplTest {
......@@ -27,15 +26,16 @@ public class PatientCrossReferenceSearchImplTest {
@Test
public void searchTestWithNullSourceIdentifier() {
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class, () -> patientCrossReferenceSearch.search(null));
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class, () -> patientCrossReferenceSearch.search(null,null));
assertEquals("The source identifier cannot be null", exception.getMessage());
}
@Test
public void searchTestWithNullSystemIdentifier() {
EntityIdentifier sourceIdentifier = new EntityIdentifier();
List<String> targetDomains = new ArrayList<>();
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class,
() -> patientCrossReferenceSearch.search(sourceIdentifier));
() -> patientCrossReferenceSearch.search(sourceIdentifier,targetDomains));
assertEquals("The system identifier from sourceIdentifier cannot be null or empty", exception.getMessage());
}
......@@ -44,8 +44,9 @@ public class PatientCrossReferenceSearchImplTest {
public void searchTestWithBlankSystemIdentifier() {
EntityIdentifier sourceIdentifier = new EntityIdentifier();
sourceIdentifier.setSystemIdentifier("");
List<String> targetDomains = new ArrayList<>();
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class,
() -> patientCrossReferenceSearch.search(sourceIdentifier));
() -> patientCrossReferenceSearch.search(sourceIdentifier,targetDomains));
assertEquals("The system identifier from sourceIdentifier cannot be null or empty", exception.getMessage());
}
......@@ -54,8 +55,9 @@ public class PatientCrossReferenceSearchImplTest {
public void searchTestWithNullValue() {
EntityIdentifier sourceIdentifier = new EntityIdentifier();
sourceIdentifier.setSystemIdentifier("toto");
List<String> targetDomains = new ArrayList<>();
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class,
() -> patientCrossReferenceSearch.search(sourceIdentifier));
() -> patientCrossReferenceSearch.search(sourceIdentifier,targetDomains));
assertEquals("The value from sourceIdentifier cannot be null or empty", exception.getMessage());
}
......@@ -65,8 +67,9 @@ public class PatientCrossReferenceSearchImplTest {
EntityIdentifier sourceIdentifier = new EntityIdentifier();
sourceIdentifier.setSystemIdentifier("toto");
sourceIdentifier.setValue("");
List<String> targetDomains = new ArrayList<>();
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class,
() -> patientCrossReferenceSearch.search(sourceIdentifier));
() -> patientCrossReferenceSearch.search(sourceIdentifier,targetDomains));
assertEquals("The value from sourceIdentifier cannot be null or empty", exception.getMessage());
}
......@@ -75,8 +78,9 @@ public class PatientCrossReferenceSearchImplTest {
EntityIdentifier sourceIdentifier = new EntityIdentifier();
sourceIdentifier.setSystemIdentifier("toto");
sourceIdentifier.setValue("SystemNotFound");
List<String> targetDomains = new ArrayList<>();
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class,
() -> patientCrossReferenceSearch.search(sourceIdentifier));
() -> patientCrossReferenceSearch.search(sourceIdentifier,targetDomains));
assertEquals("Error in the sourceIdentifier : System doesn't exit", exception.getMessage());
}
......@@ -86,8 +90,9 @@ public class PatientCrossReferenceSearchImplTest {
EntityIdentifier sourceIdentifier = new EntityIdentifier();
sourceIdentifier.setSystemIdentifier("toto");
sourceIdentifier.setValue("UnexpectedException");
List<String> targetDomains = new ArrayList<>();
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class,
() -> patientCrossReferenceSearch.search(sourceIdentifier));
() -> patientCrossReferenceSearch.search(sourceIdentifier,targetDomains));
assertEquals("An Error occurred during CrossReference Search", exception.getMessage());
}
......@@ -97,8 +102,9 @@ public class PatientCrossReferenceSearchImplTest {
EntityIdentifier sourceIdentifier = new EntityIdentifier();
sourceIdentifier.setSystemIdentifier("toto");
sourceIdentifier.setValue("PatientIdentifiernotfound");
List<String> targetDomains = new ArrayList<>();
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class,
() -> patientCrossReferenceSearch.search(sourceIdentifier));
() -> patientCrossReferenceSearch.search(sourceIdentifier,targetDomains));
assertEquals("Error in the sourceIdentifier : it doesn't match any identity", exception.getMessage());
}
......@@ -108,8 +114,9 @@ public class PatientCrossReferenceSearchImplTest {
EntityIdentifier sourceIdentifier = new EntityIdentifier();
sourceIdentifier.setSystemIdentifier("toto");
sourceIdentifier.setValue("PatientNotFound");
List<String> targetDomains = new ArrayList<>();
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class,
() -> patientCrossReferenceSearch.search(sourceIdentifier));
() -> patientCrossReferenceSearch.search(sourceIdentifier,targetDomains));
assertEquals("Error in the sourceIdentifier : it doesn't match any Patient", exception.getMessage());
}
......@@ -119,7 +126,8 @@ public class PatientCrossReferenceSearchImplTest {
EntityIdentifier sourceIdentifier = new EntityIdentifier();
sourceIdentifier.setSystemIdentifier("toto");
sourceIdentifier.setValue("NoXCrossrefFound");
PatientAliases patientAliases = patientCrossReferenceSearch.search(sourceIdentifier);
List<String> targetDomains = new ArrayList<>();
PatientAliases patientAliases = patientCrossReferenceSearch.search(sourceIdentifier,targetDomains);
Assert.assertEquals("The X-ref shall contain only the patient matching with the sourceIdentifier, no cross ref has been found ", 1,
patientAliases.getMembers().size());
Assert.assertEquals("The X-ref shall contain only the patient matching with the sourceIdentifier, the uuid shall be : NoCrossRef",
......@@ -131,7 +139,8 @@ public class PatientCrossReferenceSearchImplTest {
EntityIdentifier sourceIdentifier = new EntityIdentifier();
sourceIdentifier.setSystemIdentifier("toto");
sourceIdentifier.setValue("1CrossFound");
PatientAliases patientAliases = patientCrossReferenceSearch.search(sourceIdentifier);
List<String> targetDomains = new ArrayList<>();
PatientAliases patientAliases = patientCrossReferenceSearch.search(sourceIdentifier,targetDomains);
for (Patient patient : patientAliases.getMembers()) {
if (patient.getUuid().equals("original")) {
fail();
......@@ -147,7 +156,8 @@ public class PatientCrossReferenceSearchImplTest {
EntityIdentifier sourceIdentifier = new EntityIdentifier();
sourceIdentifier.setSystemIdentifier("toto");
sourceIdentifier.setValue("3CrossFound");
PatientAliases patientAliases = patientCrossReferenceSearch.search(sourceIdentifier);
List<String> targetDomains = new ArrayList<>();
PatientAliases patientAliases = patientCrossReferenceSearch.search(sourceIdentifier,targetDomains);
for (Patient patient : patientAliases.getMembers()) {
if (patient.getUuid().equals("original3")) {
fail();
......@@ -175,8 +185,8 @@ public class PatientCrossReferenceSearchImplTest {
entityIdentifiers.add(sourceIdentifier1);
entityIdentifiers.add(entityIdentifier2);
entityIdentifiers.add(entityIdentifier3);
PatientAliases patientAliases = patientCrossReferenceSearch.searchInTargetDomain(sourceIdentifier1, entityIdentifiers);
List<String> targetDomains = new ArrayList<>();
PatientAliases patientAliases = patientCrossReferenceSearch.search(sourceIdentifier1, targetDomains);
assert (patientAliases.getMembers().size() == 0);
}
......@@ -198,8 +208,8 @@ public class PatientCrossReferenceSearchImplTest {
entityIdentifiers.add(sourceIdentifier1);
entityIdentifiers.add(entityIdentifier2);
entityIdentifiers.add(entityIdentifier3);
PatientAliases patientAliases = patientCrossReferenceSearch.searchInTargetDomain(sourceIdentifier1, entityIdentifiers);
List<String> targetDomains = new ArrayList<>();
PatientAliases patientAliases = patientCrossReferenceSearch.search(sourceIdentifier1, targetDomains);
assert (patientAliases.getMembers().size() == 1);
}
......@@ -220,8 +230,9 @@ public class PatientCrossReferenceSearchImplTest {
List<EntityIdentifier> entityIdentifiers = new ArrayList<>();
entityIdentifiers.add(entityIdentifier2);
entityIdentifiers.add(entityIdentifier3);
List<String> targetDomains = new ArrayList<>();
UnrecognizedDomainException exception = assertThrows(UnrecognizedDomainException.class,
() -> patientCrossReferenceSearch.searchInTargetDomain(entityIdentifier, entityIdentifiers));
() -> patientCrossReferenceSearch.search(entityIdentifier, targetDomains));
assertEquals("The current target domain could not be found", exception.getMessage());
}
......
......@@ -19,6 +19,7 @@ import net.ihe.gazelle.lib.gitbutils.adapter.MappingException;
import net.ihe.gazelle.lib.searchmodelapi.business.exception.SearchException;
import java.net.URL;
import java.util.List;
public class XRefSearchClient implements PatientCrossReferenceSearch {
......@@ -46,15 +47,19 @@ public class XRefSearchClient implements PatientCrossReferenceSearch {
}
@Override
public PatientAliases search(EntityIdentifier sourceIdentifier) throws SearchCrossReferenceException {
public PatientAliases search(EntityIdentifier sourceIdentifier, List<String> targetDomains) throws SearchCrossReferenceException {
ProcessRequest processRequest = new ProcessRequest();
processRequest.setOperation(CrossReferenceProcessingWebServiceConstants.CROSS_REFERENCE_PATIENT_SEARCH_OPERATION);
try {
AnyContent patientToFeedAnyContent =
AnyContent sourceIdentifierAnyContent =
new MapperObjectToAnyContent().getAnyContent(CrossReferenceProcessingWebServiceConstants.CROSS_REFERENCE_INPUT_NAME,
sourceIdentifier);
processRequest.getInput().add(patientToFeedAnyContent);
AnyContent targetDomainsAnyContent =
new MapperObjectToAnyContent().getAnyContent(CrossReferenceProcessingWebServiceConstants.CROSS_REFERENCE_INPUT_TARGET_NAME,
sourceIdentifier);
processRequest.getInput().add(sourceIdentifierAnyContent);
processRequest.getInput().add(targetDomainsAnyContent);
ProcessResponse processResponse = processingClient.process(processRequest);
return extractPatientAliasesFromProcessResponse(processResponse);
} catch (MappingException e) {
......
......@@ -6,6 +6,9 @@ import net.ihe.gazelle.app.patientregistryapi.business.PatientAliases;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
......@@ -37,7 +40,8 @@ class XRefSearchClientTest {
EntityIdentifier entityIdentifier = new EntityIdentifier();
entityIdentifier.setSystemIdentifier("test");
entityIdentifier.setValue("test");
PatientAliases patientAliases = xRefSearchClient.search(entityIdentifier);
List<String> targetDomain = new ArrayList<>();
PatientAliases patientAliases = xRefSearchClient.search(entityIdentifier, targetDomain);
assertEquals("123456789", patientAliases.getUuid(), "The result uuid shall be equal to the mocked one's : '123456789'");
}
......@@ -51,8 +55,9 @@ class XRefSearchClientTest {
EntityIdentifier entityIdentifier = new EntityIdentifier();
entityIdentifier.setSystemIdentifier("test");
entityIdentifier.setValue("test");
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class, () -> xRefSearchClient.search(entityIdentifier));
List<String> targetDomain = new ArrayList<>();
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class, () -> xRefSearchClient.search(entityIdentifier,
targetDomain));
assertEquals("Response from the distant CrossReferenceSearchProcessingService shall contain a report with " +
"the success status of the operation !", exception.getCause().getMessage());
}
......@@ -67,8 +72,9 @@ class XRefSearchClientTest {
EntityIdentifier entityIdentifier = new EntityIdentifier();
entityIdentifier.setSystemIdentifier("test");
entityIdentifier.setValue("test");
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class, () -> xRefSearchClient.search(entityIdentifier));
List<String> targetDomain = new ArrayList<>();
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class, () -> xRefSearchClient.search(entityIdentifier,
targetDomain));
assertEquals("Invalid Request sent to distant CrossReferenceSearchProcessingService !", exception.getMessage());
}
......@@ -81,8 +87,9 @@ class XRefSearchClientTest {
EntityIdentifier entityIdentifier = new EntityIdentifier();
entityIdentifier.setSystemIdentifier("test");
entityIdentifier.setValue("test");
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class, () -> xRefSearchClient.search(entityIdentifier));
List<String> targetDomain = new ArrayList<>();
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class, () -> xRefSearchClient.search(entityIdentifier,
targetDomain));
assertEquals("Response from the distant CrossReferenceSearchProcessingService shall contain a single output for PatientAliases !",
exception.getCause().getMessage());
}
......@@ -96,8 +103,9 @@ class XRefSearchClientTest {
EntityIdentifier entityIdentifier = new EntityIdentifier();
entityIdentifier.setSystemIdentifier("test");
entityIdentifier.setValue("test");
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class, () -> xRefSearchClient.search(entityIdentifier));
List<String> targetDomain = new ArrayList<>();
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class, () -> xRefSearchClient.search(entityIdentifier,
targetDomain));
assertEquals("Error while mapping processing output from distant CrossReferenceSearchProcessingService " +
"to PatientAliases !", exception.getCause().getMessage());
}
......@@ -111,8 +119,9 @@ class XRefSearchClientTest {
EntityIdentifier entityIdentifier = new EntityIdentifier();
entityIdentifier.setSystemIdentifier("test");
entityIdentifier.setValue("test");
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class, () -> xRefSearchClient.search(entityIdentifier));
List<String> targetDomain = new ArrayList<>();
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class, () -> xRefSearchClient.search(entityIdentifier,
targetDomain));
assertEquals("Empty Response from the distant CrossReferenceSearchProcessingService !", exception.getCause().getMessage());
}
......@@ -126,8 +135,9 @@ class XRefSearchClientTest {
EntityIdentifier entityIdentifier = new EntityIdentifier();
entityIdentifier.setSystemIdentifier("test");
entityIdentifier.setValue("test");
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class, () -> xRefSearchClient.search(entityIdentifier));
List<String> targetDomain = new ArrayList<>();
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class, () -> xRefSearchClient.search(entityIdentifier,
targetDomain));
assertEquals("Processing response with unexpected type WARNING ! Expected type is " +
"either SUCCESS or FAILURE.", exception.getCause().getMessage());
}
......@@ -141,8 +151,9 @@ class XRefSearchClientTest {
EntityIdentifier entityIdentifier = new EntityIdentifier();
entityIdentifier.setSystemIdentifier("test");
entityIdentifier.setValue("test");
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class, () -> xRefSearchClient.search(entityIdentifier));
List<String> targetDomain = new ArrayList<>();
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class, () -> xRefSearchClient.search(entityIdentifier,
targetDomain));
assertEquals("The report from the ProcessResponse shall not be null and shall contain a single error.", exception.getCause().getMessage());
}
......@@ -155,8 +166,9 @@ class XRefSearchClientTest {
EntityIdentifier entityIdentifier = new EntityIdentifier();
entityIdentifier.setSystemIdentifier("test");
entityIdentifier.setValue("test");
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class, () -> xRefSearchClient.search(entityIdentifier));
List<String> targetDomain = new ArrayList<>();
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class, () -> xRefSearchClient.search(entityIdentifier,
targetDomain));
assertEquals("The report from the ProcessResponse shall not be null and shall contain a single error.", exception.getCause().getMessage());
}
......@@ -169,8 +181,9 @@ class XRefSearchClientTest {
EntityIdentifier entityIdentifier = new EntityIdentifier();
entityIdentifier.setSystemIdentifier("test");
entityIdentifier.setValue("test");
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class, () -> xRefSearchClient.search(entityIdentifier));
List<String> targetDomain = new ArrayList<>();
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class, () -> xRefSearchClient.search(entityIdentifier,
targetDomain));
assertEquals("Error from ProcessResponse report must have a valid description !", exception.getCause().getMessage());
}
......@@ -183,8 +196,9 @@ class XRefSearchClientTest {
EntityIdentifier entityIdentifier = new EntityIdentifier();
entityIdentifier.setSystemIdentifier("test");
entityIdentifier.setValue("test");
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class, () -> xRefSearchClient.search(entityIdentifier));
List<String> targetDomain = new ArrayList<>();
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class, () -> xRefSearchClient.search(entityIdentifier,
targetDomain));
assertEquals("Invalid Request sent to distant CrossReferenceSearchProcessingService !", exception.getMessage());
}
......@@ -197,8 +211,9 @@ class XRefSearchClientTest {
EntityIdentifier entityIdentifier = new EntityIdentifier();
entityIdentifier.setSystemIdentifier("test");
entityIdentifier.setValue("test");
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class, () -> xRefSearchClient.search(entityIdentifier));
List<String> targetDomain = new ArrayList<>();
SearchCrossReferenceException exception = assertThrows(SearchCrossReferenceException.class, () -> xRefSearchClient.search(entityIdentifier,
targetDomain));
assertEquals("Invalid operation used on distant CrossReferenceSearchProcessingService !", exception.getMessage());
}
......
......@@ -9,6 +9,8 @@ import org.junit.jupiter.api.Test;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
@Disabled
public class TestClientWithUrl {
......@@ -23,10 +25,10 @@ public class TestClientWithUrl {
entityIdentifier.setSystemIdentifier("1.3.6.1.4.1.12559.11.1.2.2.5");
entityIdentifier.setType("ISO");
entityIdentifier.setValue("1610749172368102389526");
List<String> targetDomain = new ArrayList<>();
try {