RESTClient tool
RESTClient is a Java application to test RESTful webservices. RESTClient2.4 can be downloaded from http://code.google.com/p/rest-client/downloads/detail?name=restclient-ui-2.4-jar-with-dependencies.jar
Â
1. Before testng REST interface of OpenEMPI, get a session key from REST interface of OpenEMPI by following method and configured the session key in the HTTP Headers in each test cases for authentication.
(1). Get session key through authenticate method
URL:Â http://localhost:8080/openempi-admin/openempi-ws-rest/security-resource/authenticate
HTTP Method: PUT
Content-type: application/xml
Body:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><authenticationRequest><password>admin</password><username>admin</username></authenticationRequest>
Response:
70394B59A140CCA6A9B32998BAC85086
(2). Add session key to the HTTP header in each test cases for authentication.
Â
2. Test cases.
(1) person-query-resource/loadPerson
HTTP Method: GET
Content-type: application/xml
Â
(2) person-query-resource/findPersonById
URL: http://localhost:8080/openempi-admin/openempi-ws-rest/person-query-resource/findPersonById
HTTP Method: POST
Content-type: application/xml
Body:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
   <personIdentifier>
      <identifier>865e7370-a045-11e1-a160-005056c00008</identifier>
      <identifierDomain>
         <namespaceIdentifier>2.16.840.1.113883.4.357</namespaceIdentifier>
         <universalIdentifier>2.16.840.1.113883.4.357</universalIdentifier>
         <universalIdentifierTypeCode>hl7</universalIdentifierTypeCode>
      </identifierDomain>
   </personIdentifier>
Â
(3) person-query-resource/getIdentifierDomains
URL: http://localhost:8080/openempi-admin/openempi-ws-rest/person-query-resource/getIdentifierDomains
HTTP Method: GET
Content-type: application/xml
Â
(4) person-query-resource/getIdentifierDomainAttributes
HTTP Method: POST
Content-type: application/xml
Body:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<identifierDomain>
   <dateCreated>2009-06-17T11:45:54-04:00</dateCreated>
   <identifierDomainDescription>2.16.840.1.113883.4.2</identifierDomainDescription>
   <identifierDomainId>11</identifierDomainId>
   <identifierDomainName>2.16.840.1.113883.4.2</identifierDomainName>
   <namespaceIdentifier>2.16.840.1.113883.4.2</namespaceIdentifier>
   <universalIdentifier>2.16.840.1.113883.4.2</universalIdentifier>
   <universalIdentifierTypeCode>TIN</universalIdentifierTypeCode>
</identifierDomain>
Â
(5) person-query-resource/getGlobalIdentifierById
URL:http://localhost:8080/openempi-admin/openempi-ws-rest/person-query-resource/getGlobalIdentifierById
HTTP Method: POST
Content-type: application/xml
Body:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
   <personIdentifier>
      <identifier>865e7370-a045-11e1-a160-005056c00008</identifier>
      <identifierDomain>
         <namespaceIdentifier>2.16.840.1.113883.4.357</namespaceIdentifier>
         <universalIdentifier>2.16.840.1.113883.4.357</universalIdentifier>
         <universalIdentifierTypeCode>hl7</universalIdentifierTypeCode>
      </identifierDomain>
   </personIdentifier>
Â
(6) person-query-resource/findPersonsByAttributes
URL: http://localhost:8080/openempi-admin/openempi-ws-rest/person-query-resource/findPersonsByAttributes
HTTP Method: POST
Content-type: application/xml
Body:
<person>
   <familyName>White</familyName><givenName>Campbell</givenName>
   <dateOfBirth>1982-05-29T00:00:00-04:00</dateOfBirth>
</person>
Â
(6) person-query-resource/getPersonLinks
URL:http://localhost:8080/openempi-admin/openempi-ws-rest/person-query-resource/getPersonLinks
HTTP Method: POST
Content-type: application/xml
Body:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<person>
   <familyName>White</familyName><givenName>Campbell</givenName>
   <dateOfBirth>1982-05-29T00:00:00-04:00</dateOfBirth>
   <personId>45099</personId>
