UpgradeCatalog220 extends AbstractUpgradeCatalog { protected void executeStageDDLUpdates() throws SQLException { dbAccessor.addColumn(STAGE_TABLE, new DBAccessor.DBColumnInfo("supports_auto_skip_failure", Integer.class, 1, 0, false)); } @Inject  UpgradeCatalog220(Injector injector); @Override String getTargetVersion(); @Override String getSourceVersion(); @Transactional void bootstrapRepoVersionForHDP21(); static final String UPGRADE_PACKAGE_COL; static final String UPGRADE_TYPE_COL; static final String REPO_VERSION_TABLE; }
@Test public void testExecuteStageDDLUpdates() throws Exception { final DBAccessor dbAccessor = createNiceMock(DBAccessor.class); dbAccessor.addColumn(eq("stage"), anyObject(DBAccessor.DBColumnInfo.class)); expectLastCall().times(1); replay(dbAccessor); Module module = new Module() { @Override public void configure(Binder binder) { binder.bind(DBAccessor.class).toInstance(dbAccessor); binder.bind(OsFamily.class).toInstance(createNiceMock(OsFamily.class)); binder.bind(EntityManager.class).toInstance(entityManager); } }; Injector injector = Guice.createInjector(module); UpgradeCatalog220 upgradeCatalog220 = injector.getInstance(UpgradeCatalog220.class); upgradeCatalog220.executeStageDDLUpdates(); verify(dbAccessor); }