You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2016/02/01 18:51:57 UTC

[13/50] [abbrv] brooklyn-ui git commit: remove all async refs in main codebase, so it always does true by default, unless we set false in our tests, and fix tests by catching errors during fade routines

remove all async refs in main codebase, so it always does true by default, unless we set false in our tests,
and fix tests by catching errors during fade routines


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/227a50f8
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/227a50f8
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/227a50f8

Branch: refs/heads/0.6.0
Commit: 227a50f8a956d41add7484db0e4443bf3fc09d14
Parents: 3fefde1
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Fri Sep 13 16:24:19 2013 +0100
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Fri Sep 13 16:48:20 2013 +0100

----------------------------------------------------------------------
 usage/jsgui/pom.xml                                     | 10 +++++-----
 .../webapp/assets/js/view/application-add-wizard.js     |  2 +-
 .../src/main/webapp/assets/js/view/entity-activities.js |  1 -
 .../src/main/webapp/assets/js/view/entity-config.js     |  1 -
 .../src/main/webapp/assets/js/view/entity-policies.js   |  1 -
 usage/jsgui/src/main/webapp/assets/js/view/viewutils.js | 12 ++++++++++--
 usage/jsgui/src/test/javascript/config.txt              |  8 +++++++-
 .../src/test/javascript/specs/model/app-tree-spec.js    |  5 +++--
 .../src/test/javascript/specs/model/application-spec.js |  2 ++
 .../src/test/javascript/specs/model/effector-spec.js    |  3 ++-
 .../src/test/javascript/specs/model/entity-spec.js      |  5 +++--
 11 files changed, 33 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/227a50f8/usage/jsgui/pom.xml
----------------------------------------------------------------------
diff --git a/usage/jsgui/pom.xml b/usage/jsgui/pom.xml
index 4b36257..21a6e1f 100644
--- a/usage/jsgui/pom.xml
+++ b/usage/jsgui/pom.xml
@@ -23,6 +23,9 @@
         <maven-replacer-plugin.version>1.5.2</maven-replacer-plugin.version>
         <nodejs-maven-plugin.version>1.0.3</nodejs-maven-plugin.version>
         <jasmine-maven-plugin.version>1.2.0.0</jasmine-maven-plugin.version>
+<!-- see comment about fixtures below
+        <jasmine-maven-plugin.version>1.3.1.2</jasmine-maven-plugin.version>
+-->
         <requirejs-maven-plugin.version>2.0.0</requirejs-maven-plugin.version>
 
         <!-- The maven-war-plugin 2.1+ and the replacer plugin don't work well together. -->
@@ -108,21 +111,18 @@
                 <extensions>true</extensions>
                 <executions>
                     <execution>
-                        <id>FIREFOX_3</id>
-                        <phase>test</phase>
                         <goals>
                             <goal>test</goal>
                         </goals>
                     </execution>
                 </executions>
                 <configuration>
-                    <!--Tests simulate Firefox 3-->
+<!-- Tests simulate Firefox 3 - does not seem supported on latest jasmine
                     <browserVersion>FIREFOX_3</browserVersion>
-
-                    <!--Configures output file names-->
                     <junitXmlReportFileName>TEST-FIREFOX_3-jasmine.xml</junitXmlReportFileName>
                     <manualSpecRunnerHtmlFileName>FIREFOX_3-ManualSpecRunner.html</manualSpecRunnerHtmlFileName>
                     <specRunnerHtmlFileName>FIREFOX_3-SpecRunner.html</specRunnerHtmlFileName>
