<?xml version="1.0" encoding="UTF-8"?>
<con:soapui-project activeEnvironment="Default" name="FPDS-FtP-TiuHl7-Write" soapui-version="5.2.1" abortOnError="false" runType="SEQUENTIAL" resourceRoot="" id="4c423225-5363-4866-b83c-2fd401cbd11b" xmlns:con="http://eviware.com/soapui/config">
	<con:settings><con:setting id="ProjectSettings@hermesConfig">${HERMES_CFG}</con:setting></con:settings>
	<con:interface xsi:type="con:RestService" wadlVersion="http://wadl.dev.java.net/2009/02" name="FPDS" type="rest" basePath="/repositories.URL       /fpds/pgd/" definitionUrl="http://${#Project#mockServiceHost}:${#Project#fpdsServicePort}/repositories.URL       /fpds/?_wadl" id="80a6f778-8128-4803-90b2-ecaa662310cc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
		<con:settings/>
		<con:definitionCache type="TEXT" rootPart="http://${#Project#mockServiceHost}:${#Project#fpdsServicePort}/repositories.URL       /fpds/?_wadl">
			<con:part>
				<con:url>http://${#Project#mockServiceHost}:${#Project#fpdsServicePort}/repositories.URL       /fpds/?_wadl
				</con:url>
				<con:content>&lt;ns1:XMLFault
					xmlns:ns1="http://cxf.apache.org/bindings/xformat">
					&lt;ns1:faultstring>UriInfo object is expected to be part of the in
					message content list.&lt;/ns1:faultstring>
					&lt;/ns1:XMLFault></con:content>
				<con:type>http://cxf.apache.org/bindings/xformat</con:type>
			</con:part>
		</con:definitionCache>
		<con:endpoints>
			<con:endpoint>FPDS_TIU::queue_jms/fpds/TiuHl7Queue::queue_</con:endpoint>
		<con:endpoint>FPDS_TIU_QUEUE_JMS_ENDPOINT</con:endpoint><con:endpoint>http://${#Project#fpdsServiceHost}:${#Project#fpdsServicePort}
			</con:endpoint><con:endpoint>jms://${FPDS_QUEUE_JMS_ENDPOINT}</con:endpoint><con:endpoint>jms://FPDS_PGD::queue_jms/fpds/HmpPgdQueue</con:endpoint></con:endpoints>
		
	<con:resource name="" path="" id="715349a3-86bf-4f63-969e-7b73f29e8472">
			<con:settings/>
			<con:parameters/>
			
			
		</con:resource><con:resource name="write" path="{templateId}/{filterId}/{identifier}" id="db854e01-81ac-4023-9a1d-e5a78b7f5fe5"><con:settings/><con:parameters><con:parameter><con:name>templateId</con:name><con:value>templateId</con:value><con:style>TEMPLATE</con:style><con:default>templateId</con:default></con:parameter><con:parameter><con:name>request</con:name><con:value>request</con:value><con:style>TEMPLATE</con:style><con:default>request</con:default></con:parameter><con:parameter><con:name>requestId</con:name><con:value>requestId</con:value><con:style>TEMPLATE</con:style><con:default>requestId</con:default></con:parameter><con:parameter><con:name>filterId</con:name><con:value>filterId</con:value><con:style>TEMPLATE</con:style><con:default>filterId</con:default></con:parameter><con:parameter><con:name>identifier</con:name><con:value>identifier</con:value><con:style>TEMPLATE</con:style><con:default>identifier</con:default></con:parameter></con:parameters><con:method name="Method 1" method="POST" id="de3006ab-93a7-47c3-b521-5942285928cc"><con:settings/><con:parameters/><con:request name="writePGD" mediaType="application/json" postQueryString="false" id="2f463b5f-b937-4435-b120-6d6a2e3ccf7e"><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers">&lt;xml-fragment/></con:setting></con:settings><con:endpoint>http://${#Project#fpdsServiceHost}:${#Project#fpdsServicePort} 			</con:endpoint><con:request/><con:credentials><con:selectedAuthProfile>Basic</con:selectedAuthProfile><con:addedBasicAuthenticationTypes>Basic</con:addedBasicAuthenticationTypes><con:authType>Global HTTP Settings</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters/><con:parameterOrder><con:entry>templateId</con:entry><con:entry>request</con:entry><con:entry>requestId</con:entry><con:entry>filterId</con:entry><con:entry>identifier</con:entry></con:parameterOrder></con:request></con:method></con:resource><con:resource name="record" path="record/{identifier}" id="0c4cb861-2da6-4e7d-a798-aa685bd7c723"><con:settings/><con:parameters><con:parameter><con:name>identifier</con:name><con:style>TEMPLATE</con:style></con:parameter><con:parameter><con:name>filterId</con:name><con:value/><con:style>QUERY</con:style><con:default/><con:description xsi:nil="true"/></con:parameter><con:parameter><con:name>requestId</con:name><con:value/><con:style>QUERY</con:style><con:default/><con:description xsi:nil="true"/></con:parameter><con:parameter><con:name>clientName</con:name><con:value/><con:style>QUERY</con:style><con:default/><con:description xsi:nil="true"/></con:parameter><con:parameter><con:name>clientRequestInitiationTime</con:name><con:value/><con:style>QUERY</con:style><con:default/><con:description xsi:nil="true"/></con:parameter><con:parameter><con:name>_type</con:name><con:value/><con:style>QUERY</con:style><con:default/><con:description xsi:nil="true"/></con:parameter></con:parameters><con:method name="readByRecord" method="GET" id="0a9879ee-62f1-4ae0-8a1f-35a37254465a"><con:settings/><con:parameters/><con:request name="Request 1" mediaType="application/json" id="f8e20bd8-f834-424f-8a94-c0c5aec16485"><con:settings/><con:endpoint>http://${#Project#fpdsServiceHost}:${#Project#fpdsServicePort}
			</con:endpoint><con:request/><con:credentials><con:authType>No Authorization</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters>
  <con:entry key="_type" value="json"/>
  <con:entry key="requestId" value="${=java.util.UUID.randomUUID().toString()}       "/>
  <con:entry key="clientInitiationTime" value="${=org.apache.commons.lang.time.DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format( new Date() )}"/>
  <con:entry key="clientName" value="HMPPGD"/>
