@Test public void testServiceList_ExceptionRollsback() throws Exception { createDatabase(); JdbcServiceList service = createServiceCollection(); DatabaseConnection c = createJdbcConnection(); c.setAutoCommit(false); c.setDebugMode(true); service.setConnection(c); AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(); String oldName = Thread.currentThread().getName(); Thread.currentThread().setName("testServiceList_ExceptionRollsback"); try { service.add(createSequenceNumberService(null, getName(), SequenceNumberCase.DEFAULT_ID)); service.add(new NullService() { @Override public void doService(AdaptrisMessage msg) throws ServiceException { throw new ServiceException("testServiceList_ExceptionRollsback throws an Exception"); } }); try { execute(service, msg); } catch (ServiceException expected) { } assertTrue(msg.getObjectHeaders().containsKey(JdbcConstants.OBJ_METADATA_DATABASE_CONNECTION_KEY)); Connection conn = (Connection) msg.getObjectHeaders().get(JdbcConstants.OBJ_METADATA_DATABASE_CONNECTION_KEY); assertTrue(conn.isClosed()); assertEquals(-1, getCurrentSequenceNumber(SequenceNumberCase.DEFAULT_ID)); } finally { Thread.currentThread().setName(oldName); } }
@Override public void setConnection(AdaptrisConnection c) { this.connection = c; }
JdbcServiceList extends ServiceList implements ConnectedService { @Override public void setConnection(AdaptrisConnection c) { this.connection = c; } }
JdbcServiceList extends ServiceList implements ConnectedService { @Override public void setConnection(AdaptrisConnection c) { this.connection = c; } JdbcServiceList();  JdbcServiceList(Collection<Service> serviceList);  JdbcServiceList(Service... services); }
JdbcServiceList extends ServiceList implements ConnectedService { @Override public void setConnection(AdaptrisConnection c) { this.connection = c; } JdbcServiceList();  JdbcServiceList(Collection<Service> serviceList);  JdbcServiceList(Service... services); @Override void prepare(); @Override AdaptrisConnection getConnection(); @Override void setConnection(AdaptrisConnection c); }
JdbcServiceList extends ServiceList implements ConnectedService { @Override public void setConnection(AdaptrisConnection c) { this.connection = c; } JdbcServiceList();  JdbcServiceList(Collection<Service> serviceList);  JdbcServiceList(Service... services); @Override void prepare(); @Override AdaptrisConnection getConnection(); @Override void setConnection(AdaptrisConnection c);  }