@Test
public void testExecuteDDLUpdates() throws SQLException, AmbariException, ClassNotFoundException {

  Capture<DBAccessor.DBColumnInfo> capturedSortOrderColumnInfo = newCapture();
  Capture<DBAccessor.DBColumnInfo> capturedPermissionIDColumnInfo = newCapture();
  Capture<DBAccessor.DBColumnInfo> capturedScColumnInfo = newCapture();
  Capture<DBAccessor.DBColumnInfo> capturedScDesiredVersionColumnInfo = newCapture();
  final DBAccessor dbAccessor = createStrictMock(DBAccessor.class);
  Configuration configuration = createNiceMock(Configuration.class);
  Connection connection = createNiceMock(Connection.class);
  Statement statement = createNiceMock(Statement.class);
  ResultSet resultSet = createNiceMock(ResultSet.class);
  Capture<List<DBAccessor.DBColumnInfo>> capturedExtensionColumns = EasyMock.newCapture();
  Capture<List<DBAccessor.DBColumnInfo>> capturedExtensionLinkColumns = EasyMock.newCapture();
  Capture<List<DBAccessor.DBColumnInfo>> capturedSettingColumns = EasyMock.newCapture();
  dbAccessor.addColumn(eq("adminpermission"), capture(capturedSortOrderColumnInfo));
  dbAccessor.addColumn(eq("adminpermission"), capture(capturedPermissionIDColumnInfo));
  dbAccessor.addColumn(eq(UpgradeCatalog240.SERVICE_COMPONENT_DESIRED_STATE_TABLE), capture(capturedScColumnInfo));
  dbAccessor.addColumn(eq(UpgradeCatalog240.SERVICE_COMPONENT_DESIRED_STATE_TABLE),
      capture(capturedScDesiredVersionColumnInfo));
  dbAccessor.createTable(eq("extension"), capture(capturedExtensionColumns), eq("extension_id"));
  dbAccessor.addUniqueConstraint("extension", "UQ_extension", "extension_name", "extension_version");
  expect(dbAccessor.getConnection()).andReturn(connection);
  dbAccessor.createTable(eq("extensionlink"), capture(capturedExtensionLinkColumns), eq("link_id"));
  dbAccessor.addUniqueConstraint("extensionlink", "UQ_extension_link", "stack_id", "extension_id");
  dbAccessor.addFKConstraint("extensionlink", "FK_extensionlink_extension_id", "extension_id", "extension",
                             "extension_id", false);
  dbAccessor.addFKConstraint("extensionlink", "FK_extensionlink_stack_id", "stack_id", "stack",
                             "stack_id", false);
  expect(dbAccessor.getConnection()).andReturn(connection);
  dbAccessor.createTable(eq("setting"), capture(capturedSettingColumns), eq("id"));
  expect(configuration.getDatabaseUrl()).andReturn(Configuration.JDBC_IN_MEMORY_URL).anyTimes();
  expect(dbAccessor.getConnection()).andReturn(connection);
  expect(connection.createStatement()).andReturn(statement);
  expect(statement.executeQuery(anyObject(String.class))).andReturn(resultSet);
  Capture<DBAccessor.DBColumnInfo> repoVersionRepoTypeColumnCapture = newCapture();
  Capture<DBAccessor.DBColumnInfo> repoVersionUrlColumnCapture = newCapture();
  Capture<DBAccessor.DBColumnInfo> repoVersionXmlColumnCapture = newCapture();
  Capture<DBAccessor.DBColumnInfo> repoVersionXsdColumnCapture = newCapture();
  Capture<DBAccessor.DBColumnInfo> repoVersionParentIdColumnCapture = newCapture();
  dbAccessor.addColumn(eq("repo_version"), capture(repoVersionRepoTypeColumnCapture));
  dbAccessor.addColumn(eq("repo_version"), capture(repoVersionUrlColumnCapture));
  dbAccessor.addColumn(eq("repo_version"), capture(repoVersionXmlColumnCapture));
  dbAccessor.addColumn(eq("repo_version"), capture(repoVersionXsdColumnCapture));
  dbAccessor.addColumn(eq("repo_version"), capture(repoVersionParentIdColumnCapture));
  // skip all of the drama of the servicecomponentdesiredstate table for now
  expect(dbAccessor.tableHasPrimaryKey("servicecomponentdesiredstate", "id")).andReturn(true);
  Capture<List<DBAccessor.DBColumnInfo>> capturedHistoryColumns = EasyMock.newCapture();
  dbAccessor.createTable(eq("servicecomponent_history"), capture(capturedHistoryColumns),
          eq((String[]) null));
  dbAccessor.addPKConstraint("servicecomponent_history", "PK_sc_history", "id");
  dbAccessor.addFKConstraint("servicecomponent_history", "FK_sc_history_component_id",
      "component_id", "servicecomponentdesiredstate", "id", false);
  dbAccessor.addFKConstraint("servicecomponent_history", "FK_sc_history_upgrade_id", "upgrade_id",
      "upgrade", "upgrade_id", false);
  dbAccessor.addFKConstraint("servicecomponent_history", "FK_sc_history_from_stack_id",
          "from_stack_id", "stack", "stack_id", false);
  dbAccessor.addFKConstraint("servicecomponent_history", "FK_sc_history_to_stack_id",
          "to_stack_id", "stack", "stack_id", false);
  expect(dbAccessor.getConnection()).andReturn(connection);
  expect(connection.createStatement()).andReturn(statement);
  expect(statement.executeQuery(anyObject(String.class))).andReturn(resultSet);
  Capture<DBAccessor.DBColumnInfo> capturedClusterUpgradeColumnInfo = newCapture();
  dbAccessor.addColumn(eq(UpgradeCatalog240.CLUSTER_TABLE), capture(capturedClusterUpgradeColumnInfo));
  dbAccessor.addFKConstraint(UpgradeCatalog240.CLUSTER_TABLE, "FK_clusters_upgrade_id",
          UpgradeCatalog240.CLUSTER_UPGRADE_ID_COLUMN, UpgradeCatalog240.UPGRADE_TABLE, "upgrade_id", false);
  Capture<DBAccessor.DBColumnInfo> capturedHelpURLColumnInfo = newCapture();
  Capture<DBAccessor.DBColumnInfo> capturedRepeatToleranceColumnInfo = newCapture();
  Capture<DBAccessor.DBColumnInfo> capturedRepeatToleranceEnabledColumnInfo = newCapture();
  Capture<DBAccessor.DBColumnInfo> capturedOccurrencesColumnInfo = newCapture();
  Capture<DBAccessor.DBColumnInfo> capturedFirmnessColumnInfo = newCapture();
  Capture<DBAccessor.DBColumnInfo> capturedTargetEnabledColumnInfo = newCapture();
  dbAccessor.addColumn(eq(UpgradeCatalog240.ALERT_DEFINITION_TABLE), capture(capturedHelpURLColumnInfo));
  dbAccessor.addColumn(eq(UpgradeCatalog240.ALERT_DEFINITION_TABLE), capture(capturedRepeatToleranceColumnInfo));
  dbAccessor.addColumn(eq(UpgradeCatalog240.ALERT_DEFINITION_TABLE), capture(capturedRepeatToleranceEnabledColumnInfo));
  dbAccessor.addColumn(eq(UpgradeCatalog240.ALERT_CURRENT_TABLE), capture(capturedOccurrencesColumnInfo));
  dbAccessor.addColumn(eq(UpgradeCatalog240.ALERT_CURRENT_TABLE), capture(capturedFirmnessColumnInfo));
  dbAccessor.addColumn(eq(UpgradeCatalog240.ALERT_TARGET_TABLE), capture(capturedTargetEnabledColumnInfo));
  // Test creation of blueprint_setting table
  Capture<List<DBAccessor.DBColumnInfo>> capturedBlueprintSettingColumns = EasyMock.newCapture();
  dbAccessor.createTable(eq(UpgradeCatalog240.BLUEPRINT_SETTING_TABLE), capture(capturedBlueprintSettingColumns));
  dbAccessor.addPKConstraint(UpgradeCatalog240.BLUEPRINT_SETTING_TABLE, "PK_blueprint_setting", UpgradeCatalog240.ID);
  dbAccessor.addUniqueConstraint(UpgradeCatalog240.BLUEPRINT_SETTING_TABLE, "UQ_blueprint_setting_name",
          UpgradeCatalog240.BLUEPRINT_NAME_COL, UpgradeCatalog240.SETTING_NAME_COL);
  dbAccessor.addFKConstraint(UpgradeCatalog240.BLUEPRINT_SETTING_TABLE, "FK_blueprint_setting_name",
          UpgradeCatalog240.BLUEPRINT_NAME_COL, UpgradeCatalog240.BLUEPRINT_TABLE,
          UpgradeCatalog240.BLUEPRINT_NAME_COL, false);
  expect(dbAccessor.getConnection()).andReturn(connection);
  expect(connection.createStatement()).andReturn(statement);
  expect(statement.executeQuery(anyObject(String.class))).andReturn(resultSet);
  // Test host_role_command adds a column called original_start_time
  Capture<DBAccessor.DBColumnInfo> hostRoleCommandOriginalStartTimeColumnInfo = newCapture();
  dbAccessor.addColumn(eq(UpgradeCatalog240.HOST_ROLE_COMMAND_TABLE), capture(hostRoleCommandOriginalStartTimeColumnInfo));
  Capture<List<DBAccessor.DBColumnInfo>> capturedViewUrlColums = EasyMock.newCapture();
  dbAccessor.createTable(eq(UpgradeCatalog240.VIEWURL_TABLE), capture(capturedViewUrlColums),eq("url_id"));
  expect(dbAccessor.getConnection()).andReturn(connection);
  expect(connection.createStatement()).andReturn(statement);
  Capture<DBAccessor.DBColumnInfo> viewInstanceShortUrlInfo = newCapture();
  dbAccessor.addColumn(eq(UpgradeCatalog240.VIEWINSTANCE_TABLE), capture(viewInstanceShortUrlInfo));
  dbAccessor.addFKConstraint(UpgradeCatalog240.VIEWINSTANCE_TABLE, "FK_instance_url_id",
          UpgradeCatalog240.SHORT_URL_COLUMN, UpgradeCatalog240.VIEWURL_TABLE, "url_id", false);
  Capture<DBAccessor.DBColumnInfo> viewInstanceClusterType = newCapture();
  dbAccessor.addColumn(eq(UpgradeCatalog240.VIEWINSTANCE_TABLE), capture(viewInstanceClusterType));
  // Test remote Cluster Tables
  Capture<List<DBAccessor.DBColumnInfo>> capturedRemoteAmbariClusterColumns = EasyMock.newCapture();
  dbAccessor.createTable(eq(UpgradeCatalog240.REMOTE_AMBARI_CLUSTER_TABLE), capture(capturedRemoteAmbariClusterColumns),anyString());
  dbAccessor.addUniqueConstraint(UpgradeCatalog240.REMOTE_AMBARI_CLUSTER_TABLE , "UQ_remote_ambari_cluster" , UpgradeCatalog240.CLUSTER_NAME);
  expect(dbAccessor.getConnection()).andReturn(connection);
  expect(connection.createStatement()).andReturn(statement);
  Capture<List<DBAccessor.DBColumnInfo>> capturedRemoteClusterServiceColumns = EasyMock.newCapture();
  dbAccessor.createTable(eq(UpgradeCatalog240.REMOTE_AMBARI_CLUSTER_SERVICE_TABLE), capture(capturedRemoteClusterServiceColumns),anyString());
  dbAccessor.addFKConstraint(UpgradeCatalog240.REMOTE_AMBARI_CLUSTER_SERVICE_TABLE, "FK_remote_ambari_cluster_id",
    UpgradeCatalog240.CLUSTER_ID, UpgradeCatalog240.REMOTE_AMBARI_CLUSTER_TABLE, UpgradeCatalog240.CLUSTER_ID, false);
  expect(dbAccessor.getConnection()).andReturn(connection);
  expect(connection.createStatement()).andReturn(statement);
  // Test viewInstance update
  expect(dbAccessor.getColumnClass(UpgradeCatalog240.VIEWINSTANCE_TABLE, UpgradeCatalog240.CLUSTER_HANDLE_COLUMN)).andReturn(String.class);
  dbAccessor.addColumn(eq(UpgradeCatalog240.VIEWINSTANCE_TABLE), anyObject(DBAccessor.DBColumnInfo.class));
  expect(dbAccessor.getConnection()).andReturn(connection);
  expect(connection.createStatement()).andReturn(statement);
  dbAccessor.dropColumn(UpgradeCatalog240.VIEWINSTANCE_TABLE, UpgradeCatalog240.CLUSTER_HANDLE_COLUMN);
  Capture<DBAccessor.DBColumnInfo> capturedClusterHandleColumn = EasyMock.newCapture();
  dbAccessor.renameColumn(eq(UpgradeCatalog240.VIEWINSTANCE_TABLE), anyString(), capture(capturedClusterHandleColumn));
  Capture<DBAccessor.DBColumnInfo> requestScheduleUserIdInfo = newCapture();
  dbAccessor.addColumn(eq(UpgradeCatalog240.REQUESTSCHEDULE_TABLE), capture(requestScheduleUserIdInfo));
  Capture<DBAccessor.DBColumnInfo> provisionActionColumnInfo = newCapture();
  dbAccessor.addColumn(eq(UpgradeCatalog240.TOPOLOGY_REQUEST_TABLE), capture(provisionActionColumnInfo));
  replay(dbAccessor, configuration, connection, statement, resultSet);
  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);
      binder.bind(PasswordEncoder.class).toInstance(createNiceMock(PasswordEncoder.class));
      binder.bind(HookContextFactory.class).toInstance(createMock(HookContextFactory.class));
      binder.bind(HookService.class).toInstance(createMock(HookService.class));
    }
    };
  Injector injector = Guice.createInjector(module);
  UpgradeCatalog240 upgradeCatalog240 = injector.getInstance(UpgradeCatalog240.class);
  upgradeCatalog240.executeDDLUpdates();
  DBAccessor.DBColumnInfo columnSortOrderInfo = capturedSortOrderColumnInfo.getValue();
  Assert.assertNotNull(columnSortOrderInfo);
  Assert.assertEquals(UpgradeCatalog240.SORT_ORDER_COL, columnSortOrderInfo.getName());
  Assert.assertEquals(null, columnSortOrderInfo.getLength());
  Assert.assertEquals(Short.class, columnSortOrderInfo.getType());
  Assert.assertEquals(1, columnSortOrderInfo.getDefaultValue());
  Assert.assertEquals(false, columnSortOrderInfo.isNullable());
  DBAccessor.DBColumnInfo columnPrincipalIDInfo = capturedPermissionIDColumnInfo.getValue();
  Assert.assertNotNull(columnPrincipalIDInfo);
  Assert.assertEquals(UpgradeCatalog240.PRINCIPAL_ID_COL, columnPrincipalIDInfo.getName());
  Assert.assertEquals(null, columnPrincipalIDInfo.getLength());
  Assert.assertEquals(Long.class, columnPrincipalIDInfo.getType());
  Assert.assertEquals(null, columnPrincipalIDInfo.getDefaultValue());
  Assert.assertEquals(true, columnPrincipalIDInfo.isNullable());
  // Verify if recovery_enabled column was added to servicecomponentdesiredstate table
  DBAccessor.DBColumnInfo columnScInfo = capturedScColumnInfo.getValue();
  Assert.assertNotNull(columnScInfo);
  Assert.assertEquals(UpgradeCatalog240.RECOVERY_ENABLED_COL, columnScInfo.getName());
  Assert.assertEquals(null, columnScInfo.getLength());
  Assert.assertEquals(Short.class, columnScInfo.getType());
  Assert.assertEquals(0, columnScInfo.getDefaultValue());
  Assert.assertEquals(false, columnScInfo.isNullable());
  DBAccessor.DBColumnInfo columnScDesiredVersionInfo = capturedScDesiredVersionColumnInfo.getValue();
  Assert.assertNotNull(columnScDesiredVersionInfo);
  Assert.assertEquals(UpgradeCatalog240.DESIRED_VERSION_COLUMN_NAME, columnScDesiredVersionInfo.getName());
  Assert.assertEquals(Integer.valueOf(255), columnScDesiredVersionInfo.getLength());
  Assert.assertEquals(String.class, columnScDesiredVersionInfo.getType());
  Assert.assertEquals("UNKNOWN", columnScDesiredVersionInfo.getDefaultValue());
  Assert.assertEquals(false, columnScDesiredVersionInfo.isNullable());
  // Verify if upgrade_id column was added to clusters table
  DBAccessor.DBColumnInfo clusterUpgradeColumnInfo = capturedClusterUpgradeColumnInfo.getValue();
  Assert.assertNotNull(clusterUpgradeColumnInfo);
  Assert.assertEquals(UpgradeCatalog240.CLUSTER_UPGRADE_ID_COLUMN, clusterUpgradeColumnInfo.getName());
  Assert.assertEquals(null, clusterUpgradeColumnInfo.getLength());
  Assert.assertEquals(Long.class, clusterUpgradeColumnInfo.getType());
  Assert.assertEquals(null, clusterUpgradeColumnInfo.getDefaultValue());
  Assert.assertEquals(true, clusterUpgradeColumnInfo.isNullable());
  Map<String, Class> expectedCaptures = new HashMap<>();
  expectedCaptures.put("id", Long.class);
  expectedCaptures.put("name", String.class);
  expectedCaptures.put("setting_type", String.class);
  expectedCaptures.put("content", String.class);
  expectedCaptures.put("updated_by", String.class);
  expectedCaptures.put("update_timestamp", Long.class);
  Map<String, Class> actualCaptures = new HashMap<>();
  for(DBAccessor.DBColumnInfo settingColumnInfo : capturedSettingColumns.getValue()) {
    actualCaptures.put(settingColumnInfo.getName(), settingColumnInfo.getType());
  }
  assertEquals(expectedCaptures, actualCaptures);
  expectedCaptures = new HashMap<>();
  expectedCaptures.put("extension_id", Long.class);
  expectedCaptures.put("extension_name", String.class);
  expectedCaptures.put("extension_version", String.class);
  actualCaptures = new HashMap<>();
  for(DBAccessor.DBColumnInfo settingColumnInfo : capturedExtensionColumns.getValue()) {
    actualCaptures.put(settingColumnInfo.getName(), settingColumnInfo.getType());
  }
  assertEquals(expectedCaptures, actualCaptures);
  expectedCaptures = new HashMap<>();
  expectedCaptures.put("link_id", Long.class);
  expectedCaptures.put("stack_id", Long.class);
  expectedCaptures.put("extension_id", Long.class);
  actualCaptures = new HashMap<>();
  for(DBAccessor.DBColumnInfo settingColumnInfo : capturedExtensionLinkColumns.getValue()) {
    actualCaptures.put(settingColumnInfo.getName(), settingColumnInfo.getType());
  }
  assertEquals(expectedCaptures, actualCaptures);
  expectedCaptures = new HashMap<>();
  expectedCaptures.put("id", Long.class);
  expectedCaptures.put("component_id", Long.class);
  expectedCaptures.put("upgrade_id", Long.class);
  expectedCaptures.put("from_stack_id", Long.class);
  expectedCaptures.put("to_stack_id", Long.class);
  actualCaptures = new HashMap<>();
  for (DBAccessor.DBColumnInfo historyColumnInfo : capturedHistoryColumns.getValue()) {
    actualCaptures.put(historyColumnInfo.getName(), historyColumnInfo.getType());
  }
  DBAccessor.DBColumnInfo columnHelpURLInfo = capturedHelpURLColumnInfo.getValue();
  Assert.assertNotNull(columnHelpURLInfo);
  Assert.assertEquals(UpgradeCatalog240.HELP_URL_COLUMN, columnHelpURLInfo.getName());
  Assert.assertEquals(Integer.valueOf(512), columnHelpURLInfo.getLength());
  Assert.assertEquals(String.class, columnHelpURLInfo.getType());
  Assert.assertEquals(null, columnHelpURLInfo.getDefaultValue());
  Assert.assertEquals(true, columnHelpURLInfo.isNullable());
  DBAccessor.DBColumnInfo columnRepeatToleranceInfo = capturedRepeatToleranceColumnInfo.getValue();
  Assert.assertNotNull(columnRepeatToleranceInfo);
  Assert.assertEquals(UpgradeCatalog240.REPEAT_TOLERANCE_COLUMN, columnRepeatToleranceInfo.getName());
  Assert.assertEquals(Integer.class, columnRepeatToleranceInfo.getType());
  Assert.assertEquals(1, columnRepeatToleranceInfo.getDefaultValue());
  Assert.assertEquals(false, columnRepeatToleranceInfo.isNullable());
  DBAccessor.DBColumnInfo columnRepeatToleranceEnabledInfo = capturedRepeatToleranceEnabledColumnInfo.getValue();
  Assert.assertNotNull(columnRepeatToleranceEnabledInfo);
  Assert.assertEquals(UpgradeCatalog240.REPEAT_TOLERANCE_ENABLED_COLUMN, columnRepeatToleranceEnabledInfo.getName());
  Assert.assertEquals(Short.class, columnRepeatToleranceEnabledInfo.getType());
  Assert.assertEquals(0, columnRepeatToleranceEnabledInfo.getDefaultValue());
  Assert.assertEquals(false, columnRepeatToleranceEnabledInfo.isNullable());
  DBAccessor.DBColumnInfo columnOccurrencesInfo = capturedOccurrencesColumnInfo.getValue();
  Assert.assertNotNull(columnOccurrencesInfo);
  Assert.assertEquals(UpgradeCatalog240.ALERT_CURRENT_OCCURRENCES_COLUMN, columnOccurrencesInfo.getName());
  Assert.assertEquals(Long.class, columnOccurrencesInfo.getType());
  Assert.assertEquals(1, columnOccurrencesInfo.getDefaultValue());
  Assert.assertEquals(false, columnOccurrencesInfo.isNullable());
  DBAccessor.DBColumnInfo columnFirmnessInfo = capturedFirmnessColumnInfo.getValue();
  Assert.assertNotNull(columnFirmnessInfo);
  Assert.assertEquals(UpgradeCatalog240.ALERT_CURRENT_FIRMNESS_COLUMN, columnFirmnessInfo.getName());
  Assert.assertEquals(String.class, columnFirmnessInfo.getType());
  Assert.assertEquals(AlertFirmness.HARD.name(), columnFirmnessInfo.getDefaultValue());
  Assert.assertEquals(false, columnFirmnessInfo.isNullable());
  DBAccessor.DBColumnInfo targetEnabledColumnInfo = capturedTargetEnabledColumnInfo.getValue();
  Assert.assertNotNull(targetEnabledColumnInfo);
  Assert.assertEquals(UpgradeCatalog240.ALERT_TARGET_ENABLED_COLUMN, targetEnabledColumnInfo.getName());
  Assert.assertEquals(Short.class, targetEnabledColumnInfo.getType());
  Assert.assertEquals(1, targetEnabledColumnInfo.getDefaultValue());
  Assert.assertEquals(false, targetEnabledColumnInfo.isNullable());
  assertEquals(expectedCaptures, actualCaptures);
  // Verify blueprint_setting columns
  expectedCaptures = new HashMap<>();
  expectedCaptures.put(UpgradeCatalog240.ID, Long.class);
  expectedCaptures.put(UpgradeCatalog240.BLUEPRINT_NAME_COL, String.class);
  expectedCaptures.put(UpgradeCatalog240.SETTING_NAME_COL, String.class);
  expectedCaptures.put(UpgradeCatalog240.SETTING_DATA_COL, char[].class);
  actualCaptures = new HashMap<>();
  for(DBAccessor.DBColumnInfo blueprintSettingsColumnInfo : capturedBlueprintSettingColumns.getValue()) {
    actualCaptures.put(blueprintSettingsColumnInfo.getName(), blueprintSettingsColumnInfo.getType());
  }
  assertEquals(expectedCaptures, actualCaptures);
  // Verify host_role_command column
  DBAccessor.DBColumnInfo originalStartTimeInfo = hostRoleCommandOriginalStartTimeColumnInfo.getValue();
  Assert.assertNotNull(originalStartTimeInfo);
  Assert.assertEquals("original_start_time", originalStartTimeInfo.getName());
  Assert.assertEquals(Long.class, originalStartTimeInfo.getType());
  Assert.assertEquals(-1L, originalStartTimeInfo.getDefaultValue());
  DBAccessor.DBColumnInfo viewInstanceEntityUrlColInfoValue = viewInstanceShortUrlInfo.getValue();
  Assert.assertNotNull(viewInstanceEntityUrlColInfoValue);
  Assert.assertEquals("short_url", viewInstanceEntityUrlColInfoValue.getName());
  Assert.assertEquals(Long.class, viewInstanceEntityUrlColInfoValue.getType());
  List<DBAccessor.DBColumnInfo> capturedViewUrlColumsValue = capturedViewUrlColums.getValue();
  Assert.assertNotNull(capturedViewUrlColumsValue);
  Assert.assertEquals(3, capturedViewUrlColumsValue.size());
  // Verify cluster_type column
  DBAccessor.DBColumnInfo viewInstanceEntityClusterTypeValue = viewInstanceClusterType.getValue();
  Assert.assertNotNull(viewInstanceClusterType);
  Assert.assertEquals("cluster_type", viewInstanceEntityClusterTypeValue.getName());
  Assert.assertEquals(String.class, viewInstanceEntityClusterTypeValue.getType());
  List<DBAccessor.DBColumnInfo> capturedRemoteAmbariClusterColumnsValue = capturedRemoteAmbariClusterColumns.getValue();
  Assert.assertNotNull(capturedRemoteAmbariClusterColumnsValue);
  Assert.assertEquals(5, capturedRemoteAmbariClusterColumnsValue.size());
  List<DBAccessor.DBColumnInfo> capturedRemoteClusterServiceColumnsValue = capturedRemoteClusterServiceColumns.getValue();
  Assert.assertNotNull(capturedRemoteClusterServiceColumnsValue);
  Assert.assertEquals(3, capturedRemoteClusterServiceColumnsValue.size());
  DBAccessor.DBColumnInfo clusterHandleColumn = capturedClusterHandleColumn.getValue();
  Assert.assertEquals(UpgradeCatalog240.CLUSTER_HANDLE_COLUMN, clusterHandleColumn.getName());
  Assert.assertEquals(Long.class, clusterHandleColumn.getType());
  // Verify authenticated_user_id column
  DBAccessor.DBColumnInfo requestScheduleUserIdInfoValue = requestScheduleUserIdInfo.getValue();
  Assert.assertNotNull(requestScheduleUserIdInfoValue);
  Assert.assertEquals("authenticated_user_id", requestScheduleUserIdInfoValue.getName());
  Assert.assertEquals(Integer.class, requestScheduleUserIdInfoValue.getType());
  Assert.assertEquals(null, requestScheduleUserIdInfoValue.getDefaultValue());
  DBAccessor.DBColumnInfo provisionActionColumnInfoValue = provisionActionColumnInfo.getValue();
  Assert.assertNotNull(provisionActionColumnInfoValue);
  Assert.assertEquals(UpgradeCatalog240.PROVISION_ACTION_COL, provisionActionColumnInfoValue.getName());
  Assert.assertEquals(String.class, provisionActionColumnInfoValue.getType());
  Assert.assertEquals(true, provisionActionColumnInfoValue.isNullable());
  verify(dbAccessor);
}