ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [31/50] [abbrv] ambari git commit: Merge branch 'trunk' into branch-feature-AMBARI-12556
Date Thu, 27 Apr 2017 20:20:18 GMT
Merge branch 'trunk' into branch-feature-AMBARI-12556


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/353a076c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/353a076c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/353a076c

Branch: refs/heads/trunk
Commit: 353a076c8bf65a911f29b1f908e60d011459ffe0
Parents: 0c3478b cb030a4
Author: Nate Cole <ncole@hortonworks.com>
Authored: Fri Feb 24 09:18:46 2017 -0500
Committer: Nate Cole <ncole@hortonworks.com>
Committed: Fri Feb 24 09:18:46 2017 -0500

----------------------------------------------------------------------
 .../main/resources/ui/admin-web/app/index.html  |   2 +-
 ambari-agent/etc/init.d/ambari-agent            |   1 +
 .../org/apache/ambari/logfeeder/LogFeeder.java  |  13 +-
 .../ambari/logfeeder/common/ConfigBlock.java    |   2 +-
 .../apache/ambari/logfeeder/filter/Filter.java  |   4 +-
 .../ambari/logfeeder/input/InputSimulate.java   |  31 +-
 .../handler/UploadConfigurationHandler.java     |  65 +-
 ambari-metrics/ambari-metrics-assembly/pom.xml  |  12 +
 .../src/main/assembly/collector-windows.xml     |   1 +
 .../src/main/assembly/collector.xml             |   1 +
 .../timeline/AbstractTimelineMetricsSink.java   |  22 +-
 .../timeline/HadoopTimelineMetricsSink.java     |  11 +-
 .../ambari-metrics-kafka-sink/pom.xml           |   7 +-
 .../kafka/KafkaTimelineMetricsReporter.java     |   9 +-
 .../conf/unix/amshbase_metrics_whitelist        | 162 +++++
 .../conf/windows/amshbase_metrics_whitelist     | 162 +++++
 .../ambari-metrics-timelineservice/pom.xml      |   5 +
 .../timeline/HBaseTimelineMetricStore.java      |   2 +-
 .../timeline/TimelineMetricConfiguration.java   |  39 ++
 .../metrics/timeline/TimelineMetricsFilter.java |  45 +-
 .../timeline/TimelineMetricsFilterTest.java     |  59 +-
 .../timeline/discovery/TestMetadataManager.java |  15 +-
 ambari-server/sbin/ambari-server                |   2 +-
 .../checks/DatabaseConsistencyCheckHelper.java  |  79 +--
 .../internal/ServiceResourceProvider.java       |   2 +-
 .../internal/UpgradeResourceProvider.java       |  25 +-
 .../controller/utilities/DatabaseChecker.java   | 100 +--
 .../ambari/server/orm/dao/ClusterDAO.java       | 136 +---
 .../orm/entities/ClusterConfigEntity.java       | 125 ++--
 .../entities/ClusterConfigMappingEntity.java    | 207 -------
 .../entities/ClusterConfigMappingEntityPK.java  |  83 ---
 .../server/orm/entities/ClusterEntity.java      |  13 +-
 .../orm/entities/ServiceConfigEntity.java       |   2 +-
 .../orm/helpers/dbms/GenericDbmsHelper.java     |   2 +-
 .../kerberos/FinalizeKerberosServerAction.java  |  14 +-
 .../kerberos/KerberosServerAction.java          |   2 +-
 .../ambari/server/state/ConfigHelper.java       |  80 ++-
 .../ambari/server/state/DesiredConfig.java      |  20 -
 .../ambari/server/state/RepositoryInfo.java     |  20 +-
 .../apache/ambari/server/state/ServiceImpl.java |  33 +-
 .../server/state/cluster/ClusterImpl.java       | 238 ++-----
 .../ambari/server/state/host/HostImpl.java      |  13 +-
 .../stack/upgrade/RepositoryVersionHelper.java  |   2 +
 .../ambari/server/topology/TopologyManager.java |   3 +
 .../server/upgrade/UpgradeCatalog300.java       |  92 ++-
 .../main/resources/Ambari-DDL-Derby-CREATE.sql  |  12 +-
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  |  12 +-
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql |  12 +-
 .../resources/Ambari-DDL-Postgres-CREATE.sql    |  12 +-
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql |  12 +-
 .../resources/Ambari-DDL-SQLServer-CREATE.sql   |  12 +-
 .../HDP/grafana-logsearch-home.json             | 600 ++++++++++++++++++
 .../package/scripts/metadata_server.py          |   5 +-
 .../ATLAS/0.1.0.2.3/package/scripts/params.py   |   1 +
 .../DRUID/0.9.2/package/scripts/params.py       |   2 +-
 .../DRUID/0.9.2/package/scripts/superset.py     |   2 +-
 .../KAFKA/0.8.1/package/scripts/kafka_broker.py |  15 +-
 .../KAFKA/0.8.1/package/scripts/params.py       |   2 +
 .../LOGSEARCH/0.5.0/package/scripts/params.py   |   9 +
 .../0.5.0/package/scripts/setup_logfeeder.py    |  43 +-
 .../0.5.0/package/scripts/setup_logsearch.py    |  35 +-
 .../0.4.0/package/scripts/setup_ranger_xml.py   |  13 +-
 .../common-services/YARN/2.1.0.2.0/metainfo.xml |   1 +
 .../common-services/YARN/3.0.0.3.0/metainfo.xml |   1 +
 .../src/main/resources/scripts/configs.sh       |   8 +-
 .../stacks/HDP/2.0.6/services/stack_advisor.py  |   1 +
 .../stacks/HDP/2.3/upgrades/config-upgrade.xml  |  57 +-
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml |  17 -
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml |  17 -
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml |  48 +-
 .../stacks/HDP/2.3/upgrades/upgrade-2.4.xml     |  15 -
 .../stacks/HDP/2.3/upgrades/upgrade-2.5.xml     |  14 -
 .../stacks/HDP/2.3/upgrades/upgrade-2.6.xml     |  19 +-
 .../stacks/HDP/2.4/upgrades/config-upgrade.xml  |  57 +-
 .../HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml |  16 -
 .../HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml |  48 +-
 .../stacks/HDP/2.4/upgrades/upgrade-2.5.xml     |  14 -
 .../stacks/HDP/2.4/upgrades/upgrade-2.6.xml     |  22 +-
 .../HIVE/configuration/hive-interactive-env.xml |   2 +-
 .../configuration/hive-interactive-site.xml     |   6 -
 .../stacks/HDP/2.5/services/stack_advisor.py    |   8 +
 .../stacks/HDP/2.5/upgrades/config-upgrade.xml  |  40 ++
 .../HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml |  32 +-
 .../stacks/HDP/2.5/upgrades/upgrade-2.6.xml     |   8 +
 .../HIVE/configuration/hive-interactive-env.xml |   2 +-
 .../configuration/hive-interactive-site.xml     |   7 +
 .../HIVE/configuration/tez-interactive-site.xml |   6 +-
 .../src/main/resources/stacks/stack_advisor.py  |  14 +-
 .../DatabaseConsistencyCheckHelperTest.java     |  56 +-
 .../server/orm/dao/ServiceConfigDAOTest.java    | 324 +++++-----
 .../FinalizeKerberosServerActionTest.java       | 206 ++++++
 .../ambari/server/state/DesiredConfigTest.java  |   2 -
 .../server/state/cluster/ClusterTest.java       | 281 ++++-----
 .../server/state/cluster/ClustersTest.java      |   7 +-
 .../ambari/server/state/host/HostTest.java      |  10 +-
 .../upgrade/RepositoryVersionHelperTest.java    |   3 +-
 .../server/upgrade/UpgradeCatalog300Test.java   | 167 ++++-
 .../stacks/2.2/common/test_stack_advisor.py     |  20 +-
 .../stacks/2.4/LOGSEARCH/test_logfeeder.py      |   6 +
 .../stacks/2.4/LOGSEARCH/test_logsearch.py      |   6 +
 .../test/python/stacks/2.4/configs/default.json |   1 +
 .../stacks/2.5/common/test_stack_advisor.py     |  21 +-
 .../test/resources/stacks/old_stack_advisor.py  |  12 +-
 ambari-web/app/assets/data/clusters/info.json   |  11 +
 ambari-web/app/assets/img/ambari-logo.png       | Bin 0 -> 2779 bytes
 ambari-web/app/assets/img/logo-white.png        | Bin 4538 -> 0 bytes
 ambari-web/app/config.js                        |   6 +-
 .../main/admin/kerberos/step1_controller.js     |   2 +-
 .../main/admin/kerberos/step2_controller.js     |  10 +-
 .../main/admin/kerberos/step4_controller.js     |   2 +
 .../main/admin/kerberos/step5_controller.js     |   4 +
 .../main/admin/stack_and_upgrade_controller.js  |   1 -
 .../main/alert_definitions_controller.js        |  14 +-
 .../main/alerts/alert_instances_controller.js   | 151 -----
 .../controllers/main/service/info/summary.js    |  12 +-
 .../wizard/step7/assign_master_controller.js    |  13 +-
 .../app/controllers/wizard/step9_controller.js  |   7 +-
 ambari-web/app/messages.js                      |   6 +
 .../wizard/wizardProgressPageController.js      |   2 +
 ambari-web/app/routes/add_kerberos_routes.js    |  50 +-
 ambari-web/app/routes/main.js                   |   8 +-
 ambari-web/app/styles/application.less          |  14 +-
 ambari-web/app/styles/common.less               |  13 +-
 .../app/styles/enhanced_service_dashboard.less  |   1 -
 ambari-web/app/styles/modal_popups.less         |  11 +-
 ambari-web/app/styles/stack_versions.less       |   2 +-
 .../app/styles/theme/bootstrap-ambari.css       | 619 ++++++++++++++++++-
 ambari-web/app/styles/top-nav.less              | 204 ++----
 ambari-web/app/styles/wizard.less               |  14 +-
 ambari-web/app/templates/application.hbs        | 226 ++++---
 .../common/assign_master_components.hbs         |  33 +-
 .../app/templates/common/button_progress.hbs    |  29 +
 .../configs/propertyDependence_footer.hbs       |  25 -
 ambari-web/app/templates/common/modal_popup.hbs |  26 +-
 ambari-web/app/templates/common/progress.hbs    |  18 +-
 .../app/templates/main/admin/kerberos/step1.hbs |   2 +-
 .../app/templates/main/admin/kerberos/step2.hbs |   5 +-
 .../app/templates/main/admin/kerberos/step3.hbs |   4 +-
 .../app/templates/main/admin/kerberos/step4.hbs |   5 +-
 .../app/templates/main/admin/kerberos/step5.hbs |  13 +-
 .../main/alerts/alert_notifications_popup.hbs   |  69 +++
 ambari-web/app/templates/main/dashboard.hbs     |  26 +-
 ambari-web/app/templates/main/menu.hbs          |  23 -
 ambari-web/app/templates/main/menu_item.hbs     |  50 --
 ambari-web/app/templates/main/service.hbs       |   6 +-
 .../main/service/all_services_actions.hbs       | 100 ++-
 .../main/service/info/save_popup_footer.hbs     |  13 +-
 .../app/templates/main/service/menu_item.hbs    |   4 +-
 .../app/templates/main/side-menu-item.hbs       |  53 ++
 .../step3/step3_host_warning_popup_footer.hbs   |  14 +-
 ambari-web/app/utils/date/date.js               |  26 +-
 ambari-web/app/utils/ember_reopen.js            |   4 +
 ambari-web/app/views.js                         |   3 +
 ambari-web/app/views/application.js             | 125 +++-
 .../common/assign_master_components_view.js     |   6 +-
 .../common/buttons/button_progress_view.js      |  77 +++
 .../app/views/common/buttons/wizard_buttons.js  |  36 ++
 .../configs/service_configs_by_category_view.js |  15 +-
 .../views/main/admin/kerberos/disable_view.js   |   2 +-
 .../main/alerts/alert_instances_popup_view.js   | 190 ++++++
 .../dashboard/widgets/uptime_text_widget.js     |   9 +-
 ambari-web/app/views/main/menu.js               | 179 ++++--
 .../views/main/service/all_services_actions.js  |   2 +
 ambari-web/app/views/main/service/menu.js       | 104 +---
 .../app/views/main/service/services/yarn.js     |   1 +
 .../views/wizard/step7/assign_master_view.js    |   6 +-
 ambari-web/brunch-config.js                     |   3 +-
 .../admin/kerberos/step1_controller_test.js     |   6 +-
 .../admin/kerberos/step2_controller_test.js     |   2 +-
 .../alerts/alert_instances_controller_test.js   |  33 -
 ambari-web/test/init_test.js                    |  42 ++
 ambari-web/test/mappers/service_mapper_test.js  |   2 +-
 ambari-web/test/utils/date/date_test.js         |  30 +-
 .../stack_upgrade/upgrade_history_view_test.js  |   8 +-
 .../widgets/hbase_master_uptime_test.js         |   4 +-
 .../dashboard/widgets/namenode_uptime_test.js   |   4 +-
 .../widgets/resource_manager_uptime_test.js     |   4 +-
 .../widgets/uptime_text_widget_test.js          |   4 +-
 ambari-web/test/views/main/menu_test.js         |   2 +-
 .../vendor/scripts/theme/bootstrap-ambari.js    | 204 ++++++
 .../stacks/HDF/2.0/services/stack_advisor.py    |   2 +-
 .../ambari/view/commons/hdfs/UploadService.java |   2 +-
 .../resources/ui/app/adapters/application.js    |   6 +
 .../resources/ui/app/components/upload-file.js  |  19 +-
 .../ambari/view/hive20/ConnectionSystem.java    |  27 -
 .../hive20/actor/DatabaseChangeNotifier.java    | 168 -----
 .../view/hive20/actor/DatabaseManager.java      | 313 ----------
 .../ambari/view/hive20/actor/JdbcConnector.java |   5 +-
 .../ambari/view/hive20/actor/LogAggregator.java |   4 +-
 .../view/hive20/actor/MetaDataManager.java      | 137 ----
 .../view/hive20/actor/MetaDataRetriever.java    | 173 ------
 .../view/hive20/actor/TableChangeNotifier.java  |  95 ---
 .../ambari/view/hive20/actor/message/Ping.java  |  50 --
 .../ambari/view/hive20/client/DDLDelegator.java |   7 +-
 .../view/hive20/client/DDLDelegatorImpl.java    |  52 +-
 .../view/hive20/internal/dto/TableInfo.java     |  12 +-
 .../view/hive20/internal/dto/TableResponse.java |   9 -
 .../view/hive20/resources/browser/DDLProxy.java |  67 +-
 .../resources/browser/HiveBrowserService.java   | 259 --------
 .../hive20/resources/system/SystemService.java  |  28 +-
 .../utils/MetaDataManagerEventSubmitter.java    |  43 --
 .../src/main/resources/ui/app/adapters/ping.js  |  35 --
 .../main/resources/ui/app/adapters/ranger.js    |  27 +
 .../resources/ui/app/components/list-filter.js  |   5 +-
 .../ui/app/components/table-statistics.js       |   5 +-
 .../ui/app/components/visual-explain.js         |   2 +
 .../resources/ui/app/configs/result-tabs.js     |   6 +-
 .../src/main/resources/ui/app/models/table.js   |   9 +-
 .../main/resources/ui/app/models/worksheet.js   |   3 +-
 .../main/resources/ui/app/routes/application.js |   5 -
 .../routes/databases/database/tables/table.js   |   2 +
 .../databases/database/tables/table/auth.js     |   2 +-
 .../databases/database/tables/table/edit.js     |   2 +-
 .../main/resources/ui/app/routes/queries/new.js |   1 -
 .../resources/ui/app/routes/queries/query.js    | 126 +++-
 .../resources/ui/app/routes/savedqueries.js     |   3 -
 .../resources/ui/app/serializers/database.js    |  25 +
 .../main/resources/ui/app/serializers/table.js  |  22 +
 .../src/main/resources/ui/app/services/jobs.js  |   5 +
 .../resources/ui/app/services/keep-alive.js     |  31 -
 .../resources/ui/app/services/tez-view-info.js  |  83 +++
 .../src/main/resources/ui/app/styles/app.scss   |   9 +
 .../app/templates/components/visual-explain.hbs |   2 +-
 .../ui/app/templates/queries/query.hbs          |  17 +-
 .../ui/app/templates/queries/query/tez-ui.hbs   |   6 +-
 .../resources/ui/app/templates/savedqueries.hbs |   1 -
 .../app/utils/hive-explainer/renderer-force.js  |   2 +-
 .../ui/app/utils/hive-explainer/renderer.js     |   4 +-
 .../views/hive20/src/main/resources/view.xml    |   5 -
 .../apache/oozie/ambari/view/OozieDelegate.java |  12 +-
 .../ambari/view/OozieProxyImpersonator.java     | 381 +++++-------
 .../oozie/ambari/view/assets/AssetResource.java |  93 +--
 .../oozie/ambari/view/exception/ErrorCode.java  |  58 ++
 .../ambari/view/exception/WfmException.java     |  46 ++
 .../ambari/view/exception/WfmWebException.java  | 115 ++++
 .../WorkflowsManagerResource.java               |  36 +-
 .../ui/app/components/bundle-config.js          |   8 +-
 .../resources/ui/app/components/coord-config.js |   6 +-
 .../ui/app/components/designer-errors.js        |  49 ++
 .../ui/app/components/flow-designer.js          | 108 ++--
 .../main/resources/ui/app/components/save-wf.js |   2 +-
 .../ui/app/components/stack-trace-dialog.js     |  26 +
 .../ui/app/components/workflow-action-editor.js |  40 +-
 .../ui/app/domain/cytoscape-flow-renderer.js    |   2 +-
 .../resources/ui/app/domain/cytoscape-style.js  |   8 +
 .../main/resources/ui/app/domain/workflow.js    |   9 +-
 .../src/main/resources/ui/app/styles/app.less   |  18 +-
 .../app/templates/components/bundle-config.hbs  |   4 +-
 .../app/templates/components/coord-config.hbs   |   2 +-
 .../templates/components/designer-errors.hbs    |  17 +
 .../app/templates/components/flow-designer.hbs  |  20 +-
 .../ui/app/templates/components/save-wf.hbs     |   4 +-
 .../templates/components/stack-trace-dialog.hbs |  33 +
 .../components/workflow-action-editor.hbs       |   5 +-
 .../components/stack-trace-dialog-test.js       |  40 ++
 255 files changed, 5951 insertions(+), 4532 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/353a076c/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/353a076c/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java
