|
@@ -650,6 +650,216 @@ describe("App.MainServiceInfoConfigsController", function () {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
+ describe("#isDirChanged", function() {
|
|
|
+
|
|
|
+ describe("when service name is HDFS", function() {
|
|
|
+ beforeEach(function() {
|
|
|
+ mainServiceInfoConfigsController.set('content', Ember.Object.create ({ serviceName: 'HDFS' }));
|
|
|
+ });
|
|
|
+
|
|
|
+ describe("when isHadoop2Stack is true", function() {
|
|
|
+
|
|
|
+ var tests = [
|
|
|
+ {
|
|
|
+ it: "should set dirChanged to false if none of the properties exist",
|
|
|
+ expect: false,
|
|
|
+ config: Ember.Object.create ({})
|
|
|
+ },
|
|
|
+ {
|
|
|
+ it: "should set dirChanged to true if dfs.namenode.name.dir is not default",
|
|
|
+ expect: true,
|
|
|
+ config: Ember.Object.create ({
|
|
|
+ name: 'dfs.namenode.name.dir',
|
|
|
+ isNotDefaultValue: true
|
|
|
+ })
|
|
|
+ },
|
|
|
+ {
|
|
|
+ it: "should set dirChanged to false if dfs.namenode.name.dir is default",
|
|
|
+ expect: false,
|
|
|
+ config: Ember.Object.create ({
|
|
|
+ name: 'dfs.namenode.name.dir',
|
|
|
+ isNotDefaultValue: false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ {
|
|
|
+ it: "should set dirChanged to true if dfs.namenode.checkpoint.dir is not default",
|
|
|
+ expect: true,
|
|
|
+ config: Ember.Object.create ({
|
|
|
+ name: 'dfs.namenode.checkpoint.dir',
|
|
|
+ isNotDefaultValue: true
|
|
|
+ })
|
|
|
+ },
|
|
|
+ {
|
|
|
+ it: "should set dirChanged to false if dfs.namenode.checkpoint.dir is default",
|
|
|
+ expect: false,
|
|
|
+ config: Ember.Object.create ({
|
|
|
+ name: 'dfs.namenode.checkpoint.dir',
|
|
|
+ isNotDefaultValue: false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ {
|
|
|
+ it: "should set dirChanged to true if dfs.datanode.data.dir is not default",
|
|
|
+ expect: true,
|
|
|
+ config: Ember.Object.create ({
|
|
|
+ name: 'dfs.datanode.data.dir',
|
|
|
+ isNotDefaultValue: true
|
|
|
+ })
|
|
|
+ },
|
|
|
+ {
|
|
|
+ it: "should set dirChanged to false if dfs.datanode.data.dir is default",
|
|
|
+ expect: false,
|
|
|
+ config: Ember.Object.create ({
|
|
|
+ name: 'dfs.datanode.data.dir',
|
|
|
+ isNotDefaultValue: false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ ];
|
|
|
+
|
|
|
+ beforeEach(function() {
|
|
|
+ sinon.stub(App, 'get').returns(true);
|
|
|
+ });
|
|
|
+
|
|
|
+ afterEach(function() {
|
|
|
+ App.get.restore();
|
|
|
+ });
|
|
|
+
|
|
|
+ tests.forEach(function(test) {
|
|
|
+ it(test.it, function() {
|
|
|
+ mainServiceInfoConfigsController.set('stepConfigs', [Ember.Object.create ({ configs: [test.config], serviceName: 'HDFS' })]);
|
|
|
+ expect(mainServiceInfoConfigsController.isDirChanged()).to.equal(test.expect);
|
|
|
+ })
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ describe("when isHadoop2Stack is false", function() {
|
|
|
+
|
|
|
+ var tests = [
|
|
|
+ {
|
|
|
+ it: "should set dirChanged to false if none of the properties exist",
|
|
|
+ expect: false,
|
|
|
+ config: Ember.Object.create ({})
|
|
|
+ },
|
|
|
+ {
|
|
|
+ it: "should set dirChanged to true if dfs.name.dir is not default",
|
|
|
+ expect: true,
|
|
|
+ config: Ember.Object.create ({
|
|
|
+ name: 'dfs.name.dir',
|
|
|
+ isNotDefaultValue: true
|
|
|
+ })
|
|
|
+ },
|
|
|
+ {
|
|
|
+ it: "should set dirChanged to false if dfs.name.dir is default",
|
|
|
+ expect: false,
|
|
|
+ config: Ember.Object.create ({
|
|
|
+ name: 'dfs.name.dir',
|
|
|
+ isNotDefaultValue: false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ {
|
|
|
+ it: "should set dirChanged to true if fs.checkpoint.dir is not default",
|
|
|
+ expect: true,
|
|
|
+ config: Ember.Object.create ({
|
|
|
+ name: 'fs.checkpoint.dir',
|
|
|
+ isNotDefaultValue: true
|
|
|
+ })
|
|
|
+ },
|
|
|
+ {
|
|
|
+ it: "should set dirChanged to false if fs.checkpoint.dir is default",
|
|
|
+ expect: false,
|
|
|
+ config: Ember.Object.create ({
|
|
|
+ name: 'fs.checkpoint.dir',
|
|
|
+ isNotDefaultValue: false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ {
|
|
|
+ it: "should set dirChanged to true if dfs.data.dir is not default",
|
|
|
+ expect: true,
|
|
|
+ config: Ember.Object.create ({
|
|
|
+ name: 'dfs.data.dir',
|
|
|
+ isNotDefaultValue: true
|
|
|
+ })
|
|
|
+ },
|
|
|
+ {
|
|
|
+ it: "should set dirChanged to false if dfs.data.dir is default",
|
|
|
+ expect: false,
|
|
|
+ config: Ember.Object.create ({
|
|
|
+ name: 'dfs.data.dir',
|
|
|
+ isNotDefaultValue: false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ ];
|
|
|
+
|
|
|
+ beforeEach(function() {
|
|
|
+ sinon.stub(App, 'get').returns(false);
|
|
|
+ });
|
|
|
+
|
|
|
+ afterEach(function() {
|
|
|
+ App.get.restore();
|
|
|
+ });
|
|
|
+
|
|
|
+ tests.forEach(function(test) {
|
|
|
+ it(test.it, function() {
|
|
|
+ mainServiceInfoConfigsController.set('stepConfigs', [Ember.Object.create ({ configs: [test.config], serviceName: 'HDFS' })]);
|
|
|
+ expect(mainServiceInfoConfigsController.isDirChanged()).to.equal(test.expect);
|
|
|
+ })
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ describe("when service name is MAPREDUCE", function() {
|
|
|
+ beforeEach(function() {
|
|
|
+ mainServiceInfoConfigsController.set('content', Ember.Object.create ({ serviceName: 'MAPREDUCE' }));
|
|
|
+ });
|
|
|
+
|
|
|
+ var tests = [
|
|
|
+ {
|
|
|
+ it: "should set dirChanged to false if none of the properties exist",
|
|
|
+ expect: false,
|
|
|
+ config: Ember.Object.create ({})
|
|
|
+ },
|
|
|
+ {
|
|
|
+ it: "should set dirChanged to true if mapred.local.dir is not default",
|
|
|
+ expect: true,
|
|
|
+ config: Ember.Object.create ({
|
|
|
+ name: 'mapred.local.dir',
|
|
|
+ isNotDefaultValue: true
|
|
|
+ })
|
|
|
+ },
|
|
|
+ {
|
|
|
+ it: "should set dirChanged to false if mapred.local.dir is default",
|
|
|
+ expect: false,
|
|
|
+ config: Ember.Object.create ({
|
|
|
+ name: 'mapred.local.dir',
|
|
|
+ isNotDefaultValue: false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ {
|
|
|
+ it: "should set dirChanged to true if mapred.system.dir is not default",
|
|
|
+ expect: true,
|
|
|
+ config: Ember.Object.create ({
|
|
|
+ name: 'mapred.system.dir',
|
|
|
+ isNotDefaultValue: true
|
|
|
+ })
|
|
|
+ },
|
|
|
+ {
|
|
|
+ it: "should set dirChanged to false if mapred.system.dir is default",
|
|
|
+ expect: false,
|
|
|
+ config: Ember.Object.create ({
|
|
|
+ name: 'mapred.system.dir',
|
|
|
+ isNotDefaultValue: false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ ];
|
|
|
+
|
|
|
+ tests.forEach(function(test) {
|
|
|
+ it(test.it, function() {
|
|
|
+ mainServiceInfoConfigsController.set('stepConfigs', [Ember.Object.create ({ configs: [test.config], serviceName: 'MAPREDUCE' })]);
|
|
|
+ expect(mainServiceInfoConfigsController.isDirChanged()).to.equal(test.expect);
|
|
|
+ })
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
describe("#addDynamicProperties", function() {
|
|
|
|
|
|
var tests = [
|