JdbcSharedStateManager extends AbstractJDBCDriver implements SharedStateManager { @Override public void stop() throws SQLException { this.liveLock.close(); this.backupLock.close(); super.stop(); } private  JdbcSharedStateManager(String holderId, long lockExpirationMillis); static JdbcSharedStateManager usingConnectionProvider(String holderId,
                                                        long locksExpirationMillis,
                                                        JDBCConnectionProvider connectionProvider,
                                                        SQLProvider provider); @Override LeaseLock liveLock(); @Override LeaseLock backupLock(); @Override UUID readNodeId(); @Override void writeNodeId(UUID nodeId); @Override UUID setup(Supplier<? extends UUID> nodeIdFactory); @Override State readState(); @Override void writeState(State state); @Override void stop(); @Override void close();  }
@Test(timeout = 10000) public void shouldStartIfTableNotExist() throws Exception { final JdbcSharedStateManager sharedStateManager = createSharedStateManager(); try { sharedStateManager.destroy(); } finally { sharedStateManager.stop(); } }
@Test(timeout = 10000) public void shouldStartIfTableExistEmpty() throws Exception { final TestJDBCDriver fakeDriver = createFakeDriver(false); fakeDriver.start(); final JdbcSharedStateManager sharedStateManager = createSharedStateManager(); sharedStateManager.stop(); try { fakeDriver.destroy(); } finally { fakeDriver.stop(); } }
@Test(timeout = 10000) public void shouldStartIfTableExistInitialized() throws Exception { final TestJDBCDriver fakeDriver = createFakeDriver(true); fakeDriver.start(); final JdbcSharedStateManager sharedStateManager = createSharedStateManager(); sharedStateManager.stop(); try { fakeDriver.destroy(); } finally { fakeDriver.stop(); } }
@Test(timeout = 10000) public void shouldStartTwoIfTableNotExist() throws Exception { final JdbcSharedStateManager liveSharedStateManager = createSharedStateManager(); final JdbcSharedStateManager backupSharedStateManager = createSharedStateManager(); backupSharedStateManager.stop(); try { liveSharedStateManager.destroy(); } finally { liveSharedStateManager.stop(); } }