public void testGetPersonByIdQueryRemoteService() { System.out.println( "Transactional support for this test has rollback set to " + this.isDefaultRollback()); this.setDefaultRollback(true); try { org.openhie.openempi.service.PersonManagerService pms = Context.getPersonManagerService(); PersonUtils.createTestPersonTable(pms, TABLE_NAME, "", false, null, false, null, null); RemotePersonServiceLocator remotePersonServiceLocator = Context.getRemotePersonServiceLocator(); SecurityService securityService = remotePersonServiceLocator.getSecurityService(ipAddress); String sessionKey = securityService.authenticate("admin", "admin"); System.out.println("Obtained a session key of " + sessionKey); PersonQueryService personQueryService = remotePersonServiceLocator.getPersonQueryService(); Person p = personQueryService.getPersonById(sessionKey, TABLE_NAME, 1L); if (p != null) { System.out.println("Found person: " + p); } } catch (NamingException e) { e.printStackTrace(); } catch (ApplicationException e) { e.printStackTrace(); } }
public void testGetPersonPagedQueryRemoteService() throws ApplicationException { try { RemotePersonServiceLocator remotePersonServiceLocator = Context.getRemotePersonServiceLocator(); SecurityService securityService = remotePersonServiceLocator.getSecurityService(ipAddress); String sessionKey = securityService.authenticate("admin", "admin"); System.out.println("Obtained a session key of " + sessionKey); PersonQueryService personQueryService = remotePersonServiceLocator.getPersonQueryService(); List<Person> ps = personQueryService.getPersonsPaged(sessionKey, "testtablename", 0L, 2); if (ps != null) { for (Person p : ps) { System.out.println("Found person: " + p); } } } catch (NamingException e) { e.printStackTrace(); } }