|
@@ -101,10 +101,10 @@ describe('App.InstallerStep7Controller', function () {
|
|
|
beforeEach(function () {
|
|
|
sinon.stub(App.config, 'setPreDefinedServiceConfigs', Em.K);
|
|
|
installerStep7Controller = App.WizardStep7Controller.create({
|
|
|
- content: {
|
|
|
+ content: Em.Object.create({
|
|
|
advancedServiceConfig: [],
|
|
|
serviceConfigProperties: []
|
|
|
- }
|
|
|
+ })
|
|
|
});
|
|
|
sinon.stub(console, 'error', Em.K);
|
|
|
});
|
|
@@ -2091,4 +2091,96 @@ describe('App.InstallerStep7Controller', function () {
|
|
|
|
|
|
});
|
|
|
|
|
|
+ describe('#resolveHiveMysqlDatabase', function () {
|
|
|
+
|
|
|
+ beforeEach(function () {
|
|
|
+ installerStep7Controller.get('content').setProperties({
|
|
|
+ services: Em.A([
|
|
|
+ Em.Object.create({serviceName: 'HIVE', isSelected: true, isInstalled: false})
|
|
|
+ ])
|
|
|
+ });
|
|
|
+ installerStep7Controller.setProperties({
|
|
|
+ stepConfigs: Em.A([
|
|
|
+ Em.Object.create({serviceName: 'HIVE', configs: [{name: 'hive_database', value: 'New MySQL Database'}]})
|
|
|
+ ]),
|
|
|
+ mySQLServerConflict: true
|
|
|
+ });
|
|
|
+ sinon.stub(installerStep7Controller, 'moveNext', Em.K);
|
|
|
+ sinon.stub(installerStep7Controller, 'checkMySQLHost', function () {
|
|
|
+ return $.Deferred().resolve();
|
|
|
+ });
|
|
|
+ sinon.spy(App.ModalPopup, 'show');
|
|
|
+ });
|
|
|
+
|
|
|
+ afterEach(function () {
|
|
|
+ installerStep7Controller.moveNext.restore();
|
|
|
+ installerStep7Controller.checkMySQLHost.restore();
|
|
|
+
|
|
|
+ App.ModalPopup.show.restore();
|
|
|
+ });
|
|
|
+
|
|
|
+ it('no HIVE service', function () {
|
|
|
+ installerStep7Controller.set('content.services', Em.A([]));
|
|
|
+ installerStep7Controller.resolveHiveMysqlDatabase();
|
|
|
+ expect(installerStep7Controller.moveNext.calledOnce).to.be.true;
|
|
|
+ expect(App.ModalPopup.show.called).to.be.false;
|
|
|
+ });
|
|
|
+
|
|
|
+ it('if mySQLServerConflict, popup is shown', function () {
|
|
|
+ installerStep7Controller.resolveHiveMysqlDatabase();
|
|
|
+ expect(installerStep7Controller.moveNext.called).to.be.false;
|
|
|
+ expect(App.ModalPopup.show.calledOnce).to.be.true;
|
|
|
+ });
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ describe('#mySQLWarningHandler', function () {
|
|
|
+
|
|
|
+ beforeEach(function () {
|
|
|
+ installerStep7Controller.set('mySQLServerConflict', true);
|
|
|
+ sinon.spy(App.ModalPopup, 'show');
|
|
|
+ sinon.stub(App.router, 'get').returns({gotoStep: Em.K});
|
|
|
+ sinon.stub(App.router.get(), 'gotoStep', Em.K);
|
|
|
+ });
|
|
|
+
|
|
|
+ afterEach(function () {
|
|
|
+ App.ModalPopup.show.restore();
|
|
|
+ App.router.get().gotoStep.restore();
|
|
|
+ App.router.get.restore();
|
|
|
+ });
|
|
|
+
|
|
|
+ it('warning popup is shown', function () {
|
|
|
+ installerStep7Controller.mySQLWarningHandler();
|
|
|
+ expect(App.ModalPopup.show.calledOnce).to.be.true;
|
|
|
+ });
|
|
|
+
|
|
|
+ it('submitButtonClicked is set to false on primary click', function () {
|
|
|
+ installerStep7Controller.mySQLWarningHandler().onPrimary();
|
|
|
+ expect(installerStep7Controller.get('submitButtonClicked')).to.be.false;
|
|
|
+ });
|
|
|
+
|
|
|
+ it('second popup is shown on secondary click', function () {
|
|
|
+ installerStep7Controller.mySQLWarningHandler().onSecondary();
|
|
|
+ expect(App.ModalPopup.show.calledTwice).to.be.true;
|
|
|
+ });
|
|
|
+
|
|
|
+ it('submitButtonClicked is set to false on secondary click on the second popup', function () {
|
|
|
+ installerStep7Controller.mySQLWarningHandler().onSecondary().onSecondary();
|
|
|
+ expect(installerStep7Controller.get('submitButtonClicked')).to.be.false;
|
|
|
+ });
|
|
|
+
|
|
|
+ it('user is moved to step5 on primary click on the second popup (installerController)', function () {
|
|
|
+ installerStep7Controller.set('content.controllerName', 'installerController');
|
|
|
+ installerStep7Controller.mySQLWarningHandler().onSecondary().onPrimary();
|
|
|
+ expect(App.router.get('installerController').gotoStep.calledWith(5, true)).to.be.true;
|
|
|
+ });
|
|
|
+
|
|
|
+ it('user is moved to step2 on primary click on the second popup (addSeviceController)', function () {
|
|
|
+ installerStep7Controller.set('content.controllerName', 'addServiceController');
|
|
|
+ installerStep7Controller.mySQLWarningHandler().onSecondary().onPrimary();
|
|
|
+ expect(App.router.get('addSeviceController').gotoStep.calledWith(2, true)).to.be.true;
|
|
|
+ });
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
});
|