</con:parameters><con:parameterOrder><con:entry>identifier</con:entry><con:entry>filterId</con:entry><con:entry>requestId</con:entry><con:entry>clientName</con:entry><con:entry>clientRequestInitiationTime</con:entry><con:entry>_type</con:entry></con:parameterOrder></con:request></con:method></con:resource><con:resource name="patient" path="patient/" id="ff2bd350-6d58-4c94-bcca-66930caed35f"><con:settings/><con:parameters><con:parameter><con:name>filterId</con:name><con:value/><con:style>QUERY</con:style><con:default/><con:description xsi:nil="true"/></con:parameter><con:parameter><con:name>requestId</con:name><con:value/><con:style>QUERY</con:style><con:default/><con:description xsi:nil="true"/></con:parameter><con:parameter><con:name>clientRequestInitiationTime</con:name><con:value/><con:style>QUERY</con:style><con:default/><con:description xsi:nil="true"/></con:parameter><con:parameter><con:name>clientName</con:name><con:value/><con:style>QUERY</con:style><con:default/><con:description xsi:nil="true"/></con:parameter><con:parameter><con:name>collectionType</con:name><con:value/><con:style>QUERY</con:style><con:default/><con:description xsi:nil="true"/></con:parameter><con:parameter><con:name>resolvedIdentifier</con:name><con:value/><con:style>QUERY</con:style><con:default/><con:description xsi:nil="true"/></con:parameter><con:parameter><con:name>excludeIdentifier</con:name><con:value/><con:style>QUERY</con:style><con:default/><con:description xsi:nil="true"/></con:parameter><con:parameter><con:name>_type</con:name><con:value/><con:style>QUERY</con:style><con:default/><con:description xsi:nil="true"/></con:parameter><con:parameter><con:name>templateId</con:name><con:value/><con:style>QUERY</con:style><con:default/><con:description xsi:nil="true"/></con:parameter><con:parameter><con:name>nationalId</con:name><con:value/><con:style>QUERY</con:style><con:default/><con:description xsi:nil="true"/></con:parameter></con:parameters><con:method name="readByPatient" method="GET" id="7d8b644b-adbc-4ad8-ae5a-5fc555a89d55"><con:settings/><con:parameters/><con:request name="Request 1" mediaType="application/json" id="4a066020-46e2-4373-9b9f-2a81cf0a1a09"><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers">&lt;xml-fragment/></con:setting></con:settings><con:endpoint>http://${#Project#fpdsServiceHost}:${#Project#fpdsServicePort} 			</con:endpoint><con:request/><con:credentials><con:authType>No Authorization</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters>
  <con:entry key="_type" value="json"/>
  <con:entry key="requestId" value="${=java.util.UUID.randomUUID().toString()}       "/>
  <con:entry key="clientName" value="HMPPGD"/>
</con:parameters><con:parameterOrder><con:entry>filterId</con:entry><con:entry>requestId</con:entry><con:entry>clientName</con:entry><con:entry>clientRequestInitiationTime</con:entry><con:entry>collectionType</con:entry><con:entry>nationalId</con:entry><con:entry>excludeIdentifier</con:entry><con:entry>resolvedIdentifier</con:entry><con:entry>templateId</con:entry><con:entry>_type</con:entry></con:parameterOrder></con:request></con:method></con:resource></con:interface>
	
	<con:testSuite name="FtP Test Suite" id="f187a357-b378-4a67-b033-63ec148b5fc7"><con:settings/><con:runType>SEQUENTIAL</con:runType><con:testCase id="446b9810-4f2c-4c2b-b6d8-def31eed36c9" failOnError="true" failTestCaseOnErrors="true" keepSession="false" maxResults="0" name="Groovy Create TiuNote" searchProperties="true"><con:settings/><con:testStep type="groovy" name="CreateTiuHl7Note" id="75b87055-31f2-45f4-8fa6-437dcf9145ab"><con:settings/><con:config><script><![CDATA[import com.eviware.soapui.impl.wsdl.submit.transports.jms.JMSConnectionHolder
import com.eviware.soapui.impl.wsdl.submit.transports.jms.util.HermesUtils
import com.eviware.soapui.impl.wsdl.submit.transports.jms.JMSEndpoint
import javax.jms.*
import java.nio.*
import java.text.SimpleDateFormat

//def jmsEndpoint = new JMSEndpoint("jms://FPDS_TIU::queue_jms/fpds/TiuHl7Queue::queue_");
def jmsEndpoint = new JMSEndpoint("jms://FPDS_TIU::queue_jms/fpds/TiuHl7Queue::queue_jms/fpds/FtpHl7AckQueue");
def hermes = HermesUtils.getHermes(context.testCase.testSuite.project, jmsEndpoint.sessionName);
def jmsConnectionHolder = new JMSConnectionHolder(jmsEndpoint, hermes, false, null, null, null);

Session queueSession = jmsConnectionHolder.getSession();
Queue queueSend = jmsConnectionHolder.getQueue( jmsConnectionHolder.getJmsEndpoint().getSend());
Queue queueBrowse = jmsConnectionHolder.getQueue(jmsConnectionHolder.getJmsEndpoint().getReceive());
//TemporaryQueue queueBrowse = jmsConnectionHolder.getQueue(jmsConnectionHolder.getJmsEndpoint().getReceive());

def responseQueueName = queueBrowse.getQueueName();
log.info "Request Q: "+queueSend.getQueueName();
log.info "Response Q: "+responseQueueName;

MessageProducer messageProducer = queueSession.createProducer(queueSend);
TextMessage testMessageSend = queueSession.createTextMessage();

def messageControlId = (UUID.randomUUID().toString()).trim();
timeStamp = new SimpleDateFormat("yyyyMMddHHmmssZ").format(Calendar.getInstance().getTime());

//expect nothing returned - Invalid Sending Application CR RESPONSE will go to the Default Q  because MSH 3 has the wrong Name to lookup the client Q
//testMessageSend.setText("MSH^~|\\&^HDRFTPXXX^200HD~HDRURL        ~DNS^TIUHL7^654~islvhdvsta01.fo-slc.URL       ~DNS^"+timeStamp+"^^MDM~T02^"+messageControlId+"^T^2.4^^^AL^AL^USA^^^^\r\nEVN^T02^"+timeStamp+"^^2^32885~Blankenship~George~~~~~~USVHA&&0363~L~~~NI~FACILITY&STATION&L^"+timeStamp+"^\r\nPID^1^^~~~USVHA~NI~VA FACILITY ID&200M&L|1~~~USVHA~PI~VA FACILITY&552&L|666223456~~~USSSA~SS~VA FACILITY ID&STATION&L^^Zzzretfivefiftyone~Patient~~~~~L^Government~~~~~~M^19350407^m^^w^1335 East West Highway~~Silver Sprung~MD~20910^^(301) 734-0400^(301) 734-0227^^M^C^^^^^American^^^^^veteran^^^N^\r\nPV1^^^CARDIOLOGY~~~~~C^^123456789~~~USVHA~~DNS    &552&L~~^^^^^^^^^^^^^^NEW^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\nTXA^^PR^TEXT^"+timeStamp+"^^"+timeStamp+"^^^988~Provider~Five~~~~~~~~~~~facility&station&L^988~Provider~Five~~~~~~~~~~~facility&station&L^^123456789~USVHA^^^220051022154424~HT^ASI-ADDICTION SEVERITY INDEX^PA^U^^AC^end of collection period^^\r\nOBX^1^TX^^^This is a Note for MJT development - note from soapUI: "+messageControlId+"  ^^^^^^^^^^^^^^");

//expect a CR - Invalid Receiving Application 
//testMessageSend.setText("MSH^~|\\&^HDRFTP^200HD~HDRURL        ~DNS^TIUHL7XXX^654~islvhdvsta01.fo-slc.URL       ~DNS^"+timeStamp+"^^MDM~T02^"+messageControlId+"^T^2.4^^^AL^AL^USA^^^^\r\nEVN^T02^"+timeStamp+"^^2^32885~Blankenship~George~~~~~~USVHA&&0363~L~~~NI~FACILITY&STATION&L^"+timeStamp+"^\r\nPID^1^^~~~USVHA~NI~VA FACILITY ID&200M&L|1~~~USVHA~PI~VA FACILITY&552&L|666223456~~~USSSA~SS~VA FACILITY ID&STATION&L^^Zzzretfivefiftyone~Patient~~~~~L^Government~~~~~~M^19350407^m^^w^1335 East West Highway~~Silver Sprung~MD~20910^^(301) 734-0400^(301) 734-0227^^M^C^^^^^American^^^^^veteran^^^N^\r\nPV1^^^CARDIOLOGY~~~~~C^^123456789~~~USVHA~~DNS    &552&L~~^^^^^^^^^^^^^^NEW^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\nTXA^^PR^TEXT^"+timeStamp+"^^"+timeStamp+"^^^988~Provider~Five~~~~~~~~~~~facility&station&L^988~Provider~Five~~~~~~~~~~~facility&station&L^^123456789~USVHA^^^220051022154424~HT^ASI-ADDICTION SEVERITY INDEX^PA^U^^AC^end of collection period^^\r\nOBX^1^TX^^^This is a Note for MJT development - note from soapUI: "+messageControlId+"  ^^^^^^^^^^^^^^");

//expect a CR with several validation errors concatenated, missing mmsh 5, msh 7 and msh 10
//testMessageSend.setText("MSH^~|\\&^HDRFTP^200HD~HDRURL        ~DNS^^654~islvhdvsta01.fo-slc.URL       ~DNS^^^MDM~T02^^T^2.4^^^AL^AL^USA^^^^\r\nEVN^T02^"+timeStamp+"^^2^32885~Blankenship~George~~~~~~USVHA&&0363~L~~~NI~FACILITY&STATION&L^"+timeStamp+"^\r\nPID^1^^~~~USVHA~NI~VA FACILITY ID&200M&L|1~~~USVHA~PI~VA FACILITY&552&L|666223456~~~USSSA~SS~VA FACILITY ID&STATION&L^^Zzzretfivefiftyone~Patient~~~~~L^Government~~~~~~M^19350407^m^^w^1335 East West Highway~~Silver Sprung~MD~20910^^(301) 734-0400^(301) 734-0227^^M^C^^^^^American^^^^^veteran^^^N^\r\nPV1^^^CARDIOLOGY~~~~~C^^123456789~~~USVHA~~DNS    &552&L~~^^^^^^^^^^^^^^NEW^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\nTXA^^PR^TEXT^"+timeStamp+"^^"+timeStamp+"^^^988~Provider~Five~~~~~~~~~~~facility&station&L^988~Provider~Five~~~~~~~~~~~facility&station&L^^123456789~USVHA^^^220051022154424~HT^ASI-ADDICTION SEVERITY INDEX^PA^U^^AC^end of collection period^^\r\nOBX^1^TX^^^This is a Note for MJT development - note from soapUI: "+messageControlId+"  ^^^^^^^^^^^^^^");

//expect a CR - SOCKET_CLIENT_TIMEOUT_EXCEPTION - because the address used to route to the Hl7Listerner is wrong, couldn't send message - there should ALSO BE a message sitting on the ErrorQ 
//testMessageSend.setText("MSH^~|\\&^HDRFTP^200HD~HDRURL        ~DNS^TIUHL7^654~BAD_ADDRESS~DNS^"+timeStamp+"^^MDM~T02^"+messageControlId+"^T^2.4^^^AL^AL^USA^^^^\r\nEVN^T02^"+timeStamp+"^^2^32885~Blankenship~George~~~~~~USVHA&&0363~L~~~NI~FACILITY&STATION&L^"+timeStamp+"^\r\nPID^1^^~~~USVHA~NI~VA FACILITY ID&200M&L|1~~~USVHA~PI~VA FACILITY&552&L|666223456~~~USSSA~SS~VA FACILITY ID&STATION&L^^Zzzretfivefiftyone~Patient~~~~~L^Government~~~~~~M^19350407^m^^w^1335 East West Highway~~Silver Sprung~MD~20910^^(301) 734-0400^(301) 734-0227^^M^C^^^^^American^^^^^veteran^^^N^\r\nPV1^^^CARDIOLOGY~~~~~C^^123456789~~~USVHA~~DNS    &552&L~~^^^^^^^^^^^^^^NEW^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\nTXA^^PR^TEXT^"+timeStamp+"^^"+timeStamp+"^^^988~Provider~Five~~~~~~~~~~~facility&station&L^988~Provider~Five~~~~~~~~~~~facility&station&L^^123456789~USVHA^^^220051022154424~HT^ASI-ADDICTION SEVERITY INDEX^PA^U^^AC^end of collection period^^\r\nOBX^1^TX^^^This is a Note for MJT development - note from soapUI: "+messageControlId+"  ^^^^^^^^^^^^^^");

//expect a CR - Validation MSH 7 - MSH 7 is not in the correct date time format
//testMessageSend.setText("MSH^~|\\&^HDRFTP^200HD~HDRURL        ~DNS^TIUHL7^654~islvhdvsta01.fo-slc.URL       ~DNS^6767"+timeStamp+"^^MDM~T02^"+messageControlId+"^T^2.4^^^AL^AL^USA^^^^\r\nEVN^T02^"+timeStamp+"^^2^32885~Blankenship~George~~~~~~USVHA&&0363~L~~~NI~FACILITY&STATION&L^"+timeStamp+"^\r\nPID^1^^~~~USVHA~NI~VA FACILITY ID&200M&L|1~~~USVHA~PI~VA FACILITY&552&L|666223456~~~USSSA~SS~VA FACILITY ID&STATION&L^^Zzzretfivefiftyone~Patient~~~~~L^Government~~~~~~M^19350407^m^^w^1335 East West Highway~~Silver Sprung~MD~20910^^(301) 734-0400^(301) 734-0227^^M^C^^^^^American^^^^^veteran^^^N^\r\nPV1^^^CARDIOLOGY~~~~~C^^123456789~~~USVHA~~DNS    &552&L~~^^^^^^^^^^^^^^NEW^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\nTXA^^PR^TEXT^"+timeStamp+"^^"+timeStamp+"^^^988~Provider~Five~~~~~~~~~~~facility&station&L^988~Provider~Five~~~~~~~~~~~facility&station&L^^123456789~USVHA^^^220051022154424~HT^ASI-ADDICTION SEVERITY INDEX^PA^U^^AC^end of collection period^^\r\nOBX^1^TX^^^This is a Note for MJT development - note from soapUI: "+messageControlId+"  ^^^^^^^^^^^^^^");

//expect an AR - bad Provider name - discrepenceny between Hl7 message IEN and Hl7 message name
//testMessageSend.setText("MSH^~|\\&^HDRFTP^200HD~HDRURL        ~DNS^TIUHL7^654~islvhdvsta01.fo-slc.URL       ~DNS^"+timeStamp+"^^MDM~T02^"+messageControlId+"^T^2.4^^^AL^AL^USA^^^^\r\nEVN^T02^"+timeStamp+"^^2^32885~Blankenship~George~~~~~~USVHA&&0363~L~~~NI~FACILITY&STATION&L^"+timeStamp+"^\r\nPID^1^^~~~USVHA~NI~VA FACILITY ID&200M&L|1~~~USVHA~PI~VA FACILITY&552&L|666223456~~~USSSA~SS~VA FACILITY ID&STATION&L^^Zzzretfivefiftyone~Patient~~~~~L^Government~~~~~~M^19350407^m^^w^1335 East West Highway~~Silver Sprung~MD~20910^^(301) 734-0400^(301) 734-0227^^M^C^^^^^American^^^^^veteran^^^N^\r\nPV1^^^CARDIOLOGY~~~~~C^^123456789~~~USVHA~~DNS    &552&L~~^^^^^^^^^^^^^^NEW^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\nTXA^^PR^TEXT^"+timeStamp+"^^"+timeStamp+"^^^988~Provider~FBADNAME~~~~~~~~~~~facility&station&L^988~Provider~Five~~~~~~~~~~~facility&station&L^^123456789~USVHA^^^220051022154424~HT^ASI-ADDICTION SEVERITY INDEX^PA^U^^AC^end of collection period^^\r\nOBX^1^TX^^^This is a Note for MJT development - note from soapUI: "+messageControlId+"  ^^^^^^^^^^^^^^");

//expect an AA - Document creation successful
testMessageSend.setText("MSH^~|\\&^HDRFTP^200HD~HDRURL        ~DNS^TIUHL7^654~islvhdvsta01.fo-slc.URL       ~DNS^"+timeStamp+"^^MDM~T02^"+messageControlId+"^T^2.4^^^AL^AL^USA^^^^\r\nEVN^T02^"+timeStamp+"^^2^32885~Blankenship~George~~~~~~USVHA&&0363~L~~~NI~FACILITY&STATION&L^"+timeStamp+"^\r\nPID^1^^~~~USVHA~NI~VA FACILITY ID&200M&L|1~~~USVHA~PI~VA FACILITY&552&L|666223456~~~USSSA~SS~VA FACILITY ID&STATION&L^^Zzzretfivefiftyone~Patient~~~~~L^Government~~~~~~M^19350407^m^^w^1335 East West Highway~~Silver Sprung~MD~20910^^(301) 734-0400^(301) 734-0227^^M^C^^^^^American^^^^^veteran^^^N^\r\nPV1^^^CARDIOLOGY~~~~~C^^123456789~~~USVHA~~DNS    &552&L~~^^^^^^^^^^^^^^NEW^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\nTXA^^PR^TEXT^"+timeStamp+"^^"+timeStamp+"^^^988~Provider~Five~~~~~~~~~~~facility&station&L^988~Provider~Five~~~~~~~~~~~facility&station&L^^123456789~USVHA^^^220051022154424~HT^ASI-ADDICTION SEVERITY INDEX^PA^U^^AC^end of collection period^^\r\nOBX^1^TX^^^This is a Note for MJT development - note from soapUI: "+messageControlId+"  ^^^^^^^^^^^^^^");

//CHANGE String sent to test different secenarios
messageProducer.send(testMessageSend);

MessageConsumer messageConsumer = queueSession.createConsumer(queueBrowse);
BytesMessage response = (BytesMessage)messageConsumer.receive(30000);
int msgLength = (int)response.getBodyLength();
byte[] messageBytes = new byte[msgLength];
response.readBytes(messageBytes);
ByteBuffer messageBuffer = ByteBuffer.wrap(messageBytes);
String messageResponse = new String(messageBuffer.array());
log.info "XXXXReceived:"+ messageResponse;


]]></script></con:config></con:testStep><con:properties/></con:testCase><con:testCase failOnError="true" failTestCaseOnErrors="true" keepSession="false" maxResults="0" name="Create HL7 TestCase" searchProperties="true" id="d0b7f28c-6859-44c0-bf10-4f6edb1fa8aa" disabled="true"><con:settings/><con:testStep type="groovy" name="Setup Test Data" id="b65cb6fb-89ff-4fa6-9654-350494ef2d75" disabled="true"><con:settings/><con:config><script>import java.util.UUID;  
import org.apache.commons.lang.time.DateFormatUtils;
context.CLIENT_INITIATION_TIME = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format( new Date() );
context.REQUEST_ID = (UUID.randomUUID().toString()).trim()

context.RECORD_UPDATE_TIME = '20151104172217-0600'
</script></con:config></con:testStep><con:testStep type="restrequest" name="CreateJMSTiuHl7 Test Request" id="96870077-635a-49c6-8d62-e6dea7a50cd7" disabled="true"><con:settings/><con:config service="FPDS" methodName="Method 1" resourcePath="/repositories.URL       /fpds/pgd/{templateId}/{filterId}/{identifier}" xsi:type="con:RestRequestStep" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><con:restRequest name="CreateJMSTiuHl7 Test Request" mediaType="text/xml" postQueryString="false" id="3c69a6f9-9acc-4e37-97a1-a521edcfda24"><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers">&lt;xml-fragment/></con:setting></con:settings><con:encoding>UTF-8</con:encoding><con:endpoint>jms://FPDS_TIU::queue_jms/fpds/TiuHl7Queue::queue_jms/fpds/FtpHl7AckQueue</con:endpoint><con:request><![CDATA[MSH^~|\&^HDRFTP^200HD~HDRURL        ~DNS^TIUHL7^654~islvhdvsta01.fo-slc.URL       ~DNS^20151217094543-0500^^MDM~T02^19999999999044^T^2.4^^^AL^AL^USA^^^^
EVN^T02^20051022154503-0500^^2^32885~Blankenship~George~~~~~~USVHA&&0363~L~~~NI~FACILITY&STATION&L^20151216094543-0500^
PID^1^^~~~USVHA~NI~VA FACILITY ID&200M&L|1~~~USVHA~PI~VA FACILITY&552&L|666223456~~~USSSA~SS~VA FACILITY ID&STATION&L^^Zzzretfivefiftyone~Patient~~~~~L^Government~~~~~~M^19350407^m^^w^1335 East West Highway~~Silver Sprung~MD~20910^^(301) 734-0400^(301) 734-0227^^M^C^^^^^American^^^^^veteran^^^N^
PV1^^^CARDIOLOGY~~~~~C^^123456789~~~USVHA~~DNS    &552&L~~^^^^^^^^^^^^^^NEW^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TXA^^PR^TEXT^20151215095403-0500^^20151217094543-0500^^^988~Provider~Five~~~~~~~~~~~facility&station&L^988~Provider~Five~~~~~~~~~~~facility&station&L^^123456789~USVHA^^^220051022154424~HT^ASI-ADDICTION SEVERITY INDEX^PA^U^^AC^end of collection period^^
OBX^1^TX^^^This is a Note for MJT development - note 9044  ^^^^^^^^^^^^^^]]></con:request><con:assertion type="Simple NotContains" name="Not Contains - checkForErrors" id="46de8ed3-4793-49fc-ad07-ce8cf0a560a3"><con:configuration><token>errorSection</token><ignoreCase>false</ignoreCase><useRegEx>false</useRegEx></con:configuration></con:assertion><con:assertion type="Simple Contains" name="Contains - checkForSuccess" id="8895d2fb-f6fe-43cc-9d8e-72826f134fd9" disabled="true"><con:configuration><token>"BIG SUCCESS"</token><ignoreCase>false</ignoreCase><useRegEx>false</useRegEx></con:configuration></con:assertion><con:credentials><con:selectedAuthProfile>Basic</con:selectedAuthProfile><con:addedBasicAuthenticationTypes>Basic</con:addedBasicAuthenticationTypes><con:authType>Global HTTP Settings</con:authType></con:credentials><con:attachment><con:name>bytesmessage3263601158640881702.tmp</con:name><con:contentType>application/octet-stream</con:contentType><con:contentId>bytesmessage3263601158640881702.tmp</con:contentId><con:url>C:/Users/DNS   ~4/AppData/Local/Temp/1/bytesmessage3263601158640881702.tmp</con:url><con:id>beadf47a-7477-4257-baa4-a678ad0cfc24</con:id></con:attachment><con:attachment><con:name>bytesmessage4819609667604579413.tmp</con:name><con:contentType>application/octet-stream</con:contentType><con:contentId>bytesmessage4819609667604579413.tmp</con:contentId><con:url>C:/Users/DNS   ~4/AppData/Local/Temp/1/bytesmessage4819609667604579413.tmp</con:url><con:id>52fda260-b735-4b58-97d6-62768efd3e93</con:id></con:attachment><con:attachment><con:name>bytesmessage325611500731733317.tmp</con:name><con:contentType>application/octet-stream</con:contentType><con:contentId>bytesmessage325611500731733317.tmp</con:contentId><con:url>C:/Users/DNS   ~4/AppData/Local/Temp/1/bytesmessage325611500731733317.tmp</con:url><con:id>d6d23e32-8a87-47ec-845c-ec1d8775abbc</con:id></con:attachment><con:attachment><con:name>bytesmessage7063699911772651552.tmp</con:name><con:contentType>application/octet-stream</con:contentType><con:contentId>bytesmessage7063699911772651552.tmp</con:contentId><con:url>C:/Users/DNS   ~4/AppData/Local/Temp/1/bytesmessage7063699911772651552.tmp</con:url><con:id>055fd80e-0cff-4549-8724-12ed36b3143f</con:id></con:attachment><con:attachment><con:name>bytesmessage5677986271643760935.tmp</con:name><con:contentType>application/octet-stream</con:contentType><con:contentId>bytesmessage5677986271643760935.tmp</con:contentId><con:url>C:/Users/DNS   ~4/AppData/Local/Temp/1/bytesmessage5677986271643760935.tmp</con:url><con:id>a9d6e581-399e-4735-bf07-13c7a11d2747</con:id></con:attachment><con:attachment><con:name>bytesmessage5498395633689715045.tmp</con:name><con:contentType>application/octet-stream</con:contentType><con:contentId>bytesmessage5498395633689715045.tmp</con:contentId><con:url>C:/Users/DNS   ~4/AppData/Local/Temp/1/bytesmessage5498395633689715045.tmp</con:url><con:id>7f91fab7-db6a-4f51-aa5b-2a77f8ae92e2</con:id></con:attachment><con:jmsConfig JMSDeliveryMode="PERSISTENT" JMSReplyTo="jms/fpds/FtpHl7AckQueue" sendAsBytesMessage="true" JMSCorrelationID=""/><con:jmsPropertyConfig/><con:parameters>
  <con:entry key="templateId" value=""/>
  <con:entry key="collectionType" value=""/>
  <con:entry key="_type" value="json"/>
  <con:entry key="filterId" value=""/>
  <con:entry key="requestId" value=""/>
  <con:entry key="clientName" value=""/>
  <con:entry key="request" value=""/>
  <con:entry key="resolvedAssigningAuthority" value=""/>
  <con:entry key="identifier" value=""/>
  <con:entry key="resolvedAssigningFacility" value=""/>
</con:parameters><con:parameterOrder><con:entry>templateId</con:entry><con:entry>request</con:entry><con:entry>requestId</con:entry><con:entry>filterId</con:entry><con:entry>identifier</con:entry></con:parameterOrder></con:restRequest></con:config></con:testStep><con:testStep type="groovy" name="CreateTiuJMSHL7_groovy" id="ba6e3226-69ac-4f07-b881-17f8f7e4ccfc" disabled="true"><con:settings/><con:config><script><![CDATA[import com.eviware.soapui.impl.wsdl.submit.transports.jms.JMSConnectionHolder
import com.eviware.soapui.impl.wsdl.submit.transports.jms.util.HermesUtils
import com.eviware.soapui.impl.wsdl.submit.transports.jms.JMSEndpoint
import javax.jms.*
import java.nio.*
import java.text.SimpleDateFormat

//def jmsEndpoint = new JMSEndpoint("jms://FPDS_TIU::queue_jms/fpds/TiuHl7Queue::queue_");
def jmsEndpoint = new JMSEndpoint("jms://FPDS_TIU::queue_jms/fpds/TiuHl7Queue::queue_jms/fpds/FtpHl7AckQueue");
def hermes = HermesUtils.getHermes(context.testCase.testSuite.project, jmsEndpoint.sessionName);
def jmsConnectionHolder = new JMSConnectionHolder(jmsEndpoint, hermes, false, null, null, null);

Session queueSession = jmsConnectionHolder.getSession();
Queue queueSend = jmsConnectionHolder.getQueue( jmsConnectionHolder.getJmsEndpoint().getSend());
Queue queueBrowse = jmsConnectionHolder.getQueue(jmsConnectionHolder.getJmsEndpoint().getReceive());
//TemporaryQueue queueBrowse = jmsConnectionHolder.getQueue(jmsConnectionHolder.getJmsEndpoint().getReceive());

def responseQueueName = queueBrowse.getQueueName();
log.info "Request Q: "+queueSend.getQueueName();
log.info "Response Q: "+responseQueueName;

MessageProducer messageProducer = queueSession.createProducer(queueSend);
TextMessage testMessageSend = queueSession.createTextMessage();

def messageControlId = (UUID.randomUUID().toString()).trim();
timeStamp = new SimpleDateFormat("yyyyMMddHHmmssZ").format(Calendar.getInstance().getTime());

//testMessageSend.setText("MSH^~|\\&^HDRAPP^FTP~jms/fpds/FtpHl7AckQueue~JMS^TIUHL7^654~islvhdvsta01.fo-slc.URL       ~DNS^20151209094503-0500^^MDM~T02^7888888208^T^2.4^^^AL^AL^USA^^^^\nEVN^T02^20051022154503-0500^^2^32885~Blankenship~George~~~~~~USVHA&&0363~L~~~NI~FACILITY&STATION&L^20051022154503-0500^\nPID^1^^~~~USVHA~NI~VA FACILITY ID&200M&L|1~~~USVHA~PI~VA FACILITY&552&L|666223456~~~USSSA~SS~VA FACILITY ID&STATION&L^^Zzzretfivefiftyone~Patient~~~~~L^Government~~~~~~M^19350407^m^^w^1335 East West Highway~~Silver Sprung~MD~20910^^(301) 734-0400^(301) 734-0227^^M^C^^^^^American^^^^^veteran^^^N^\nPV1^^^CARDIOLOGY~~~~~C^^123456789~~~USVHA~~DNS    &552&L~~^^^^^^^^^^^^^^NEW^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nTXA^^PR^TEXT^20151209094503-0500^^20051022154503-0500^^^988~Provider~Five~~~~~~~~~~~facility&station&L^988~Provider~Five~~~~~~~~~~~facility&station&L^^123456789~USVHA^^^220051022154424~HT^ASI-ADDICTION SEVERITY INDEX^PA^U^^AC^end of collection period^^\nOBX^1^TX^^^This is a Note for MJT development - note 8208  ^^^^^^^^^^^^^^");
//testMessageSend.setText("MSH^~|\\&^HDRAPP^FTP~jms/fpds/FtpHl7AckQueue~JMS^TIUHL7^654~islvhdvsta01.fo-slc.URL       ~DNS^20151210094503-0500^^MDM~T02^1111111119^T^2.4^^^AL^AL^USA^^^^\rEVN^T02^20051022154503-0500^^2^32885~Blankenship~George~~~~~~USVHA&&0363~L~~~NI~FACILITY&STATION&L^20051022154503-0500^\rPID^1^^~~~USVHA~NI~VA FACILITY ID&200M&L|1~~~USVHA~PI~VA FACILITY&552&L|666223456~~~USSSA~SS~VA FACILITY ID&STATION&L^^Zzzretfivefiftyone~Patient~~~~~L^Government~~~~~~M^19350407^m^^w^1335 East West Highway~~Silver Sprung~MD~20910^^(301) 734-0400^(301) 734-0227^^M^C^^^^^American^^^^^veteran^^^N^\rPV1^^^CARDIOLOGY~~~~~C^^123456789~~~USVHA~~DNS    &552&L~~^^^^^^^^^^^^^^NEW^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\rTXA^^PR^TEXT^20151210094503-0500^^20051022154503-0500^^^988~Provider~Five~~~~~~~~~~~facility&station&L^988~Provider~Five~~~~~~~~~~~facility&station&L^^123456789~USVHA^^^220051022154424~HT^ASI-ADDICTION SEVERITY INDEX^PA^U^^AC^end of collection period^^\rOBX^1^TX^^^This is a Note for MJT development - note 119  ^^^^^^^^^^^^^^");
//testMessageSend.setText("MSH^~|\\&^^FTP~$responseQueueName~JMS^TIUHL7^654~islvhdvsta01.fo-slc.URL       ~DNS^20151210094503-0500^^MDM~T02^1111111119^T^2.4^^^AL^AL^USA^^^^\r\nEVN^T02^20051022154503-0500^^2^32885~Blankenship~George~~~~~~USVHA&&0363~L~~~NI~FACILITY&STATION&L^20051022154503-0500^\r\nPID^1^^~~~USVHA~NI~VA FACILITY ID&200M&L|1~~~USVHA~PI~VA FACILITY&552&L|666223456~~~USSSA~SS~VA FACILITY ID&STATION&L^^Zzzretfivefiftyone~Patient~~~~~L^Government~~~~~~M^19350407^m^^w^1335 East West Highway~~Silver Sprung~MD~20910^^(301) 734-0400^(301) 734-0227^^M^C^^^^^American^^^^^veteran^^^N^\r\nPV1^^^CARDIOLOGY~~~~~C^^123456789~~~USVHA~~DNS    &552&L~~^^^^^^^^^^^^^^NEW^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\nTXA^^PR^TEXT^20151210094503-0500^^20051022154503-0500^^^988~Provider~Five~~~~~~~~~~~facility&station&L^988~Provider~Five~~~~~~~~~~~facility&station&L^^123456789~USVHA^^^220051022154424~HT^ASI-ADDICTION SEVERITY INDEX^PA^U^^AC^end of collection period^^\r\nOBX^1^TX^^^This is a Note for MJT development - note 119  ^^^^^^^^^^^^^^");
testMessageSend.setText("MSH^~|\\&^HDRFTP^200HD~HDRURL        ~DNS^TIUHL7^654~islvhdvsta01.fo-slc.URL       ~DNS^"+timeStamp+"^^MDM~T02^"+messageControlId+"^T^2.4^^^AL^AL^USA^^^^\r\nEVN^T02^"+timeStamp+"^^2^32885~Blankenship~George~~~~~~USVHA&&0363~L~~~NI~FACILITY&STATION&L^"+timeStamp+"^\r\nPID^1^^~~~USVHA~NI~VA FACILITY ID&200M&L|1~~~USVHA~PI~VA FACILITY&552&L|666223456~~~USSSA~SS~VA FACILITY ID&STATION&L^^Zzzretfivefiftyone~Patient~~~~~L^Government~~~~~~M^19350407^m^^w^1335 East West Highway~~Silver Sprung~MD~20910^^(301) 734-0400^(301) 734-0227^^M^C^^^^^American^^^^^veteran^^^N^\r\nPV1^^^CARDIOLOGY~~~~~C^^123456789~~~USVHA~~DNS    &552&L~~^^^^^^^^^^^^^^NEW^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\nTXA^^PR^TEXT^"+timeStamp+"^^"+timeStamp+"^^^988~Provider~Five~~~~~~~~~~~facility&station&L^988~Provider~Five~~~~~~~~~~~facility&station&L^^123456789~USVHA^^^220051022154424~HT^ASI-ADDICTION SEVERITY INDEX^PA^U^^AC^end of collection period^^\r\nOBX^1^TX^^^This is a Note for MJT development - note from soapUI: "+messageControlId+"  ^^^^^^^^^^^^^^");

messageProducer.send(testMessageSend);
MessageConsumer messageConsumer = queueSession.createConsumer(queueBrowse);
BytesMessage response = (BytesMessage)messageConsumer.receive(20000);
int msgLength = (int)response.getBodyLength();
byte[] messageBytes = new byte[msgLength];
response.readBytes(messageBytes);
ByteBuffer messageBuffer = ByteBuffer.wrap(messageBytes);
String messageResponse = new String(messageBuffer.array());
log.info "XXXXReceived:"+ messageResponse;


]]></script></con:config></con:testStep><con:properties/></con:testCase><con:testCase failOnError="true" failTestCaseOnErrors="true" keepSession="false" maxResults="0" name="Create HL7 TestCaseTCPMONITOR" searchProperties="true" id="64448309-e6d5-4f66-ad7e-6ff26a7f606b" disabled="true"><con:settings/><con:testStep type="groovy" name="Setup Test Data" id="a8686d58-9e4c-4776-9a85-a1d6e9448974" disabled="true"><con:settings/><con:config><script>import java.util.UUID;  
import org.apache.commons.lang.time.DateFormatUtils;
context.CLIENT_INITIATION_TIME = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format( new Date() );
context.REQUEST_ID = (UUID.randomUUID().toString()).trim()

