diff --git a/documentation/MatchMakerFramework.md b/documentation/MatchMakerFramework.md index 46a104230..5dc605373 100644 --- a/documentation/MatchMakerFramework.md +++ b/documentation/MatchMakerFramework.md @@ -114,8 +114,8 @@ The input for these POST requests will be in the following format. Note that it "http://registry.gpii.net/terms/environment/sound": -6 "http://registry.gpii.net/terms/environment/timeOfDay": "18:29:00" }, - solutionsRegistry: { - //stuff from: https://github.com/GPII/universal/blob/master/testData/solutions/win32.json + solutionsRegistryEntries: { + // entries from: https://github.com/GPII/universal/blob/master/testData/solutions/win32.json (or whichever os is the relevent one) merged with the entries from https://github.com/GPII/universal/blob/master/testData/solutions/web.json }, activeContexts: [ "gpii-default", @@ -162,6 +162,11 @@ The return payload from at call to `/match` should be in the following format: "http://registry.gpii.net/applications/com.microsoft.windows.desktop/otherSetting": "reallyBig" } }, + "com.bdigital.easit4all": { + "settings": { + "http://registry.gpii.net/common/fontSize": 25 + } + }, "org.cats": {} } }, diff --git a/gpii/node_modules/flowManager/src/FlowManagerUtilities.js b/gpii/node_modules/flowManager/src/FlowManagerUtilities.js index 224c715f6..38cb0f178 100644 --- a/gpii/node_modules/flowManager/src/FlowManagerUtilities.js +++ b/gpii/node_modules/flowManager/src/FlowManagerUtilities.js @@ -55,7 +55,7 @@ * @return (undefined) - function is asynchronous and doesn't return anything. Instead the event * is fired with the modified mmpayload. */ - gpii.request.flowManager.getSolutions = function (solutionsRegistryDataSource, deviceContext, event) { + gpii.request.flowManager.getSolutions = function (solutionsRegistryDataSource, deviceContext, event, webEvent) { var os = fluid.get(deviceContext, "OS.id"), version = fluid.get(deviceContext, "OS.version"); solutionsRegistryDataSource.get({ @@ -66,6 +66,18 @@ fluid.log("Fetched filtered solutions registry entries: " + JSON.stringify(solutionsRegistryEntries, null, 4)); event.fire(solutionsRegistryEntries); }); + if (deviceContext.OS.id !== "web") { + // if we're getting solutions for an installed system, fetch web solutions as well + solutionsRegistryDataSource.get({ + os: "web" + }, function (solutions) { + // var solutionsRegistryEntries = gpii.matchMakerFramework.filterSolutions(solutions, deviceContext); + fluid.log("Fetched web solutions registry entries: " + JSON.stringify(solutions, null, 4)); + webEvent.fire(solutions); + }); + } else { + webEvent.fire({}); + } }; gpii.request.flowManager.transformLifecycle = function (transformer, contextPayload) { @@ -125,7 +137,7 @@ }, getSolutions: { funcName: "gpii.request.flowManager.getSolutions", - args: [ "{flowManager}.solutionsRegistryDataSource", "{arguments}.0", "{that}.events.onSolutions"] + args: [ "{flowManager}.solutionsRegistryDataSource", "{arguments}.0", "{that}.events.onSolutions", "{that}.events.onWebSolutions"] } }, events: { @@ -134,6 +146,7 @@ onPreferences: null, onDeviceContext: null, onSolutions: null, + onWebSolutions: null, // The "pseudo-event" whose handlers govern the match processing chain processMatch: null, // Output of the matching process - listeners in derived grades @@ -143,13 +156,15 @@ events: { preferences: "onPreferences", deviceContext: "onDeviceContext", - solutions: "onSolutions" + solutions: "onSolutions", + webSolutions: "onWebSolutions" }, args: [{ userToken: "{that}.userToken", preferences: "{arguments}.preferences.0", deviceContext: "{arguments}.deviceContext.0", - solutionsRegistryEntries: "{arguments}.solutions.0" + solutionsRegistryEntries: "{arguments}.solutions.0", + webSolutionsRegistryEntries: "{arguments}.webSolutions.0" }] } }, diff --git a/gpii/node_modules/matchMakerFramework/src/MatchMakerFramework.js b/gpii/node_modules/matchMakerFramework/src/MatchMakerFramework.js index beae08b1a..2e1b1a077 100644 --- a/gpii/node_modules/matchMakerFramework/src/MatchMakerFramework.js +++ b/gpii/node_modules/matchMakerFramework/src/MatchMakerFramework.js @@ -64,6 +64,10 @@ * userToken, preferences, deviceContext, solutionsRegistryEntry */ gpii.matchMakerFramework.preProcess = function (that, initialPayload) { + // merge the OS solutions registry with the web-based solutions registry: + initialPayload.solutionsRegistryEntries = $.extend({}, + initialPayload.webSolutionsRegistryEntries, initialPayload.solutionsRegistryEntries); + delete initialPayload.webSolutionsRegistryEntries; var matchMakerInput = $.extend({ activeContexts: [ // TODO calculate properly "gpii-default" diff --git a/gpii/node_modules/testing/src/Integration.js b/gpii/node_modules/testing/src/Integration.js index e9bd8c450..a99d671ca 100644 --- a/gpii/node_modules/testing/src/Integration.js +++ b/gpii/node_modules/testing/src/Integration.js @@ -336,7 +336,8 @@ fluid.defaults("gpii.test.integration.mockSettingsHandlerRegistry.universal", { "gpii.settingsHandlers.JSONSettingsHandler": { optionsPathKey: "filename" }, - "gpii.settingsHandlers.webSockets" : {} + "gpii.settingsHandlers.webSockets": {}, + "gpii.settingsHandlers.noSettings": {} } }); diff --git a/testData/preferences/acceptanceTests/webtest_font_size.json b/testData/preferences/acceptanceTests/webtest_font_size.json new file mode 100644 index 000000000..a2d1a9930 --- /dev/null +++ b/testData/preferences/acceptanceTests/webtest_font_size.json @@ -0,0 +1,17 @@ +{ + "flat": { + "contexts": { + "gpii-default": { + "name": "Default preferences", + "preferences": { + "http://registry.gpii.net/common/fontSize": 16, + "http://registry.gpii.net/common/screenReaderTTSEnabled": false, + "http://registry.gpii.net/common/magnifierEnabled": false, + "http://registry.gpii.net/common/magnification": 1, + "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/invertColours": false + } + } + } + } +} \ No newline at end of file diff --git a/testData/solutions/web.json b/testData/solutions/web.json index 5bbd1955a..f25f2e919 100644 --- a/testData/solutions/web.json +++ b/testData/solutions/web.json @@ -605,7 +605,13 @@ "pictogramsEnabled": "http://registry\\.gpii\\.net/common/pictogramsEnabled" } } - } + }, + "configure": [ + "settings.conf" + ], + "restore": [ + "settings.conf" + ] } } diff --git a/tests/SolutionRegistryMergingTests.js b/tests/SolutionRegistryMergingTests.js new file mode 100644 index 000000000..cde0975d8 --- /dev/null +++ b/tests/SolutionRegistryMergingTests.js @@ -0,0 +1,97 @@ +/** +GPII Solution Registry Retrieval and Merging Tests + +These tests ensures that we're correctly retrieving the solutions registry for the current platform +as well as the web platform. Furthermore, we're testing that these are used in the matchMaking +process + +Copyright 2014 Raising the Floor - International + +Licensed under the New BSD license. You may not use this file except in +compliance with this License. + +The research leading to these results has received funding from the European Union's +Seventh Framework Programme (FP7/2007-2013) under grant agreement no. 289016. + +You may obtain a copy of the License at +https://github.com/GPII/universal/blob/master/LICENSE.txt +*/ + + +"use strict"; + +var fluid = require("infusion"), + kettle = fluid.registerNamespace("kettle"), + path = require("path"), + jqUnit = jqUnit || fluid.require("jqUnit"), + gpii = fluid.registerNamespace("gpii"); + +fluid.registerNamespace("gpii.tests.solutionRegistryMerging"); + +require("../index.js"); + +gpii.loadTestingSupport(); + +gpii.tests.solutionRegistryMerging.data = { + "settingsHandlers": { + "gpii.settingsHandlers.noSettings": { + "data": [{ + "settings": { + "signLanguage": "ils", + "textSize": 1.3333333333333333 + } + }] + }, + "gpii.settingsHandlers.webSockets": { + "data": [{ + "settings": { + "fontSize": "large" + } + }] + } + } +}; + +gpii.tests.solutionRegistryMerging.fixtures = [ + { + name: "Configuration retrieved by lifecycle manager", + expect: 2, + sequence: [ + { + "func": "gpii.test.expandSettings", + args: [ "{tests}", [ "contexts" ]] + }, { + func: "{loginRequest}.send" + }, { + event: "{loginRequest}.events.onComplete", + listener: "gpii.test.loginRequestListen" + }, + { + func: "gpii.test.checkConfiguration", + args: ["{tests}.data.settingsHandlers", "{nameResolver}"] + } + ] + } +]; + +gpii.tests.solutionRegistryMerging.buildTestFixtures = function (fixtures) { + return fluid.transform(fixtures, function (fixture) { + var testDef = { + name: fixture.name, + userToken: "webtest_font_size", + expect: fixture.expect, + gradeNames: "gpii.test.integration.testCaseHolder.linux", + config: { + configName: "linux-chrome-config", + configPath: path.resolve(__dirname, "platform/linux/configs") + }, + sequence: fixture.sequence, + data: gpii.tests.solutionRegistryMerging.data + }; + + return testDef; + }); +}; + +kettle.test.bootstrapServer(gpii.tests.solutionRegistryMerging.buildTestFixtures( + gpii.tests.solutionRegistryMerging.fixtures)); \ No newline at end of file