+-->
 
                     <!--Uses the require.js test spec-->
                     <specRunnerTemplate>REQUIRE_JS</specRunnerTemplate>

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/227a50f8/usage/jsgui/src/main/webapp/assets/js/view/application-add-wizard.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/view/application-add-wizard.js b/usage/jsgui/src/main/webapp/assets/js/view/application-add-wizard.js
index 09667d6..3ede26d 100644
--- a/usage/jsgui/src/main/webapp/assets/js/view/application-add-wizard.js
+++ b/usage/jsgui/src/main/webapp/assets/js/view/application-add-wizard.js
@@ -414,7 +414,7 @@ define([
         updateForState: function () {
             var that = this
             this.renderName()
-            this.locations.fetch({async:true,
+            this.locations.fetch({
                 success:function () {
                     if (that.model.spec.get("locations").length==0)
                         that.addLocation()

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/227a50f8/usage/jsgui/src/main/webapp/assets/js/view/entity-activities.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/view/entity-activities.js b/usage/jsgui/src/main/webapp/assets/js/view/entity-activities.js
index 4c4f327..ccb9e52 100644
--- a/usage/jsgui/src/main/webapp/assets/js/view/entity-activities.js
+++ b/usage/jsgui/src/main/webapp/assets/js/view/entity-activities.js
@@ -28,7 +28,6 @@ define([
         initialize:function () {
             this.$el.html(this.template({ }));
             this.$('#activities-root').html(_.template(ActivityTableHtml))
-            $.ajaxSetup({ async:true });
             var that = this,
                 $table = that.$('#activities-root .activity-table');
             that.collection.url = that.model.getLinkByName("activities");

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/227a50f8/usage/jsgui/src/main/webapp/assets/js/view/entity-config.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/view/entity-config.js b/usage/jsgui/src/main/webapp/assets/js/view/entity-config.js
index 89a6fe6..1cadaa1 100644
--- a/usage/jsgui/src/main/webapp/assets/js/view/entity-config.js
+++ b/usage/jsgui/src/main/webapp/assets/js/view/entity-config.js
@@ -20,7 +20,6 @@ define([
         },
         initialize:function () {
         	this.$el.html(this.template({ }));
-            $.ajaxSetup({ async:true });
             var that = this,
                 $table = this.$('#config-table');
             that.table = ViewUtils.myDataTable($table, {

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/227a50f8/usage/jsgui/src/main/webapp/assets/js/view/entity-policies.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/view/entity-policies.js b/usage/jsgui/src/main/webapp/assets/js/view/entity-policies.js
index 2b01008..2e64075 100644
--- a/usage/jsgui/src/main/webapp/assets/js/view/entity-policies.js
+++ b/usage/jsgui/src/main/webapp/assets/js/view/entity-policies.js
@@ -24,7 +24,6 @@ define([
         },
         initialize:function () {
             this.$el.html(this.template({ }));
-            $.ajaxSetup({ async:true });
             var that = this;
             // fetch the list of policies and create a view for each one
             that._policies = new PolicySummary.Collection();

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/227a50f8/usage/jsgui/src/main/webapp/assets/js/view/viewutils.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/view/viewutils.js b/usage/jsgui/src/main/webapp/assets/js/view/viewutils.js
index 2c551dd..3559839 100644
--- a/usage/jsgui/src/main/webapp/assets/js/view/viewutils.js
+++ b/usage/jsgui/src/main/webapp/assets/js/view/viewutils.js
@@ -229,10 +229,18 @@ define([
         fadeToIndicateInitialLoad: function($table) {
             // in case the server response time is low, fade out while it refreshes
             // (since we can't show updated details until we've retrieved app + entity details)
-            $table.fadeTo(1000, 0.3);
+            try {                
+                $table.fadeTo(1000, 0.3);
+            } catch (e) {
+                // ignore - normal during tests
+            }
         },
         cancelFadeOnceLoaded: function($table) {
-            $table.stop().fadeTo(200, 1);
+            try {
+                $table.stop().fadeTo(200, 1);
+            } catch (e) {
+                // ignore - normal during tests
+            }
         }
     };
     return ViewUtils;

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/227a50f8/usage/jsgui/src/test/javascript/config.txt
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/test/javascript/config.txt b/usage/jsgui/src/test/javascript/config.txt
index 3e49c21..060928f 100644
--- a/usage/jsgui/src/test/javascript/config.txt
+++ b/usage/jsgui/src/test/javascript/config.txt
@@ -38,7 +38,13 @@
         },
         "datatables-extensions":{
             deps:[ "jquery", "jquery-datatables" ]
-        }
+        },
+        "jquery-form": { deps: [ "jquery" ] },
+        "jquery-slideto": { deps: [ "jquery" ] },
+        "jquery-wiggle": { deps: [ "jquery" ] },
+        "jquery-ba-bbq": { deps: [ "jquery" ] },
+        "handlebars": { deps: [ "jquery" ] },
+        "bootstrap": { deps: [ "jquery" ] /* http://stackoverflow.com/questions/9227406/bootstrap-typeerror-undefined-is-not-a-function-has-no-method-tab-when-us */ }
     },
     // Seconds require will wait before timing out. Defaults to seven seconds.
     waitSeconds: 300

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/227a50f8/usage/jsgui/src/test/javascript/specs/model/app-tree-spec.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/test/javascript/specs/model/app-tree-spec.js b/usage/jsgui/src/test/javascript/specs/model/app-tree-spec.js
index a0a75c6..d0e5fcc 100644
--- a/usage/jsgui/src/test/javascript/specs/model/app-tree-spec.js
+++ b/usage/jsgui/src/test/javascript/specs/model/app-tree-spec.js
@@ -2,10 +2,11 @@ define([
     "model/app-tree"
 ], function (AppTree) {
 
+    $.ajaxSetup({ async:false });
     var apps = new AppTree.Collection
     apps.url = "fixtures/application-tree.json"
-    apps.fetch({async:false})
-
+    apps.fetch({ async:false })
+    
     describe("model/app-tree", function () {
 
         it("loads fixture data", function () {

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/227a50f8/usage/jsgui/src/test/javascript/specs/model/application-spec.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/test/javascript/specs/model/application-spec.js b/usage/jsgui/src/test/javascript/specs/model/application-spec.js
index bb3ef7c..a541029 100644
--- a/usage/jsgui/src/test/javascript/specs/model/application-spec.js
+++ b/usage/jsgui/src/test/javascript/specs/model/application-spec.js
@@ -2,6 +2,8 @@ define([
     "model/application", "model/entity"
 ], function (Application, Entity) {
 
+    $.ajaxSetup({ async:false });
+
     describe('model/application Application model', function () {
 
         var application = new Application.Model()

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/227a50f8/usage/jsgui/src/test/javascript/specs/model/effector-spec.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/test/javascript/specs/model/effector-spec.js b/usage/jsgui/src/test/javascript/specs/model/effector-spec.js
index 6c50d51..37e1a00 100644
--- a/usage/jsgui/src/test/javascript/specs/model/effector-spec.js
+++ b/usage/jsgui/src/test/javascript/specs/model/effector-spec.js
@@ -1,7 +1,8 @@
 define([
     "model/effector-summary", "model/effector-param"
 ], function (EffectorSummary, EffectorParam) {
-
+    $.ajaxSetup({ async:false });
+    
     describe("effector-spec: EffectorSummary model", function () {
         var effectorCollection = new EffectorSummary.Collection
         effectorCollection.url = "fixtures/effector-summary-list.json"

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/227a50f8/usage/jsgui/src/test/javascript/specs/model/entity-spec.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/test/javascript/specs/model/entity-spec.js b/usage/jsgui/src/test/javascript/specs/model/entity-spec.js
index 45c9db0..4b3fc96 100644
--- a/usage/jsgui/src/test/javascript/specs/model/entity-spec.js
+++ b/usage/jsgui/src/test/javascript/specs/model/entity-spec.js
@@ -1,12 +1,13 @@
 define([
     "underscore", "model/entity"
 ], function (_, Entity) {
-
+    $.ajaxSetup({ async:false });
+    
     describe("model/entity", function () {
         // keep these in describe so jasmine-maven will load them from the file pointed by URL
         var entityFixture = new Entity.Collection
         entityFixture.url = 'fixtures/entity.json'
-        entityFixture.fetch({async:true})
+        entityFixture.fetch()
 
         it('loads all model properties defined in fixtures/entity.json', function () {
             expect(entityFixture.length).toEqual(1)