MySQLPositionManager extends BasePositionManager<BinlogPosition> { @Override public BinlogPosition getPosition() { BinlogPosition position = super.getPosition(); if (null != position) { return position; } initPosition(); return super.getPosition(); } MySQLPositionManager(final DataSource dataSource);  MySQLPositionManager(final String position); @Override BinlogPosition getPosition();  }
@Test public void assertInitPositionByJson() { MySQLPositionManager mysqlPositionManager = new MySQLPositionManager(new BinlogPosition(LOG_FILE_NAME, LOG_POSITION).toJson().toString()); BinlogPosition actual = mysqlPositionManager.getPosition(); assertThat(actual.getFilename(), is(LOG_FILE_NAME)); assertThat(actual.getPosition(), is(LOG_POSITION)); }
@Test public void assertUpdateCurrentPosition() { MySQLPositionManager mysqlPositionManager = new MySQLPositionManager(dataSource); BinlogPosition expected = new BinlogPosition(LOG_FILE_NAME, LOG_POSITION, SERVER_ID); mysqlPositionManager.setPosition(expected); assertThat(mysqlPositionManager.getPosition(), is(expected)); }