----------------------------------------------------------------------
diff --cc ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java
index 483362b,d9b9b57..d527290
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java
@@@ -106,8 -110,8 +113,9 @@@ public class UpgradeCatalog300 extends 
     */
    @Override
    protected void executeDDLUpdates() throws AmbariException, SQLException {
 +    addServiceComponentColumn();
      updateStageTable();
+     updateClusterConfigurationTable();
    }
  
    protected void updateStageTable() throws SQLException {

http://git-wip-us.apache.org/repos/asf/ambari/blob/353a076c/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/353a076c/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/353a076c/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/353a076c/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/353a076c/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/353a076c/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/353a076c/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java
----------------------------------------------------------------------
diff --cc ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java
index 3c933d9,a44c2b3..e0d07b4
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java
@@@ -53,25 -122,86 +121,96 @@@ public class UpgradeCatalog300Test 
  
    @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));
+ 
++    // component table
++    Capture<DBAccessor.DBColumnInfo> componentStateColumn = newCapture();
++    dbAccessor.addColumn(eq(UpgradeCatalog250.COMPONENT_TABLE), capture(componentStateColumn));
++
+     replay(dbAccessor, configuration);
+ 
+     Injector injector = Guice.createInjector(module);
+     UpgradeCatalog300 upgradeCatalog300 = injector.getInstance(UpgradeCatalog300.class);
+     upgradeCatalog300.executeDDLUpdates();
  
