From 40e3badbdb4d6d371e8bc08f5ff2f387ce52e06e Mon Sep 17 00:00:00 2001 From: Drew Folta Date: Tue, 9 Oct 2012 16:04:42 -0700 Subject: [PATCH 01/10] fixed typo --- .../frameworkapp/common/mojits/CM_Layout/controller.common.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/func/applications/frameworkapp/common/mojits/CM_Layout/controller.common.js b/tests/func/applications/frameworkapp/common/mojits/CM_Layout/controller.common.js index 74b5048a7..09a0782d5 100644 --- a/tests/func/applications/frameworkapp/common/mojits/CM_Layout/controller.common.js +++ b/tests/func/applications/frameworkapp/common/mojits/CM_Layout/controller.common.js @@ -74,6 +74,6 @@ YUI.add('CM_Layout', function(Y, NAME) { }, '0.0.1', {requires: [ 'mojito', - 'mojito-config-done', - 'mojito-composite-done', + 'mojito-config-addon', + 'mojito-composite-addon', 'mojito-params-addon']}); From bb3296a2fde57c9cdd69385e01e136fb8bf793bb Mon Sep 17 00:00:00 2001 From: Drew Folta Date: Wed, 10 Oct 2012 12:42:54 -0700 Subject: [PATCH 02/10] don't show stacktrace on dispatch error (security bug) --- lib/app/autoload/dispatch.common.js | 30 ++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/lib/app/autoload/dispatch.common.js b/lib/app/autoload/dispatch.common.js index 409606af0..46799e68a 100644 --- a/lib/app/autoload/dispatch.common.js +++ b/lib/app/autoload/dispatch.common.js @@ -88,13 +88,29 @@ YUI.add('mojito-dispatcher', function(Y, NAME) { // Note that creation of an ActionContext current causes // immediate invocation of the dispatch() call. - ac = new Y.mojito.ActionContext({ - command: command, - controller: controller, - dispatcher: my, // NOTE passing dispatcher. - adapter: adapter, - store: store - }); + try { + ac = new Y.mojito.ActionContext({ + command: command, + controller: controller, + dispatcher: my, // NOTE passing dispatcher. + adapter: adapter, + store: store + }); + } catch(err) { + if (adapter.error) { + adapter.error(err); + } else { + this.Y.log('WARNING!! Uncaught error from dispatch on' + + ' instance \'' + (instance.id || '@' + instance.type) + + '\'', 'error', NAME); + this.Y.log(err.message, 'error', NAME); + this.Y.log(err.stack, 'error', NAME); + adapter.done('ERROR'); + } + // TODO: should we be rethrowing the error here? We log but we + // don't ensure callers know...but then again dispatch() may + // need this level of isolation. + } perf.done(); // closing the 'ac:ctor' timeline From 492c464600163621b79965aff2b73583ff2188dc Mon Sep 17 00:00:00 2001 From: Drew Folta Date: Wed, 10 Oct 2012 12:50:19 -0700 Subject: [PATCH 03/10] cleanups --- tests/func/routing/testbasicroutingneg1.js | 27 +++++++++++----------- tests/func/routing/testbasicroutingneg2.js | 25 ++++++++++---------- tests/func/routing/testbasicroutingneg3.js | 27 +++++++++++----------- 3 files changed, 38 insertions(+), 41 deletions(-) diff --git a/tests/func/routing/testbasicroutingneg1.js b/tests/func/routing/testbasicroutingneg1.js index 8ba05731f..7fa06ed16 100644 --- a/tests/func/routing/testbasicroutingneg1.js +++ b/tests/func/routing/testbasicroutingneg1.js @@ -1,21 +1,20 @@ /* * This is a basic func test for a Routing application. */ - YUI({ - useConsoleOutput: true, - useBrowserConsole: true, - logInclude: { TestRunner: true } - }).use('node', 'node-event-simulate', 'test', function (Y) { +YUI({ + useConsoleOutput: true, + useBrowserConsole: true, + logInclude: { TestRunner: true } +}).use('node', 'node-event-simulate', 'test', function (Y) { - var suite = new Y.Test.Suite("Routing: BasicRoutingNeg3"); + var suite = new Y.Test.Suite("Routing: BasicRoutingNeg1"); - suite.add(new Y.Test.Case({ - "test BasicRoutingNeg3": function(){ - Y.Assert.areEqual("Error: 404", Y.one('h1').get("innerHTML")); - Y.Assert.areEqual("Error details are not available.", Y.one('p').get("innerHTML")); - } - })); + suite.add(new Y.Test.Case({ + "test BasicRoutingNeg1": function(){ + Y.Assert.areEqual("Error: 404", Y.one('h1').get("innerHTML")); + Y.Assert.areEqual("Error details are not available.", Y.one('p').get("innerHTML")); + } + })); Y.Test.Runner.add(suite); - }); - +}); diff --git a/tests/func/routing/testbasicroutingneg2.js b/tests/func/routing/testbasicroutingneg2.js index 3bbaef47e..dbf62c054 100644 --- a/tests/func/routing/testbasicroutingneg2.js +++ b/tests/func/routing/testbasicroutingneg2.js @@ -1,20 +1,19 @@ /* * This is a basic func test for a Routing application. */ - YUI({ - useConsoleOutput: true, - useBrowserConsole: true, - logInclude: { TestRunner: true } - }).use('node', 'node-event-simulate', 'test', function (Y) { +YUI({ + useConsoleOutput: true, + useBrowserConsole: true, + logInclude: { TestRunner: true } +}).use('node', 'node-event-simulate', 'test', function (Y) { - var suite = new Y.Test.Suite("Routing: BasicRoutingNeg3"); + var suite = new Y.Test.Suite("Routing: BasicRoutingNeg2"); - suite.add(new Y.Test.Case({ - "test BasicRoutingNeg3": function(){ - Y.Assert.areEqual("Cannot GET /complete/invalid/path", Y.one('pre').get('innerHTML')); - } - })); + suite.add(new Y.Test.Case({ + "test BasicRoutingNeg2": function(){ + Y.Assert.areEqual("Cannot GET /complete/invalid/path", Y.one('pre').get('innerHTML')); + } + })); Y.Test.Runner.add(suite); - }); - +}); diff --git a/tests/func/routing/testbasicroutingneg3.js b/tests/func/routing/testbasicroutingneg3.js index 1241775f4..c62bac214 100644 --- a/tests/func/routing/testbasicroutingneg3.js +++ b/tests/func/routing/testbasicroutingneg3.js @@ -1,21 +1,20 @@ /* * This is a basic func test for a Routing application. */ - YUI({ - useConsoleOutput: true, - useBrowserConsole: true, - logInclude: { TestRunner: true } - }).use('node', 'node-event-simulate', 'test', function (Y) { +YUI({ + useConsoleOutput: true, + useBrowserConsole: true, + logInclude: { TestRunner: true } +}).use('node', 'node-event-simulate', 'test', function (Y) { - var suite = new Y.Test.Suite("Routing: BasicRoutingNeg3"); + var suite = new Y.Test.Suite("Routing: BasicRoutingNeg3"); - suite.add(new Y.Test.Case({ - "test BasicRoutingNeg3": function(){ - Y.Assert.areEqual("Click to execute the action 'route-2' for the mojit 'nothing'", Y.one('#mylink').get('innerHTML')); - Y.Assert.areEqual("/route-2/nothing", Y.one('#mylink').getAttribute("href")); - } - })); + suite.add(new Y.Test.Case({ + "test BasicRoutingNeg3": function(){ + Y.Assert.areEqual("Click to execute the action 'route-2' for the mojit 'nothing'", Y.one('#mylink').get('innerHTML')); + Y.Assert.areEqual("/route-2/nothing", Y.one('#mylink').getAttribute("href")); + } + })); Y.Test.Runner.add(suite); - }); - +}); From 0d64847f435a25f503bfae5a28e0aabb1f1ade34 Mon Sep 17 00:00:00 2001 From: Drew Folta Date: Wed, 10 Oct 2012 12:52:01 -0700 Subject: [PATCH 04/10] delinted --- lib/app/autoload/dispatch.common.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/app/autoload/dispatch.common.js b/lib/app/autoload/dispatch.common.js index 46799e68a..e662704bd 100644 --- a/lib/app/autoload/dispatch.common.js +++ b/lib/app/autoload/dispatch.common.js @@ -96,15 +96,15 @@ YUI.add('mojito-dispatcher', function(Y, NAME) { adapter: adapter, store: store }); - } catch(err) { + } catch (e) { if (adapter.error) { - adapter.error(err); + adapter.error(e); } else { this.Y.log('WARNING!! Uncaught error from dispatch on' + ' instance \'' + (instance.id || '@' + instance.type) + '\'', 'error', NAME); - this.Y.log(err.message, 'error', NAME); - this.Y.log(err.stack, 'error', NAME); + this.Y.log(e.message, 'error', NAME); + this.Y.log(e.stack, 'error', NAME); adapter.done('ERROR'); } // TODO: should we be rethrowing the error here? We log but we From 7be255c831a59baf9e5c7e8daf43e181ea61516b Mon Sep 17 00:00:00 2001 From: Drew Folta Date: Wed, 10 Oct 2012 13:18:00 -0700 Subject: [PATCH 05/10] added missing params addon --- .../frameworkapp/serveronly/mojits/RESTLib/controller.common.js | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/func/applications/frameworkapp/serveronly/mojits/RESTLib/controller.common.js b/tests/func/applications/frameworkapp/serveronly/mojits/RESTLib/controller.common.js index 01a759f63..7a63dcd4a 100644 --- a/tests/func/applications/frameworkapp/serveronly/mojits/RESTLib/controller.common.js +++ b/tests/func/applications/frameworkapp/serveronly/mojits/RESTLib/controller.common.js @@ -374,4 +374,5 @@ YUI.add('RESTLib', function(Y, NAME) { 'mojito', 'mojito-models-addon', 'mojito-http-addon', + 'mojito-params-addon', 'RESTLibModel']}); From f7b1b2286d0cadbb767277451336ed2fc4cfe9cc Mon Sep 17 00:00:00 2001 From: Drew Folta Date: Wed, 10 Oct 2012 14:16:02 -0700 Subject: [PATCH 06/10] match test names, so we can tell which test is failing --- tests/func/serveronly/serveronlytest_descriptor.json | 6 +++--- tests/func/serveronly/testMultiActions1.js | 4 ++-- tests/func/serveronly/testMultiActions2.js | 4 ++-- tests/func/serveronly/testMultiActions3.js | 4 ++-- tests/func/serveronly/testMultiActions4.js | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/func/serveronly/serveronlytest_descriptor.json b/tests/func/serveronly/serveronlytest_descriptor.json index 945ae9e76..c93b5dcfd 100644 --- a/tests/func/serveronly/serveronlytest_descriptor.json +++ b/tests/func/serveronly/serveronlytest_descriptor.json @@ -466,21 +466,21 @@ "page" : "$$config.baseUrl$$/inst0" } }, - "multiaction2" : { + "bz5300267-multiaction2" : { "group" : "smoke,restlib,serveronly", "params" : { "test" : "testMultiActions2.js", "page" : "$$config.baseUrl$$/inst1" } }, - "multiaction3" : { + "bz5300267-multiaction3" : { "group" : "smoke,restlib,serveronly", "params" : { "test" : "testMultiActions3.js", "page" : "$$config.baseUrl$$/inst01" } }, - "multiaction4" : { + "bz5300267-multiaction4" : { "group" : "smoke,restlib,serveronly", "params" : { "test" : "testMultiActions4.js", diff --git a/tests/func/serveronly/testMultiActions1.js b/tests/func/serveronly/testMultiActions1.js index 1df791ff6..bc1e9fac0 100644 --- a/tests/func/serveronly/testMultiActions1.js +++ b/tests/func/serveronly/testMultiActions1.js @@ -7,10 +7,10 @@ YUI({ logInclude: { TestRunner: true } }).use('node', 'node-event-simulate', 'test', 'console', function (Y) { - var suite = new Y.Test.Suite("ServerOnly: multiaction"); + var suite = new Y.Test.Suite("ServerOnly: multiaction1"); suite.add(new Y.Test.Case({ - "test multiaction": function(){ + "test multiaction1": function(){ Y.Assert.areEqual('Index', Y.all('h3').item(0).get('innerHTML')); Y.Assert.areEqual('hello from index', Y.all('h3').item(1).get('innerHTML')); } diff --git a/tests/func/serveronly/testMultiActions2.js b/tests/func/serveronly/testMultiActions2.js index 14eb890b7..ebe31b0c0 100644 --- a/tests/func/serveronly/testMultiActions2.js +++ b/tests/func/serveronly/testMultiActions2.js @@ -7,10 +7,10 @@ YUI({ logInclude: { TestRunner: true } }).use('node', 'node-event-simulate', 'test', 'console', function (Y) { - var suite = new Y.Test.Suite("ServerOnly: bz5300267"); + var suite = new Y.Test.Suite("ServerOnly: bz5300267 multiaction2"); suite.add(new Y.Test.Case({ - "test bz5300267": function(){ + "test bz5300267 multiaction2": function(){ Y.Assert.areEqual('Inst1', Y.all('h3').item(0).get('innerHTML')); Y.Assert.areEqual('hello from inst1', Y.all('h3').item(1).get('innerHTML')); } diff --git a/tests/func/serveronly/testMultiActions3.js b/tests/func/serveronly/testMultiActions3.js index 14eb890b7..0dd528488 100644 --- a/tests/func/serveronly/testMultiActions3.js +++ b/tests/func/serveronly/testMultiActions3.js @@ -7,10 +7,10 @@ YUI({ logInclude: { TestRunner: true } }).use('node', 'node-event-simulate', 'test', 'console', function (Y) { - var suite = new Y.Test.Suite("ServerOnly: bz5300267"); + var suite = new Y.Test.Suite("ServerOnly: bz5300267 multiaction3"); suite.add(new Y.Test.Case({ - "test bz5300267": function(){ + "test bz5300267 multiaction3": function(){ Y.Assert.areEqual('Inst1', Y.all('h3').item(0).get('innerHTML')); Y.Assert.areEqual('hello from inst1', Y.all('h3').item(1).get('innerHTML')); } diff --git a/tests/func/serveronly/testMultiActions4.js b/tests/func/serveronly/testMultiActions4.js index afc62ea78..e3b24fb80 100644 --- a/tests/func/serveronly/testMultiActions4.js +++ b/tests/func/serveronly/testMultiActions4.js @@ -7,10 +7,10 @@ YUI({ logInclude: { TestRunner: true } }).use('node', 'node-event-simulate', 'test', 'console', function (Y) { - var suite = new Y.Test.Suite("ServerOnly: bz5300267"); + var suite = new Y.Test.Suite("ServerOnly: bz5300267 multiaction4"); suite.add(new Y.Test.Case({ - "test bz5300267": function(){ + "test bz5300267 multiaction4": function(){ Y.Assert.areEqual('There are two children in this Container:', Y.all('#ctitle').get('innerHTML')); Y.Assert.areEqual('Index', Y.all('h3').item(0).get('innerHTML')); Y.Assert.areEqual('hello from index', Y.all('h3').item(1).get('innerHTML')); From a6ccd642c7075e84be27f15a19a3c4bf4910004a Mon Sep 17 00:00:00 2001 From: Drew Folta Date: Wed, 10 Oct 2012 14:17:32 -0700 Subject: [PATCH 07/10] action can come from the instance (as in "call":"foo." in routes) --- lib/app/autoload/action-context.common.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/app/autoload/action-context.common.js b/lib/app/autoload/action-context.common.js index 82dd27d0f..ae54f0cd3 100644 --- a/lib/app/autoload/action-context.common.js +++ b/lib/app/autoload/action-context.common.js @@ -278,7 +278,7 @@ YUI.add('mojito-action-context', function(Y, NAME) { var controller = opts.controller, command = opts.command, - actionFunction = command.action, + actionFunction, perf = Y.mojito.perf.timeline('mojito', 'ac:init', 'set up AC object', command), error, staticAppConfig = YUI.Env.mojito.DataProcess.retrieve('static-app-config') || {}, @@ -286,10 +286,17 @@ YUI.add('mojito-action-context', function(Y, NAME) { my = this; + // It's possible to setup a route that calls "foo.", which means that + // the default action in the instance should be used instead. + if (!command.action) { + command.action = command.instance.action || 'index'; + } + this.action = command.action; this.type = command.instance.type; this.context = command.context; this.dispatcher = opts.dispatcher; + actionFunction = this.action; // These should not be on the ac object this.command = command; From 3e5be2b8be81bb11d09aa26b0250df00f5975e75 Mon Sep 17 00:00:00 2001 From: Drew Folta Date: Wed, 10 Oct 2012 14:19:02 -0700 Subject: [PATCH 08/10] always log when dispatch() fails --- lib/app/autoload/dispatch.common.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/app/autoload/dispatch.common.js b/lib/app/autoload/dispatch.common.js index e662704bd..061739d50 100644 --- a/lib/app/autoload/dispatch.common.js +++ b/lib/app/autoload/dispatch.common.js @@ -97,19 +97,19 @@ YUI.add('mojito-dispatcher', function(Y, NAME) { store: store }); } catch (e) { + Y.log('Error from dispatch on instance \'' + + (instance.id || '@' + instance.type) + + '\':', 'error', NAME); + Y.log(e.message, 'error', NAME); + Y.log(e.stack, 'error', NAME); if (adapter.error) { adapter.error(e); } else { - this.Y.log('WARNING!! Uncaught error from dispatch on' + - ' instance \'' + (instance.id || '@' + instance.type) + - '\'', 'error', NAME); - this.Y.log(e.message, 'error', NAME); - this.Y.log(e.stack, 'error', NAME); + // TODO: should we be rethrowing the error here? We log but we + // don't ensure callers know...but then again dispatch() may + // need this level of isolation. adapter.done('ERROR'); } - // TODO: should we be rethrowing the error here? We log but we - // don't ensure callers know...but then again dispatch() may - // need this level of isolation. } perf.done(); // closing the 'ac:ctor' timeline From 2977af0c9146ec7f9d71f63c607658f042fbeaef Mon Sep 17 00:00:00 2001 From: Drew Folta Date: Wed, 10 Oct 2012 16:32:01 -0700 Subject: [PATCH 09/10] more careful about YUI module names of models --- .../usecase/mojits/Coverage/models/model.server.js | 2 +- .../frameworkapp/usecase/mojits/Flickr/controller.common.js | 2 +- .../frameworkapp/usecase/mojits/Flickr/models/model.common.js | 4 ++-- .../usecase/mojits/FlickrDetail/controller.common.js | 2 +- .../usecase/mojits/FlickrDetail/models/model.common.js | 4 ++-- .../usecase/mojits/PagedFlickr/controller.common.js | 2 +- .../usecase/mojits/PagedFlickr/models/model.common.js | 4 ++-- .../usecase/mojits/PagedFlickr2/controller.common.js | 2 +- .../usecase/mojits/PagedFlickr2/models/model.common.js | 4 ++-- .../usecase/mojits/PagedFlickr5/controller.common.js | 2 +- .../usecase/mojits/PagedFlickr5/models/model.common.js | 4 ++-- .../usecase/mojits/i18nMojit/controller.server.js | 2 +- .../usecase/mojits/i18nMojit/models/model.server.js | 2 +- .../usecase/mojits/i18n_Mojit/controller.server.js | 2 +- .../usecase/mojits/i18n_Mojit/models/model.server.js | 2 +- 15 files changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/func/applications/frameworkapp/usecase/mojits/Coverage/models/model.server.js b/tests/func/applications/frameworkapp/usecase/mojits/Coverage/models/model.server.js index ba32a9436..cdb185058 100644 --- a/tests/func/applications/frameworkapp/usecase/mojits/Coverage/models/model.server.js +++ b/tests/func/applications/frameworkapp/usecase/mojits/Coverage/models/model.server.js @@ -15,7 +15,7 @@ YUI.add('CoverageModel', function(Y, NAME) { * @class Model * @constructor */ - Y.mojito.models.default = { + Y.mojito.models[NAME] = { init: function(mojitSpec) { this.spec = mojitSpec; diff --git a/tests/func/applications/frameworkapp/usecase/mojits/Flickr/controller.common.js b/tests/func/applications/frameworkapp/usecase/mojits/Flickr/controller.common.js index 218b8fb88..ff98eca1e 100644 --- a/tests/func/applications/frameworkapp/usecase/mojits/Flickr/controller.common.js +++ b/tests/func/applications/frameworkapp/usecase/mojits/Flickr/controller.common.js @@ -19,7 +19,7 @@ YUI.add('Flickr', function(Y, NAME) { * @return {} */ index: function(ac) { - ac.models.get('flickrModel').getFlickrImages('mojito', function(images) { + ac.models.get('FlickrModel').getFlickrImages('mojito', function(images) { ac.done({images: images}); }); } diff --git a/tests/func/applications/frameworkapp/usecase/mojits/Flickr/models/model.common.js b/tests/func/applications/frameworkapp/usecase/mojits/Flickr/models/model.common.js index 4fbf061bf..91f1be801 100644 --- a/tests/func/applications/frameworkapp/usecase/mojits/Flickr/models/model.common.js +++ b/tests/func/applications/frameworkapp/usecase/mojits/Flickr/models/model.common.js @@ -1,7 +1,7 @@ /* * Copyright (c) 2011 Yahoo! Inc. All rights reserved. */ -YUI.add('FlickrModel', function(Y) { +YUI.add('FlickrModel', function(Y, NAME) { /** * The FlickrModel module. @@ -9,7 +9,7 @@ YUI.add('FlickrModel', function(Y) { * @module FlickrModel */ - Y.mojito.models.flickrModel = { + Y.mojito.models[NAME] = { /** * Method that will be invoked by the mojit controller to obtain data. diff --git a/tests/func/applications/frameworkapp/usecase/mojits/FlickrDetail/controller.common.js b/tests/func/applications/frameworkapp/usecase/mojits/FlickrDetail/controller.common.js index 471608185..7372e4bb8 100644 --- a/tests/func/applications/frameworkapp/usecase/mojits/FlickrDetail/controller.common.js +++ b/tests/func/applications/frameworkapp/usecase/mojits/FlickrDetail/controller.common.js @@ -37,7 +37,7 @@ YUI.add('FlickrDetail', function(Y, NAME) { return; } - ac.models.get('flickrModel').getFlickrDetail(image, function(details) { + ac.models.get('FlickrDetailModelFlickr').getFlickrDetail(image, function(details) { if (!details) { ac.done({ type: 'error', message: ac.intl.lang('ERROR_NO_DETAILS') }, { name:'message' }); return; diff --git a/tests/func/applications/frameworkapp/usecase/mojits/FlickrDetail/models/model.common.js b/tests/func/applications/frameworkapp/usecase/mojits/FlickrDetail/models/model.common.js index c1e32a716..0d7becb59 100644 --- a/tests/func/applications/frameworkapp/usecase/mojits/FlickrDetail/models/model.common.js +++ b/tests/func/applications/frameworkapp/usecase/mojits/FlickrDetail/models/model.common.js @@ -1,7 +1,7 @@ /* * Copyright (c) 2011 Yahoo! Inc. All rights reserved. */ -YUI.add('FlickrDetailModelFlickr', function(Y) { +YUI.add('FlickrDetailModelFlickr', function(Y, NAME) { /** * The FlickrDetailModelFlickr module. @@ -15,7 +15,7 @@ YUI.add('FlickrDetailModelFlickr', function(Y) { * @class FlickrDetailModelFlickr * @constructor */ - Y.mojito.models.flickr = { + Y.mojito.models[NAME] = { /** * Method that will be invoked by the mojit controller to obtain data. diff --git a/tests/func/applications/frameworkapp/usecase/mojits/PagedFlickr/controller.common.js b/tests/func/applications/frameworkapp/usecase/mojits/PagedFlickr/controller.common.js index 976521e14..b983ff494 100644 --- a/tests/func/applications/frameworkapp/usecase/mojits/PagedFlickr/controller.common.js +++ b/tests/func/applications/frameworkapp/usecase/mojits/PagedFlickr/controller.common.js @@ -21,7 +21,7 @@ YUI.add('PagedFlickr', function(Y, NAME) { // parameter is base-0. start = (page-1) * PAGESIZE; - ac.models.get('flickrModel').getFlickrImages('mojito', start, PAGESIZE, function(images) { + ac.models.get('PagedFlickrModel').getFlickrImages('mojito', start, PAGESIZE, function(images) { var dateString = ac.intl.formatDate(new Date()); var data = { diff --git a/tests/func/applications/frameworkapp/usecase/mojits/PagedFlickr/models/model.common.js b/tests/func/applications/frameworkapp/usecase/mojits/PagedFlickr/models/model.common.js index 3dd0693dc..965230983 100644 --- a/tests/func/applications/frameworkapp/usecase/mojits/PagedFlickr/models/model.common.js +++ b/tests/func/applications/frameworkapp/usecase/mojits/PagedFlickr/models/model.common.js @@ -1,9 +1,9 @@ /* * Copyright (c) 2011 Yahoo! Inc. All rights reserved. */ -YUI.add('PagedFlickrModel', function(Y) { +YUI.add('PagedFlickrModel', function(Y, NAME) { - Y.mojito.models.flickrModel = { + Y.mojito.models[NAME] = { getFlickrImages: function(queryString, start, count, callback) { var APP_KEY = '84921e87fb8f2fc338c3ff9bf51a412e'; diff --git a/tests/func/applications/frameworkapp/usecase/mojits/PagedFlickr2/controller.common.js b/tests/func/applications/frameworkapp/usecase/mojits/PagedFlickr2/controller.common.js index ab2a9b4ea..cf30fb430 100644 --- a/tests/func/applications/frameworkapp/usecase/mojits/PagedFlickr2/controller.common.js +++ b/tests/func/applications/frameworkapp/usecase/mojits/PagedFlickr2/controller.common.js @@ -21,7 +21,7 @@ YUI.add('PagedFlickr2', function(Y, NAME) { // parameter is base-0. start = (page-1) * PAGESIZE; - ac.models.get('flickrModel').getFlickrImages('mojito', start, PAGESIZE, function(images) { + ac.models.get('PagedFlickr2Model').getFlickrImages('mojito', start, PAGESIZE, function(images) { var dateString = ac.intl.formatDate(new Date()); Y.log("config1 from controller----"+JSON.stringify(ac.config.get('config1'))); var data = { diff --git a/tests/func/applications/frameworkapp/usecase/mojits/PagedFlickr2/models/model.common.js b/tests/func/applications/frameworkapp/usecase/mojits/PagedFlickr2/models/model.common.js index 6a554a52d..7be3b9fa0 100644 --- a/tests/func/applications/frameworkapp/usecase/mojits/PagedFlickr2/models/model.common.js +++ b/tests/func/applications/frameworkapp/usecase/mojits/PagedFlickr2/models/model.common.js @@ -1,9 +1,9 @@ /* * Copyright (c) 2011 Yahoo! Inc. All rights reserved. */ -YUI.add('PagedFlickr2Model', function(Y) { +YUI.add('PagedFlickr2Model', function(Y, NAME) { - Y.mojito.models.flickrModel = { + Y.mojito.models[NAME] = { getFlickrImages: function(queryString, start, count, callback) { var APP_KEY = '84921e87fb8f2fc338c3ff9bf51a412e'; diff --git a/tests/func/applications/frameworkapp/usecase/mojits/PagedFlickr5/controller.common.js b/tests/func/applications/frameworkapp/usecase/mojits/PagedFlickr5/controller.common.js index b914c91cf..51a7cc642 100644 --- a/tests/func/applications/frameworkapp/usecase/mojits/PagedFlickr5/controller.common.js +++ b/tests/func/applications/frameworkapp/usecase/mojits/PagedFlickr5/controller.common.js @@ -39,7 +39,7 @@ YUI.add('PagedFlickr5', function(Y, NAME) { // parameter is base-0. start = (page-1) * PAGESIZE; - ac.models.get('flickrModel').getFlickrImages('mojito', start, PAGESIZE, function(images) { + ac.models.get('PagedFlickr5Model').getFlickrImages('mojito', start, PAGESIZE, function(images) { var dateString = ac.intl.formatDate(new Date()); var data = { diff --git a/tests/func/applications/frameworkapp/usecase/mojits/PagedFlickr5/models/model.common.js b/tests/func/applications/frameworkapp/usecase/mojits/PagedFlickr5/models/model.common.js index 66ff60ef5..a9d4c4a28 100644 --- a/tests/func/applications/frameworkapp/usecase/mojits/PagedFlickr5/models/model.common.js +++ b/tests/func/applications/frameworkapp/usecase/mojits/PagedFlickr5/models/model.common.js @@ -1,7 +1,7 @@ /* * Copyright (c) 2011 Yahoo! Inc. All rights reserved. */ -YUI.add('PagedFlickr5Model', function(Y) { +YUI.add('PagedFlickr5Model', function(Y, NAME) { /** * The PagedFlickr5Model module. @@ -15,7 +15,7 @@ YUI.add('PagedFlickr5Model', function(Y) { * @class PagedFlickr5Model * @constructor */ - Y.mojito.models.flickr = { + Y.mojito.models[NAME] = { /** * Method that will be invoked by the mojit controller to obtain data. diff --git a/tests/func/applications/frameworkapp/usecase/mojits/i18nMojit/controller.server.js b/tests/func/applications/frameworkapp/usecase/mojits/i18nMojit/controller.server.js index e8b89cc8b..135c4e419 100644 --- a/tests/func/applications/frameworkapp/usecase/mojits/i18nMojit/controller.server.js +++ b/tests/func/applications/frameworkapp/usecase/mojits/i18nMojit/controller.server.js @@ -28,7 +28,7 @@ YUI.add('i18nMojit', function(Y, NAME) { * to the Mojito API. */ index: function(ac) { - ac.models.get('i18nTest').getFlickrImages('mojito', function(images) { + ac.models.get('i18nMojitModel').getFlickrImages('mojito', function(images) { var dateString = ac.intl.formatDate(new Date()); var tempStr = ac.intl.lang("TITLE"); console.log("*********************TITLE: " + tempStr); diff --git a/tests/func/applications/frameworkapp/usecase/mojits/i18nMojit/models/model.server.js b/tests/func/applications/frameworkapp/usecase/mojits/i18nMojit/models/model.server.js index f3a75cd58..3c0100b42 100644 --- a/tests/func/applications/frameworkapp/usecase/mojits/i18nMojit/models/model.server.js +++ b/tests/func/applications/frameworkapp/usecase/mojits/i18nMojit/models/model.server.js @@ -15,7 +15,7 @@ YUI.add('i18nMojitModel', function(Y, NAME) { * @class Model * @constructor */ - Y.mojito.models.i18nTest = { + Y.mojito.models[NAME] = { init: function(mojitSpec) { this.spec = mojitSpec; diff --git a/tests/func/applications/frameworkapp/usecase/mojits/i18n_Mojit/controller.server.js b/tests/func/applications/frameworkapp/usecase/mojits/i18n_Mojit/controller.server.js index 898afa999..de19d36e1 100644 --- a/tests/func/applications/frameworkapp/usecase/mojits/i18n_Mojit/controller.server.js +++ b/tests/func/applications/frameworkapp/usecase/mojits/i18n_Mojit/controller.server.js @@ -10,7 +10,7 @@ YUI.add('i18n_Mojit', function(Y, NAME) { }, index: function(ac) { - ac.models.get('i18nTest').getFlickrImages('mojito', function(images) { + ac.models.get('i18n_MojitModel').getFlickrImages('mojito', function(images) { var dateString = ac.intl.formatDate(new Date()); var tempStr = ac.intl.lang("TITLE"); console.log("*********************TITLE: " + tempStr); diff --git a/tests/func/applications/frameworkapp/usecase/mojits/i18n_Mojit/models/model.server.js b/tests/func/applications/frameworkapp/usecase/mojits/i18n_Mojit/models/model.server.js index 97c0b2a1e..4b2b339c1 100644 --- a/tests/func/applications/frameworkapp/usecase/mojits/i18n_Mojit/models/model.server.js +++ b/tests/func/applications/frameworkapp/usecase/mojits/i18n_Mojit/models/model.server.js @@ -4,7 +4,7 @@ YUI.add('i18n_MojitModel', function(Y, NAME) { - Y.mojito.models.i18nTest = { + Y.mojito.models[NAME] = { init: function(mojitSpec) { this.spec = mojitSpec; From c9aefd9ac93dfb8acda8f1f0ac2de6805f87b2d1 Mon Sep 17 00:00:00 2001 From: Drew Folta Date: Thu, 11 Oct 2012 09:58:29 -0700 Subject: [PATCH 10/10] adapter is always expected to have an error() method --- lib/app/autoload/dispatch.common.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/lib/app/autoload/dispatch.common.js b/lib/app/autoload/dispatch.common.js index 061739d50..38cc8042f 100644 --- a/lib/app/autoload/dispatch.common.js +++ b/lib/app/autoload/dispatch.common.js @@ -102,20 +102,10 @@ YUI.add('mojito-dispatcher', function(Y, NAME) { '\':', 'error', NAME); Y.log(e.message, 'error', NAME); Y.log(e.stack, 'error', NAME); - if (adapter.error) { - adapter.error(e); - } else { - // TODO: should we be rethrowing the error here? We log but we - // don't ensure callers know...but then again dispatch() may - // need this level of isolation. - adapter.done('ERROR'); - } + adapter.error(e); } - perf.done(); // closing the 'ac:ctor' timeline - }); - } };