From d6367850c0fefc4c35b0cb6fd07ee3e51ed4b99d Mon Sep 17 00:00:00 2001 From: Dmytro Rud Date: Wed, 21 Jun 2017 16:49:05 +0200 Subject: [PATCH 01/29] fix socket key generation which has prevented the socket from being recreated --- .../ihe/atna/auditor/sender/TLSSyslogSenderImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/sender/TLSSyslogSenderImpl.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/sender/TLSSyslogSenderImpl.java index 058cb15..183a084 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/sender/TLSSyslogSenderImpl.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/sender/TLSSyslogSenderImpl.java @@ -97,7 +97,7 @@ private void send(AuditEventMessage msg, Socket socket) throws Exception } catch(SocketException e) { try { LOGGER.info("Failed to connect with existing TLS socket. Will create a new connection and retry."); - String key = socket.getInetAddress().getHostName() + ":" + socket.getPort(); + String key = socket.getInetAddress().getHostAddress() + ":" + socket.getPort(); synchronized (socketMap) { socketMap.remove(key); Socket newSocket = this.getTLSSocket(socket.getInetAddress(), socket.getPort()); From eaffe37c752083cfb28dd8b881d2fb35a8440ecd Mon Sep 17 00:00:00 2001 From: Dmytro Rud Date: Thu, 22 Jun 2017 14:51:44 +0200 Subject: [PATCH 02/29] #8: first steps --- auditor/pom.xml | 25 ++++- .../auditor/models/rfc3881/AuditMessage.java | 2 +- .../auditor/queue/JmsAuditMessageQueue.java | 100 ++++++++++++++++++ .../queue/JmsAuditMessageQueueTest.java | 65 ++++++++++++ pom.xml | 22 +++- 5 files changed, 209 insertions(+), 5 deletions(-) create mode 100644 auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueue.java create mode 100644 auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java diff --git a/auditor/pom.xml b/auditor/pom.xml index aa9c416..3f1c313 100644 --- a/auditor/pom.xml +++ b/auditor/pom.xml @@ -12,6 +12,7 @@ + org.openehealth.ipf.oht.atna ipf-oht-atna-nodeauth @@ -36,17 +37,25 @@ true - junit - junit - test + org.apache.geronimo.specs + geronimo-jms_1.1_spec + true org.slf4j slf4j-log4j12 + + + + junit + junit + test + org.mockito mockito-all + test org.openehealth.ipf.oht.atna @@ -59,6 +68,16 @@ commons-io test + + org.apache.activemq + activemq-broker + test + + + org.apache.activemq + activemq-pool + test + diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/models/rfc3881/AuditMessage.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/models/rfc3881/AuditMessage.java index b04493a..96fb129 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/models/rfc3881/AuditMessage.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/models/rfc3881/AuditMessage.java @@ -80,7 +80,7 @@ public String toString(boolean useSpacing) StringBuilder sb = new StringBuilder(); sb.append(""); sb.append(eventIdentification.toString(useSpacing)); diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueue.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueue.java new file mode 100644 index 0000000..34f13f4 --- /dev/null +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueue.java @@ -0,0 +1,100 @@ +/* + * Copyright 2017 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.openhealthtools.ihe.atna.auditor.queue; + +import org.openhealthtools.ihe.atna.auditor.events.AuditEventMessage; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.jms.*; +import java.net.InetAddress; + +/** + * @author Dmytro Rud + */ +public class JmsAuditMessageQueue implements AuditMessageQueue { + private static transient final Logger LOG = LoggerFactory.getLogger(JmsAuditMessageQueue.class); + + private final Connection connection; + private final Destination destination; + private final boolean needCloseSession; + + /** + * @param connectionFactory JMS connection factory + * @param destination JMS destination of ATNA messages + * @param needCloseSession whether the JMS session shall be closed after each message (should be false for pooled sessions) + * @param userName user name for JMS authentication + * @param password user password for JMS authentication + * @throws JMSException + */ + public JmsAuditMessageQueue(ConnectionFactory connectionFactory, Destination destination, boolean needCloseSession, String userName, String password) throws JMSException { + this.connection = connectionFactory.createConnection(userName, password); + this.destination = destination; + this.needCloseSession = needCloseSession; + } + + /** + * @param connectionFactory JMS connection factory + * @param destination JMS destination of ATNA messages + * @param needCloseSession whether the JMS session shall be closed after each message (should be false for pooled sessions) + * @throws JMSException + */ + public JmsAuditMessageQueue(ConnectionFactory connectionFactory, Destination destination, boolean needCloseSession) throws JMSException { + this(connectionFactory, destination, needCloseSession, null, null); + } + + @Override + public void sendAuditEvent(AuditEventMessage atnaMessage) { + Session session = null; + try { + connection.start(); + session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + BytesMessage message = session.createBytesMessage(); + message.writeBytes(atnaMessage.getSerializedMessage(false)); + session.createProducer(destination).send(message); + } catch (JMSException e) { + LOG.error("Could not send ATNA message", e); + } finally { + if (needCloseSession && (session != null)) { + try { + session.close(); + } catch (JMSException e1) { + LOG.error("Could not close session", e1); + } + } + } + } + + @Override + public void sendAuditEvent(AuditEventMessage msg, InetAddress destination, int port) { + sendAuditEvent(msg); + } + + @Override + public void flush() { + // nop + } + + @Override + public void shutdown() { + try { + connection.stop(); + } catch (JMSException e) { + LOG.error("Could not shutdown gracefully", e); + } + } + +} diff --git a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java new file mode 100644 index 0000000..ee11c58 --- /dev/null +++ b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java @@ -0,0 +1,65 @@ +/* + * Copyright 2017 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.openhealthtools.ihe.atna.auditor.queue; + +import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.command.ActiveMQQueue; +import org.apache.activemq.pool.PooledConnectionFactory; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openhealthtools.ihe.atna.auditor.IHEAuditor; +import org.openhealthtools.ihe.atna.auditor.codes.rfc3881.RFC3881EventCodes; +import org.openhealthtools.ihe.atna.auditor.context.AuditorModuleContext; + +import java.util.Locale; + +/** + * @author Dmytro Rud + */ +public class JmsAuditMessageQueueTest { + + private static final String JMS_BROKER_URL = "tcp://localhost:61616"; + private static final String JMS_QUEUE_NAME = "atna"; + + private static BrokerService jmsBroker; + + @BeforeClass + public static void beforeClass() throws Exception { + Locale.setDefault(Locale.ENGLISH); + + // some dummy values + AuditorModuleContext.getContext().getConfig().setAuditRepositoryHost("localhost"); + AuditorModuleContext.getContext().getConfig().setAuditRepositoryPort(514); + + jmsBroker = new BrokerService(); + jmsBroker.addConnector(JMS_BROKER_URL); + jmsBroker.setUseJmx(false); + jmsBroker.setPersistent(false); + jmsBroker.deleteAllMessages(); + jmsBroker.start(); + } + + @Test + public void testActiveMQ() throws Exception { + PooledConnectionFactory jmsConnectionFactory = new PooledConnectionFactory(JMS_BROKER_URL); + ActiveMQQueue jmsQueue = new ActiveMQQueue(JMS_QUEUE_NAME); + JmsAuditMessageQueue atnaQueue = new JmsAuditMessageQueue(jmsConnectionFactory, jmsQueue, false); + + AuditorModuleContext.getContext().setQueue(atnaQueue); + + IHEAuditor.getAuditor().auditActorStartEvent(RFC3881EventCodes.RFC3881EventOutcomeCodes.SUCCESS, "actorName", "actorStarter"); + } +} diff --git a/pom.xml b/pom.xml index 2574137..d9cac29 100644 --- a/pom.xml +++ b/pom.xml @@ -7,6 +7,7 @@ pom + 2.6 2.0.1 3.5.1 @@ -15,10 +16,14 @@ 1.6.3 2.5.3 3.0.1 + + + 5.14.5 1.10 3.2.2 2.5 3.4 + 1.1.1 2.0.15 4.1.3.Final 1.7.21 @@ -28,7 +33,7 @@ https://github.com/oehf/ipf-oht-atna - IPF OHT ATNA is a project containing patched packages of the forked OHT ATNA framework. + IPF OHT ATNA is a project containing patched packages of the forked OHT ATNA framework Open eHealth Foundation @@ -170,6 +175,21 @@ ${mockito-version} test + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + ${geronimo-spec-jms-version} + + + org.apache.activemq + activemq-broker + ${activemq-version} + + + org.apache.activemq + activemq-pool + ${activemq-version} + From ed8e10c694a6cfa3a4f9b9b21de5eeab60d6e8e7 Mon Sep 17 00:00:00 2001 From: stanojevic-boris Date: Thu, 13 Jul 2017 10:24:43 +0200 Subject: [PATCH 03/29] fixing failed unit test --- .../ihe/atna/auditor/AuditorIntegrationTest.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/AuditorIntegrationTest.java b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/AuditorIntegrationTest.java index 698dcfb..5aceab7 100644 --- a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/AuditorIntegrationTest.java +++ b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/AuditorIntegrationTest.java @@ -39,7 +39,7 @@ public class AuditorIntegrationTest { private Vertx vertx; private int port; private final String host = "localhost"; - private final long waitTime = 1000L; + private final long waitTime = 5000L; private Properties p; @@ -66,7 +66,7 @@ public void setup(TestContext context){ public void tearDown(TestContext context) { System.setProperties(p); SecurityContextFactory.cleanupSecurityContext(); - vertx.close(context.asyncAssertSuccess()); + vertx.close(context.asyncAssertSuccess()); } @Test @@ -85,7 +85,7 @@ public void testTCPNoTLS(TestContext context) throws Exception { Properties properties = initSecurityDomainProperties(); initSecurityDomain(properties, false); Async async = context.async(); - vertx.deployVerticle(createTCPServer(port, async), context.asyncAssertSuccess()); + vertx.deployVerticle(createTCPServer(port, async), context.asyncAssertSuccess()); auditor.auditActorStartEvent(SUCCESS, MESA_SYSTEM_ID, MESA_USER_IDENTITY); async.awaitSuccess(waitTime); } @@ -97,7 +97,7 @@ public void testTCPOneWayTLS(TestContext context) throws Exception { Async async = context.async(); vertx.deployVerticle(createTCPServerOneWayTLS(port, properties.getProperty(JAVAX_NET_SSL_TRUSTSTORE), properties.getProperty(JAVAX_NET_SSL_TRUSTSTORE_PASSWORD), async), - context.asyncAssertSuccess()); + context.asyncAssertSuccess()); auditor.auditActorStartEvent(SUCCESS, MESA_SYSTEM_ID, MESA_USER_IDENTITY); async.awaitSuccess(waitTime); } @@ -113,7 +113,7 @@ public void testTCPTwoWayTLS(TestContext context) throws Exception { properties.getProperty(JAVAX_NET_SSL_TRUSTSTORE), properties.getProperty(JAVAX_NET_SSL_TRUSTSTORE_PASSWORD), async), - context.asyncAssertSuccess()); + context.asyncAssertSuccess()); auditor.auditActorStartEvent(SUCCESS, MESA_SYSTEM_ID, MESA_USER_IDENTITY); async.awaitSuccess(waitTime); } @@ -134,7 +134,7 @@ public void testTCPTwoWayTLSWrongClientCert(TestContext context) throws Exceptio properties.getProperty(JAVAX_NET_SSL_TRUSTSTORE), properties.getProperty(JAVAX_NET_SSL_TRUSTSTORE_PASSWORD), async), - context.asyncAssertSuccess()); + context.asyncAssertSuccess()); auditor.auditActorStartEvent(SUCCESS, MESA_SYSTEM_ID, MESA_USER_IDENTITY); try { async.awaitSuccess(waitTime); @@ -152,6 +152,7 @@ private Properties initSecurityDomainProperties() throws Exception { props.put(JAVAX_NET_SSL_KEYSTORE, this.getClass().getResource(KEY_STORE).getPath()); props.put(JAVAX_NET_SSL_TRUSTSTORE_PASSWORD, TRUST_STORE_PASS); props.put(JAVAX_NET_SSL_TRUSTSTORE, this.getClass().getResource(TRUST_STORE).getPath()); + props.put(JDK_TLS_CLIENT_PROTOCOLS, "TLSv1.2"); return props; } From 370c6d6dbbf7c0379ed3f853f2efd8357b8ffade Mon Sep 17 00:00:00 2001 From: stanojevic-boris Date: Thu, 13 Jul 2017 10:42:29 +0200 Subject: [PATCH 04/29] set the DEBUG level to check the cause for failed build --- auditor/src/test/resources/log4j.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/auditor/src/test/resources/log4j.xml b/auditor/src/test/resources/log4j.xml index d6a9b99..e1e6477 100644 --- a/auditor/src/test/resources/log4j.xml +++ b/auditor/src/test/resources/log4j.xml @@ -63,6 +63,10 @@ Examples: "%r [%t] %-5p %c %x - %m\n" + + + + From ffc631f30d0739a07010f30f597c9f92d7523c1e Mon Sep 17 00:00:00 2001 From: stanojevic-boris Date: Thu, 13 Jul 2017 11:09:22 +0200 Subject: [PATCH 05/29] dependencies upgrade --- pom.xml | 4 ++-- test/pom.xml | 2 +- .../org/openhealthtools/ihe/atna/test/UDPSyslogServer.java | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index d9cac29..f60610a 100644 --- a/pom.xml +++ b/pom.xml @@ -24,8 +24,8 @@ 2.5 3.4 1.1.1 - 2.0.15 - 4.1.3.Final + 2.0.16 + 4.1.9.Final 1.7.21 4.12 1.10.19 diff --git a/test/pom.xml b/test/pom.xml index 5b5260a..f5675a2 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -12,7 +12,7 @@ - 3.2.0 + 3.4.2 diff --git a/test/src/main/java/org/openhealthtools/ihe/atna/test/UDPSyslogServer.java b/test/src/main/java/org/openhealthtools/ihe/atna/test/UDPSyslogServer.java index 8c2c2ba..b74cbe1 100644 --- a/test/src/main/java/org/openhealthtools/ihe/atna/test/UDPSyslogServer.java +++ b/test/src/main/java/org/openhealthtools/ihe/atna/test/UDPSyslogServer.java @@ -1,7 +1,6 @@ package org.openhealthtools.ihe.atna.test; import io.vertx.core.AbstractVerticle; -import io.vertx.core.AsyncResultHandler; import io.vertx.core.datagram.DatagramSocket; import io.vertx.core.datagram.DatagramSocketOptions; import io.vertx.ext.unit.Async; @@ -34,7 +33,7 @@ public UDPSyslogServer(String host, int udpPort, Async async) { @Override public void start() { final DatagramSocket socket = vertx.createDatagramSocket(dsOptions); - socket.listen(udpPort, host, (AsyncResultHandler) datagramSocketAsyncResult -> { + socket.listen(udpPort, host, datagramSocketAsyncResult -> { if (datagramSocketAsyncResult.succeeded()){ log.info("Listening on UDP port " + udpPort); async.countDown(); From 3ec72b4c9686a3ae3bbe8727c528be8ec000a1ce Mon Sep 17 00:00:00 2001 From: stanojevic-boris Date: Thu, 13 Jul 2017 11:17:19 +0200 Subject: [PATCH 06/29] timeout increased --- .../ihe/atna/auditor/AuditorIntegrationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/AuditorIntegrationTest.java b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/AuditorIntegrationTest.java index 5aceab7..f29abb3 100644 --- a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/AuditorIntegrationTest.java +++ b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/AuditorIntegrationTest.java @@ -39,7 +39,7 @@ public class AuditorIntegrationTest { private Vertx vertx; private int port; private final String host = "localhost"; - private final long waitTime = 5000L; + private final long waitTime = 30000L; private Properties p; From c3e44b0330ddc1f98421d1fc8df48853fb619974 Mon Sep 17 00:00:00 2001 From: stanojevic-boris Date: Mon, 17 Jul 2017 13:33:14 +0200 Subject: [PATCH 07/29] try to isolate failing test --- .../ihe/atna/auditor/AuditorIntegrationTest.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/AuditorIntegrationTest.java b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/AuditorIntegrationTest.java index f29abb3..4949ade 100644 --- a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/AuditorIntegrationTest.java +++ b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/AuditorIntegrationTest.java @@ -70,6 +70,7 @@ public void tearDown(TestContext context) { } @Test + @Ignore public void testUDP(TestContext context) throws Exception { CONFIG.setAuditRepositoryTransport("UDP"); Async async = context.async(2); @@ -81,6 +82,7 @@ public void testUDP(TestContext context) throws Exception { } @Test + @Ignore public void testTCPNoTLS(TestContext context) throws Exception { Properties properties = initSecurityDomainProperties(); initSecurityDomain(properties, false); @@ -91,6 +93,7 @@ public void testTCPNoTLS(TestContext context) throws Exception { } @Test + @Ignore public void testTCPOneWayTLS(TestContext context) throws Exception { Properties properties = initSecurityDomainProperties(); initSecurityDomain(properties, true); @@ -119,6 +122,7 @@ public void testTCPTwoWayTLS(TestContext context) throws Exception { } @Test + @Ignore public void testTCPTwoWayTLSWrongClientCert(TestContext context) throws Exception { Properties properties = initSecurityDomainProperties(); properties.setProperty(JAVAX_NET_SSL_KEYSTORE, From 5c41008663ceeeb3906b676873d1539fd50a301d Mon Sep 17 00:00:00 2001 From: stanojevic-boris Date: Mon, 17 Jul 2017 14:19:34 +0200 Subject: [PATCH 08/29] investigating... --- auditor/pom.xml | 18 ++++++++++++++++++ auditor/src/test/resources/log4j.xml | 6 +++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/auditor/pom.xml b/auditor/pom.xml index 3f1c313..0429074 100644 --- a/auditor/pom.xml +++ b/auditor/pom.xml @@ -80,5 +80,23 @@ + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + + javax.net.debug + ssl + + + + + + + diff --git a/auditor/src/test/resources/log4j.xml b/auditor/src/test/resources/log4j.xml index e1e6477..3e842cb 100644 --- a/auditor/src/test/resources/log4j.xml +++ b/auditor/src/test/resources/log4j.xml @@ -67,8 +67,12 @@ Examples: "%r [%t] %-5p %c %x - %m\n" + + + + - + From e63a737620e9227ecf85636ce8b6b4755cbfc3f1 Mon Sep 17 00:00:00 2001 From: stanojevic-boris Date: Mon, 17 Jul 2017 14:52:57 +0200 Subject: [PATCH 09/29] investigating... --- .../ihe/atna/test/TCPSyslogServer.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/test/src/main/java/org/openhealthtools/ihe/atna/test/TCPSyslogServer.java b/test/src/main/java/org/openhealthtools/ihe/atna/test/TCPSyslogServer.java index a9819c5..f69d3be 100644 --- a/test/src/main/java/org/openhealthtools/ihe/atna/test/TCPSyslogServer.java +++ b/test/src/main/java/org/openhealthtools/ihe/atna/test/TCPSyslogServer.java @@ -27,6 +27,7 @@ public TCPSyslogServer(int port, Async async){ this.async = async; nsOptions = new NetServerOptions() .setReuseAddress(true) + .setHost("localhost") .setSsl(false); } @@ -38,6 +39,7 @@ public TCPSyslogServer(int port, String clientAuth, this.async = async; nsOptions = new NetServerOptions() .setReuseAddress(true) + .setHost("localhost") .setClientAuth(ClientAuth.valueOf(clientAuth)) .setTrustStoreOptions(trustStorePath != null? new JksOptions(). setPath(trustStorePath). @@ -51,13 +53,10 @@ public TCPSyslogServer(int port, String clientAuth, @Override public void start() throws Exception { NetServer netServer = vertx.createNetServer(nsOptions); - netServer.connectHandler(netSocket -> netSocket.handler(new Handler() { - @Override - public void handle(Buffer buffer) { - log.debug("================= Received content on " + port + ":" + async.count() + - " =================== \n" + buffer.toString()); - async.countDown(); - } + netServer.connectHandler(netSocket -> netSocket.handler(buffer -> { + log.debug("================= Received content on " + port + ":" + async.count() + + " =================== \n" + buffer.toString()); + async.countDown(); })).listen(port); } } From 35eb35f534e9e86044e588095998d2f97666f02d Mon Sep 17 00:00:00 2001 From: stanojevic-boris Date: Mon, 17 Jul 2017 15:01:24 +0200 Subject: [PATCH 10/29] finally, fixed failing unit test --- auditor/pom.xml | 18 ------------------ .../atna/auditor/AuditorIntegrationTest.java | 6 +----- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/auditor/pom.xml b/auditor/pom.xml index 0429074..3f1c313 100644 --- a/auditor/pom.xml +++ b/auditor/pom.xml @@ -80,23 +80,5 @@ - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - - javax.net.debug - ssl - - - - - - - diff --git a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/AuditorIntegrationTest.java b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/AuditorIntegrationTest.java index 4949ade..1e5b85c 100644 --- a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/AuditorIntegrationTest.java +++ b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/AuditorIntegrationTest.java @@ -39,7 +39,7 @@ public class AuditorIntegrationTest { private Vertx vertx; private int port; private final String host = "localhost"; - private final long waitTime = 30000L; + private final long waitTime = 2000L; private Properties p; @@ -70,7 +70,6 @@ public void tearDown(TestContext context) { } @Test - @Ignore public void testUDP(TestContext context) throws Exception { CONFIG.setAuditRepositoryTransport("UDP"); Async async = context.async(2); @@ -82,7 +81,6 @@ public void testUDP(TestContext context) throws Exception { } @Test - @Ignore public void testTCPNoTLS(TestContext context) throws Exception { Properties properties = initSecurityDomainProperties(); initSecurityDomain(properties, false); @@ -93,7 +91,6 @@ public void testTCPNoTLS(TestContext context) throws Exception { } @Test - @Ignore public void testTCPOneWayTLS(TestContext context) throws Exception { Properties properties = initSecurityDomainProperties(); initSecurityDomain(properties, true); @@ -122,7 +119,6 @@ public void testTCPTwoWayTLS(TestContext context) throws Exception { } @Test - @Ignore public void testTCPTwoWayTLSWrongClientCert(TestContext context) throws Exception { Properties properties = initSecurityDomainProperties(); properties.setProperty(JAVAX_NET_SSL_KEYSTORE, From 5fbdc09bb5b3edf3b700da43de1909924b8d131b Mon Sep 17 00:00:00 2001 From: stanojevic-boris Date: Mon, 17 Jul 2017 16:28:28 +0200 Subject: [PATCH 11/29] try without JMS --- .../ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java index ee11c58..5016fee 100644 --- a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java +++ b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java @@ -19,6 +19,7 @@ import org.apache.activemq.command.ActiveMQQueue; import org.apache.activemq.pool.PooledConnectionFactory; import org.junit.BeforeClass; +import org.junit.Ignore; import org.junit.Test; import org.openhealthtools.ihe.atna.auditor.IHEAuditor; import org.openhealthtools.ihe.atna.auditor.codes.rfc3881.RFC3881EventCodes; @@ -29,6 +30,7 @@ /** * @author Dmytro Rud */ +@Ignore public class JmsAuditMessageQueueTest { private static final String JMS_BROKER_URL = "tcp://localhost:61616"; @@ -52,6 +54,10 @@ public static void beforeClass() throws Exception { jmsBroker.start(); } + public static void afterClass() throws Exception { +// jmsBroker.stop(); + } + @Test public void testActiveMQ() throws Exception { PooledConnectionFactory jmsConnectionFactory = new PooledConnectionFactory(JMS_BROKER_URL); From ac1c6ebc832fcb55ab62fafb2a4c699052be3493 Mon Sep 17 00:00:00 2001 From: stanojevic-boris Date: Wed, 19 Jul 2017 10:46:18 +0200 Subject: [PATCH 12/29] added JMS test consumer --- auditor/pom.xml | 14 ++++ .../queue/JmsAuditMessageQueueTest.java | 31 ++++++++- auditor/src/test/resources/log4j.xml | 6 +- test/pom.xml | 5 ++ .../ihe/atna/test/JmsAtnaMessageConsumer.java | 64 +++++++++++++++++++ 5 files changed, 116 insertions(+), 4 deletions(-) create mode 100644 test/src/main/java/org/openhealthtools/ihe/atna/test/JmsAtnaMessageConsumer.java diff --git a/auditor/pom.xml b/auditor/pom.xml index 3f1c313..5c83445 100644 --- a/auditor/pom.xml +++ b/auditor/pom.xml @@ -80,5 +80,19 @@ + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.20 + + false + + + + + diff --git a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java index 5016fee..4a9b661 100644 --- a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java +++ b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java @@ -15,22 +15,26 @@ */ package org.openhealthtools.ihe.atna.auditor.queue; +import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.broker.BrokerService; import org.apache.activemq.command.ActiveMQQueue; import org.apache.activemq.pool.PooledConnectionFactory; +import org.junit.After; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; import org.openhealthtools.ihe.atna.auditor.IHEAuditor; import org.openhealthtools.ihe.atna.auditor.codes.rfc3881.RFC3881EventCodes; import org.openhealthtools.ihe.atna.auditor.context.AuditorModuleContext; +import org.openhealthtools.ihe.atna.test.JmsAtnaMessageConsumer; +import javax.jms.*; import java.util.Locale; +import java.util.concurrent.CountDownLatch; /** * @author Dmytro Rud */ -@Ignore public class JmsAuditMessageQueueTest { private static final String JMS_BROKER_URL = "tcp://localhost:61616"; @@ -38,6 +42,8 @@ public class JmsAuditMessageQueueTest { private static BrokerService jmsBroker; + private JmsAuditMessageQueue atnaQueue; + @BeforeClass public static void beforeClass() throws Exception { Locale.setDefault(Locale.ENGLISH); @@ -55,17 +61,36 @@ public static void beforeClass() throws Exception { } public static void afterClass() throws Exception { -// jmsBroker.stop(); + jmsBroker.stop(); + } + + @After + public void tearDown(){ + if (atnaQueue != null) { + atnaQueue.shutdown(); + } } @Test public void testActiveMQ() throws Exception { + CountDownLatch latch = new CountDownLatch(1); + thread(new JmsAtnaMessageConsumer(latch, JMS_BROKER_URL, JMS_QUEUE_NAME), false); + PooledConnectionFactory jmsConnectionFactory = new PooledConnectionFactory(JMS_BROKER_URL); ActiveMQQueue jmsQueue = new ActiveMQQueue(JMS_QUEUE_NAME); - JmsAuditMessageQueue atnaQueue = new JmsAuditMessageQueue(jmsConnectionFactory, jmsQueue, false); + atnaQueue = new JmsAuditMessageQueue(jmsConnectionFactory, jmsQueue, false); AuditorModuleContext.getContext().setQueue(atnaQueue); IHEAuditor.getAuditor().auditActorStartEvent(RFC3881EventCodes.RFC3881EventOutcomeCodes.SUCCESS, "actorName", "actorStarter"); + + latch.await(); + } + + public static void thread(Runnable runnable, boolean daemon) { + Thread brokerThread = new Thread(runnable); + brokerThread.setDaemon(daemon); + brokerThread.start(); } + } diff --git a/auditor/src/test/resources/log4j.xml b/auditor/src/test/resources/log4j.xml index 3e842cb..9b921f7 100644 --- a/auditor/src/test/resources/log4j.xml +++ b/auditor/src/test/resources/log4j.xml @@ -71,8 +71,12 @@ Examples: "%r [%t] %-5p %c %x - %m\n" + + + + - + diff --git a/test/pom.xml b/test/pom.xml index f5675a2..553cf96 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -26,6 +26,11 @@ vertx-unit ${vertx.version} + + org.apache.activemq + activemq-client + ${activemq-version} + junit junit diff --git a/test/src/main/java/org/openhealthtools/ihe/atna/test/JmsAtnaMessageConsumer.java b/test/src/main/java/org/openhealthtools/ihe/atna/test/JmsAtnaMessageConsumer.java new file mode 100644 index 0000000..f4ecd9d --- /dev/null +++ b/test/src/main/java/org/openhealthtools/ihe/atna/test/JmsAtnaMessageConsumer.java @@ -0,0 +1,64 @@ +package org.openhealthtools.ihe.atna.test; + +import org.apache.activemq.ActiveMQConnectionFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.jms.*; +import java.util.concurrent.CountDownLatch; + +/** + * + */ +public class JmsAtnaMessageConsumer implements Runnable, ExceptionListener { + + private final CountDownLatch latch; + private final String jmsBrokerUrl; + private final String jmsQueueName; + + private Logger LOG = LoggerFactory.getLogger(JmsAtnaMessageConsumer.class); + + public JmsAtnaMessageConsumer(CountDownLatch latch, String jmsBrokerUrl, String jmsQueueName) { + this.latch = latch; + this.jmsQueueName = jmsQueueName; + this.jmsBrokerUrl = jmsBrokerUrl; + } + + public void run() { + try { + ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(jmsBrokerUrl); + Connection connection = connectionFactory.createConnection(); + connection.start(); + + connection.setExceptionListener(this); + Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + Destination destination = session.createQueue(jmsQueueName); + MessageConsumer consumer = session.createConsumer(destination); + Message message = consumer.receive(1000); + + if (message instanceof BytesMessage) { + BytesMessage bytesMessage = (BytesMessage) message; + byte[] bytes = new byte[(int)bytesMessage.getBodyLength()]; + bytesMessage.readBytes(bytes); + String text = new String(bytes); + LOG.info("JMS Consumer Received: " + text); + } else if (message instanceof TextMessage){ + TextMessage textMessage = (TextMessage) message; + String text = textMessage.getText(); + LOG.info("JMS Consumer Received: " + text); + } else { + LOG.info("JMS Consumer Received: " + message); + } + latch.countDown(); + consumer.close(); + session.close(); + connection.close(); + } catch (Exception e) { + System.out.println("Caught: " + e); + } + } + + public synchronized void onException(JMSException ex) { + System.out.println("JMS Exception occured. Shutting down client."); + } +} From 5b7447280771104cbe0fb7bc2d951eb6bde3adc5 Mon Sep 17 00:00:00 2001 From: stanojevic-boris Date: Wed, 19 Jul 2017 11:10:57 +0200 Subject: [PATCH 13/29] atna jms tests support --- .../queue/JmsAuditMessageQueueTest.java | 18 +++--------------- .../ihe/atna/test/SyslogServerFactory.java | 9 +++++++++ 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java index 4a9b661..5e09c15 100644 --- a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java +++ b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java @@ -15,23 +15,21 @@ */ package org.openhealthtools.ihe.atna.auditor.queue; -import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.broker.BrokerService; import org.apache.activemq.command.ActiveMQQueue; import org.apache.activemq.pool.PooledConnectionFactory; import org.junit.After; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; import org.openhealthtools.ihe.atna.auditor.IHEAuditor; import org.openhealthtools.ihe.atna.auditor.codes.rfc3881.RFC3881EventCodes; import org.openhealthtools.ihe.atna.auditor.context.AuditorModuleContext; -import org.openhealthtools.ihe.atna.test.JmsAtnaMessageConsumer; -import javax.jms.*; import java.util.Locale; import java.util.concurrent.CountDownLatch; +import static org.openhealthtools.ihe.atna.test.SyslogServerFactory.createJMSConsumer; + /** * @author Dmytro Rud */ @@ -60,10 +58,6 @@ public static void beforeClass() throws Exception { jmsBroker.start(); } - public static void afterClass() throws Exception { - jmsBroker.stop(); - } - @After public void tearDown(){ if (atnaQueue != null) { @@ -74,7 +68,7 @@ public void tearDown(){ @Test public void testActiveMQ() throws Exception { CountDownLatch latch = new CountDownLatch(1); - thread(new JmsAtnaMessageConsumer(latch, JMS_BROKER_URL, JMS_QUEUE_NAME), false); + createJMSConsumer(JMS_BROKER_URL, JMS_QUEUE_NAME, latch, false); PooledConnectionFactory jmsConnectionFactory = new PooledConnectionFactory(JMS_BROKER_URL); ActiveMQQueue jmsQueue = new ActiveMQQueue(JMS_QUEUE_NAME); @@ -87,10 +81,4 @@ public void testActiveMQ() throws Exception { latch.await(); } - public static void thread(Runnable runnable, boolean daemon) { - Thread brokerThread = new Thread(runnable); - brokerThread.setDaemon(daemon); - brokerThread.start(); - } - } diff --git a/test/src/main/java/org/openhealthtools/ihe/atna/test/SyslogServerFactory.java b/test/src/main/java/org/openhealthtools/ihe/atna/test/SyslogServerFactory.java index aaf87e8..f89edc0 100644 --- a/test/src/main/java/org/openhealthtools/ihe/atna/test/SyslogServerFactory.java +++ b/test/src/main/java/org/openhealthtools/ihe/atna/test/SyslogServerFactory.java @@ -3,6 +3,8 @@ import io.vertx.core.Verticle; import io.vertx.ext.unit.Async; +import java.util.concurrent.CountDownLatch; + /** * */ @@ -27,4 +29,11 @@ public static Verticle createTCPServerTwoWayTLS(int port, keystorePath, keystorePassword, async); } + public static void createJMSConsumer(String brokerUrl, String queueName, CountDownLatch latch, boolean daemon){ + Runnable runnable = new JmsAtnaMessageConsumer(latch, brokerUrl, queueName); + Thread brokerThread = new Thread(runnable); + brokerThread.setDaemon(daemon); + brokerThread.start(); + } + } From 6445b9cdcbec9293942b53ec1adf2a79e88eea44 Mon Sep 17 00:00:00 2001 From: stanojevic-boris Date: Thu, 20 Jul 2017 09:37:03 +0200 Subject: [PATCH 14/29] jms unit test --- .../ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java index 5e09c15..251d4c0 100644 --- a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java +++ b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java @@ -28,6 +28,7 @@ import java.util.Locale; import java.util.concurrent.CountDownLatch; +import static org.junit.Assert.assertEquals; import static org.openhealthtools.ihe.atna.test.SyslogServerFactory.createJMSConsumer; /** @@ -73,12 +74,12 @@ public void testActiveMQ() throws Exception { PooledConnectionFactory jmsConnectionFactory = new PooledConnectionFactory(JMS_BROKER_URL); ActiveMQQueue jmsQueue = new ActiveMQQueue(JMS_QUEUE_NAME); atnaQueue = new JmsAuditMessageQueue(jmsConnectionFactory, jmsQueue, false); - AuditorModuleContext.getContext().setQueue(atnaQueue); IHEAuditor.getAuditor().auditActorStartEvent(RFC3881EventCodes.RFC3881EventOutcomeCodes.SUCCESS, "actorName", "actorStarter"); latch.await(); + assertEquals(0, latch.getCount()); } } From 18b660aaf2b399125d775e95ea6da192e9863403 Mon Sep 17 00:00:00 2001 From: stanojevic-boris Date: Thu, 20 Jul 2017 11:11:37 +0200 Subject: [PATCH 15/29] jms more unit test --- .../queue/JmsAuditMessageQueueTest.java | 47 ++++++++++++++++++- .../ihe/atna/test/JmsAtnaMessageConsumer.java | 8 ++-- 2 files changed, 50 insertions(+), 5 deletions(-) diff --git a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java index 251d4c0..bf680ca 100644 --- a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java +++ b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java @@ -24,11 +24,20 @@ import org.openhealthtools.ihe.atna.auditor.IHEAuditor; import org.openhealthtools.ihe.atna.auditor.codes.rfc3881.RFC3881EventCodes; import org.openhealthtools.ihe.atna.auditor.context.AuditorModuleContext; +import org.openhealthtools.ihe.atna.test.JmsAtnaMessageConsumer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import javax.jms.ConnectionFactory; import java.util.Locale; +import java.util.Random; import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.stream.IntStream; import static org.junit.Assert.assertEquals; +import static org.openhealthtools.ihe.atna.auditor.codes.rfc3881.RFC3881EventCodes.RFC3881EventOutcomeCodes.SUCCESS; import static org.openhealthtools.ihe.atna.test.SyslogServerFactory.createJMSConsumer; /** @@ -43,6 +52,8 @@ public class JmsAuditMessageQueueTest { private JmsAuditMessageQueue atnaQueue; + private Logger LOG = LoggerFactory.getLogger(JmsAuditMessageQueueTest.class); + @BeforeClass public static void beforeClass() throws Exception { Locale.setDefault(Locale.ENGLISH); @@ -76,10 +87,44 @@ public void testActiveMQ() throws Exception { atnaQueue = new JmsAuditMessageQueue(jmsConnectionFactory, jmsQueue, false); AuditorModuleContext.getContext().setQueue(atnaQueue); - IHEAuditor.getAuditor().auditActorStartEvent(RFC3881EventCodes.RFC3881EventOutcomeCodes.SUCCESS, "actorName", "actorStarter"); + IHEAuditor.getAuditor().auditActorStartEvent(SUCCESS, "actorName", "actorStarter"); latch.await(); assertEquals(0, latch.getCount()); } + @Test + public void testMultiActiveMQ() throws Exception { + CountDownLatch latch = new CountDownLatch(latchCount()); + LOG.info("Latch count: " + latch.getCount()); + ExecutorService executorService = Executors.newFixedThreadPool(2); + IntStream.range(0, (int)latch.getCount()) + .forEach(i -> + executorService.submit(new JmsAtnaMessageConsumer(latch, JMS_BROKER_URL, JMS_QUEUE_NAME)) + ); + + ConnectionFactory jmsConnectionFactory = new PooledConnectionFactory(JMS_BROKER_URL); + ActiveMQQueue jmsQueue = new ActiveMQQueue(JMS_QUEUE_NAME); + atnaQueue = new JmsAuditMessageQueue(jmsConnectionFactory, jmsQueue, false); + AuditorModuleContext.getContext().setQueue(atnaQueue); + + IntStream.range(0, (int)latch.getCount()) + .forEach(i -> + IHEAuditor.getAuditor().auditActorStartEvent(SUCCESS, "actorName" + i, "actorStarter" + i) + ); + + latch.await(); + assertEquals(0, latch.getCount()); + LOG.info("Latch count: " + latch.getCount()); + LOG.info("Shutting down Executor service"); + executorService.shutdown(); + } + + private static int latchCount(){ + Random r = new Random(); + int low = 10; + int high = 100; + return r.nextInt(high-low) + low; + } + } diff --git a/test/src/main/java/org/openhealthtools/ihe/atna/test/JmsAtnaMessageConsumer.java b/test/src/main/java/org/openhealthtools/ihe/atna/test/JmsAtnaMessageConsumer.java index f4ecd9d..257c76f 100644 --- a/test/src/main/java/org/openhealthtools/ihe/atna/test/JmsAtnaMessageConsumer.java +++ b/test/src/main/java/org/openhealthtools/ihe/atna/test/JmsAtnaMessageConsumer.java @@ -41,11 +41,11 @@ public void run() { byte[] bytes = new byte[(int)bytesMessage.getBodyLength()]; bytesMessage.readBytes(bytes); String text = new String(bytes); - LOG.info("JMS Consumer Received: " + text); + LOG.info("JMS Consumer Received BytesMessage: " + text); } else if (message instanceof TextMessage){ TextMessage textMessage = (TextMessage) message; String text = textMessage.getText(); - LOG.info("JMS Consumer Received: " + text); + LOG.info("JMS Consumer Received TextMessage: " + text); } else { LOG.info("JMS Consumer Received: " + message); } @@ -54,11 +54,11 @@ public void run() { session.close(); connection.close(); } catch (Exception e) { - System.out.println("Caught: " + e); + LOG.error("Exception caught: " + e); } } public synchronized void onException(JMSException ex) { - System.out.println("JMS Exception occured. Shutting down client."); + LOG.error("JMS Exception occured. Shutting down client."); } } From 01c1848c0ac5626a1a806c9ff1e2897273a33dc2 Mon Sep 17 00:00:00 2001 From: stanojevic-boris Date: Thu, 20 Jul 2017 11:16:16 +0200 Subject: [PATCH 16/29] jms unit test --- .../ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java index bf680ca..a75609c 100644 --- a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java +++ b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java @@ -100,7 +100,7 @@ public void testMultiActiveMQ() throws Exception { ExecutorService executorService = Executors.newFixedThreadPool(2); IntStream.range(0, (int)latch.getCount()) .forEach(i -> - executorService.submit(new JmsAtnaMessageConsumer(latch, JMS_BROKER_URL, JMS_QUEUE_NAME)) + executorService.execute(new JmsAtnaMessageConsumer(latch, JMS_BROKER_URL, JMS_QUEUE_NAME)) ); ConnectionFactory jmsConnectionFactory = new PooledConnectionFactory(JMS_BROKER_URL); From 1b9680cd424669ceeae87ae387cf56c5eb354a2f Mon Sep 17 00:00:00 2001 From: stanojevic-boris Date: Thu, 20 Jul 2017 13:46:24 +0200 Subject: [PATCH 17/29] some versions update --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index f60610a..6114680 100644 --- a/pom.xml +++ b/pom.xml @@ -18,15 +18,15 @@ 3.0.1 - 5.14.5 + 5.15.0 1.10 3.2.2 2.5 - 3.4 + 3.6 1.1.1 2.0.16 4.1.9.Final - 1.7.21 + 1.7.25 4.12 1.10.19 From dfed1f29cd70fd19f056cb964a1393555de53b83 Mon Sep 17 00:00:00 2001 From: stanojevic-boris Date: Thu, 20 Jul 2017 14:04:49 +0200 Subject: [PATCH 18/29] some plugin versions update --- pom.xml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 6114680..87c932b 100644 --- a/pom.xml +++ b/pom.xml @@ -8,9 +8,8 @@ - 2.6 2.0.1 - 3.5.1 + 3.6.1 1.6 2.10.4 1.6.3 @@ -196,10 +195,6 @@ - - maven-assembly-plugin - ${assembly-plugin-version} - org.apache.maven.plugins maven-release-plugin From 8b288086c9f5d87af5a919a88690e8f687f7f7e3 Mon Sep 17 00:00:00 2001 From: stanojevic-boris Date: Thu, 20 Jul 2017 14:19:08 +0200 Subject: [PATCH 19/29] more versions update --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 87c932b..9e7efef 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ 3.6 1.1.1 2.0.16 - 4.1.9.Final + 4.1.13.Final 1.7.25 4.12 1.10.19 From 15c5528dd6d876a80fe052edaa21422aa4f00314 Mon Sep 17 00:00:00 2001 From: unixoid Date: Sun, 23 Jul 2017 11:52:15 +0200 Subject: [PATCH 20/29] #9: support role ID codes for human users --- auditor/pom.xml | 2 +- .../ihe/atna/auditor/PAMSourceAuditor.java | 6 +- .../ihe/atna/auditor/PDQConsumerAuditor.java | 12 ++-- .../ihe/atna/auditor/PIXAuditor.java | 14 ++-- .../ihe/atna/auditor/PIXConsumerAuditor.java | 19 ++++-- .../ihe/atna/auditor/PIXManagerAuditor.java | 14 ++-- .../ihe/atna/auditor/PIXSourceAuditor.java | 27 +++++--- .../ihe/atna/auditor/SVSConsumerAuditor.java | 7 +- .../auditor/XCAInitiatingGatewayAuditor.java | 28 +++++--- .../auditor/XCARespondingGatewayAuditor.java | 29 +++++--- .../ihe/atna/auditor/XDSAuditor.java | 8 ++- .../ihe/atna/auditor/XDSConsumerAuditor.java | 28 +++++--- .../ihe/atna/auditor/XDSRegistryAuditor.java | 30 ++++++--- .../atna/auditor/XDSRepositoryAuditor.java | 67 ++++++++++++------- .../ihe/atna/auditor/XDSSourceAuditor.java | 16 +++-- .../events/AbstractAuditEventMessageImpl.java | 6 +- .../dicom/ApplicationActivityEvent.java | 10 +-- .../events/dicom/UserAuthenticationEvent.java | 4 +- .../ihe/GenericIHEAuditEventMessage.java | 38 ++++++++--- .../queue/JmsAuditMessageQueueTest.java | 1 - .../atna/auditor/tests/mesa/Mesa11180.java | 2 +- 21 files changed, 243 insertions(+), 125 deletions(-) diff --git a/auditor/pom.xml b/auditor/pom.xml index 5c83445..5f31616 100644 --- a/auditor/pom.xml +++ b/auditor/pom.xml @@ -39,7 +39,7 @@ org.apache.geronimo.specs geronimo-jms_1.1_spec - true + provided org.slf4j diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PAMSourceAuditor.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PAMSourceAuditor.java index 89c30bd..fbca42d 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PAMSourceAuditor.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PAMSourceAuditor.java @@ -70,7 +70,7 @@ sendingFacility, sendingApp, getSystemAltUserId(), getSystemNetworkId(), receivingFacility, receivingApp, null, EventUtils.getAddressForUrl(pixManagerUri, false), getHumanRequestor(), hl7MessageControlId, - new String[] {patientId}, null); + new String[] {patientId}, null, null); } /** @@ -101,7 +101,7 @@ sendingFacility, sendingApp, getSystemAltUserId(), getSystemNetworkId(), receivingFacility, receivingApp, null, EventUtils.getAddressForUrl(pixManagerUri, false), getHumanRequestor(), hl7MessageControlId, - new String[] {patientId}, null); + new String[] {patientId}, null, null); } /** @@ -132,6 +132,6 @@ sendingFacility, sendingApp, getSystemAltUserId(), getSystemNetworkId(), receivingFacility, receivingApp, null, EventUtils.getAddressForUrl(pixManagerUri, false), getHumanRequestor(), hl7MessageControlId, - new String[] {patientId}, null); + new String[] {patientId}, null, null); } } diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PDQConsumerAuditor.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PDQConsumerAuditor.java index 9cc5be6..8135eb1 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PDQConsumerAuditor.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PDQConsumerAuditor.java @@ -75,7 +75,7 @@ sendingFacility, sendingApp, getSystemAltUserId(), getSystemNetworkId(), receivingFacility, receivingApp, null, EventUtils.getAddressForUrl(pixManagerUri, false), getHumanRequestor(), hl7MessageControlId, hl7QueryParameters, - patientIds, null); + patientIds, null, null); } /** @@ -91,12 +91,16 @@ sendingFacility, sendingApp, getSystemAltUserId(), getSystemNetworkId(), * @param hl7MessageId The HL7 message.id * @param hl7QueryParameters The HL7 query parameters * @param patientIds List of patient IDs that were seen in this transaction + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ public void auditPDQQueryV3Event(RFC3881EventOutcomeCodes eventOutcome, String pixManagerUri, String receivingFacility, String receivingApp, String sendingFacility, String sendingApp, String hl7MessageId, String hl7QueryParameters, - String[] patientIds, List purposesOfUse) + String[] patientIds, + List purposesOfUse, + List userRoles) { if (!isAuditorEnabled()) { return; @@ -107,7 +111,7 @@ sendingFacility, sendingApp, getSystemAltUserId(), getSystemNetworkId(), receivingFacility, receivingApp, null, EventUtils.getAddressForUrl(pixManagerUri, false), getHumanRequestor(), hl7MessageId, hl7QueryParameters, - patientIds, purposesOfUse); + patientIds, purposesOfUse, userRoles); } /** @@ -139,7 +143,7 @@ sendingFacility, sendingApp, getSystemAltUserId(), getSystemNetworkId(), receivingFacility, receivingApp, null, EventUtils.getAddressForUrl(pixManagerUri, false), getHumanRequestor(), hl7MessageControlId, hl7QueryParameters, - patientIds, null); + patientIds, null, null); } } diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXAuditor.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXAuditor.java index 9f8167f..d0f5dad 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXAuditor.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXAuditor.java @@ -49,6 +49,8 @@ public abstract class PIXAuditor extends IHEAuditor * @param hl7MessageId The HL7 Message ID (v2 from the MSH segment field 10, v3 from message.Id) * @param hl7QueryParameters The HL7 Query Parameters from the QPD segment * @param patientIds List of patient IDs that were seen in this transaction + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ protected void auditQueryEvent(boolean systemIsSource, IHETransactionEventTypeCodes transaction, RFC3881EventOutcomeCodes eventOutcome, @@ -57,7 +59,8 @@ protected void auditQueryEvent(boolean systemIsSource, String humanRequestor, String hl7MessageId, String hl7QueryParameters, String[] patientIds, - List purposesOfUse) + List purposesOfUse, + List userRoles) { // Create query event QueryEvent queryEvent = new QueryEvent(systemIsSource, eventOutcome, transaction, purposesOfUse); @@ -66,7 +69,7 @@ protected void auditQueryEvent(boolean systemIsSource, queryEvent.addSourceActiveParticipant(EventUtils.concatHL7FacilityApplication(sourceFacility,sourceApp), sourceAltUserId, null, sourceNetworkId, true); // Set the human requestor active participant if (!EventUtils.isEmptyOrNull(humanRequestor)) { - queryEvent.addHumanRequestorActiveParticipant(humanRequestor, null, null, null); + queryEvent.addHumanRequestorActiveParticipant(humanRequestor, null, null, userRoles); } // Set the destination active participant queryEvent.addDestinationActiveParticipant(EventUtils.concatHL7FacilityApplication(destinationFacility,destinationApp), destinationAltUserId, null, destinationNetworkId, false); @@ -111,6 +114,8 @@ protected void auditQueryEvent(boolean systemIsSource, * @param humanRequestor Identity of the human that initiated the transaction (if known) * @param hl7MessageId The HL7 Message ID (v2 from the MSH segment field 10, v3 from message.Id) * @param patientIds List of patient IDs that were seen in this transaction + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ protected void auditPatientRecordEvent(boolean systemIsSource, IHETransactionEventTypeCodes transaction, RFC3881EventOutcomeCodes eventOutcome, RFC3881EventActionCodes eventActionCode, @@ -119,7 +124,8 @@ protected void auditPatientRecordEvent(boolean systemIsSource, String humanRequestor, String hl7MessageId, String patientIds[], - List purposesOfUse) + List purposesOfUse, + List userRoles) { // Create Patient Record event PatientRecordEvent patientEvent = new PatientRecordEvent(systemIsSource, eventOutcome, eventActionCode, transaction, purposesOfUse); @@ -128,7 +134,7 @@ protected void auditPatientRecordEvent(boolean systemIsSource, patientEvent.addSourceActiveParticipant(EventUtils.concatHL7FacilityApplication(sourceFacility,sourceApp), sourceAltUserId, null, sourceNetworkId, true); // Set the human requestor active participant if (!EventUtils.isEmptyOrNull(humanRequestor)) { - patientEvent.addHumanRequestorActiveParticipant(humanRequestor, null, null, null); + patientEvent.addHumanRequestorActiveParticipant(humanRequestor, null, null, userRoles); } // Set the destination active participant patientEvent.addDestinationActiveParticipant(EventUtils.concatHL7FacilityApplication(destinationFacility,destinationApp), destinationAltUserId, null, destinationNetworkId, false); diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXConsumerAuditor.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXConsumerAuditor.java index 852acd5..9c70080 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXConsumerAuditor.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXConsumerAuditor.java @@ -77,7 +77,7 @@ sendingFacility, sendingApp, getSystemAltUserId(), getSystemNetworkId(), receivingFacility, receivingApp, null, EventUtils.getAddressForUrl(pixManagerUri, false), getHumanRequestor(), hl7MessageControlId, hl7QueryParameters, - patientIds, null); + patientIds, null, null); } /** @@ -93,12 +93,16 @@ sendingFacility, sendingApp, getSystemAltUserId(), getSystemNetworkId(), * @param hl7MessageId The HL7 message.id * @param hl7QueryParameters The HL7 query parameters * @param patientIds List of patient IDs that were seen in this transaction + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ public void auditPIXQueryV3Event(RFC3881EventOutcomeCodes eventOutcome, String pixManagerUri, String receivingFacility, String receivingApp, String sendingFacility, String sendingApp, String hl7MessageId, String hl7QueryParameters, - String[] patientIds, List purposesOfUse) + String[] patientIds, + List purposesOfUse, + List userRoles) { if (!isAuditorEnabled()) { return; @@ -109,7 +113,7 @@ sendingFacility, sendingApp, getSystemAltUserId(), getSystemNetworkId(), receivingFacility, receivingApp, null, EventUtils.getAddressForUrl(pixManagerUri, false), getHumanRequestor(), hl7MessageId, hl7QueryParameters, - patientIds, purposesOfUse); + patientIds, purposesOfUse, userRoles); } /** @@ -140,7 +144,7 @@ public void auditUpdateNotificationEvent(RFC3881EventOutcomeCodes eventOutcome, receivingFacility, receivingApp, getSystemAltUserId(), getSystemNetworkId(), null, hl7MessageControlId, - patientIds, null); + patientIds, null, null); } /** @@ -155,13 +159,16 @@ receivingFacility, receivingApp, getSystemAltUserId(), getSystemNetworkId(), * @param sendingApp The HL7 sending application * @param hl7MessageId The HL7 message.id * @param patientIds List of patient IDs that were seen in this transaction + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ public void auditUpdateNotificationV3Event(RFC3881EventOutcomeCodes eventOutcome, String pixMgrIpAddress, String sendingFacility, String sendingApp, String receivingFacility, String receivingApp, String hl7MessageId, String[] patientIds, - List purposesOfUse) + List purposesOfUse, + List userRoles) { if (!isAuditorEnabled()) { return; @@ -172,6 +179,6 @@ public void auditUpdateNotificationV3Event(RFC3881EventOutcomeCodes eventOutcome receivingFacility, receivingApp, getSystemAltUserId(), getSystemNetworkId(), null, hl7MessageId, - patientIds, purposesOfUse); + patientIds, purposesOfUse, userRoles); } } diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXManagerAuditor.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXManagerAuditor.java index c26f203..26f0a12 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXManagerAuditor.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXManagerAuditor.java @@ -74,7 +74,7 @@ public void auditCreatePatientRecordEvent(RFC3881EventOutcomeCodes eventOutcome, receivingFacility, receivingApp, getSystemAltUserId(), EventUtils.getAddressForUrl(pixManagerUri, false), null, hl7MessageControlId, - new String[] {patientId}, null); + new String[] {patientId}, null, null); } /** @@ -106,7 +106,7 @@ public void auditDeletePatientRecordEvent(RFC3881EventOutcomeCodes eventOutcome, receivingFacility, receivingApp, getSystemAltUserId(), EventUtils.getAddressForUrl(pixManagerUri, false), null, hl7MessageControlId, - new String[] {patientId}, null); + new String[] {patientId}, null, null); } /** @@ -137,7 +137,7 @@ public void auditUpdatePatientRecordEvent(RFC3881EventOutcomeCodes eventOutcome, receivingFacility, receivingApp, getSystemAltUserId(), EventUtils.getAddressForUrl(pixManagerUri, false), null, hl7MessageControlId, - new String[] {patientId}, null); + new String[] {patientId}, null, null); } /** @@ -170,7 +170,7 @@ public void auditPDQQueryEvent(RFC3881EventOutcomeCodes eventOutcome, receivingFacility, receivingApp, getSystemAltUserId(), EventUtils.getAddressForUrl(pixManagerUri, false), null, hl7MessageControlId, hl7QueryParameters, - patientIds, null); + patientIds, null, null); } /** @@ -203,7 +203,7 @@ public void auditPDVQQueryEvent(RFC3881EventOutcomeCodes eventOutcome, receivingFacility, receivingApp, getSystemAltUserId(), EventUtils.getAddressForUrl(pixManagerUri, false), null, hl7MessageControlId, hl7QueryParameters, - patientIds, null); + patientIds, null, null); } /** @@ -235,7 +235,7 @@ public void auditPIXQueryEvent(RFC3881EventOutcomeCodes eventOutcome, receivingFacility, receivingApp, getSystemAltUserId(), EventUtils.getAddressForUrl(pixManagerUri, false), null, hl7MessageControlId, hl7QueryParameters, - patientIds, null); + patientIds, null, null); } /** @@ -268,6 +268,6 @@ sendingFacility, sendingApp, getSystemAltUserId(), pixMgrIpAddress, receivingFacility, receivingApp, null, EventUtils.getAddressForUrl(consumerEndpointUri, false), null, hl7MessageControlId, - patientIds, null); + patientIds, null, null); } } diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXSourceAuditor.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXSourceAuditor.java index fbcef31..9b5ea8b 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXSourceAuditor.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXSourceAuditor.java @@ -74,7 +74,7 @@ sendingFacility, sendingApp, getSystemAltUserId(), getSystemNetworkId(), receivingFacility, receivingApp, null, EventUtils.getAddressForUrl(pixManagerUri, false), getHumanRequestor(), hl7MessageControlId, - new String[] {patientId}, null); + new String[] {patientId}, null, null); } /** @@ -89,13 +89,16 @@ sendingFacility, sendingApp, getSystemAltUserId(), getSystemNetworkId(), * @param sendingApp The HL7 sending application * @param hl7MessageId The HL7 message.id * @param patientId The patient ID that was affected by this event + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ public void auditCreatePatientRecordV3Event(RFC3881EventOutcomeCodes eventOutcome, String pixManagerUri, String receivingFacility, String receivingApp, String sendingFacility, String sendingApp, String hl7MessageId, String patientId, - List purposesOfUse) + List purposesOfUse, + List userRoles) { if (!isAuditorEnabled()) { return; @@ -106,7 +109,7 @@ sendingFacility, sendingApp, getSystemAltUserId(), getSystemNetworkId(), receivingFacility, receivingApp, null, EventUtils.getAddressForUrl(pixManagerUri, false), getHumanRequestor(), hl7MessageId, - new String[] {patientId}, purposesOfUse); + new String[] {patientId}, purposesOfUse, userRoles); } /** @@ -137,7 +140,7 @@ sendingFacility, sendingApp, getSystemAltUserId(), getSystemNetworkId(), receivingFacility, receivingApp, null, EventUtils.getAddressForUrl(pixManagerUri, false), getHumanRequestor(), hl7MessageControlId, - new String[] {patientId}, null); + new String[] {patientId}, null, null); } /** @@ -152,13 +155,16 @@ sendingFacility, sendingApp, getSystemAltUserId(), getSystemNetworkId(), * @param sendingApp The HL7 sending application * @param hl7MessageId The HL7 message.id * @param patientId The patient ID that was affected by this event + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ public void auditDeletePatientRecordV3Event(RFC3881EventOutcomeCodes eventOutcome, String pixManagerUri, String receivingFacility, String receivingApp, String sendingFacility, String sendingApp, String hl7MessageId, String patientId, - List purposesOfUse) + List purposesOfUse, + List userRoles) { if (!isAuditorEnabled()) { return; @@ -169,7 +175,7 @@ sendingFacility, sendingApp, getSystemAltUserId(), getSystemNetworkId(), receivingFacility, receivingApp, null, EventUtils.getAddressForUrl(pixManagerUri, false), getHumanRequestor(), hl7MessageId, - new String[] {patientId}, purposesOfUse); + new String[] {patientId}, purposesOfUse, userRoles); } /** @@ -200,7 +206,7 @@ sendingFacility, sendingApp, getSystemAltUserId(), getSystemNetworkId(), receivingFacility, receivingApp, null, EventUtils.getAddressForUrl(pixManagerUri, false), getHumanRequestor(), hl7MessageControlId, - new String[] {patientId}, null); + new String[] {patientId}, null, null); } /** @@ -215,13 +221,16 @@ sendingFacility, sendingApp, getSystemAltUserId(), getSystemNetworkId(), * @param sendingApp The HL7 sending application * @param hl7MessageId The HL7 message.id * @param patientId The patient ID that was affected by this event + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ public void auditUpdatePatientRecordV3Event(RFC3881EventOutcomeCodes eventOutcome, String pixManagerUri, String receivingFacility, String receivingApp, String sendingFacility, String sendingApp, String hl7MessageId, String patientId, - List purposesOfUse) + List purposesOfUse, + List userRoles) { if (!isAuditorEnabled()) { return; @@ -232,6 +241,6 @@ sendingFacility, sendingApp, getSystemAltUserId(), getSystemNetworkId(), receivingFacility, receivingApp, null, EventUtils.getAddressForUrl(pixManagerUri, false), getHumanRequestor(), hl7MessageId, - new String[] {patientId}, purposesOfUse); + new String[] {patientId}, purposesOfUse, userRoles); } } diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/SVSConsumerAuditor.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/SVSConsumerAuditor.java index a2f0860..79e28bf 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/SVSConsumerAuditor.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/SVSConsumerAuditor.java @@ -53,12 +53,15 @@ public static SVSConsumerAuditor getAuditor() * @param valueSetUniqueId unique id (OID) of the returned value set * @param valueSetName name associated with the unique id (OID) of the returned value set * @param valueSetVersion version of the returned value set + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ public void auditRetrieveValueSetEvent(RFC3881EventOutcomeCodes eventOutcome, String repositoryEndpointUri, String valueSetUniqueId, String valueSetName, String valueSetVersion, - List purposesOfUse) + List purposesOfUse, + List userRoles) { if (!isAuditorEnabled()) { return; @@ -68,7 +71,7 @@ public void auditRetrieveValueSetEvent(RFC3881EventOutcomeCodes eventOutcome, importEvent.addSourceActiveParticipant(EventUtils.getAddressForUrl(repositoryEndpointUri, false), null, null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false); importEvent.addDestinationActiveParticipant(getSystemUserId(), getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), true); if (!EventUtils.isEmptyOrNull(getHumanRequestor())) { - importEvent.addHumanRequestorActiveParticipant(getHumanRequestor(), null, null, null); + importEvent.addHumanRequestorActiveParticipant(getHumanRequestor(), null, null, userRoles); } importEvent.addValueSetParticipantObject(valueSetUniqueId, valueSetName, valueSetVersion); audit(importEvent); diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XCAInitiatingGatewayAuditor.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XCAInitiatingGatewayAuditor.java index 358c54e..a5b9eea 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XCAInitiatingGatewayAuditor.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XCAInitiatingGatewayAuditor.java @@ -57,13 +57,15 @@ public static XCAInitiatingGatewayAuditor getAuditor() * @param adhocQueryRequestPayload The payload of the adhoc query request element * @param homeCommunityId The home community id of the transaction (if present) * @param patientId The patient ID queried (if query pertained to a patient id) + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ public void auditCrossGatewayQueryEvent( RFC3881EventOutcomeCodes eventOutcome, String respondingGatewayEndpointUri, String initiatingGatewayUserId, String initiatingGatewayUserName, String storedQueryUUID, String adhocQueryRequestPayload, String homeCommunityId, - String patientId, List purposesOfUse) + String patientId, List purposesOfUse, List userRoles) { if (!isAuditorEnabled()) { return; @@ -76,7 +78,7 @@ initiatingGatewayUserId, getSystemAltUserId(), initiatingGatewayUserName, getSys initiatingGatewayUserName, initiatingGatewayUserName, false, respondingGatewayEndpointUri, null, storedQueryUUID, adhocQueryRequestPayload, homeCommunityId, - patientId, purposesOfUse); + patientId, purposesOfUse, userRoles); } /** @@ -87,12 +89,14 @@ initiatingGatewayUserId, getSystemAltUserId(), initiatingGatewayUserName, getSys * @param documentUniqueIds The list of Document Entry UniqueId(s) for the document(s) retrieved * @param repositoryUniqueIds The list of XDS.b Repository Unique Ids involved in this transaction (aligned with Document Unique Ids array) * @param homeCommunityIds The list of home community ids used in the transaction - */ + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) + */ public void auditCrossGatewayRetrieveEvent(RFC3881EventOutcomeCodes eventOutcome, String respondingGatewayEndpointUri, String initiatingGatewayUserId, String initiatingGatewayUserName, String[] documentUniqueIds, String[] repositoryUniqueIds, String[] homeCommunityIds, - List purposesOfUse) + List purposesOfUse, List userRoles) { if (!isAuditorEnabled()) { return; @@ -103,7 +107,7 @@ public void auditCrossGatewayRetrieveEvent(RFC3881EventOutcomeCodes eventOutcome importEvent.addDestinationActiveParticipant(initiatingGatewayUserId, getSystemAltUserId(), initiatingGatewayUserName, getSystemNetworkId(), true); if(!EventUtils.isEmptyOrNull(initiatingGatewayUserName)) { - importEvent.addHumanRequestorActiveParticipant(initiatingGatewayUserName, null, initiatingGatewayUserName, null); + importEvent.addHumanRequestorActiveParticipant(initiatingGatewayUserName, null, initiatingGatewayUserName, userRoles); } if (!EventUtils.isEmptyOrNull(documentUniqueIds)) { @@ -125,20 +129,22 @@ public void auditCrossGatewayRetrieveEvent(RFC3881EventOutcomeCodes eventOutcome * @param documentUniqueIds The list of Document Entry UniqueId(s) for the document(s) retrieved * @param repositoryUniqueIds The list of XDS.b Repository Unique Ids involved in this transaction (aligned with Document Unique Ids array) * @param homeCommunityIds The list of XCA Home Community Ids involved in this transaction (aligned with Document Unique Ids array) + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ public void auditRetrieveDocumentSetEvent( RFC3881EventOutcomeCodes eventOutcome, String consumerUserId, String consumerUserName, String consumerIpAddress, String repositoryEndpointUri, String[] documentUniqueIds, String[] repositoryUniqueIds, String[] homeCommunityIds, - List purposesOfUse) + List purposesOfUse, List userRoles) { if (!isAuditorEnabled()) { return; } XDSRepositoryAuditor.getAuditor().auditRetrieveDocumentSetEvent(eventOutcome, consumerUserId, consumerUserName, consumerIpAddress, repositoryEndpointUri, - documentUniqueIds, repositoryUniqueIds, homeCommunityIds, purposesOfUse); + documentUniqueIds, repositoryUniqueIds, homeCommunityIds, purposesOfUse, userRoles); } /** @@ -153,18 +159,22 @@ public void auditRetrieveDocumentSetEvent( * @param adhocQueryRequestPayload The payload of the adhoc query request element * @param homeCommunityId The home community id of the transaction (if present) * @param patientId The patient ID queried (if query pertained to a patient id) + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ public void auditRegistryStoredQueryEvent( RFC3881EventOutcomeCodes eventOutcome, String consumerUserId, String consumerUserName, String consumerIpAddress, String registryEndpointUri, String storedQueryUUID, String adhocQueryRequestPayload, String homeCommunityId, - String patientId, List purposesOfUse) + String patientId, List purposesOfUse, List userRoles) { if (!isAuditorEnabled()) { return; } - XDSRegistryAuditor.getAuditor().auditRegistryStoredQueryEvent(eventOutcome, consumerUserId, consumerUserName, consumerIpAddress, registryEndpointUri, storedQueryUUID, adhocQueryRequestPayload, homeCommunityId, patientId, purposesOfUse); + XDSRegistryAuditor.getAuditor().auditRegistryStoredQueryEvent(eventOutcome, consumerUserId, consumerUserName, + consumerIpAddress, registryEndpointUri, storedQueryUUID, adhocQueryRequestPayload, homeCommunityId, + patientId, purposesOfUse, userRoles); } } diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XCARespondingGatewayAuditor.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XCARespondingGatewayAuditor.java index 4e2d9d7..d063ef7 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XCARespondingGatewayAuditor.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XCARespondingGatewayAuditor.java @@ -61,6 +61,8 @@ public static XCARespondingGatewayAuditor getAuditor() * @param adhocQueryRequestPayload The payload of the adhoc query request element * @param homeCommunityId The home community id of the transaction (if present) * @param patientId The patient ID queried (if query pertained to a patient id) + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ public void auditCrossGatewayQueryEvent( RFC3881EventOutcomeCodes eventOutcome, @@ -68,7 +70,8 @@ public void auditCrossGatewayQueryEvent( String respondingGatewayEndpointUri, String storedQueryUUID, String adhocQueryRequestPayload, String homeCommunityId, String patientId, - List purposesOfUse) + List purposesOfUse, + List userRoles) { if (!isAuditorEnabled()) { return; @@ -80,7 +83,7 @@ public void auditCrossGatewayQueryEvent( initiatingGatewayUserName, initiatingGatewayUserName, false, respondingGatewayEndpointUri, getSystemAltUserId(), storedQueryUUID, adhocQueryRequestPayload, homeCommunityId, - patientId, purposesOfUse); + patientId, purposesOfUse, userRoles); } /** @@ -94,6 +97,8 @@ respondingGatewayEndpointUri, getSystemAltUserId(), * @param documentUniqueIds The list of Document Entry UniqueId(s) for the document(s) retrieved * @param repositoryUniqueIds The list of XDS.b Repository Unique Ids involved in this transaction (aligned with Document Unique Ids array) * @param homeCommunityIds The list of home community ids used in the transaction + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ public void auditCrossGatewayRetrieveEvent( RFC3881EventOutcomeCodes eventOutcome, @@ -101,7 +106,8 @@ public void auditCrossGatewayRetrieveEvent( String respondingGatewayEndpointUri, String initiatingGatewayUserName, String[] documentUniqueIds, String[] repositoryUniqueIds, String homeCommunityIds[], - List purposesOfUse) + List purposesOfUse, + List userRoles) { if (!isAuditorEnabled()) { return; @@ -111,7 +117,7 @@ public void auditCrossGatewayRetrieveEvent( exportEvent.addSourceActiveParticipant(respondingGatewayEndpointUri, getSystemAltUserId(), null, EventUtils.getAddressForUrl(respondingGatewayEndpointUri, false), false); if(!EventUtils.isEmptyOrNull(initiatingGatewayUserName)) { - exportEvent.addHumanRequestorActiveParticipant(initiatingGatewayUserName, null, initiatingGatewayUserName, null); + exportEvent.addHumanRequestorActiveParticipant(initiatingGatewayUserName, null, initiatingGatewayUserName, userRoles); } exportEvent.addDestinationActiveParticipant(initiatingGatewayUserId, null, null, initiatingGatewayIpAddress, true); @@ -132,19 +138,21 @@ public void auditCrossGatewayRetrieveEvent( * @param repositoryUniqueIds The XDS.b RepositoryUniqueId value for the repository * @param documentUniqueIds The list of Document Entry UniqueId(s) for the document(s) retrieved * @param homeCommunityIds The list of home community ids used in the transaction - */ + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) + */ public void auditRetrieveDocumentSetEvent(RFC3881EventOutcomeCodes eventOutcome, String repositoryEndpointUri, String userName, String[] documentUniqueIds, String[] repositoryUniqueIds, String homeCommunityIds[], - List purposesOfUse) + List purposesOfUse, List userRoles) { if (!isAuditorEnabled()) { return; } XDSConsumerAuditor.getAuditor().auditRetrieveDocumentSetEvent(eventOutcome, repositoryEndpointUri, userName, - documentUniqueIds, repositoryUniqueIds, homeCommunityIds, null, purposesOfUse); + documentUniqueIds, repositoryUniqueIds, homeCommunityIds, null, purposesOfUse, userRoles); } /** @@ -156,6 +164,8 @@ public void auditRetrieveDocumentSetEvent(RFC3881EventOutcomeCodes eventOutcome, * @param adhocQueryRequestPayload The payload of the adhoc query request element * @param homeCommunityId The home community id of the transaction (if present) * @param patientId The patient ID queried (if query pertained to a patient id) + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ public void auditRegistryStoredQueryEvent( RFC3881EventOutcomeCodes eventOutcome, @@ -163,14 +173,15 @@ public void auditRegistryStoredQueryEvent( String consumerUserName, String storedQueryUUID, String adhocQueryRequestPayload, String homeCommunityId, String patientId, - List purposesOfUse) + List purposesOfUse, + List userRoles) { if (!isAuditorEnabled()) { return; } XDSConsumerAuditor.getAuditor().auditRegistryStoredQueryEvent(eventOutcome, registryEndpointUri, consumerUserName, storedQueryUUID, adhocQueryRequestPayload, - homeCommunityId, patientId, purposesOfUse); + homeCommunityId, patientId, purposesOfUse, userRoles); } } diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSAuditor.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSAuditor.java index e16eddf..a7b10f3 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSAuditor.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSAuditor.java @@ -49,6 +49,8 @@ public abstract class XDSAuditor extends IHEAuditor * @param adhocQueryRequestPayload The payload of the adhoc query request element * @param homeCommunityId The home community id of the transaction (if present) * @param patientId The patient ID queried (if query pertained to a patient id) + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ protected void auditQueryEvent( boolean systemIsSource, // System Type @@ -60,8 +62,8 @@ protected void auditQueryEvent( boolean humanAfterDestination, String registryEndpointUri, String registryAltUserId, // Destination Participant String storedQueryUUID, String adhocQueryRequestPayload, String homeCommunityId, // Payload Object Participant - String patientId, - List purposesOfUse) // Patient Object Participant + String patientId, // Patient Object Participant + List purposesOfUse, List userRoles) { QueryEvent queryEvent = new QueryEvent(systemIsSource, eventOutcome, transaction, purposesOfUse); queryEvent.setAuditSourceId(auditSourceId, auditSourceEnterpriseSiteId); @@ -72,7 +74,7 @@ protected void auditQueryEvent( } if(!EventUtils.isEmptyOrNull(humanRequestorName)) { - queryEvent.addHumanRequestorActiveParticipant(humanRequestorName, null, humanRequestorName, null); + queryEvent.addHumanRequestorActiveParticipant(humanRequestorName, null, humanRequestorName, userRoles); } if (! humanAfterDestination) { diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSConsumerAuditor.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSConsumerAuditor.java index dcb964c..d5f0f26 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSConsumerAuditor.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSConsumerAuditor.java @@ -11,6 +11,7 @@ package org.openhealthtools.ihe.atna.auditor; import java.util.Arrays; +import java.util.Collections; import java.util.List; import org.openhealthtools.ihe.atna.auditor.codes.ihe.IHETransactionEventTypeCodes; @@ -74,7 +75,7 @@ public void auditRegistryQueryEvent( consumerUserName, consumerUserName, true, registryEndpointUri, null, "", adhocQueryRequestPayload, "", - patientId, null); + patientId, null, null); } @@ -88,6 +89,8 @@ public void auditRegistryQueryEvent( * @param adhocQueryRequestPayload The payload of the adhoc query request element * @param homeCommunityId The home community id of the transaction (if present) * @param patientId The patient ID queried (if query pertained to a patient id) + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ public void auditRegistryStoredQueryEvent( RFC3881EventOutcomeCodes eventOutcome, @@ -95,7 +98,8 @@ public void auditRegistryStoredQueryEvent( String consumerUserName, String storedQueryUUID, String adhocQueryRequestPayload, String homeCommunityId, String patientId, - List purposesOfUse) + List purposesOfUse, + List userRoles) { if (!isAuditorEnabled()) { return; @@ -114,7 +118,7 @@ replyToUri, getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), consumerUserName, consumerUserName, false, registryEndpointUri, null, storedQueryUUID, adhocQueryRequestPayload, homeCommunityId, - patientId, purposesOfUse); + patientId, purposesOfUse, userRoles); } @@ -140,7 +144,7 @@ public void auditRetrieveDocumentEvent(RFC3881EventOutcomeCodes eventOutcome, importEvent.addSourceActiveParticipant(repositoryRetrieveUri, null, null, EventUtils.getAddressForUrl(repositoryRetrieveUri, false), false); importEvent.addDestinationActiveParticipant(getSystemUserId(), getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), true); if (!EventUtils.isEmptyOrNull(userName)) { - importEvent.addHumanRequestorActiveParticipant(userName, null, userName, null); + importEvent.addHumanRequestorActiveParticipant(userName, null, userName, (List) null); } if (!EventUtils.isEmptyOrNull(patientId)) { importEvent.addPatientParticipantObject(patientId); @@ -160,13 +164,16 @@ public void auditRetrieveDocumentEvent(RFC3881EventOutcomeCodes eventOutcome, * @param repositoryUniqueId The XDS.b RepositoryUniqueId value for the repository * @param homeCommunityId The XCA Home Community Id used in the transaction * @param patientId The patient ID the document(s) relate to (if known) - */ + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) + */ public void auditRetrieveDocumentSetEvent(RFC3881EventOutcomeCodes eventOutcome, String repositoryEndpointUri, String userName, String[] documentUniqueIds, String repositoryUniqueId, String homeCommunityId, String patientId, - List purposesOfUse) + List purposesOfUse, + List userRoles) { if (!isAuditorEnabled()) { return; @@ -183,7 +190,7 @@ public void auditRetrieveDocumentSetEvent(RFC3881EventOutcomeCodes eventOutcome, auditRetrieveDocumentSetEvent(eventOutcome, repositoryEndpointUri, userName, - documentUniqueIds, repositoryUniqueIds, homeCommunityIds, patientId, purposesOfUse); + documentUniqueIds, repositoryUniqueIds, homeCommunityIds, patientId, purposesOfUse, userRoles); } @@ -197,13 +204,16 @@ public void auditRetrieveDocumentSetEvent(RFC3881EventOutcomeCodes eventOutcome, * @param repositoryUniqueIds The list of XDS.b Repository Unique Ids involved in this transaction (aligned with Document Unique Ids array) * @param homeCommunityIds The list of XCA Home Community Ids involved in this transaction (aligned with Document Unique Ids array) * @param patientId The patient ID the document(s) relate to (if known) + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ public void auditRetrieveDocumentSetEvent(RFC3881EventOutcomeCodes eventOutcome, String repositoryEndpointUri, String userName, String[] documentUniqueIds, String[] repositoryUniqueIds, String[] homeCommunityIds, String patientId, - List purposesOfUse) + List purposesOfUse, + List userRoles) { if (!isAuditorEnabled()) { return; @@ -217,7 +227,7 @@ public void auditRetrieveDocumentSetEvent(RFC3881EventOutcomeCodes eventOutcome, String replyToUri = "http://www.w3.org/2005/08/addressing/anonymous"; importEvent.addDestinationActiveParticipant(replyToUri, getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), true); if (!EventUtils.isEmptyOrNull(userName)) { - importEvent.addHumanRequestorActiveParticipant(userName, null, userName, null); + importEvent.addHumanRequestorActiveParticipant(userName, null, userName, userRoles); } if (!EventUtils.isEmptyOrNull(patientId)) { importEvent.addPatientParticipantObject(patientId); diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRegistryAuditor.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRegistryAuditor.java index 25bfa6a..8613f2f 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRegistryAuditor.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRegistryAuditor.java @@ -72,7 +72,7 @@ public void auditRegisterDocumentSetEvent( auditRegisterEvent(new IHETransactionEventTypeCodes.RegisterDocumentSet(), eventOutcome, repositoryUserId, repositoryIpAddress, userName, - registryEndpointUri, submissionSetUniqueId, patientId, null); + registryEndpointUri, submissionSetUniqueId, patientId, null, null); } /** @@ -103,7 +103,7 @@ public void auditRegistryQueryEvent( consumerUserName, consumerUserName, true, registryEndpointUri, getSystemAltUserId(), "", adhocQueryRequestPayload, "", - patientId, null); + patientId, null, null); } /** @@ -118,13 +118,15 @@ registryEndpointUri, getSystemAltUserId(), * @param adhocQueryRequestPayload The payload of the adhoc query request element * @param homeCommunityId The home community id of the transaction (if present) * @param patientId The patient ID queried (if query pertained to a patient id) + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ public void auditRegistryStoredQueryEvent( RFC3881EventOutcomeCodes eventOutcome, String consumerUserId, String consumerUserName, String consumerIpAddress, String registryEndpointUri, String storedQueryUUID, String adhocQueryRequestPayload, String homeCommunityId, - String patientId, List purposesOfUse) + String patientId, List purposesOfUse, List userRoles) { if (!isAuditorEnabled()) { return; @@ -136,7 +138,7 @@ public void auditRegistryStoredQueryEvent( consumerUserName, consumerUserName, false, registryEndpointUri, getSystemAltUserId(), storedQueryUUID, adhocQueryRequestPayload, homeCommunityId, - patientId, purposesOfUse); + patientId, purposesOfUse, userRoles); } @Deprecated @@ -149,7 +151,7 @@ public void auditRegistryStoredQueryEvent( { auditRegistryStoredQueryEvent(eventOutcome, consumerUserId, consumerUserName, consumerIpAddress, registryEndpointUri, storedQueryUUID, adhocQueryRequestPayload, - homeCommunityId, patientId, null); + homeCommunityId, patientId, null, null); } /** @@ -161,6 +163,8 @@ public void auditRegistryStoredQueryEvent( * @param registryEndpointUri The URI of this registry's endpoint that received the transaction * @param submissionSetUniqueId The UniqueID of the Submission Set registered * @param patientId The Patient Id that this submission pertains to + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ public void auditRegisterDocumentSetBEvent( RFC3881EventOutcomeCodes eventOutcome, @@ -169,7 +173,8 @@ public void auditRegisterDocumentSetBEvent( String registryEndpointUri, String submissionSetUniqueId, String patientId, - List purposesOfUse) + List purposesOfUse, + List userRoles) { if (!isAuditorEnabled()) { return; @@ -177,7 +182,7 @@ public void auditRegisterDocumentSetBEvent( auditRegisterEvent(new IHETransactionEventTypeCodes.RegisterDocumentSetB(), eventOutcome, repositoryUserId, repositoryIpAddress, userName, - registryEndpointUri, submissionSetUniqueId, patientId, purposesOfUse); + registryEndpointUri, submissionSetUniqueId, patientId, purposesOfUse, userRoles); } @Deprecated @@ -190,7 +195,7 @@ public void auditRegisterDocumentSetBEvent( String patientId) { auditRegisterDocumentSetBEvent(eventOutcome, repositoryUserId, repositoryIpAddress, - userName, registryEndpointUri, submissionSetUniqueId, patientId, null); + userName, registryEndpointUri, submissionSetUniqueId, patientId, null, null); } /** @@ -204,6 +209,8 @@ public void auditRegisterDocumentSetBEvent( * @param registryEndpointUri The URI of this registry's endpoint that received the transaction * @param submissionSetUniqueId The UniqueID of the Submission Set provided * @param patientId The Patient Id that this submission pertains to + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ protected void auditRegisterEvent( IHETransactionEventTypeCodes transaction, RFC3881EventOutcomeCodes eventOutcome, @@ -212,13 +219,14 @@ protected void auditRegisterEvent( String registryEndpointUri, String submissionSetUniqueId, String patientId, - List purposesOfUse) + List purposesOfUse, + List userRoles) { ImportEvent importEvent = new ImportEvent(false, eventOutcome, transaction, purposesOfUse); importEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); importEvent.addSourceActiveParticipant(repositoryUserId, null, null, repositoryIpAddress, true); if (! EventUtils.isEmptyOrNull(userName)) { - importEvent.addHumanRequestorActiveParticipant(userName, null, userName, null); + importEvent.addHumanRequestorActiveParticipant(userName, null, userName, userRoles); } importEvent.addDestinationActiveParticipant(registryEndpointUri, getSystemAltUserId(), null, EventUtils.getAddressForUrl(registryEndpointUri, false), false); if (!EventUtils.isEmptyOrNull(patientId)) { @@ -239,6 +247,6 @@ protected void auditRegisterEvent( String patientId) { auditRegisterEvent(transaction, eventOutcome, repositoryUserId, repositoryIpAddress, userName, - registryEndpointUri, submissionSetUniqueId, patientId, null); + registryEndpointUri, submissionSetUniqueId, patientId, null, null); } } diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRepositoryAuditor.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRepositoryAuditor.java index c82fb32..3eb6db1 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRepositoryAuditor.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRepositoryAuditor.java @@ -76,7 +76,7 @@ public void auditProvideAndRegisterDocumentSetEvent( auditProvideAndRegisterEvent(new IHETransactionEventTypeCodes.ProvideAndRegisterDocumentSet(), eventOutcome, sourceUserId, sourceIpAddress, userName, - repositoryEndpointUri, submissionSetUniqueId, patientId, null); + repositoryEndpointUri, submissionSetUniqueId, patientId, null, null); } /** @@ -88,6 +88,8 @@ public void auditProvideAndRegisterDocumentSetEvent( * @param repositoryEndpointUri The URI of this repository's endpoint that received the transaction * @param submissionSetUniqueId The UniqueID of the Submission Set provided * @param patientId The Patient Id that this submission pertains to + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ public void auditProvideAndRegisterDocumentSetBEvent( RFC3881EventOutcomeCodes eventOutcome, @@ -96,7 +98,8 @@ public void auditProvideAndRegisterDocumentSetBEvent( String repositoryEndpointUri, String submissionSetUniqueId, String patientId, - List purposesOfUse) + List purposesOfUse, + List userRoles) { if (!isAuditorEnabled()) { return; @@ -104,7 +107,7 @@ public void auditProvideAndRegisterDocumentSetBEvent( auditProvideAndRegisterEvent( new IHETransactionEventTypeCodes.ProvideAndRegisterDocumentSetB(), eventOutcome, sourceUserId, sourceIpAddress, userName, - repositoryEndpointUri, submissionSetUniqueId, patientId, purposesOfUse); + repositoryEndpointUri, submissionSetUniqueId, patientId, purposesOfUse, userRoles); } @Deprecated @@ -117,7 +120,7 @@ public void auditProvideAndRegisterDocumentSetBEvent( String patientId) { auditProvideAndRegisterDocumentSetBEvent(eventOutcome, sourceUserId, sourceIpAddress, - userName, repositoryEndpointUri, submissionSetUniqueId, patientId, null); + userName, repositoryEndpointUri, submissionSetUniqueId, patientId, null, null); } /** @@ -140,7 +143,7 @@ public void auditRegisterDocumentSetEvent( } auditRegisterEvent(new IHETransactionEventTypeCodes.RegisterDocumentSet(), eventOutcome, repositoryUserId, userName, - registryEndpointUri, submissionSetUniqueId, patientId, null); + registryEndpointUri, submissionSetUniqueId, patientId, null, null); } /** @@ -150,6 +153,8 @@ public void auditRegisterDocumentSetEvent( * @param registryEndpointUri The endpoint of the registry in this transaction * @param submissionSetUniqueId The UniqueID of the Submission Set registered * @param patientId The Patient Id that this submission pertains to + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ public void auditRegisterDocumentSetBEvent( RFC3881EventOutcomeCodes eventOutcome, @@ -157,14 +162,15 @@ public void auditRegisterDocumentSetBEvent( String userName, String registryEndpointUri, String submissionSetUniqueId, String patientId, - List purposesOfUse) + List purposesOfUse, + List userRoles) { if (!isAuditorEnabled()) { return; } auditRegisterEvent(new IHETransactionEventTypeCodes.RegisterDocumentSetB(), eventOutcome, repositoryUserId, userName, - registryEndpointUri, submissionSetUniqueId, patientId, purposesOfUse); + registryEndpointUri, submissionSetUniqueId, patientId, purposesOfUse, userRoles); } @Deprecated @@ -176,7 +182,7 @@ public void auditRegisterDocumentSetBEvent( String submissionSetUniqueId, String patientId) { auditRegisterDocumentSetBEvent(eventOutcome, repositoryUserId, userName, registryEndpointUri, - submissionSetUniqueId, patientId, null); + submissionSetUniqueId, patientId, null, null); } /** @@ -200,7 +206,7 @@ public void auditRetrieveDocumentEvent( exportEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); exportEvent.addSourceActiveParticipant(repositoryRetrieveUri, getSystemAltUserId(), null, EventUtils.getAddressForUrl(repositoryRetrieveUri, false), false); if (!EventUtils.isEmptyOrNull(userName)) { - exportEvent.addHumanRequestorActiveParticipant(userName, null, userName, null); + exportEvent.addHumanRequestorActiveParticipant(userName, null, userName, (List) null); } exportEvent.addDestinationActiveParticipant(consumerIpAddress, null, null, consumerIpAddress, true); //exportEvent.addPatientParticipantObject(patientId); @@ -220,13 +226,15 @@ public void auditRetrieveDocumentEvent( * @param documentUniqueIds The list of Document Entry UniqueId(s) for the document(s) retrieved * @param repositoryUniqueId The XDS.b Repository Unique Id value for this repository * @param homeCommunityId The XCA Home Community Id used in the transaction + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ public void auditRetrieveDocumentSetEvent( RFC3881EventOutcomeCodes eventOutcome, String consumerUserId, String consumerUserName, String consumerIpAddress, String repositoryEndpointUri, String[] documentUniqueIds, String repositoryUniqueId, String homeCommunityId, - List purposesOfUse) + List purposesOfUse, List userRoles) { if (!isAuditorEnabled()) { return; @@ -239,7 +247,7 @@ public void auditRetrieveDocumentSetEvent( } auditRetrieveDocumentSetEvent(eventOutcome, consumerUserId, consumerUserName, consumerIpAddress, - repositoryEndpointUri, documentUniqueIds, repositoryUniqueIds, homeCommunityId, purposesOfUse); + repositoryEndpointUri, documentUniqueIds, repositoryUniqueIds, homeCommunityId, purposesOfUse, userRoles); } @Deprecated @@ -250,7 +258,7 @@ public void auditRetrieveDocumentSetEvent( String[] documentUniqueIds, String repositoryUniqueId, String homeCommunityId) { auditRetrieveDocumentSetEvent(eventOutcome, consumerUserId, consumerUserName, consumerIpAddress, - repositoryEndpointUri, documentUniqueIds, repositoryUniqueId, homeCommunityId, null); + repositoryEndpointUri, documentUniqueIds, repositoryUniqueId, homeCommunityId, null, null); } /** @@ -265,13 +273,15 @@ public void auditRetrieveDocumentSetEvent( * @param documentUniqueIds The list of Document Entry UniqueId(s) for the document(s) retrieved * @param repositoryUniqueIds The list of XDS.b Repository Unique Ids involved in this transaction (aligned with Document Unique Ids array) * @param homeCommunityId The XCA Home Community Id used in the transaction + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ public void auditRetrieveDocumentSetEvent( RFC3881EventOutcomeCodes eventOutcome, String consumerUserId, String consumerUserName, String consumerIpAddress, String repositoryEndpointUri, String[] documentUniqueIds, String[] repositoryUniqueIds, String homeCommunityId, - List purposesOfUse) + List purposesOfUse, List userRoles) { if (!isAuditorEnabled()) { return; @@ -284,7 +294,7 @@ public void auditRetrieveDocumentSetEvent( } auditRetrieveDocumentSetEvent(eventOutcome, consumerUserId, consumerUserName, consumerIpAddress, - repositoryEndpointUri, documentUniqueIds, repositoryUniqueIds, homeCommunityIds, purposesOfUse); + repositoryEndpointUri, documentUniqueIds, repositoryUniqueIds, homeCommunityIds, purposesOfUse, userRoles); } @Deprecated @@ -295,7 +305,7 @@ public void auditRetrieveDocumentSetEvent( String[] documentUniqueIds, String[] repositoryUniqueIds, String homeCommunityId) { auditRetrieveDocumentSetEvent(eventOutcome, consumerUserId, consumerUserName, consumerIpAddress, - repositoryEndpointUri, documentUniqueIds, repositoryUniqueIds, homeCommunityId, null); + repositoryEndpointUri, documentUniqueIds, repositoryUniqueIds, homeCommunityId, null, null); } /** @@ -310,13 +320,16 @@ public void auditRetrieveDocumentSetEvent( * @param documentUniqueIds The list of Document Entry UniqueId(s) for the document(s) retrieved * @param repositoryUniqueIds The list of XDS.b Repository Unique Ids involved in this transaction (aligned with Document Unique Ids array) * @param homeCommunityIds The list of XCA Home Community Ids involved in this transaction (aligned with Document Unique Ids array) + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ public void auditRetrieveDocumentSetEvent( RFC3881EventOutcomeCodes eventOutcome, String consumerUserId, String consumerUserName, String consumerIpAddress, String repositoryEndpointUri, String[] documentUniqueIds, String[] repositoryUniqueIds, String[] homeCommunityIds, - List purposesOfUse) + List purposesOfUse, + List userRoles) { if (!isAuditorEnabled()) { return; @@ -326,7 +339,7 @@ public void auditRetrieveDocumentSetEvent( exportEvent.addSourceActiveParticipant(repositoryEndpointUri, getSystemAltUserId(), null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false); exportEvent.addDestinationActiveParticipant(consumerUserId, null, consumerUserName, consumerIpAddress, true); if (! EventUtils.isEmptyOrNull(consumerUserName)) { - exportEvent.addHumanRequestorActiveParticipant(consumerUserName, null, consumerUserName, null); + exportEvent.addHumanRequestorActiveParticipant(consumerUserName, null, consumerUserName, userRoles); } //exportEvent.addPatientParticipantObject(patientId); @@ -346,7 +359,7 @@ public void auditRetrieveDocumentSetEvent( String[] documentUniqueIds, String[] repositoryUniqueIds, String[] homeCommunityIds) { auditRetrieveDocumentSetEvent(eventOutcome, consumerUserId, consumerUserName, consumerIpAddress, - repositoryEndpointUri, documentUniqueIds, repositoryUniqueIds, homeCommunityIds, null); + repositoryEndpointUri, documentUniqueIds, repositoryUniqueIds, homeCommunityIds, null, null); } /** @@ -359,6 +372,8 @@ public void auditRetrieveDocumentSetEvent( * @param repositoryEndpointUri The Web service endpoint URI for this document repository * @param submissionSetUniqueId The UniqueID of the Submission Set registered * @param patientId The Patient Id that this submission pertains to + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ protected void auditProvideAndRegisterEvent ( IHETransactionEventTypeCodes transaction, @@ -368,13 +383,14 @@ protected void auditProvideAndRegisterEvent ( String repositoryEndpointUri, String submissionSetUniqueId, String patientId, - List purposesOfUse) + List purposesOfUse, + List userRoles) { ImportEvent importEvent = new ImportEvent(false, eventOutcome, transaction, purposesOfUse); importEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); importEvent.addSourceActiveParticipant(sourceUserId, null, null, sourceIpAddress, true); if (!EventUtils.isEmptyOrNull(userName)) { - importEvent.addHumanRequestorActiveParticipant(userName, null, userName, null); + importEvent.addHumanRequestorActiveParticipant(userName, null, userName, userRoles); } importEvent.addDestinationActiveParticipant(repositoryEndpointUri, getSystemAltUserId(), null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false); if (!EventUtils.isEmptyOrNull(patientId)) { @@ -396,7 +412,7 @@ protected void auditProvideAndRegisterEvent ( String patientId) { auditProvideAndRegisterEvent(transaction, eventOutcome, sourceUserId, sourceIpAddress, userName, - repositoryEndpointUri, submissionSetUniqueId, patientId, null); + repositoryEndpointUri, submissionSetUniqueId, patientId, null, null); } /** @@ -408,6 +424,8 @@ protected void auditProvideAndRegisterEvent ( * @param registryEndpointUri The Web service endpoint URI for the document registry * @param submissionSetUniqueId The UniqueID of the Submission Set registered * @param patientId The Patient Id that this submission pertains to + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ protected void auditRegisterEvent( IHETransactionEventTypeCodes transaction, @@ -416,13 +434,14 @@ protected void auditRegisterEvent( String userName, String registryEndpointUri, String submissionSetUniqueId, String patientId, - List purposesOfUse) + List purposesOfUse, + List userRoles) { ExportEvent exportEvent = new ExportEvent(true, eventOutcome, transaction, purposesOfUse); exportEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); exportEvent.addSourceActiveParticipant(repositoryUserId, getSystemAltUserId(), null, getSystemNetworkId(), true); if (!EventUtils.isEmptyOrNull(userName)) { - exportEvent.addHumanRequestorActiveParticipant(userName, null, userName, null); + exportEvent.addHumanRequestorActiveParticipant(userName, null, userName, userRoles); } exportEvent.addDestinationActiveParticipant(registryEndpointUri, null, null, EventUtils.getAddressForUrl(registryEndpointUri, false), false); if (!EventUtils.isEmptyOrNull(patientId)) { @@ -442,7 +461,7 @@ protected void auditRegisterEvent ( String submissionSetUniqueId, String patientId) { auditRegisterEvent(transaction, eventOutcome, repositoryUserId, userName, registryEndpointUri, - submissionSetUniqueId, patientId, null); + submissionSetUniqueId, patientId, null, null); } } diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSSourceAuditor.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSSourceAuditor.java index a4796e5..0e3e314 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSSourceAuditor.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSSourceAuditor.java @@ -66,7 +66,7 @@ public void auditProvideAndRegisterDocumentSetEvent(RFC3881EventOutcomeCodes eve auditProvideAndRegisterEvent( new IHETransactionEventTypeCodes.ProvideAndRegisterDocumentSet(), eventOutcome, repositoryEndpointUri, userName, - submissionSetUniqueId, patientId, null); + submissionSetUniqueId, patientId, null, null); } /** @@ -76,13 +76,16 @@ public void auditProvideAndRegisterDocumentSetEvent(RFC3881EventOutcomeCodes eve * @param repositoryEndpointUri The endpoint of the repository in this transaction * @param submissionSetUniqueId The UniqueID of the Submission Set provided * @param patientId The Patient Id that this submission pertains to + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ public void auditProvideAndRegisterDocumentSetBEvent(RFC3881EventOutcomeCodes eventOutcome, String repositoryEndpointUri, String userName, String submissionSetUniqueId, String patientId, - List purposesOfUse) + List purposesOfUse, + List userRoles) { if (!isAuditorEnabled()) { return; @@ -90,7 +93,7 @@ public void auditProvideAndRegisterDocumentSetBEvent(RFC3881EventOutcomeCodes ev auditProvideAndRegisterEvent( new IHETransactionEventTypeCodes.ProvideAndRegisterDocumentSetB(), eventOutcome, repositoryEndpointUri, userName, - submissionSetUniqueId, patientId, purposesOfUse); + submissionSetUniqueId, patientId, purposesOfUse, userRoles); } /** @@ -101,6 +104,8 @@ public void auditProvideAndRegisterDocumentSetBEvent(RFC3881EventOutcomeCodes ev * @param repositoryEndpointUri The endpoint of the repository in this transaction * @param submissionSetUniqueId The UniqueID of the Submission Set provided * @param patientId The Patient Id that this submission pertains to + * @param purposesOfUse purpose of use codes (may be taken from XUA token) + * @param userRoles roles of the human user (may be taken from XUA token) */ protected void auditProvideAndRegisterEvent( IHETransactionEventTypeCodes transaction, RFC3881EventOutcomeCodes eventOutcome, @@ -108,7 +113,8 @@ protected void auditProvideAndRegisterEvent( String userName, String submissionSetUniqueId, String patientId, - List purposesOfUse) + List purposesOfUse, + List userRoles) { ExportEvent exportEvent = new ExportEvent(true, eventOutcome, transaction, purposesOfUse); exportEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); @@ -121,7 +127,7 @@ protected void auditProvideAndRegisterEvent( exportEvent.addSourceActiveParticipant(replyToUri, getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), true); if (!EventUtils.isEmptyOrNull(userName)) { - exportEvent.addHumanRequestorActiveParticipant(userName, null, userName, null); + exportEvent.addHumanRequestorActiveParticipant(userName, null, userName, userRoles); } exportEvent.addDestinationActiveParticipant(repositoryEndpointUri, null, null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false); if (!EventUtils.isEmptyOrNull(patientId)) { diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/AbstractAuditEventMessageImpl.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/AbstractAuditEventMessageImpl.java index 009ecb9..55bb013 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/AbstractAuditEventMessageImpl.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/AbstractAuditEventMessageImpl.java @@ -264,7 +264,7 @@ protected EventIdentificationType setEventIdentification( * @return The Active Participant block created */ protected ActiveParticipantType addActiveParticipant(String userID, String altUserID, String userName, - Boolean userIsRequestor, CodedValueType[] roleIdCodes, String networkAccessPointID, RFC3881NetworkAccessPointTypeCodes networkAccessPointTypeCode) { + Boolean userIsRequestor, List roleIdCodes, String networkAccessPointID, RFC3881NetworkAccessPointTypeCodes networkAccessPointTypeCode) { ActiveParticipantType activeParticipantBlock = new ActiveParticipantType(); activeParticipantBlock.setUserID(userID); @@ -272,7 +272,7 @@ protected ActiveParticipantType addActiveParticipant(String userID, String altUs activeParticipantBlock.setUserName(userName); activeParticipantBlock.setUserIsRequestor(userIsRequestor); if (!EventUtils.isEmptyOrNull(roleIdCodes, true)) { - activeParticipantBlock.getRoleIDCode().addAll(Arrays.asList(roleIdCodes)); + activeParticipantBlock.getRoleIDCode().addAll(roleIdCodes); } activeParticipantBlock.setNetworkAccessPointID(networkAccessPointID); if (!EventUtils.isEmptyOrNull(networkAccessPointTypeCode)) { @@ -385,7 +385,7 @@ public ParticipantObjectIdentificationType addParticipantObjectIdentification(Co * @return The Active Participant block created */ protected ActiveParticipantType addActiveParticipant(String userID, String altUserID, String userName, - Boolean userIsRequestor, CodedValueType[] roleIdCodes, String networkAccessPointID) { + Boolean userIsRequestor, List roleIdCodes, String networkAccessPointID) { // Does lookup to see if using IP Address or hostname in Network Access Point ID return addActiveParticipant( userID, altUserID, userName, userIsRequestor, diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/ApplicationActivityEvent.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/ApplicationActivityEvent.java index f23c96e..e7ad120 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/ApplicationActivityEvent.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/ApplicationActivityEvent.java @@ -17,6 +17,8 @@ import org.openhealthtools.ihe.atna.auditor.codes.rfc3881.RFC3881EventCodes.RFC3881EventOutcomeCodes; import org.openhealthtools.ihe.atna.auditor.events.GenericAuditEventMessageImpl; +import java.util.Collections; + /** * Audit Event representing a DICOM 95 Application Activity event (DCM 110100) @@ -55,8 +57,8 @@ public void addApplicationParticipant(String userId, String altUserId, String us userId, altUserId, userName, - false, - new DICOMActiveParticipantRoleIdCodes[] {new DICOMActiveParticipantRoleIdCodes.Application()}, + false, + Collections.singletonList(new DICOMActiveParticipantRoleIdCodes.Application()), networkId); } @@ -74,8 +76,8 @@ public void addApplicationStarterParticipant(String userId, String altUserId, St userId, altUserId, userName, - true, - new DICOMActiveParticipantRoleIdCodes[] {new DICOMActiveParticipantRoleIdCodes.ApplicationLauncher()}, + true, + Collections.singletonList(new DICOMActiveParticipantRoleIdCodes.ApplicationLauncher()), networkId); } diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/UserAuthenticationEvent.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/UserAuthenticationEvent.java index 203b1f3..9f019c6 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/UserAuthenticationEvent.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/UserAuthenticationEvent.java @@ -18,6 +18,8 @@ import org.openhealthtools.ihe.atna.auditor.events.GenericAuditEventMessageImpl; import org.openhealthtools.ihe.atna.auditor.models.rfc3881.CodedValueType; +import java.util.Collections; + /** * Audit Event representing a DICOM 95 User Authentication event (DCM 110114) * @@ -76,7 +78,7 @@ public void addNodeActiveParticipant(String userId, String altUserId, String use altUserId, userName, true, - new CodedValueType[] {new DICOMActiveParticipantRoleIdCodes.Application()}, + Collections.singletonList(new DICOMActiveParticipantRoleIdCodes.Application()), networkId); } diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java index b6ac788..28343cb 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.openhealthtools.ihe.atna.auditor.events.ihe; +import java.util.Collections; import java.util.LinkedList; import java.util.List; @@ -98,8 +99,8 @@ public void addSourceActiveParticipant(String userId, String altUserId, String u userId, altUserId, userName, - isRequestor, - new DICOMActiveParticipantRoleIdCodes[] {new DICOMActiveParticipantRoleIdCodes.Source()}, + isRequestor, + Collections.singletonList(new DICOMActiveParticipantRoleIdCodes.Source()), networkId); } @@ -118,28 +119,47 @@ public void addDestinationActiveParticipant(String userId, String altUserId, Str altUserId, userName, isRequestor, - new DICOMActiveParticipantRoleIdCodes[] {new DICOMActiveParticipantRoleIdCodes.Destination()}, + Collections.singletonList(new DICOMActiveParticipantRoleIdCodes.Destination()), networkId); } - + /** * Adds an Active Participant block representing the human requestor participant * @param userId The Active Participant's User ID * @param altUserId The Active Participant's Alternate UserID * @param userName The Active Participant's UserName + * @param roles The participant's roles + */ + public void addHumanRequestorActiveParticipant(String userId, String altUserId, String userName, List roles) + { + addActiveParticipant( + userId, + altUserId, + userName, + true, + roles, + null); + } + + /** + * Adds an Active Participant block representing the human requestor participant + * @param userId The Active Participant's User ID + * @param altUserId The Active Participant's Alternate UserID + * @param userName The Active Participant's UserName * @param role The participant's role */ + @Deprecated public void addHumanRequestorActiveParticipant(String userId, String altUserId, String userName, CodedValueType role) { addActiveParticipant( - userId, - altUserId, - userName, + userId, + altUserId, + userName, true, - new CodedValueType[] {role}, + Collections.singletonList(role), null); } - + /** * Adds a Participant Object Identification block that representing a patient * involved in the event diff --git a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java index a75609c..fbd34ff 100644 --- a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java +++ b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/queue/JmsAuditMessageQueueTest.java @@ -22,7 +22,6 @@ import org.junit.BeforeClass; import org.junit.Test; import org.openhealthtools.ihe.atna.auditor.IHEAuditor; -import org.openhealthtools.ihe.atna.auditor.codes.rfc3881.RFC3881EventCodes; import org.openhealthtools.ihe.atna.auditor.context.AuditorModuleContext; import org.openhealthtools.ihe.atna.test.JmsAtnaMessageConsumer; import org.slf4j.Logger; diff --git a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/tests/mesa/Mesa11180.java b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/tests/mesa/Mesa11180.java index 139d15e..1d609d0 100644 --- a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/tests/mesa/Mesa11180.java +++ b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/tests/mesa/Mesa11180.java @@ -80,7 +80,7 @@ public void test11199() { codedValue.setCode("purposeOfUse"); purposesOfUse.add(codedValue); consumerAuditor.auditRegistryStoredQueryEvent(RFC3881EventOutcomeCodes.SUCCESS, "http://xds-ibm.lgs.com:9080/IBMXDSRegistry/registry", "urn:uuid:1234", "", "1.1.1.1", "1234^^^&1.2.3.4&ISO", - "4711", purposesOfUse); + "4711", purposesOfUse, null); } } From 60b0da9d974001eba9052e31a23977576e9c4bcd Mon Sep 17 00:00:00 2001 From: unixoid Date: Sun, 23 Jul 2017 12:18:30 +0200 Subject: [PATCH 21/29] fix ITI-62 participant object attributes --- .../atna/auditor/events/ihe/GenericIHEAuditEventMessage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java index 28343cb..f133e56 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java @@ -290,7 +290,7 @@ public void addRemovedRegistryObject(IHETransactionParticipantObjectIDTypeCodes registryObjectUuid, RFC3881ParticipantObjectTypeCodes.SYSTEM, RFC3881ParticipantObjectTypeRoleCodes.REPORT, - null, + RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectDataLifeCycleCodes.PERMANENT_ERASURE, null); } From c91b00bddac68cbd02799e554a8227e67cb51f21 Mon Sep 17 00:00:00 2001 From: Dmytro Rud Date: Thu, 3 Aug 2017 20:23:16 +0200 Subject: [PATCH 22/29] infamous backdoor to manually set event timestamp --- .../events/AbstractAuditEventMessageImpl.java | 5 ++-- .../events/GenericAuditEventMessageImpl.java | 27 +++++++++++++------ .../events/dicom/UserAuthenticationEvent.java | 27 +++++++++++++++---- 3 files changed, 44 insertions(+), 15 deletions(-) diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/AbstractAuditEventMessageImpl.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/AbstractAuditEventMessageImpl.java index 55bb013..9bdfaa9 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/AbstractAuditEventMessageImpl.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/AbstractAuditEventMessageImpl.java @@ -62,7 +62,7 @@ public abstract class AbstractAuditEventMessageImpl implements AuditEventMessage /** * Date and time the event was generated */ - private final Date eventDateTime = new Date(); + private final Date eventDateTime; /** * Message destination address @@ -83,7 +83,8 @@ public abstract class AbstractAuditEventMessageImpl implements AuditEventMessage /** * Constructor for creating an Audit Event Message */ - protected AbstractAuditEventMessageImpl() { + protected AbstractAuditEventMessageImpl(Date timestamp) { + eventDateTime = timestamp; auditMessage = new AuditMessage(); } diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/GenericAuditEventMessageImpl.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/GenericAuditEventMessageImpl.java index 7f08457..670ff4b 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/GenericAuditEventMessageImpl.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/GenericAuditEventMessageImpl.java @@ -16,6 +16,7 @@ import org.openhealthtools.ihe.atna.auditor.codes.rfc3881.RFC3881EventCodes.RFC3881EventOutcomeCodes; import org.openhealthtools.ihe.atna.auditor.models.rfc3881.CodedValueType; +import java.util.Date; import java.util.List; /** @@ -31,15 +32,25 @@ public class GenericAuditEventMessageImpl extends AbstractAuditEventMessageImpl { - public GenericAuditEventMessageImpl( RFC3881EventOutcomeCodes outcome, - RFC3881EventActionCodes action, - CodedValueType id, CodedValueType[] type, - List purposesOfUse) - { - setEventIdentification(outcome,action,id,type, purposesOfUse); - } + public GenericAuditEventMessageImpl( RFC3881EventOutcomeCodes outcome, + RFC3881EventActionCodes action, + CodedValueType id, CodedValueType[] type, + Date eventDateTime, + List purposesOfUse) + { + super(eventDateTime); + setEventIdentification(outcome,action,id,type, purposesOfUse); + } + + public GenericAuditEventMessageImpl( RFC3881EventOutcomeCodes outcome, + RFC3881EventActionCodes action, + CodedValueType id, CodedValueType[] type, + List purposesOfUse) + { + this(outcome,action,id,type, new Date(), purposesOfUse); + } - @Deprecated + @Deprecated public GenericAuditEventMessageImpl( RFC3881EventOutcomeCodes outcome, RFC3881EventActionCodes action, CodedValueType id, CodedValueType[] type) diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/UserAuthenticationEvent.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/UserAuthenticationEvent.java index 9f019c6..11dcb89 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/UserAuthenticationEvent.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/UserAuthenticationEvent.java @@ -16,10 +16,9 @@ import org.openhealthtools.ihe.atna.auditor.codes.rfc3881.RFC3881EventCodes; import org.openhealthtools.ihe.atna.auditor.codes.rfc3881.RFC3881EventCodes.RFC3881EventOutcomeCodes; import org.openhealthtools.ihe.atna.auditor.events.GenericAuditEventMessageImpl; -import org.openhealthtools.ihe.atna.auditor.models.rfc3881.CodedValueType; +import java.util.Date; import java.util.Collections; - /** * Audit Event representing a DICOM 95 User Authentication event (DCM 110114) * @@ -27,6 +26,24 @@ */ public class UserAuthenticationEvent extends GenericAuditEventMessageImpl { + /** + * Creates a User Authentication Event for a given event type (e.g. Login, Logout) + * @param outcome The event outcome indicator + * @param type The type of event + * @param eventDateTime timestamp of the event + */ + public UserAuthenticationEvent(RFC3881EventOutcomeCodes outcome, DICOMEventTypeCodes type, Date eventDateTime) + { + super( + outcome, + RFC3881EventCodes.RFC3881EventActionCodes.EXECUTE, + new DICOMEventIdCodes.UserAuthentication(), + new DICOMEventTypeCodes[] {type}, + eventDateTime, + null + ); + } + /** * Creates a User Authentication Event for a given event type (e.g. Login, Logout) * @param outcome The event outcome indicator @@ -35,14 +52,14 @@ public class UserAuthenticationEvent extends GenericAuditEventMessageImpl public UserAuthenticationEvent(RFC3881EventOutcomeCodes outcome, DICOMEventTypeCodes type) { super( - outcome, + outcome, RFC3881EventCodes.RFC3881EventActionCodes.EXECUTE, new DICOMEventIdCodes.UserAuthentication(), new DICOMEventTypeCodes[] {type}, - null + null ); } - + /** * Adds an Active Participant representing the user requesting the authentication * From 441d0ec759d93226bf56dbba8b24e16439d1d807 Mon Sep 17 00:00:00 2001 From: Dmytro Rud Date: Wed, 6 Sep 2017 17:19:24 +0200 Subject: [PATCH 23/29] change attribute name @code to @csd-code; closes #10 --- .../ihe/atna/auditor/models/rfc3881/AuditSourceType.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/models/rfc3881/AuditSourceType.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/models/rfc3881/AuditSourceType.java index 9d30b43..d3c5369 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/models/rfc3881/AuditSourceType.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/models/rfc3881/AuditSourceType.java @@ -50,7 +50,7 @@ public String toString() StringBuilder sb = new StringBuilder(); sb.append(" Date: Tue, 26 Sep 2017 09:28:24 +0200 Subject: [PATCH 24/29] [maven-release-plugin] prepare release ipf-oht-atna-3.6-20170926 --- auditor/pom.xml | 4 ++-- context/pom.xml | 4 ++-- nodeauth/pom.xml | 4 ++-- osgi/pom.xml | 4 ++-- pom.xml | 4 ++-- test/pom.xml | 4 ++-- util/pom.xml | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/auditor/pom.xml b/auditor/pom.xml index 5f31616..ab7cd72 100644 --- a/auditor/pom.xml +++ b/auditor/pom.xml @@ -1,14 +1,14 @@ 4.0.0 ipf-oht-atna-auditor - 3.6-SNAPSHOT + 3.6-20170926 OpenHealthTools(OHT) ATNA Auditor jar org.openehealth.ipf.oht.atna ipf-oht-atna - 3.6-SNAPSHOT + 3.6-20170926 diff --git a/context/pom.xml b/context/pom.xml index 4f1258d..0497d15 100644 --- a/context/pom.xml +++ b/context/pom.xml @@ -1,14 +1,14 @@ 4.0.0 ipf-oht-atna-context - 3.6-SNAPSHOT + 3.6-20170926 OpenHealthTools(OHT) ATNA Context jar org.openehealth.ipf.oht.atna ipf-oht-atna - 3.6-SNAPSHOT + 3.6-20170926 diff --git a/nodeauth/pom.xml b/nodeauth/pom.xml index fa4d085..cd7db30 100644 --- a/nodeauth/pom.xml +++ b/nodeauth/pom.xml @@ -1,14 +1,14 @@ 4.0.0 ipf-oht-atna-nodeauth - 3.6-SNAPSHOT + 3.6-20170926 OpenHealthTools(OHT) ATNA NodeAuth jar org.openehealth.ipf.oht.atna ipf-oht-atna - 3.6-SNAPSHOT + 3.6-20170926 diff --git a/osgi/pom.xml b/osgi/pom.xml index e8cc4bf..3576072 100644 --- a/osgi/pom.xml +++ b/osgi/pom.xml @@ -1,14 +1,14 @@ 4.0.0 ipf-oht-atna-osgi - 3.6-SNAPSHOT + 3.6-20170926 OpenHealthTools(OHT) ATNA OSGi Bundle bundle org.openehealth.ipf.oht.atna ipf-oht-atna - 3.6-SNAPSHOT + 3.6-20170926 diff --git a/pom.xml b/pom.xml index 9e7efef..ebf2450 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 org.openehealth.ipf.oht.atna ipf-oht-atna - 3.6-SNAPSHOT + 3.6-20170926 OpenHealthTools(OHT) ATNA pom @@ -107,7 +107,7 @@ scm:git:git@github.com:oehf/ipf-oht-atna.git scm:git:git@github.com:oehf/ipf-oht-atna.git scm:git:git@github.com:oehf/ipf-oht-atna.git - HEAD + ipf-oht-atna-3.6-20170926 diff --git a/test/pom.xml b/test/pom.xml index 553cf96..35a0569 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -1,14 +1,14 @@ 4.0.0 ipf-oht-atna-test - 3.6-SNAPSHOT + 3.6-20170926 OpenHealthTools(OHT) Test jar org.openehealth.ipf.oht.atna ipf-oht-atna - 3.6-SNAPSHOT + 3.6-20170926 diff --git a/util/pom.xml b/util/pom.xml index 71428c3..b16e0cc 100644 --- a/util/pom.xml +++ b/util/pom.xml @@ -1,14 +1,14 @@ 4.0.0 ipf-oht-util - 3.6-SNAPSHOT + 3.6-20170926 OpenHealthTools(OHT) Util jar org.openehealth.ipf.oht.atna ipf-oht-atna - 3.6-SNAPSHOT + 3.6-20170926 From 8c024e92c5ee0ac25e506c5e0053383e95799f93 Mon Sep 17 00:00:00 2001 From: stanojevic-boris Date: Tue, 26 Sep 2017 09:28:34 +0200 Subject: [PATCH 25/29] [maven-release-plugin] prepare for next development iteration --- auditor/pom.xml | 4 ++-- context/pom.xml | 4 ++-- nodeauth/pom.xml | 4 ++-- osgi/pom.xml | 4 ++-- pom.xml | 4 ++-- test/pom.xml | 4 ++-- util/pom.xml | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/auditor/pom.xml b/auditor/pom.xml index ab7cd72..5f31616 100644 --- a/auditor/pom.xml +++ b/auditor/pom.xml @@ -1,14 +1,14 @@ 4.0.0 ipf-oht-atna-auditor - 3.6-20170926 + 3.6-SNAPSHOT OpenHealthTools(OHT) ATNA Auditor jar org.openehealth.ipf.oht.atna ipf-oht-atna - 3.6-20170926 + 3.6-SNAPSHOT diff --git a/context/pom.xml b/context/pom.xml index 0497d15..4f1258d 100644 --- a/context/pom.xml +++ b/context/pom.xml @@ -1,14 +1,14 @@ 4.0.0 ipf-oht-atna-context - 3.6-20170926 + 3.6-SNAPSHOT OpenHealthTools(OHT) ATNA Context jar org.openehealth.ipf.oht.atna ipf-oht-atna - 3.6-20170926 + 3.6-SNAPSHOT diff --git a/nodeauth/pom.xml b/nodeauth/pom.xml index cd7db30..fa4d085 100644 --- a/nodeauth/pom.xml +++ b/nodeauth/pom.xml @@ -1,14 +1,14 @@ 4.0.0 ipf-oht-atna-nodeauth - 3.6-20170926 + 3.6-SNAPSHOT OpenHealthTools(OHT) ATNA NodeAuth jar org.openehealth.ipf.oht.atna ipf-oht-atna - 3.6-20170926 + 3.6-SNAPSHOT diff --git a/osgi/pom.xml b/osgi/pom.xml index 3576072..e8cc4bf 100644 --- a/osgi/pom.xml +++ b/osgi/pom.xml @@ -1,14 +1,14 @@ 4.0.0 ipf-oht-atna-osgi - 3.6-20170926 + 3.6-SNAPSHOT OpenHealthTools(OHT) ATNA OSGi Bundle bundle org.openehealth.ipf.oht.atna ipf-oht-atna - 3.6-20170926 + 3.6-SNAPSHOT diff --git a/pom.xml b/pom.xml index ebf2450..9e7efef 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 org.openehealth.ipf.oht.atna ipf-oht-atna - 3.6-20170926 + 3.6-SNAPSHOT OpenHealthTools(OHT) ATNA pom @@ -107,7 +107,7 @@ scm:git:git@github.com:oehf/ipf-oht-atna.git scm:git:git@github.com:oehf/ipf-oht-atna.git scm:git:git@github.com:oehf/ipf-oht-atna.git - ipf-oht-atna-3.6-20170926 + HEAD diff --git a/test/pom.xml b/test/pom.xml index 35a0569..553cf96 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -1,14 +1,14 @@ 4.0.0 ipf-oht-atna-test - 3.6-20170926 + 3.6-SNAPSHOT OpenHealthTools(OHT) Test jar org.openehealth.ipf.oht.atna ipf-oht-atna - 3.6-20170926 + 3.6-SNAPSHOT diff --git a/util/pom.xml b/util/pom.xml index b16e0cc..71428c3 100644 --- a/util/pom.xml +++ b/util/pom.xml @@ -1,14 +1,14 @@ 4.0.0 ipf-oht-util - 3.6-20170926 + 3.6-SNAPSHOT OpenHealthTools(OHT) Util jar org.openehealth.ipf.oht.atna ipf-oht-atna - 3.6-20170926 + 3.6-SNAPSHOT From 6a8f92924134a6fafd666abf549b6bd55450c861 Mon Sep 17 00:00:00 2001 From: stanojevic-boris Date: Mon, 9 Oct 2017 13:26:17 +0200 Subject: [PATCH 26/29] small dependencies update --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 9e7efef..f97e742 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 2.0.1 - 3.6.1 + 3.7.0 1.6 2.10.4 1.6.3 @@ -24,7 +24,7 @@ 3.6 1.1.1 2.0.16 - 4.1.13.Final + 4.1.15.Final 1.7.25 4.12 1.10.19 From 7ffa4b012bd70e6735a082a6027c7f9547745db9 Mon Sep 17 00:00:00 2001 From: Christian Ohr Date: Wed, 18 Oct 2017 13:11:19 +0200 Subject: [PATCH 27/29] #169:use log4j2 --- auditor/pom.xml | 19 ++++-- auditor/src/test/resources/log4j.xml | 83 --------------------------- auditor/src/test/resources/log4j2.xml | 17 ++++++ context/pom.xml | 15 ++++- nodeauth/pom.xml | 15 ++++- pom.xml | 19 +++++- test/pom.xml | 15 ++++- util/pom.xml | 15 ++++- 8 files changed, 100 insertions(+), 98 deletions(-) delete mode 100644 auditor/src/test/resources/log4j.xml create mode 100644 auditor/src/test/resources/log4j2.xml diff --git a/auditor/pom.xml b/auditor/pom.xml index 5f31616..bd46e42 100644 --- a/auditor/pom.xml +++ b/auditor/pom.xml @@ -41,10 +41,6 @@ geronimo-jms_1.1_spec provided - - org.slf4j - slf4j-log4j12 - @@ -78,6 +74,21 @@ activemq-pool test + + org.apache.logging.log4j + log4j-api + test + + + org.apache.logging.log4j + log4j-core + test + + + org.apache.logging.log4j + log4j-slf4j-impl + test + diff --git a/auditor/src/test/resources/log4j.xml b/auditor/src/test/resources/log4j.xml deleted file mode 100644 index 9b921f7..0000000 --- a/auditor/src/test/resources/log4j.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/auditor/src/test/resources/log4j2.xml b/auditor/src/test/resources/log4j2.xml new file mode 100644 index 0000000..30fb1c5 --- /dev/null +++ b/auditor/src/test/resources/log4j2.xml @@ -0,0 +1,17 @@ + + + + + + %d{ABSOLUTE} [%t] %-5p - %C{1}.%M(%L) | %m%n + + + + + + + + + + + diff --git a/context/pom.xml b/context/pom.xml index 4f1258d..8f71c8e 100644 --- a/context/pom.xml +++ b/context/pom.xml @@ -27,8 +27,19 @@ slf4j-api - org.slf4j - slf4j-log4j12 + org.apache.logging.log4j + log4j-api + test + + + org.apache.logging.log4j + log4j-core + test + + + org.apache.logging.log4j + log4j-slf4j-impl + test diff --git a/nodeauth/pom.xml b/nodeauth/pom.xml index fa4d085..8accbf8 100644 --- a/nodeauth/pom.xml +++ b/nodeauth/pom.xml @@ -27,8 +27,19 @@ slf4j-api - org.slf4j - slf4j-log4j12 + org.apache.logging.log4j + log4j-api + test + + + org.apache.logging.log4j + log4j-core + test + + + org.apache.logging.log4j + log4j-slf4j-impl + test diff --git a/pom.xml b/pom.xml index 9e7efef..42e6874 100644 --- a/pom.xml +++ b/pom.xml @@ -23,6 +23,7 @@ 2.5 3.6 1.1.1 + 2.9.0 2.0.16 4.1.13.Final 1.7.25 @@ -157,9 +158,21 @@ ${slf4j-version} - org.slf4j - slf4j-log4j12 - ${slf4j-version} + org.apache.logging.log4j + log4j-api + ${log4j-version} + test + + + org.apache.logging.log4j + log4j-core + ${log4j-version} + test + + + org.apache.logging.log4j + log4j-slf4j-impl + ${log4j-version} test diff --git a/test/pom.xml b/test/pom.xml index 553cf96..1557ff3 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -41,8 +41,19 @@ slf4j-api - org.slf4j - slf4j-log4j12 + org.apache.logging.log4j + log4j-api + test + + + org.apache.logging.log4j + log4j-core + test + + + org.apache.logging.log4j + log4j-slf4j-impl + test diff --git a/util/pom.xml b/util/pom.xml index 71428c3..54ec1c9 100644 --- a/util/pom.xml +++ b/util/pom.xml @@ -22,8 +22,19 @@ slf4j-api - org.slf4j - slf4j-log4j12 + org.apache.logging.log4j + log4j-api + test + + + org.apache.logging.log4j + log4j-core + test + + + org.apache.logging.log4j + log4j-slf4j-impl + test From 597a645876d0c032a674cb6cd805f42a2af18ddb Mon Sep 17 00:00:00 2001 From: Christian Ohr Date: Wed, 18 Oct 2017 13:15:38 +0200 Subject: [PATCH 28/29] #169:log4j2 fixes --- .../auditor/tests/mesa/AuditorMesaTest.java | 4 ---- context/src/test/resources/log4j2.xml | 17 +++++++++++++++++ .../nodeauth/tests/mesa/NodeAuthMesaTest.java | 3 --- 3 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 context/src/test/resources/log4j2.xml diff --git a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/tests/mesa/AuditorMesaTest.java b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/tests/mesa/AuditorMesaTest.java index 0fab441..8485059 100644 --- a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/tests/mesa/AuditorMesaTest.java +++ b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/tests/mesa/AuditorMesaTest.java @@ -12,7 +12,6 @@ */ package org.openhealthtools.ihe.atna.auditor.tests.mesa; -import org.apache.log4j.BasicConfigurator; import org.junit.Assert; import org.junit.Before; import org.openhealthtools.ihe.atna.auditor.context.AuditorModuleConfig; @@ -31,9 +30,6 @@ public abstract class AuditorMesaTest extends Assert { @Before public void setUp() throws Exception { - // Do basic log4j configuration - BasicConfigurator.configure(); - File keystoreFile = new File(getClass().getResource(TestConfiguration.KEY_STORE).toURI()); File truststoreFile = new File(getClass().getResource(TestConfiguration.TRUST_STORE).toURI()); diff --git a/context/src/test/resources/log4j2.xml b/context/src/test/resources/log4j2.xml new file mode 100644 index 0000000..30fb1c5 --- /dev/null +++ b/context/src/test/resources/log4j2.xml @@ -0,0 +1,17 @@ + + + + + + %d{ABSOLUTE} [%t] %-5p - %C{1}.%M(%L) | %m%n + + + + + + + + + + + diff --git a/nodeauth/src/test/java/org/openhealthtools/ihe/atna/nodeauth/tests/mesa/NodeAuthMesaTest.java b/nodeauth/src/test/java/org/openhealthtools/ihe/atna/nodeauth/tests/mesa/NodeAuthMesaTest.java index 1e539e0..b5a6dfd 100644 --- a/nodeauth/src/test/java/org/openhealthtools/ihe/atna/nodeauth/tests/mesa/NodeAuthMesaTest.java +++ b/nodeauth/src/test/java/org/openhealthtools/ihe/atna/nodeauth/tests/mesa/NodeAuthMesaTest.java @@ -13,7 +13,6 @@ package org.openhealthtools.ihe.atna.nodeauth.tests.mesa; -import org.apache.log4j.BasicConfigurator; import org.junit.Before; import org.openhealthtools.ihe.atna.nodeauth.SecurityDomain; import org.openhealthtools.ihe.atna.nodeauth.context.NodeAuthModuleContext; @@ -34,8 +33,6 @@ public abstract class NodeAuthMesaTest { @Before public void setUp() throws Exception { - // Setup the basic log4j handler - BasicConfigurator.configure(); // Set the security domain information Properties props = new Properties(); From 70480089688f8f2394dce70556adba2ba5ad00f0 Mon Sep 17 00:00:00 2001 From: Christian Ohr Date: Fri, 10 Nov 2017 21:39:18 +0100 Subject: [PATCH 29/29] remove warnings --- .../openhealthtools/ihe/atna/auditor/XDSConsumerAuditor.java | 1 - .../atna/auditor/events/AbstractAuditEventMessageImpl.java | 2 +- .../ihe/atna/auditor/events/AuditEventMessage.java | 2 +- .../auditor/models/rfc3881/AuditSourceIdentificationType.java | 1 - .../atna/auditor/models/rfc3881/EventIdentificationType.java | 1 - .../models/rfc3881/ParticipantObjectIdentificationType.java | 1 - .../ihe/atna/auditor/sender/NettyTLSSyslogSenderImpl.java | 2 +- .../ihe/atna/auditor/AuditorIntegrationTest.java | 2 +- .../org/openhealthtools/ihe/atna/nodeauth/SecurityDomain.java | 4 ++-- .../ihe/atna/nodeauth/SecurityDomainManager.java | 2 +- .../org/openhealthtools/ihe/atna/test/TCPSyslogServer.java | 2 -- 11 files changed, 7 insertions(+), 13 deletions(-) diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSConsumerAuditor.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSConsumerAuditor.java index d5f0f26..7a5b2f8 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSConsumerAuditor.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSConsumerAuditor.java @@ -11,7 +11,6 @@ package org.openhealthtools.ihe.atna.auditor; import java.util.Arrays; -import java.util.Collections; import java.util.List; import org.openhealthtools.ihe.atna.auditor.codes.ihe.IHETransactionEventTypeCodes; diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/AbstractAuditEventMessageImpl.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/AbstractAuditEventMessageImpl.java index 9bdfaa9..a8a0cf5 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/AbstractAuditEventMessageImpl.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/AbstractAuditEventMessageImpl.java @@ -106,7 +106,7 @@ public Date getDateTime() { /* (non-Javadoc) * @see org.openhealthtools.ihe.atna.auditor.events.AuditEventMessage#setDestinationUri(java.net.URI) */ - public void setDestinationUri(URI uri) throws Exception { + public void setDestinationUri(URI uri) { if (EventUtils.isEmptyOrNull(uri)) { LOGGER.error("The destination URI cannot be null"); throw new IllegalArgumentException("The destination URI cannot be null"); diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/AuditEventMessage.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/AuditEventMessage.java index 92529d3..4595ec3 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/AuditEventMessage.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/AuditEventMessage.java @@ -56,7 +56,7 @@ public interface AuditEventMessage * @param uri The destination * @throws Exception */ - void setDestinationUri(URI uri) throws Exception; + void setDestinationUri(URI uri); /** * Gets the destination address for this message diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/models/rfc3881/AuditSourceIdentificationType.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/models/rfc3881/AuditSourceIdentificationType.java index 0ab3769..da107e8 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/models/rfc3881/AuditSourceIdentificationType.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/models/rfc3881/AuditSourceIdentificationType.java @@ -20,7 +20,6 @@ package org.openhealthtools.ihe.atna.auditor.models.rfc3881; import org.apache.commons.lang3.StringEscapeUtils; -import org.openhealthtools.ihe.atna.auditor.codes.rfc3881.RFC3881AuditSourceTypeCodes; import org.openhealthtools.ihe.atna.auditor.codes.rfc3881.RFC3881AuditSourceTypes; import org.openhealthtools.ihe.atna.auditor.utils.EventUtils; diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/models/rfc3881/EventIdentificationType.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/models/rfc3881/EventIdentificationType.java index e4d84e1..b5da467 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/models/rfc3881/EventIdentificationType.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/models/rfc3881/EventIdentificationType.java @@ -21,7 +21,6 @@ import java.math.BigInteger; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import java.util.Objects; diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/models/rfc3881/ParticipantObjectIdentificationType.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/models/rfc3881/ParticipantObjectIdentificationType.java index c436c79..b75e94c 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/models/rfc3881/ParticipantObjectIdentificationType.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/models/rfc3881/ParticipantObjectIdentificationType.java @@ -20,7 +20,6 @@ package org.openhealthtools.ihe.atna.auditor.models.rfc3881; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import org.apache.commons.lang3.StringEscapeUtils; diff --git a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/sender/NettyTLSSyslogSenderImpl.java b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/sender/NettyTLSSyslogSenderImpl.java index b46235e..b00c5db 100644 --- a/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/sender/NettyTLSSyslogSenderImpl.java +++ b/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/sender/NettyTLSSyslogSenderImpl.java @@ -54,7 +54,7 @@ private static final class NettyDestination implements Destination { private EventLoopGroup workerGroup; private Channel channel; - public NettyDestination(String host, int port, final boolean withLogging) throws Exception { + public NettyDestination(String host, int port, final boolean withLogging) { workerGroup = new NioEventLoopGroup(5); diff --git a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/AuditorIntegrationTest.java b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/AuditorIntegrationTest.java index 1e5b85c..a778620 100644 --- a/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/AuditorIntegrationTest.java +++ b/auditor/src/test/java/org/openhealthtools/ihe/atna/auditor/AuditorIntegrationTest.java @@ -146,7 +146,7 @@ public void testTCPTwoWayTLSWrongClientCert(TestContext context) throws Exceptio async.complete(); } - private Properties initSecurityDomainProperties() throws Exception { + private Properties initSecurityDomainProperties() { Properties props = new Properties(); props.put(JAVAX_NET_SSL_KEYSTORE_PASSWORD, KEY_STORE_PASS); props.put(JAVAX_NET_SSL_KEYSTORE, this.getClass().getResource(KEY_STORE).getPath()); diff --git a/nodeauth/src/main/java/org/openhealthtools/ihe/atna/nodeauth/SecurityDomain.java b/nodeauth/src/main/java/org/openhealthtools/ihe/atna/nodeauth/SecurityDomain.java index 3490e39..b41c49b 100644 --- a/nodeauth/src/main/java/org/openhealthtools/ihe/atna/nodeauth/SecurityDomain.java +++ b/nodeauth/src/main/java/org/openhealthtools/ihe/atna/nodeauth/SecurityDomain.java @@ -277,7 +277,7 @@ private void setOrClearSystemProperties(String name, Properties source) { * @throws CertificateException * @throws IOException */ - protected void initTrustStore(InputStream truststoreInputStream, char[] truststorePassword) throws SecurityDomainException, NoSuchAlgorithmException, CertificateException, IOException { + protected void initTrustStore(InputStream truststoreInputStream, char[] truststorePassword) throws SecurityDomainException, NoSuchAlgorithmException, CertificateException { if (null == truststoreInputStream) { truststoreInitialized = true; logger.warn("Truststore input stream is null. Using JVM default trust store."); @@ -323,7 +323,7 @@ protected void initTrustStore(InputStream truststoreInputStream, char[] truststo * @throws UnrecoverableKeyException * @throws IOException */ - protected void initKeyStore(InputStream keystoreInputStream, char[] keystorePassword) throws SecurityDomainException, NoSuchAlgorithmException, CertificateException, UnrecoverableKeyException, IOException { + protected void initKeyStore(InputStream keystoreInputStream, char[] keystorePassword) throws SecurityDomainException, NoSuchAlgorithmException, CertificateException, UnrecoverableKeyException { for (int typeIndex = 0; typeIndex < SECURITY_STORE_FORMATS.length; typeIndex++) { String storeType = SECURITY_STORE_FORMATS[typeIndex]; try { diff --git a/nodeauth/src/main/java/org/openhealthtools/ihe/atna/nodeauth/SecurityDomainManager.java b/nodeauth/src/main/java/org/openhealthtools/ihe/atna/nodeauth/SecurityDomainManager.java index 238109d..51d6bce 100644 --- a/nodeauth/src/main/java/org/openhealthtools/ihe/atna/nodeauth/SecurityDomainManager.java +++ b/nodeauth/src/main/java/org/openhealthtools/ihe/atna/nodeauth/SecurityDomainManager.java @@ -114,7 +114,7 @@ public void registerDefaultSecurityDomain(SecurityDomain securityDomain) * @throws URISyntaxException * @throws {@link IllegalArgumentException If the specified domain doesn't exist, or if the URI is null */ - public void registerURItoSecurityDomain(URI uri, String name) throws NoSecurityDomainException, URISyntaxException + public void registerURItoSecurityDomain(URI uri, String name) throws URISyntaxException { if (uri == null) throw new IllegalArgumentException("URI parameter cannot be null"); if (! securityDomains.containsKey(name) ) throw new IllegalArgumentException("Security domain "+name+" is not a configured security domain."); diff --git a/test/src/main/java/org/openhealthtools/ihe/atna/test/TCPSyslogServer.java b/test/src/main/java/org/openhealthtools/ihe/atna/test/TCPSyslogServer.java index f69d3be..402468a 100644 --- a/test/src/main/java/org/openhealthtools/ihe/atna/test/TCPSyslogServer.java +++ b/test/src/main/java/org/openhealthtools/ihe/atna/test/TCPSyslogServer.java @@ -1,8 +1,6 @@ package org.openhealthtools.ihe.atna.test; import io.vertx.core.AbstractVerticle; -import io.vertx.core.Handler; -import io.vertx.core.buffer.Buffer; import io.vertx.core.http.ClientAuth; import io.vertx.core.net.*; import io.vertx.ext.unit.Async;