-     Method updateStageTable = UpgradeCatalog300.class.getDeclaredMethod("updateStageTable");
-     Method addServiceComponentColumn = UpgradeCatalog300.class
-         .getDeclaredMethod("addServiceComponentColumn");
+     DBAccessor.DBColumnInfo capturedSelectedColumn = clusterConfigSelectedColumn.getValue();
+     Assert.assertNotNull(capturedSelectedColumn);
+     Assert.assertEquals(UpgradeCatalog300.CLUSTER_CONFIG_SELECTED_COLUMN, capturedSelectedColumn.getName());
+     Assert.assertEquals(Short.class, capturedSelectedColumn.getType());
  
-     UpgradeCatalog300 upgradeCatalog300 = createMockBuilder(UpgradeCatalog300.class)
-         .addMockedMethod(addServiceComponentColumn)
-         .addMockedMethod(updateStageTable)
-         .createMock();
+     DBAccessor.DBColumnInfo capturedSelectedTimestampColumn = clusterConfigSelectedTimestampColumn.getValue();
+     Assert.assertNotNull(capturedSelectedTimestampColumn);
+     Assert.assertEquals(UpgradeCatalog300.CLUSTER_CONFIG_SELECTED_TIMESTAMP_COLUMN, capturedSelectedTimestampColumn.getName());
+     Assert.assertEquals(Long.class, capturedSelectedTimestampColumn.getType());
  
