@Test public void testExecuteDDLUpdates() throws Exception { Module module = new Module() { @Override public void configure(Binder binder) { binder.bind(DBAccessor.class).toInstance(dbAccessor); binder.bind(OsFamily.class).toInstance(osFamily); binder.bind(EntityManager.class).toInstance(entityManager); binder.bind(Configuration.class).toInstance(configuration); } }; Capture<DBAccessor.DBColumnInfo> clusterConfigSelectedColumn = newCapture(); Capture<DBAccessor.DBColumnInfo> clusterConfigSelectedTimestampColumn = newCapture(); dbAccessor.addColumn(eq(UpgradeCatalog300.CLUSTER_CONFIG_TABLE), capture(clusterConfigSelectedColumn)); dbAccessor.addColumn(eq(UpgradeCatalog300.CLUSTER_CONFIG_TABLE), capture(clusterConfigSelectedTimestampColumn)); replay(dbAccessor, configuration); Injector injector = Guice.createInjector(module); UpgradeCatalog300 upgradeCatalog300 = injector.getInstance(UpgradeCatalog300.class); upgradeCatalog300.executeDDLUpdates(); DBAccessor.DBColumnInfo capturedSelectedColumn = clusterConfigSelectedColumn.getValue(); Assert.assertNotNull(capturedSelectedColumn); Assert.assertEquals(UpgradeCatalog300.CLUSTER_CONFIG_SELECTED_COLUMN, capturedSelectedColumn.getName()); Assert.assertEquals(Short.class, capturedSelectedColumn.getType()); DBAccessor.DBColumnInfo capturedSelectedTimestampColumn = clusterConfigSelectedTimestampColumn.getValue(); Assert.assertNotNull(capturedSelectedTimestampColumn); Assert.assertEquals(UpgradeCatalog300.CLUSTER_CONFIG_SELECTED_TIMESTAMP_COLUMN, capturedSelectedTimestampColumn.getName()); Assert.assertEquals(Long.class, capturedSelectedTimestampColumn.getType()); verify(dbAccessor); }
@Override protected void executeDDLUpdates() throws AmbariException, SQLException { updateStageTable(); updateClusterConfigurationTable(); }
UpgradeCatalog300 extends AbstractUpgradeCatalog { @Override protected void executeDDLUpdates() throws AmbariException, SQLException { updateStageTable(); updateClusterConfigurationTable(); } }
UpgradeCatalog300 extends AbstractUpgradeCatalog { @Override protected void executeDDLUpdates() throws AmbariException, SQLException { updateStageTable(); updateClusterConfigurationTable(); } @Inject  UpgradeCatalog300(Injector injector); }
UpgradeCatalog300 extends AbstractUpgradeCatalog { @Override protected void executeDDLUpdates() throws AmbariException, SQLException { updateStageTable(); updateClusterConfigurationTable(); } @Inject  UpgradeCatalog300(Injector injector); @Override String getTargetVersion(); @Override String getSourceVersion(); }
UpgradeCatalog300 extends AbstractUpgradeCatalog { @Override protected void executeDDLUpdates() throws AmbariException, SQLException { updateStageTable(); updateClusterConfigurationTable(); } @Inject  UpgradeCatalog300(Injector injector); @Override String getTargetVersion(); @Override String getSourceVersion();  }