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

Fix TU and connection to PAM db

parent 277cb11b
sudo cp patient-registry-service/target/patient-registry-1.0.1-SNAPSHOT.jar /usr/local/wildfly18/standalone/deployments/patient-registry.jar
......@@ -5,7 +5,8 @@ package net.ihe.gazelle.app.patientregistryapi.adapter.ws;
*/
public class CrossReferenceProcessingWebServiceConstants {
public static final String CROSS_REFERENCE_PROCESSING_SERVICE = "xref-processing-service";
public static final String CROSS_REFERENCE_PROCESSING_RESOURCE_URL = "xref-processing-service";
public static final String CROSS_REFERENCE_PROCESSING_SERVICE = "CrossReferenceService";
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";
......
......@@ -5,8 +5,8 @@ package net.ihe.gazelle.app.patientregistryapi.adapter.ws;
*This class is used to store all constant values used by Patient Registry Patient Feed Processing Service.
*/
public class PatientProcessingWebserviceConstants {
public static final String PATIENT_PROCESSING_SERVICE = "patient-processing-service";
public static final String PATIENT_PROCESSING_RESOURCE_URL = "patient-processing-service";
public static final String PATIENT_PROCESSING_SERVICE = "PatientProcessingService";
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";
......
......@@ -226,7 +226,7 @@
<url>jdbc:postgresql://${postgresql.host}:${postgresql.port}/${postgresql.root.login}</url>
<autocommit>true</autocommit>
<sqlCommand>drop database "${postgresql.gazelle.name}"</sqlCommand>
<!-- ignore error when database is not avaiable -->
<!-- ignore error when database is not available -->
<onError>continue</onError>
</configuration>
</execution>
......@@ -242,7 +242,7 @@
<url>jdbc:postgresql://${postgresql.host}:${postgresql.port}/${postgresql.root.login}</url>
<autocommit>true</autocommit>
<sqlCommand>create database "${postgresql.gazelle.name}"</sqlCommand>
<!-- ignore error when database is not avaiable -->
<!-- ignore error when database is not available -->
<onError>continue</onError>
</configuration>
</execution>
......@@ -258,7 +258,7 @@
<url>jdbc:postgresql://${postgresql.host}:${postgresql.port}/${postgresql.gazelle.name}</url>
<autocommit>true</autocommit>
<sqlCommand>create user ${postgresql.gazelle.login} with password '${postgresql.gazelle.password}'</sqlCommand>
<!-- ignore error when database is not avaiable -->
<!-- ignore error when database is not available -->
<onError>continue</onError>
</configuration>
</execution>
......@@ -274,7 +274,7 @@
<url>jdbc:postgresql://${postgresql.host}:${postgresql.port}/${postgresql.root.login}</url>
<autocommit>true</autocommit>
<sqlCommand>ALTER DATABASE "${postgresql.gazelle.name}" OWNER TO ${postgresql.gazelle.login}</sqlCommand>
<!-- ignore error when database is not avaiable -->
<!-- ignore error when database is not available -->
<onError>continue</onError>
</configuration>
</execution>
......
......@@ -5,7 +5,7 @@ import javax.persistence.*;
@Entity
@Table(name = "pam_hierarchic_designator", schema = "public")
@SequenceGenerator(name = "pam_hierarchic_designator_sequence", sequenceName = "pam_hierarchic_designator_id_seq", allocationSize = 1)
@NamedQuery(name = "HierarchicDesignatorDB.findByUniversalID", query = "SELECT hd FROM HierarchicDesignatorDB hd WHERE hd.universalID = :universalID")
@NamedQuery(name = "HierarchicDesignatorDB.findByUniversalID", query = "SELECT hd FROM HierarchicDesignatorDB hd WHERE hd.universalID = :universalID and hd.usage =: givenUsage")
public class HierarchicDesignatorDB {
private static final String DEFAULT_UNIVERSAL_ID_TYPE = "ISO";
......
......@@ -62,11 +62,11 @@ public class DomainDAOImpl implements DomainDAO, DomainService {
* @param domainIdentifier identifier of the Domain to retrieve.
* @return retrieved Domain if exists, or null.
*/
//TODO refactor pour virer le null | a recopier dans PCRDAOImpl ?
public HierarchicDesignatorDB retrieve(String domainIdentifier) {
TypedQuery<HierarchicDesignatorDB> query = entityManager.createNamedQuery("HierarchicDesignatorDB.findByUniversalID",
HierarchicDesignatorDB.class);
query.setParameter("universalID", domainIdentifier);
query.setParameter("givenUsage",DesignatorTypeDB.PATIENT_ID);
HierarchicDesignatorDB domain;
try {
domain = query.getSingleResult();
......
......@@ -5,6 +5,7 @@ import net.ihe.gazelle.app.patientregistryapi.business.EntityIdentifier;
import net.ihe.gazelle.app.patientregistryapi.business.PatientAliases;
import net.ihe.gazelle.app.patientregistryservice.adapter.dao.EntityManagerProducer;
import net.ihe.gazelle.app.patientregistryservice.adapter.dao.pamsimulator.converter.PatientAliasesConverter;
import net.ihe.gazelle.app.patientregistryservice.adapter.dao.pamsimulator.model.patient.DesignatorTypeDB;
import net.ihe.gazelle.app.patientregistryservice.adapter.dao.pamsimulator.model.patient.HierarchicDesignatorDB;
import net.ihe.gazelle.app.patientregistryservice.adapter.dao.pamsimulator.model.patient.PatientDB;
import net.ihe.gazelle.app.patientregistryservice.adapter.dao.pamsimulator.model.patient.PatientIdentifierDB;
......@@ -103,9 +104,10 @@ public class PatientCrossReferenceDAOImpl implements PatientCrossReferenceDAO {
try {
TypedQuery<HierarchicDesignatorDB> queryForAPatient = entityManager.createNamedQuery("HierarchicDesignatorDB.findByUniversalID", HierarchicDesignatorDB.class);
queryForAPatient.setParameter("universalID", systemIdentifier);
queryForAPatient.setParameter("givenUsage", DesignatorTypeDB.PATIENT_ID);
HierarchicDesignatorDB hierarchicDesignatorDB = queryForAPatient.getSingleResult();
return hierarchicDesignatorDB;
} catch (NoResultException exception) {
} catch (NoResultException | NonUniqueResultException exception) {
throw new SearchCrossReferenceException("System not found");
}
}
......
......@@ -3,7 +3,6 @@ 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;
......@@ -11,8 +10,9 @@ import javax.jws.WebService;
@Stateless
@WebService(
name = CrossReferenceProcessingWebServiceConstants.CROSS_REFERENCE_PROCESSING_SERVICE,
portName = PatientProcessingWebserviceConstants.PATIENT_PROCESSING_SERVICE_PORT,
name = CrossReferenceProcessingWebServiceConstants.CROSS_REFERENCE_PROCESSING_RESOURCE_URL,
serviceName = CrossReferenceProcessingWebServiceConstants.CROSS_REFERENCE_PROCESSING_SERVICE,
portName = CrossReferenceProcessingWebServiceConstants.CROSS_REFERENCE_PROCESSING_SERVICE_PORT,
targetNamespace = "http://www.gitb.com/ps/v1/",
endpointInterface = "com.gitb.ps.ProcessingService")
public class CrossReferenceProcessingService implements ProcessingService {
......@@ -31,7 +31,7 @@ public class CrossReferenceProcessingService implements ProcessingService {
/**
* Constructor with dependencies.
*
* @param crossReferenceSearchProcessingService application service to use to process X-Ref search requests.
* @param crossReferenceSearchProcessingService application service to use to process X-Ref search requests.
*/
public CrossReferenceProcessingService(CrossReferenceSearchProcessingService crossReferenceSearchProcessingService) {
this.crossReferenceSearchProcessingService = crossReferenceSearchProcessingService;
......
......@@ -13,7 +13,8 @@ import javax.jws.WebService;
*/
@Stateless
@WebService(
name = PatientProcessingWebserviceConstants.PATIENT_PROCESSING_SERVICE,
name = PatientProcessingWebserviceConstants.PATIENT_PROCESSING_RESOURCE_URL,
serviceName = PatientProcessingWebserviceConstants.PATIENT_PROCESSING_SERVICE,
portName = PatientProcessingWebserviceConstants.PATIENT_PROCESSING_SERVICE_PORT,
targetNamespace = "http://www.gitb.com/ps/v1/",
endpointInterface = "com.gitb.ps.ProcessingService")
......
......@@ -2,11 +2,7 @@ package net.ihe.gazelle.app.patientregistryservice.adapter.dao.pamsimulator.serv
import net.ihe.gazelle.app.patientregistryapi.application.SearchCrossReferenceException;
import net.ihe.gazelle.app.patientregistryapi.business.EntityIdentifier;
import net.ihe.gazelle.app.patientregistryapi.business.PatientAliases;
import net.ihe.gazelle.app.patientregistryservice.adapter.dao.pamsimulator.model.patient.GenderCodeDB;
import net.ihe.gazelle.app.patientregistryservice.adapter.dao.pamsimulator.model.patient.HierarchicDesignatorDB;
import net.ihe.gazelle.app.patientregistryservice.adapter.dao.pamsimulator.model.patient.PatientDB;
import net.ihe.gazelle.app.patientregistryservice.adapter.dao.pamsimulator.model.patient.PatientIdentifierDB;
import net.ihe.gazelle.app.patientregistryservice.adapter.dao.pamsimulator.model.patient.*;
import net.ihe.gazelle.app.patientregistryservice.adapter.dao.pamsimulator.model.references.CrossReferenceDB;
import net.ihe.gazelle.app.patientregistryservice.adapter.dao.pamsimulator.service.PatientCrossReferenceDAO;
import net.ihe.gazelle.app.patientregistryservice.adapter.dao.pamsimulator.service.PatientCrossReferenceDAOImpl;
......@@ -215,16 +211,19 @@ public class PatientCrossReferenceDAOImplTest {
HierarchicDesignatorDB hierarchicDesignatorDB = new HierarchicDesignatorDB();
hierarchicDesignatorDB.setUniversalID("1111");
hierarchicDesignatorDB.setUniversalIDType("ISO");
hierarchicDesignatorDB.setUsage(DesignatorTypeDB.PATIENT_ID);
HierarchicDesignatorDB hierarchicDesignatorDB2 = entityManager.merge(hierarchicDesignatorDB);
HierarchicDesignatorDB hierarchicDesignatorDB3 = new HierarchicDesignatorDB();
hierarchicDesignatorDB3.setUniversalID("2222");
hierarchicDesignatorDB3.setUniversalIDType("ISO");
hierarchicDesignatorDB3.setUsage(DesignatorTypeDB.PATIENT_ID);
HierarchicDesignatorDB hierarchicDesignatorDB4 = entityManager.merge(hierarchicDesignatorDB3);
HierarchicDesignatorDB hierarchicDesignatorDB5 = new HierarchicDesignatorDB();
hierarchicDesignatorDB5.setUniversalID("3333");
hierarchicDesignatorDB5.setUniversalIDType("ISO");
hierarchicDesignatorDB5.setUsage(DesignatorTypeDB.PATIENT_ID);
HierarchicDesignatorDB hierarchicDesignatorDB6 = entityManager.merge(hierarchicDesignatorDB5);
PatientIdentifierDB patientIdentifierDB = new PatientIdentifierDB();
......
......@@ -46,8 +46,10 @@ public class FeedExecutionStepDefinition {
*/
@Before
public void setUpFeedClient() throws MalformedURLException {
patientFeedClient = new PatientFeedClient(new URL("http://localhost:8080/patient-registry/processing-service?wsdl"));
patientSearchClient = new PatientSearchClient(new URL("http://localhost:8080/patient-registry/processing-service?wsdl"));
patientFeedClient = new PatientFeedClient(new URL("http://localhost:8580/patient-registry/PatientProcessingService/patient-processing" +
"-service?wsdl"));
patientSearchClient = new PatientSearchClient(new URL("http://localhost:8580/patient-registry/PatientProcessingService/patient-processing" +
"-service?wsdl"));
existingPatients = new ArrayList<>();
}
......
......@@ -55,8 +55,8 @@ public class SearchExecutionStepDefinition {
*/
@Before
public void setUpInMemoryDBAndFeedClient() throws MalformedURLException {
patientFeedClient = new PatientFeedClient(new URL("http://localhost:8080/patient-registry/processing-service?wsdl"));
patientSearchClient = new PatientSearchClient(new URL("http://localhost:8080/patient-registry/processing-service?wsdl"));
patientFeedClient = new PatientFeedClient(new URL("http://localhost:8580/patient-registry/PatientProcessingService/patient-processing-service?wsdl"));
patientSearchClient = new PatientSearchClient(new URL("http://localhost:8580/patient-registry/PatientProcessingService/patient-processing-service?wsdl"));
existingPatients = new ArrayList<>();
......
......@@ -10,6 +10,7 @@
<class>net.ihe.gazelle.app.patientregistryservice.adapter.dao.pamsimulator.model.patient.PatientPhoneNumberDB</class>
<class>net.ihe.gazelle.app.patientregistryservice.adapter.dao.pamsimulator.model.patient.PatientIdentifierDB</class>
<class>net.ihe.gazelle.app.patientregistryservice.adapter.dao.pamsimulator.model.patient.HierarchicDesignatorDB</class>
<class>net.ihe.gazelle.app.patientregistryservice.adapter.dao.pamsimulator.model.patient.DesignatorTypeDB</class>
<class>net.ihe.gazelle.app.patientregistryservice.adapter.dao.pamsimulator.model.patient.PersonAddressDB</class>
<class>net.ihe.gazelle.app.patientregistryservice.adapter.dao.pamsimulator.model.patient.PersonDB</class>
<class>net.ihe.gazelle.app.patientregistryservice.adapter.dao.pamsimulator.model.patient.PersonPhoneNumberDB</class>
......
......@@ -46,19 +46,16 @@
<groupId>net.ihe.gazelle</groupId>
<artifactId>lib.gitb-utils</artifactId>
</dependency>
<dependency>
<groupId>net.ihe.gazelle</groupId>
<artifactId>lib.unit-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8</artifactId>
<version>2.28.1</version>
<scope>test</scope>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-ri</artifactId>
<version>2.3.3</version>
<type>pom</type>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package net.ihe.gazelle.app.patientregistryxrefsearchclient.adapter.it;
import net.ihe.gazelle.app.patientregistryapi.application.SearchCrossReferenceException;
import net.ihe.gazelle.app.patientregistryapi.business.EntityIdentifier;
import net.ihe.gazelle.app.patientregistryapi.business.PatientAliases;
import net.ihe.gazelle.app.patientregistryxrefsearchclient.adapter.XRefSearchClient;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import java.net.MalformedURLException;
import java.net.URL;
@Disabled
public class TestClientWithUrl {
@Test
void test() throws MalformedURLException {
URL patientRegistryUrl = new URL("http://localhost:8580/patient-registry/CrossReferenceService/xref-processing-service?wsdl");
XRefSearchClient xRefSearchClient = new XRefSearchClient(patientRegistryUrl);
EntityIdentifier entityIdentifier = new EntityIdentifier();
entityIdentifier.setSystemName("ASIP-SANTE-INS-C");
entityIdentifier.setSystemIdentifier("1.3.6.1.4.1.12559.11.1.2.2.5");
entityIdentifier.setType("ISO");
entityIdentifier.setValue("1610749172368102389526");
try {
PatientAliases patientAliases = xRefSearchClient.search(entityIdentifier);
//Assertions.assertEquals(patientAliases.getUuid(),10);
} catch (SearchCrossReferenceException e) {
e.printStackTrace();
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment