As the use of HAPI extends deeper into our work practices, building test cases 
has encouraged us to use example message files. Saving them with the package, 
and bringing them in as resource streams is the manner we have adopted.
 
Today I stumbled across the Hl7InputStreamMessageIterator, which looks to be 
made for just this scenario, so I have been having a go at using it.
 
The code below shows my attempt:
 
//        Hl7InputStreamMessageIterator messageIterator = 
Hl7InputStreamMessageIterator.getForClasspathResource("/au/gov/qld/health/sit/cdr2/CdnPacsCbhInEscaped.dat");
        Hl7InputStreamMessageIterator messageIterator = new 
Hl7InputStreamMessageIterator(getClass().getResourceAsStream("/au/gov/qld/health/sit/cdr2/CdnPacsCbhInEscaped.dat"));
        messageIterator.setIgnoreComments(true);
//        
messageIterator.setMessageType(ca.uhn.hl7v2.model.v24.message.ORU_R01.class);
As is I get a good result, and can step through the messages in my resource 
file and assert things for my test case.
 
However, the commented out lines, the first being how I thought I might be able 
to bring in the resource, the second fixing the message to a particular version 
which I expect won't build.  They return:
 
Compiling 1 source file to D:\JavaDevelopment\RisToCdr2\build\test\classes
D:\JavaDevelopment\RisToCdr2\test\au\gov\qld\health\sit\cdr2\CdnPacsCbhTxCdr2Test.java:52:
 error: cannot find symbol
        Hl7InputStreamMessageIterator messageIterator = 
Hl7InputStreamMessageIterator.getForClasspathResource("/au/gov/qld/health/sit/cdr2/CdnPacsCbhInEscaped.dat");
  symbol:   method getForClasspathResource(String)
  location: class Hl7InputStreamMessageIterator
HAPI library in use is v2.1
 
Any thoughts on where I have gone wrong?
 
Thanks
Ian

********************************************************************************
This email, including any attachments sent with it, is confidential and for the 
sole use of the intended recipient(s). This confidentiality is not waived or 
lost, if you receive it and you are not the intended recipient(s), or if it is 
transmitted/received in error.
Any unauthorised use, alteration, disclosure, distribution or review of this 
email is strictly prohibited.  The information contained in this email, 
including any attachment sent with it, may be subject to a statutory duty of 
confidentiality if it relates to health service matters.
If you are not the intended recipient(s), or if you have received this email in 
error, you are asked to immediately notify the sender by telephone collect on 
Australia +61 1800 198 175 or by return email.  You should also delete this 
email, and any copies, from your computer system network and destroy any hard 
copies produced.
If not an intended recipient of this email, you must not copy, distribute or 
take any action(s) that relies on it; any form of disclosure, modification, 
distribution and/or publication of this email is also prohibited.
Although Queensland Health takes all reasonable steps to ensure this email does 
not contain malicious software, Queensland Health does not accept 
responsibility for the consequences if any person's computer inadvertently 
suffers any disruption to services, loss of information, harm or is infected 
with a virus, other malicious computer programme or code that may occur as a 
consequence of receiving this email.
Unless stated otherwise, this email represents only the views of the sender and 
not the views of the Queensland Government.
**********************************************************************************

------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to