-     upgradeCatalog300.addServiceComponentColumn();
++    // component table
++    DBAccessor.DBColumnInfo capturedStateColumn = componentStateColumn.getValue();
++    Assert.assertNotNull(componentStateColumn);
++    Assert.assertEquals("repo_state", capturedStateColumn.getName());
++    Assert.assertEquals(String.class, capturedStateColumn.getType());
 +
-     upgradeCatalog300.updateStageTable();
+     verify(dbAccessor);
+   }
  
-     replay(upgradeCatalog300);
+   /**
+    * Tests pre-DML executions.
+    *
+    * @throws Exception
+    */
+   @Test
+   public void testExecutePreDMLUpdates() 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);
+       }
+     };
  
-     upgradeCatalog300.executeDDLUpdates();
+     EntityManagerFactory emFactory = EasyMock.createNiceMock(EntityManagerFactory.class);
+     Cache emCache = EasyMock.createNiceMock(Cache.class);
  
-     verify(upgradeCatalog300);
-   }
+     expect(entityManager.getEntityManagerFactory()).andReturn(emFactory).atLeastOnce();
+     expect(emFactory.getCache()).andReturn(emCache).atLeastOnce();
+ 
+     EntityTransaction mockTransaction = EasyMock.createNiceMock(EntityTransaction.class);
+     Connection mockConnection = EasyMock.createNiceMock(Connection.class);
+     Statement mockStatement = EasyMock.createNiceMock(Statement.class);
  
+     expect(dbAccessor.getConnection()).andReturn(mockConnection).once();
+     expect(mockConnection.createStatement()).andReturn(mockStatement).once();
+ 
+     expect(mockStatement.executeQuery(EasyMock.anyString())).andReturn(
+         EasyMock.createNiceMock(ResultSet.class));
+ 
+     expect(entityManager.getTransaction()).andReturn(
+         mockTransaction).atLeastOnce();
+ 
+     dbAccessor.dropTable(UpgradeCatalog300.CLUSTER_CONFIG_MAPPING_TABLE);
+     EasyMock.expectLastCall().once();
+ 
+     replay(dbAccessor, entityManager, emFactory, emCache, mockConnection, mockTransaction,
+         mockStatement, configuration);
+ 
+     Injector injector = Guice.createInjector(module);
+     UpgradeCatalog300 upgradeCatalog300 = injector.getInstance(UpgradeCatalog300.class);
+     upgradeCatalog300.executePreDMLUpdates();
+ 
+     verify(dbAccessor, entityManager, emFactory, emCache);
+   }
  }


Mime
View raw message