@Test public void testExecuteDMLUpdates() throws Exception { Method addNewConfigurationsFromXml = AbstractUpgradeCatalog.class.getDeclaredMethod("addNewConfigurationsFromXml"); Method updateAlerts = UpgradeCatalog240.class.getDeclaredMethod("updateAlerts"); Method addManageUserPersistedDataPermission = UpgradeCatalog240.class.getDeclaredMethod("addManageUserPersistedDataPermission"); Method allowClusterOperatorToManageCredentials = UpgradeCatalog240.class.getDeclaredMethod("allowClusterOperatorToManageCredentials"); Method addSettingPermission = UpgradeCatalog240.class.getDeclaredMethod("addSettingPermission"); Method addViewOperationalLogsPermission = UpgradeCatalog240.class.getDeclaredMethod("addViewOperationalLogsPermission"); Method updateHDFSConfigs = UpgradeCatalog240.class.getDeclaredMethod("updateHDFSConfigs"); Method updateHIVEConfigs = UpgradeCatalog240.class.getDeclaredMethod("updateHIVEConfigs"); Method updateAmsConfigs = UpgradeCatalog240.class.getDeclaredMethod("updateAMSConfigs"); Method updateClusterEnv = UpgradeCatalog240.class.getDeclaredMethod("updateClusterEnv"); Method updateSequenceForView = UpgradeCatalog240.class.getDeclaredMethod("updateSequenceForView"); Method adjustHiveJobTimestamps = UpgradeCatalog240.class.getDeclaredMethod("adjustHiveJobTimestamps"); Method updateHostRoleCommandTableDML = UpgradeCatalog240.class.getDeclaredMethod("updateHostRoleCommandTableDML"); Method updateKerberosEnv = UpgradeCatalog240.class.getDeclaredMethod("updateKerberosConfigs"); Method updateYarnEnv = UpgradeCatalog240.class.getDeclaredMethod("updateYarnEnv"); Method removeHiveOozieDBConnectionConfigs = UpgradeCatalog240.class.getDeclaredMethod("removeHiveOozieDBConnectionConfigs"); Method updateClustersAndHostsVersionStateTableDML = UpgradeCatalog240.class.getDeclaredMethod("updateClustersAndHostsVersionStateTableDML"); Method removeStandardDeviationAlerts = UpgradeCatalog240.class.getDeclaredMethod("removeStandardDeviationAlerts"); Method consolidateUserRoles = UpgradeCatalog240.class.getDeclaredMethod("consolidateUserRoles"); Method updateClusterInheritedPermissionsConfig = UpgradeCatalog240.class.getDeclaredMethod("updateClusterInheritedPermissionsConfig"); Method createRolePrincipals = UpgradeCatalog240.class.getDeclaredMethod("createRolePrincipals"); Method updateHDFSWidget = UpgradeCatalog240.class.getDeclaredMethod("updateHDFSWidgetDefinition"); Method upgradeCapSchedulerView = UpgradeCatalog240.class.getDeclaredMethod("upgradeCapSchedulerView"); Method updatePhoenixConfigs = UpgradeCatalog240.class.getDeclaredMethod("updatePhoenixConfigs"); Method updateSparkConfigs = UpgradeCatalog240.class.getDeclaredMethod("updateSparkConfigs"); Method updateHBaseConfigs = UpgradeCatalog240.class.getDeclaredMethod("updateHBaseConfigs"); Method updateKerberosDescriptorArtifacts = AbstractUpgradeCatalog.class.getDeclaredMethod("updateKerberosDescriptorArtifacts"); Method updateFalconConfigs = UpgradeCatalog240.class.getDeclaredMethod("updateFalconConfigs"); Method fixAuthorizationDescriptions = UpgradeCatalog240.class.getDeclaredMethod("fixAuthorizationDescriptions"); Method removeAuthorizations = UpgradeCatalog240.class.getDeclaredMethod("removeAuthorizations"); Method addConnectionTimeoutParamForWebAndMetricAlerts = AbstractUpgradeCatalog.class.getDeclaredMethod("addConnectionTimeoutParamForWebAndMetricAlerts"); Method addSliderClientConfig = UpgradeCatalog240.class.getDeclaredMethod("addSliderClientConfig"); Method updateRequestScheduleEntityUserIds = UpgradeCatalog240.class.getDeclaredMethod("updateRequestScheduleEntityUserIds"); Method updateRecoveryConfigurationDML = UpgradeCatalog240.class.getDeclaredMethod("updateRecoveryConfigurationDML"); Method removeAtlasMetaserverAlert = UpgradeCatalog240.class.getDeclaredMethod("removeAtlasMetaserverAlert"); Method updateRangerHbasePluginProperties = UpgradeCatalog240.class.getDeclaredMethod("updateRangerHbasePluginProperties"); Method updateKAFKAConfigs = UpgradeCatalog240.class.getDeclaredMethod("updateKAFKAConfigs"); Capture<String> capturedStatements = newCapture(CaptureType.ALL); DBAccessor dbAccessor = createStrictMock(DBAccessor.class); expect(dbAccessor.executeUpdate(capture(capturedStatements))).andReturn(1).times(7); Capture<String> capturedTezViewUpdate = newCapture(); expect(dbAccessor.executeUpdate(capture(capturedTezViewUpdate))).andReturn(1).once(); Capture<String> capturedPigSmokeTestEntityUpdate = newCapture(); expect(dbAccessor.executeUpdate(capture(capturedPigSmokeTestEntityUpdate))).andReturn(1).once(); UpgradeCatalog240 upgradeCatalog240 = createMockBuilder(UpgradeCatalog240.class) .addMockedMethod(addNewConfigurationsFromXml) .addMockedMethod(updateAlerts) .addMockedMethod(addSettingPermission) .addMockedMethod(addViewOperationalLogsPermission) .addMockedMethod(addManageUserPersistedDataPermission) .addMockedMethod(allowClusterOperatorToManageCredentials) .addMockedMethod(updateHDFSConfigs) .addMockedMethod(updateHIVEConfigs) .addMockedMethod(updateAmsConfigs) .addMockedMethod(updateClusterEnv) .addMockedMethod(updateSequenceForView) .addMockedMethod(adjustHiveJobTimestamps) .addMockedMethod(updateHostRoleCommandTableDML) .addMockedMethod(updateKerberosEnv) .addMockedMethod(updateYarnEnv) .addMockedMethod(removeHiveOozieDBConnectionConfigs) .addMockedMethod(updateClustersAndHostsVersionStateTableDML) .addMockedMethod(removeStandardDeviationAlerts) .addMockedMethod(consolidateUserRoles) .addMockedMethod(updateClusterInheritedPermissionsConfig) .addMockedMethod(createRolePrincipals) .addMockedMethod(updateHDFSWidget) .addMockedMethod(upgradeCapSchedulerView) .addMockedMethod(updatePhoenixConfigs) .addMockedMethod(updateSparkConfigs) .addMockedMethod(updateKerberosDescriptorArtifacts) .addMockedMethod(updateFalconConfigs) .addMockedMethod(fixAuthorizationDescriptions) .addMockedMethod(removeAuthorizations) .addMockedMethod(addConnectionTimeoutParamForWebAndMetricAlerts) .addMockedMethod(updateHBaseConfigs) .addMockedMethod(addSliderClientConfig) .addMockedMethod(updateRequestScheduleEntityUserIds) .addMockedMethod(updateRecoveryConfigurationDML) .addMockedMethod(removeAtlasMetaserverAlert) .addMockedMethod(updateRangerHbasePluginProperties) .addMockedMethod(updateKAFKAConfigs) .createMock(); Field field = AbstractUpgradeCatalog.class.getDeclaredField("dbAccessor"); field.set(upgradeCatalog240, dbAccessor); upgradeCatalog240.addNewConfigurationsFromXml(); upgradeCatalog240.updateAlerts(); upgradeCatalog240.addSettingPermission(); upgradeCatalog240.addViewOperationalLogsPermission(); upgradeCatalog240.addManageUserPersistedDataPermission(); upgradeCatalog240.allowClusterOperatorToManageCredentials(); upgradeCatalog240.updateHDFSConfigs(); upgradeCatalog240.updateHIVEConfigs(); upgradeCatalog240.updateAMSConfigs(); upgradeCatalog240.updateClusterEnv(); upgradeCatalog240.updateSequenceForView(); upgradeCatalog240.updateHostRoleCommandTableDML(); upgradeCatalog240.updateKerberosConfigs(); upgradeCatalog240.updateYarnEnv(); upgradeCatalog240.removeHiveOozieDBConnectionConfigs(); upgradeCatalog240.updateClustersAndHostsVersionStateTableDML(); upgradeCatalog240.removeStandardDeviationAlerts(); upgradeCatalog240.consolidateUserRoles(); upgradeCatalog240.createRolePrincipals(); upgradeCatalog240.updateClusterInheritedPermissionsConfig(); upgradeCatalog240.updateHDFSWidgetDefinition(); upgradeCatalog240.upgradeCapSchedulerView(); upgradeCatalog240.updatePhoenixConfigs(); upgradeCatalog240.updateSparkConfigs(); upgradeCatalog240.updateKerberosDescriptorArtifacts(); upgradeCatalog240.updateFalconConfigs(); upgradeCatalog240.fixAuthorizationDescriptions(); upgradeCatalog240.removeAuthorizations(); upgradeCatalog240.addConnectionTimeoutParamForWebAndMetricAlerts(); upgradeCatalog240.updateHBaseConfigs(); upgradeCatalog240.addSliderClientConfig(); upgradeCatalog240.updateRequestScheduleEntityUserIds(); upgradeCatalog240.updateRecoveryConfigurationDML(); upgradeCatalog240.removeAtlasMetaserverAlert(); upgradeCatalog240.updateRangerHbasePluginProperties(); upgradeCatalog240.adjustHiveJobTimestamps(); upgradeCatalog240.updateKAFKAConfigs(); replay(upgradeCatalog240, dbAccessor); upgradeCatalog240.executeDMLUpdates(); verify(upgradeCatalog240, dbAccessor); List<String> statements = capturedStatements.getValues(); Assert.assertNotNull(statements); Assert.assertEquals(7, statements.size()); Assert.assertTrue(statements.contains("UPDATE adminpermission SET sort_order=1 WHERE permission_name='AMBARI.ADMINISTRATOR'")); Assert.assertTrue(statements.contains("UPDATE adminpermission SET sort_order=2 WHERE permission_name='CLUSTER.ADMINISTRATOR'")); Assert.assertTrue(statements.contains("UPDATE adminpermission SET sort_order=3 WHERE permission_name='CLUSTER.OPERATOR'")); Assert.assertTrue(statements.contains("UPDATE adminpermission SET sort_order=4 WHERE permission_name='SERVICE.ADMINISTRATOR'")); Assert.assertTrue(statements.contains("UPDATE adminpermission SET sort_order=5 WHERE permission_name='SERVICE.OPERATOR'")); Assert.assertTrue(statements.contains("UPDATE adminpermission SET sort_order=6 WHERE permission_name='CLUSTER.USER'")); Assert.assertTrue(statements.contains("UPDATE adminpermission SET sort_order=7 WHERE permission_name='VIEW.USER'")); Assert.assertNotNull(capturedTezViewUpdate.getValue()); Assert.assertEquals("UPDATE viewinstanceproperty SET name = 'yarn.ats.url' where name = 'yarn.timeline-server.url'", capturedTezViewUpdate.getValue()); Assert.assertNotNull(capturedPigSmokeTestEntityUpdate.getValue()); Assert.assertEquals("UPDATE viewentity " + "SET class_name = 'org.apache.ambari.view.pig.persistence.SmokeTestEntity' " + "WHERE class_name = 'org.apache.ambari.view.pig.persistence.DataStoreStorage$SmokeTestEntity'", capturedPigSmokeTestEntityUpdate.getValue()); }
@Override protected void executeDMLUpdates() throws AmbariException, SQLException { addNewConfigurationsFromXml(); updateAlerts(); setRoleSortOrder(); addSettingPermission(); addViewOperationalLogsPermission(); addManageUserPersistedDataPermission(); allowClusterOperatorToManageCredentials(); updateHDFSConfigs(); updateKAFKAConfigs(); updateHIVEConfigs(); updateAMSConfigs(); updateClusterEnv(); updateSequenceForView(); updateHostRoleCommandTableDML(); updateKerberosConfigs(); updateYarnEnv(); updatePhoenixConfigs(); updateSparkConfigs(); updateHBaseConfigs(); updateFalconConfigs(); updateKerberosDescriptorArtifacts(); removeHiveOozieDBConnectionConfigs(); updateClustersAndHostsVersionStateTableDML(); removeStandardDeviationAlerts(); removeAtlasMetaserverAlert(); updateClusterInheritedPermissionsConfig(); consolidateUserRoles(); createRolePrincipals(); updateHDFSWidgetDefinition(); updateTezViewProperty(); upgradeCapSchedulerView(); fixAuthorizationDescriptions(); removeAuthorizations(); addConnectionTimeoutParamForWebAndMetricAlerts(); addSliderClientConfig(); updateRequestScheduleEntityUserIds(); updateRecoveryConfigurationDML(); updatePigSmokeTestEntityClass(); updateRangerHbasePluginProperties(); adjustHiveJobTimestamps(); }
UpgradeCatalog240 extends AbstractUpgradeCatalog { @Override protected void executeDMLUpdates() throws AmbariException, SQLException { addNewConfigurationsFromXml(); updateAlerts(); setRoleSortOrder(); addSettingPermission(); addViewOperationalLogsPermission(); addManageUserPersistedDataPermission(); allowClusterOperatorToManageCredentials(); updateHDFSConfigs(); updateKAFKAConfigs(); updateHIVEConfigs(); updateAMSConfigs(); updateClusterEnv(); updateSequenceForView(); updateHostRoleCommandTableDML(); updateKerberosConfigs(); updateYarnEnv(); updatePhoenixConfigs(); updateSparkConfigs(); updateHBaseConfigs(); updateFalconConfigs(); updateKerberosDescriptorArtifacts(); removeHiveOozieDBConnectionConfigs(); updateClustersAndHostsVersionStateTableDML(); removeStandardDeviationAlerts(); removeAtlasMetaserverAlert(); updateClusterInheritedPermissionsConfig(); consolidateUserRoles(); createRolePrincipals(); updateHDFSWidgetDefinition(); updateTezViewProperty(); upgradeCapSchedulerView(); fixAuthorizationDescriptions(); removeAuthorizations(); addConnectionTimeoutParamForWebAndMetricAlerts(); addSliderClientConfig(); updateRequestScheduleEntityUserIds(); updateRecoveryConfigurationDML(); updatePigSmokeTestEntityClass(); updateRangerHbasePluginProperties(); adjustHiveJobTimestamps(); } }
UpgradeCatalog240 extends AbstractUpgradeCatalog { @Override protected void executeDMLUpdates() throws AmbariException, SQLException { addNewConfigurationsFromXml(); updateAlerts(); setRoleSortOrder(); addSettingPermission(); addViewOperationalLogsPermission(); addManageUserPersistedDataPermission(); allowClusterOperatorToManageCredentials(); updateHDFSConfigs(); updateKAFKAConfigs(); updateHIVEConfigs(); updateAMSConfigs(); updateClusterEnv(); updateSequenceForView(); updateHostRoleCommandTableDML(); updateKerberosConfigs(); updateYarnEnv(); updatePhoenixConfigs(); updateSparkConfigs(); updateHBaseConfigs(); updateFalconConfigs(); updateKerberosDescriptorArtifacts(); removeHiveOozieDBConnectionConfigs(); updateClustersAndHostsVersionStateTableDML(); removeStandardDeviationAlerts(); removeAtlasMetaserverAlert(); updateClusterInheritedPermissionsConfig(); consolidateUserRoles(); createRolePrincipals(); updateHDFSWidgetDefinition(); updateTezViewProperty(); upgradeCapSchedulerView(); fixAuthorizationDescriptions(); removeAuthorizations(); addConnectionTimeoutParamForWebAndMetricAlerts(); addSliderClientConfig(); updateRequestScheduleEntityUserIds(); updateRecoveryConfigurationDML(); updatePigSmokeTestEntityClass(); updateRangerHbasePluginProperties(); adjustHiveJobTimestamps(); } @Inject  UpgradeCatalog240(Injector injector); }
UpgradeCatalog240 extends AbstractUpgradeCatalog { @Override protected void executeDMLUpdates() throws AmbariException, SQLException { addNewConfigurationsFromXml(); updateAlerts(); setRoleSortOrder(); addSettingPermission(); addViewOperationalLogsPermission(); addManageUserPersistedDataPermission(); allowClusterOperatorToManageCredentials(); updateHDFSConfigs(); updateKAFKAConfigs(); updateHIVEConfigs(); updateAMSConfigs(); updateClusterEnv(); updateSequenceForView(); updateHostRoleCommandTableDML(); updateKerberosConfigs(); updateYarnEnv(); updatePhoenixConfigs(); updateSparkConfigs(); updateHBaseConfigs(); updateFalconConfigs(); updateKerberosDescriptorArtifacts(); removeHiveOozieDBConnectionConfigs(); updateClustersAndHostsVersionStateTableDML(); removeStandardDeviationAlerts(); removeAtlasMetaserverAlert(); updateClusterInheritedPermissionsConfig(); consolidateUserRoles(); createRolePrincipals(); updateHDFSWidgetDefinition(); updateTezViewProperty(); upgradeCapSchedulerView(); fixAuthorizationDescriptions(); removeAuthorizations(); addConnectionTimeoutParamForWebAndMetricAlerts(); addSliderClientConfig(); updateRequestScheduleEntityUserIds(); updateRecoveryConfigurationDML(); updatePigSmokeTestEntityClass(); updateRangerHbasePluginProperties(); adjustHiveJobTimestamps(); } @Inject  UpgradeCatalog240(Injector injector); @Override String getTargetVersion(); @Override String getSourceVersion(); }
UpgradeCatalog240 extends AbstractUpgradeCatalog { @Override protected void executeDMLUpdates() throws AmbariException, SQLException { addNewConfigurationsFromXml(); updateAlerts(); setRoleSortOrder(); addSettingPermission(); addViewOperationalLogsPermission(); addManageUserPersistedDataPermission(); allowClusterOperatorToManageCredentials(); updateHDFSConfigs(); updateKAFKAConfigs(); updateHIVEConfigs(); updateAMSConfigs(); updateClusterEnv(); updateSequenceForView(); updateHostRoleCommandTableDML(); updateKerberosConfigs(); updateYarnEnv(); updatePhoenixConfigs(); updateSparkConfigs(); updateHBaseConfigs(); updateFalconConfigs(); updateKerberosDescriptorArtifacts(); removeHiveOozieDBConnectionConfigs(); updateClustersAndHostsVersionStateTableDML(); removeStandardDeviationAlerts(); removeAtlasMetaserverAlert(); updateClusterInheritedPermissionsConfig(); consolidateUserRoles(); createRolePrincipals(); updateHDFSWidgetDefinition(); updateTezViewProperty(); upgradeCapSchedulerView(); fixAuthorizationDescriptions(); removeAuthorizations(); addConnectionTimeoutParamForWebAndMetricAlerts(); addSliderClientConfig(); updateRequestScheduleEntityUserIds(); updateRecoveryConfigurationDML(); updatePigSmokeTestEntityClass(); updateRangerHbasePluginProperties(); adjustHiveJobTimestamps(); } @Inject  UpgradeCatalog240(Injector injector); @Override String getTargetVersion(); @Override String getSourceVersion(); static final String DESIRED_VERSION_COLUMN_NAME; static final String BLUEPRINT_SETTING_TABLE; static final String BLUEPRINT_NAME_COL; static final String SETTING_NAME_COL; static final String SETTING_DATA_COL; static final String ID; static final String BLUEPRINT_TABLE; static final String VIEWINSTANCE_TABLE; static final String SHORT_URL_COLUMN; static final String CLUSTER_HANDLE_COLUMN; static final String REQUESTSCHEDULE_TABLE; static final String AUTHENTICATED_USER_ID_COLUMN; static final String TIMELINE_METRICS_SINK_COLLECTION_PERIOD; static final String ONE_DIR_PER_PARITION_PROPERTY; static final String VIEWURL_TABLE; static final String URL_ID_COLUMN; static final String PRECISION_TABLE_TTL_PROPERTY; static final String CLUSTER_SECOND_TABLE_TTL_PROPERTY; static final String CLUSTER_TYPE_COLUMN; static final String REMOTE_AMBARI_CLUSTER_TABLE; static final String REMOTE_AMBARI_CLUSTER_SERVICE_TABLE; static final String CLUSTER_ID; static final String SERVICE_NAME; static final String CLUSTER_NAME; }