</person>
Â
(7) person-query-resource/loadReviewRecordPair
HTTP Method: GET
Content-type: application/xml
Â
(8) person-manager-resource/updatePersonById
Before calling updatePersonById, make sure the <dateChanged>2012-06-07T09:33:19.796-04:00</dateChanged> should be greater than that of record in the database.
URL:http://localhost:8080/openempi-admin/openempi-ws-rest/person-manager-resource/updatePersonById
HTTP Method: PUT
Content-type: application/xml
Body:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<person>
   <address1>15 Barrett Street</address1>
   <address2>Aleon</address2>
   <city>Westland</city>
   <custom1>JFRS</custom1><custom2>SML</custom2><custom3>Jeff</custom3><custom4>10.1974</custom4>
   <dateChanged>2012-06-07T09:33:19.796-04:00</dateChanged>
   <dateCreated>2012-05-17T13:27:06.165-04:00</dateCreated>
   <dateOfBirth>1974-10-18T00:00:00-04:00</dateOfBirth>
   <familyName>Jeffries</familyName><givenName>Samuel</givenName>
   <personId>44800</personId>
   <personIdentifiers>
      <dateCreated>2012-05-17T13:27:06.535-04:00</dateCreated>
      <identifier>865e7370-a045-11e1-a160-005056c00008</identifier>
      <identifierDomain>
         <dateCreated>2012-02-10T13:44:24.755-05:00</dateCreated>
         <identifierDomainDescription>OpenEMPI Domain</identifierDomainDescription>
         <identifierDomainId>56</identifierDomainId>
         <identifierDomainName>OpenEMPI Domain</identifierDomainName>
         <namespaceIdentifier>2.16.840.1.113883.4.357</namespaceIdentifier>
         <universalIdentifier>2.16.840.1.113883.4.357</universalIdentifier>
         <universalIdentifierTypeCode>hl7</universalIdentifierTypeCode>
         <userCreatedBy>
            <accountExpired>false</accountExpired>
            <accountLocked>false</accountLocked>
            <address><address>2930 Oak Shadow Drive</address>
            <city>Herndon</city><country>US</country><postalCode>20171</postalCode><province>VA</province>
            </address>
            <credentialsExpired>false</credentialsExpired>
            <email>odysseas@sysnetint.com</email>
            <enabled>true</enabled>
            <firstName>Odysseas</firstName>
            <id>1</id>
            <lastName>Pentakalos</lastName>
            <password>d033e22ae348aeb5660fc2140aec35850c4da997</password>
            <passwordHint>A male kitty.</passwordHint>
            <username>testuser</username>
            <website>http://www.sysnetint.com</website>
         </userCreatedBy>
      </identifierDomain>
      <personIdentifierId>29411</personIdentifierId>
         <userCreatedBy>
            <accountExpired>false</accountExpired>
            <accountLocked>false</accountLocked>
            <address><address></address>
            <city>Reston</city><country>US</country><postalCode>20191</postalCode><province>VA</province>
            </address>
            <credentialsExpired>false</credentialsExpired>
            <email>admin@sysnetint.com</email>
            <enabled>true</enabled>
            <firstName>Open</firstName>
            <id>-1</id>
            <lastName>Empi</lastName>
            <password>d033e22ae348aeb5660fc2140aec35850c4da997</password>
            <passwordHint>A male kitty.</passwordHint>
            <phoneNumber></phoneNumber>
            <username>admin</username>
            <website>http://www.sysnetint.com</website>
         </userCreatedBy>
   </personIdentifiers>
   <phoneAreaCode>665</phoneAreaCode>
   <phoneNumber>2012291</phoneNumber
   ><postalCode>47630</postalCode>
   <ssn>189718658</ssn>
   <state>TX</state>
   <userChangedBy>
      <accountExpired>false</accountExpired>
      <accountLocked>false</accountLocked>
      <address><address></address>
      <city>Reston</city>
      <country>US</country>
      <postalCode>20191</postalCode>
      <province>VA</province>
      </address>
      <credentialsExpired>false</credentialsExpired>
      <email>admin@sysnetint.com</email>
      <enabled>true</enabled>
      <firstName>Open</firstName><id>-1</id>
      <lastName>Empi</lastName>
      <password>d033e22ae348aeb5660fc2140aec35850c4da997</password>
      <passwordHint>A male kitty.</passwordHint>
      <phoneNumber></phoneNumber>
      <username>admin</username>
      <website>http://www.sysnetint.com</website>
   </userChangedBy>
   <userCreatedBy>
      <accountExpired>false</accountExpired>
      <accountLocked>false</accountLocked>
      <address><address></address>
      <city>Reston</city>
      <country>US</country>
      <postalCode>20191</postalCode>
      <province>VA</province>
      </address>
      <credentialsExpired>false</credentialsExpired>
      <email>admin@sysnetint.com</email>
      <enabled>true</enabled>
      <firstName>Open</firstName>
      <id>-1</id>
      <lastName>Empi</lastName>
      <password>d033e22ae348aeb5660fc2140aec35850c4da997</password>
      <passwordHint>A male kitty.</passwordHint>
      <phoneNumber></phoneNumber>
      <username>admin</username>
      <website>http://www.sysnetint.com</website></userCreatedBy>
</person>
Â