context.RECORD_UPDATE_TIME = '20151104172217-0600'
</script></con:config></con:testStep><con:testStep type="restrequest" name="DEV3-TIUMONITOR JMS Hl7 Test Request" id="2bad1433-d121-4f4e-8697-31a4cfe72bc9" disabled="true"><con:settings/><con:config service="FPDS" methodName="Method 1" resourcePath="/repositories.URL       /fpds/pgd/{templateId}/{filterId}/{identifier}" xsi:type="con:RestRequestStep" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><con:restRequest name="DEV3-TIUMONITOR JMS Hl7 Test Request" mediaType="text/xml" postQueryString="false" id="3c69a6f9-9acc-4e37-97a1-a521edcfda24"><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers">&lt;xml-fragment/></con:setting></con:settings><con:encoding>UTF-8</con:encoding><con:endpoint>jms://FPDS_TIU::queue_jms/fpds/TiuHl7Queue::queue_</con:endpoint><con:request><![CDATA[MSH^~|\&^HDRAPP^FTP~jms/fpds/FtpHl7AckQueue~JMS^TIUHL7^654~IP         ~DNS^20151210094503-0500^^MDM~T02^9999999999115^T^2.4^^^AL^AL^USA^^^^
EVN^T02^20051022154503-0500^^2^32885~Blankenship~George~~~~~~USVHA&&0363~L~~~NI~FACILITY&STATION&L^20051022154503-0500^
PID^1^^~~~USVHA~NI~VA FACILITY ID&200M&L|1~~~USVHA~PI~VA FACILITY&552&L|666223456~~~USSSA~SS~VA FACILITY ID&STATION&L^^Zzzretfivefiftyone~Patient~~~~~L^Government~~~~~~M^19350407^m^^w^1335 East West Highway~~Silver Sprung~MD~20910^^(301) 734-0400^(301) 734-0227^^M^C^^^^^American^^^^^veteran^^^N^
PV1^^^CARDIOLOGY~~~~~C^^123456789~~~USVHA~~DNS    &552&L~~^^^^^^^^^^^^^^NEW^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TXA^^PR^TEXT^20151210094503-0500^^20051022154503-0500^^^988~Provider~Five~~~~~~~~~~~facility&station&L^988~Provider~Five~~~~~~~~~~~facility&station&L^^123456789~USVHA^^^220051022154424~HT^ASI-ADDICTION SEVERITY INDEX^PA^U^^AC^end of collection period^^
OBX^1^TX^^^This is a Note for MJT development - note 115  ^^^^^^^^^^^^^^]]></con:request><con:assertion type="Simple NotContains" name="Not Contains - checkForErrors" id="46de8ed3-4793-49fc-ad07-ce8cf0a560a3"><con:configuration><token>errorSection</token><ignoreCase>false</ignoreCase><useRegEx>false</useRegEx></con:configuration></con:assertion><con:assertion type="Simple Contains" name="Contains - checkForSuccess" id="8895d2fb-f6fe-43cc-9d8e-72826f134fd9" disabled="true"><con:configuration><token>"BIG SUCCESS"</token><ignoreCase>false</ignoreCase><useRegEx>false</useRegEx></con:configuration></con:assertion><con:credentials><con:selectedAuthProfile>Basic</con:selectedAuthProfile><con:addedBasicAuthenticationTypes>Basic</con:addedBasicAuthenticationTypes><con:authType>Global HTTP Settings</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT" JMSReplyTo="" sendAsBytesMessage="true" JMSCorrelationID=""/><con:jmsPropertyConfig/><con:parameters>
  <con:entry key="templateId" value=""/>
  <con:entry key="collectionType" value=""/>
  <con:entry key="_type" value="json"/>
  <con:entry key="filterId" value=""/>
  <con:entry key="requestId" value=""/>
  <con:entry key="clientName" value=""/>
  <con:entry key="request" value=""/>
  <con:entry key="resolvedAssigningAuthority" value=""/>
  <con:entry key="identifier" value=""/>
  <con:entry key="resolvedAssigningFacility" value=""/>
</con:parameters><con:parameterOrder><con:entry>templateId</con:entry><con:entry>request</con:entry><con:entry>requestId</con:entry><con:entry>filterId</con:entry><con:entry>identifier</con:entry></con:parameterOrder></con:restRequest></con:config></con:testStep><con:properties/></con:testCase><con:properties><con:property><con:name>PATIENT_IDENTIFIER</con:name><con:value>123456789XXX</con:value></con:property><con:property><con:name>DEFAULT_FACILITY</con:name><con:value>654</con:value></con:property><con:property><con:name>DEFAULT_AUTHORITY</con:name><con:value>USVHA</con:value></con:property><con:property><con:name>CLIENT_NAME</con:name><con:value>Fix the Phones</con:value></con:property></con:properties></con:testSuite><con:properties>
		<con:property>
			<con:name>fpdsServiceHost</con:name>
			<con:value>${fpds.appserver.target.host}</con:value>
		</con:property>
		<con:property>
			<con:name>fpdsServicePort</con:name>
			<con:value>${fpds.appserver.target.port}</con:value>
		</con:property>
	</con:properties>
	<con:wssContainer/>
	<con:oAuth2ProfileContainer/><con:sensitiveInformation/>
</con:soapui-project>