[1240] | 1 | package gov.va.med.edp.vistalink;
|
---|
| 2 |
|
---|
| 3 | import junit.framework.TestCase;
|
---|
| 4 | import gov.va.med.edp.vistalink.VistaLinkTemplate;
|
---|
| 5 | import gov.va.med.edp.vistalink.locator.InstitutionMappingConnectionFactoryLocator;
|
---|
| 6 | import gov.va.med.edp.vistalink.VistaLinkDaoSupport;
|
---|
| 7 |
|
---|
| 8 | public class VistaLinkDaoSupportTest extends TestCase {
|
---|
| 9 |
|
---|
| 10 | public void testDefaultConstruction() {
|
---|
| 11 | VistaLinkDaoSupport dao = new VistaLinkDaoSupport();
|
---|
| 12 | dao.afterPropertiesSet();
|
---|
| 13 | assertNotNull(dao.getConnectionFactoryLocator());
|
---|
| 14 | assertNotNull(dao.getRpcTemplate());
|
---|
| 15 | assertTrue(dao.getConnectionFactoryLocator() instanceof InstitutionMappingConnectionFactoryLocator);
|
---|
| 16 | assertSame(dao.getConnectionFactoryLocator(), dao.getRpcTemplate().getConnectionFactoryLocator());
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 | public void testSetConnectionFactoryLocator() {
|
---|
| 20 | VistaLinkDaoSupport dao = new VistaLinkDaoSupport();
|
---|
| 21 | dao.setConnectionFactoryLocator(new MockConnectionFactoryLocator());
|
---|
| 22 | dao.afterPropertiesSet();
|
---|
| 23 | assertNotNull(dao.getConnectionFactoryLocator());
|
---|
| 24 | assertNotNull(dao.getRpcTemplate());
|
---|
| 25 | assertTrue(dao.getConnectionFactoryLocator() instanceof MockConnectionFactoryLocator);
|
---|
| 26 | assertSame(dao.getConnectionFactoryLocator(), dao.getRpcTemplate().getConnectionFactoryLocator());
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | public void testSetRpcTemplate() {
|
---|
| 30 | VistaLinkTemplate t = new VistaLinkTemplate(new MockConnectionFactoryLocator());
|
---|
| 31 | VistaLinkDaoSupport dao = new VistaLinkDaoSupport();
|
---|
| 32 | dao.setRpcTemplate(t);
|
---|
| 33 | dao.afterPropertiesSet();
|
---|
| 34 | assertSame(t, dao.getRpcTemplate());
|
---|
| 35 | assertSame(t.getConnectionFactoryLocator(), dao.getConnectionFactoryLocator());
|
---|
| 36 | }
|
---|
| 37 | }
|
---|