From 899d5ba2a7a4cdf74b9f49123dc5f82a3204fa41 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 1 Mar 2017 09:21:07 +0100 Subject: [PATCH 01/44] GPII-442: Using dynamic device reporter in most tests --- .../contextManager/src/ContextManager.js | 10 +- .../lifecycleManager/src/LifecycleManager.js | 34 ++-- .../processReporter/src/ProcessReporter.js | 40 +++-- gpii/node_modules/settingsHandlers/index.js | 1 + .../settingsHandlers/src/LaunchHandlers.js | 67 +++++++ .../src/settingsHandlerUtilities.js | 14 +- gpii/node_modules/testing/src/Integration.js | 37 +++- gpii/node_modules/testing/src/Testing.js | 13 +- .../acceptanceTests/linux_builtIn.json | 3 + .../acceptanceTests/os_common.json | 3 +- testData/solutions/linux.json5 | 163 +++++++----------- 11 files changed, 235 insertions(+), 150 deletions(-) create mode 100644 gpii/node_modules/settingsHandlers/src/LaunchHandlers.js diff --git a/gpii/node_modules/contextManager/src/ContextManager.js b/gpii/node_modules/contextManager/src/ContextManager.js index 1b6f4d5c2..d6b19a6f4 100644 --- a/gpii/node_modules/contextManager/src/ContextManager.js +++ b/gpii/node_modules/contextManager/src/ContextManager.js @@ -104,7 +104,7 @@ fluid.defaults("gpii.contextManager", { gpii.contextManager.onEnvironmentChanged = function (that, body) { var newContext = fluid.copy(body); delete newContext.timestamp; - fluid.log("contextManager: Updating context with: " + JSON.stringify(newContext, null, 4)); + fluid.log(fluid.logLevel.TRACE, "contextManager: Updating context with: " + JSON.stringify(newContext, null, 4)); that.applier.change("currentContext", newContext); }; @@ -154,7 +154,7 @@ gpii.contextManager.stopTemporalEnvironmentReporter = function (that) { * @that {Object} The context manager object * @lifecycleManager {Object} the lifecycleManager component from which the current * session will be retrieved - * @context {Object} The model as reporterd by the changeApplier (ie. the content of + * @context {Object} The model as reported by the changeApplier (ie. the content of * that.model.currentContext) **/ gpii.contextManager.evaluateConditions = function (that, lifecycleManager, context) { @@ -166,9 +166,9 @@ gpii.contextManager.evaluateConditions = function (that, lifecycleManager, conte } var activeSession = lifecycleManager.getSession(activeSessions); var newActiveContexts = gpii.contextManager.utils.findActiveContexts(context, activeSession.model.matchMakerOutput); - fluid.log("contextManager: New active contexts: " + newActiveContexts); - if (newActiveContexts[0] === activeSession.activeContextName) { - fluid.log("contextManager: Same context as before (" + activeSession.model.appliedContext + ") so doing nothing"); + fluid.log(fluid.logLevel.TRACE, "contextManager: New active contexts: " + newActiveContexts); + if (newActiveContexts[0] === activeSession.model.activeContextName) { + fluid.log(fluid.logLevel.TRACE, "contextManager: Same context as before (" + activeSession.model.activeContextName + ") so doing nothing"); return; } var activeConfiguration = activeSession.model.matchMakerOutput.inferredConfiguration[newActiveContexts[0]]; diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index d2832cdd2..e73189572 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -96,8 +96,8 @@ var gpii = fluid.registerNamespace("gpii"); }, invokeSettingsHandler: { funcName: "gpii.lifecycleManager.invokeSettingsHandler", - args: ["{that}", "{arguments}.0", "{arguments}.1", "{arguments}.2"] - // solutionId, settingsHandlers, isMultiSH + args: ["{that}", "{arguments}.0", "{arguments}.1"] + // solutionId, settingsHandlers }, restoreSnapshot: { funcName: "gpii.lifecycleManager.restoreSnapshot", @@ -134,21 +134,13 @@ var gpii = fluid.registerNamespace("gpii"); /** Transforms the handlerSpec (handler part of the transformer's response payload) to a form * accepted by a settingsHandler - we use a 1-element array holding the payload for a single solution * per handler - * @param isMultiSH {boolean} is a flag denoting whether it's a multi-settingshandler solution - * If it is, a supported settings block is required for each entry */ - gpii.lifecycleManager.specToSettingsHandler = function (solutionId, handlerSpec, isMultiSH) { + gpii.lifecycleManager.specToSettingsHandler = function (solutionId, handlerSpec) { var returnObj = {}, settings = {}; if (handlerSpec.supportedSettings === undefined) { - if (isMultiSH) { - fluid.fail("Solution " + solutionId + " has multiple settingshandlers but is missing " + - "the 'supportedSettings' directive. Will not set the settings for this settingshandler"); - } else { - // if supportedSettings directive is not present, pass all settings: - settings = handlerSpec.settings; - } + settings = handlerSpec.settings; } else { // we cant simply use fluid.filterKeys because that wont handle the cases where // there are 'undefined' values for the keys in handlerSpec.settings @@ -164,7 +156,7 @@ var gpii = fluid.registerNamespace("gpii"); options: handlerSpec.options }]; - return returnObj; // NB array removed here + return returnObj; }; // Transform the response from the handler SET to a format that we can persist in models before passing to handler SET on restore @@ -181,16 +173,15 @@ var gpii = fluid.registerNamespace("gpii"); /** * @param handlerSpec {Object} A single settings handler specification - * @param isMultiSH {Boolean} [optional] if present and true, the solution has multiple settingshandlers * Payload example: * http://wiki.gpii.net/index.php/Settings_Handler_Payload_Examples * Transformer output: * http://wiki.gpii.net/index.php/Transformer_Payload_Examples */ - gpii.lifecycleManager.invokeSettingsHandler = function (that, solutionId, handlerSpec, isMultiSH) { + gpii.lifecycleManager.invokeSettingsHandler = function (that, solutionId, handlerSpec) { // first prepare the payload for the settingsHandler in question - a more efficient // implementation might bulk together payloads destined for the same handler - var settingsHandlerPayload = gpii.lifecycleManager.specToSettingsHandler(solutionId, handlerSpec, isMultiSH); + var settingsHandlerPayload = gpii.lifecycleManager.specToSettingsHandler(solutionId, handlerSpec); var resolvedName = that.nameResolver.resolveName(handlerSpec.type, "settingsHandler"); var setSettingsPromise = gpii.settingsHandlers.dispatchSettingsHandler(resolvedName, settingsHandlerPayload, that.options.retryOptions); var togo = fluid.promise(); @@ -265,7 +256,6 @@ var gpii = fluid.registerNamespace("gpii"); * that will be resolved once the settings are successfully set. */ gpii.lifecycleManager.executeSettingsAction = function (that, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction) { - var isMultiSH = Object.keys(solutionRecord.settingsHandlers).length > 1; var settingsHandlerBlock = solutionRecord.settingsHandlers[settingsHandlerBlockName]; if (settingsHandlerBlock === undefined) { fluid.fail("Reference to non-existing settingsHandler block named " + settingsHandlerBlockName + @@ -273,7 +263,7 @@ var gpii = fluid.registerNamespace("gpii"); } return function () { var expanded = session.localResolver(settingsHandlerBlock); - var settingsPromise = that.invokeSettingsHandler(solutionId, expanded, isMultiSH); + var settingsPromise = that.invokeSettingsHandler(solutionId, expanded); settingsPromise.then(function (snapshot) { session.applier.change(["appliedSolutions", solutionId], solutionRecord); gpii.lifecycleManager.recordSnapshotInSession(that, snapshot, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction); @@ -335,6 +325,12 @@ var gpii = fluid.registerNamespace("gpii"); // the settings handler block) if (action.indexOf("settings.") === 0) { var settingsHandlerBlockName = action.substring("settings.".length); + // if this is related to launching, overwrite entry with the appropriate settings, + // that is: { running: true } if we're in a start block, else { running: false } + if (actionBlock === "start" || actionBlock === "stop") { + var launchSettings = { running: actionBlock === "start" ? true : false }; + fluid.set(solutionRecord, [ "settingsHandlers", settingsHandlerBlockName, "settings"], launchSettings); + } return gpii.lifecycleManager.executeSettingsAction(that, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction); } else if (actionBlock === "update") { // Keywords: "start", "stop", "configure" are allowed here as well, and @@ -352,7 +348,7 @@ var gpii = fluid.registerNamespace("gpii"); " inside 'update' section for solution " + solutionId); } } - } else { // TODO should be removed when GPII-1235 has been solved (lifecycle actions are settings handlers) + } else { // TODO should be removed when GPII-1235 has been solved (lifecycle actions are settings handlers) // TODO KASPER remove this return function () { var expanded = session.localResolver(action); var result = gpii.lifecycleManager.invokeAction(expanded, that.nameResolver); diff --git a/gpii/node_modules/processReporter/src/ProcessReporter.js b/gpii/node_modules/processReporter/src/ProcessReporter.js index 2e1cf9745..74176dce6 100644 --- a/gpii/node_modules/processReporter/src/ProcessReporter.js +++ b/gpii/node_modules/processReporter/src/ProcessReporter.js @@ -157,30 +157,46 @@ fluid.defaults("gpii.processReporter.live", { }, handleIsRunning: { funcName: "gpii.processReporter.live.handleIsRunning", - args: ["{arguments}.0", "{arguments}.1", "{processReporter}"] - // entry, entry id, processReporter + args: ["{arguments}.0"] + // entry } } }); -gpii.processReporter.live.handleIsRunning = function (entry, entryId, processReporter) { - var runningSolution = null; +/* Marker function for use in isRunning sections of a launch handler + * to identify in a meaningful way that the solutions start block should always + * be run. + */ +fluid.defaults("gpii.processReporter.neverRunning", { + gradeNames: "fluid.function", + argumentMap: {} +}); + +gpii.processReporter.neverRunning = function () { + return false; +}; + +/** + * Runs the 'isRunning' entries of the 'entry' argument. If no 'isRunning' block is present + * undefined is returned + */ +gpii.processReporter.live.handleIsRunning = function (entry) { + var running = undefined; if (!!entry.isRunning) { - runningSolution = { id: entryId, isRunning: true }; + running = true; fluid.each (entry.isRunning, function (aMember) { - var resolvedName = processReporter.nameResolver.resolveName(aMember.type, "processReporter"); - var partial = fluid.invokeGradedFunction(resolvedName, aMember); - runningSolution.isRunning = runningSolution.isRunning && partial; + var partial = fluid.invokeGradedFunction(aMember.type, aMember); + running = running && partial; }); } - return runningSolution; + return running; }; gpii.processReporter.live.get = function (request, processReporter, solutionsRegistryDataSource) { var runningSolutions = []; solutionsRegistryDataSource.get({os: processReporter.platformReporter.reportPlatform().id}, function onSuccess(entries) { - fluid.each(entries, function (entry, entryId) { - var foundEntry = gpii.processReporter.live.handleIsRunning(entry, entryId, processReporter); + fluid.each(entries, function (entry) { + var foundEntry = gpii.processReporter.live.handleIsRunning(entry); if (foundEntry !== null) { runningSolutions.push(foundEntry); } @@ -194,7 +210,7 @@ gpii.processReporter.live.getProcess = function (request, processReporter, solut solutionsRegistryDataSource.get({os: processReporter.platformReporter.reportPlatform().id}, function onSuccess(entries) { var result = fluid.find(entries, function (anEntry, entryID) { if (entryID === solutionID) { - return gpii.processReporter.live.handleIsRunning(anEntry, entryID, processReporter); + return gpii.processReporter.live.handleIsRunning(anEntry); } }, null); if (result === null) { diff --git a/gpii/node_modules/settingsHandlers/index.js b/gpii/node_modules/settingsHandlers/index.js index 9b3e1ebe1..0d0199a92 100644 --- a/gpii/node_modules/settingsHandlers/index.js +++ b/gpii/node_modules/settingsHandlers/index.js @@ -9,3 +9,4 @@ require("./src/XMLSettingsHandler.js"); require("./src/JSONSettingsHandler.js"); require("./src/WebSocketsSettingsHandler.js"); require("./src/NoSettingsHandler.js"); +require("./src/LaunchHandlers.js"); diff --git a/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js b/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js new file mode 100644 index 000000000..c0275b2d0 --- /dev/null +++ b/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js @@ -0,0 +1,67 @@ +/* + * GPII JSON Settings Handler + * + * Copyright 2017 Raising the Floor - International + * + * Licensed under the New BSD license. You may not use this file except in + * compliance with this License. + * + * You may obtain a copy of the License at + * https://github.com/GPII/universal/blob/master/LICENSE.txt + */ + +"use strict"; + +var fluid = require("infusion"), + gpii = fluid.registerNamespace("gpii"); + +fluid.registerNamespace("gpii.launchHandlers"); +fluid.registerNamespace("gpii.launchHandlers.flexibleHandler"); + + +gpii.launchHandlers.flexibleHandler.set = function (payload) { + return fluid.transform(payload, function (allSettingsBlocks, solutionId) { + return fluid.transform(allSettingsBlocks, function (handlerData) { + // find desire state { running: X } + var desiredState = handlerData.settings.running; + if (desiredState !== true && desiredState !== false) { + fluid.fail("Unable to set the launch state of ", solutionId, " to ", desiredState); + } + + // get current state + var currentState = gpii.launchHandlers.flexibleHandler.executeIsRunningBlock(handlerData.options, solutionId); + + // if not in desired state + if (currentState !== desiredState) { + desiredState === true ? + gpii.launchHandlers.flexibleHandler.executeStartBlock(handlerData) : + gpii.launchHandlers.flexibleHandler.executeStopBlock(handlerData); + } + + return gpii.settingsHandlers.setSettings(handlerData, { running: currentState }); + }); + }); +}; + +gpii.launchHandlers.flexibleHandler.get = function (payload) { + return fluid.transform(payload, function (allSettingsBlocks, solutionId) { + return fluid.transform(allSettingsBlocks, function (handlerData) { + var currentState = gpii.launchHandlers.flexibleHandler.executeIsRunningBlock(handlerData.options, solutionId); + return { settings: { running: currentState }}; + }); + }); +}; + +gpii.launchHandlers.flexibleHandler.executeStartBlock = function (mainEntry) { + var startBlock = fluid.get(mainEntry, [ "options", "start" ]); + fluid.invokeGradedFunction(startBlock.type, startBlock); +}; + +gpii.launchHandlers.flexibleHandler.executeStopBlock = function (mainEntry) { + var stopBlock = fluid.get(mainEntry, [ "options", "stop" ]); + fluid.invokeGradedFunction(stopBlock.type, stopBlock); +}; + +gpii.launchHandlers.flexibleHandler.executeIsRunningBlock = function (options) { + return gpii.processReporter.live.handleIsRunning(options); +}; diff --git a/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js b/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js index 02a4ed55d..91ebd0ff6 100644 --- a/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js +++ b/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js @@ -72,9 +72,9 @@ fluid.registerNamespace("gpii.settingsHandlers"); * @return The transformed payload-structured value */ gpii.settingsHandlers.transformPayload = function (payload, handler) { - return fluid.transform(payload, function (oneSolution, solutionPath) { + return fluid.transform(payload, function (oneSolution, solutionId) { return fluid.transform(oneSolution, function (oneSetting, settingPath) { - var path = [solutionPath, settingPath]; + var path = [solutionId, settingPath]; return handler(oneSetting, path, oneSolution); }); }); @@ -138,16 +138,16 @@ gpii.settingsHandlers.numberify = function (payload) { * @return A promise yielding the combined payload expected from a top-level settings handler - this * will resolve synchronously if the supplied handler function is synchronous ("ZALGO" notwithstanding) **/ - gpii.settingsHandlers.invokeSettingsHandler = function (handler, payload) { var worklist = []; var response = gpii.settingsHandlers.transformPayload(payload, function (element, path) { + var solutionId = path[0]; // first entry of path will always be solution ID // Note shallow copy performed within filterKeys var directLoad = fluid.filterKeys(element, ["settings", "options"]); var others = fluid.censorKeys(element, ["settings", "options"]); worklist.push({ path: path, - result: handler(directLoad), + result: handler(directLoad, solutionId), others: others }); return {}; // construct isomorphic skeleton of response @@ -304,8 +304,12 @@ gpii.settingsHandlers.invokeSetHandler = function (resolvedName, payload) { * that matches, or else a rejection if the GET payloads never match after the end of the nominated retry period */ gpii.settingsHandlers.invokeRetryingHandler = function (resolvedName, payload, retryOptions) { + // solution entry options overwrites any component options on retrying + var solutionIds = fluid.keys(payload); + var solutionRetryOptions = fluid.get(payload, [solutionIds[0], 0, "options", "retryOptions"]); + var mergedRetryOptions = fluid.extend(true, {}, retryOptions, solutionRetryOptions); var that = { - retryOptions: retryOptions, + retryOptions: mergedRetryOptions, retries: 1, payload: payload, resolvedName: resolvedName, diff --git a/gpii/node_modules/testing/src/Integration.js b/gpii/node_modules/testing/src/Integration.js index 3098d332b..b8c296a4d 100644 --- a/gpii/node_modules/testing/src/Integration.js +++ b/gpii/node_modules/testing/src/Integration.js @@ -39,6 +39,17 @@ gpii.test.integration.exec.exec = function (that, processSpec /*, expected */) { that.events.onExecExit.fire(true, processSpec); }; +gpii.test.integration.prepopulateSettingsStore = function (testCaseHolder, settings) { + fluid.extend(true, testCaseHolder.settingsStore, { orig: settings }); +}; + +gpii.test.integration.prepopulateSettingsSequence = fluid.freezeRecursive([ + { + func: "gpii.test.integration.prepopulateSettingsStore", + args: [ "{testCaseHolder}", "{testCaseHolder}.options.integrationPrepopulation" ] + } +]); + fluid.defaults("gpii.test.integration.testCaseHolder", { gradeNames: ["gpii.test.common.testCaseHolder"], // TODO: Namespace these distributions so they can be overridden @@ -206,7 +217,8 @@ fluid.defaults("gpii.test.integration.mockSettingsHandler", { }, setImpl: { funcName: "gpii.test.integration.mockSettingsHandler.setImpl", - args: ["{that}", "{arguments}.0"] + args: ["{that}", "{arguments}.0", "{arguments}.1"] + // set payload, solutionId }, get: { funcName: "gpii.test.integration.mockSettingsHandler.get", @@ -214,17 +226,18 @@ fluid.defaults("gpii.test.integration.mockSettingsHandler", { }, getImpl: { funcName: "gpii.test.integration.mockSettingsHandler.getImpl", - args: ["{that}", "{arguments}.0"] + args: ["{that}", "{arguments}.0", "{arguments}.1"] + // get payload, solutionId } } }); -gpii.test.integration.resolveHandlerKey = function (that, payload) { +gpii.test.integration.resolveHandlerKey = function (that, payload, solutionId) { var pathKey = that.options.optionsPathKey; if (typeof(pathKey) === "string") { return fluid.get(payload.options, pathKey); } else if (typeof(pathKey) === "function") { - return pathKey(payload.options); + return pathKey(payload.options, solutionId); } }; @@ -259,9 +272,9 @@ gpii.test.integration.mockSettingsHandler.returnAsyncResponse = function (value, } }; -gpii.test.integration.mockSettingsHandler.setImpl = function (that, payload) { +gpii.test.integration.mockSettingsHandler.setImpl = function (that, payload, solutionId) { var setSettings = function () { - var key = gpii.test.integration.resolveHandlerKey(that, payload); + var key = gpii.test.integration.resolveHandlerKey(that, payload, solutionId); var oldStore = fluid.copy(that.settingsStore[key]) || {}; var store = (that.settingsStore[key] = that.settingsStore[key] || {}); var applySettings = function () { @@ -283,8 +296,8 @@ gpii.test.integration.mockSettingsHandler.set = function (that, payload) { return gpii.settingsHandlers.invokeSettingsHandler(that.setImpl, payload); }; -gpii.test.integration.mockSettingsHandler.getImpl = function (that, payload) { - var key = gpii.test.integration.resolveHandlerKey(that, payload); +gpii.test.integration.mockSettingsHandler.getImpl = function (that, payload, solutionId) { + var key = gpii.test.integration.resolveHandlerKey(that, payload, solutionId); var store = that.settingsStore[key] || {}; var response = fluid.transform(payload.settings, function (value, key) { return store[key]; @@ -297,8 +310,11 @@ gpii.test.integration.mockSettingsHandler.get = function (that, payload) { return gpii.settingsHandlers.invokeSettingsHandler(that.getImpl, payload); }; -// The platform-specific registry of mock settings handlers +gpii.test.integration.flexibleHandlerKey = function (options, solutionId) { + return solutionId + ".flexibleHandler"; +}; +// The platform-specific registry of mock settings handlers gpii.test.integration.registrySettingsHandlerKey = function (options) { return options.hKey + "|" + options.path; }; @@ -360,6 +376,9 @@ fluid.defaults("gpii.test.integration.mockSettingsHandlerRegistry.universal", { "gpii.settingsHandlers.JSONSettingsHandler": { optionsPathKey: "filename" }, + "gpii.launchHandlers.flexibleHandler": { + optionsPathKey: gpii.test.integration.flexibleHandlerKey + }, "gpii.settingsHandlers.webSockets" : {} } }); diff --git a/gpii/node_modules/testing/src/Testing.js b/gpii/node_modules/testing/src/Testing.js index 3fdff025a..5c767c593 100644 --- a/gpii/node_modules/testing/src/Testing.js +++ b/gpii/node_modules/testing/src/Testing.js @@ -165,7 +165,8 @@ gpii.test.operateSettings = function (settingsHandlers, nameResolver, method) { gpii.test.snapshotSettings = function (settingsHandlers, settingsStore, nameResolver, onComplete) { var origPromise = gpii.test.getSettings(settingsHandlers, nameResolver); origPromise.then(function (origSettings) { - settingsStore.orig = origSettings; + // any settings already defined in settingsStore.org overwrites the ones read by snapshotter + settingsStore.orig = fluid.extend(true, origSettings, settingsStore.orig); onComplete(); }); }; @@ -391,8 +392,11 @@ gpii.test.push = function (array, elements) { /** Build a test fixture for integration/acceptance tests operating the stereotypical workflow - * snapshot, login, expectConfigured, logout and expectRestored */ - gpii.test.buildSingleTestFixture = function (testDef, rootGrades) { + var isIntegrationTest = fluid.find(rootGrades, function (val) { + return val.startsWith("gpii.test.integration") ? true : undefined; + }); + var processes = testDef.processes || []; testDef.gradeNames = fluid.makeArray(testDef.gradeNames).concat(fluid.makeArray(rootGrades)); @@ -402,6 +406,11 @@ gpii.test.buildSingleTestFixture = function (testDef, rootGrades) { gpii.test.unshift(testDef.sequence, gpii.test.loginSequence); gpii.test.unshift(testDef.sequence, gpii.test.initialSequence); + // if integration test, prepopulate 'settings' for process reporter + if (isIntegrationTest) { + gpii.test.unshift(testDef.sequence, gpii.test.integration.prepopulateSettingsSequence); + } + // For each process, run the command, then check that we get the expected output testDef.sequence = testDef.sequence.concat(gpii.test.createProcessChecks(processes, "expectConfigured")); diff --git a/testData/deviceReporter/acceptanceTests/linux_builtIn.json b/testData/deviceReporter/acceptanceTests/linux_builtIn.json index e0fbf462b..23b554fb1 100644 --- a/testData/deviceReporter/acceptanceTests/linux_builtIn.json +++ b/testData/deviceReporter/acceptanceTests/linux_builtIn.json @@ -10,5 +10,8 @@ }, { "id": "org.gnome.desktop.a11y.keyboard" + }, + { + "id": "org.gnome.desktop.a11y.applications.onscreen-keyboard" } ] diff --git a/testData/preferences/acceptanceTests/os_common.json b/testData/preferences/acceptanceTests/os_common.json index f2051074c..fc3f21153 100644 --- a/testData/preferences/acceptanceTests/os_common.json +++ b/testData/preferences/acceptanceTests/os_common.json @@ -17,7 +17,8 @@ "http://registry.gpii.net/common/cursorSpeed": 1, "http://registry.gpii.net/common/stickyKeys": true, "http://registry.gpii.net/common/debounceEnable": true, - "http://registry.gpii.net/common/debounceInterval": 1 + "http://registry.gpii.net/common/debounceInterval": 1, + "http://registry.gpii.net/common/onScreenKeyboardEnabled": true } } } diff --git a/testData/solutions/linux.json5 b/testData/solutions/linux.json5 index 7f3a0976e..3da5c3dfc 100644 --- a/testData/solutions/linux.json5 +++ b/testData/solutions/linux.json5 @@ -75,6 +75,31 @@ } ] } + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": { + "type": "gpii.launch.exec", + "command": "gsettings set org.gnome.desktop.a11y.applications screen-magnifier-enabled true" + }, + "stop": { + "type": "gpii.launch.exec", + "command": "gsettings set org.gnome.desktop.a11y.applications screen-magnifier-enabled false" + }, + "isRunning": [ + { + "type": "gpii.processReporter.find", + "command": "gnome-shell" + }, + { + "type": "gpii.processReporter.checkSetting", + "schema": "org.gnome.desktop.a11y.applications", + "setting": "screen-magnifier-enabled", + "value": true + } + ] + } } }, "update": [ @@ -87,34 +112,16 @@ "settings.configuration" ], "start": [ - { - "type": "gpii.launch.exec", - "command": "gsettings set org.gnome.desktop.a11y.applications screen-magnifier-enabled true" - } + "settings.launcher" ], "stop": [ - { - "type": "gpii.launch.exec", - "command": "gsettings set org.gnome.desktop.a11y.applications screen-magnifier-enabled false" - } + "settings.launcher" ], "isInstalled": [ { "type": "gpii.packageKit.find", "name": "gnome-shell" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "gnome-shell" - }, - { - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-magnifier-enabled", - "value": true - } ] }, @@ -231,12 +238,6 @@ "type": "gpii.packageKit.find", "name": "gsettings-desktop-schemas" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "dunno" - } ] }, @@ -273,12 +274,6 @@ "type": "gpii.packageKit.find", "name": "nautilus" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "nautilus" - } ] }, @@ -296,31 +291,36 @@ "capabilities": [ "http://registry\\.gpii\\.net/common/onScreenKeyboardEnabled" ] + }, + "launching": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": { + "type": "gpii.launch.exec", + "command": "gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled true" + }, + "stop": { + "type": "gpii.launch.exec", + "command": "gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled false" + }, + "isRunning": { + "type": "gpii.processReporter.find", + "command": "caribou" + } // TODO KASPER: add gsettings check as well + } } }, "start": [ - { - "type": "gpii.launch.exec", - "command": "gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled true" - } + "settings.launching" ], "stop": [ - { - "type": "gpii.launch.exec", - "command": "gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled false" - } + "settings.launching" ], "isInstalled": [ { "type": "gpii.packageKit.find", "name": "gnome-shell" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "caribou" - } ] }, @@ -393,12 +393,6 @@ "type": "gpii.packageKit.find", "name": "gsettings-desktop-schemas" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "gnome-settings-daemon" - } ] }, @@ -1080,6 +1074,23 @@ } ] } + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": { + "type": "gpii.launch.exec", + "command": "gsettings set org.gnome.desktop.a11y.applications screen-reader-enabled true" + }, + "stop": { + "type": "gpii.launch.exec", + "command": "gsettings set org.gnome.desktop.a11y.applications screen-reader-enabled false" + }, + "isRunning": { + "type": "gpii.processReporter.find", + "command": "orca" + } + } } }, "configure": [ @@ -1089,28 +1100,16 @@ "settings.configuration" ], "start": [ - { - "type": "gpii.launch.exec", - "command": "gsettings set org.gnome.desktop.a11y.applications screen-reader-enabled true" - } + "settings.launcher" ], "stop": [ - { - "type": "gpii.launch.exec", - "command": "gsettings set org.gnome.desktop.a11y.applications screen-reader-enabled false" - } + "settings.launcher" ], "isInstalled": [ { "type": "gpii.packageKit.find", "name": "orca" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "orca" - } ] }, @@ -1157,12 +1156,6 @@ "type": "gpii.packageKit.find", "name": "alsa-lib" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "alsactl" - } ] }, @@ -1209,12 +1202,6 @@ "type": "gpii.packageKit.find", "name": "google-chrome-unstable" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "chrome" - } ] }, @@ -1261,12 +1248,6 @@ "type": "gpii.packageKit.find", "name": "google-chrome-unstable" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "chrome" - } ] }, @@ -1313,12 +1294,6 @@ "type": "gpii.packageKit.find", "name": "google-chrome-unstable" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "chrome" - } ] }, @@ -1339,14 +1314,8 @@ "configure": [ "settings.configuration" ], - "stop": [ + "restore": [ "settings.configuration" - ], - "isInstalled": [ - { - "type": "gpii.packageKit.find", - "name": "libXrandr" - } ] }, From 9df79311059741464f4c1e0c79324f87948c776a Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 1 Mar 2017 09:21:27 +0100 Subject: [PATCH 02/44] GPII-442: Using dynamic device reporter in most tests --- testData/solutions/linux.json5 | 110 +++-- testData/solutions/win32.json5 | 433 +++++++++++------- .../platform/linux/linux-builtIn-testSpec.js | 123 ++++- .../linux-dynamicDeviceReporter-testSpec.js | 75 +++ .../linux-dynamicDeviceReporter-testSpec.txt | 2 +- tests/platform/linux/linux-orca-testSpec.js | 81 +++- .../windows/windows-builtIn-testSpec.js | 147 +++++- .../windows-dynamicDeviceReporter-testSpec.js | 49 +- .../platform/windows/windows-jaws-testSpec.js | 100 +++- .../windows/windows-maavis-testSpec.js | 50 +- .../platform/windows/windows-nvda-testSpec.js | 75 ++- .../windows/windows-readWrite-testSpec.js | 50 +- 12 files changed, 1052 insertions(+), 243 deletions(-) diff --git a/testData/solutions/linux.json5 b/testData/solutions/linux.json5 index 3da5c3dfc..3719d3d5b 100644 --- a/testData/solutions/linux.json5 +++ b/testData/solutions/linux.json5 @@ -303,10 +303,15 @@ "type": "gpii.launch.exec", "command": "gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled false" }, - "isRunning": { - "type": "gpii.processReporter.find", - "command": "caribou" - } // TODO KASPER: add gsettings check as well + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "caribou", + }, { + "type": "gpii.processReporter.checkSetting", + "schema": "org.gnome.desktop.a11y.applications", + "setting": "screen-keyboard-enabled", + "value": true + }] } } }, @@ -1078,6 +1083,11 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { + "verifySettings": true, + "retryOptions": { + "rewriteEvery": 0, + retryInterval: 200 + }, "start": { "type": "gpii.launch.exec", "command": "gsettings set org.gnome.desktop.a11y.applications screen-reader-enabled true" @@ -1086,10 +1096,12 @@ "type": "gpii.launch.exec", "command": "gsettings set org.gnome.desktop.a11y.applications screen-reader-enabled false" }, - "isRunning": { - "type": "gpii.processReporter.find", - "command": "orca" - } + "isRunning": [{ // GPII-2306: Add check for Orca process + "type": "gpii.processReporter.checkSetting", + "schema": "org.gnome.desktop.a11y.applications", + "setting": "screen-reader-enabled", + "value": true + }] } } }, @@ -1175,19 +1187,29 @@ "capabilities": [ "http://registry\\.gpii\\.net/common/simplification" ] + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": { + "type": "gpii.launch.exec", + "command": "google-chrome http://easy123.org/user/${{userToken}}" + }, + "stop": { + "type": "gpii.launch.exec", + "command": "pkill -2 chrome" + }, + "isRunning": [{ + "type": "gpii.processReporter.neverRunning" + }] + } } }, "start": [ - { - "type": "gpii.launch.exec", - "command": "google-chrome http://easy123.org/user/${{userToken}}" - } + "settings.launcher" ], "stop": [ - { - "type": "gpii.launch.exec", - "command": "pkill -2 chrome" - } + "settings.launcher" ], "isInstalled": [ { @@ -1221,19 +1243,29 @@ "capabilities": [ "http://registry\\.gpii\\.net/common/simplification" ] + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": { + "type": "gpii.launch.exec", + "command": "google-chrome http://easy123.org/sudan" + }, + "stop": { + "type": "gpii.launch.exec", + "command": "pkill -2 chrome" + }, + "isRunning": [{ + "type": "gpii.processReporter.neverRunning" + }] + } } }, "start": [ - { - "type": "gpii.launch.exec", - "command": "google-chrome http://easy123.org/sudan" - } + "settings.launcher" ], "stop": [ - { - "type": "gpii.launch.exec", - "command": "pkill -2 chrome" - } + "settings.launcher" ], "isInstalled": [ { @@ -1267,19 +1299,29 @@ "capabilities": [ "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" ] + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": { + "type": "gpii.launch.exec", + "command": "google-chrome http://webanywhere.cs.washington.edu/beta/?starting_url=http%3A%2F%2Fcloud4all.info" + }, + "stop": { + "type": "gpii.launch.exec", + "command": "pkill -2 chrome" + }, + "isRunning": [{ + "type": "gpii.processReporter.neverRunning" + }] + } } }, "start": [ - { - "type": "gpii.launch.exec", - "command": "google-chrome http://webanywhere.cs.washington.edu/beta/?starting_url=http%3A%2F%2Fcloud4all.info" - } + "settings.launcher" ], "stop": [ - { - "type": "gpii.launch.exec", - "command": "pkill -2 chrome" - } + "settings.launcher" ], "isInstalled": [ { @@ -1390,10 +1432,6 @@ "restore": [ "settings.chromeconf" ], - "start": [ - ], - "stop": [ - ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" diff --git a/testData/solutions/win32.json5 b/testData/solutions/win32.json5 index 767e4606f..a6b4365ce 100644 --- a/testData/solutions/win32.json5 +++ b/testData/solutions/win32.json5 @@ -559,6 +559,29 @@ } } } + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "isRunning": [ + { + "type": "gpii.processReporter.find", + "command": "jaws" + } + ], + "start": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\JAWS17.exe\\}\"" + } + ], + "stop": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "jfw.exe" + } + ] + } } }, "configure": [ @@ -570,16 +593,10 @@ "settings.configuration2" ], "start": [ - { - "type": "gpii.launch.exec", - "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\JAWS17.exe\\}\"" - } + "settings.launcher" ], "stop": [ - { - "type": "gpii.windows.closeProcessByName", - "filename": "jfw.exe" - } + "settings.launcher" ], "isInstalled": [ { @@ -589,12 +606,6 @@ "subPath": "", "dataType": "REG_SZ" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "jaws" - } ] }, @@ -622,6 +633,29 @@ "capabilitiesTransformations": { "ApplicationSettings": "ApplicationSettings" } + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_CURRENT_USER\\Software\\Texthelp\\Read&Write11\\InstallPath}\\ReadAndWrite.exe\"" + } + ], + "stop": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "ReadAndWrite.exe" + } + ], + "isRunning": [ + { + "type": "gpii.processReporter.find", + "command": "readandwrite" + } + ] + } } }, "configure": [ @@ -631,16 +665,10 @@ "settings.configuration" ], "start": [ - { - "type": "gpii.launch.exec", - "command": "\"${{registry}.HKEY_CURRENT_USER\\Software\\Texthelp\\Read&Write11\\InstallPath}\\ReadAndWrite.exe\"" - } + "settings.launcher" ], "stop": [ - { - "type": "gpii.windows.closeProcessByName", - "filename": "ReadAndWrite.exe" - } + "settings.launcher" ], "isInstalled": [ { @@ -650,12 +678,6 @@ "subPath": "InstallPath", "dataType": "REG_SZ" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "readandwrite" - } ] }, @@ -766,38 +788,49 @@ } ] } + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": [ + { + "type": "gpii.windows.enableRegisteredAT", + "name": "magnifierpane", + "enable": true + } + ], + "stop": [ + { + "type": "gpii.windows.enableRegisteredAT", + "name": "magnifierpane", + "enable": false + } + ], + "isRunning": [ + { + "type": "gpii.processReporter.find", + "command": "Magnify" + } + ] + } } }, + "start": [ + "settings.launcher" + ], + "stop": [ + "settings.launcher" + ], "configure": [ "settings.configure" ], "restore": [ "settings.configure" ], - "start": [ - { - "type": "gpii.windows.enableRegisteredAT", - "name": "magnifierpane", - "enable": true - } - ], - "stop": [ - { - "type": "gpii.windows.enableRegisteredAT", - "name": "magnifierpane", - "enable": false - } - ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "Magnify" - } ] }, @@ -829,38 +862,49 @@ "literalValue": 0 } } + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": [ + { + "type": "gpii.windows.enableRegisteredAT", + "name": "osk", + "enable": true + } + ], + "stop": [ + { + "type": "gpii.windows.enableRegisteredAT", + "name": "osk", + "enable": false + } + ], + "isRunning": [ + { + "type": "gpii.processReporter.find", + "command": "osk" + } + ] + } } }, + "start": [ + "settings.launcher" + ], + "stop": [ + "settings.launcher" + ], "configure": [ "settings.configure" ], "restore": [ "settings.configure" ], - "start": [ - { - "type": "gpii.windows.enableRegisteredAT", - "name": "osk", - "enable": true - } - ], - "stop": [ - { - "type": "gpii.windows.enableRegisteredAT", - "name": "osk", - "enable": false - } - ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "osk" - } ] }, @@ -1239,29 +1283,46 @@ } ] } + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "isRunning": [ + { + "type": "gpii.processReporter.find", + "command": "nvda" + } + ], + "start": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\nvda.exe\\}\"" + } + ], + "stop": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "nvda_service.exe" + },{ + "type": "gpii.windows.closeProcessByName", + "filename": "nvda.exe" + } + ], + } } }, + "start": [ + "settings.launcher" + ], + "stop": [ + "settings.launcher" + ], "configure": [ "settings.configs" ], "restore": [ "settings.configs" ], - "start": [ - { - "type": "gpii.launch.exec", - "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\nvda.exe\\}\"" - } - ], - "stop": [ - { - "type": "gpii.windows.closeProcessByName", - "filename": "nvda_service.exe" - },{ - "type": "gpii.windows.closeProcessByName", - "filename": "nvda.exe" - } - ], "isInstalled": [ { "type": "gpii.deviceReporter.registryKeyExists", @@ -1270,12 +1331,6 @@ "subPath": "", "dataType": "REG_SZ" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "nvda" - } ] }, @@ -1296,30 +1351,34 @@ "capabilities": [ "http://registry\\.gpii\\.net/common/simplification" ] + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\firefox.exe\\}\" http://easy123.org/user/${{userToken}}" + }, + "stop": { + "type": "gpii.windows.closeProcessByName", + "filename": "firefox.exe" + }, + "isRunning": [{ + "type": "gpii.processReporter.neverRunning" + }] + } } }, "start": [ - { - "type": "gpii.launch.exec", - "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\firefox.exe\\}\" http://easy123.org/user/${{userToken}}" - } + "settings.launcher" ], "stop": [ - { - "type": "gpii.windows.closeProcessByName", - "filename": "firefox.exe" - } + "settings.launcher" ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "firefox" - } ] }, @@ -1339,30 +1398,34 @@ "capabilities": [ "http://registry\\.gpii\\.net/common/pictorialSimplification" ] + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\firefox.exe\\}\" http://easy123.org/sudan" + }, + "stop": { + "type": "gpii.windows.closeProcessByName", + "filename": "firefox.exe" + }, + "isRunning": [{ + "type": "gpii.processReporter.neverRunning" + }] + } } }, "start": [ - { - "type": "gpii.launch.exec", - "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\firefox.exe\\}\" http://easy123.org/sudan" - } + "settings.launcher" ], "stop": [ - { - "type": "gpii.windows.closeProcessByName", - "filename": "firefox.exe" - } + "settings.launcher" ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "firefox" - } ] }, @@ -1382,30 +1445,34 @@ "capabilities": [ "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" ] + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\firefox.exe\\}\" \"http://webanywhere.cs.washington.edu/beta/?starting_url=http%3A%2F%2Fcloud4all.info\"" + }, + "stop": { + "type": "gpii.windows.closeProcessByName", + "filename": "firefox.exe" + }, + "isRunning": [{ + "type": "gpii.processReporter.neverRunning" + }] + } } }, - "start": [ - { - "type": "gpii.launch.exec", - "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\firefox.exe\\}\" \"http://webanywhere.cs.washington.edu/beta/?starting_url=http%3A%2F%2Fcloud4all.info\"" - } + "start": [ + "settings.launcher" ], "stop": [ - { - "type": "gpii.windows.closeProcessByName", - "filename": "firefox.exe" - } + "settings.launcher" ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "firefox" - } ] }, @@ -1474,6 +1541,29 @@ ] }, "inverseCapabilitiesTransformations": {} + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": [ + { + "type": "gpii.launch.exec", + "command": "${{environment}.ComSpec} /c \"cd ${{environment}.MAAVIS_HOME} && MaavisPortable.cmd\"" + } + ], + "stop": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "firefox.exe" + } + ], + "isRunning": [ + { + "type": "gpii.processReporter.find", + "command": "MaavisPortable" + } + ] + } } }, "configure": [ @@ -1483,27 +1573,15 @@ "settings.configuration" ], "start": [ - { - "type": "gpii.launch.exec", - "command": "${{environment}.ComSpec} /c \"cd ${{environment}.MAAVIS_HOME} && MaavisPortable.cmd\"" - } + "settings.launcher" ], "stop": [ - { - "type": "gpii.windows.closeProcessByName", - "filename": "firefox.exe" - } + "settings.launcher" ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "MaavisPortable" - } ] }, @@ -2284,8 +2362,23 @@ } ] } + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": [{ + "type": "gpii.windows.spiSettingsHandler.updateCursors" + }], + "isRunning": [{ + "type": "gpii.processReporter.neverRunning" + }] + } } }, + "start": [ + "settings.launcher" + ], + "stop": [], "configure": [ "settings.configure" ], @@ -2295,13 +2388,6 @@ "type": "gpii.windows.spiSettingsHandler.updateCursors" } ], - "start": [ - { - "type": "gpii.windows.spiSettingsHandler.updateCursors" - } - ], - "stop": [ - ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" @@ -2360,6 +2446,29 @@ } }, "inverseCapabilitiesTransformations": {} + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": [ + { + "type": "gpii.launch.exec", + "command": "C:\\Sociable\\Cloud4All.exe" + } + ], + "stop": [ + { + "type": "gpii.launch.exec", + "command": "C:\\Sociable\\Cloud4All.exe -stop" + } + ], + "isRunning": [ + { + "type": "gpii.processReporter.find", + "command": "Cloud4Allcd " + } + ] + } } }, "configure": [ @@ -2369,22 +2478,10 @@ "settings.configuration" ], "start": [ - { - "type": "gpii.launch.exec", - "command": "C:\\Sociable\\Cloud4All.exe" - } + "settings.launcher" ], "stop": [ - { - "type": "gpii.launch.exec", - "command": "C:\\Sociable\\Cloud4All.exe -stop" - } - ], - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "Cloud4Allcd " - } + "settings.launcher" ] }, @@ -2459,8 +2556,6 @@ "restore": [ "settings.chromeconf" ], - "start": [], - "stop": [], "isInstalled": [] // always reported as not installed. Should be changed once GPII-1998 is fixed } } diff --git a/tests/platform/linux/linux-builtIn-testSpec.js b/tests/platform/linux/linux-builtIn-testSpec.js index 680e143a7..ad949d1e8 100644 --- a/tests/platform/linux/linux-builtIn-testSpec.js +++ b/tests/platform/linux/linux-builtIn-testSpec.js @@ -26,9 +26,23 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ { name: "Testing os_common using default matchmaker", userToken: "os_common", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "running": false + } + }], + "org.gnome.desktop.a11y.applications.onscreen-keyboard": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.gsettings": { - "some.app.id": [{ + "org.gnome.desktop.a11y.magnifier": [{ "settings": { "mag-factor": 1.5, "screen-position": "full-screen", @@ -39,7 +53,8 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ "options": { "schema": "org.gnome.desktop.a11y.magnifier" } - }, { + }], + "org.gnome.desktop.interface": [{ "settings": { "gtk-theme": "HighContrast", "icon-theme": "HighContrast", @@ -50,6 +65,44 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ "schema": "org.gnome.desktop.interface" } }] + }, + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.desktop.a11y.applications.onscreen-keyboard": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "caribou" + }, { + "type": "gpii.processReporter.checkSetting", + "schema": "org.gnome.desktop.a11y.applications", + "setting": "screen-keyboard-enabled", + "value": true + }] + } + }], + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "gnome-shell" + }, + { + "type": "gpii.processReporter.checkSetting", + "schema": "org.gnome.desktop.a11y.applications", + "setting": "screen-magnifier-enabled", + "value": true + }] + } + }] + } }, processes: [ @@ -81,9 +134,18 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ { name: "Testing os_gnome using default matchmaker", userToken: "os_gnome", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.gsettings": { - "some.app.id": [{ + "org.gnome.desktop.a11y.magnifier": [{ "settings": { "mag-factor": 1.5, "screen-position": "full-screen" @@ -91,7 +153,8 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ "options": { "schema": "org.gnome.desktop.a11y.magnifier" } - }, { + }], + "org.gnome.desktop.interface": [{ "settings": { "text-scaling-factor": 0.75, "cursor-size": 90 @@ -102,11 +165,31 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ }] }, "gpii.alsa": { - "some.app.id": [{ + "org.alsa-project": [{ "settings": { "masterVolume": 50 } }] + }, + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "gnome-shell" + }, + { + "type": "gpii.processReporter.checkSetting", + "schema": "org.gnome.desktop.a11y.applications", + "setting": "screen-magnifier-enabled", + "value": true + }] + } + }] } }, processes: [ @@ -120,6 +203,15 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ { name: "Testing os_win7 using default matchmaker", userToken: "os_win7", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.gsettings": { "some.app.id": [{ @@ -143,7 +235,28 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ "schema": "org.gnome.desktop.interface" } }] + }, + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "gnome-shell" + }, + { + "type": "gpii.processReporter.checkSetting", + "schema": "org.gnome.desktop.a11y.applications", + "setting": "screen-magnifier-enabled", + "value": true + }] + } + }] } + }, processes: [ { diff --git a/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js b/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js index 3e44192de..34afb4563 100644 --- a/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js +++ b/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js @@ -26,6 +26,15 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ name: "Testing screenreader_common using Flat matchmaker", gradeNames: "gpii.test.integration.deviceReporterAware.linux", userToken: "screenreader_common", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.orca": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.orca": { "data": [ @@ -50,6 +59,22 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.orca": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.checkSetting", + "schema": "org.gnome.desktop.a11y.applications", + "setting": "screen-reader-enabled", + "value": true + }] + } + }] } }, processes: [ @@ -69,6 +94,15 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ name: "Testing screenreader_orca using Flat matchmaker", gradeNames: "gpii.test.integration.deviceReporterAware.linux", userToken: "screenreader_orca", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.orca": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.orca": { "some.app.id": [ @@ -92,6 +126,22 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.orca": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.checkSetting", + "schema": "org.gnome.desktop.a11y.applications", + "setting": "screen-reader-enabled", + "value": true + }] + } + }] } }, processes: [ @@ -111,6 +161,15 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ name: "Testing screenreader_nvda using Flat matchmaker", gradeNames: "gpii.test.integration.deviceReporterAware.linux", userToken: "screenreader_nvda", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.orca": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.orca": { "some.app.id": [ @@ -133,6 +192,22 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.orca": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.checkSetting", + "schema": "org.gnome.desktop.a11y.applications", + "setting": "screen-reader-enabled", + "value": true + }] + } + }] } }, processes: [ diff --git a/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.txt b/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.txt index 979e68516..6ea62ad4e 100644 --- a/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.txt +++ b/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.txt @@ -3,4 +3,4 @@ linux-dynamicDeviceReporter-testSpec.js Descriptions: This will run the acceptance tests with dynamic device reporting. -It uses 1 NP set: screenreader_common (but more will be added) +It uses 3 NP sets: screenreader_common, screenreader_orca and screenreader_nvda diff --git a/tests/platform/linux/linux-orca-testSpec.js b/tests/platform/linux/linux-orca-testSpec.js index 21707a2c1..ad46b289f 100644 --- a/tests/platform/linux/linux-orca-testSpec.js +++ b/tests/platform/linux/linux-orca-testSpec.js @@ -26,9 +26,18 @@ gpii.tests.linux.orca.testDefs = [ { name: "Testing screenreader_common using Flat matchmaker", userToken: "screenreader_common", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.orca": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.orca": { - "some.app.id": [ + "org.gnome.orca": [ { "settings": { "sayAllStyle": 1, @@ -50,6 +59,22 @@ gpii.tests.linux.orca.testDefs = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.orca": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.checkSetting", + "schema": "org.gnome.desktop.a11y.applications", + "setting": "screen-reader-enabled", + "value": true + }] + } + }] } }, processes: [ @@ -63,9 +88,18 @@ gpii.tests.linux.orca.testDefs = [ { name: "Testing screenreader_orca using Flat matchmaker", userToken: "screenreader_orca", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.orca": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.orca": { - "some.app.id": [ + "org.gnome.orca": [ { "settings": { "sayAllStyle": 1, @@ -86,6 +120,22 @@ gpii.tests.linux.orca.testDefs = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.orca": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.checkSetting", + "schema": "org.gnome.desktop.a11y.applications", + "setting": "screen-reader-enabled", + "value": true + }] + } + }] } }, processes: [ @@ -99,9 +149,18 @@ gpii.tests.linux.orca.testDefs = [ { name: "Testing screenreader_nvda using Flat matchmaker", userToken: "screenreader_nvda", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.orca": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.orca": { - "some.app.id": [ + "org.gnome.orca": [ { "settings": { "sayAllStyle": 1, @@ -121,6 +180,22 @@ gpii.tests.linux.orca.testDefs = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "org.gnome.orca": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.checkSetting", + "schema": "org.gnome.desktop.a11y.applications", + "setting": "screen-reader-enabled", + "value": true + }] + } + }] } }, processes: [ diff --git a/tests/platform/windows/windows-builtIn-testSpec.js b/tests/platform/windows/windows-builtIn-testSpec.js index 749ef6677..90466fe9c 100644 --- a/tests/platform/windows/windows-builtIn-testSpec.js +++ b/tests/platform/windows/windows-builtIn-testSpec.js @@ -26,9 +26,18 @@ gpii.tests.windows.builtIn = [ { name: "Testing os_win7 using default matchmaker", userToken: "os_win7", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "com.microsoft.windows.magnifier": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.windows.spiSettingsHandler": { - "some.app.id": [ + "com.microsoft.windows.mouseTrailing": [ { "settings": { "MouseTrails": { @@ -47,7 +56,10 @@ gpii.tests.windows.builtIn = [ "type": "BOOL" } } - }, { + } + ], + "com.microsoft.windows.mouseKeys": [ + { "settings": { "MouseKeysOn": { "path": "pvParam.dwFlags.MKF_MOUSEKEYSON", @@ -71,7 +83,10 @@ gpii.tests.windows.builtIn = [ "name": "MOUSEKEYS" } } - }, { + } + ], + "com.microsoft.windows.stickyKeys": [ + { "settings": { "StickyKeysOn": { "path": "pvParam.dwFlags.SKF_STICKYKEYSON", @@ -87,7 +102,10 @@ gpii.tests.windows.builtIn = [ "name": "STICKYKEYS" } } - }, { + } + ], + "com.microsoft.windows.filterKeys": [ + { "settings": { "FilterKeysEnable": { "path": "pvParam.dwFlags.FKF_FILTERKEYSON", @@ -107,7 +125,10 @@ gpii.tests.windows.builtIn = [ "name": "FILTERKEYS" } } - }, { // high contrast settings + } + ], + "com.microsoft.windows.highContrast": [ + { // high contrast settings "settings": { "HighContrastOn": { "path": "pvParam.dwFlags.HCF_HIGHCONTRASTON", @@ -127,7 +148,7 @@ gpii.tests.windows.builtIn = [ ] }, "gpii.windows.registrySettingsHandler": { - "some.app.id": [{ // magnifier stuff + "com.microsoft.windows.magnifier": [{ // magnifier stuff "settings": { "Invert": 1, "Magnification": 150, @@ -148,7 +169,8 @@ gpii.tests.windows.builtIn = [ "MagnificationMode": "REG_DWORD" } } - }, { // cursor size stuff + }], + "com.microsoft.windows.cursors": [{ // cursor size stuff "settings": { "No": "%SystemRoot%\\cursors\\aero_unavail_xl.cur", "Hand": "%SystemRoot%\\cursors\\aero_link_xl.cur", @@ -186,7 +208,7 @@ gpii.tests.windows.builtIn = [ }] }, "gpii.windows.displaySettingsHandler": { - "some.app.id": [{ + "com.microsoft.windows.screenResolution": [{ "settings": { "screen-resolution": { "width": 800, @@ -194,6 +216,20 @@ gpii.tests.windows.builtIn = [ } } }] + }, + "gpii.launchHandlers.flexibleHandler": { + "com.microsoft.windows.magnifier": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "Magnify" + }] + } + }] } }, processes: [ @@ -206,9 +242,23 @@ gpii.tests.windows.builtIn = [ }, { name: "Testing os_common using default matchmaker", userToken: "os_common", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "com.microsoft.windows.magnifier": [{ + "settings": { + "running": false + } + }], + "com.microsoft.windows.onscreenKeyboard": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.windows.spiSettingsHandler": { - "some.app.id": [ + "com.microsoft.windows.mouseTrailing": [ { "settings": { "MouseTrails": { @@ -227,7 +277,10 @@ gpii.tests.windows.builtIn = [ "type": "BOOL" } } - }, { + } + ], + "com.microsoft.windows.mouseKeys": [ + { "settings": { "MouseKeysOn": { "path": "pvParam.dwFlags.MKF_MOUSEKEYSON", @@ -243,7 +296,10 @@ gpii.tests.windows.builtIn = [ "name": "MOUSEKEYS" } } - }, { + } + ], + "com.microsoft.windows.stickyKeys": [ + { "settings": { "StickyKeysOn": { "path": "pvParam.dwFlags.SKF_STICKYKEYSON", @@ -259,7 +315,10 @@ gpii.tests.windows.builtIn = [ "name": "STICKYKEYS" } } - }, { + } + ], + "com.microsoft.windows.filterKeys": [ + { "settings": { "FilterKeysEnable": { "path": "pvParam.dwFlags.FKF_FILTERKEYSON", @@ -279,7 +338,10 @@ gpii.tests.windows.builtIn = [ "name": "FILTERKEYS" } } - }, { // high contrast settings + } + ], + "com.microsoft.windows.highContrast": [ + { // high contrast settings "settings": { "HighContrastOn": { "path": "pvParam.dwFlags.HCF_HIGHCONTRASTON", @@ -299,7 +361,7 @@ gpii.tests.windows.builtIn = [ ] }, "gpii.windows.registrySettingsHandler": { - "some.app.id": [{ // magnifier stuff + "com.microsoft.windows.magnifier": [{ // magnifier stuff "settings": { "Invert": 1, "Magnification": 150, @@ -320,7 +382,8 @@ gpii.tests.windows.builtIn = [ "MagnificationMode": "REG_DWORD" } } - }, { // cursor size stuff + }], + "com.microsoft.windows.cursors": [{ // cursor size stuff "settings": { "No": "%SystemRoot%\\cursors\\aero_unavail_xl.cur", "Hand": "%SystemRoot%\\cursors\\aero_link_xl.cur", @@ -356,6 +419,32 @@ gpii.tests.windows.builtIn = [ } } }] + }, + "gpii.launchHandlers.flexibleHandler": { + "com.microsoft.windows.magnifier": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "Magnify" + }] + } + }], + "com.microsoft.windows.onscreenKeyboard": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "osk" + }] + } + }] } }, processes: [ @@ -368,9 +457,18 @@ gpii.tests.windows.builtIn = [ }, { name: "Testing os_gnome using default matchmaker", userToken: "os_gnome", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "com.microsoft.windows.magnifier": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.windows.registrySettingsHandler": { - "some.app.id": [{ // magnifier stuff + "com.microsoft.windows.magnifier": [{ // magnifier stuff "settings": { "Magnification": 150, "MagnificationMode": 2 @@ -387,7 +485,8 @@ gpii.tests.windows.builtIn = [ "MagnificationMode": "REG_DWORD" } } - }, { // cursor size stuff + }], + "com.microsoft.windows.cursors": [{ // cursor size stuff "settings": { "No": "%SystemRoot%\\cursors\\aero_unavail_xl.cur", "Hand": "%SystemRoot%\\cursors\\aero_link_xl.cur", @@ -423,6 +522,20 @@ gpii.tests.windows.builtIn = [ } } }] + }, + "gpii.launchHandlers.flexibleHandler": { + "com.microsoft.windows.magnifier": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "Magnify" + }] + } + }] } }, processes: [ diff --git a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js index 87f37784d..3cb425457 100644 --- a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js +++ b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js @@ -24,6 +24,15 @@ gpii.tests.deviceReporterAware.windows = [ { name: "Testing screenreader_nvda using Flat matchmaker", userToken: "screenreader_nvda", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "org.nvda-project": [{ + "settings": { + "running": false + } + }] + } + }, gradeNames: "gpii.test.integration.deviceReporterAware.windows", settingsHandlers: { "gpii.settingsHandlers.INISettingsHandler": { @@ -53,6 +62,20 @@ gpii.tests.deviceReporterAware.windows = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "org.nvda-project": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "nvda" + }] + } + }] } }, processes: [ @@ -76,7 +99,31 @@ gpii.tests.deviceReporterAware.windows = [ name: "Testing readwritegold_application1 using Flat matchmaker", userToken: "readwritegold_application1", gradeNames: "gpii.test.integration.deviceReporterAware.windows", - settingsHandlers: {}, + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "com.texthelp.readWriteGold": [{ + "settings": { + "running": false + } + }] + } + }, + settingsHandlers: { + "gpii.launchHandlers.flexibleHandler": { + "com.texthelp.readWriteGold": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "readandwrite" + }] + } + }] + } + }, processes: [ { "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq ReadAndWrite.exe\" | find /I \"ReadAndWrite.exe\" /C", diff --git a/tests/platform/windows/windows-jaws-testSpec.js b/tests/platform/windows/windows-jaws-testSpec.js index d0ec3b314..73516fc86 100644 --- a/tests/platform/windows/windows-jaws-testSpec.js +++ b/tests/platform/windows/windows-jaws-testSpec.js @@ -26,9 +26,18 @@ gpii.tests.windows.jaws = [ { name: "Testing NP set \"jaws_application\" using Flat matchmaker", userToken: "jaws_application", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "com.freedomscientific.jaws": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.settingsHandlers.INISettingsHandler": { - "some.app.id": [ + "com.freedomscientific.jaws": [ { "settings": { "Voice Profiles.ActiveVoiceProfileName" : "GPII", @@ -82,6 +91,20 @@ gpii.tests.windows.jaws = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "com.freedomscientific.jaws": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "jaws" + }] + } + }] } }, processes: [ @@ -96,9 +119,18 @@ gpii.tests.windows.jaws = [ { name: "Testing NP set \"jaws_common\" using Flat matchmaker", userToken: "jaws_common", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "com.freedomscientific.jaws": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.settingsHandlers.INISettingsHandler": { - "some.app.id": [ + "com.freedomscientific.jaws": [ { "settings": { "Options.PrimarySynthesizer": "eloq", @@ -152,6 +184,20 @@ gpii.tests.windows.jaws = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "com.freedomscientific.jaws": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "jaws" + }] + } + }] } }, processes: [ @@ -166,9 +212,18 @@ gpii.tests.windows.jaws = [ { name: "Testing NP set \"jaws_common2\" using Flat matchmaker", userToken: "jaws_common2", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "com.freedomscientific.jaws": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.settingsHandlers.INISettingsHandler": { - "some.app.id": [ + "com.freedomscientific.jaws": [ { "settings": { "Options.PrimarySynthesizer": "eloq", @@ -221,6 +276,20 @@ gpii.tests.windows.jaws = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "com.freedomscientific.jaws": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "jaws" + }] + } + }] } }, processes: [ @@ -235,9 +304,18 @@ gpii.tests.windows.jaws = [ { name: "Testing NP set \"jaws_common3\" using Flat matchmaker", userToken: "jaws_common3", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "com.freedomscientific.jaws": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.settingsHandlers.INISettingsHandler": { - "some.app.id": [ + "com.freedomscientific.jaws": [ { "settings": { "Options.PrimarySynthesizer": "eloq", @@ -291,6 +369,20 @@ gpii.tests.windows.jaws = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "com.freedomscientific.jaws": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "jaws" + }] + } + }] } }, processes: [ diff --git a/tests/platform/windows/windows-maavis-testSpec.js b/tests/platform/windows/windows-maavis-testSpec.js index 658f95b4d..3598ff290 100644 --- a/tests/platform/windows/windows-maavis-testSpec.js +++ b/tests/platform/windows/windows-maavis-testSpec.js @@ -25,9 +25,18 @@ gpii.tests.windows.maavis = [ { name: "Testing maavis_highcontrast using Flat matchmaker", userToken: "maavis_highcontrast", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "net.opendirective.maavis": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.settingsHandlers.JSONSettingsHandler": { - "data": [ + "net.opendirective.maavis": [ { "settings": { "theme": "hc", @@ -40,6 +49,20 @@ gpii.tests.windows.maavis = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "net.opendirective.maavis": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "MaavisPortable" + }] + } + }] } }, processes: [ @@ -52,9 +75,18 @@ gpii.tests.windows.maavis = [ }, { name: "Testing maavis_selfvoicing using Flat matchmaker", userToken: "maavis_selfvoicing", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "net.opendirective.maavis": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.settingsHandlers.JSONSettingsHandler": { - "data": [ + "net.opendirective.maavis": [ { "settings": { "theme": "colour", @@ -67,6 +99,20 @@ gpii.tests.windows.maavis = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "net.opendirective.maavis": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "MaavisPortable" + }] + } + }] } }, processes: [ diff --git a/tests/platform/windows/windows-nvda-testSpec.js b/tests/platform/windows/windows-nvda-testSpec.js index b6af2d032..0aa6a7305 100644 --- a/tests/platform/windows/windows-nvda-testSpec.js +++ b/tests/platform/windows/windows-nvda-testSpec.js @@ -25,9 +25,18 @@ gpii.tests.windows.nvda = [ { name: "Testing screenreader_nvda using Flat matchmaker", userToken: "screenreader_nvda", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "org.nvda-project": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.settingsHandlers.INISettingsHandler": { - "some.app.id": [ + "org.nvda-project": [ { "settings": { "speech.espeak.rate": 17, @@ -53,6 +62,20 @@ gpii.tests.windows.nvda = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "org.nvda-project": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "nvda" + }] + } + }] } }, processes: [ @@ -65,9 +88,18 @@ gpii.tests.windows.nvda = [ }, { name: "Testing screenreader_common using Flat matchmaker", userToken: "screenreader_common", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "org.nvda-project": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.settingsHandlers.INISettingsHandler": { - "some.app.id": [ + "org.nvda-project": [ { "settings": { "speech.espeak.rate": 17, @@ -91,6 +123,20 @@ gpii.tests.windows.nvda = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "org.nvda-project": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "nvda" + }] + } + }] } }, processes: [ @@ -103,9 +149,18 @@ gpii.tests.windows.nvda = [ }, { name: "Testing screenreader_orca using Flat matchmaker", userToken: "screenreader_orca", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "org.nvda-project": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.settingsHandlers.INISettingsHandler": { - "some.app.id": [ + "org.nvda-project": [ { "settings": { "speech.symbolLevel": 300, @@ -123,6 +178,20 @@ gpii.tests.windows.nvda = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "org.nvda-project": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "nvda" + }] + } + }] } }, processes: [ diff --git a/tests/platform/windows/windows-readWrite-testSpec.js b/tests/platform/windows/windows-readWrite-testSpec.js index bb2d1fb7f..5e15006e2 100644 --- a/tests/platform/windows/windows-readWrite-testSpec.js +++ b/tests/platform/windows/windows-readWrite-testSpec.js @@ -22,9 +22,18 @@ gpii.tests.windows.readWrite = [ { name: "Testing rwg1", userToken: "rwg1", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "com.texthelp.readWriteGold": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.settingsHandlers.XMLHandler": { - "some.app.id": [ + "com.texthelp.readWriteGold": [ { "settings": { "ApplicationSettings.AppBar.optToolbarIconSet.$t": "Fun", @@ -53,6 +62,20 @@ gpii.tests.windows.readWrite = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "com.texthelp.readWriteGold": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "readandwrite" + }] + } + }] } }, processes: [ @@ -65,9 +88,18 @@ gpii.tests.windows.readWrite = [ }, { name: "Testing rwg2", userToken: "rwg2", + integrationPrepopulation: { + "gpii.launchHandlers.flexibleHandler": { + "com.texthelp.readWriteGold": [{ + "settings": { + "running": false + } + }] + } + }, settingsHandlers: { "gpii.settingsHandlers.XMLHandler": { - "some.app.id": [ + "com.texthelp.readWriteGold": [ { "settings": { "ApplicationSettings.AppBar.optToolbarIconSet.$t": "Professional", @@ -98,6 +130,20 @@ gpii.tests.windows.readWrite = [ } } ] + }, + "gpii.launchHandlers.flexibleHandler": { + "com.texthelp.readWriteGold": [{ + "settings": { + "running": true + }, + "options": { + // start and stop blocks omitted for size/clarity + "isRunning": [{ + "type": "gpii.processReporter.find", + "command": "readandwrite" + }] + } + }] } }, processes: [ From edeb9ace35caed9cf6b0a5e9b10be2341e3356dd Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 1 Mar 2017 13:16:34 +0100 Subject: [PATCH 03/44] GPII-442: Fixed failing Journal integration tests --- tests/JournalIntegrationTests.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/tests/JournalIntegrationTests.js b/tests/JournalIntegrationTests.js index 7852f382f..c389ebf50 100644 --- a/tests/JournalIntegrationTests.js +++ b/tests/JournalIntegrationTests.js @@ -25,6 +25,7 @@ fluid.setLogging(true); fluid.registerNamespace("gpii.tests.journal"); +fluid.logObjectRenderChars = 10000 gpii.tests.journal.testSpec = fluid.require("%universal/tests/platform/windows/windows-builtIn-testSpec.js"); // The os_win7 entry forms the spine of our test. This user has 4 application-specific preferences encoded @@ -35,7 +36,7 @@ gpii.tests.journal.testDef = gpii.tests.windows.builtIn[0]; gpii.tests.journal.initialSettings = { "gpii.windows.spiSettingsHandler": { - "some.app.id": [{ + "com.microsoft.windows.mouseTrailing": [{ "settings": { "MouseTrails": { "value": 20 @@ -49,7 +50,7 @@ gpii.tests.journal.initialSettings = { }] }, "gpii.windows.registrySettingsHandler": { - "some.app.id": [{ // magnifier stuff + "com.microsoft.windows.magnifier": [{ // magnifier stuff "settings": { "Invert": 1, "Magnification": 200, @@ -75,7 +76,7 @@ gpii.tests.journal.initialSettings = { ] }, "gpii.windows.displaySettingsHandler": { - "some.app.id": [{ + "com.microsoft.windows.screenResolution": [{ "settings": { "screen-resolution": { "width": 800, @@ -83,6 +84,15 @@ gpii.tests.journal.initialSettings = { } } }] + }, + "gpii.launchHandlers.flexibleHandler": { + "com.microsoft.windows.magnifier": [ + { + "settings": { + "running": false + } + } + ] } }; @@ -274,8 +284,10 @@ gpii.tests.journal.stashInitial = function (settingsHandlersPayload, settingsSto var settingsHandlers = fluid.copy(testCaseHolder.options.settingsHandlers); // We eliminate the last blocks since our initial settings state does not include them, and the blocks // with values all `undefined` will confuse jqUnit.assertDeepEq in gpii.test.checkConfiguration - settingsHandlers["gpii.windows.spiSettingsHandler"]["some.app.id"].length = 1; - settingsHandlers["gpii.windows.registrySettingsHandler"]["some.app.id"].length = 1; + settingsHandlers["gpii.windows.spiSettingsHandler"] = fluid.filterKeys(settingsHandlers["gpii.windows.spiSettingsHandler"], "com.microsoft.windows.mouseTrailing"); + settingsHandlers["gpii.windows.registrySettingsHandler"] = fluid.filterKeys(settingsHandlers["gpii.windows.registrySettingsHandler"], "com.microsoft.windows.magnifier"); + // settingsHandlers["gpii.windows.spiSettingsHandler"]["com.microsoft.windows.mouseTrailing"].length = 1; + // settingsHandlers["gpii.windows.registrySettingsHandler"]["com.microsoft.windows.magnifier"].length = 1; testCaseHolder.settingsHandlers = settingsHandlers; }; From 957d48891a6a66c9e0c0a492be2588e347bcc5cf Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Thu, 2 Mar 2017 17:54:18 +0100 Subject: [PATCH 04/44] GPII-442: Removed REST related processReporter functionality --- ....config.all.development.pr.production.json | 1 - .../gpii.processReporter.config.base.json | 19 - ...pii.processReporter.config.production.json | 12 - ...gpii.processReporter.config.production.txt | 5 - gpii/node_modules/processReporter/index.js | 1 + .../processReporter/src/ProcessReporter.js | 116 +----- .../test/web/html/ProcessReporterTest.html | 34 ++ .../test/web/js/ProcessReporterTests.js | 109 ++++++ .../settingsHandlers/src/LaunchHandlers.js | 18 +- .../test/web/html/LaunchHandlerTest.html | 36 ++ .../test/web/js/LaunchHandlerTests.js | 347 ++++++++++++++++++ gpii/node_modules/testing/src/Testing.js | 33 +- testData/solutions/android.json5 | 77 ++-- .../platform/linux/linux-builtIn-testSpec.js | 31 +- tests/platform/linux/linux-chrome-testSpec.js | 9 +- .../linux-dynamicDeviceReporter-testSpec.js | 21 -- tests/platform/linux/linux-orca-testSpec.js | 27 +- .../windows/windows-builtIn-testSpec.js | 27 +- .../windows/windows-chrome-testSpec.js | 9 +- .../windows-dynamicDeviceReporter-testSpec.js | 14 - .../platform/windows/windows-jaws-testSpec.js | 40 +- .../windows/windows-maavis-testSpec.js | 18 +- .../platform/windows/windows-nvda-testSpec.js | 27 +- .../windows/windows-readWrite-testSpec.js | 18 +- tests/web/html/all-tests.html | 3 +- 25 files changed, 628 insertions(+), 424 deletions(-) delete mode 100644 gpii/node_modules/processReporter/configs/gpii.processReporter.config.base.json delete mode 100644 gpii/node_modules/processReporter/configs/gpii.processReporter.config.production.json delete mode 100644 gpii/node_modules/processReporter/configs/gpii.processReporter.config.production.txt create mode 100644 gpii/node_modules/processReporter/test/web/html/ProcessReporterTest.html create mode 100644 gpii/node_modules/processReporter/test/web/js/ProcessReporterTests.js create mode 100644 gpii/node_modules/settingsHandlers/test/web/html/LaunchHandlerTest.html create mode 100644 gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js diff --git a/gpii/configs/gpii.config.all.development.pr.production.json b/gpii/configs/gpii.config.all.development.pr.production.json index bccb5ab11..e07369298 100644 --- a/gpii/configs/gpii.config.all.development.pr.production.json +++ b/gpii/configs/gpii.config.all.development.pr.production.json @@ -9,7 +9,6 @@ } }, "mergeConfigs": [ - "%processReporter/configs/gpii.processReporter.config.production.json", "%deviceReporter/configs/gpii.deviceReporter.config.production.json", "%universal/gpii/configs/gpii.config.development.base.local.json" ] diff --git a/gpii/node_modules/processReporter/configs/gpii.processReporter.config.base.json b/gpii/node_modules/processReporter/configs/gpii.processReporter.config.base.json deleted file mode 100644 index 3f1413b93..000000000 --- a/gpii/node_modules/processReporter/configs/gpii.processReporter.config.base.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "type": "gpii.processReporter.config.base", - "options": { - "gradeNames": ["fluid.component"], - "components": { - "server": { - "type": "kettle.server", - "options": { - "components": { - "processReporter": { - "type": "gpii.processReporter" - } - } - } - } - } - }, - "require": "processReporter" -} diff --git a/gpii/node_modules/processReporter/configs/gpii.processReporter.config.production.json b/gpii/node_modules/processReporter/configs/gpii.processReporter.config.production.json deleted file mode 100644 index 59c531d55..000000000 --- a/gpii/node_modules/processReporter/configs/gpii.processReporter.config.production.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "type": "gpii.processReporter.config.production", - "options": { - "distributeOptions": { - "processReporterType": { - "record": "gpii.processReporter.live", - "target": "{that processReporter}.type" - } - } - }, - "mergeConfigs": "gpii.processReporter.config.base.json" -} diff --git a/gpii/node_modules/processReporter/configs/gpii.processReporter.config.production.txt b/gpii/node_modules/processReporter/configs/gpii.processReporter.config.production.txt deleted file mode 100644 index bd849178c..000000000 --- a/gpii/node_modules/processReporter/configs/gpii.processReporter.config.production.txt +++ /dev/null @@ -1,5 +0,0 @@ -==production.json== - -Running the process reporter in production mode - -**WARNING: This config this is untrusted and most likely broken** diff --git a/gpii/node_modules/processReporter/index.js b/gpii/node_modules/processReporter/index.js index 5081d1885..b929e1274 100644 --- a/gpii/node_modules/processReporter/index.js +++ b/gpii/node_modules/processReporter/index.js @@ -5,5 +5,6 @@ var fluid = require("infusion"); fluid.module.register("processReporter", __dirname, require); require("./src/ProcessReporter.js"); +require("./src/ProcessesBridge.js") diff --git a/gpii/node_modules/processReporter/src/ProcessReporter.js b/gpii/node_modules/processReporter/src/ProcessReporter.js index 7129a2c69..a76f32756 100644 --- a/gpii/node_modules/processReporter/src/ProcessReporter.js +++ b/gpii/node_modules/processReporter/src/ProcessReporter.js @@ -12,30 +12,11 @@ "use strict"; -var fluid = require("infusion"), +var fluid = fluid || require("infusion"), gpii = fluid.registerNamespace("gpii"); -fluid.require("kettle", require); -fluid.require("./processesBridge.js", require); - fluid.defaults("gpii.processReporter", { - gradeNames: "fluid.component" -}); - -fluid.defaults("gpii.processReporter.base", { - gradeNames: ["kettle.app", "gpii.processReporter"], - requestHandlers: { - processGet: { - route: "/processes", - type: "gpii.processReporter.allSolutions.get", - method: "get" - }, - processGetSingle: { - route: "/processes/:solutionID", - type: "gpii.processReporter.solution.get", - method: "get" - } - }, + gradeNames: ["fluid.component"], components: { platformReporter: { type: "gpii.platformReporter.native" @@ -45,32 +26,10 @@ fluid.defaults("gpii.processReporter.base", { } }, invokers: { - fireResponse: { - funcName: "gpii.processReporter.fireResponse", - args: ["{arguments}.0", "{arguments}.1", "{platformReporter}"] - // request, runningSolutions - } - } -}); - -fluid.defaults("gpii.processReporter.allSolutions.get", { - gradeNames: ["kettle.request.http"], - invokers: { - handleRequest: { - func: "{processReporter}.get", - args: [ - "{request}" - ] - } - } -}); - -fluid.defaults("gpii.processReporter.solution.get", { - gradeNames: ["kettle.request.http"], - invokers: { - handleRequest: { - func: "{processReporter}.getProcess", - args: ["{request}", "{processReporter}", "{solutionsRegistryDataSource}"] + handleIsRunning: { + funcName: "gpii.processReporter.handleIsRunning", + args: ["{arguments}.0"] + // entry } } }); @@ -84,32 +43,6 @@ fluid.defaults("gpii.processReporter.nameResolver", { } }); -gpii.processReporter.fireResponse = function (request, runningSolutions, platformReporter) { - request.events.onSuccess.fire({ - solutions: runningSolutions, - OS: platformReporter.reportPlatform() - }); -}; - -fluid.defaults("gpii.processReporter.live", { - gradeNames: ["gpii.processReporter.base"], - invokers: { - get: { - funcName: "gpii.processReporter.live.get", - args: ["{arguments}.0", "{processReporter}", "{flowManager}.solutionsRegistryDataSource"] - }, - getProcess: { - funcName: "gpii.processReporter.live.getProcess", - args: ["{arguments}.0", "{processReporter}", "{flowManager}.solutionsRegistryDataSource"] - }, - handleIsRunning: { - funcName: "gpii.processReporter.live.handleIsRunning", - args: ["{arguments}.0"] - // entry - } - } -}); - /* Marker function for use in isRunning sections of a launch handler * to identify in a meaningful way that the solutions start block should always * be run. @@ -127,46 +60,15 @@ gpii.processReporter.neverRunning = function () { * Runs the 'isRunning' entries of the 'entry' argument. If no 'isRunning' block is present * undefined is returned */ -gpii.processReporter.live.handleIsRunning = function (entry) { +gpii.processReporter.handleIsRunning = function (entry) { var running = undefined; if (!!entry.isRunning) { running = true; - fluid.each (entry.isRunning, function (aMember) { + + fluid.each (fluid.makeArray(entry.isRunning), function (aMember) { var partial = fluid.invokeGradedFunction(aMember.type, aMember); running = running && partial; }); } return running; }; - -gpii.processReporter.live.get = function (request, processReporter, solutionsRegistryDataSource) { - var runningSolutions = []; - solutionsRegistryDataSource.get({os: processReporter.platformReporter.reportPlatform().id}, function onSuccess(entries) { - fluid.each(entries, function (entry) { - var foundEntry = gpii.processReporter.live.handleIsRunning(entry); - if (foundEntry !== null) { - runningSolutions.push(foundEntry); - } - }); - processReporter.fireResponse(request, runningSolutions); - }); -}; - -gpii.processReporter.live.getProcess = function (request, processReporter, solutionsRegistryDataSource) { - var solutionID = request.req.params.solutionID; - solutionsRegistryDataSource.get({os: processReporter.platformReporter.reportPlatform().id}, function onSuccess(entries) { - var result = fluid.find(entries, function (anEntry, entryID) { - if (entryID === solutionID) { - return gpii.processReporter.live.handleIsRunning(anEntry); - } - }, null); - if (result === null) { - result = { id: solutionID, running: false }; - } - processReporter.fireResponse(request, result); - }); -}; - -fluid.defaults("gpii.processReporter.dev", { - gradeNames: ["kettle.urlExpander.distributeDevVariables"] -}); diff --git a/gpii/node_modules/processReporter/test/web/html/ProcessReporterTest.html b/gpii/node_modules/processReporter/test/web/html/ProcessReporterTest.html new file mode 100644 index 000000000..5d3df1cf1 --- /dev/null +++ b/gpii/node_modules/processReporter/test/web/html/ProcessReporterTest.html @@ -0,0 +1,34 @@ + + + + + GPII Process Reporter Tests + + + + + + + + + + + + + + + + + + + +

GPII Process Reporter Tests

+

+
+

+
    + + + + diff --git a/gpii/node_modules/processReporter/test/web/js/ProcessReporterTests.js b/gpii/node_modules/processReporter/test/web/js/ProcessReporterTests.js new file mode 100644 index 000000000..4ff5200f1 --- /dev/null +++ b/gpii/node_modules/processReporter/test/web/js/ProcessReporterTests.js @@ -0,0 +1,109 @@ +/* + * Process Reporter Tests + * + * Copyright 2017 Raising the Floor - International + * + * Licensed under the New BSD license. You may not use this file except in + * compliance with this License. + * + * You may obtain a copy of the License at + * https://github.com/GPII/universal/blob/master/LICENSE.txt + */ + +/* global fluid, jqUnit, gpii */ + +"use strict"; + +(function () { + // TODO: Rewrite all these tests into browser-style jqUnit tests, leaving just + // a stub tester here to test filesystem integration + + fluid.registerNamespace("gpii.tests"); + fluid.registerNamespace("gpii.tests.processReporter"); + + fluid.defaults("gpii.tests.processReporter.alwaysTrue", { + gradeNames: "fluid.function", + argumentMap: {} + }); + + gpii.tests.processReporter.alwaysTrue = function () { + return true; + } + + fluid.defaults("gpii.tests.processReporter.alwaysFalse", { + gradeNames: "fluid.function", + argumentMap: {} + }); + + gpii.tests.processReporter.alwaysFalse = function () { + return false; + } + + gpii.tests.processReporter.handleIsRunningSpecs = { + "No isRunning block": { + input: {}, + expected: undefined + }, + "Single true entry as object": { + input: { + isRunning: { + "type": "gpii.tests.processReporter.alwaysTrue" + } + }, + expected: true + }, + "Single true entry as array": { + input: { + isRunning: [{ + "type": "gpii.tests.processReporter.alwaysTrue" + }] + }, + expected: true + }, + "Single false entry": { + input: { + isRunning: [{ + "type": "gpii.tests.processReporter.alwaysFalse" + }] + }, + expected: false + }, + "true + false => false": { + input: { + isRunning: [{ + "type": "gpii.tests.processReporter.alwaysTrue" + }, { + "type": "gpii.tests.processReporter.alwaysFalse" + }] + }, + expected: false + }, + "false + true => false": { + input: { + isRunning: [{ + "type": "gpii.tests.processReporter.alwaysFalse" + }, { + "type": "gpii.tests.processReporter.alwaysTrue" + }] + }, + expected: false + }, + "true + true => true": { + input: { + isRunning: [{ + "type": "gpii.tests.processReporter.alwaysTrue" + }, { + "type": "gpii.tests.processReporter.alwaysTrue" + }] + }, + expected: true + } + }; + + jqUnit.test("gpii.processReporter.handleIsRunning tests", function () { + fluid.each(gpii.tests.processReporter.handleIsRunningSpecs, function (spec, title) { + var actual = gpii.processReporter.handleIsRunning(spec.input); + jqUnit.assertEquals(title, spec.expected, actual); + }); + }); +})(); diff --git a/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js b/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js index c0275b2d0..537da67e4 100644 --- a/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js +++ b/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js @@ -1,5 +1,5 @@ /* - * GPII JSON Settings Handler + * GPII Launch Handlers * * Copyright 2017 Raising the Floor - International * @@ -12,7 +12,7 @@ "use strict"; -var fluid = require("infusion"), +var fluid = fluid || require("infusion"), gpii = fluid.registerNamespace("gpii"); fluid.registerNamespace("gpii.launchHandlers"); @@ -53,15 +53,19 @@ gpii.launchHandlers.flexibleHandler.get = function (payload) { }; gpii.launchHandlers.flexibleHandler.executeStartBlock = function (mainEntry) { - var startBlock = fluid.get(mainEntry, [ "options", "start" ]); - fluid.invokeGradedFunction(startBlock.type, startBlock); + var startBlocks = fluid.get(mainEntry, [ "options", "start" ]); + fluid.each(fluid.makeArray(startBlocks), function (startBlock) { + fluid.invokeGradedFunction(startBlock.type, startBlock); + }); }; gpii.launchHandlers.flexibleHandler.executeStopBlock = function (mainEntry) { - var stopBlock = fluid.get(mainEntry, [ "options", "stop" ]); - fluid.invokeGradedFunction(stopBlock.type, stopBlock); + var stopBlocks = fluid.get(mainEntry, [ "options", "stop" ]); + fluid.each(fluid.makeArray(stopBlocks), function (stopBlock) { + fluid.invokeGradedFunction(stopBlock.type, stopBlock); + }); }; gpii.launchHandlers.flexibleHandler.executeIsRunningBlock = function (options) { - return gpii.processReporter.live.handleIsRunning(options); + return gpii.processReporter.handleIsRunning(options); }; diff --git a/gpii/node_modules/settingsHandlers/test/web/html/LaunchHandlerTest.html b/gpii/node_modules/settingsHandlers/test/web/html/LaunchHandlerTest.html new file mode 100644 index 000000000..4e66b8577 --- /dev/null +++ b/gpii/node_modules/settingsHandlers/test/web/html/LaunchHandlerTest.html @@ -0,0 +1,36 @@ + + + + + GPII Launch Handler Tests + + + + + + + + + + + + + + + + + + + + + +

    GPII Launch Handlers Tests

    +

    +
    +

    +
      + + + + diff --git a/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js b/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js new file mode 100644 index 000000000..06cb63a44 --- /dev/null +++ b/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js @@ -0,0 +1,347 @@ +/* + * Launch Handler Tests + * + * Copyright 2017 Raising the Floor - International + * + * Licensed under the New BSD license. You may not use this file except in + * compliance with this License. + * + * You may obtain a copy of the License at + * https://github.com/GPII/universal/blob/master/LICENSE.txt + */ + +/* global fluid, jqUnit, gpii */ + +"use strict"; + +(function () { + // TODO: Rewrite all these tests into browser-style jqUnit tests, leaving just + // a stub tester here to test filesystem integration + + fluid.registerNamespace("gpii.tests"); + fluid.registerNamespace("gpii.tests.flexibleHandler"); + + + fluid.defaults("gpii.tests.flexibleHandler.assertDirective", { + gradeNames: "fluid.function", + argumentMap: {} + }); + + gpii.tests.flexibleHandler.assertDirective = function () { + jqUnit.assertTrue("Assertion block", true); + }; + + fluid.defaults("gpii.tests.flexibleHandler.failBlock", { + gradeNames: "fluid.function", + argumentMap: {} + }); + + gpii.tests.flexibleHandler.failBlock = function () { + jqUnit.assertTrue("Asserted that this block should not be called", false); + }; + + fluid.defaults("gpii.tests.flexibleHandler.returnTrue", { + gradeNames: "fluid.function", + argumentMap: {} + }); + + gpii.tests.flexibleHandler.returnTrue = function () { + return true + }; + + fluid.defaults("gpii.tests.flexibleHandler.returnFalse", { + gradeNames: "fluid.function", + argumentMap: {} + }); + + gpii.tests.flexibleHandler.returnFalse = function () { + return false + }; + + gpii.tests.flexibleHandler.assertBlock = { + "type": "gpii.tests.flexibleHandler.assertDirective" + }; + + gpii.tests.flexibleHandler.reportRunning = { + "type": "gpii.tests.flexibleHandler.returnTrue" + }; + + gpii.tests.flexibleHandler.reportNotRunning = { + "type": "gpii.tests.flexibleHandler.returnFalse" + }; + + gpii.tests.flexibleHandler.basicTestDefs = [ + { + description: "Passing true to handler if already running should not execute start block", + expect: 1, + input: { + settings: { + "running": true + }, + options: { + "start": gpii.tests.flexibleHandler.failBlock, + "stop": gpii.tests.flexibleHandler.failBlock, + "isRunning": gpii.tests.flexibleHandler.reportRunning + } + }, + expectedSettings: { + "running": { + "newValue": true, + "oldValue": true + } + } + }, { + description: "Passing false to handler if already not running should not execute stop block", + expect: 1, + input: { + settings: { + "running": false + }, + options: { + "start": gpii.tests.flexibleHandler.failBlock, + "stop": gpii.tests.flexibleHandler.failBlock, + "isRunning": gpii.tests.flexibleHandler.reportNotRunning + } + }, + expectedSettings: { + "running": { + "newValue": false, + "oldValue": false + } + } + }, { + description: "Passing true to handler if solution is not running should execute start block", + expect: 2, + input: { + settings: { + "running": true + }, + options: { + "start": gpii.tests.flexibleHandler.assertBlock, + "stop": gpii.tests.flexibleHandler.failBlock, + "isRunning": gpii.tests.flexibleHandler.reportNotRunning + } + }, + expectedSettings: { + "running": { + "newValue": true, + "oldValue": false + } + } + }, { + description: "Passing false to handler if solution is running should execute stop block", + expect: 2, + input: { + settings: { + "running": false + }, + options: { + "start": gpii.tests.flexibleHandler.failBlock, + "stop": gpii.tests.flexibleHandler.assertBlock, + "isRunning": gpii.tests.flexibleHandler.reportRunning + } + }, + expectedSettings: { + "running": { + "newValue": false, + "oldValue": true + } + } + }, { + description: "Testing for multiple start blocks", + expect: 3, + input: { + settings: { + "running": true + }, + options: { + "start": [ + gpii.tests.flexibleHandler.assertBlock, + gpii.tests.flexibleHandler.assertBlock + ], + "stop": gpii.tests.flexibleHandler.failBlock, + "isRunning": gpii.tests.flexibleHandler.reportNotRunning + } + }, + expectedSettings: { + "running": { + "newValue": true, + "oldValue": false + } + } + }, { + description: "Testing for multiple stop blocks", + expect: 3, + input: { + settings: { + "running": false + }, + options: { + "start": gpii.tests.flexibleHandler.failBlock, + "stop": [ + gpii.tests.flexibleHandler.assertBlock, + gpii.tests.flexibleHandler.assertBlock + ], + "isRunning": gpii.tests.flexibleHandler.reportRunning + } + }, + expectedSettings: { + "running": { + "newValue": false, + "oldValue": true + } + } + } + ]; + + fluid.each(gpii.tests.flexibleHandler.basicTestDefs, function (spec) { + jqUnit.test(spec.description, function () { + jqUnit.expect(spec.expect); + var actual = gpii.launchHandlers.flexibleHandler.set({ + "my.solution1": [ + spec.input + ] + }); + // build expected return payload: + jqUnit.assertDeepEq("Return payload is correct", spec.expectedSettings, actual["my.solution1"][0].settings); + }); + }); + + gpii.tests.flexibleHandler.extraTestDefs = [ + { + description: "Multiple solution entries sent - both should attempt to start", + expect: 3, + input: { + "my.solution1": [ + { + settings: { + "running": true + }, + options: { + "start": gpii.tests.flexibleHandler.assertBlock, + "stop": gpii.tests.flexibleHandler.failBlock, + "isRunning": gpii.tests.flexibleHandler.reportNotRunning + } + } + ], + "my.solution2": [ + { + settings: { + "running": true + }, + options: { + "start": gpii.tests.flexibleHandler.assertBlock, + "stop": gpii.tests.flexibleHandler.failBlock, + "isRunning": gpii.tests.flexibleHandler.reportNotRunning + } + } + ] + }, + expected: { + "my.solution1": [ + { + settings: { + running: { + "newValue": true, + "oldValue": false + } + }, + options: { + "start": gpii.tests.flexibleHandler.assertBlock, + "stop": gpii.tests.flexibleHandler.failBlock, + "isRunning": gpii.tests.flexibleHandler.reportNotRunning + } + } + ], + "my.solution2": [ + { + settings: { + running: { + "newValue": true, + "oldValue": false + } + }, + options: { + "start": gpii.tests.flexibleHandler.assertBlock, + "stop": gpii.tests.flexibleHandler.failBlock, + "isRunning": gpii.tests.flexibleHandler.reportNotRunning + } + } + ] + } + }, + { + description: "Multiple solution entries sent - different actions", + expect: 2, + input: { + "my.solution1": [ + { + settings: { + "running": false + }, + options: { + "start": gpii.tests.flexibleHandler.failBlock, + "stop": gpii.tests.flexibleHandler.assertBlock, + "isRunning": gpii.tests.flexibleHandler.reportRunning + } + } + ], + "my.solution2": [ + { + settings: { + "running": false + }, + options: { + "start": gpii.tests.flexibleHandler.failBlock, + "stop": gpii.tests.flexibleHandler.failBlock, + "isRunning": gpii.tests.flexibleHandler.reportNotRunning + } + } + ] + }, + expected: { + "my.solution1": [ + { + settings: { + running: { + "newValue": false, + "oldValue": true + } + }, + options: { + "start": gpii.tests.flexibleHandler.failBlock, + "stop": gpii.tests.flexibleHandler.assertBlock, + "isRunning": gpii.tests.flexibleHandler.reportRunning + } + } + ], + "my.solution2": [ + { + settings: { + running: { + "newValue": false, + "oldValue": false + } + }, + options: { + "start": gpii.tests.flexibleHandler.failBlock, + "stop": gpii.tests.flexibleHandler.failBlock, + "isRunning": gpii.tests.flexibleHandler.reportNotRunning + } + } + ] + } + } + ]; + + fluid.each(gpii.tests.flexibleHandler.extraTestDefs, function (spec) { + jqUnit.test(spec.description, function () { + jqUnit.expect(spec.expect); + var actual = gpii.launchHandlers.flexibleHandler.set(spec.input); + // build expected return payload: + jqUnit.assertDeepEq("Return payload is correct", spec.expected, actual); + }); + }); + + +})(); diff --git a/gpii/node_modules/testing/src/Testing.js b/gpii/node_modules/testing/src/Testing.js index 5c767c593..8d8f7f722 100644 --- a/gpii/node_modules/testing/src/Testing.js +++ b/gpii/node_modules/testing/src/Testing.js @@ -189,10 +189,6 @@ gpii.test.checkConfiguration = function (settingsHandlers, nameResolver, onCompl }); }; -gpii.test.onExecExit = function (result, processSpec) { - jqUnit.assertTrue("Checking the process with command: " + processSpec, result); -}; - gpii.test.logoutRequestListen = function (data) { jqUnit.assertNotEquals("Successful logout message returned " + data, -1, data.indexOf("was successfully logged out.")); @@ -298,26 +294,6 @@ gpii.test.common.receiveLifecycleManager = function (testCaseHolder, lifecycleMa }; -// Will return the part of a test sequence that tests for the process state based on the -// 'expectedKey' parameter -gpii.test.createProcessChecks = function (processList, expectedKey) { - var sequence = []; - // For each process, run the command, then check that we get the expected output - fluid.each(processList, function (process, pindex) { - sequence.push({ - func: "{exec}.exec", - args: [ - fluid.model.composeSegments("{tests}.options.processes", pindex), - fluid.model.composeSegments("{tests}.options.processes", pindex, expectedKey) - ] - }, { - event: "{exec}.events.onExecExit", - listener: "gpii.test.onExecExit" - }); - }); - return sequence; -}; - /** Expand material in a `gpii.test.common.testCaseHolder` fixture's options using the variableResolver fished out of the real implementation, * and place it at a public member for the assertions to use * @param testCaseHolder {gpii.test.common.testCaseHolder} a testCaseHolder with some expandable material in its options @@ -397,10 +373,9 @@ gpii.test.buildSingleTestFixture = function (testDef, rootGrades) { return val.startsWith("gpii.test.integration") ? true : undefined; }); - var processes = testDef.processes || []; testDef.gradeNames = fluid.makeArray(testDef.gradeNames).concat(fluid.makeArray(rootGrades)); - testDef.expect = 4 + processes.length * 2; + testDef.expect = 4; testDef.sequence = fluid.makeArray(testDef.sequence); gpii.test.unshift(testDef.sequence, gpii.test.loginSequence); @@ -411,14 +386,8 @@ gpii.test.buildSingleTestFixture = function (testDef, rootGrades) { gpii.test.unshift(testDef.sequence, gpii.test.integration.prepopulateSettingsSequence); } - // For each process, run the command, then check that we get the expected output - testDef.sequence = testDef.sequence.concat(gpii.test.createProcessChecks(processes, "expectConfigured")); - gpii.test.push(testDef.sequence, gpii.test.logoutSequence); - // Check that the processes are in the expected state after logout - testDef.sequence = testDef.sequence.concat(gpii.test.createProcessChecks(processes, "expectRestored")); - gpii.test.push(testDef.sequence, gpii.test.checkSequence); return testDef; diff --git a/testData/solutions/android.json5 b/testData/solutions/android.json5 index a8c4cef32..708f41db2 100644 --- a/testData/solutions/android.json5 +++ b/testData/solutions/android.json5 @@ -13,12 +13,21 @@ "capabilities": [ "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" ] + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": { + "type": "gpii.androidActivityManager.startFreespeech" + }, + "isRunning": [{ + "type": "gpii.processReporter.neverRunning" + }] + } } }, "start": [ - { - "type": "gpii.androidActivityManager.startFreespeech" - } + "settings.launcher" ] }, @@ -36,17 +45,24 @@ "capabilities": [ "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" ] + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": { + "type": "gpii.androidActivityManager.startTalkback" + }, + "stop": { + "type": "gpii.androidActivityManager.stopTalkback" + }, + "isRunning": [{ + "type": "gpii.processReporter.neverRunning" + }] + } } }, "start": [ - { - "type": "gpii.androidActivityManager.startTalkback" - } - ], - "stop": [ - { - "type": "gpii.androidActivityManager.stopTalkback" - } + "settings.launcher" ] }, @@ -392,28 +408,37 @@ } }, "inverseCapabilitiesTransformations": {} + }, + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "start": { + "type": "gpii.androidActivityManager.startActivityByPackageName", + "packageName": "se.omnitor.ecmobile" + }, + "stop": [ + { + "type": "gpii.androidActivityManager.stopActivityByPackageName", + "packageName": "se.omnitor.ecmobile" + }, + { + "type": "gpii.androidActivityManager.goToHomeScreen" + } + ], + "isRunning": [{ + "type": "gpii.processReporter.neverRunning" + }] + } } }, + "start": [ + "settings.launcher" + ], "configure": [ "settings.configuration" ], "restore": [ "settings.configuration" - ], - "start": [ - { - "type": "gpii.androidActivityManager.startActivityByPackageName", - "packageName": "se.omnitor.ecmobile" - } - ], - "stop": [ - { - "type": "gpii.androidActivityManager.stopActivityByPackageName", - "packageName": "se.omnitor.ecmobile" - }, - { - "type": "gpii.androidActivityManager.goToHomeScreen" - } ] }, diff --git a/tests/platform/linux/linux-builtIn-testSpec.js b/tests/platform/linux/linux-builtIn-testSpec.js index 40ab6d14e..fdfa87226 100644 --- a/tests/platform/linux/linux-builtIn-testSpec.js +++ b/tests/platform/linux/linux-builtIn-testSpec.js @@ -104,16 +104,8 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ }] } }] - - } - }, - processes: [ - { - "command": "gsettings get org.gnome.desktop.a11y.applications screen-magnifier-enabled", - "expectConfigured": "true", - "expectRestored": "false" } - ] + } }, { name: "Testing os_common2 using default matchmaker", @@ -130,8 +122,7 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ } }] } - }, - processes: [] + } }, { name: "Testing os_gnome using default matchmaker", @@ -193,14 +184,7 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ } }] } - }, - processes: [ - { - "command": "gsettings get org.gnome.desktop.a11y.applications screen-magnifier-enabled", - "expectConfigured": "true", - "expectRestored": "false" - } - ] + } }, { name: "Testing os_win7 using default matchmaker", @@ -259,14 +243,7 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ }] } - }, - processes: [ - { - "command": "gsettings get org.gnome.desktop.a11y.applications screen-magnifier-enabled", - "expectConfigured": "true", - "expectRestored": "false" - } - ] + } } ]); diff --git a/tests/platform/linux/linux-chrome-testSpec.js b/tests/platform/linux/linux-chrome-testSpec.js index 46dd95da5..94055ef96 100644 --- a/tests/platform/linux/linux-chrome-testSpec.js +++ b/tests/platform/linux/linux-chrome-testSpec.js @@ -47,8 +47,7 @@ gpii.tests.linux.chrome.testDefs = [ } ] } - }, - processes: [] + } }, { name: "Acceptance test for font size transformation in Chrome", @@ -71,8 +70,7 @@ gpii.tests.linux.chrome.testDefs = [ } ] } - }, - processes: [] + } }, { name: "Acceptance test for magnification transformation in Chrome", @@ -95,8 +93,7 @@ gpii.tests.linux.chrome.testDefs = [ } ] } - }, - processes: [] + } } ]; diff --git a/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js b/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js index ced7bcf59..aae5de0c6 100644 --- a/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js +++ b/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js @@ -80,13 +80,6 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ }] } }, - processes: [ - { - "command": "gsettings get org.gnome.desktop.a11y.applications screen-reader-enabled", - "expectConfigured": "true", - "expectRestored": "false" - } - ], deviceReporters: { "gpii.packageKit.find": { "expectInstalled": ["orca"] @@ -147,13 +140,6 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ }] } }, - processes: [ - { - "command": "gsettings get org.gnome.desktop.a11y.applications screen-reader-enabled", - "expectConfigured": "true", - "expectRestored": "false" - } - ], deviceReporters: { "gpii.packageKit.find": { "expectInstalled": ["orca"] @@ -213,13 +199,6 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ }] } }, - processes: [ - { - "command": "gsettings get org.gnome.desktop.a11y.applications screen-reader-enabled", - "expectConfigured": "true", - "expectRestored": "false" - } - ], deviceReporters: { "gpii.packageKit.find": { "expectInstalled": ["orca"] diff --git a/tests/platform/linux/linux-orca-testSpec.js b/tests/platform/linux/linux-orca-testSpec.js index c5f839dad..e87e81c34 100644 --- a/tests/platform/linux/linux-orca-testSpec.js +++ b/tests/platform/linux/linux-orca-testSpec.js @@ -78,14 +78,7 @@ gpii.tests.linux.orca.testDefs = [ } }] } - }, - processes: [ - { - "command": "gsettings get org.gnome.desktop.a11y.applications screen-reader-enabled", - "expectConfigured": "true", - "expectRestored": "false" - } - ] + } }, { name: "Testing screenreader_orca using Flat matchmaker", @@ -139,14 +132,7 @@ gpii.tests.linux.orca.testDefs = [ } }] } - }, - processes: [ - { - "command": "gsettings get org.gnome.desktop.a11y.applications screen-reader-enabled", - "expectConfigured": "true", - "expectRestored": "false" - } - ] + } }, { name: "Testing screenreader_nvda using Flat matchmaker", @@ -199,14 +185,7 @@ gpii.tests.linux.orca.testDefs = [ } }] } - }, - processes: [ - { - "command": "gsettings get org.gnome.desktop.a11y.applications screen-reader-enabled", - "expectConfigured": "true", - "expectRestored": "false" - } - ] + } } ]; diff --git a/tests/platform/windows/windows-builtIn-testSpec.js b/tests/platform/windows/windows-builtIn-testSpec.js index a0326002c..f1bbfa69b 100644 --- a/tests/platform/windows/windows-builtIn-testSpec.js +++ b/tests/platform/windows/windows-builtIn-testSpec.js @@ -233,14 +233,7 @@ gpii.tests.windows.builtIn = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq Magnify.exe\" | find /I \"Magnify.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0" - } - ] + } }, { name: "Testing os_common using default matchmaker", userToken: "os_common", @@ -448,14 +441,7 @@ gpii.tests.windows.builtIn = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq Magnify.exe\" | find /I \"Magnify.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0" - } - ] + } }, { name: "Testing os_gnome using default matchmaker", userToken: "os_gnome", @@ -539,14 +525,7 @@ gpii.tests.windows.builtIn = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq Magnify.exe\" | find /I \"Magnify.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0" - } - ] + } } ]; diff --git a/tests/platform/windows/windows-chrome-testSpec.js b/tests/platform/windows/windows-chrome-testSpec.js index bc66b41ae..930cb0cd8 100644 --- a/tests/platform/windows/windows-chrome-testSpec.js +++ b/tests/platform/windows/windows-chrome-testSpec.js @@ -49,8 +49,7 @@ gpii.tests.windows.chrome = [ } ] } - }, - processes: [] + } }, { name: "Acceptance test for font size transformation in Chrome", @@ -73,8 +72,7 @@ gpii.tests.windows.chrome = [ } ] } - }, - processes: [] + } }, { name: "Acceptance test for magnification transformation in Chrome", @@ -97,8 +95,7 @@ gpii.tests.windows.chrome = [ } ] } - }, - processes: [] + } } ]; diff --git a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js index 1e2b80bc1..7da440571 100644 --- a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js +++ b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js @@ -82,13 +82,6 @@ gpii.tests.deviceReporterAware.windows = [ }] } }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq nvda.exe\" | find /I \"nvda.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0" - } - ], deviceReporters: { "gpii.deviceReporter.registryKeyExists": { "expectInstalled": [{ @@ -128,13 +121,6 @@ gpii.tests.deviceReporterAware.windows = [ }] } }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq ReadAndWrite.exe\" | find /I \"ReadAndWrite.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0" - } - ], deviceReporters: { "gpii.deviceReporter.registryKeyExists": { "expectInstalled": [{ diff --git a/tests/platform/windows/windows-jaws-testSpec.js b/tests/platform/windows/windows-jaws-testSpec.js index 26a529a10..569d661fd 100644 --- a/tests/platform/windows/windows-jaws-testSpec.js +++ b/tests/platform/windows/windows-jaws-testSpec.js @@ -108,15 +108,7 @@ gpii.tests.windows.jaws = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq jfw.exe\" | find /I \"jfw.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0", - "maxTimeouts": "40" - } - ] + } }, { name: "Testing NP set \"jaws_common\" using Flat matchmaker", @@ -201,15 +193,7 @@ gpii.tests.windows.jaws = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq jfw.exe\" | find /I \"jfw.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0", - "maxTimeouts": "40" - } - ] + } }, { name: "Testing NP set \"jaws_common2\" using Flat matchmaker", @@ -293,15 +277,7 @@ gpii.tests.windows.jaws = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq jfw.exe\" | find /I \"jfw.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0", - "maxTimeouts": "40" - } - ] + } }, { name: "Testing NP set \"jaws_common3\" using Flat matchmaker", @@ -386,15 +362,7 @@ gpii.tests.windows.jaws = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq jfw.exe\" | find /I \"jfw.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0", - "maxTimeouts": "40" - } - ] + } } ]; diff --git a/tests/platform/windows/windows-maavis-testSpec.js b/tests/platform/windows/windows-maavis-testSpec.js index b4c48c2ee..7d21f99e5 100644 --- a/tests/platform/windows/windows-maavis-testSpec.js +++ b/tests/platform/windows/windows-maavis-testSpec.js @@ -67,14 +67,7 @@ gpii.tests.windows.maavis = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq MaavisPortable.exe\" | find /I \"MaavisPortable.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0" - } - ] + } }, { name: "Testing maavis_selfvoicing using Flat matchmaker", userToken: "maavis_selfvoicing", @@ -117,14 +110,7 @@ gpii.tests.windows.maavis = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq MaavisPortable.exe\" | find /I \"MaavisPortable.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0" - } - ] + } } ]; diff --git a/tests/platform/windows/windows-nvda-testSpec.js b/tests/platform/windows/windows-nvda-testSpec.js index 1b466cfab..312bc4592 100644 --- a/tests/platform/windows/windows-nvda-testSpec.js +++ b/tests/platform/windows/windows-nvda-testSpec.js @@ -80,14 +80,7 @@ gpii.tests.windows.nvda = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq nvda.exe\" | find /I \"nvda.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0" - } - ] + } }, { name: "Testing screenreader_common using Flat matchmaker", userToken: "screenreader_common", @@ -141,14 +134,7 @@ gpii.tests.windows.nvda = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq nvda.exe\" | find /I \"nvda.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0" - } - ] + } }, { name: "Testing screenreader_orca using Flat matchmaker", userToken: "screenreader_orca", @@ -196,14 +182,7 @@ gpii.tests.windows.nvda = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq nvda.exe\" | find /I \"nvda.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0" - } - ] + } } ]; diff --git a/tests/platform/windows/windows-readWrite-testSpec.js b/tests/platform/windows/windows-readWrite-testSpec.js index 29dbb50cd..efe676e25 100644 --- a/tests/platform/windows/windows-readWrite-testSpec.js +++ b/tests/platform/windows/windows-readWrite-testSpec.js @@ -80,14 +80,7 @@ gpii.tests.windows.readWrite = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq ReadAndWrite.exe\" | find /I \"ReadAndWrite.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0" - } - ] + } }, { name: "Testing rwg2", userToken: "rwg2", @@ -148,14 +141,7 @@ gpii.tests.windows.readWrite = [ } }] } - }, - processes: [ - { - "command": "tasklist /fi \"STATUS eq RUNNING\" /FI \"IMAGENAME eq ReadAndWrite.exe\" | find /I \"ReadAndWrite.exe\" /C", - "expectConfigured": "1", - "expectRestored": "0" - } - ] + } } ]; diff --git a/tests/web/html/all-tests.html b/tests/web/html/all-tests.html index 9aa6e76fe..4528d57a7 100644 --- a/tests/web/html/all-tests.html +++ b/tests/web/html/all-tests.html @@ -26,7 +26,8 @@ "../../../gpii/node_modules/gpii-oauth2/gpii-oauth2-authz-server/test/html/AuthorizationServiceTests.html", "../../../gpii/node_modules/gpii-oauth2/gpii-oauth2-authz-server/test/html/UserServiceTests.html", "../../../gpii/node_modules/gpii-oauth2/gpii-oauth2-datastore/test/html/DataSource-PouchDBTests.html", - "../../../gpii/node_modules/gpii-oauth2/gpii-oauth2-utilities/test/html/OAuth2UtilitiesTests.html" + "../../../gpii/node_modules/gpii-oauth2/gpii-oauth2-utilities/test/html/OAuth2UtilitiesTests.html", + "../../../gpii/node_modules/processReporter/test/web/html/ProcessReporterTest.html" ]); QUnit.testSuites("GPII OAuth2 Component Tests", [ "../../../gpii/node_modules/gpii-oauth2/gpii-oauth2-authz-server/webTests/all-tests.html" From a5a59097c48a581f653f0b164b2ac606dc37dcf2 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Tue, 7 Mar 2017 13:17:18 +0100 Subject: [PATCH 05/44] GPII-442: Improvements to linux gsettings launch handler --- .../settingsHandlers/src/LaunchHandlers.js | 27 ++--- gpii/node_modules/testing/src/Integration.js | 7 ++ testData/solutions/android.json5 | 16 +-- testData/solutions/linux.json5 | 107 +++++++----------- testData/solutions/win32.json5 | 64 +++++------ tests/ContextIntegrationTests.js | 11 +- .../platform/linux/linux-builtIn-testSpec.js | 71 ++++-------- .../linux-dynamicDeviceReporter-testSpec.js | 39 ++----- tests/platform/linux/linux-orca-testSpec.js | 41 +++---- 9 files changed, 144 insertions(+), 239 deletions(-) diff --git a/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js b/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js index 537da67e4..daba8f5ec 100644 --- a/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js +++ b/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js @@ -29,13 +29,13 @@ gpii.launchHandlers.flexibleHandler.set = function (payload) { } // get current state - var currentState = gpii.launchHandlers.flexibleHandler.executeIsRunningBlock(handlerData.options, solutionId); + var currentState = gpii.launchHandlers.flexibleHandler.executeGetBlock(handlerData.options, solutionId); // if not in desired state if (currentState !== desiredState) { desiredState === true ? - gpii.launchHandlers.flexibleHandler.executeStartBlock(handlerData) : - gpii.launchHandlers.flexibleHandler.executeStopBlock(handlerData); + gpii.launchHandlers.flexibleHandler.executeSetBlock(handlerData, "setTrue") : + gpii.launchHandlers.flexibleHandler.executeStopBlock(handlerData, "setFalse"); } return gpii.settingsHandlers.setSettings(handlerData, { running: currentState }); @@ -46,26 +46,19 @@ gpii.launchHandlers.flexibleHandler.set = function (payload) { gpii.launchHandlers.flexibleHandler.get = function (payload) { return fluid.transform(payload, function (allSettingsBlocks, solutionId) { return fluid.transform(allSettingsBlocks, function (handlerData) { - var currentState = gpii.launchHandlers.flexibleHandler.executeIsRunningBlock(handlerData.options, solutionId); + var currentState = gpii.launchHandlers.flexibleHandler.executeGetBlock(handlerData.options, solutionId); return { settings: { running: currentState }}; }); }); }; -gpii.launchHandlers.flexibleHandler.executeStartBlock = function (mainEntry) { - var startBlocks = fluid.get(mainEntry, [ "options", "start" ]); - fluid.each(fluid.makeArray(startBlocks), function (startBlock) { - fluid.invokeGradedFunction(startBlock.type, startBlock); +gpii.launchHandlers.flexibleHandler.executeSetBlock = function (mainEntry, blockName) { + var setBlocks = fluid.get(mainEntry, [ "options", blockName ]); + fluid.each(fluid.makeArray(setBlocks), function (setBlock) { + fluid.invokeGradedFunction(setBlock.type, setBlock); }); }; -gpii.launchHandlers.flexibleHandler.executeStopBlock = function (mainEntry) { - var stopBlocks = fluid.get(mainEntry, [ "options", "stop" ]); - fluid.each(fluid.makeArray(stopBlocks), function (stopBlock) { - fluid.invokeGradedFunction(stopBlock.type, stopBlock); - }); -}; - -gpii.launchHandlers.flexibleHandler.executeIsRunningBlock = function (options) { - return gpii.processReporter.handleIsRunning(options); +gpii.launchHandlers.flexibleHandler.executeGetBlock = function (options) { + return gpii.processReporter.handleIsRunning({ isRunning: options.getState }); }; diff --git a/gpii/node_modules/testing/src/Integration.js b/gpii/node_modules/testing/src/Integration.js index b8c296a4d..8666a14a7 100644 --- a/gpii/node_modules/testing/src/Integration.js +++ b/gpii/node_modules/testing/src/Integration.js @@ -319,6 +319,10 @@ gpii.test.integration.registrySettingsHandlerKey = function (options) { return options.hKey + "|" + options.path; }; +gpii.test.integration.gsettingsLaunchKey = function (options) { + return options.schema + "|" + options.key; +} + fluid.defaults("gpii.test.integration.mockSettingsHandlerRegistry", { gradeNames: ["fluid.component"], rootPath: "gpii.test.integration.mockSettingsHandlers", // the global names for mocks will be deposited in here @@ -410,6 +414,9 @@ fluid.defaults("gpii.test.integration.mockSettingsHandlerRegistry.linux", { }, "gpii.alsa": { optionsPathKey: "NONE" + }, + "gpii.gsettings.launch": { + optionsPathkey: gpii.test.integration.gsettingsLaunchKey } } }); diff --git a/testData/solutions/android.json5 b/testData/solutions/android.json5 index 708f41db2..c36af5dee 100644 --- a/testData/solutions/android.json5 +++ b/testData/solutions/android.json5 @@ -17,10 +17,10 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": { + "setTrue": { "type": "gpii.androidActivityManager.startFreespeech" }, - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.neverRunning" }] } @@ -49,13 +49,13 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": { + "setTrue": { "type": "gpii.androidActivityManager.startTalkback" }, - "stop": { + "setFalse": { "type": "gpii.androidActivityManager.stopTalkback" }, - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.neverRunning" }] } @@ -412,11 +412,11 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": { + "setTrue": { "type": "gpii.androidActivityManager.startActivityByPackageName", "packageName": "se.omnitor.ecmobile" }, - "stop": [ + "setFalse": [ { "type": "gpii.androidActivityManager.stopActivityByPackageName", "packageName": "se.omnitor.ecmobile" @@ -425,7 +425,7 @@ "type": "gpii.androidActivityManager.goToHomeScreen" } ], - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.neverRunning" }] } diff --git a/testData/solutions/linux.json5 b/testData/solutions/linux.json5 index 3719d3d5b..b8b984d43 100644 --- a/testData/solutions/linux.json5 +++ b/testData/solutions/linux.json5 @@ -77,28 +77,10 @@ } }, "launcher": { - "type": "gpii.launchHandlers.flexibleHandler", + "type": "gpii.gsettings.launch", "options": { - "start": { - "type": "gpii.launch.exec", - "command": "gsettings set org.gnome.desktop.a11y.applications screen-magnifier-enabled true" - }, - "stop": { - "type": "gpii.launch.exec", - "command": "gsettings set org.gnome.desktop.a11y.applications screen-magnifier-enabled false" - }, - "isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "gnome-shell" - }, - { - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-magnifier-enabled", - "value": true - } - ] + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-magnifier-enabled" } } }, @@ -117,6 +99,12 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], + "isRunning": [ + "settings.launcher" + ], "isInstalled": [ { "type": "gpii.packageKit.find", @@ -293,25 +281,10 @@ ] }, "launching": { - "type": "gpii.launchHandlers.flexibleHandler", + "type": "gpii.gsettings.launch", "options": { - "start": { - "type": "gpii.launch.exec", - "command": "gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled true" - }, - "stop": { - "type": "gpii.launch.exec", - "command": "gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled false" - }, - "isRunning": [{ - "type": "gpii.processReporter.find", - "command": "caribou", - }, { - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-keyboard-enabled", - "value": true - }] + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-keyboard-enabled" } } }, @@ -321,6 +294,9 @@ "stop": [ "settings.launching" ], + "isRunning": [ + "settings.launching" + ], "isInstalled": [ { "type": "gpii.packageKit.find", @@ -1081,27 +1057,10 @@ } }, "launcher": { - "type": "gpii.launchHandlers.flexibleHandler", + "type": "gpii.gsettings.launch", "options": { - "verifySettings": true, - "retryOptions": { - "rewriteEvery": 0, - retryInterval: 200 - }, - "start": { - "type": "gpii.launch.exec", - "command": "gsettings set org.gnome.desktop.a11y.applications screen-reader-enabled true" - }, - "stop": { - "type": "gpii.launch.exec", - "command": "gsettings set org.gnome.desktop.a11y.applications screen-reader-enabled false" - }, - "isRunning": [{ // GPII-2306: Add check for Orca process - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-reader-enabled", - "value": true - }] + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" } } }, @@ -1117,6 +1076,9 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], "isInstalled": [ { "type": "gpii.packageKit.find", @@ -1191,15 +1153,15 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": { + "setTrue": { "type": "gpii.launch.exec", "command": "google-chrome http://easy123.org/user/${{userToken}}" }, - "stop": { + "setFalse": { "type": "gpii.launch.exec", "command": "pkill -2 chrome" }, - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.neverRunning" }] } @@ -1211,6 +1173,9 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], "isInstalled": [ { "type": "gpii.packageKit.find", @@ -1247,15 +1212,15 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": { + "setTrue": { "type": "gpii.launch.exec", "command": "google-chrome http://easy123.org/sudan" }, - "stop": { + "setFalse": { "type": "gpii.launch.exec", "command": "pkill -2 chrome" }, - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.neverRunning" }] } @@ -1267,6 +1232,9 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], "isInstalled": [ { "type": "gpii.packageKit.find", @@ -1303,15 +1271,15 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": { + "setTrue": { "type": "gpii.launch.exec", "command": "google-chrome http://webanywhere.cs.washington.edu/beta/?starting_url=http%3A%2F%2Fcloud4all.info" }, - "stop": { + "setFalse": { "type": "gpii.launch.exec", "command": "pkill -2 chrome" }, - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.neverRunning" }] } @@ -1323,6 +1291,9 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], "isInstalled": [ { "type": "gpii.packageKit.find", diff --git a/testData/solutions/win32.json5 b/testData/solutions/win32.json5 index afb0b8d37..ae0768ff0 100644 --- a/testData/solutions/win32.json5 +++ b/testData/solutions/win32.json5 @@ -563,19 +563,19 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "isRunning": [ + "getState": [ { "type": "gpii.processReporter.find", "command": "jaws" } ], - "start": [ + "setTrue": [ { "type": "gpii.launch.exec", "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\JAWS17.exe\\}\"" } ], - "stop": [ + "setFalse": [ { "type": "gpii.windows.closeProcessByName", "filename": "jfw.exe" @@ -637,19 +637,19 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": [ + "setTrue": [ { "type": "gpii.launch.exec", "command": "\"${{registry}.HKEY_CURRENT_USER\\Software\\Texthelp\\Read&Write11\\InstallPath}\\ReadAndWrite.exe\"" } ], - "stop": [ + "setFalse": [ { "type": "gpii.windows.closeProcessByName", "filename": "ReadAndWrite.exe" } ], - "isRunning": [ + "getState": [ { "type": "gpii.processReporter.find", "command": "readandwrite" @@ -792,21 +792,21 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": [ + "setTrue": [ { "type": "gpii.windows.enableRegisteredAT", "name": "magnifierpane", "enable": true } ], - "stop": [ + "setFalse": [ { "type": "gpii.windows.enableRegisteredAT", "name": "magnifierpane", "enable": false } ], - "isRunning": [ + "getState": [ { "type": "gpii.processReporter.find", "command": "Magnify" @@ -866,21 +866,21 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": [ + "setTrue": [ { "type": "gpii.windows.enableRegisteredAT", "name": "osk", "enable": true } ], - "stop": [ + "setFalse": [ { "type": "gpii.windows.enableRegisteredAT", "name": "osk", "enable": false } ], - "isRunning": [ + "getState": [ { "type": "gpii.processReporter.find", "command": "osk" @@ -1287,19 +1287,19 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "isRunning": [ + "getState": [ { "type": "gpii.processReporter.find", "command": "nvda" } ], - "start": [ + "setTrue": [ { "type": "gpii.launch.exec", "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\nvda.exe\\}\"" } ], - "stop": [ + "setFalse": [ { "type": "gpii.windows.closeProcessByName", "filename": "nvda_service.exe" @@ -1355,15 +1355,15 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": { + "setTrue": { "type": "gpii.launch.exec", "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\firefox.exe\\}\" http://easy123.org/user/${{userToken}}" }, - "stop": { + "setFalse": { "type": "gpii.windows.closeProcessByName", "filename": "firefox.exe" }, - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.neverRunning" }] } @@ -1402,15 +1402,15 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": { + "setTrue": { "type": "gpii.launch.exec", "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\firefox.exe\\}\" http://easy123.org/sudan" }, - "stop": { + "setFalse": { "type": "gpii.windows.closeProcessByName", "filename": "firefox.exe" }, - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.neverRunning" }] } @@ -1449,15 +1449,15 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": { + "setTrue": { "type": "gpii.launch.exec", "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\firefox.exe\\}\" \"http://webanywhere.cs.washington.edu/beta/?starting_url=http%3A%2F%2Fcloud4all.info\"" }, - "stop": { + "setFalse": { "type": "gpii.windows.closeProcessByName", "filename": "firefox.exe" }, - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.neverRunning" }] } @@ -1545,19 +1545,19 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": [ + "setTrue": [ { "type": "gpii.launch.exec", "command": "${{environment}.ComSpec} /c \"cd ${{environment}.MAAVIS_HOME} && MaavisPortable.cmd\"" } ], - "stop": [ + "setFalse": [ { "type": "gpii.windows.closeProcessByName", "filename": "firefox.exe" } ], - "isRunning": [ + "getState": [ { "type": "gpii.processReporter.find", "command": "MaavisPortable" @@ -2402,10 +2402,10 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": [{ + "setTrue": [{ "type": "gpii.windows.spiSettingsHandler.updateCursors" }], - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.neverRunning" }] } @@ -2486,19 +2486,19 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { - "start": [ + "setTrue": [ { "type": "gpii.launch.exec", "command": "C:\\Sociable\\Cloud4All.exe" } ], - "stop": [ + "setFalse": [ { "type": "gpii.launch.exec", "command": "C:\\Sociable\\Cloud4All.exe -stop" } ], - "isRunning": [ + "getState": [ { "type": "gpii.processReporter.find", "command": "Cloud4Allcd " diff --git a/tests/ContextIntegrationTests.js b/tests/ContextIntegrationTests.js index bafdbab73..8d63c70f7 100644 --- a/tests/ContextIntegrationTests.js +++ b/tests/ContextIntegrationTests.js @@ -218,7 +218,7 @@ gpii.tests.contextIntegration.data = { gpii.tests.contextIntegration.fixtures = [ { name: "Simple context change after login", - expect: 9, + expect: 7, sequenceSegments: [ [ { @@ -246,7 +246,6 @@ gpii.tests.contextIntegration.fixtures = [ args: ["{lifecycleManager}", "context1", "gpii-default"] } ], - gpii.test.createProcessChecks(gpii.tests.contextIntegration.data.processes, "expectConfigured"), gpii.tests.contextIntegration.changeEnvironmentAndCheck("bright"), [ { @@ -256,7 +255,6 @@ gpii.tests.contextIntegration.fixtures = [ listener: "gpii.test.logoutRequestListen" } ], - gpii.test.createProcessChecks(gpii.tests.contextIntegration.data.processes, "expectRestored"), [ { func: "gpii.test.checkRestoredConfiguration", @@ -270,7 +268,7 @@ gpii.tests.contextIntegration.fixtures = [ }, { name: "Context changed before login", - expect: 6, + expect: 5, sequenceSegments: [ [ { @@ -310,7 +308,6 @@ gpii.tests.contextIntegration.fixtures = [ listener: "gpii.test.logoutRequestListen" } ], - gpii.test.createProcessChecks(gpii.tests.contextIntegration.data.processes, "expectRestored"), [ { func: "gpii.test.checkRestoredConfiguration", @@ -323,7 +320,7 @@ gpii.tests.contextIntegration.fixtures = [ ] }, { name: "Multiple context changes", - expect: 15, + expect: 13, sequenceSegments: [ [ { @@ -351,7 +348,6 @@ gpii.tests.contextIntegration.fixtures = [ args: ["{lifecycleManager}", "context1", "gpii-default"] } ], - gpii.test.createProcessChecks(gpii.tests.contextIntegration.data.processes, "expectConfigured"), gpii.tests.contextIntegration.changeEnvironmentAndCheck("bright"), gpii.tests.contextIntegration.changeEnvironmentAndCheck("gpii-default"), gpii.tests.contextIntegration.changeEnvironmentAndCheck("noise"), @@ -364,7 +360,6 @@ gpii.tests.contextIntegration.fixtures = [ listener: "gpii.test.logoutRequestListen" } ], - gpii.test.createProcessChecks(gpii.tests.contextIntegration.data.processes, "expectRestored"), [ { func: "gpii.test.checkRestoredConfiguration", diff --git a/tests/platform/linux/linux-builtIn-testSpec.js b/tests/platform/linux/linux-builtIn-testSpec.js index fdfa87226..e7a84170c 100644 --- a/tests/platform/linux/linux-builtIn-testSpec.js +++ b/tests/platform/linux/linux-builtIn-testSpec.js @@ -15,9 +15,12 @@ Seventh Framework Programme (FP7/2007-2013) under grant agreement no. 289016. "use strict"; + var fluid = require("infusion"), gpii = fluid.registerNamespace("gpii"); +fluid.logObjectRenderChars = 2048 + fluid.require("%universal"); gpii.loadTestingSupport(); @@ -29,7 +32,7 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ name: "Testing os_common using default matchmaker", userToken: "os_common", integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.desktop.a11y.magnifier": [{ "settings": { "running": false @@ -68,40 +71,23 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ } }] }, - "gpii.launchHandlers.flexibleHandler": { - "org.gnome.desktop.a11y.applications.onscreen-keyboard": [{ + "gpii.gsettings.launch": { + "org.gnome.desktop.a11y.magnifier": [{ "settings": { "running": true }, "options": { - // start and stop blocks omitted for size/clarity - "isRunning": [{ - "type": "gpii.processReporter.find", - "command": "caribou" - }, { - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-keyboard-enabled", - "value": true - }] + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-magnifier-enabled" } }], - "org.gnome.desktop.a11y.magnifier": [{ + "org.gnome.desktop.a11y.applications.onscreen-keyboard": [{ "settings": { "running": true }, "options": { - // start and stop blocks omitted for size/clarity - "isRunning": [{ - "type": "gpii.processReporter.find", - "command": "gnome-shell" - }, - { - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-magnifier-enabled", - "value": true - }] + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-keyboard-enabled" } }] } @@ -128,7 +114,7 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ name: "Testing os_gnome using default matchmaker", userToken: "os_gnome", integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.desktop.a11y.magnifier": [{ "settings": { "running": false @@ -164,23 +150,14 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ } }] }, - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.desktop.a11y.magnifier": [{ "settings": { "running": true }, "options": { - // start and stop blocks omitted for size/clarity - "isRunning": [{ - "type": "gpii.processReporter.find", - "command": "gnome-shell" - }, - { - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-magnifier-enabled", - "value": true - }] + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-magnifier-enabled" } }] } @@ -190,7 +167,7 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ name: "Testing os_win7 using default matchmaker", userToken: "os_win7", integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.desktop.a11y.magnifier": [{ "settings": { "running": false @@ -222,27 +199,17 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ } }] }, - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.desktop.a11y.magnifier": [{ "settings": { "running": true }, "options": { - // start and stop blocks omitted for size/clarity - "isRunning": [{ - "type": "gpii.processReporter.find", - "command": "gnome-shell" - }, - { - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-magnifier-enabled", - "value": true - }] + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-magnifier-enabled" } }] } - } } ]); diff --git a/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js b/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js index aae5de0c6..94c1689c7 100644 --- a/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js +++ b/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js @@ -30,7 +30,7 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ gradeNames: "gpii.test.integration.deviceReporterAware.linux", userToken: "screenreader_common", integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { "running": false @@ -63,19 +63,14 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { "running": true }, "options": { - // start and stop blocks omitted for size/clarity - "isRunning": [{ - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-reader-enabled", - "value": true - }] + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" } }] } @@ -91,7 +86,7 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ gradeNames: "gpii.test.integration.deviceReporterAware.linux", userToken: "screenreader_orca", integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { "running": false @@ -123,19 +118,14 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { "running": true }, "options": { - // start and stop blocks omitted for size/clarity - "isRunning": [{ - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-reader-enabled", - "value": true - }] + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" } }] } @@ -151,7 +141,7 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ gradeNames: "gpii.test.integration.deviceReporterAware.linux", userToken: "screenreader_nvda", integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { "running": false @@ -182,19 +172,14 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { "running": true }, "options": { - // start and stop blocks omitted for size/clarity - "isRunning": [{ - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-reader-enabled", - "value": true - }] + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" } }] } diff --git a/tests/platform/linux/linux-orca-testSpec.js b/tests/platform/linux/linux-orca-testSpec.js index e87e81c34..644642d8b 100644 --- a/tests/platform/linux/linux-orca-testSpec.js +++ b/tests/platform/linux/linux-orca-testSpec.js @@ -22,6 +22,8 @@ fluid.require("%universal"); gpii.loadTestingSupport(); +fluid.logObjectRenderChars = 8000 + fluid.registerNamespace("gpii.tests.linux.orca"); gpii.tests.linux.orca.testDefs = [ @@ -29,7 +31,7 @@ gpii.tests.linux.orca.testDefs = [ name: "Testing screenreader_common using Flat matchmaker", userToken: "screenreader_common", integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { "running": false @@ -62,19 +64,14 @@ gpii.tests.linux.orca.testDefs = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { "running": true }, "options": { - // start and stop blocks omitted for size/clarity - "isRunning": [{ - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-reader-enabled", - "value": true - }] + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" } }] } @@ -84,7 +81,7 @@ gpii.tests.linux.orca.testDefs = [ name: "Testing screenreader_orca using Flat matchmaker", userToken: "screenreader_orca", integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { "running": false @@ -116,19 +113,14 @@ gpii.tests.linux.orca.testDefs = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { "running": true }, "options": { - // start and stop blocks omitted for size/clarity - "isRunning": [{ - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-reader-enabled", - "value": true - }] + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" } }] } @@ -138,7 +130,7 @@ gpii.tests.linux.orca.testDefs = [ name: "Testing screenreader_nvda using Flat matchmaker", userToken: "screenreader_nvda", integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { "running": false @@ -169,19 +161,14 @@ gpii.tests.linux.orca.testDefs = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { + "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { "running": true }, "options": { - // start and stop blocks omitted for size/clarity - "isRunning": [{ - "type": "gpii.processReporter.checkSetting", - "schema": "org.gnome.desktop.a11y.applications", - "setting": "screen-reader-enabled", - "value": true - }] + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" } }] } From ac4f90ea0f1dd1f79c374ea035848b09c1e16419 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 8 Mar 2017 22:57:34 +0100 Subject: [PATCH 06/44] GPII-1230: Working with already running solutions plus other minor improvements --- documentation/SolutionsRegistryFormat.md | 8 +- .../lifecycleManager/src/LifecycleManager.js | 118 ++++++++++++++---- .../test/js/LifecycleManagerTests.js | 49 ++++++++ .../src/settingsHandlerUtilities.js | 41 +++++- gpii/node_modules/testing/src/Integration.js | 23 ++-- gpii/node_modules/testing/src/Testing.js | 13 +- testData/solutions/linux.json5 | 5 + .../platform/linux/linux-builtIn-testSpec.js | 16 +++ .../linux-dynamicDeviceReporter-testSpec.js | 12 ++ tests/platform/linux/linux-orca-testSpec.js | 12 ++ .../windows/windows-builtIn-testSpec.js | 35 +++++- .../windows-dynamicDeviceReporter-testSpec.js | 18 ++- .../platform/windows/windows-jaws-testSpec.js | 36 +++++- .../windows/windows-maavis-testSpec.js | 18 ++- .../platform/windows/windows-nvda-testSpec.js | 27 +++- .../windows/windows-readWrite-testSpec.js | 18 ++- 16 files changed, 379 insertions(+), 70 deletions(-) diff --git a/documentation/SolutionsRegistryFormat.md b/documentation/SolutionsRegistryFormat.md index 969e78b0a..c7a6a7379 100644 --- a/documentation/SolutionsRegistryFormat.md +++ b/documentation/SolutionsRegistryFormat.md @@ -14,7 +14,7 @@ Each entry in the solution registry should have a unique ID (`Solution.id` in th "start": [ .. ], "stop": [ .. ], "isInstalled": [ .. ], - + // Not yet supported. Post-Cloud4All features. "install": [ ... ], "uninstall": [ ... ], @@ -116,7 +116,7 @@ These four lifecycle blocks have different meanings to the system but has the sa * `start`: Launch/start the solution * `stop`: Stop/kill the solution -Each of these lifecycle blocks allow the same content - which is an array with entries that are either references to settingsHandlers blocks or customized lifecycle blocks. To reference a settingsHandler block, the keywork `settings.` is used, where `` should be replaced with the name of a settingsHandler block. In the case of `configure` and `start`, a consequence of referencing a settingsHandler is that the settings given in the settingsHandler and users preferences set will be applied to that solution (and their original values will be saved to the system - if user just logged in). In the case of `restore` and `stop`, the settings that has previously been written using the settingshandler(s) in question will be restored. Alternative to referencings setting and restoring settings, arbitrary lifecycle actions are allowed - the syntax for this is an object that contains at least a `type` key for the function to call. None of these blocks are mandatory. +Each of these lifecycle blocks allow the same content - which is an array with entries that are either references to settingsHandlers blocks or customized lifecycle blocks. To reference a settingsHandler block, the keywork `settings.` is used, where `` should be replaced with the name of a settingsHandler block. In the case of `configure` and `start`, a consequence of referencing a settingsHandler is that the settings given in the settingsHandler and users preferences set will be applied to that solution (and their original values will be saved to the system - if user just logged in). In the case of `restore` and `stop`, the settings that has previously been written using the settingshandler(s) in question will be restored. Alternative to referencings setting and restoring settings, arbitrary lifecycle actions are allowed - the syntax for this is an object that contains at least a `type` key for the function to call. None of these blocks are mandatory. **Example blocks**: ``` @@ -144,7 +144,7 @@ Each of these lifecycle blocks allow the same content - which is an array with e The `update` block works very similarly to the configure, restore, start and stop blocks. It describes what should happen when the configuration needs to be updated (e.g. due to context changes, PCP adjustments, etc). -The format of the `update` block allows for the same entries as the configure, restore, start and stop blocks - that is: arbitrary lifecycle action blocks and `settings.`. Unlike for the other lifecycle blocks, the `update` block furthermore allows references to the `start`, `stop` and `configure` blocks. This is one by putting a string with the name of that block. When the system encounters one of these references, the entries of that block will be run. +The format of the `update` block allows for the same entries as the configure, restore, start and stop blocks - that is: arbitrary lifecycle action blocks and `settings.`. Unlike for the other lifecycle blocks, the `update` block furthermore allows references to the `start`, `stop` and `configure` blocks. This is done by putting a string with the name of that block. When the system encounters one of these references, the entries of that block will be run. **Example block**: ``` @@ -204,7 +204,7 @@ This is run before configuration to ensure that the application is actually read **Example Entry**: ``` -"isConfigurable": [{ +"isConfigurable": [{ "type": "gpii.reporter.fileExists", "path": "${{environment}.XDG_DATA_HOME}/orca/user-settings.conf"" }] diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index 36c32727d..e58e8f8f7 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -94,8 +94,13 @@ var gpii = fluid.registerNamespace("gpii"); args: ["{that}", "{arguments}.0", "{arguments}.1", "{arguments}.2", "{arguments}.3", "{arguments}.4"] // solutionId, settingsHandlers, actions, session, rootAction }, - invokeSettingsHandler: { - funcName: "gpii.lifecycleManager.invokeSettingsHandler", + invokeSettingsHandlerGet: { + funcName: "gpii.lifecycleManager.invokeSettingsHandlerGet", + args: ["{that}", "{arguments}.0", "{arguments}.1"] + // solutionId, settingsHandlers + }, + invokeSettingsHandlerSet: { + funcName: "gpii.lifecycleManager.invokeSettingsHandlerSet", args: ["{that}", "{arguments}.0", "{arguments}.1"] // solutionId, settingsHandlers }, @@ -103,6 +108,11 @@ var gpii = fluid.registerNamespace("gpii"); funcName: "gpii.lifecycleManager.restoreSnapshot", args: ["{that}", "{arguments}.0"] // originalSettings + }, + getSolutionRunningState: { + funcName: "gpii.lifecycleManager.getSolutionRunningState", + args: ["{that}", "{arguments}.0", "{arguments}.1", "{arguments}.2"] + // solutionId, solution, session } } }); @@ -171,19 +181,27 @@ var gpii = fluid.registerNamespace("gpii"); return fluid.get(armoured, [solutionId, 0]); }; - /** + gpii.lifecycleManager.invokeSettingsHandlerGet = function (that, solutionId, handlerSpec) { + // first prepare the payload for the settingsHandler in question - a more efficient + // implementation might bulk together payloads destined for the same handler + var settingsHandlerPayload = gpii.lifecycleManager.specToSettingsHandler(solutionId, handlerSpec); + var resolvedName = that.nameResolver.resolveName(handlerSpec.type, "settingsHandler"); + return gpii.settingsHandlers.dispatchSettingsHandlerGet(resolvedName, settingsHandlerPayload); + }; + + /** * @param handlerSpec {Object} A single settings handler specification * Payload example: * http://wiki.gpii.net/index.php/Settings_Handler_Payload_Examples * Transformer output: * http://wiki.gpii.net/index.php/Transformer_Payload_Examples */ - gpii.lifecycleManager.invokeSettingsHandler = function (that, solutionId, handlerSpec) { + gpii.lifecycleManager.invokeSettingsHandlerSet = function (that, solutionId, handlerSpec) { // first prepare the payload for the settingsHandler in question - a more efficient // implementation might bulk together payloads destined for the same handler var settingsHandlerPayload = gpii.lifecycleManager.specToSettingsHandler(solutionId, handlerSpec); var resolvedName = that.nameResolver.resolveName(handlerSpec.type, "settingsHandler"); - var setSettingsPromise = gpii.settingsHandlers.dispatchSettingsHandler(resolvedName, settingsHandlerPayload, that.options.retryOptions); + var setSettingsPromise = gpii.settingsHandlers.dispatchSettingsHandlerSet(resolvedName, settingsHandlerPayload, that.options.retryOptions); var togo = fluid.promise(); setSettingsPromise.then(function (handlerResponse) { @@ -226,13 +244,18 @@ var gpii = fluid.registerNamespace("gpii"); var toSnapshot = fluid.copy(solutionRecord); toSnapshot.settingsHandlers = {}; toSnapshot.settingsHandlers[settingsHandlerBlockName] = snapshot; - if (rootAction === "start") { - session.applier.change(["originalSettings", solutionId], toSnapshot); - } else if (rootAction === "update") { - // if we're doing an update, keep the settings that are already stored from the + if (rootAction === "start" || rootAction === "update") { + // keep the settings that are already stored from the // original snapshot, but augment it with any settings from the new snapshot // that were not present in the original snapshot. - // This workflow is tested in LifecycleManagerTests.js "Updating with normal reference to settingsHandler block, and 'undefined' value stored in snapshot" + // + // This is relevant when doing an update for obvious reasons + // (and tested) in LifecycleManagerTests.js "Updating with normal reference to settingsHandler block, and 'undefined' value stored in snapshot" + // + // It is also relevant for logins ("start" root action), in case a solution is already running. + // This would trigger a call to its "update" block. If that in turn eg. looks like the following + // [ "stop", "configure", "start" ] we would want the original state recorded during the "stop" + // action to persist - even when the "start" block is later run var mergedSettings = fluid.extend(true, {}, toSnapshot, session.model.originalSettings[solutionId]); var cleanedSettings = gpii.lifecycleManager.transformSolutionSettings(mergedSettings, gpii.lifecycleManager.cleanDeletes); session.applier.change(["originalSettings", solutionId], cleanedSettings); @@ -260,7 +283,7 @@ var gpii = fluid.registerNamespace("gpii"); * @param settingsHandlerBlockName {String} should be a reference to a settings block from the * settingsHandlers section. * @param rootAction {String} The root action on the LifecycleManager which is being serviced: "start", "stop", - * "update" or "restore" + * "update", "restore" or "isRunning" * @return {Function} a nullary function (a task), that once executed will set the settings returning a promise * that will be resolved once the settings are successfully set. */ @@ -272,13 +295,17 @@ var gpii = fluid.registerNamespace("gpii"); } return function () { var expanded = session.localResolver(settingsHandlerBlock); - var settingsPromise = that.invokeSettingsHandler(solutionId, expanded); - settingsPromise.then(function (snapshot) { - session.applier.change(["appliedSolutions", solutionId], solutionRecord); - gpii.lifecycleManager.recordSnapshotInSession(that, snapshot, solutionId, solutionRecord, session, - settingsHandlerBlockName, rootAction); - }); - return gpii.lifecycleManager.wrapRestorePromise(settingsPromise, rootAction); + if (rootAction === "isRunning") { // only run get and return directly if where checking for running applications + return that.invokeSettingsHandlerGet(solutionId, expanded); + } else { + var settingsPromise = that.invokeSettingsHandlerSet(solutionId, expanded); + settingsPromise.then(function (snapshot) { + session.applier.change(["appliedSolutions", solutionId], solutionRecord); + gpii.lifecycleManager.recordSnapshotInSession(that, snapshot, solutionId, solutionRecord, session, + settingsHandlerBlockName, rootAction); + }); + return gpii.lifecycleManager.wrapRestorePromise(settingsPromise, rootAction); + } }; }; @@ -385,7 +412,7 @@ var gpii = fluid.registerNamespace("gpii"); var settingsHandlerBlockName = action.substring("settings.".length); // if this is related to launching, overwrite entry with the appropriate settings, // that is: { running: true } if we're in a start block, else { running: false } - if (actionBlock === "start" || actionBlock === "stop") { + if (actionBlock === "start" || (actionBlock === "stop" && rootAction !== "stop") || actionBlock === "isRunning") { var launchSettings = { running: actionBlock === "start" ? true : false }; fluid.set(solutionRecord, [ "settingsHandlers", settingsHandlerBlockName, "settings"], launchSettings); } @@ -398,10 +425,13 @@ var gpii = fluid.registerNamespace("gpii"); if (action === "start" || action === "configure") { return that.executeActions(solutionId, solutionRecord, session, action, rootAction); } else if (action === "stop") { + // TODO KASPER -- OVERVEJ AT GENINDFØRE DET NEDENSTÅENDE // This branch is used when an "update" action requires a stop and start of the solution - var unarmoured = gpii.lifecycleManager.transformSolutionSettings( - session.model.originalSettings[solutionId], gpii.settingsHandlers.changesToSettings); - return that.executeActions(solutionId, unarmoured, session, "stop", rootAction); + // var unarmoured = gpii.lifecycleManager.transformSolutionSettings( + // session.model.originalSettings[solutionId], gpii.settingsHandlers.changesToSettings); + // return that.executeActions(solutionId, unarmoured, session, "stop", rootAction); + // TODO KASPER: Har erstattet ovenstående med: + return that.executeActions(solutionId, solutionRecord, session, "stop", rootAction); } else { fluid.fail("Unrecognised string action in LifecycleManager: " + action + " inside 'update' section for solution " + solutionId); @@ -455,7 +485,9 @@ var gpii = fluid.registerNamespace("gpii"); gpii.lifecycleManager.restoreSystem = function (that, session, rootAction) { var promises = fluid.transform(session.model.originalSettings, function (changesSolutionRecord, solutionId) { var solutionRecord = gpii.lifecycleManager.transformSolutionSettings(changesSolutionRecord, gpii.settingsHandlers.changesToSettings); - return that.applySolution(solutionId, solutionRecord, session, [ "stop", "restore" ], rootAction); + // if a solution was running on login, run the update block to ensure that restored settings are applied + var actions = session.model.runningOnLogin[solutionId] ? [ "update" ] : [ "stop", "restore" ]; + return that.applySolution(solutionId, solutionRecord, session, actions, rootAction); }); // TODO: In theory we could stop all solutions in parallel @@ -483,6 +515,19 @@ var gpii = fluid.registerNamespace("gpii"); }); }; + gpii.lifecycleManager.getSolutionRunningState = function (that, solutionId, solutionRecord, session) { + if (!fluid.isDestroyed(that)) { + var promise = that.executeActions(solutionId, solutionRecord, session, "isRunning", "isRunning"); + var togo = fluid.promise(); + promise.then(function (val) { + var isRunning = fluid.get(val, [0, solutionId, 0, "settings", "running"]); + session.applier.change(["runningOnLogin", solutionId], isRunning); + togo.resolve(isRunning); + }); + return togo; + } + }; + /** * Structure of lifecycleManager options: * userid: userid, @@ -561,9 +606,32 @@ var gpii = fluid.registerNamespace("gpii"); fluid.each(lifecycleInstructions, function (solution, solutionId) { tasks.push(function () { if (!fluid.isDestroyed(that)) { // See above comment for GPII-580 + // check the current state of the solution to decide whether we should run the + // "update", "start" or "stop" directive + return that.getSolutionRunningState(solutionId, solution, session); + } + }); + tasks.push(function () { + if (!fluid.isDestroyed(that)) { // See above comment for GPII-580 + // if solution is already running, call "update" directive - else use "start" directive + var isRunning = session.model.runningOnLogin[solutionId]; + var actions; + if (isRunning === true) { // if it's already running + if (solution.active === false) { // and it shouldn't + actions = [ "stop", "configure" ]; + } else { // else call "update" to make changes apply to a running solutions + actions = [ "update" ]; + } + } else { // if it is not running + if (solution.active === true) { // and we want it to run + actions = [ "configure", "start" ]; + } else { // else just configure it + actions = [ "configure" ] + } + } + // build structure for returned values (for later reset) - return that.applySolution(solutionId, solution, session, - (solution.active ? [ "configure", "start" ] : [ "configure" ]), "start"); + return that.applySolution(solutionId, solution, session, actions, "start"); } }); }); diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index 406df736d..92c65e257 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -673,6 +673,54 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt }); }; + gpii.tests.lifecycleManager.isRunningTests = function () { + jqUnit.asyncTest("Tests for correct behavior when application is not already running", function () { + // call start block for solution + gpii.tests.lifecycleManager.setup(); + // 2 tests for the settingsHandler (see mockSettingsHandler function above) + // 2 tests for the launchHandler (see mockLaunchHandler function above) + // and the two asserts below + jqUnit.expect(5); + var lifecycleManager = gpii.lifecycleManager(gpii.tests.lifecycleManager.testOptions); + gpii.tests.lifecycleManager.initBackingMock(); + + lifecycleManager.start(gpii.tests.lifecycleManager.startPayload, function () { + gpii.tests.lifecycleManager.assertExpectedExec(); + // gpii.tests.lifecycleManager.assertExpectedSettingsHandler(" - on start", gpii.tests.lifecycleManager.settingsHandlerExpectedInputNewSettings); + // lifecycleManager.stop(gpii.tests.lifecycleManager.userOptions, function () { + // gpii.tests.lifecycleManager.assertExpectedSettingsHandler(" - on stop", gpii.tests.lifecycleManager.settingsHandlerExpectedInputRestoreSettings); + // jqUnit.assertEquals("Expected pid has been sent to kill handler", + // 8839, gpii.tests.lifecycleManager.staticRepository.killHandler.pid); + // gpii.tests.lifecycleManager.assertNoActiveSessions(lifecycleManager, "stop: Stop message to lifecycle manager"); + // jqUnit.start(); + // }); + jqUnit.start(); + }); + + // expect the isRunning block to be called (will return false) + // do NOT expect the 'update' block to be called + // DO expect the 'start' block to be called + // the correct state should be stored + // the correct state should be applied + // on logout DO expect the 'stop' block to be called + // the correct state should be restored + + // TEST: Running on startup - no reference to start/stop block in update + // call start block for solution + // get for isRunning block should be called (will return true) + // Expect the update block to be called + // do NOT expect the start block to be called + // The correct state should be stored + // The correct state should be applied + // on logout, update should be called + // do NOT expect the stop block to be called + // + + + // TEST: Running on startup + }); + }; + gpii.tests.lifecycleManager.settingsToChanges = function (expected) { return gpii.settingsHandlers.transformOneSolutionSettings(expected, gpii.settingsHandlers.settingsToChanges); }; @@ -685,6 +733,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt jqUnit.module("Lifecycle Manager", function () { gpii.tests.staticRepository = {}; }); + gpii.tests.lifecycleManager.isRunningTests(); jqUnit.test("gpii.lifecycleManager.specToSettingsHandler()", function () { fluid.each(gpii.tests.lifecycleManager.specToSettingsHandlerTests, function (spec, name) { diff --git a/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js b/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js index 0bccbf2a9..0aeee8d44 100644 --- a/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js +++ b/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js @@ -258,7 +258,38 @@ gpii.settingsHandlers.checkRereadSettings = function (that) { }; /** - * Called to invoke settings handlers. Based on the first verifySettings option found in the payload, + * Called to invoke settings handlers' get functionality. + + * Structure of 'payload' argument is: + * { + * "some.app.id": [{ + * "settings": { ... }, + * "options": { + * ..., + * "verifySettings": true + * } + * }] + * } + * @param resolvedName {String} The resolved "trunk name" of the settings handler to be invoked - e.g. gpii.windows.registrySettingsHandler + * @param payload {Object} The full payload that would be sent to the SET method of the settings handler + * @return a promise that will yield the original payload of the invoked GET method + */ +gpii.settingsHandlers.dispatchSettingsHandlerGet = function (resolvedName, payload, retryOptions) { + // TODO "gpii.lifecycleManager.specToSettingsHandler" is the one responsible for this awkward + // layout of the settings handler payload - all of this infrastructure will have to be updated + // and cleaned up at some point + try { + var solutionIds = fluid.keys(payload); + return gpii.settingsHandlers.invokeGetHandler(resolvedName, payload); + } catch (e) { + fluid.log(fluid.logLevel.WARN, "Error received when dispatching settingsHandler.get " + resolvedName + " with payload ", + payload, ": " + e); + return fluid.promise().reject(e); + } +}; + +/** + * Called to invoke settings handlers' set function. Based on the first verifySettings option found in the payload, * the settingshandler will be invoked with retrying enabled (if true) or without it (false). * Structure of 'payload' argument is: * { @@ -278,7 +309,7 @@ gpii.settingsHandlers.checkRereadSettings = function (that) { * @return a promise that will yield the original payload of the invoked SET method. In the case * that retrying is enabled, a rejection occurs if the GET payloads never match after the end of the nominated retry period */ -gpii.settingsHandlers.dispatchSettingsHandler = function (resolvedName, payload, retryOptions) { +gpii.settingsHandlers.dispatchSettingsHandlerSet = function (resolvedName, payload, retryOptions) { // TODO "gpii.lifecycleManager.specToSettingsHandler" is the one responsible for this awkward // layout of the settings handler payload - all of this infrastructure will have to be updated // and cleaned up at some point @@ -290,12 +321,16 @@ gpii.settingsHandlers.dispatchSettingsHandler = function (resolvedName, payload, gpii.settingsHandlers.invokeRetryingHandler(resolvedName, payload, retryOptions) : gpii.settingsHandlers.invokeSetHandler(resolvedName, payload); } catch (e) { - fluid.log(fluid.logLevel.WARN, "Error received when dispatching settingsHandler " + resolvedName + " with payload ", + fluid.log(fluid.logLevel.WARN, "Error received when dispatching settingsHandler.set " + resolvedName + " with payload ", payload, ": " + e); return fluid.promise().reject(e); } }; +gpii.settingsHandlers.invokeGetHandler = function (resolvedName, payload) { + return gpii.toPromise(fluid.invokeGlobalFunction(resolvedName + ".get", [payload])); +}; + gpii.settingsHandlers.invokeSetHandler = function (resolvedName, payload) { return gpii.toPromise(fluid.invokeGlobalFunction(resolvedName + ".set", [payload])); }; diff --git a/gpii/node_modules/testing/src/Integration.js b/gpii/node_modules/testing/src/Integration.js index 8666a14a7..d55dae021 100644 --- a/gpii/node_modules/testing/src/Integration.js +++ b/gpii/node_modules/testing/src/Integration.js @@ -39,17 +39,11 @@ gpii.test.integration.exec.exec = function (that, processSpec /*, expected */) { that.events.onExecExit.fire(true, processSpec); }; -gpii.test.integration.prepopulateSettingsStore = function (testCaseHolder, settings) { - fluid.extend(true, testCaseHolder.settingsStore, { orig: settings }); +gpii.test.integration.prepopulateSettingsStore = function (testCaseHolder, nameResolver) { + var settingsHandlers = testCaseHolder.options.integrationPrepopulation; + gpii.test.setSettings(settingsHandlers, nameResolver); }; -gpii.test.integration.prepopulateSettingsSequence = fluid.freezeRecursive([ - { - func: "gpii.test.integration.prepopulateSettingsStore", - args: [ "{testCaseHolder}", "{testCaseHolder}.options.integrationPrepopulation" ] - } -]); - fluid.defaults("gpii.test.integration.testCaseHolder", { gradeNames: ["gpii.test.common.testCaseHolder"], // TODO: Namespace these distributions so they can be overridden @@ -75,6 +69,12 @@ fluid.defaults("gpii.test.integration.testCaseHolder", { target: "{that lifecycleManager > variableResolver}.options.components.resolverConfig.type", record: "gpii.test.integration.standardResolverConfig" }], + invokers: { + prepopulateSettingsStore: { + funcName: "gpii.test.integration.prepopulateSettingsStore", + args: [ "{that}", "{nameResolver}" ] + } + }, components: { exec: { type: "gpii.test.integration.exec" @@ -96,6 +96,9 @@ fluid.defaults("gpii.test.integration.testCaseHolder", { } } } + }, + listeners: { + "onCreate.prepopulateSettingsStore": "{that}.prepopulateSettingsStore" } }); @@ -416,7 +419,7 @@ fluid.defaults("gpii.test.integration.mockSettingsHandlerRegistry.linux", { optionsPathKey: "NONE" }, "gpii.gsettings.launch": { - optionsPathkey: gpii.test.integration.gsettingsLaunchKey + optionsPathKey: gpii.test.integration.gsettingsLaunchKey } } }); diff --git a/gpii/node_modules/testing/src/Testing.js b/gpii/node_modules/testing/src/Testing.js index 8d8f7f722..b8c85fa8b 100644 --- a/gpii/node_modules/testing/src/Testing.js +++ b/gpii/node_modules/testing/src/Testing.js @@ -369,10 +369,6 @@ gpii.test.push = function (array, elements) { * snapshot, login, expectConfigured, logout and expectRestored */ gpii.test.buildSingleTestFixture = function (testDef, rootGrades) { - var isIntegrationTest = fluid.find(rootGrades, function (val) { - return val.startsWith("gpii.test.integration") ? true : undefined; - }); - testDef.gradeNames = fluid.makeArray(testDef.gradeNames).concat(fluid.makeArray(rootGrades)); testDef.expect = 4; @@ -381,11 +377,6 @@ gpii.test.buildSingleTestFixture = function (testDef, rootGrades) { gpii.test.unshift(testDef.sequence, gpii.test.loginSequence); gpii.test.unshift(testDef.sequence, gpii.test.initialSequence); - // if integration test, prepopulate 'settings' for process reporter - if (isIntegrationTest) { - gpii.test.unshift(testDef.sequence, gpii.test.integration.prepopulateSettingsSequence); - } - gpii.test.push(testDef.sequence, gpii.test.logoutSequence); gpii.test.push(testDef.sequence, gpii.test.checkSequence); @@ -419,8 +410,8 @@ gpii.test.recordToTestDefs = function (record) { var testDefs = fluid.copy(fluid.getGlobalValue(record.testDefs)); fluid.each(testDefs, function (testDef) { testDef.config = { - configName: record.configName, - configPath: record.configPath + configName: testDef.configName || record.configName, + configPath: testDef.configPath || record.configPath }; }); return testDefs; diff --git a/testData/solutions/linux.json5 b/testData/solutions/linux.json5 index b8b984d43..06b98d1d4 100644 --- a/testData/solutions/linux.json5 +++ b/testData/solutions/linux.json5 @@ -1064,6 +1064,11 @@ } } }, + "update": [ + "stop", + "configure", + "start" + ], "configure": [ "settings.configuration" ], diff --git a/tests/platform/linux/linux-builtIn-testSpec.js b/tests/platform/linux/linux-builtIn-testSpec.js index e7a84170c..bd0d3970e 100644 --- a/tests/platform/linux/linux-builtIn-testSpec.js +++ b/tests/platform/linux/linux-builtIn-testSpec.js @@ -36,11 +36,19 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ "org.gnome.desktop.a11y.magnifier": [{ "settings": { "running": false + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-magnifier-enabled" } }], "org.gnome.desktop.a11y.applications.onscreen-keyboard": [{ "settings": { "running": false + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-keyboard-enabled" } }] } @@ -118,6 +126,10 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ "org.gnome.desktop.a11y.magnifier": [{ "settings": { "running": false + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-magnifier-enabled" } }] } @@ -171,6 +183,10 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ "org.gnome.desktop.a11y.magnifier": [{ "settings": { "running": false + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-magnifier-enabled" } }] } diff --git a/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js b/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js index 94c1689c7..6a0ff47a4 100644 --- a/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js +++ b/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js @@ -34,6 +34,10 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ "org.gnome.orca": [{ "settings": { "running": false + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" } }] } @@ -90,6 +94,10 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ "org.gnome.orca": [{ "settings": { "running": false + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" } }] } @@ -145,6 +153,10 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ "org.gnome.orca": [{ "settings": { "running": false + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" } }] } diff --git a/tests/platform/linux/linux-orca-testSpec.js b/tests/platform/linux/linux-orca-testSpec.js index 644642d8b..0cb8df889 100644 --- a/tests/platform/linux/linux-orca-testSpec.js +++ b/tests/platform/linux/linux-orca-testSpec.js @@ -35,6 +35,10 @@ gpii.tests.linux.orca.testDefs = [ "org.gnome.orca": [{ "settings": { "running": false + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" } }] } @@ -85,6 +89,10 @@ gpii.tests.linux.orca.testDefs = [ "org.gnome.orca": [{ "settings": { "running": false + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" } }] } @@ -134,6 +142,10 @@ gpii.tests.linux.orca.testDefs = [ "org.gnome.orca": [{ "settings": { "running": false + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" } }] } diff --git a/tests/platform/windows/windows-builtIn-testSpec.js b/tests/platform/windows/windows-builtIn-testSpec.js index f1bbfa69b..946cfd5a0 100644 --- a/tests/platform/windows/windows-builtIn-testSpec.js +++ b/tests/platform/windows/windows-builtIn-testSpec.js @@ -33,6 +33,12 @@ gpii.tests.windows.builtIn = [ "com.microsoft.windows.magnifier": [{ "settings": { "running": false + }, + "options": { + "getState": [{ + "type": "gpii.processReporter.find", + "command": "Magnify" + }] } }] } @@ -226,7 +232,7 @@ gpii.tests.windows.builtIn = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "Magnify" }] @@ -242,11 +248,25 @@ gpii.tests.windows.builtIn = [ "com.microsoft.windows.magnifier": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "Magnify" + }] } }], "com.microsoft.windows.onscreenKeyboard": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "osk" + }] } }] } @@ -422,7 +442,7 @@ gpii.tests.windows.builtIn = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "Magnify" }] @@ -434,7 +454,7 @@ gpii.tests.windows.builtIn = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "osk" }] @@ -450,6 +470,13 @@ gpii.tests.windows.builtIn = [ "com.microsoft.windows.magnifier": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "Magnify" + }] } }] } @@ -518,7 +545,7 @@ gpii.tests.windows.builtIn = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "Magnify" }] diff --git a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js index 7da440571..a36246ead 100644 --- a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js +++ b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js @@ -33,6 +33,13 @@ gpii.tests.deviceReporterAware.windows = [ "org.nvda-project": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "nvda" + }] } }] } @@ -74,7 +81,7 @@ gpii.tests.deviceReporterAware.windows = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "nvda" }] @@ -101,6 +108,13 @@ gpii.tests.deviceReporterAware.windows = [ "com.texthelp.readWriteGold": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "readandwrite" + }] } }] } @@ -113,7 +127,7 @@ gpii.tests.deviceReporterAware.windows = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "readandwrite" }] diff --git a/tests/platform/windows/windows-jaws-testSpec.js b/tests/platform/windows/windows-jaws-testSpec.js index 569d661fd..75fedf9c9 100644 --- a/tests/platform/windows/windows-jaws-testSpec.js +++ b/tests/platform/windows/windows-jaws-testSpec.js @@ -33,6 +33,13 @@ gpii.tests.windows.jaws = [ "com.freedomscientific.jaws": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "jaws" + }] } }] } @@ -101,7 +108,7 @@ gpii.tests.windows.jaws = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "jaws" }] @@ -118,6 +125,13 @@ gpii.tests.windows.jaws = [ "com.freedomscientific.jaws": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "jaws" + }] } }] } @@ -186,7 +200,7 @@ gpii.tests.windows.jaws = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "jaws" }] @@ -203,6 +217,13 @@ gpii.tests.windows.jaws = [ "com.freedomscientific.jaws": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "jaws" + }] } }] } @@ -270,7 +291,7 @@ gpii.tests.windows.jaws = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "jaws" }] @@ -287,6 +308,13 @@ gpii.tests.windows.jaws = [ "com.freedomscientific.jaws": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "jaws" + }] } }] } @@ -355,7 +383,7 @@ gpii.tests.windows.jaws = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "jaws" }] diff --git a/tests/platform/windows/windows-maavis-testSpec.js b/tests/platform/windows/windows-maavis-testSpec.js index 7d21f99e5..c0e967435 100644 --- a/tests/platform/windows/windows-maavis-testSpec.js +++ b/tests/platform/windows/windows-maavis-testSpec.js @@ -33,6 +33,13 @@ gpii.tests.windows.maavis = [ "net.opendirective.maavis": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "MaavisPortable" + }] } }] } @@ -60,7 +67,7 @@ gpii.tests.windows.maavis = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "MaavisPortable" }] @@ -76,6 +83,13 @@ gpii.tests.windows.maavis = [ "net.opendirective.maavis": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "MaavisPortable" + }] } }] } @@ -103,7 +117,7 @@ gpii.tests.windows.maavis = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "MaavisPortable" }] diff --git a/tests/platform/windows/windows-nvda-testSpec.js b/tests/platform/windows/windows-nvda-testSpec.js index 312bc4592..f0582d56c 100644 --- a/tests/platform/windows/windows-nvda-testSpec.js +++ b/tests/platform/windows/windows-nvda-testSpec.js @@ -33,6 +33,13 @@ gpii.tests.windows.nvda = [ "org.nvda-project": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "nvda" + }] } }] } @@ -73,7 +80,7 @@ gpii.tests.windows.nvda = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "nvda" }] @@ -89,6 +96,13 @@ gpii.tests.windows.nvda = [ "org.nvda-project": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "nvda" + }] } }] } @@ -127,7 +141,7 @@ gpii.tests.windows.nvda = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "nvda" }] @@ -143,6 +157,13 @@ gpii.tests.windows.nvda = [ "org.nvda-project": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "nvda" + }] } }] } @@ -175,7 +196,7 @@ gpii.tests.windows.nvda = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "nvda" }] diff --git a/tests/platform/windows/windows-readWrite-testSpec.js b/tests/platform/windows/windows-readWrite-testSpec.js index efe676e25..e0120f9eb 100644 --- a/tests/platform/windows/windows-readWrite-testSpec.js +++ b/tests/platform/windows/windows-readWrite-testSpec.js @@ -30,6 +30,13 @@ gpii.tests.windows.readWrite = [ "com.texthelp.readWriteGold": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "readandwrite" + }] } }] } @@ -73,7 +80,7 @@ gpii.tests.windows.readWrite = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "readandwrite" }] @@ -89,6 +96,13 @@ gpii.tests.windows.readWrite = [ "com.texthelp.readWriteGold": [{ "settings": { "running": false + }, + "options": { + // start and stop blocks omitted for size/clarity + "getState": [{ + "type": "gpii.processReporter.find", + "command": "readandwrite" + }] } }] } @@ -134,7 +148,7 @@ gpii.tests.windows.readWrite = [ }, "options": { // start and stop blocks omitted for size/clarity - "isRunning": [{ + "getState": [{ "type": "gpii.processReporter.find", "command": "readandwrite" }] From 30e77a1d023bbaf98cc7232ca27afc390d1ec198 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Thu, 9 Mar 2017 22:45:44 +0100 Subject: [PATCH 07/44] GPII-1230: Fixed most of the windows acceptance tests --- .../settingsHandlers/src/LaunchHandlers.js | 2 +- testData/solutions/win32.json5 | 107 +++++++++++------- .../windows/windows-builtIn-testSpec.js | 14 +-- .../windows-dynamicDeviceReporter-testSpec.js | 8 +- .../platform/windows/windows-jaws-testSpec.js | 30 ++--- .../windows/windows-maavis-testSpec.js | 8 +- .../windows/windows-readWrite-testSpec.js | 8 +- 7 files changed, 99 insertions(+), 78 deletions(-) diff --git a/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js b/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js index daba8f5ec..cc9fb6b57 100644 --- a/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js +++ b/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js @@ -35,7 +35,7 @@ gpii.launchHandlers.flexibleHandler.set = function (payload) { if (currentState !== desiredState) { desiredState === true ? gpii.launchHandlers.flexibleHandler.executeSetBlock(handlerData, "setTrue") : - gpii.launchHandlers.flexibleHandler.executeStopBlock(handlerData, "setFalse"); + gpii.launchHandlers.flexibleHandler.executeSetBlock(handlerData, "setFalse"); } return gpii.settingsHandlers.setSettings(handlerData, { running: currentState }); diff --git a/testData/solutions/win32.json5 b/testData/solutions/win32.json5 index ae0768ff0..2bfe94fc8 100644 --- a/testData/solutions/win32.json5 +++ b/testData/solutions/win32.json5 @@ -563,10 +563,15 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20 + }, "getState": [ { "type": "gpii.processReporter.find", - "command": "jaws" + "command": "jfw" } ], "setTrue": [ @@ -579,6 +584,14 @@ { "type": "gpii.windows.closeProcessByName", "filename": "jfw.exe" + }, + { + "type": "gpii.windows.closeProcessByName", + "filename": "fsSynth32.exe" + }, + { + "type": "gpii.windows.closeProcessByName", + "filename": "jhookldr.exe" } ] } @@ -598,6 +611,9 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], "isInstalled": [ { "type": "gpii.deviceReporter.registryKeyExists", @@ -670,6 +686,9 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], "isInstalled": [ { "type": "gpii.deviceReporter.registryKeyExists", @@ -790,28 +809,10 @@ } }, "launcher": { - "type": "gpii.launchHandlers.flexibleHandler", + "type": "gpii.windows.enableRegisteredAT", "options": { - "setTrue": [ - { - "type": "gpii.windows.enableRegisteredAT", - "name": "magnifierpane", - "enable": true - } - ], - "setFalse": [ - { - "type": "gpii.windows.enableRegisteredAT", - "name": "magnifierpane", - "enable": false - } - ], - "getState": [ - { - "type": "gpii.processReporter.find", - "command": "Magnify" - } - ] + "registryName": "magnifierpane", + "queryProcess": "Magnify" } } }, @@ -821,6 +822,9 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], "configure": [ "settings.configure" ], @@ -864,28 +868,10 @@ } }, "launcher": { - "type": "gpii.launchHandlers.flexibleHandler", + "type": "gpii.windows.enableRegisteredAT", "options": { - "setTrue": [ - { - "type": "gpii.windows.enableRegisteredAT", - "name": "osk", - "enable": true - } - ], - "setFalse": [ - { - "type": "gpii.windows.enableRegisteredAT", - "name": "osk", - "enable": false - } - ], - "getState": [ - { - "type": "gpii.processReporter.find", - "command": "osk" - } - ] + "registryName": "osk", + "queryProcess": "osk" } } }, @@ -895,6 +881,9 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], "configure": [ "settings.configure" ], @@ -1287,6 +1276,11 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20 + }, "getState": [ { "type": "gpii.processReporter.find", @@ -1317,12 +1311,16 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], "configure": [ "settings.configs" ], "restore": [ "settings.configs" ], + "isInstalled": [ { "type": "gpii.deviceReporter.registryKeyExists", @@ -1375,6 +1373,9 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" @@ -1422,6 +1423,9 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" @@ -1469,6 +1473,9 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" @@ -1545,6 +1552,11 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { + "verifySettings": true, + "retryOptions": { + "rewriteEvery": 0, + "numRetries": 20 + }, "setTrue": [ { "type": "gpii.launch.exec", @@ -1578,6 +1590,9 @@ "stop": [ "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" @@ -2415,6 +2430,9 @@ "settings.launcher" ], "stop": [], + "isRunning": [ + "settings.launcher" + ], "configure": [ "settings.configure" ], @@ -2513,6 +2531,9 @@ "restore": [ "settings.configuration" ], + "isRunning": [ + "settings.launcher" + ], "start": [ "settings.launcher" ], diff --git a/tests/platform/windows/windows-builtIn-testSpec.js b/tests/platform/windows/windows-builtIn-testSpec.js index 946cfd5a0..bd227ba3d 100644 --- a/tests/platform/windows/windows-builtIn-testSpec.js +++ b/tests/platform/windows/windows-builtIn-testSpec.js @@ -231,7 +231,7 @@ gpii.tests.windows.builtIn = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "Magnify" @@ -250,7 +250,7 @@ gpii.tests.windows.builtIn = [ "running": false }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "Magnify" @@ -262,7 +262,7 @@ gpii.tests.windows.builtIn = [ "running": false }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "osk" @@ -441,7 +441,7 @@ gpii.tests.windows.builtIn = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "Magnify" @@ -453,7 +453,7 @@ gpii.tests.windows.builtIn = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "osk" @@ -472,7 +472,7 @@ gpii.tests.windows.builtIn = [ "running": false }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "Magnify" @@ -544,7 +544,7 @@ gpii.tests.windows.builtIn = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "Magnify" diff --git a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js index a36246ead..9f0b80187 100644 --- a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js +++ b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js @@ -35,7 +35,7 @@ gpii.tests.deviceReporterAware.windows = [ "running": false }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "nvda" @@ -80,7 +80,7 @@ gpii.tests.deviceReporterAware.windows = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "nvda" @@ -110,7 +110,7 @@ gpii.tests.deviceReporterAware.windows = [ "running": false }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "readandwrite" @@ -126,7 +126,7 @@ gpii.tests.deviceReporterAware.windows = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "readandwrite" diff --git a/tests/platform/windows/windows-jaws-testSpec.js b/tests/platform/windows/windows-jaws-testSpec.js index 75fedf9c9..01e6ed44c 100644 --- a/tests/platform/windows/windows-jaws-testSpec.js +++ b/tests/platform/windows/windows-jaws-testSpec.js @@ -35,10 +35,10 @@ gpii.tests.windows.jaws = [ "running": false }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", - "command": "jaws" + "command": "jfw" }] } }] @@ -107,10 +107,10 @@ gpii.tests.windows.jaws = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", - "command": "jaws" + "command": "jfw" }] } }] @@ -127,10 +127,10 @@ gpii.tests.windows.jaws = [ "running": false }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", - "command": "jaws" + "command": "jfw" }] } }] @@ -199,10 +199,10 @@ gpii.tests.windows.jaws = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", - "command": "jaws" + "command": "jfw" }] } }] @@ -219,10 +219,10 @@ gpii.tests.windows.jaws = [ "running": false }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", - "command": "jaws" + "command": "jfw" }] } }] @@ -290,10 +290,10 @@ gpii.tests.windows.jaws = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", - "command": "jaws" + "command": "jfw" }] } }] @@ -310,7 +310,7 @@ gpii.tests.windows.jaws = [ "running": false }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "jaws" @@ -382,10 +382,10 @@ gpii.tests.windows.jaws = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", - "command": "jaws" + "command": "jfw" }] } }] diff --git a/tests/platform/windows/windows-maavis-testSpec.js b/tests/platform/windows/windows-maavis-testSpec.js index c0e967435..76ff0e861 100644 --- a/tests/platform/windows/windows-maavis-testSpec.js +++ b/tests/platform/windows/windows-maavis-testSpec.js @@ -35,7 +35,7 @@ gpii.tests.windows.maavis = [ "running": false }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "MaavisPortable" @@ -66,7 +66,7 @@ gpii.tests.windows.maavis = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "MaavisPortable" @@ -85,7 +85,7 @@ gpii.tests.windows.maavis = [ "running": false }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "MaavisPortable" @@ -116,7 +116,7 @@ gpii.tests.windows.maavis = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "MaavisPortable" diff --git a/tests/platform/windows/windows-readWrite-testSpec.js b/tests/platform/windows/windows-readWrite-testSpec.js index e0120f9eb..dce3099b6 100644 --- a/tests/platform/windows/windows-readWrite-testSpec.js +++ b/tests/platform/windows/windows-readWrite-testSpec.js @@ -32,7 +32,7 @@ gpii.tests.windows.readWrite = [ "running": false }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "readandwrite" @@ -79,7 +79,7 @@ gpii.tests.windows.readWrite = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "readandwrite" @@ -98,7 +98,7 @@ gpii.tests.windows.readWrite = [ "running": false }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "readandwrite" @@ -147,7 +147,7 @@ gpii.tests.windows.readWrite = [ "running": true }, "options": { - // start and stop blocks omitted for size/clarity + // setTrue and setFalse blocks omitted for size/clarity "getState": [{ "type": "gpii.processReporter.find", "command": "readandwrite" From a645511e6e4898f6bfc0592014b27d9070410084 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Fri, 10 Mar 2017 14:43:32 +0100 Subject: [PATCH 08/44] GPII-1230: Committing to do Acceptance tests in linux --- .../src/settingsHandlerUtilities.js | 11 +- gpii/node_modules/testing/src/Integration.js | 21 +- gpii/node_modules/testing/src/Testing.js | 49 +- testData/solutions/android.json5 | 15 + testData/solutions/linux.json5 | 3 - testData/solutions/win32.json5 | 53 +- .../platform/linux/linux-builtIn-testSpec.js | 150 +++++- .../linux-dynamicDeviceReporter-testSpec.js | 6 +- tests/platform/linux/linux-orca-testSpec.js | 65 ++- .../windows/windows-builtIn-testSpec.js | 493 ++++++++++++++++-- .../windows-dynamicDeviceReporter-testSpec.js | 4 +- .../platform/windows/windows-jaws-testSpec.js | 248 ++++----- .../windows/windows-maavis-testSpec.js | 135 ++--- .../platform/windows/windows-nvda-testSpec.js | 301 +++++------ .../windows/windows-readWrite-testSpec.js | 123 ++++- 15 files changed, 1235 insertions(+), 442 deletions(-) diff --git a/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js b/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js index 0aeee8d44..ed9a99a8e 100644 --- a/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js +++ b/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js @@ -257,6 +257,12 @@ gpii.settingsHandlers.checkRereadSettings = function (that) { } }; +gpii.settingsHandlers.dispatchSettingsHandler = function (resolvedName, payload, operation, retryOptions) { + return (operation === "get") ? + gpii.settingsHandlers.dispatchSettingsHandlerGet(resolvedName, payload) : + gpii.settingsHandlers.dispatchSettingsHandlerSet(resolvedName, payload, retryOptions); +}; + /** * Called to invoke settings handlers' get functionality. @@ -265,8 +271,7 @@ gpii.settingsHandlers.checkRereadSettings = function (that) { * "some.app.id": [{ * "settings": { ... }, * "options": { - * ..., - * "verifySettings": true + * ... * } * }] * } @@ -274,7 +279,7 @@ gpii.settingsHandlers.checkRereadSettings = function (that) { * @param payload {Object} The full payload that would be sent to the SET method of the settings handler * @return a promise that will yield the original payload of the invoked GET method */ -gpii.settingsHandlers.dispatchSettingsHandlerGet = function (resolvedName, payload, retryOptions) { +gpii.settingsHandlers.dispatchSettingsHandlerGet = function (resolvedName, payload) { // TODO "gpii.lifecycleManager.specToSettingsHandler" is the one responsible for this awkward // layout of the settings handler payload - all of this infrastructure will have to be updated // and cleaned up at some point diff --git a/gpii/node_modules/testing/src/Integration.js b/gpii/node_modules/testing/src/Integration.js index d55dae021..55767a06a 100644 --- a/gpii/node_modules/testing/src/Integration.js +++ b/gpii/node_modules/testing/src/Integration.js @@ -39,11 +39,6 @@ gpii.test.integration.exec.exec = function (that, processSpec /*, expected */) { that.events.onExecExit.fire(true, processSpec); }; -gpii.test.integration.prepopulateSettingsStore = function (testCaseHolder, nameResolver) { - var settingsHandlers = testCaseHolder.options.integrationPrepopulation; - gpii.test.setSettings(settingsHandlers, nameResolver); -}; - fluid.defaults("gpii.test.integration.testCaseHolder", { gradeNames: ["gpii.test.common.testCaseHolder"], // TODO: Namespace these distributions so they can be overridden @@ -69,12 +64,6 @@ fluid.defaults("gpii.test.integration.testCaseHolder", { target: "{that lifecycleManager > variableResolver}.options.components.resolverConfig.type", record: "gpii.test.integration.standardResolverConfig" }], - invokers: { - prepopulateSettingsStore: { - funcName: "gpii.test.integration.prepopulateSettingsStore", - args: [ "{that}", "{nameResolver}" ] - } - }, components: { exec: { type: "gpii.test.integration.exec" @@ -96,9 +85,6 @@ fluid.defaults("gpii.test.integration.testCaseHolder", { } } } - }, - listeners: { - "onCreate.prepopulateSettingsStore": "{that}.prepopulateSettingsStore" } }); @@ -400,7 +386,10 @@ fluid.defaults("gpii.test.integration.mockSettingsHandlerRegistry.windows", { delaying: true, optionsPathKey: "setAction" }, - "gpii.windows.displaySettingsHandler": {} + "gpii.windows.displaySettingsHandler": {}, + "gpii.windows.enableRegisteredAT": { + optionsPathKey: "registryName" + } } }); @@ -420,7 +409,7 @@ fluid.defaults("gpii.test.integration.mockSettingsHandlerRegistry.linux", { }, "gpii.gsettings.launch": { optionsPathKey: gpii.test.integration.gsettingsLaunchKey - } + }, } }); diff --git a/gpii/node_modules/testing/src/Testing.js b/gpii/node_modules/testing/src/Testing.js index b8c85fa8b..c5794db07 100644 --- a/gpii/node_modules/testing/src/Testing.js +++ b/gpii/node_modules/testing/src/Testing.js @@ -143,7 +143,9 @@ gpii.test.operateSettings = function (settingsHandlers, nameResolver, method) { var ret = {}; fluid.each(settingsHandlers, function (handlerBlock, handlerID) { var resolvedName = nameResolver ? nameResolver.resolveName(handlerID, "settingsHandler") : handlerID; - var response = fluid.invokeGlobalFunction(resolvedName + "." + method, [handlerBlock]); + var response = gpii.settingsHandlers.dispatchSettingsHandler(resolvedName, handlerBlock, method); + + // var response = fluid.invokeGlobalFunction(resolvedName + "." + method, [handlerBlock]); ret[handlerID] = response; }); var togo = gpii.test.settleStructure(ret); @@ -153,6 +155,12 @@ gpii.test.operateSettings = function (settingsHandlers, nameResolver, method) { return togo; }; +gpii.test.setInitialState = function (settingsHandlers, nameResolver, onComplete) { + console.log("KASPER: SETTING INITIAL STATE " + JSON.stringify(settingsHandlers, null, 2)); + var promise = gpii.test.setSettings(settingsHandlers, nameResolver); + promise.then(onComplete) +} + /** Snapshot the state of all settingsHandlers by stashing them in a member named `orig` on the supplied settingsStore * @param settingsHandlers {Object} A map of settings handler names to `settingsHandler` blocks as seen in the `settingsHandlers` * option of a `gpii.test.common.testCaseHolder` @@ -180,11 +188,15 @@ gpii.test.extractSettingsBlocks = function (settingsHandlers) { return fluid.transform(settingsHandlers, gpii.settingsHandlers.extractSettingsBlocks); }; -gpii.test.checkConfiguration = function (settingsHandlers, nameResolver, onComplete) { +gpii.test.checkConfiguration = function (settingsHandlers, nameResolver, onComplete, customMsg) { + console.log("KASPER: CHECKING CONFIGURATION " + JSON.stringify(settingsHandlers, null, 2)); var configPromise = gpii.test.getSettings(settingsHandlers, nameResolver); configPromise.then(function (config) { var noOptions = gpii.test.extractSettingsBlocks(settingsHandlers); - jqUnit.assertDeepEq("Checking that settings are set", noOptions, config); + jqUnit.assertDeepEq(customMsg || "Checking that settings are set", noOptions, config); + // console.log(JSON.stringify(noOptions, null, 2)) + // console.log("VS") + // console.log(JSON.stringify(config, null, 2)) onComplete(); }); }; @@ -240,10 +252,13 @@ fluid.defaults("gpii.test.common.testCaseHolder", { settingsStore: {} }, mergePolicy: { - "settingsHandlers": "noexpand" + "settingsHandlers": "noexpand", + "initialState": "noexpand" // KASPER? }, events: { onSnapshotComplete: null, + onInitialStateSet: null, + onInitialStateConfirmed: null, onCheckConfigurationComplete: null, onCheckRestoredConfigurationComplete: null }, @@ -309,7 +324,25 @@ gpii.test.expandSettings = function (testCaseHolder, members) { }; // TODO: remove these clumsy constants once https://issues.fluidproject.org/browse/FLUID-5903 is implemented -gpii.test.initialSequence = fluid.freezeRecursive([ +gpii.test.initalStateSequence = fluid.freezeRecursive([ + { + func: "gpii.test.expandSettings", + args: [ "{tests}", "initialState" ] + }, { + func: "gpii.test.setInitialState", + args: [ "{tests}.initialState", "{nameResolver}", "{testCaseHolder}.events.onInitialStateSet.fire"] + }, { + event: "{testCaseHolder}.events.onInitialStateSet", + listener: "fluid.identity" + }, { + func: "gpii.test.checkConfiguration", + args: ["{tests}.initialState", "{nameResolver}", "{testCaseHolder}.events.onInitialStateConfirmed.fire", "Confirming initial state"] + }, { + event: "{testCaseHolder}.events.onInitialStateConfirmed", + listener: "fluid.identity" + } +]) +gpii.test.snapshotSequence = fluid.freezeRecursive([ { func: "gpii.test.expandSettings", args: [ "{tests}", "settingsHandlers" ] @@ -375,7 +408,11 @@ gpii.test.buildSingleTestFixture = function (testDef, rootGrades) { testDef.sequence = fluid.makeArray(testDef.sequence); gpii.test.unshift(testDef.sequence, gpii.test.loginSequence); - gpii.test.unshift(testDef.sequence, gpii.test.initialSequence); + gpii.test.unshift(testDef.sequence, gpii.test.snapshotSequence); + if (testDef.initialState) { + gpii.test.unshift(testDef.sequence, gpii.test.initalStateSequence); + testDef.expect++; + } gpii.test.push(testDef.sequence, gpii.test.logoutSequence); diff --git a/testData/solutions/android.json5 b/testData/solutions/android.json5 index c36af5dee..52c87d30f 100644 --- a/testData/solutions/android.json5 +++ b/testData/solutions/android.json5 @@ -28,6 +28,9 @@ }, "start": [ "settings.launcher" + ], + "isRunning": [ + "settings.launcher" ] }, @@ -63,6 +66,12 @@ }, "start": [ "settings.launcher" + ], + "stop": [ + "settings.launcher" + ], + "isRunning": [ + "settings.launcher" ] }, @@ -434,6 +443,12 @@ "start": [ "settings.launcher" ], + "stop": [ + "settings.launcher" + ], + "isRunning": [ + "settings.launcher" + ], "configure": [ "settings.configuration" ], diff --git a/testData/solutions/linux.json5 b/testData/solutions/linux.json5 index 06b98d1d4..968034727 100644 --- a/testData/solutions/linux.json5 +++ b/testData/solutions/linux.json5 @@ -102,9 +102,6 @@ "isRunning": [ "settings.launcher" ], - "isRunning": [ - "settings.launcher" - ], "isInstalled": [ { "type": "gpii.packageKit.find", diff --git a/testData/solutions/win32.json5 b/testData/solutions/win32.json5 index 2bfe94fc8..60647ff8c 100644 --- a/testData/solutions/win32.json5 +++ b/testData/solutions/win32.json5 @@ -501,11 +501,6 @@ "inverseCapabilitiesTransformations": { "http://registry\\.gpii\\.net/common/speechSynthesizer": "Options\\.PrimarySynthesizer", "http://registry\\.gpii\\.net/common/speechRate": "ENU-Global\\.Rate", - "http://registry\\.gpii\\.net/common/speechRate": "ENU-JAWSCursor\\.Rate", - "http://registry\\.gpii\\.net/common/speechRate": "ENU-Keyboard\\.Rate", - "http://registry\\.gpii\\.net/common/speechRate": "ENU-MenuAndDialog\\.Rate", - "http://registry\\.gpii\\.net/common/speechRate": "ENU-Message\\.Rate", - "http://registry\\.gpii\\.net/common/speechRate": "ENU-PCCursor\\.Rate", "http://registry\\.gpii\\.net/common/pitch": { "transform": { "type": "fluid.transforms.linearScale", @@ -611,6 +606,11 @@ "stop": [ "settings.launcher" ], + "update": [ + "stop", + "configure", + "start" + ], "isRunning": [ "settings.launcher" ], @@ -686,6 +686,11 @@ "stop": [ "settings.launcher" ], + "update": [ + "stop", + "configure", + "start" + ], "isRunning": [ "settings.launcher" ], @@ -822,6 +827,11 @@ "stop": [ "settings.launcher" ], + "update": [ + "stop", + "configure", + "start" + ], "isRunning": [ "settings.launcher" ], @@ -881,6 +891,11 @@ "stop": [ "settings.launcher" ], + "update": [ + "stop", + "configure", + "start" + ], "isRunning": [ "settings.launcher" ], @@ -1057,7 +1072,6 @@ "grc": "test\\grc", "eo": "eo", "es": "es", - "es-ES": "es", "es-419": "es-la", "et": "et", "fi": "fi", @@ -1098,8 +1112,7 @@ "vi": "vi", "zh-cmn": "zh", "cmn": "zh", - "zh-yue": "zh-yue", - "zh-yue": "yue" + "zh-yue": "zh-yue" } } } @@ -1226,7 +1239,6 @@ "test\\grc": "grc", "eo": "eo", "es": "es", - "es": "es-ES", "es-la": "es-419", "et": "et", "fi": "fi", @@ -1267,7 +1279,6 @@ "vi": "vi", "zh": "zh-cmn", "zh-yue": "zh-yue", - "yue": "zh-yue" } } ] @@ -1301,7 +1312,7 @@ "type": "gpii.windows.closeProcessByName", "filename": "nvda.exe" } - ], + ] } } }, @@ -1311,6 +1322,11 @@ "stop": [ "settings.launcher" ], + "update": [ + "stop", + "configure", + "start" + ], "isRunning": [ "settings.launcher" ], @@ -1320,7 +1336,6 @@ "restore": [ "settings.configs" ], - "isInstalled": [ { "type": "gpii.deviceReporter.registryKeyExists", @@ -1590,6 +1605,11 @@ "stop": [ "settings.launcher" ], + "update": [ + "stop", + "configure", + "start" + ], "isRunning": [ "settings.launcher" ], @@ -2430,6 +2450,10 @@ "settings.launcher" ], "stop": [], + "update": [ + "configure", + "start" + ], "isRunning": [ "settings.launcher" ], @@ -2539,6 +2563,11 @@ ], "stop": [ "settings.launcher" + ], + "update": [ + "stop", + "configure", + "start" ] }, diff --git a/tests/platform/linux/linux-builtIn-testSpec.js b/tests/platform/linux/linux-builtIn-testSpec.js index bd0d3970e..479cce567 100644 --- a/tests/platform/linux/linux-builtIn-testSpec.js +++ b/tests/platform/linux/linux-builtIn-testSpec.js @@ -31,7 +31,7 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ { name: "Testing os_common using default matchmaker", userToken: "os_common", - integrationPrepopulation: { + initialState: { "gpii.gsettings.launch": { "org.gnome.desktop.a11y.magnifier": [{ "settings": { @@ -100,6 +100,150 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ }] } } + }, { + name: "Testing os_common - magnifier running on startup", + userToken: "os_common", + initialState: { + "gpii.gsettings.launch": { + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "running": true + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-magnifier-enabled" + } + }], + "org.gnome.desktop.a11y.applications.onscreen-keyboard": [{ + "settings": { + "running": false + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-keyboard-enabled" + } + }] + } + }, + settingsHandlers: { + "gpii.gsettings": { + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "mag-factor": 1.5, + "screen-position": "full-screen", + "mouse-tracking": "proportional", + "caret-tracking": "proportional", + "focus-tracking": "none" + }, + "options": { + "schema": "org.gnome.desktop.a11y.magnifier" + } + }], + "org.gnome.desktop.interface": [{ + "settings": { + "gtk-theme": "HighContrast", + "icon-theme": "HighContrast", + "text-scaling-factor": 0.75, + "cursor-size": 41 + }, + "options": { + "schema": "org.gnome.desktop.interface" + } + }] + }, + "gpii.gsettings.launch": { + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "running": true + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-magnifier-enabled" + } + }], + "org.gnome.desktop.a11y.applications.onscreen-keyboard": [{ + "settings": { + "running": true + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-keyboard-enabled" + } + }] + } + } + }, { + name: "Testing os_common - magnifier and keyboard running on startup", + userToken: "os_common", + initialState: { + "gpii.gsettings.launch": { + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "running": true + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-magnifier-enabled" + } + }], + "org.gnome.desktop.a11y.applications.onscreen-keyboard": [{ + "settings": { + "running": true + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-keyboard-enabled" + } + }] + } + }, + settingsHandlers: { + "gpii.gsettings": { + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "mag-factor": 1.5, + "screen-position": "full-screen", + "mouse-tracking": "proportional", + "caret-tracking": "proportional", + "focus-tracking": "none" + }, + "options": { + "schema": "org.gnome.desktop.a11y.magnifier" + } + }], + "org.gnome.desktop.interface": [{ + "settings": { + "gtk-theme": "HighContrast", + "icon-theme": "HighContrast", + "text-scaling-factor": 0.75, + "cursor-size": 41 + }, + "options": { + "schema": "org.gnome.desktop.interface" + } + }] + }, + "gpii.gsettings.launch": { + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "running": true + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-magnifier-enabled" + } + }], + "org.gnome.desktop.a11y.applications.onscreen-keyboard": [{ + "settings": { + "running": true + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-keyboard-enabled" + } + }] + } + } }, { name: "Testing os_common2 using default matchmaker", @@ -121,7 +265,7 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ { name: "Testing os_gnome using default matchmaker", userToken: "os_gnome", - integrationPrepopulation: { + initialState: { "gpii.gsettings.launch": { "org.gnome.desktop.a11y.magnifier": [{ "settings": { @@ -178,7 +322,7 @@ gpii.tests.linux.builtIn.testDefs = fluid.freezeRecursive([ { name: "Testing os_win7 using default matchmaker", userToken: "os_win7", - integrationPrepopulation: { + initialState: { "gpii.gsettings.launch": { "org.gnome.desktop.a11y.magnifier": [{ "settings": { diff --git a/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js b/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js index 6a0ff47a4..e69e92668 100644 --- a/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js +++ b/tests/platform/linux/linux-dynamicDeviceReporter-testSpec.js @@ -29,7 +29,7 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ name: "Testing screenreader_common using Flat matchmaker", gradeNames: "gpii.test.integration.deviceReporterAware.linux", userToken: "screenreader_common", - integrationPrepopulation: { + initialState: { "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { @@ -89,7 +89,7 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ name: "Testing screenreader_orca using Flat matchmaker", gradeNames: "gpii.test.integration.deviceReporterAware.linux", userToken: "screenreader_orca", - integrationPrepopulation: { + initialState: { "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { @@ -148,7 +148,7 @@ gpii.tests.deviceReporterAware.linux.orca.testDefs = [ name: "Testing screenreader_nvda using Flat matchmaker", gradeNames: "gpii.test.integration.deviceReporterAware.linux", userToken: "screenreader_nvda", - integrationPrepopulation: { + initialState: { "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { diff --git a/tests/platform/linux/linux-orca-testSpec.js b/tests/platform/linux/linux-orca-testSpec.js index 0cb8df889..21cbf7ecf 100644 --- a/tests/platform/linux/linux-orca-testSpec.js +++ b/tests/platform/linux/linux-orca-testSpec.js @@ -28,9 +28,9 @@ fluid.registerNamespace("gpii.tests.linux.orca"); gpii.tests.linux.orca.testDefs = [ { - name: "Testing screenreader_common using Flat matchmaker", + name: "Testing screenreader_common", userToken: "screenreader_common", - integrationPrepopulation: { + initialState: { "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { @@ -80,11 +80,64 @@ gpii.tests.linux.orca.testDefs = [ }] } } + }, { + name: "Testing screenreader_common with orca running on login", + userToken: "screenreader_common", + initialState: { + "gpii.gsettings.launch": { + "org.gnome.orca": [{ + "settings": { + "running": true + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" + } + }] + } + }, + settingsHandlers: { + "gpii.orca": { + "org.gnome.orca": [ + { + "settings": { + "sayAllStyle": 1, + "enableSpeech": true, + "enableEchoByWord": true, + "enableEchoByCharacter": false, + "voices.default.rate": 102.27272727272727, + "voices.default.gain": 7.5, + "enableTutorialMessages": false, + "voices.default.family": { + "locale": "en", + "name": "en-westindies" + }, + "verbalizePunctuationStyle": 0, + "voices.default.average-pitch": 1.5 + }, + "options": { + "user": "screenreader_common" + } + } + ] + }, + "gpii.gsettings.launch": { + "org.gnome.orca": [{ + "settings": { + "running": true + }, + "options": { + "schema": "org.gnome.desktop.a11y.applications", + "key": "screen-reader-enabled" + } + }] + } + } }, { - name: "Testing screenreader_orca using Flat matchmaker", + name: "Testing screenreader_orca", userToken: "screenreader_orca", - integrationPrepopulation: { + initialState: { "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { @@ -135,9 +188,9 @@ gpii.tests.linux.orca.testDefs = [ } }, { - name: "Testing screenreader_nvda using Flat matchmaker", + name: "Testing screenreader_nvda", userToken: "screenreader_nvda", - integrationPrepopulation: { + initialState: { "gpii.gsettings.launch": { "org.gnome.orca": [{ "settings": { diff --git a/tests/platform/windows/windows-builtIn-testSpec.js b/tests/platform/windows/windows-builtIn-testSpec.js index bd227ba3d..ace416f75 100644 --- a/tests/platform/windows/windows-builtIn-testSpec.js +++ b/tests/platform/windows/windows-builtIn-testSpec.js @@ -28,17 +28,15 @@ gpii.tests.windows.builtIn = [ { name: "Testing os_win7 using default matchmaker", userToken: "os_win7", - integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { + initialState: { + "gpii.windows.enableRegisteredAT": { "com.microsoft.windows.magnifier": [{ "settings": { "running": false }, "options": { - "getState": [{ - "type": "gpii.processReporter.find", - "command": "Magnify" - }] + "registryName": "magnifierpane", + "queryProcess": "Magnify" } }] } @@ -225,17 +223,14 @@ gpii.tests.windows.builtIn = [ } }] }, - "gpii.launchHandlers.flexibleHandler": { + "gpii.windows.enableRegisteredAT": { "com.microsoft.windows.magnifier": [{ "settings": { "running": true }, "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "Magnify" - }] + "registryName": "magnifierpane", + "queryProcess": "Magnify" } }] } @@ -243,18 +238,15 @@ gpii.tests.windows.builtIn = [ }, { name: "Testing os_common using default matchmaker", userToken: "os_common", - integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { + initialState: { + "gpii.windows.enableRegisteredAT": { "com.microsoft.windows.magnifier": [{ "settings": { "running": false }, "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "Magnify" - }] + "registryName": "magnifierpane", + "queryProcess": "Magnify" } }], "com.microsoft.windows.onscreenKeyboard": [{ @@ -262,11 +254,8 @@ gpii.tests.windows.builtIn = [ "running": false }, "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "osk" - }] + "registryName": "osk", + "queryProcess": "osk" } }] } @@ -435,17 +424,14 @@ gpii.tests.windows.builtIn = [ } }] }, - "gpii.launchHandlers.flexibleHandler": { + "gpii.windows.enableRegisteredAT": { "com.microsoft.windows.magnifier": [{ "settings": { "running": true }, "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "Magnify" - }] + "registryName": "magnifierpane", + "queryProcess": "Magnify" } }], "com.microsoft.windows.onscreenKeyboard": [{ @@ -453,11 +439,428 @@ gpii.tests.windows.builtIn = [ "running": true }, "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "osk" - }] + "registryName": "osk", + "queryProcess": "osk" + } + }] + } + } + }, { + name: "Testing os_common - magnifier running on startup", + userToken: "os_common", + initialState: { + "gpii.windows.enableRegisteredAT": { + "com.microsoft.windows.magnifier": [{ + "settings": { + "running": true + }, + "options": { + "registryName": "magnifierpane", + "queryProcess": "Magnify" + } + }], + "com.microsoft.windows.onscreenKeyboard": [{ + "settings": { + "running": false + }, + "options": { + "registryName": "osk", + "queryProcess": "osk" + } + }] + } + }, + settingsHandlers: { + "gpii.windows.spiSettingsHandler": { + "com.microsoft.windows.mouseTrailing": [ + { + "settings": { + "MouseTrails": { + "path": { + "get": "pvParam", + "set": "uiParam" + }, + "value": 10 + } + }, + "options": { + "getAction": "SPI_GETMOUSETRAILS", + "setAction": "SPI_SETMOUSETRAILS", + "uiParam": 0, + "pvParam": { + "type": "BOOL" + } + } + } + ], + "com.microsoft.windows.mouseKeys": [ + { + "settings": { + "MouseKeysOn": { + "path": "pvParam.dwFlags.MKF_MOUSEKEYSON", + "value": true + } + }, + "options": { + "getAction": "SPI_GETMOUSEKEYS", + "setAction": "SPI_SETMOUSEKEYS", + "uiParam": "struct_size", + "pvParam": { + "type": "struct", + "name": "MOUSEKEYS" + } + } + } + ], + "com.microsoft.windows.stickyKeys": [ + { + "settings": { + "StickyKeysOn": { + "path": "pvParam.dwFlags.SKF_STICKYKEYSON", + "value": true + } + }, + "options": { + "getAction": "SPI_GETSTICKYKEYS", + "setAction": "SPI_SETSTICKYKEYS", + "uiParam": "struct_size", + "pvParam": { + "type": "struct", + "name": "STICKYKEYS" + } + } + } + ], + "com.microsoft.windows.filterKeys": [ + { + "settings": { + "FilterKeysEnable": { + "path": "pvParam.dwFlags.FKF_FILTERKEYSON", + "value": true + }, + "BounceKeysInterval": { + "path": "pvParam.iBounceMSec", + "value": 1000 + } + }, + "options": { + "getAction": "SPI_GETFILTERKEYS", + "setAction": "SPI_SETFILTERKEYS", + "uiParam": "struct_size", + "pvParam": { + "type": "struct", + "name": "FILTERKEYS" + } + } + } + ], + "com.microsoft.windows.highContrast": [ + { // high contrast settings + "settings": { + "HighContrastOn": { + "path": "pvParam.dwFlags.HCF_HIGHCONTRASTON", + "value": true + } + }, + "options": { + "getAction": "SPI_GETHIGHCONTRAST", + "setAction": "SPI_SETHIGHCONTRAST", + "uiParam": "struct_size", + "pvParam": { + "type": "struct", + "name": "HIGHCONTRAST" + } + } + } + ] + }, + "gpii.windows.registrySettingsHandler": { + "com.microsoft.windows.magnifier": [{ // magnifier stuff + "settings": { + "Invert": 1, + "Magnification": 150, + "MagnificationMode": 3, + "FollowFocus": 0, + "FollowCaret": 1, + "FollowMouse": 1 + }, + "options": { + "hKey": "HKEY_CURRENT_USER", + "path": "Software\\Microsoft\\ScreenMagnifier", + "dataTypes": { + "Magnification": "REG_DWORD", + "Invert": "REG_DWORD", + "FollowFocus": "REG_DWORD", + "FollowCaret": "REG_DWORD", + "FollowMouse": "REG_DWORD", + "MagnificationMode": "REG_DWORD" + } + } + }], + "com.microsoft.windows.cursors": [{ // cursor size stuff + "settings": { + "No": "%SystemRoot%\\cursors\\aero_unavail_xl.cur", + "Hand": "%SystemRoot%\\cursors\\aero_link_xl.cur", + "Help": "%SystemRoot%\\cursors\\aero_helpsel_xl.cur", + "Wait": "%SystemRoot%\\cursors\\aero_busy_xl.ani", + "Arrow": "%SystemRoot%\\cursors\\aero_arrow_xl.cur", + "NWPen": "%SystemRoot%\\cursors\\aero_pen_xl.cur", + "SizeNS": "%SystemRoot%\\cursors\\aero_ns_xl.cur", + "SizeWE": "%SystemRoot%\\cursors\\aero_ew_xl.cur", + "SizeAll": "%SystemRoot%\\cursors\\aero_move_xl.cur", + "UpArrow": "%SystemRoot%\\cursors\\aero_up_xl.cur", + "SizeNESW": "%SystemRoot%\\cursors\\aero_nesw_xl.cur", + "SizeNWSE": "%SystemRoot%\\cursors\\aero_nwse_xl.cur", + "AppStarting": "%SystemRoot%\\cursors\\aero_working_xl.ani" + }, + "options": { + "hKey": "HKEY_CURRENT_USER", + "path": "Control Panel\\Cursors", + "dataTypes": { + "Arrow": "REG_SZ", + "Hand": "REG_SZ", + "Help": "REG_SZ", + "AppStarting": "REG_SZ", + "No": "REG_SZ", + "NWPen": "REG_SZ", + "SizeAll": "REG_SZ", + "SizeNESW": "REG_SZ", + "SizeNS": "REG_SZ", + "SizeNWSE": "REG_SZ", + "SizeWE": "REG_SZ", + "UpArrow": "REG_SZ", + "Wait": "REG_SZ" + } + } + }] + }, + "gpii.windows.enableRegisteredAT": { + "com.microsoft.windows.magnifier": [{ + "settings": { + "running": true + }, + "options": { + "registryName": "magnifierpane", + "queryProcess": "Magnify" + } + }], + "com.microsoft.windows.onscreenKeyboard": [{ + "settings": { + "running": true + }, + "options": { + "registryName": "osk", + "queryProcess": "osk" + } + }] + } + } + }, { + name: "Testing os_common - magnifier running on startup and keyboard both running on startup", + userToken: "os_common", + initialState: { + "gpii.windows.enableRegisteredAT": { + "com.microsoft.windows.magnifier": [{ + "settings": { + "running": true + }, + "options": { + "registryName": "magnifierpane", + "queryProcess": "Magnify" + } + }], + "com.microsoft.windows.onscreenKeyboard": [{ + "settings": { + "running": true + }, + "options": { + "registryName": "osk", + "queryProcess": "osk" + } + }] + } + }, + settingsHandlers: { + "gpii.windows.spiSettingsHandler": { + "com.microsoft.windows.mouseTrailing": [ + { + "settings": { + "MouseTrails": { + "path": { + "get": "pvParam", + "set": "uiParam" + }, + "value": 10 + } + }, + "options": { + "getAction": "SPI_GETMOUSETRAILS", + "setAction": "SPI_SETMOUSETRAILS", + "uiParam": 0, + "pvParam": { + "type": "BOOL" + } + } + } + ], + "com.microsoft.windows.mouseKeys": [ + { + "settings": { + "MouseKeysOn": { + "path": "pvParam.dwFlags.MKF_MOUSEKEYSON", + "value": true + } + }, + "options": { + "getAction": "SPI_GETMOUSEKEYS", + "setAction": "SPI_SETMOUSEKEYS", + "uiParam": "struct_size", + "pvParam": { + "type": "struct", + "name": "MOUSEKEYS" + } + } + } + ], + "com.microsoft.windows.stickyKeys": [ + { + "settings": { + "StickyKeysOn": { + "path": "pvParam.dwFlags.SKF_STICKYKEYSON", + "value": true + } + }, + "options": { + "getAction": "SPI_GETSTICKYKEYS", + "setAction": "SPI_SETSTICKYKEYS", + "uiParam": "struct_size", + "pvParam": { + "type": "struct", + "name": "STICKYKEYS" + } + } + } + ], + "com.microsoft.windows.filterKeys": [ + { + "settings": { + "FilterKeysEnable": { + "path": "pvParam.dwFlags.FKF_FILTERKEYSON", + "value": true + }, + "BounceKeysInterval": { + "path": "pvParam.iBounceMSec", + "value": 1000 + } + }, + "options": { + "getAction": "SPI_GETFILTERKEYS", + "setAction": "SPI_SETFILTERKEYS", + "uiParam": "struct_size", + "pvParam": { + "type": "struct", + "name": "FILTERKEYS" + } + } + } + ], + "com.microsoft.windows.highContrast": [ + { // high contrast settings + "settings": { + "HighContrastOn": { + "path": "pvParam.dwFlags.HCF_HIGHCONTRASTON", + "value": true + } + }, + "options": { + "getAction": "SPI_GETHIGHCONTRAST", + "setAction": "SPI_SETHIGHCONTRAST", + "uiParam": "struct_size", + "pvParam": { + "type": "struct", + "name": "HIGHCONTRAST" + } + } + } + ] + }, + "gpii.windows.registrySettingsHandler": { + "com.microsoft.windows.magnifier": [{ // magnifier stuff + "settings": { + "Invert": 1, + "Magnification": 150, + "MagnificationMode": 3, + "FollowFocus": 0, + "FollowCaret": 1, + "FollowMouse": 1 + }, + "options": { + "hKey": "HKEY_CURRENT_USER", + "path": "Software\\Microsoft\\ScreenMagnifier", + "dataTypes": { + "Magnification": "REG_DWORD", + "Invert": "REG_DWORD", + "FollowFocus": "REG_DWORD", + "FollowCaret": "REG_DWORD", + "FollowMouse": "REG_DWORD", + "MagnificationMode": "REG_DWORD" + } + } + }], + "com.microsoft.windows.cursors": [{ // cursor size stuff + "settings": { + "No": "%SystemRoot%\\cursors\\aero_unavail_xl.cur", + "Hand": "%SystemRoot%\\cursors\\aero_link_xl.cur", + "Help": "%SystemRoot%\\cursors\\aero_helpsel_xl.cur", + "Wait": "%SystemRoot%\\cursors\\aero_busy_xl.ani", + "Arrow": "%SystemRoot%\\cursors\\aero_arrow_xl.cur", + "NWPen": "%SystemRoot%\\cursors\\aero_pen_xl.cur", + "SizeNS": "%SystemRoot%\\cursors\\aero_ns_xl.cur", + "SizeWE": "%SystemRoot%\\cursors\\aero_ew_xl.cur", + "SizeAll": "%SystemRoot%\\cursors\\aero_move_xl.cur", + "UpArrow": "%SystemRoot%\\cursors\\aero_up_xl.cur", + "SizeNESW": "%SystemRoot%\\cursors\\aero_nesw_xl.cur", + "SizeNWSE": "%SystemRoot%\\cursors\\aero_nwse_xl.cur", + "AppStarting": "%SystemRoot%\\cursors\\aero_working_xl.ani" + }, + "options": { + "hKey": "HKEY_CURRENT_USER", + "path": "Control Panel\\Cursors", + "dataTypes": { + "Arrow": "REG_SZ", + "Hand": "REG_SZ", + "Help": "REG_SZ", + "AppStarting": "REG_SZ", + "No": "REG_SZ", + "NWPen": "REG_SZ", + "SizeAll": "REG_SZ", + "SizeNESW": "REG_SZ", + "SizeNS": "REG_SZ", + "SizeNWSE": "REG_SZ", + "SizeWE": "REG_SZ", + "UpArrow": "REG_SZ", + "Wait": "REG_SZ" + } + } + }] + }, + "gpii.windows.enableRegisteredAT": { + "com.microsoft.windows.magnifier": [{ + "settings": { + "running": true + }, + "options": { + "registryName": "magnifierpane", + "queryProcess": "Magnify" + } + }], + "com.microsoft.windows.onscreenKeyboard": [{ + "settings": { + "running": true + }, + "options": { + "registryName": "osk", + "queryProcess": "osk" } }] } @@ -465,18 +868,15 @@ gpii.tests.windows.builtIn = [ }, { name: "Testing os_gnome using default matchmaker", userToken: "os_gnome", - integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { + initialState: { + "gpii.windows.enableRegisteredAT": { "com.microsoft.windows.magnifier": [{ "settings": { "running": false }, "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "Magnify" - }] + "registryName": "magnifierpane", + "queryProcess": "Magnify" } }] } @@ -538,17 +938,14 @@ gpii.tests.windows.builtIn = [ } }] }, - "gpii.launchHandlers.flexibleHandler": { + "gpii.windows.enableRegisteredAT": { "com.microsoft.windows.magnifier": [{ "settings": { "running": true }, "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "Magnify" - }] + "registryName": "magnifierpane", + "queryProcess": "Magnify" } }] } diff --git a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js index 9f0b80187..ceffbebb3 100644 --- a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js +++ b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js @@ -28,7 +28,7 @@ gpii.tests.deviceReporterAware.windows = [ { name: "Testing screenreader_nvda using Flat matchmaker", userToken: "screenreader_nvda", - integrationPrepopulation: { + initialState: { "gpii.launchHandlers.flexibleHandler": { "org.nvda-project": [{ "settings": { @@ -103,7 +103,7 @@ gpii.tests.deviceReporterAware.windows = [ name: "Testing readwritegold_application1 using Flat matchmaker", userToken: "readwritegold_application1", gradeNames: "gpii.test.integration.deviceReporterAware.windows", - integrationPrepopulation: { + initialState: { "gpii.launchHandlers.flexibleHandler": { "com.texthelp.readWriteGold": [{ "settings": { diff --git a/tests/platform/windows/windows-jaws-testSpec.js b/tests/platform/windows/windows-jaws-testSpec.js index 01e6ed44c..eca2f17da 100644 --- a/tests/platform/windows/windows-jaws-testSpec.js +++ b/tests/platform/windows/windows-jaws-testSpec.js @@ -22,27 +22,60 @@ fluid.require("%universal"); gpii.loadTestingSupport(); -fluid.registerNamespace("gpii.tests.windows"); +fluid.registerNamespace("gpii.tests.windows.jaws"); -gpii.tests.windows.jaws = [ - { - name: "Testing NP set \"jaws_application\" using Flat matchmaker", - userToken: "jaws_application", - integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { - "com.freedomscientific.jaws": [{ - "settings": { - "running": false +// To avoid duplicating this entire piece in each test. Given a true or false value +// as input, this will return a settingshandler entry, containing all the options from +// the solutions registry entry for NVDAs launchHandler, with a settings block with +// running: X - where X is replaced with the input parameter +gpii.tests.windows.jaws.flexibleHandlerEntry = function (running) { + return { + "com.freedomscientific.jaws": [{ + "settings": { + "running": running + }, + "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20 + }, + "getState": [ + { + "type": "gpii.processReporter.find", + "command": "jfw" + } + ], + "setTrue": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\JAWS17.exe\\}\"" + } + ], + "setFalse": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "jfw.exe" + }, + { + "type": "gpii.windows.closeProcessByName", + "filename": "fsSynth32.exe" }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "jfw" - }] + { + "type": "gpii.windows.closeProcessByName", + "filename": "jhookldr.exe" } - }] + ] } + }] + } +}; +gpii.tests.windows.jaws.testDefs = [ + { + name: "Testing NP set \"jaws_application\"", + userToken: "jaws_application", + initialState: { + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.jaws.flexibleHandlerEntry(false) }, settingsHandlers: { "gpii.settingsHandlers.INISettingsHandler": { @@ -101,40 +134,80 @@ gpii.tests.windows.jaws = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { - "com.freedomscientific.jaws": [{ - "settings": { - "running": true + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.jaws.flexibleHandlerEntry(true) + } + }, + { + name: "Testing NP set \"jaws_application\" - where jaws is running on startup", + userToken: "jaws_application", + initialState: { + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.jaws.flexibleHandlerEntry(true) + }, + settingsHandlers: { + "gpii.settingsHandlers.INISettingsHandler": { + "com.freedomscientific.jaws": [ + { + "settings": { + "Voice Profiles.ActiveVoiceProfileName" : "GPII", + "options.SayAllIndicateCaps" : false, + "options.TypingEcho": 3, + "options.SayAllMode": 0, + "Braille.BrailleMode": 0, + "options.SayAllIgnoreShiftKeys": true + }, + "options": { + "filename": "${{environment}.APPDATA}\\Freedom Scientific\\JAWS\\17.0\\Settings\\enu\\DEFAULT.JCF" + } }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "jfw" - }] + + { + "settings": { + "Options.PrimarySynthesizer" : "eloq", + "ENU-Global.Rate": 100, + "ENU-JAWSCursor.Rate": 100, + "ENU-Keyboard.Rate": 100, + "ENU-MenuAndDialog.Rate": 100, + "ENU-Message.Rate": 100, + "ENU-PCCursor.Rate": 100, + "ENU-Global.Pitch": 75, + "ENU-JAWSCursor.Pitch": 75, + "ENU-Keyboard.Pitch": 75, + "ENU-MenuAndDialog.Pitch": 75, + "ENU-Message.Pitch": 75, + "ENU-PCCursor.Pitch": 75, + "ENU-Global.Volume": 100, + "ENU-JAWSCursor.Volume": 100, + "ENU-Keyboard.Volume": 100, + "ENU-MenuAndDialog.Volume": 100, + "ENU-Message.Volume": 100, + "ENU-PCCursor.Volume": 100, + "ENU-Global.Punctuation": 2, + "ENU-JAWSCursor.Punctuation": 2, + "ENU-Keyboard.Punctuation": 2, + "ENU-MenuAndDialog.Punctuation": 2, + "ENU-Message.Punctuation": 2, + "ENU-PCCursor.Punctuation": 2, + "ENU-Global.SynthLangString": "Italian", + "ENU-JAWSCursor.SynthLangString": "Italian", + "ENU-Keyboard.SynthLangString": "Italian", + "ENU-MenuAndDialog.SynthLangString": "Italian", + "ENU-Message.SynthLangString": "Italian", + "ENU-PCCursor.SynthLangString": "Italian" + }, + "options": { + "filename": "${{environment}.APPDATA}\\Freedom Scientific\\JAWS\\17.0\\Settings\\VoiceProfiles\\GPII.VPF" + } } - }] - } + ] + }, + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.jaws.flexibleHandlerEntry(true) } }, { - name: "Testing NP set \"jaws_common\" using Flat matchmaker", + name: "Testing NP set \"jaws_common\"", userToken: "jaws_common", - integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { - "com.freedomscientific.jaws": [{ - "settings": { - "running": false - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "jfw" - }] - } - }] - } + initialState: { + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.jaws.flexibleHandlerEntry(false) }, settingsHandlers: { "gpii.settingsHandlers.INISettingsHandler": { @@ -193,40 +266,14 @@ gpii.tests.windows.jaws = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { - "com.freedomscientific.jaws": [{ - "settings": { - "running": true - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "jfw" - }] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.jaws.flexibleHandlerEntry(true) } }, { - name: "Testing NP set \"jaws_common2\" using Flat matchmaker", + name: "Testing NP set \"jaws_common2\"", userToken: "jaws_common2", - integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { - "com.freedomscientific.jaws": [{ - "settings": { - "running": false - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "jfw" - }] - } - }] - } + initialState: { + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.jaws.flexibleHandlerEntry(false) }, settingsHandlers: { "gpii.settingsHandlers.INISettingsHandler": { @@ -284,40 +331,14 @@ gpii.tests.windows.jaws = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { - "com.freedomscientific.jaws": [{ - "settings": { - "running": true - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "jfw" - }] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.jaws.flexibleHandlerEntry(true) } }, { - name: "Testing NP set \"jaws_common3\" using Flat matchmaker", + name: "Testing NP set \"jaws_common3\"", userToken: "jaws_common3", - integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { - "com.freedomscientific.jaws": [{ - "settings": { - "running": false - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "jaws" - }] - } - }] - } + initialState: { + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.jaws.flexibleHandlerEntry(false) }, settingsHandlers: { "gpii.settingsHandlers.INISettingsHandler": { @@ -376,26 +397,13 @@ gpii.tests.windows.jaws = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { - "com.freedomscientific.jaws": [{ - "settings": { - "running": true - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "jfw" - }] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.jaws.flexibleHandlerEntry(true) } } ]; module.exports = gpii.test.bootstrap({ - testDefs: "gpii.tests.windows.jaws", + testDefs: "gpii.tests.windows.jaws.testDefs", configName: "gpii.tests.acceptance.windows.jaws.config", configPath: "%universal/tests/platform/windows/configs" }, ["gpii.test.integration.testCaseHolder.windows"], diff --git a/tests/platform/windows/windows-maavis-testSpec.js b/tests/platform/windows/windows-maavis-testSpec.js index 76ff0e861..a357c13ec 100644 --- a/tests/platform/windows/windows-maavis-testSpec.js +++ b/tests/platform/windows/windows-maavis-testSpec.js @@ -22,27 +22,53 @@ fluid.require("%universal"); gpii.loadTestingSupport(); -fluid.registerNamespace("gpii.tests.windows"); +fluid.registerNamespace("gpii.tests.windows.maavis"); -gpii.tests.windows.maavis = [ - { - name: "Testing maavis_highcontrast using Flat matchmaker", - userToken: "maavis_highcontrast", - integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { - "net.opendirective.maavis": [{ - "settings": { - "running": false - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "MaavisPortable" - }] +// To avoid duplicating this entire piece in each test. Given a true or false value +// as input, this will return a settingshandler entry, containing all the options from +// the solutions registry entry for NVDAs launchHandler, with a settings block with +// running: X - where X is replaced with the input parameter +gpii.tests.windows.maavis.flexibleHandlerEntry = function (running) { + return { + "net.opendirective.maavis": [{ + "settings": { + "running": running + }, + "options": { + "verifySettings": true, + "retryOptions": { + "rewriteEvery": 0, + "numRetries": 20 + }, + "setTrue": [ + { + "type": "gpii.launch.exec", + "command": "${{environment}.ComSpec} /c \"cd ${{environment}.MAAVIS_HOME} && MaavisPortable.cmd\"" + } + ], + "setFalse": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "firefox.exe" + } + ], + "getState": [ + { + "type": "gpii.processReporter.find", + "command": "MaavisPortable" } - }] + ] } + }] + } +}; + +gpii.tests.windows.maavis.testDefs = [ + { + name: "Testing maavis_highcontrast - when maavis is running on login", + userToken: "maavis_highcontrast", + initialState: { + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.maavis.flexibleHandlerEntry(true) }, settingsHandlers: { "gpii.settingsHandlers.JSONSettingsHandler": { @@ -60,39 +86,37 @@ gpii.tests.windows.maavis = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { - "net.opendirective.maavis": [{ - "settings": { - "running": true - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "MaavisPortable" - }] + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.maavis.flexibleHandlerEntry(true) + } + }, { + name: "Testing maavis_highcontrast", + userToken: "maavis_highcontrast", + initialState: { + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.maavis.flexibleHandlerEntry(false) + }, + settingsHandlers: { + "gpii.settingsHandlers.JSONSettingsHandler": { + "net.opendirective.maavis": [ + { + "settings": { + "theme": "hc", + "speakTitles": "no", + "speakLabels": "no", + "speakOnActivate": "no" + }, + "options": { + "filename": "${{environment}.MAAVIS_HOME}\\MaavisMedia\\Users\\Default\\userconfig.json" + } } - }] - } + ] + }, + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.maavis.flexibleHandlerEntry(true) } }, { - name: "Testing maavis_selfvoicing using Flat matchmaker", + name: "Testing maavis_selfvoicing", userToken: "maavis_selfvoicing", - integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { - "net.opendirective.maavis": [{ - "settings": { - "running": false - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "MaavisPortable" - }] - } - }] - } + initialState: { + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.maavis.flexibleHandlerEntry(false) }, settingsHandlers: { "gpii.settingsHandlers.JSONSettingsHandler": { @@ -110,26 +134,13 @@ gpii.tests.windows.maavis = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { - "net.opendirective.maavis": [{ - "settings": { - "running": true - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "MaavisPortable" - }] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.maavis.flexibleHandlerEntry(true) } } ]; module.exports = gpii.test.bootstrap({ - testDefs: "gpii.tests.windows.maavis", + testDefs: "gpii.tests.windows.maavis.testDefs", configName: "gpii.tests.acceptance.windows.maavis.config", configPath: "%universal/tests/platform/windows/configs" }, ["gpii.test.integration.testCaseHolder.windows"], diff --git a/tests/platform/windows/windows-nvda-testSpec.js b/tests/platform/windows/windows-nvda-testSpec.js index f0582d56c..49e542709 100644 --- a/tests/platform/windows/windows-nvda-testSpec.js +++ b/tests/platform/windows/windows-nvda-testSpec.js @@ -20,29 +20,60 @@ var fluid = require("infusion"), fluid.require("%universal"); +fluid.logObjectRenderChars = 80000 + gpii.loadTestingSupport(); -fluid.registerNamespace("gpii.tests.windows"); +fluid.registerNamespace("gpii.tests.windows.nvda"); -gpii.tests.windows.nvda = [ - { - name: "Testing screenreader_nvda using Flat matchmaker", - userToken: "screenreader_nvda", - integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { - "org.nvda-project": [{ - "settings": { - "running": false - }, - "options": { - // start and stop blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "nvda" - }] +// To avoid duplicating this entire piece in each test. Given a true or false value +// as input, this will return a settingshandler entry, containing all the options from +// the solutions registry entry for NVDAs launchHandler, with a settings block with +// running: X - where X is replaced with the input parameter +gpii.tests.windows.nvda.flexibleHandlerEntry = function (running) { + return { + "org.nvda-project": [{ + "settings": { + "running": running + }, + "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20 + }, + "getState": [ + { + "type": "gpii.processReporter.find", + "command": "nvda" } - }] + ], + "setTrue": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\nvda.exe\\}\"" + } + ], + "setFalse": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "nvda_service.exe" + },{ + "type": "gpii.windows.closeProcessByName", + "filename": "nvda.exe" + } + ] } + }] + } +}; + +gpii.tests.windows.nvda.testDef = [ + { + name: "Testing screenreader_nvda - When running on start", + userToken: "screenreader_nvda", + initialState: { + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(true) }, settingsHandlers: { "gpii.settingsHandlers.INISettingsHandler": { @@ -73,142 +104,114 @@ gpii.tests.windows.nvda = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { - "org.nvda-project": [{ - "settings": { - "running": true - }, - "options": { - // start and stop blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "nvda" - }] - } - }] - } - } - }, { - name: "Testing screenreader_common using Flat matchmaker", - userToken: "screenreader_common", - integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { - "org.nvda-project": [{ - "settings": { - "running": false - }, - "options": { - // start and stop blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "nvda" - }] - } - }] - } - }, - settingsHandlers: { - "gpii.settingsHandlers.INISettingsHandler": { - "org.nvda-project": [ - { - "settings": { - "speech.espeak.rate": 17, - "speech.espeak.volume": 75, - "speech.espeak.pitch": 15, - "speech.espeak.rateBoost": true, - "speech.symbolLevel": 300, - "speech.espeak.voice": "en\\en-wi", - "reviewCursor.followFocus": false, - "reviewCursor.followCaret": true, - "reviewCursor.followMouse": true, - "keyboard.speakTypedWords": true, - "keyboard.speakTypedCharacters": false, - "presentation.reportHelpBalloons": false, - "speech.espeak.sayCapForCapitals": true - }, - "options": { - "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", - "allowNumberSignComments": true, - "allowSubSections": true - } - } - ] - }, - "gpii.launchHandlers.flexibleHandler": { - "org.nvda-project": [{ - "settings": { - "running": true - }, - "options": { - // start and stop blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "nvda" - }] - } - }] - } - } - }, { - name: "Testing screenreader_orca using Flat matchmaker", - userToken: "screenreader_orca", - integrationPrepopulation: { - "gpii.launchHandlers.flexibleHandler": { - "org.nvda-project": [{ - "settings": { - "running": false - }, - "options": { - // start and stop blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "nvda" - }] - } - }] - } - }, - settingsHandlers: { - "gpii.settingsHandlers.INISettingsHandler": { - "org.nvda-project": [ - { - "settings": { - "speech.symbolLevel": 300, - "speech.espeak.rate": 17, - "speech.espeak.voice": "en\\en-wi", - "keyboard.speakTypedWords": true, - "speech.espeak.rateBoost": true, - "keyboard.speakTypedCharacters": false, - "presentation.reportHelpBalloons": false - }, - "options": { - "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", - "allowNumberSignComments": true, - "allowSubSections": true - } - } - ] - }, - "gpii.launchHandlers.flexibleHandler": { - "org.nvda-project": [{ - "settings": { - "running": true - }, - "options": { - // start and stop blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "nvda" - }] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(true) } + // }, { + // name: "Testing screenreader_nvda", + // userToken: "screenreader_nvda", + // initialState: { + // "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(false) + // }, + // settingsHandlers: { + // "gpii.settingsHandlers.INISettingsHandler": { + // "org.nvda-project": [ + // { + // "settings": { + // "speech.espeak.rate": 17, + // "speech.espeak.volume": 80, + // "speech.espeak.pitch": 60, + // "speech.espeak.rateBoost": true, + // "speech.synth": "espeak", + // "speech.outputDevice": "Microsoft Sound Mapper", + // "speech.symbolLevel": 300, + // "speech.espeak.voice": "en\\en-wi", + // "reviewCursor.followFocus": false, + // "reviewCursor.followCaret": true, + // "reviewCursor.followMouse": true, + // "keyboard.speakTypedWords": true, + // "keyboard.speakTypedCharacters": false, + // "presentation.reportHelpBalloons": false, + // "speech.espeak.sayCapForCapitals": true + // }, + // "options": { + // "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", + // "allowNumberSignComments": true, + // "allowSubSections": true + // } + // } + // ] + // }, + // "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(true) + // } + // }, { + // name: "Testing screenreader_common", + // userToken: "screenreader_common", + // initialState: { + // "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(false) + // }, + // settingsHandlers: { + // "gpii.settingsHandlers.INISettingsHandler": { + // "org.nvda-project": [ + // { + // "settings": { + // "speech.espeak.rate": 17, + // "speech.espeak.volume": 75, + // "speech.espeak.pitch": 15, + // "speech.espeak.rateBoost": true, + // "speech.symbolLevel": 300, + // "speech.espeak.voice": "en\\en-wi", + // "reviewCursor.followFocus": false, + // "reviewCursor.followCaret": true, + // "reviewCursor.followMouse": true, + // "keyboard.speakTypedWords": true, + // "keyboard.speakTypedCharacters": false, + // "presentation.reportHelpBalloons": false, + // "speech.espeak.sayCapForCapitals": true + // }, + // "options": { + // "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", + // "allowNumberSignComments": true, + // "allowSubSections": true + // } + // } + // ] + // }, + // "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(true) + // } + // }, { + // name: "Testing screenreader_orca", + // userToken: "screenreader_orca", + // initialState: { + // "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(false) + // }, + // settingsHandlers: { + // "gpii.settingsHandlers.INISettingsHandler": { + // "org.nvda-project": [ + // { + // "settings": { + // "speech.symbolLevel": 300, + // "speech.espeak.rate": 17, + // "speech.espeak.voice": "en\\en-wi", + // "keyboard.speakTypedWords": true, + // "speech.espeak.rateBoost": true, + // "keyboard.speakTypedCharacters": false, + // "presentation.reportHelpBalloons": false + // }, + // "options": { + // "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", + // "allowNumberSignComments": true, + // "allowSubSections": true + // } + // } + // ] + // }, + // "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(true) + // } } ]; module.exports = gpii.test.bootstrap({ - testDefs: "gpii.tests.windows.nvda", + testDefs: "gpii.tests.windows.nvda.testDef", configName: "gpii.tests.acceptance.windows.nvda.config", configPath: "%universal/tests/platform/windows/configs" }, ["gpii.test.integration.testCaseHolder.windows"], diff --git a/tests/platform/windows/windows-readWrite-testSpec.js b/tests/platform/windows/windows-readWrite-testSpec.js index dce3099b6..77a00f367 100644 --- a/tests/platform/windows/windows-readWrite-testSpec.js +++ b/tests/platform/windows/windows-readWrite-testSpec.js @@ -23,13 +23,73 @@ fluid.registerNamespace("gpii.tests.windows"); gpii.tests.windows.readWrite = [ { - name: "Testing rwg1", + name: "Testing rwg1 - running on login", userToken: "rwg1", - integrationPrepopulation: { + initialState: { "gpii.launchHandlers.flexibleHandler": { "com.texthelp.readWriteGold": [{ "settings": { - "running": false + "running": true + }, + "options": { + "setTrue": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_CURRENT_USER\\Software\\Texthelp\\Read&Write11\\InstallPath}\\ReadAndWrite.exe\"" + } + ], + "setFalse": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "ReadAndWrite.exe" + } + ], + "getState": [ + { + "type": "gpii.processReporter.find", + "command": "readandwrite" + } + ] + } + }] + } + }, + settingsHandlers: { + "gpii.settingsHandlers.XMLHandler": { + "com.texthelp.readWriteGold": [ + { + "settings": { + "ApplicationSettings.AppBar.optToolbarIconSet.$t": "Fun", + "ApplicationSettings.AppBar.optToolbarButtonGroupNameCurrent.$t": "Writing Features", + "ApplicationSettings.AppBar.DocType.$t": "1", + "ApplicationSettings.AppBar.ShowText.$t": "true", + "ApplicationSettings.AppBar.optToolbarShowText.$t": "true", + "ApplicationSettings.AppBar.LargeIcons.$t": "true", + "ApplicationSettings.AppBar.optToolbarLargeIcons.$t": "true", + "ApplicationSettings.Speech.optSAPI5Pitch.$t": "36", + "ApplicationSettings.Speech.optSAPI5Speed.$t": "38", + "ApplicationSettings.Speech.optSAPI5Volume.$t": "72", + "ApplicationSettings.Speech.optSAPI5PauseBetweenWords.$t": "0", + "ApplicationSettings.Speech.optSAPI5Voice.$t": "ScanSoft UK English Daniel", + "ApplicationSettings.Speech.WebHighlighting.$t": "false", + "ApplicationSettings.Translation.ToLanguage.$t": "fr", + "ApplicationSettings.Speech.optSAPI5SpeechHighlightContext.$t": "2", + "ApplicationSettings.Scanning.ScanDestination.$t": "PDF", + "ApplicationSettings.Scanning.ScanToFile.$t": "false", + "ApplicationSettings.Spelling.SpellAsIType.$t": "true" + }, + "options": { + "filename": "${{environment}.APPDATA}\\Texthelp\\ReadAndWrite\\11\\RWSettings11.xml", + "encoding": "utf-8", + "xml-tag": "" + } + } + ] + }, + "gpii.launchHandlers.flexibleHandler": { + "com.texthelp.readWriteGold": [{ + "settings": { + "running": true }, "options": { // setTrue and setFalse blocks omitted for size/clarity @@ -40,6 +100,38 @@ gpii.tests.windows.readWrite = [ } }] } + } + }, { + name: "Testing rwg1", + userToken: "rwg1", + initialState: { + "gpii.launchHandlers.flexibleHandler": { + "com.texthelp.readWriteGold": [{ + "settings": { + "running": false + }, + "options": { + "setTrue": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_CURRENT_USER\\Software\\Texthelp\\Read&Write11\\InstallPath}\\ReadAndWrite.exe\"" + } + ], + "setFalse": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "ReadAndWrite.exe" + } + ], + "getState": [ + { + "type": "gpii.processReporter.find", + "command": "readandwrite" + } + ] + } + }] + } }, settingsHandlers: { "gpii.settingsHandlers.XMLHandler": { @@ -91,18 +183,31 @@ gpii.tests.windows.readWrite = [ }, { name: "Testing rwg2", userToken: "rwg2", - integrationPrepopulation: { + initialState: { "gpii.launchHandlers.flexibleHandler": { "com.texthelp.readWriteGold": [{ "settings": { "running": false }, "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "readandwrite" - }] + "setTrue": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_CURRENT_USER\\Software\\Texthelp\\Read&Write11\\InstallPath}\\ReadAndWrite.exe\"" + } + ], + "setFalse": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "ReadAndWrite.exe" + } + ], + "getState": [ + { + "type": "gpii.processReporter.find", + "command": "readandwrite" + } + ] } }] } From 6b74c91bc4ea37aaedda0867284f3069994a4953 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Tue, 14 Mar 2017 21:47:14 +0100 Subject: [PATCH 09/44] GPII-1230: Linted, fixed minor issues --- .../lifecycleManager/src/LifecycleManager.js | 11 ++++++++++- gpii/node_modules/processReporter/index.js | 2 +- .../test/web/js/ProcessReporterTests.js | 4 ++-- .../settingsHandlers/src/settingsHandlerUtilities.js | 1 - .../test/web/js/LaunchHandlerTests.js | 6 ++++-- gpii/node_modules/testing/src/Integration.js | 4 ++-- gpii/node_modules/testing/src/Testing.js | 9 +++++---- testData/solutions/linux.json5 | 2 ++ tests/JournalIntegrationTests.js | 1 - tests/platform/linux/linux-builtIn-testSpec.js | 2 -- tests/platform/linux/linux-orca-testSpec.js | 2 -- tests/platform/windows/windows-jaws-testSpec.js | 3 ++- tests/platform/windows/windows-maavis-testSpec.js | 2 +- tests/platform/windows/windows-nvda-testSpec.js | 2 +- 14 files changed, 30 insertions(+), 21 deletions(-) diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index e58e8f8f7..bbf709e5f 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -288,6 +288,10 @@ var gpii = fluid.registerNamespace("gpii"); * that will be resolved once the settings are successfully set. */ gpii.lifecycleManager.executeSettingsAction = function (that, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction) { + + // console.log("KASPER Record: " + JSON.stringify(solutionRecord, null, 2)); + var tmp = JSON.stringify(fluid.get(solutionRecord, [ "settingsHandlers", settingsHandlerBlockName, "settings"]), null, 2) + console.log("KASPER: executeSettingsAction: (" + solutionId + ": " + settingsHandlerBlockName + ") with settings: " + tmp); var settingsHandlerBlock = solutionRecord.settingsHandlers[settingsHandlerBlockName]; if (settingsHandlerBlock === undefined) { fluid.fail("Reference to non-existing settingsHandler block named " + settingsHandlerBlockName + @@ -300,6 +304,8 @@ var gpii = fluid.registerNamespace("gpii"); } else { var settingsPromise = that.invokeSettingsHandlerSet(solutionId, expanded); settingsPromise.then(function (snapshot) { + console.log("KASPER: executeSettingsAction: (" + solutionId + ": " + settingsHandlerBlockName + ") with settings: " + tmp + + " .... PROMISE RESOLVED"); session.applier.change(["appliedSolutions", solutionId], solutionRecord); gpii.lifecycleManager.recordSnapshotInSession(that, snapshot, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction); @@ -399,6 +405,7 @@ var gpii = fluid.registerNamespace("gpii"); */ gpii.lifecycleManager.executeActions = function (that, solutionId, solutionRecord, session, actionBlock, rootAction) { + console.log("KASPER: Execute actions: " + JSON.stringify(actionBlock) + "... rootAction: " + rootAction) var steps = solutionRecord[actionBlock]; if (steps === undefined) { fluid.log("No " + actionBlock + " actions defined for solution " + solutionId); @@ -583,6 +590,7 @@ var gpii = fluid.registerNamespace("gpii"); }; gpii.lifecycleManager.start = function (that, request, finalPayload, callback) { + console.log("KASPER: gpii.lifecycleManager.start") var userToken = finalPayload.userToken, lifecycleInstructions = finalPayload.lifecycleInstructions; if (that.sessionIndex[userToken]) { @@ -620,13 +628,14 @@ var gpii = fluid.registerNamespace("gpii"); if (solution.active === false) { // and it shouldn't actions = [ "stop", "configure" ]; } else { // else call "update" to make changes apply to a running solutions + console.log("KASPER: running and active = yes, so using 'update directive'") actions = [ "update" ]; } } else { // if it is not running if (solution.active === true) { // and we want it to run actions = [ "configure", "start" ]; } else { // else just configure it - actions = [ "configure" ] + actions = [ "configure" ]; } } diff --git a/gpii/node_modules/processReporter/index.js b/gpii/node_modules/processReporter/index.js index b929e1274..a56e90d76 100644 --- a/gpii/node_modules/processReporter/index.js +++ b/gpii/node_modules/processReporter/index.js @@ -5,6 +5,6 @@ var fluid = require("infusion"); fluid.module.register("processReporter", __dirname, require); require("./src/ProcessReporter.js"); -require("./src/ProcessesBridge.js") +require("./src/ProcessesBridge.js"); diff --git a/gpii/node_modules/processReporter/test/web/js/ProcessReporterTests.js b/gpii/node_modules/processReporter/test/web/js/ProcessReporterTests.js index 4ff5200f1..d1e5fb514 100644 --- a/gpii/node_modules/processReporter/test/web/js/ProcessReporterTests.js +++ b/gpii/node_modules/processReporter/test/web/js/ProcessReporterTests.js @@ -28,7 +28,7 @@ gpii.tests.processReporter.alwaysTrue = function () { return true; - } + }; fluid.defaults("gpii.tests.processReporter.alwaysFalse", { gradeNames: "fluid.function", @@ -37,7 +37,7 @@ gpii.tests.processReporter.alwaysFalse = function () { return false; - } + }; gpii.tests.processReporter.handleIsRunningSpecs = { "No isRunning block": { diff --git a/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js b/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js index ed9a99a8e..c9c4cf0d1 100644 --- a/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js +++ b/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js @@ -284,7 +284,6 @@ gpii.settingsHandlers.dispatchSettingsHandlerGet = function (resolvedName, paylo // layout of the settings handler payload - all of this infrastructure will have to be updated // and cleaned up at some point try { - var solutionIds = fluid.keys(payload); return gpii.settingsHandlers.invokeGetHandler(resolvedName, payload); } catch (e) { fluid.log(fluid.logLevel.WARN, "Error received when dispatching settingsHandler.get " + resolvedName + " with payload ", diff --git a/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js b/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js index 06cb63a44..b2f99b068 100644 --- a/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js +++ b/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js @@ -45,8 +45,10 @@ argumentMap: {} }); + // TODO KASPER: + // fix returnTrue og returnFalse til noget lidt lækrere gpii.tests.flexibleHandler.returnTrue = function () { - return true + return true; }; fluid.defaults("gpii.tests.flexibleHandler.returnFalse", { @@ -55,7 +57,7 @@ }); gpii.tests.flexibleHandler.returnFalse = function () { - return false + return false; }; gpii.tests.flexibleHandler.assertBlock = { diff --git a/gpii/node_modules/testing/src/Integration.js b/gpii/node_modules/testing/src/Integration.js index 55767a06a..1613763e2 100644 --- a/gpii/node_modules/testing/src/Integration.js +++ b/gpii/node_modules/testing/src/Integration.js @@ -310,7 +310,7 @@ gpii.test.integration.registrySettingsHandlerKey = function (options) { gpii.test.integration.gsettingsLaunchKey = function (options) { return options.schema + "|" + options.key; -} +}; fluid.defaults("gpii.test.integration.mockSettingsHandlerRegistry", { gradeNames: ["fluid.component"], @@ -409,7 +409,7 @@ fluid.defaults("gpii.test.integration.mockSettingsHandlerRegistry.linux", { }, "gpii.gsettings.launch": { optionsPathKey: gpii.test.integration.gsettingsLaunchKey - }, + } } }); diff --git a/gpii/node_modules/testing/src/Testing.js b/gpii/node_modules/testing/src/Testing.js index c5794db07..0be7f06a5 100644 --- a/gpii/node_modules/testing/src/Testing.js +++ b/gpii/node_modules/testing/src/Testing.js @@ -156,10 +156,10 @@ gpii.test.operateSettings = function (settingsHandlers, nameResolver, method) { }; gpii.test.setInitialState = function (settingsHandlers, nameResolver, onComplete) { - console.log("KASPER: SETTING INITIAL STATE " + JSON.stringify(settingsHandlers, null, 2)); + console.log("KASPER: SETTING INITIAL STATE " + JSON.stringify(settingsHandlers, null, 2)); // TODO KASPER var promise = gpii.test.setSettings(settingsHandlers, nameResolver); - promise.then(onComplete) -} + promise.then(onComplete); +}; /** Snapshot the state of all settingsHandlers by stashing them in a member named `orig` on the supplied settingsStore * @param settingsHandlers {Object} A map of settings handler names to `settingsHandler` blocks as seen in the `settingsHandlers` @@ -341,7 +341,8 @@ gpii.test.initalStateSequence = fluid.freezeRecursive([ event: "{testCaseHolder}.events.onInitialStateConfirmed", listener: "fluid.identity" } -]) +]); + gpii.test.snapshotSequence = fluid.freezeRecursive([ { func: "gpii.test.expandSettings", diff --git a/testData/solutions/linux.json5 b/testData/solutions/linux.json5 index 968034727..4835de7da 100644 --- a/testData/solutions/linux.json5 +++ b/testData/solutions/linux.json5 @@ -285,6 +285,8 @@ } } }, + "update": [ + ], "start": [ "settings.launching" ], diff --git a/tests/JournalIntegrationTests.js b/tests/JournalIntegrationTests.js index 71924c8f5..bf43fe989 100644 --- a/tests/JournalIntegrationTests.js +++ b/tests/JournalIntegrationTests.js @@ -26,7 +26,6 @@ fluid.logObjectRenderChars = 10240; fluid.registerNamespace("gpii.tests.journal"); -fluid.logObjectRenderChars = 10000 gpii.tests.journal.testSpec = fluid.require("%universal/tests/platform/windows/windows-builtIn-testSpec.js"); // The os_win7 entry forms the spine of our test. This user has 4 application-specific preferences encoded diff --git a/tests/platform/linux/linux-builtIn-testSpec.js b/tests/platform/linux/linux-builtIn-testSpec.js index 479cce567..6d00d6ad4 100644 --- a/tests/platform/linux/linux-builtIn-testSpec.js +++ b/tests/platform/linux/linux-builtIn-testSpec.js @@ -19,8 +19,6 @@ Seventh Framework Programme (FP7/2007-2013) under grant agreement no. 289016. var fluid = require("infusion"), gpii = fluid.registerNamespace("gpii"); -fluid.logObjectRenderChars = 2048 - fluid.require("%universal"); gpii.loadTestingSupport(); diff --git a/tests/platform/linux/linux-orca-testSpec.js b/tests/platform/linux/linux-orca-testSpec.js index 21cbf7ecf..fecb1fc93 100644 --- a/tests/platform/linux/linux-orca-testSpec.js +++ b/tests/platform/linux/linux-orca-testSpec.js @@ -22,8 +22,6 @@ fluid.require("%universal"); gpii.loadTestingSupport(); -fluid.logObjectRenderChars = 8000 - fluid.registerNamespace("gpii.tests.linux.orca"); gpii.tests.linux.orca.testDefs = [ diff --git a/tests/platform/windows/windows-jaws-testSpec.js b/tests/platform/windows/windows-jaws-testSpec.js index eca2f17da..89da550e0 100644 --- a/tests/platform/windows/windows-jaws-testSpec.js +++ b/tests/platform/windows/windows-jaws-testSpec.js @@ -68,8 +68,9 @@ gpii.tests.windows.jaws.flexibleHandlerEntry = function (running) { ] } }] - } + }; }; + gpii.tests.windows.jaws.testDefs = [ { name: "Testing NP set \"jaws_application\"", diff --git a/tests/platform/windows/windows-maavis-testSpec.js b/tests/platform/windows/windows-maavis-testSpec.js index a357c13ec..93ade6a8a 100644 --- a/tests/platform/windows/windows-maavis-testSpec.js +++ b/tests/platform/windows/windows-maavis-testSpec.js @@ -60,7 +60,7 @@ gpii.tests.windows.maavis.flexibleHandlerEntry = function (running) { ] } }] - } + }; }; gpii.tests.windows.maavis.testDefs = [ diff --git a/tests/platform/windows/windows-nvda-testSpec.js b/tests/platform/windows/windows-nvda-testSpec.js index 49e542709..2df5954a6 100644 --- a/tests/platform/windows/windows-nvda-testSpec.js +++ b/tests/platform/windows/windows-nvda-testSpec.js @@ -65,7 +65,7 @@ gpii.tests.windows.nvda.flexibleHandlerEntry = function (running) { ] } }] - } + }; }; gpii.tests.windows.nvda.testDef = [ From 3beba5597d9d6c7b60609ae03e592f2a61580f58 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Tue, 14 Mar 2017 23:25:26 +0100 Subject: [PATCH 10/44] GPII-1230: Fixed unit tests for launch handler --- .../test/web/js/LaunchHandlerTests.js | 84 +++++++++---------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js b/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js index b2f99b068..899741eb7 100644 --- a/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js +++ b/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js @@ -81,9 +81,9 @@ "running": true }, options: { - "start": gpii.tests.flexibleHandler.failBlock, - "stop": gpii.tests.flexibleHandler.failBlock, - "isRunning": gpii.tests.flexibleHandler.reportRunning + "setTrue": gpii.tests.flexibleHandler.failBlock, + "setFalse": gpii.tests.flexibleHandler.failBlock, + "getState": gpii.tests.flexibleHandler.reportRunning } }, expectedSettings: { @@ -100,9 +100,9 @@ "running": false }, options: { - "start": gpii.tests.flexibleHandler.failBlock, - "stop": gpii.tests.flexibleHandler.failBlock, - "isRunning": gpii.tests.flexibleHandler.reportNotRunning + "setTrue": gpii.tests.flexibleHandler.failBlock, + "setFalse": gpii.tests.flexibleHandler.failBlock, + "getState": gpii.tests.flexibleHandler.reportNotRunning } }, expectedSettings: { @@ -119,9 +119,9 @@ "running": true }, options: { - "start": gpii.tests.flexibleHandler.assertBlock, - "stop": gpii.tests.flexibleHandler.failBlock, - "isRunning": gpii.tests.flexibleHandler.reportNotRunning + "setTrue": gpii.tests.flexibleHandler.assertBlock, + "setFalse": gpii.tests.flexibleHandler.failBlock, + "getState": gpii.tests.flexibleHandler.reportNotRunning } }, expectedSettings: { @@ -138,9 +138,9 @@ "running": false }, options: { - "start": gpii.tests.flexibleHandler.failBlock, - "stop": gpii.tests.flexibleHandler.assertBlock, - "isRunning": gpii.tests.flexibleHandler.reportRunning + "setTrue": gpii.tests.flexibleHandler.failBlock, + "setFalse": gpii.tests.flexibleHandler.assertBlock, + "getState": gpii.tests.flexibleHandler.reportRunning } }, expectedSettings: { @@ -157,12 +157,12 @@ "running": true }, options: { - "start": [ + "setTrue": [ gpii.tests.flexibleHandler.assertBlock, gpii.tests.flexibleHandler.assertBlock ], - "stop": gpii.tests.flexibleHandler.failBlock, - "isRunning": gpii.tests.flexibleHandler.reportNotRunning + "setFalse": gpii.tests.flexibleHandler.failBlock, + "getState": gpii.tests.flexibleHandler.reportNotRunning } }, expectedSettings: { @@ -179,12 +179,12 @@ "running": false }, options: { - "start": gpii.tests.flexibleHandler.failBlock, - "stop": [ + "setTrue": gpii.tests.flexibleHandler.failBlock, + "setFalse": [ gpii.tests.flexibleHandler.assertBlock, gpii.tests.flexibleHandler.assertBlock ], - "isRunning": gpii.tests.flexibleHandler.reportRunning + "getState": gpii.tests.flexibleHandler.reportRunning } }, expectedSettings: { @@ -220,9 +220,9 @@ "running": true }, options: { - "start": gpii.tests.flexibleHandler.assertBlock, - "stop": gpii.tests.flexibleHandler.failBlock, - "isRunning": gpii.tests.flexibleHandler.reportNotRunning + "setTrue": gpii.tests.flexibleHandler.assertBlock, + "setFalse": gpii.tests.flexibleHandler.failBlock, + "getState": gpii.tests.flexibleHandler.reportNotRunning } } ], @@ -232,9 +232,9 @@ "running": true }, options: { - "start": gpii.tests.flexibleHandler.assertBlock, - "stop": gpii.tests.flexibleHandler.failBlock, - "isRunning": gpii.tests.flexibleHandler.reportNotRunning + "setTrue": gpii.tests.flexibleHandler.assertBlock, + "setFalse": gpii.tests.flexibleHandler.failBlock, + "getState": gpii.tests.flexibleHandler.reportNotRunning } } ] @@ -249,9 +249,9 @@ } }, options: { - "start": gpii.tests.flexibleHandler.assertBlock, - "stop": gpii.tests.flexibleHandler.failBlock, - "isRunning": gpii.tests.flexibleHandler.reportNotRunning + "setTrue": gpii.tests.flexibleHandler.assertBlock, + "setFalse": gpii.tests.flexibleHandler.failBlock, + "getState": gpii.tests.flexibleHandler.reportNotRunning } } ], @@ -264,9 +264,9 @@ } }, options: { - "start": gpii.tests.flexibleHandler.assertBlock, - "stop": gpii.tests.flexibleHandler.failBlock, - "isRunning": gpii.tests.flexibleHandler.reportNotRunning + "setTrue": gpii.tests.flexibleHandler.assertBlock, + "setFalse": gpii.tests.flexibleHandler.failBlock, + "getState": gpii.tests.flexibleHandler.reportNotRunning } } ] @@ -282,9 +282,9 @@ "running": false }, options: { - "start": gpii.tests.flexibleHandler.failBlock, - "stop": gpii.tests.flexibleHandler.assertBlock, - "isRunning": gpii.tests.flexibleHandler.reportRunning + "setTrue": gpii.tests.flexibleHandler.failBlock, + "setFalse": gpii.tests.flexibleHandler.assertBlock, + "getState": gpii.tests.flexibleHandler.reportRunning } } ], @@ -294,9 +294,9 @@ "running": false }, options: { - "start": gpii.tests.flexibleHandler.failBlock, - "stop": gpii.tests.flexibleHandler.failBlock, - "isRunning": gpii.tests.flexibleHandler.reportNotRunning + "setTrue": gpii.tests.flexibleHandler.failBlock, + "setFalse": gpii.tests.flexibleHandler.failBlock, + "getState": gpii.tests.flexibleHandler.reportNotRunning } } ] @@ -311,9 +311,9 @@ } }, options: { - "start": gpii.tests.flexibleHandler.failBlock, - "stop": gpii.tests.flexibleHandler.assertBlock, - "isRunning": gpii.tests.flexibleHandler.reportRunning + "setTrue": gpii.tests.flexibleHandler.failBlock, + "setFalse": gpii.tests.flexibleHandler.assertBlock, + "getState": gpii.tests.flexibleHandler.reportRunning } } ], @@ -326,9 +326,9 @@ } }, options: { - "start": gpii.tests.flexibleHandler.failBlock, - "stop": gpii.tests.flexibleHandler.failBlock, - "isRunning": gpii.tests.flexibleHandler.reportNotRunning + "setTrue": gpii.tests.flexibleHandler.failBlock, + "setFalse": gpii.tests.flexibleHandler.failBlock, + "getState": gpii.tests.flexibleHandler.reportNotRunning } } ] From f39112bc399c32461010f20d203607927d9e4384 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Mon, 20 Mar 2017 17:17:10 +0100 Subject: [PATCH 11/44] GPII-1230: Fixed up tests and linting... still needs more work --- .../lifecycleManager/src/LifecycleManager.js | 58 ++++++++++--------- .../test/js/LifecycleManagerTests.js | 20 +------ .../test/web/js/LaunchHandlerTests.js | 2 - gpii/node_modules/testing/src/Testing.js | 4 +- tests/JournalIntegrationTests.js | 16 ++--- .../platform/windows/windows-nvda-testSpec.js | 2 - 6 files changed, 44 insertions(+), 58 deletions(-) diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index bbf709e5f..d4cb06841 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -242,7 +242,10 @@ var gpii = fluid.registerNamespace("gpii"); gpii.lifecycleManager.recordSnapshotInSession = function (that, snapshot, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction) { var toSnapshot = fluid.copy(solutionRecord); - toSnapshot.settingsHandlers = {}; + // Disabled the removing of all settingshandlers blocks to ensure that we have them available when restoring the system. + // This is particularly relevant for launch handlers, where we will need to run the "get" directives on logout to decide + // whether we an application is running or not, and consequently, whether to run the "update" or "stop" block + // toSnapshot.settingsHandlers = {}; toSnapshot.settingsHandlers[settingsHandlerBlockName] = snapshot; if (rootAction === "start" || rootAction === "update") { // keep the settings that are already stored from the @@ -288,10 +291,6 @@ var gpii = fluid.registerNamespace("gpii"); * that will be resolved once the settings are successfully set. */ gpii.lifecycleManager.executeSettingsAction = function (that, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction) { - - // console.log("KASPER Record: " + JSON.stringify(solutionRecord, null, 2)); - var tmp = JSON.stringify(fluid.get(solutionRecord, [ "settingsHandlers", settingsHandlerBlockName, "settings"]), null, 2) - console.log("KASPER: executeSettingsAction: (" + solutionId + ": " + settingsHandlerBlockName + ") with settings: " + tmp); var settingsHandlerBlock = solutionRecord.settingsHandlers[settingsHandlerBlockName]; if (settingsHandlerBlock === undefined) { fluid.fail("Reference to non-existing settingsHandler block named " + settingsHandlerBlockName + @@ -304,8 +303,6 @@ var gpii = fluid.registerNamespace("gpii"); } else { var settingsPromise = that.invokeSettingsHandlerSet(solutionId, expanded); settingsPromise.then(function (snapshot) { - console.log("KASPER: executeSettingsAction: (" + solutionId + ": " + settingsHandlerBlockName + ") with settings: " + tmp + - " .... PROMISE RESOLVED"); session.applier.change(["appliedSolutions", solutionId], solutionRecord); gpii.lifecycleManager.recordSnapshotInSession(that, snapshot, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction); @@ -405,7 +402,6 @@ var gpii = fluid.registerNamespace("gpii"); */ gpii.lifecycleManager.executeActions = function (that, solutionId, solutionRecord, session, actionBlock, rootAction) { - console.log("KASPER: Execute actions: " + JSON.stringify(actionBlock) + "... rootAction: " + rootAction) var steps = solutionRecord[actionBlock]; if (steps === undefined) { fluid.log("No " + actionBlock + " actions defined for solution " + solutionId); @@ -417,34 +413,33 @@ var gpii = fluid.registerNamespace("gpii"); // the settings handler block) if (action.indexOf("settings.") === 0) { var settingsHandlerBlockName = action.substring("settings.".length); - // if this is related to launching, overwrite entry with the appropriate settings, - // that is: { running: true } if we're in a start block, else { running: false } - if (actionBlock === "start" || (actionBlock === "stop" && rootAction !== "stop") || actionBlock === "isRunning") { - var launchSettings = { running: actionBlock === "start" ? true : false }; - fluid.set(solutionRecord, [ "settingsHandlers", settingsHandlerBlockName, "settings"], launchSettings); + if (actionBlock === "isRunning") { + // if we're just checking for the run state, dont actually modify the solutionRecord with settings: + var tmpSolutionRecord = fluid.copy(solutionRecord); + fluid.set(tmpSolutionRecord, [ "settingsHandlers", settingsHandlerBlockName, "settings"], { running: null }); + return gpii.lifecycleManager.executeSettingsAction(that, solutionId, tmpSolutionRecord, session, settingsHandlerBlockName, rootAction); + } else { + // if this is related to launching, overwrite entry with the appropriate settings, + // that is: { running: true } if we're in a start block, else { running: false } + if (actionBlock === "start" || (actionBlock === "stop" && rootAction !== "stop") || actionBlock === "isRunning") { + var launchSettings = { running: actionBlock === "start" ? true : false }; + fluid.set(solutionRecord, [ "settingsHandlers", settingsHandlerBlockName, "settings"], launchSettings); + } + return gpii.lifecycleManager.executeSettingsAction(that, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction); } - return gpii.lifecycleManager.executeSettingsAction(that, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction); } else if (actionBlock === "update") { // Keywords: "start", "stop", "configure" are allowed here as well, and // and will result in evaluating the respective block // TODO (GPII-1230) Fix this up so we don't always run the full start and stops (including) // system restoration, etc. - if (action === "start" || action === "configure") { + if (action === "start" || action === "configure" || action === "stop") { return that.executeActions(solutionId, solutionRecord, session, action, rootAction); - } else if (action === "stop") { - // TODO KASPER -- OVERVEJ AT GENINDFØRE DET NEDENSTÅENDE - // This branch is used when an "update" action requires a stop and start of the solution - // var unarmoured = gpii.lifecycleManager.transformSolutionSettings( - // session.model.originalSettings[solutionId], gpii.settingsHandlers.changesToSettings); - // return that.executeActions(solutionId, unarmoured, session, "stop", rootAction); - // TODO KASPER: Har erstattet ovenstående med: - return that.executeActions(solutionId, solutionRecord, session, "stop", rootAction); } else { fluid.fail("Unrecognised string action in LifecycleManager: " + action + " inside 'update' section for solution " + solutionId); } } - } else { // TODO should be removed when GPII-1235 has been solved (lifecycle actions are settings handlers) // TODO KASPER remove this + } else { // TODO should be removed when GPII-1235 has been solved (lifecycle actions are settings handlers) return function () { var expanded = session.localResolver(action); var result = gpii.lifecycleManager.invokeAction(expanded, that.nameResolver); @@ -493,7 +488,8 @@ var gpii = fluid.registerNamespace("gpii"); var promises = fluid.transform(session.model.originalSettings, function (changesSolutionRecord, solutionId) { var solutionRecord = gpii.lifecycleManager.transformSolutionSettings(changesSolutionRecord, gpii.settingsHandlers.changesToSettings); // if a solution was running on login, run the update block to ensure that restored settings are applied - var actions = session.model.runningOnLogin[solutionId] ? [ "update" ] : [ "stop", "restore" ]; + var recordedState = gpii.lifecycleManager.getSolutionRunningStateFromSnapshot(solutionRecord); + var actions = recordedState ? [ "update" ] : [ "stop", "restore" ]; return that.applySolution(solutionId, solutionRecord, session, actions, rootAction); }); @@ -522,6 +518,16 @@ var gpii = fluid.registerNamespace("gpii"); }); }; + gpii.lifecycleManager.getSolutionRunningStateFromSnapshot = function (solutionSnapshot) { + // get isRunning entry from snapshot and block to run: + var isRunningBlock = fluid.makeArray(solutionSnapshot.isRunning)[0]; + if (isRunningBlock && isRunningBlock.indexOf("settings.") === 0) { + var settingsHandlerBlockName = isRunningBlock.substring("settings.".length); + var recordedState = fluid.get(solutionSnapshot, ["settingsHandlers", settingsHandlerBlockName, "settings", "running"]); + return recordedState; + } + }; + gpii.lifecycleManager.getSolutionRunningState = function (that, solutionId, solutionRecord, session) { if (!fluid.isDestroyed(that)) { var promise = that.executeActions(solutionId, solutionRecord, session, "isRunning", "isRunning"); @@ -590,7 +596,6 @@ var gpii = fluid.registerNamespace("gpii"); }; gpii.lifecycleManager.start = function (that, request, finalPayload, callback) { - console.log("KASPER: gpii.lifecycleManager.start") var userToken = finalPayload.userToken, lifecycleInstructions = finalPayload.lifecycleInstructions; if (that.sessionIndex[userToken]) { @@ -628,7 +633,6 @@ var gpii = fluid.registerNamespace("gpii"); if (solution.active === false) { // and it shouldn't actions = [ "stop", "configure" ]; } else { // else call "update" to make changes apply to a running solutions - console.log("KASPER: running and active = yes, so using 'update directive'") actions = [ "update" ]; } } else { // if it is not running diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index 92c65e257..11875031c 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -680,7 +680,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt // 2 tests for the settingsHandler (see mockSettingsHandler function above) // 2 tests for the launchHandler (see mockLaunchHandler function above) // and the two asserts below - jqUnit.expect(5); + jqUnit.expect(1); var lifecycleManager = gpii.lifecycleManager(gpii.tests.lifecycleManager.testOptions); gpii.tests.lifecycleManager.initBackingMock(); @@ -741,20 +741,6 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt var response = gpii.lifecycleManager.specToSettingsHandler("fake.solution", spec.request, spec.isMultiSH); jqUnit.assertDeepEq(name, { "fake.solution": spec.response }, response); }); - - // Test for fail if a multi settingshandler solution doesn't have a supportedSettings directive - var failingFunc = function () { - gpii.lifecycleManager.specToSettingsHandler("fake.solution", { - "type": "gpii.gsettings.set", - "options": {}, - "settings": { - "weirdSetting": "foo", - "otherSetting": "bar" - } - }, true); - }; - jqUnit.expectFrameworkDiagnostic("Expect failure if no supportedSettings for multiple SH solution", - failingFunc, "missing the 'supportedSettings' directive"); }); jqUnit.test("gpii.lifecycleManager.responseToSnapshot() no settings", function () { @@ -772,11 +758,11 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt jqUnit.assertDeepEq("responseToSnapshot returning the correct payload", expected, response); }); - jqUnit.asyncTest("gpii.lifecycleManager.invokeSettingsHandler()", function () { + jqUnit.asyncTest("gpii.lifecycleManager.invokeSettingsHandlerSet()", function () { jqUnit.expect(2); var lifecycleManager = gpii.lifecycleManager(); gpii.tests.lifecycleManager.initBackingMock(); - var snapshotPromise = lifecycleManager.invokeSettingsHandler("org.gnome.desktop.a11y.magnifier", gpii.tests.lifecycleManager.invokeSettingsHandlersRequest); + var snapshotPromise = lifecycleManager.invokeSettingsHandlerSet("org.gnome.desktop.a11y.magnifier", gpii.tests.lifecycleManager.invokeSettingsHandlersRequest); var expected = gpii.tests.lifecycleManager.settingsToChanges(gpii.tests.lifecycleManager.invokeSettingsHandlersExpectedSnapshot); snapshotPromise.then(function (snapshot) { jqUnit.assertDeepEq("invokeSettingsHandlers produced snapshot", expected, snapshot); diff --git a/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js b/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js index 899741eb7..9e9c9f6a1 100644 --- a/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js +++ b/gpii/node_modules/settingsHandlers/test/web/js/LaunchHandlerTests.js @@ -45,8 +45,6 @@ argumentMap: {} }); - // TODO KASPER: - // fix returnTrue og returnFalse til noget lidt lækrere gpii.tests.flexibleHandler.returnTrue = function () { return true; }; diff --git a/gpii/node_modules/testing/src/Testing.js b/gpii/node_modules/testing/src/Testing.js index 0be7f06a5..36b7a8651 100644 --- a/gpii/node_modules/testing/src/Testing.js +++ b/gpii/node_modules/testing/src/Testing.js @@ -156,7 +156,6 @@ gpii.test.operateSettings = function (settingsHandlers, nameResolver, method) { }; gpii.test.setInitialState = function (settingsHandlers, nameResolver, onComplete) { - console.log("KASPER: SETTING INITIAL STATE " + JSON.stringify(settingsHandlers, null, 2)); // TODO KASPER var promise = gpii.test.setSettings(settingsHandlers, nameResolver); promise.then(onComplete); }; @@ -189,7 +188,6 @@ gpii.test.extractSettingsBlocks = function (settingsHandlers) { }; gpii.test.checkConfiguration = function (settingsHandlers, nameResolver, onComplete, customMsg) { - console.log("KASPER: CHECKING CONFIGURATION " + JSON.stringify(settingsHandlers, null, 2)); var configPromise = gpii.test.getSettings(settingsHandlers, nameResolver); configPromise.then(function (config) { var noOptions = gpii.test.extractSettingsBlocks(settingsHandlers); @@ -253,7 +251,7 @@ fluid.defaults("gpii.test.common.testCaseHolder", { }, mergePolicy: { "settingsHandlers": "noexpand", - "initialState": "noexpand" // KASPER? + "initialState": "noexpand" }, events: { onSnapshotComplete: null, diff --git a/tests/JournalIntegrationTests.js b/tests/JournalIntegrationTests.js index bf43fe989..219a9a23b 100644 --- a/tests/JournalIntegrationTests.js +++ b/tests/JournalIntegrationTests.js @@ -85,14 +85,16 @@ gpii.tests.journal.initialSettings = { } }] }, - "gpii.launchHandlers.flexibleHandler": { - "com.microsoft.windows.magnifier": [ - { - "settings": { - "running": false - } + "gpii.windows.enableRegisteredAT": { + "com.microsoft.windows.magnifier": [{ + "settings": { + "running": false + }, + "options": { + "registryName": "magnifierpane", + "queryProcess": "Magnify" } - ] + }] } }; diff --git a/tests/platform/windows/windows-nvda-testSpec.js b/tests/platform/windows/windows-nvda-testSpec.js index 2df5954a6..19a46c278 100644 --- a/tests/platform/windows/windows-nvda-testSpec.js +++ b/tests/platform/windows/windows-nvda-testSpec.js @@ -20,8 +20,6 @@ var fluid = require("infusion"), fluid.require("%universal"); -fluid.logObjectRenderChars = 80000 - gpii.loadTestingSupport(); fluid.registerNamespace("gpii.tests.windows.nvda"); From b9af1c8bb1ea9d391457cfeddfb0558d80f315dd Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 29 Mar 2017 15:49:09 +0200 Subject: [PATCH 12/44] GPII-1230: Added and fixed a bunch of LFM unit tests --- .../lifecycleManager/src/LifecycleManager.js | 73 +- .../test/js/LifecycleManagerTests.js | 968 +++++++++++------- .../src/settingsHandlerUtilities.js | 7 +- 3 files changed, 691 insertions(+), 357 deletions(-) diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index d4cb06841..17c1f60f4 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -235,13 +235,22 @@ var gpii = fluid.registerNamespace("gpii"); return value; }; + /** Remove all the settings blocks from a solutions registry entry + */ + gpii.settingsHandlers.removeSettingsBlocks = function (solutionEntry) { + solutionEntry.settingsHandlers = fluid.transform(solutionEntry.settingsHandlers, function (handler) { + return fluid.filterKeys(handler, "settings", true); + }); + return solutionEntry; + }; + /** Applies snapshotted settings from a single settingsHandler block attached to a single solution into the "originalSettings" * model snapshot area in the LifecycleManager's session. Tightly bound to executeSettingsAction, executes one-to-one with it * with almost identical argument list. */ - gpii.lifecycleManager.recordSnapshotInSession = function (that, snapshot, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction) { - var toSnapshot = fluid.copy(solutionRecord); + var toSnapshot = gpii.settingsHandlers.removeSettingsBlocks(fluid.copy(solutionRecord)); + // Disabled the removing of all settingshandlers blocks to ensure that we have them available when restoring the system. // This is particularly relevant for launch handlers, where we will need to run the "get" directives on logout to decide // whether we an application is running or not, and consequently, whether to run the "update" or "stop" block @@ -485,16 +494,60 @@ var gpii = fluid.registerNamespace("gpii"); * @return {Promise} A promise for the action of restoring the system */ gpii.lifecycleManager.restoreSystem = function (that, session, rootAction) { - var promises = fluid.transform(session.model.originalSettings, function (changesSolutionRecord, solutionId) { - var solutionRecord = gpii.lifecycleManager.transformSolutionSettings(changesSolutionRecord, gpii.settingsHandlers.changesToSettings); - // if a solution was running on login, run the update block to ensure that restored settings are applied - var recordedState = gpii.lifecycleManager.getSolutionRunningStateFromSnapshot(solutionRecord); - var actions = recordedState ? [ "update" ] : [ "stop", "restore" ]; - return that.applySolution(solutionId, solutionRecord, session, actions, rootAction); + var tasks = []; + fluid.each(session.model.originalSettings, function (changesSolutionRecord, solutionId) { + tasks.push(function () { + // check the current state of the solution to decide whether we should run the + // "restore", "update, or "stop" + return that.getSolutionRunningState(solutionId, changesSolutionRecord, session); + }); + tasks.push(function () { + if (!fluid.isDestroyed(that)) { // See above comment for GPII-580 + // if solution is already running, call "update" directive - else use "start" directive + var solutionRecord = gpii.lifecycleManager.transformSolutionSettings(changesSolutionRecord, gpii.settingsHandlers.changesToSettings); + var recordedRunState = gpii.lifecycleManager.getSolutionRunningStateFromSnapshot(solutionRecord); + var currentRunState = session.model.runningOnLogin[solutionId]; + + var actions; + if (currentRunState === true) { // if it's already running + if (recordedRunState === false) { // and it was not running on start + actions = [ "stop", "restore" ] + } else { // else update it + actions = [ "update" ] + } + } else { // if it is not running + if (recordedRunState === true) { // and it was running when we started + actions = [ "restore", "start" ]; + } else { // just restore settings + actions = [ "restore" ]; + } + } + + // build structure for returned values (for later reset) + return that.applySolution(solutionId, solutionRecord, session, actions, rootAction); + } + }); }); + var sequence = fluid.promise.sequence(tasks); + - // TODO: In theory we could stop all solutions in parallel - var sequence = fluid.promise.sequence(fluid.values(promises)); + // var promises = fluid.transform(session.model.originalSettings, function (changesSolutionRecord, solutionId) { + // var solutionRecord = gpii.lifecycleManager.transformSolutionSettings(changesSolutionRecord, gpii.settingsHandlers.changesToSettings); + // // if a solution was running on login, run the update block to ensure that restored settings are applied + // var recordedState = gpii.lifecycleManager.getSolutionRunningStateFromSnapshot(solutionRecord); + // var currentState = that.getSolutionRunningState(solutionId, changesSolutionRecord, session); + // var actions; + // if (recordedState === undefined) { // if we didn't do anything to solution state before, dont do it now + // actions = [ "restore" ] + // } else if (recordedState === true) { // if originally running and we stopped it, updait was started when we logged in, ensure that it is still started + // = recordedState ? [ "update" ] : [ "stop", "restore" ]; + // } + // } + // return that.applySolution(solutionId, solutionRecord, session, actions, rootAction); + // }); + + // // TODO: In theory we could stop all solutions in parallel + // var sequence = fluid.promise.sequence(fluid.values(promises)); return sequence; }; diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index 11875031c..c21603de5 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -2,7 +2,7 @@ GPII Lifecycle Manager Tests Copyright 2012 OCAD University -Copyright 2012 Raising The Floor - International +Copyright 2012, 2017 Raising The Floor - International Licensed under the New BSD license. You may not use this file except in compliance with this License. @@ -64,16 +64,37 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt return togo; }; - gpii.tests.lifecycleManager.buildSettingsHandlersEntry = function (settings) { - return { + gpii.tests.lifecycleManager.extendLifecycleInstructions = function (currentInstructions) { + var togo = fluid.copy(currentInstructions); + var solId = Object.keys(currentInstructions)[0]; + + for (var i = 1; i < arguments.length; ++i) { + togo[solId] = fluid.extend(true, {}, togo[solId], arguments[i]); + } + + return togo; + } + + gpii.tests.lifecycleManager.buildSettingsHandlersEntry = function (settings, setRunning) { + var togo = { "settingsHandlers": { "myconf": { "type": "gpii.tests.lifecycleManager.mockSettingsHandler", - "settings": settings, + "options": {} + }, + "launcher": { + "type": "gpii.tests.lifecycleManager.mockLaunchHandler", "options": {} } } }; + if (settings !== undefined) { + fluid.set(togo, [ "settingsHandlers", "myconf", "settings" ], settings) + } + if (setRunning !== undefined) { + fluid.set(togo, [ "settingsHandlers", "launcher", "settings" ], { running: setRunning }) + } + return togo; }; gpii.tests.lifecycleManager.noUpdateLifecycle = { @@ -100,7 +121,27 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt ] }; - gpii.tests.lifecycleManager.configurationSpec = gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle = { + "active": true, + "configure": [ + "settings.myconf" + ], + "restore": [ + "settings.myconf" + ], + "start": [ + "settings.launcher" + ], + "stop": [ + "settings.launcher" + ], + "isRunning": [ + "settings.launcher" + ] + }; + + gpii.tests.lifecycleManager.configurationSpec = gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "red" }), gpii.tests.lifecycleManager.noUpdateLifecycle, { "update": [ "settings.myconf" ] }); @@ -261,9 +302,14 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt userToken: 123 }; - gpii.tests.lifecycleManager.startPayload = fluid.extend(true, {}, gpii.tests.lifecycleManager.userOptions, { - lifecycleInstructions: gpii.tests.lifecycleManager.configurationSpec - }); + gpii.tests.lifecycleManager.buildStartPayload = function (lifecycleInstructions) { + return fluid.extend(true, {}, gpii.tests.lifecycleManager.userOptions, { + lifecycleInstructions: lifecycleInstructions + }); + }; + + gpii.tests.lifecycleManager.startPayload = gpii.tests.lifecycleManager.buildStartPayload(gpii.tests.lifecycleManager.configurationSpec); + gpii.tests.lifecycleManager.sampleActiveSession = { 123: { @@ -309,10 +355,31 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt gpii.tests.lifecycleManager.backingMockSettingsHandler = null; // initialised in every test that requires it - gpii.tests.lifecycleManager.initBackingMock = function () { - gpii.tests.lifecycleManager.backingMockSettingsHandler = gpii.test.integration.mockSettingsHandler(); + gpii.tests.lifecycleManager.initBackingMock = function (origSettings, setRunning) { + gpii.tests.lifecycleManager.backingMockSettingsHandler = gpii.test.integration.mockSettingsHandler({ + optionsPathKey: function (options, solutionId) { + return "settings|" + solutionId; + } + }); + gpii.tests.lifecycleManager.backingMockLaunchHandler = gpii.test.integration.mockSettingsHandler({ + optionsPathKey: function (options, solutionId) { + return "launch|" + solutionId; + } + }); + + var settings = origSettings === undefined ? // use default if no parameter is given + gpii.tests.lifecycleManager.settingsHandlerOriginalSystemSettings : + origSettings; + + var setRunning = (setRunning === undefined) ? false : setRunning; // default to false + var launchSettings = gpii.tests.lifecycleManager.launchHandlerOriginalSystemSettingsRunning(setRunning); // initialise the mock with the initial settings expected at the end of the test - gpii.tests.lifecycleManager.backingMockSettingsHandler.set(gpii.tests.lifecycleManager.settingsHandlerOriginalSystemSettings); + gpii.tests.lifecycleManager.backingMockSettingsHandler.set(settings); + gpii.tests.lifecycleManager.backingMockLaunchHandler.set(launchSettings); + // and ensure our 'local' storage is reset + gpii.tests.lifecycleManager.staticRepository.settingsHandler = undefined; + gpii.tests.lifecycleManager.staticRepository.launchHandler = undefined; + gpii.tests.lifecycleManager.staticRepository.launchHandlerCalls = 0; }; gpii.tests.lifecycleManager.mockSettingsHandler = { @@ -330,6 +397,40 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt } }; + // TODO KASPER: this is duplicate + gpii.tests.lifecycleManager.mockLaunchHandler = { + set: function (data) { + var togo = fluid.promise(); + gpii.invokeLater(function () { + gpii.tests.lifecycleManager.staticRepository.launchHandlerCalls++; + gpii.tests.lifecycleManager.staticRepository.launchHandler = data; + var response = gpii.resolveSync(gpii.tests.lifecycleManager.backingMockLaunchHandler.set(data)); + togo.resolve(response); + }, 100); + return togo; + }, + get: function (data) { + return gpii.resolveSync(gpii.tests.lifecycleManager.backingMockLaunchHandler.get(data)); + } + }; + + + gpii.tests.lifecycleManager.createSettingsHandlerPayload = function (solutionId, settings) { + if (settings === undefined) { + return undefined; + } else { + var togo = {}; + togo[solutionId] = [ + { + options: {}, + settings: settings + } + ]; + return togo; + } + } + + // TODO KASPER: Remove this and all references (probably) gpii.tests.lifecycleManager.assertExpectedExec = function () { jqUnit.assertDeepEq("Exec handler fired with expected arguments", { "command": gpii.tests.lifecycleManager.fakeEnvironment.JAWS_DIR + "jaws.exe", @@ -354,16 +455,30 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt "iamasetting": 200, "undefSetting": undefined }, - "options": {} + "options": { + // "storePath": "settingsBlock1" + } }], "other.application": [{ "settings": { "mysetting": "Hello World" }, - "type": "gpii.tests.lifecycleManager.mockSettingsHandler" + "options": { + // "storePath": "settingsBlock1" + } }] }; + gpii.tests.lifecycleManager.launchHandlerOriginalSystemSettingsRunning = function (setRunning) { + return { + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "running": setRunning + } + }] + } + }; + gpii.tests.lifecycleManager.settingsHandlerExpectedInputNewSettings = { "org.gnome.desktop.a11y.magnifier": [{ "settings": { @@ -384,340 +499,524 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt }] }; - gpii.tests.lifecycleManager.updateTestDefs = fluid.freezeRecursive([{ - name: "Updating with the same prefs and values as already applied", - activeSessions: gpii.tests.lifecycleManager.sampleActiveSession, - startPayload: gpii.tests.lifecycleManager.startPayload, - updateSpec: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false, "cross-hairs-color": "green" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - expectedAppliedSolutions: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false, "cross-hairs-color": "green" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - expectedOriginalSettings: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false, "cross-hairs-color": "red" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }) - }, { - name: "single pref changed without 'update' directive in solution registry entry", - activeSessions: gpii.tests.lifecycleManager.sampleActiveSession, - startPayload: fluid.extend(true, {}, gpii.tests.lifecycleManager.userOptions, { - lifecycleInstructions: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "red" }), - gpii.tests.lifecycleManager.noUpdateLifecycle) - }), - updateSpec: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-color": "green" }), - gpii.tests.lifecycleManager.noUpdateLifecycle), - // dont expect changes on update due to missing 'update' directive - expectedAppliedSolutions: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "red" }), - gpii.tests.lifecycleManager.noUpdateLifecycle), - expectedOriginalSettings: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false, "cross-hairs-color": "red" }), - gpii.tests.lifecycleManager.noUpdateLifecycle) - }, { - name: "Updating with normal reference to settingsHandler block, single settings", - activeSessions: gpii.tests.lifecycleManager.sampleActiveSession, - startPayload: gpii.tests.lifecycleManager.startPayload, - updateSpec: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-color": "green" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - expectedAppliedSolutions: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "green" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - expectedOriginalSettings: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false, "cross-hairs-color": "red" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }) - }, { - name: "Updating with normal reference to settingsHandler block, multiple settings", - activeSessions: gpii.tests.lifecycleManager.sampleActiveSession, - startPayload: gpii.tests.lifecycleManager.startPayload, - updateSpec: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-color": "green", "cross-hairs-clip": false }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - expectedAppliedSolutions: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false, "cross-hairs-color": "green" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - expectedOriginalSettings: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false, "cross-hairs-color": "red" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }) + gpii.tests.lifecycleManager.startTestDefs = [{ + name: "Solution with only start and stop blocks", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + { + "active": true, + "start": [ + "settings.launcher" + ], + "stop": [ + "settings.launcher" + ], + "isRunning": [ + "settings.launcher" + ] + } + ), + originalSettings: undefined, + runningOnLogin: false, + appliedSettings: {}, + runningAfterLogin: true, + expectedLaunchHandlerCalls: 2 }, { - name: "Updating with reference to 'configure' directive, single settings", - activeSessions: gpii.tests.lifecycleManager.sampleActiveSession, - startPayload: fluid.extend(true, {}, gpii.tests.lifecycleManager.userOptions, { - lifecycleInstructions: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "red" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "configure" ] }) - }), - updateSpec: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-color": "green" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "configure" ] }), - expectedAppliedSolutions: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "green" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "configure" ] }), - expectedOriginalSettings: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false, "cross-hairs-color": "red" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "configure" ] }) + name: "solution with only configure and restore blocks", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + { + "active": true, + "restore": [ + "settings.myconf" + ], + "configure": [ + "settings.myconf" + ], + "isRunning": [ + "settings.launcher" + ] + } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: undefined, + appliedSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, + runningAfterLogin: undefined, + expectedLaunchHandlerCalls: 0 }, { - name: "Updating with normal reference to settingsHandler block, and a setting not in the original settings applied to the system", - activeSessions: gpii.tests.lifecycleManager.sampleActiveSession, - startPayload: gpii.tests.lifecycleManager.startPayload, - updateSpec: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-color": "green", "iamasetting": 100 }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - expectedAppliedSolutions: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "green", "iamasetting": 100 }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - expectedOriginalSettings: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false, "cross-hairs-color": "red", "iamasetting": 200 }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }) + name: "Solution with all lifecycle blocks", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: false, + appliedSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, + runningAfterLogin: true, + expectedLaunchHandlerCalls: 2 }, { - name: "Updating with normal reference to settingsHandler block, and a an application not in the original settings applied to the system", - activeSessions: gpii.tests.lifecycleManager.sampleActiveSession, - startPayload: gpii.tests.lifecycleManager.startPayload, - updateSpec: gpii.tests.lifecycleManager.buildLifecycleInstructions("other.application", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "mysetting": "Hallow World" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - expectedAppliedSolutions: fluid.extend(true, {}, - gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "red" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - gpii.tests.lifecycleManager.buildLifecycleInstructions("other.application", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "mysetting": "Hallow World" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] })), - expectedOriginalSettings: fluid.extend(true, {}, - gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false, "cross-hairs-color": "red" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - gpii.tests.lifecycleManager.buildLifecycleInstructions("other.application", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "mysetting": "Hello World" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] })) + name: "solution with active: false", // no launch handler calls + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { "active": false } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: false, + appliedSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, + runningAfterLogin: undefined, + expectedLaunchHandlerCalls: 0 }, { - // TODO: What is the difference between this test and the next one? Also, eliminate the massive duplication - name: "Updating with normal reference to settingsHandler block, and 'undefined' value stored in snapshot", - activeSessions: gpii.tests.lifecycleManager.sampleActiveSession, - startPayload: fluid.extend(true, {}, gpii.tests.lifecycleManager.userOptions, { - lifecycleInstructions: fluid.extend(true, {}, - gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "undefSetting": "some value" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] })) - }), - expectedFirstAppliedSettings: { - "org.gnome.desktop.a11y.magnifier": [{ - "options": {}, - "settings": { - "cross-hairs-clip": true, - "undefSetting": "some value" - } - }] - }, - updateSpec: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "undefSetting": "some other value" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - expectedAppliedSolutions: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "undefSetting": "some other value" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - expectedOriginalSettings: { - "org.gnome.desktop.a11y.magnifier": { - "active": true, + name: "solution with active: undefined", // expect no launch handler calls + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + { + "active": undefined, "configure": [ "settings.myconf" ], "restore": [ "settings.myconf" ], - "settingsHandlers": { - "myconf": { - "options": {}, - "settings": { - "cross-hairs-clip": false, - "undefSetting": gpii.undefinedEncoding - }, - "type": "gpii.tests.lifecycleManager.mockSettingsHandler" - } - }, "start": [ - { - "args": [ - "-settingsDirectory", - "${{environment}.WINDIR}" - ], - "command": "${{environment}.JAWS_DIR}jaws.exe", - "name": "exec", - "type": "gpii.tests.lifecycleManager.mockExecHandler" - } + "settings.launcher" ], "stop": [ - { - "pid": "${{exec}.pid}", - "type": "gpii.tests.lifecycleManager.mockKillHandler" - } + "settings.launcher" ], + "isRunning": [ + "settings.launcher" + ] + } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: false, + appliedSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, + runningAfterLogin: undefined, + expectedLaunchHandlerCalls: 0 + }, { + name: "running on login - 'update' with reference to settings handler block", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "settings.myconf" ] } - } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: true, + appliedSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, + runningAfterLogin: undefined, + expectedLaunchHandlerCalls: 0 }, { - name: "Updating with normal reference to settingsHandler block, and 'undefined' value stored in snapshot on update", - activeSessions: gpii.tests.lifecycleManager.sampleActiveSession, - startPayload: gpii.tests.lifecycleManager.startPayload, - updateSpec: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "undefSetting": "some value" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - expectedAppliedSolutions: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "red", "undefSetting": "some value" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "settings.myconf" ] }), - expectedOriginalSettings: { - "org.gnome.desktop.a11y.magnifier": { - "active": true, + name: "running on login - 'update' with reference to 'configure' block", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { + "update": [ + "configure" + ] + } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: true, + appliedSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, + runningAfterLogin: undefined, + expectedLaunchHandlerCalls: 0 + }, { + name: "running on login - 'update' with reference to 'stop', 'configure' and 'start' blocks", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { + "update": [ + "stop", + "configure", + "start" + ] + } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: true, + appliedSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, + runningAfterLogin: true, + expectedLaunchHandlerCalls: 4 // we run start/stop cycle both on login and logout + }, { + name: "running on login - with active: false", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { + "active": false + } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: true, + appliedSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, + runningAfterLogin: false, + expectedLaunchHandlerCalls: 2 + }, { + name: "running on login - with active: undefined", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + { + "active": undefined, "configure": [ "settings.myconf" ], "restore": [ "settings.myconf" ], - "settingsHandlers": { - "myconf": { - "options": {}, - "settings": { - "cross-hairs-clip": false, - "cross-hairs-color": "red", - "undefSetting": undefined - }, - "type": "gpii.tests.lifecycleManager.mockSettingsHandler" - } - }, "start": [ - { - "args": [ - "-settingsDirectory", - "${{environment}.WINDIR}" - ], - "command": "${{environment}.JAWS_DIR}jaws.exe", - "name": "exec", - "type": "gpii.tests.lifecycleManager.mockExecHandler" - } + "settings.launcher" ], "stop": [ - { - "pid": "${{exec}.pid}", - "type": "gpii.tests.lifecycleManager.mockKillHandler" - } + "settings.launcher" + ], + "isRunning": [ + "settings.launcher" ], "update": [ - "settings.myconf" + "stop", + "configure", + "start" ] } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: true, + appliedSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, + runningAfterLogin: true, + expectedLaunchHandlerCalls: 4 // we run start/stop cycle both on login and logout + }]; + + + gpii.tests.lifecycleManager.updateTestDefs = [{ + name: "Updating with the same prefs and values as already applied", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "settings.myconf" ] } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: false, + loginSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, + runningAfterLogin: true, + updateSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, + runningAfterUpdate: true, + expectedSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, + expectedLaunchHandlerCalls: 2 + }, { + name: "single pref changed without 'update' directive in solution registry entry", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: false, + loginSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, + runningAfterLogin: true, + updateSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, // dont expect these to apply + runningAfterUpdate: true, + expectedSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, + expectedLaunchHandlerCalls: 2 + }, { + name: "Updating with normal reference to settingsHandler block, single settings", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "settings.myconf" ] } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: false, + loginSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, + runningAfterLogin: true, + updateSettings: { "cross-hairs-color": "green" }, + runningAfterUpdate: true, + expectedSettings: { "cross-hairs-clip": true, "cross-hairs-color": "green" }, + expectedLaunchHandlerCalls: 2 + }, { + name: "Updating with normal reference to settingsHandler block, multiple settings", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "settings.myconf" ] } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: false, + loginSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, + runningAfterLogin: true, + updateSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, + runningAfterUpdate: true, + expectedSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, + expectedLaunchHandlerCalls: 2 + }, { + name: "Updating with reference to 'configure' directive, single settings", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: false, + loginSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, + runningAfterLogin: true, + updateSettings: { "cross-hairs-color": "green" }, + runningAfterUpdate: true, + expectedSettings: { "cross-hairs-clip": true, "cross-hairs-color": "green" }, + expectedLaunchHandlerCalls: 2 + }, { + name: "Updating with normal reference to settingsHandler block, and a setting not in the original settings applied to the system", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "settings.myconf" ] } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: false, + loginSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, + runningAfterLogin: true, + updateSettings: { "cross-hairs-color": "green", "iamasetting": 100 }, + runningAfterUpdate: true, + expectedSettings: { "cross-hairs-clip": true, "cross-hairs-color": "green", "iamasetting": 100 }, + originalSettingsAfterUpdate: { "cross-hairs-clip": false, "cross-hairs-color": "red", "iamasetting": undefined }, + expectedLaunchHandlerCalls: 2 + }]; + + + + gpii.tests.lifecycleManager.completeLifecycleTests = [{ + name: "Updating with normal reference to settingsHandler block, and a an application not in the original settings applied to the system", + expect: 9, + expectedLaunchHandlerCalls: 2, + runningOnLogin: false, + originalSettings: { + "org.gnome.desktop.a11y.magnifier": [{ options: {}, settings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }}] + }, + loginPayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] }, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "red" })), + expectedOriginal: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] }, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false, "cross-hairs-color": "red" }, false)), + expectedAfterLogin: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] }, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "red" }, true)), + runningAfterLogin: true, + updatePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions("other.application", + gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "mysetting": "Hallow World" }), + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] }), + expectedAfterUpdate: fluid.extend(true, {}, + gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "red" }, true), + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] }), + gpii.tests.lifecycleManager.buildLifecycleInstructions("other.application", + gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "mysetting": "Hallow World" }), + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] })), + expectedOriginalSettingsAfterUpdate: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false, "cross-hairs-color": "red" }, false), + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] }), + originalSettingsAfterUpdate: { + "other.application": [{ + "options": {}, + "settings": { + "mysetting": undefined + } + } + ] + }, + runningAfterUpdate: true + }, { + name: "Updating with normal reference to settingsHandler block, and 'undefined' value stored in snapshot", + expect: 9, + expectedLaunchHandlerCalls: 2, + runningOnLogin: false, + originalSettings: { + "org.gnome.desktop.a11y.magnifier": [{ options: {}, settings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }}] + }, + loginPayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] }, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true })), + expectedOriginal: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] }, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false }, false)), + expectedAfterLogin: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] }, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true }, true)), + runningAfterLogin: true, + updatePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "undefSetting": "some other value" }), + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] }), + expectedAfterUpdate: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "undefSetting": "some other value" }, true), + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] }), + expectedOriginalSettingsAfterUpdate: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": false, "undefSetting": undefined }, false), + gpii.tests.lifecycleManager.standardLifecycle, + { "update": [ "configure" ] }), + originalSettingsAfterUpdate: gpii.tests.lifecycleManager.createSettingsHandlerPayload("org.gnome.desktop.a11y.magnifier", { "cross-hairs-clip": false, "undefSetting": undefined }), + runningAfterUpdate: true + }]; + + gpii.tests.lifecycleManager.checkFinalSettingsPayload = function (msg, expSettings, store) { + var expectedLastSettings; + if (expSettings === undefined) { + expectedLastSettings = expSettings; + } else { + // change to the format that is stoed by the mock settingshandler: + expectedLastSettings = { + "org.gnome.desktop.a11y.magnifier": [ + { + "options": {}, + "settings": expSettings + } + ] + }; } - }]); + jqUnit.assertDeepEq(msg, expectedLastSettings, store); + }; - gpii.tests.lifecycleManager.buildUpdateTests = function () { - fluid.each(gpii.tests.lifecycleManager.updateTestDefs, function (test) { - jqUnit.asyncTest("gpii.lifecycleManager.update() with active user session: " + test.name, function () { - gpii.tests.lifecycleManager.setup(); - jqUnit.expect(6); + /** + * expects an input with the following: + * name: name of the test + * expect: number of tests to expect + * expectedLaunchHandlerCalls: number of luanch handler calls to expect (incl. logout) + * originalSettings: the original settings to apply to the system (ie. before login) + * runningOnLogin: boolean - if the magnifier should be running before login + * loginPayload: payload to send to the start() function + * expectedOriginal: the expected "originalSettings" of the session after login + * expectedAfterLogin: the expected "appliedSolutions" of the session after login + * runningAfterLogin: boolean - if the magnifier should be running after login + * --- The below keys are optional and will trigger an update cycle if present. --- + * updatePayload: payload to send to the update() function + * expectedAfterUpdate: the expected "appliedSOlutions" of the session after update call + * expectedOriginalSettingsAfterUpdate: the original after a call to update() has been done, + * originalSettingsAfterUpdate: the settings that the system should reset to (ie. last call to settingsHandler) + * runningAfterUpdate: boolean - if the magnifier should be running after update + */ + gpii.tests.lifecycleManager.runLifecycleTest = function (testDef) { + var originalRunSetting = testDef.expectedLaunchHandlerCalls === 0 ? undefined : testDef.runningOnLogin; + jqUnit.asyncTest(testDef.name, function () { + gpii.tests.lifecycleManager.setup(); + jqUnit.expect(testDef.expect); - var lifecycleManager = gpii.lifecycleManager(gpii.tests.lifecycleManager.testOptions); - gpii.tests.lifecycleManager.initBackingMock(); + var lifecycleManager = gpii.lifecycleManager(gpii.tests.lifecycleManager.testOptions); + gpii.tests.lifecycleManager.initBackingMock(testDef.originalSettings, testDef.runningOnLogin); - lifecycleManager.start(test.startPayload, function (success) { - jqUnit.assertTrue("gpii.lifecycleManager.start() succeeds", success); - var updatePayload = fluid.extend(true, {}, test.startPayload, { - lifecycleInstructions: test.updateSpec - }); - gpii.tests.lifecycleManager.assertExpectedExec(); - var expectedFirstAppliedSettings = (test.expectedFirstAppliedSettings !== undefined) ? test.expectedFirstAppliedSettings : gpii.tests.lifecycleManager.settingsHandlerExpectedInputNewSettings; - gpii.tests.lifecycleManager.assertExpectedSettingsHandler(" - on start", expectedFirstAppliedSettings); - - lifecycleManager.update(updatePayload, function () { - var session = lifecycleManager.getSession(test.startPayload.userToken); - var appliedSolutions = session.model.appliedSolutions; - var originalSettings = session.model.originalSettings; - jqUnit.assertDeepEq("Checking appliedSolutions after update", test.expectedAppliedSolutions, appliedSolutions); - var expected = gpii.lifecycleManager.transformAllSolutionSettings(test.expectedOriginalSettings, gpii.settingsHandlers.settingsToChanges); + lifecycleManager.start(gpii.tests.lifecycleManager.buildStartPayload(testDef.loginPayload), function (success) { + jqUnit.assertTrue("gpii.lifecycleManager.start() succeeds", success); + var session = lifecycleManager.getSession(123); // always just use the default user token + jqUnit.assertDeepEq("Checking appliedSolutions after start", testDef.expectedAfterLogin, session.model.appliedSolutions); + + var originalSettings = session.model.originalSettings; + jqUnit.assertDeepEq("Checking originalSettings after start", gpii.lifecycleManager.transformAllSolutionSettings(testDef.expectedOriginal, gpii.settingsHandlers.settingsToChanges), originalSettings); + + var stopCycle = function () { + jqUnit.assertDeepEq("Session not running after stop", lifecycleManager.getSession(123)); + jqUnit.assertEquals("Number of calls to launch handler", testDef.expectedLaunchHandlerCalls, gpii.tests.lifecycleManager.staticRepository.launchHandlerCalls) + // Check that last calls to launch and settings handlers were actually the ones resetting to expected state + jqUnit.assertDeepEq("checking last payload sent to settingshandler:", testDef.originalSettingsAfterUpdate || testDef.originalSettings, gpii.tests.lifecycleManager.staticRepository.settingsHandler); + + // Check that last calls to launch and settings handlers were actually the ones resetting to expected state + gpii.tests.lifecycleManager.checkFinalSettingsPayload("checking last set launch settings", (originalRunSetting === undefined) ? undefined : { running: originalRunSetting }, gpii.tests.lifecycleManager.staticRepository.launchHandler); + jqUnit.start(); + } + + if (testDef.updatePayload) { + lifecycleManager.update(gpii.tests.lifecycleManager.buildStartPayload(testDef.updatePayload), function () { + jqUnit.assertDeepEq("Checking appliedSolutions after update", testDef.expectedAfterUpdate, session.model.appliedSolutions); + var expected = gpii.lifecycleManager.transformAllSolutionSettings(testDef.expectedOriginalSettingsAfterUpdate, gpii.settingsHandlers.settingsToChanges); jqUnit.assertDeepEq("Checking originalSettings after update", expected, originalSettings); - lifecycleManager.stop(gpii.tests.lifecycleManager.userOptions, function () { - jqUnit.assertDeepEq("Session not running after stop", lifecycleManager.getSession(test.startPayload.userToken)); - jqUnit.start(); - }); + lifecycleManager.stop(gpii.tests.lifecycleManager.userOptions, stopCycle); }); - }); + } else { + lifecycleManager.stop(gpii.tests.lifecycleManager.userOptions, stopCycle); + } }); }); }; - gpii.tests.lifecycleManager.isRunningTests = function () { - jqUnit.asyncTest("Tests for correct behavior when application is not already running", function () { - // call start block for solution - gpii.tests.lifecycleManager.setup(); - // 2 tests for the settingsHandler (see mockSettingsHandler function above) - // 2 tests for the launchHandler (see mockLaunchHandler function above) - // and the two asserts below - jqUnit.expect(1); - var lifecycleManager = gpii.lifecycleManager(gpii.tests.lifecycleManager.testOptions); - gpii.tests.lifecycleManager.initBackingMock(); + gpii.tests.lifecycleManager.buildUpdateTests = function () { + fluid.each(gpii.tests.lifecycleManager.updateTestDefs, function (test) { + var expectedOriginal = gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.originalSettings, test.runningOnLogin)); + var loginPayload = gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.loginSettings)); + var expectedAfterLogin = gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.loginSettings, test.runningAfterLogin)); + var updatePayload = gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.updateSettings)); + var expectedAfterUpdate = gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.expectedSettings, test.runningAfterUpdate)); + var originalRunSetting = test.expectedLaunchHandlerCalls === 0 ? undefined : test.runningOnLogin; + + var originalSettingsAfterUpdate = test.originalSettingsAfterUpdate || test.originalSettings; + var expectedOriginalSettingsAfterUpdate = gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry(originalSettingsAfterUpdate, test.runningOnLogin)); + + var testDef = { + name: "gpii.lifecycleManager.update() with active user session: " + test.name, + expect: 9, + expectedLaunchHandlerCalls: test.expectedLaunchHandlerCalls, + originalSettings: gpii.tests.lifecycleManager.createSettingsHandlerPayload("org.gnome.desktop.a11y.magnifier", test.originalSettings), + runningOnLogin: test.runningOnLogin, + loginPayload: loginPayload, + expectedOriginal: expectedOriginal, + expectedAfterLogin: expectedAfterLogin, + runningAfterLogin: test.runningAfterLogin, + updatePayload: updatePayload, + expectedAfterUpdate: expectedAfterUpdate, + expectedOriginalSettingsAfterUpdate: expectedOriginalSettingsAfterUpdate, + runningAfterUpdate: test.runningAfterUpdate, + originalSettingsAfterUpdate: gpii.tests.lifecycleManager.createSettingsHandlerPayload("org.gnome.desktop.a11y.magnifier", originalSettingsAfterUpdate) + } - lifecycleManager.start(gpii.tests.lifecycleManager.startPayload, function () { - gpii.tests.lifecycleManager.assertExpectedExec(); - // gpii.tests.lifecycleManager.assertExpectedSettingsHandler(" - on start", gpii.tests.lifecycleManager.settingsHandlerExpectedInputNewSettings); - // lifecycleManager.stop(gpii.tests.lifecycleManager.userOptions, function () { - // gpii.tests.lifecycleManager.assertExpectedSettingsHandler(" - on stop", gpii.tests.lifecycleManager.settingsHandlerExpectedInputRestoreSettings); - // jqUnit.assertEquals("Expected pid has been sent to kill handler", - // 8839, gpii.tests.lifecycleManager.staticRepository.killHandler.pid); - // gpii.tests.lifecycleManager.assertNoActiveSessions(lifecycleManager, "stop: Stop message to lifecycle manager"); - // jqUnit.start(); - // }); - jqUnit.start(); - }); + gpii.tests.lifecycleManager.runLifecycleTest(testDef); + }); + }; - // expect the isRunning block to be called (will return false) - // do NOT expect the 'update' block to be called - // DO expect the 'start' block to be called - // the correct state should be stored - // the correct state should be applied - // on logout DO expect the 'stop' block to be called - // the correct state should be restored - - // TEST: Running on startup - no reference to start/stop block in update - // call start block for solution - // get for isRunning block should be called (will return true) - // Expect the update block to be called - // do NOT expect the start block to be called - // The correct state should be stored - // The correct state should be applied - // on logout, update should be called - // do NOT expect the stop block to be called - // - - - // TEST: Running on startup + gpii.tests.lifecycleManager.buildStartTests = function () { + fluid.each(gpii.tests.lifecycleManager.startTestDefs, function (test) { + var testDef = { + name: "gpii.lifecycleManager.start()/stop(): " + test.name, + expect: 7, + expectedLaunchHandlerCalls: test.expectedLaunchHandlerCalls, + runningOnLogin: test.runningOnLogin, + originalSettings: gpii.tests.lifecycleManager.createSettingsHandlerPayload("org.gnome.desktop.a11y.magnifier", test.originalSettings), + loginPayload: gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.appliedSettings)), + expectedAfterLogin: gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.appliedSettings, test.runningAfterLogin)), + runningAfterLogin: test.runningAfterLogin, + // only expect launch handler settings to be in the original snapshot if we've run a launchHandler call during login + expectedOriginal: gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, + gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.originalSettings, test.expectedLaunchHandlerCalls === 0 ? undefined : test.runningOnLogin)) + }; + + gpii.tests.lifecycleManager.runLifecycleTest(testDef); }); }; @@ -733,7 +1032,6 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt jqUnit.module("Lifecycle Manager", function () { gpii.tests.staticRepository = {}; }); - gpii.tests.lifecycleManager.isRunningTests(); jqUnit.test("gpii.lifecycleManager.specToSettingsHandler()", function () { fluid.each(gpii.tests.lifecycleManager.specToSettingsHandlerTests, function (spec, name) { @@ -771,48 +1069,24 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt }); }); - jqUnit.asyncTest("gpii.lifecycleManager.start() and stop()", function () { - gpii.tests.lifecycleManager.setup(); - // 2 tests for the settingsHandler (see mockSettingsHandler function above) - // 2 tests for the launchHandler (see mockLaunchHandler function above) - // and the two asserts below - jqUnit.expect(5); - var lifecycleManager = gpii.lifecycleManager(gpii.tests.lifecycleManager.testOptions); + jqUnit.asyncTest("gpii.lifecycleManager.invokeSettingsHandlerGet()", function () { + jqUnit.expect(1); + var lifecycleManager = gpii.lifecycleManager(); gpii.tests.lifecycleManager.initBackingMock(); - - lifecycleManager.start(gpii.tests.lifecycleManager.startPayload, function () { - gpii.tests.lifecycleManager.assertExpectedExec(); - gpii.tests.lifecycleManager.assertExpectedSettingsHandler(" - on start", gpii.tests.lifecycleManager.settingsHandlerExpectedInputNewSettings); - lifecycleManager.stop(gpii.tests.lifecycleManager.userOptions, function () { - gpii.tests.lifecycleManager.assertExpectedSettingsHandler(" - on stop", gpii.tests.lifecycleManager.settingsHandlerExpectedInputRestoreSettings); - jqUnit.assertEquals("Expected pid has been sent to kill handler", - 8839, gpii.tests.lifecycleManager.staticRepository.killHandler.pid); - gpii.tests.lifecycleManager.assertNoActiveSessions(lifecycleManager, "stop: Stop message to lifecycle manager"); - jqUnit.start(); - }); - }); - }); - - // tests for active: false and active: undefined. - // active: true is tested in all the other tests - var activeValues = [ false, undefined ]; - fluid.each(activeValues, function (active) { - jqUnit.asyncTest("gpii.lifecycleManager.start() with active: " + (active === undefined ? "undefined" : active), function () { - //reset the exec values - gpii.tests.lifecycleManager.setup(); - - jqUnit.expect(2); - var lifecycleManager = gpii.lifecycleManager(gpii.tests.lifecycleManager.testOptions); - gpii.tests.lifecycleManager.initBackingMock(); - - // set up payload with active false - var activeFalsePayload = fluid.copy(gpii.tests.lifecycleManager.startPayload); - fluid.set(activeFalsePayload, [ "lifecycleInstructions", "org.gnome.desktop.a11y.magnifier", "active" ], active); - lifecycleManager.start(activeFalsePayload, function () { - gpii.tests.lifecycleManager.assertExpectedSettingsHandler(" - on start", gpii.tests.lifecycleManager.settingsHandlerExpectedInputNewSettings); - gpii.tests.lifecycleManager.assertNoExec(); - jqUnit.start(); - }); + var snapshotPromise = lifecycleManager.invokeSettingsHandlerGet("org.gnome.desktop.a11y.magnifier", gpii.tests.lifecycleManager.invokeSettingsHandlersRequest); + var expected = { + "org.gnome.desktop.a11y.magnifier": [ + { + "settings": { + "cross-hairs-clip": false, + "cross-hairs-color": "red" + } + } + ] + }; + snapshotPromise.then(function (snapshot) { + jqUnit.assertDeepEq("invokeSettingsHandlerGet produced snapshot", expected, snapshot); + jqUnit.start(); }); }); @@ -824,6 +1098,10 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt }); gpii.tests.lifecycleManager.buildUpdateTests(); + gpii.tests.lifecycleManager.buildStartTests(); + fluid.each(gpii.tests.lifecycleManager.completeLifecycleTests, function (testDef) { + gpii.tests.lifecycleManager.runLifecycleTest(testDef); + }) jqUnit.asyncTest("gpii.lifecycleManager.update() tests for 'stop' reference", function () { // initial payload: diff --git a/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js b/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js index c9c4cf0d1..8b0cf7800 100644 --- a/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js +++ b/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js @@ -89,10 +89,14 @@ gpii.settingsHandlers.transformPayload = function (payload, handler) { gpii.settingsHandlers.transformOneSolutionSettings = function (oneSolution, handler, path) { path = path || []; var togo = fluid.censorKeys(oneSolution, "settings"); - togo.settings = fluid.transform(oneSolution.settings, function (oneSetting, settingKey) { + var newSettings = fluid.transform(oneSolution.settings, function (oneSetting, settingKey) { var innerPath = path.concat(["settings", settingKey]); return handler(oneSetting, innerPath, oneSolution); }); + if (newSettings !== undefined) { // ignore undefined settings blocks + togo.settings = newSettings; + } + return togo; }; @@ -109,7 +113,6 @@ gpii.settingsHandlers.transformPayloadSettings = function (payload, handler) { /** Extract just the settings (eliminating "options") from the nested settingsHandler blocks for a full payload (top-level keys are solution ids) * - this is used from gpii.settingsHandlers.comparePayloads and gpii.test.checkConfiguration */ - gpii.settingsHandlers.extractSettingsBlocks = function (payload) { return gpii.settingsHandlers.transformPayload(payload, function (oneSolution) { return fluid.filterKeys(oneSolution, "settings"); From 17992aeaf1e55392424fe56a6f63fc8c1a1b127f Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Thu, 6 Apr 2017 12:49:14 +0200 Subject: [PATCH 13/44] GPII-1230: Added integration tests for closing conflicting solutions --- .../src/CanopyMatchMakerUtilities.js | 2 +- .../test/CanopyMatchMakerTests.js | 67 ++++- .../lifecycleManager/src/LifecycleManager.js | 37 +-- .../test/js/LifecycleManagerTests.js | 51 ++-- .../src/MatchMakerUtilities.js | 14 +- .../test/js/CanopyMatchMakerTests.js | 191 ------------- ...hMakerUtilitiesDisposeFromPriorityTests.js | 10 +- .../test/js/MatchMakerUtilitiesTests.js | 6 +- gpii/node_modules/testing/src/Testing.js | 24 +- tests/CloseConflictingAppsTests.js | 266 ++++++++++++++++++ tests/JournalIntegrationTests.js | 28 +- .../gpii.tests.multiScreenreader.config.json | 18 ++ .../gpii.tests.multiScreenreader.config.txt | 4 + .../data/multiScreenreaderDeviceReporter.json | 9 + ...sts.acceptance.windows.builtIn.config.json | 2 +- 15 files changed, 458 insertions(+), 271 deletions(-) delete mode 100644 gpii/node_modules/matchMakerFramework/test/js/CanopyMatchMakerTests.js create mode 100644 tests/CloseConflictingAppsTests.js create mode 100644 tests/configs/gpii.tests.multiScreenreader.config.json create mode 100644 tests/configs/gpii.tests.multiScreenreader.config.txt create mode 100644 tests/data/multiScreenreaderDeviceReporter.json diff --git a/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js b/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js index e773b3468..349b1c69b 100644 --- a/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js +++ b/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js @@ -103,7 +103,7 @@ gpii.canopyMatchMaker.utils.disposeFromCanopy = function (leaves, ranked, solrec for (var i = 0; i < ranked.length; ++i) { var sol = solrecs[ranked[i]]; - if (sol.disposition === "reject") { + if (sol.disposition === "reject" || sol.disposition === "deactivate") { continue; } diff --git a/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js b/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js index 36fb41680..a80c86c07 100644 --- a/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js +++ b/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js @@ -94,7 +94,7 @@ var matchFixtures = [ } } }, { - description: "Two magnifier preferences->best fit is launched", + description: "Two magnifier preferences->best fit is launched, the other one should not run", input: require("./data/full_mm_payload2.json"), preferences: { "gpii-default": { @@ -115,6 +115,13 @@ var matchFixtures = [ "http://registry.gpii.net/common/magnification": 150, "http://registry.gpii.net/common/invertColours": true } + }, + "fakemag1": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150, + "http://registry.gpii.net/common/invertColours": true + } } } } @@ -140,6 +147,12 @@ var matchFixtures = [ "settings": { "http://registry.gpii.net/common/magnification": 150 } + }, + "fakemag2": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150 + } } } } @@ -174,6 +187,13 @@ var matchFixtures = [ "http://registry.gpii.net/common/magnification": 150, "http://registry.gpii.net/common/pitch": 0.8 } + }, + "fakemag2": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150, + "http://registry.gpii.net/common/pitch": 0.8 + } } } } @@ -207,6 +227,12 @@ var matchFixtures = [ "settings": { "http://registry.gpii.net/common/magnification": 150 } + }, + "fakemag1": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150 + } } } } @@ -245,6 +271,12 @@ var matchFixtures = [ "settings": { "http://registry.gpii.net/common/magnification": 150 } + }, + "fakemag1": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150 + } } } } @@ -284,6 +316,12 @@ var matchFixtures = [ "settings": { "http://registry.gpii.net/common/magnification": 150 } + }, + "fakemag2": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150 + } } } } @@ -325,6 +363,13 @@ var matchFixtures = [ "http://registry.gpii.net/common/magnification": 150, "http://registry.gpii.net/common/invertColours": true } + }, + "fakemag1": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150, + "http://registry.gpii.net/common/invertColours": true + } } } } @@ -350,6 +395,12 @@ var matchFixtures = [ "settings": { "http://registry.gpii.net/applications/fakemag2": {} } + }, + "fakemag1": { + "active": false, + "settings": { + "http://registry.gpii.net/applications/fakemag2": {} + } } } } @@ -377,6 +428,13 @@ var matchFixtures = [ "http://registry.gpii.net/applications/fakemag2": {}, "http://registry.gpii.net/applications/fakemag1": {} } + }, + "fakemag2": { + "active": false, + "settings": { + "http://registry.gpii.net/applications/fakemag2": {}, + "http://registry.gpii.net/applications/fakemag1": {} + } } } } @@ -436,6 +494,13 @@ var matchFixtures = [ "http://registry.gpii.net/applications/fakemag2": {}, "http://registry.gpii.net/common/magnification": 150 } + }, + "fakemag2": { + "active": false, + "settings": { + "http://registry.gpii.net/applications/fakemag2": {}, + "http://registry.gpii.net/common/magnification": 150 + } } } } diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index 17c1f60f4..6b2d080ab 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -237,7 +237,7 @@ var gpii = fluid.registerNamespace("gpii"); /** Remove all the settings blocks from a solutions registry entry */ - gpii.settingsHandlers.removeSettingsBlocks = function (solutionEntry) { + gpii.lifecycleManager.removeSettingsBlocks = function (solutionEntry) { solutionEntry.settingsHandlers = fluid.transform(solutionEntry.settingsHandlers, function (handler) { return fluid.filterKeys(handler, "settings", true); }); @@ -249,14 +249,14 @@ var gpii = fluid.registerNamespace("gpii"); * with almost identical argument list. */ gpii.lifecycleManager.recordSnapshotInSession = function (that, snapshot, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction) { - var toSnapshot = gpii.settingsHandlers.removeSettingsBlocks(fluid.copy(solutionRecord)); - - // Disabled the removing of all settingshandlers blocks to ensure that we have them available when restoring the system. - // This is particularly relevant for launch handlers, where we will need to run the "get" directives on logout to decide - // whether we an application is running or not, and consequently, whether to run the "update" or "stop" block - // toSnapshot.settingsHandlers = {}; - toSnapshot.settingsHandlers[settingsHandlerBlockName] = snapshot; if (rootAction === "start" || rootAction === "update") { + var toSnapshot = gpii.lifecycleManager.removeSettingsBlocks(fluid.copy(solutionRecord)); + + // Disabled the removing of all settingshandlers blocks to ensure that we have them available when restoring the system. + // This is particularly relevant for launch handlers, where we will need to run the "get" directives on logout to decide + // whether we an application is running or not, and consequently, whether to run the "update" or "stop" block + // toSnapshot.settingsHandlers = {}; + toSnapshot.settingsHandlers[settingsHandlerBlockName] = snapshot; // keep the settings that are already stored from the // original snapshot, but augment it with any settings from the new snapshot // that were not present in the original snapshot. @@ -511,9 +511,9 @@ var gpii = fluid.registerNamespace("gpii"); var actions; if (currentRunState === true) { // if it's already running if (recordedRunState === false) { // and it was not running on start - actions = [ "stop", "restore" ] + actions = [ "stop", "restore" ]; } else { // else update it - actions = [ "update" ] + actions = [ "update" ]; } } else { // if it is not running if (recordedRunState === true) { // and it was running when we started @@ -530,24 +530,7 @@ var gpii = fluid.registerNamespace("gpii"); }); var sequence = fluid.promise.sequence(tasks); - - // var promises = fluid.transform(session.model.originalSettings, function (changesSolutionRecord, solutionId) { - // var solutionRecord = gpii.lifecycleManager.transformSolutionSettings(changesSolutionRecord, gpii.settingsHandlers.changesToSettings); - // // if a solution was running on login, run the update block to ensure that restored settings are applied - // var recordedState = gpii.lifecycleManager.getSolutionRunningStateFromSnapshot(solutionRecord); - // var currentState = that.getSolutionRunningState(solutionId, changesSolutionRecord, session); - // var actions; - // if (recordedState === undefined) { // if we didn't do anything to solution state before, dont do it now - // actions = [ "restore" ] - // } else if (recordedState === true) { // if originally running and we stopped it, updait was started when we logged in, ensure that it is still started - // = recordedState ? [ "update" ] : [ "stop", "restore" ]; - // } - // } - // return that.applySolution(solutionId, solutionRecord, session, actions, rootAction); - // }); - // // TODO: In theory we could stop all solutions in parallel - // var sequence = fluid.promise.sequence(fluid.values(promises)); return sequence; }; diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index c21603de5..1779ee41f 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -73,7 +73,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt } return togo; - } + }; gpii.tests.lifecycleManager.buildSettingsHandlersEntry = function (settings, setRunning) { var togo = { @@ -89,10 +89,10 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt } }; if (settings !== undefined) { - fluid.set(togo, [ "settingsHandlers", "myconf", "settings" ], settings) + fluid.set(togo, [ "settingsHandlers", "myconf", "settings" ], settings); } if (setRunning !== undefined) { - fluid.set(togo, [ "settingsHandlers", "launcher", "settings" ], { running: setRunning }) + fluid.set(togo, [ "settingsHandlers", "launcher", "settings" ], { running: setRunning }); } return togo; }; @@ -371,7 +371,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt gpii.tests.lifecycleManager.settingsHandlerOriginalSystemSettings : origSettings; - var setRunning = (setRunning === undefined) ? false : setRunning; // default to false + setRunning = (setRunning === undefined) ? false : setRunning; // default to false var launchSettings = gpii.tests.lifecycleManager.launchHandlerOriginalSystemSettingsRunning(setRunning); // initialise the mock with the initial settings expected at the end of the test gpii.tests.lifecycleManager.backingMockSettingsHandler.set(settings); @@ -414,7 +414,6 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt } }; - gpii.tests.lifecycleManager.createSettingsHandlerPayload = function (solutionId, settings) { if (settings === undefined) { return undefined; @@ -428,7 +427,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt ]; return togo; } - } + }; // TODO KASPER: Remove this and all references (probably) gpii.tests.lifecycleManager.assertExpectedExec = function () { @@ -476,7 +475,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt "running": setRunning } }] - } + }; }; gpii.tests.lifecycleManager.settingsHandlerExpectedInputNewSettings = { @@ -830,13 +829,12 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt gpii.tests.lifecycleManager.standardLifecycle, { "update": [ "configure" ] }), originalSettingsAfterUpdate: { - "other.application": [{ - "options": {}, - "settings": { - "mysetting": undefined - } - } - ] + "other.application": [{ + "options": {}, + "settings": { + "mysetting": undefined + } + }] }, runningAfterUpdate: true }, { @@ -888,7 +886,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt } else { // change to the format that is stoed by the mock settingshandler: expectedLastSettings = { - "org.gnome.desktop.a11y.magnifier": [ + "org.gnome.desktop.a11y.magnifier": [ { "options": {}, "settings": expSettings @@ -936,14 +934,14 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt var stopCycle = function () { jqUnit.assertDeepEq("Session not running after stop", lifecycleManager.getSession(123)); - jqUnit.assertEquals("Number of calls to launch handler", testDef.expectedLaunchHandlerCalls, gpii.tests.lifecycleManager.staticRepository.launchHandlerCalls) + jqUnit.assertEquals("Number of calls to launch handler", testDef.expectedLaunchHandlerCalls, gpii.tests.lifecycleManager.staticRepository.launchHandlerCalls); // Check that last calls to launch and settings handlers were actually the ones resetting to expected state jqUnit.assertDeepEq("checking last payload sent to settingshandler:", testDef.originalSettingsAfterUpdate || testDef.originalSettings, gpii.tests.lifecycleManager.staticRepository.settingsHandler); // Check that last calls to launch and settings handlers were actually the ones resetting to expected state gpii.tests.lifecycleManager.checkFinalSettingsPayload("checking last set launch settings", (originalRunSetting === undefined) ? undefined : { running: originalRunSetting }, gpii.tests.lifecycleManager.staticRepository.launchHandler); jqUnit.start(); - } + }; if (testDef.updatePayload) { lifecycleManager.update(gpii.tests.lifecycleManager.buildStartPayload(testDef.updatePayload), function () { @@ -971,7 +969,6 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.updateSettings)); var expectedAfterUpdate = gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.expectedSettings, test.runningAfterUpdate)); - var originalRunSetting = test.expectedLaunchHandlerCalls === 0 ? undefined : test.runningOnLogin; var originalSettingsAfterUpdate = test.originalSettingsAfterUpdate || test.originalSettings; var expectedOriginalSettingsAfterUpdate = gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, @@ -992,7 +989,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt expectedOriginalSettingsAfterUpdate: expectedOriginalSettingsAfterUpdate, runningAfterUpdate: test.runningAfterUpdate, originalSettingsAfterUpdate: gpii.tests.lifecycleManager.createSettingsHandlerPayload("org.gnome.desktop.a11y.magnifier", originalSettingsAfterUpdate) - } + }; gpii.tests.lifecycleManager.runLifecycleTest(testDef); }); @@ -1075,14 +1072,12 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt gpii.tests.lifecycleManager.initBackingMock(); var snapshotPromise = lifecycleManager.invokeSettingsHandlerGet("org.gnome.desktop.a11y.magnifier", gpii.tests.lifecycleManager.invokeSettingsHandlersRequest); var expected = { - "org.gnome.desktop.a11y.magnifier": [ - { - "settings": { - "cross-hairs-clip": false, - "cross-hairs-color": "red" - } - } - ] + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "cross-hairs-clip": false, + "cross-hairs-color": "red" + } + }] }; snapshotPromise.then(function (snapshot) { jqUnit.assertDeepEq("invokeSettingsHandlerGet produced snapshot", expected, snapshot); @@ -1101,7 +1096,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt gpii.tests.lifecycleManager.buildStartTests(); fluid.each(gpii.tests.lifecycleManager.completeLifecycleTests, function (testDef) { gpii.tests.lifecycleManager.runLifecycleTest(testDef); - }) + }); jqUnit.asyncTest("gpii.lifecycleManager.update() tests for 'stop' reference", function () { // initial payload: diff --git a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js index 38f8ac4ad..6976e8ebc 100644 --- a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js +++ b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js @@ -189,10 +189,10 @@ var fluid = fluid || require("infusion"), var leaves = gpii.matchMakerFramework.utils.computeLeaves(context.preferences); var disposed = strategy(leaves, tmpSolrecs, data, ontologyMetadata); - togo[contextId] = []; + togo[contextId] = {}; fluid.each(disposed, function (solrec, solid) { - if (solrec.disposition === "accept") { - togo[contextId].push(solid); + if (solrec.disposition === "accept" || solrec.disposition === "deactivate") { + togo[contextId][solid] = (solrec.disposition === "accept"); // true if it should be running } }); }); @@ -327,8 +327,8 @@ var fluid = fluid || require("infusion"), for (var solutionId in solutionTypeMapping[type]) { var sol = solrecs[solutionId]; if (!sol.disposition) { - sol.disposition = "reject"; - sol.dispositionReason = disposeReason || "Solution rejected due to its type of " + type; + sol.disposition = "deactivate"; + sol.dispositionReason = disposeReason || "Solution rejected (deactivated) due to its type of " + type; } } }); @@ -394,9 +394,9 @@ var fluid = fluid || require("infusion"), applications: {} }; var appBlock = togo.inferredConfiguration[contextId].applications; - fluid.each(solArray, function (solutionId) { + fluid.each(solArray, function (active, solutionId) { var content = { - active: true, + active: active, settings: fullModel.preferences.contexts[contextId].preferences }; appBlock[solutionId] = content; diff --git a/gpii/node_modules/matchMakerFramework/test/js/CanopyMatchMakerTests.js b/gpii/node_modules/matchMakerFramework/test/js/CanopyMatchMakerTests.js deleted file mode 100644 index 179323e50..000000000 --- a/gpii/node_modules/matchMakerFramework/test/js/CanopyMatchMakerTests.js +++ /dev/null @@ -1,191 +0,0 @@ -/* - * GPII Canopy MatchMaker Tests - * - * Copyright 2012 OCAD University - * Copyright 2012 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 - */ - -/* global jqUnit, fluid */ - -var gpii = fluid.registerNamespace("gpii"); - -(function () { - "use strict"; - - fluid.registerNamespace("gpii.tests.canopyMatchMaker"); - - var magnifier = { - "settingsHandlers": { - "myconf": { - "type": "gpii.integrationTesting.mockSettingsHandler", - "capabilities": ["display.screenEnhancement"], - "capabilitiesTransformations": { - "mag-factor": "display.screenEnhancement.magnification", - "show-cross-hairs": "display.screenEnhancement.-provisional-showCrosshairs", - "mouse-tracking": { - "transform": { - "type": "fluid.transforms.valueMapper", - "defaultInputPath": "display.screenEnhancement.tracking", - "match": { - "mouse": "centered" - } - } - } - } - } - } - }; - - var lesserMagnifier = { - "settingsHandlers": { - "myconf": { - "type": "gpii.integrationTesting.mockSettingsHandler", - "capabilitiesTransformations": { - "mag-factor": "display.screenEnhancement.magnification" - } - }, - "yourconf": { - "type": "gpii.integrationTesting.mockSettingsHandler", - "capabilities": "display.screenEnhancement.magnification" - } - } - }; - - var magnifierLeaves = [ - "display.screenEnhancement.magnification", - "display.screenEnhancement.-provisional-showCrosshairs", - "display.screenEnhancement.tracking", - "display.screenEnhancement" - ]; - - var magnifierSkeleton = { - display: { - screenEnhancement: { - magnification: {}, - "-provisional-showCrosshairs": {}, - tracking: {} - } - } - }; - - var escapedLeaves = [ - "display.screenReader.applications.nvda\\.screenReader" - ]; - - var escapedSkeleton = { - display: { - screenReader: { - applications: { - "nvda.screenReader": {} - } - } - } - }; - - var sammyProfile = { - "display": { - "screenEnhancement": { - "fontSize": 24, - "foregroundColor": "white", - "backgroundColor": "black", - "fontFace": { - "fontName": ["Comic Sans"], - "genericFontFace": "sans serif" - }, - "magnification": 2.0, - "tracking": ["mouse"], - "invertImages": true, - "-provisional-showCrosshairs": true - } - } - }; - - var sammyLeaves = [ - "display.screenEnhancement.-provisional-showCrosshairs", - "display.screenEnhancement.backgroundColor", - "display.screenEnhancement.fontFace.fontName.0", - "display.screenEnhancement.fontFace.genericFontFace", - "display.screenEnhancement.fontSize", - "display.screenEnhancement.foregroundColor", - "display.screenEnhancement.invertImages", - "display.screenEnhancement.magnification", - "display.screenEnhancement.tracking.0" - ]; - - var expandFitness = function (fitnesses) { - return fluid.transform(fitnesses, function (fit, index) { - return { - fitness: fit, - index: index - }; - }); - }; - - var extractIndices = function (solns) { - return fluid.transform(solns, function (soln) { - return soln.index; - }); - }; - - gpii.tests.canopyMatchMaker.runTests = function () { - jqUnit.module("Utilities"); - - jqUnit.test("Path Utilities", function () { - jqUnit.assertEquals("Exact depth", 0, gpii.matchMakerFramework.utils.prefixLength("display.screenEnhancement.fontSize", sammyProfile)); - jqUnit.assertEquals("Near depth", 0, gpii.matchMakerFramework.utils.prefixLength("display.screenEnhancement.fontSize", sammyProfile)); - jqUnit.assertEquals("Mid depth", -1, gpii.matchMakerFramework.utils.prefixLength("display.unrecognizable", sammyProfile)); - jqUnit.assertEquals("Far depth", -2, gpii.matchMakerFramework.utils.prefixLength("display.unrecognizable.thing", sammyProfile)); - var skeleton = gpii.matchMakerFramework.utils.pathsToSkeleton(magnifierLeaves); - jqUnit.assertDeepEq("Computed model skeleton", magnifierSkeleton, skeleton); - - var skeleton2 = gpii.matchMakerFramework.utils.pathsToSkeleton(escapedLeaves); - jqUnit.assertDeepEq("Computed model escaped skeleton", escapedSkeleton, skeleton2); - }); - - jqUnit.test("Fitness computation", function () { - var fitness = gpii.matchMaker.canopy.computeFitness(sammyLeaves, magnifierSkeleton); - var expected = [0, 0, -1, -1, -1, -1, -1, -2, -3]; - jqUnit.assertDeepEq("Computed fitness vector", expected, fitness); - - var fitnesses = [ - [-1, -3, 0], - [0, 0, 0], - [0, 0], - [0, 0, 0, 0], - [-1, -3, -1] - ]; - var solns = gpii.matchMaker.canopy.sortSolutions(expandFitness(fitnesses)); - var indices = extractIndices(solns); - var expected2 = [3, 1, 2, 0, 4]; - jqUnit.assertDeepEq("Ranked fitnesses", expected2, indices); - }); - - jqUnit.module("MatchMaker"); - jqUnit.test("Rank and dispose solutions", function () { - var solutions = [lesserMagnifier, - magnifier - ]; - var expanded = gpii.matchMakerFramework.utils.expandSolutions(solutions, { "*": "*" }); - var ranked = gpii.matchMaker.canopy.rankSolutions(sammyLeaves, expanded); - var indices = extractIndices(ranked); - var expected = [1, 0]; - jqUnit.assertDeepEq("Ranked solutions", expected, indices); - - var disposed = gpii.matchMaker.canopy.disposeSolutionsImpl(sammyLeaves, ranked); - var itions = gpii.matchMakerFramework.utils.extractDispositions(disposed); - expected = ["reject", "accept"]; - jqUnit.assertDeepEq("Disposed solutions", expected, itions); - }); - }; - -})(); diff --git a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js index f088d22eb..4b704b3ad 100644 --- a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js +++ b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js @@ -98,11 +98,11 @@ var fluid = fluid || require("infusion"), var testData = [{ description: "Tie between highest priority, rest rejected", priorities: [2, 2, 1, 1, 1], - expectedDispositions: [undefined, undefined, "reject", "reject", "reject"] + expectedDispositions: [undefined, undefined, "deactivate", "deactivate", "deactivate"] }, { description: "Single highest priority wins, rest rejected", priorities: [2, 1, 1, 1, 1], - expectedDispositions: ["accept", "reject", "reject", "reject", "reject"] + expectedDispositions: ["accept", "deactivate", "deactivate", "deactivate", "deactivate"] }, { // description: "Only solution covering all required solution types selected", // priorities: [2, 1, 2, 1, 1], @@ -110,15 +110,15 @@ var fluid = fluid || require("infusion"), // }, { description: "Highest priority selected, solution type equivalents remove", priorities: [2, 1, 3, 1, 2], - expectedDispositions: ["reject", "reject", "accept", "reject", "accept"] + expectedDispositions: ["deactivate", "deactivate", "accept", "deactivate", "accept"] }, { description: "Tie between multiple solutions of different types", priorities: [2, 1, 2, 2, 2], - expectedDispositions: [undefined, "reject", undefined, undefined, undefined] + expectedDispositions: [undefined, "deactivate", undefined, undefined, undefined] }, { description: "Tie between multiple solutions of different types #2", priorities: [2, 1, 2, 1, 2], - expectedDispositions: [undefined, "reject", undefined, "reject", undefined] + expectedDispositions: [undefined, "deactivate", undefined, "deactivate", undefined] // }, { // description: "", // priorities: [1, null, 2, null, null], diff --git a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js index ed53b5ca7..c4c68cfdf 100644 --- a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js +++ b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js @@ -287,9 +287,9 @@ var fluid = fluid || require("infusion"), { description: "Basic payloads", disposed: { - "gpii-default": [ - "mac.dummy" - ] + "gpii-default": { + "mac.dummy": true + } }, fullModel: { "userToken": "mac", diff --git a/gpii/node_modules/testing/src/Testing.js b/gpii/node_modules/testing/src/Testing.js index 36b7a8651..7beb91481 100644 --- a/gpii/node_modules/testing/src/Testing.js +++ b/gpii/node_modules/testing/src/Testing.js @@ -212,6 +212,19 @@ gpii.test.checkRestoredConfiguration = function (settingsHandlers, settingsStore }); }; +gpii.test.checkRestoredInitialState = function (initialSettings, nameResolver, onComplete) { + if (initialSettings === undefined) { + jqUnit.assertTrue("No initial settings defined, so not checking", true); + onComplete(); + return; + } + var currentSettingsPromise = gpii.test.getSettings(initialSettings, nameResolver); + currentSettingsPromise.then(function (currentSettings) { + jqUnit.assertDeepEq("Checking that initital settings are also properly reset", gpii.test.extractSettingsBlocks(initialSettings), currentSettings); + onComplete(); + }); +}; + gpii.test.common.receiveVariableResolver = function (testCaseHolder, variableResolver) { testCaseHolder.variableResolver = variableResolver; }; @@ -258,7 +271,8 @@ fluid.defaults("gpii.test.common.testCaseHolder", { onInitialStateSet: null, onInitialStateConfirmed: null, onCheckConfigurationComplete: null, - onCheckRestoredConfigurationComplete: null + onCheckRestoredConfigurationComplete: null, + onCheckRestoredInitialStateComplete: null }, distributeOptions: { "common.testCaseHolder.variableResolver": { @@ -385,6 +399,12 @@ gpii.test.checkSequence = fluid.freezeRecursive([ }, { event: "{testCaseHolder}.events.onCheckRestoredConfigurationComplete", listener: "fluid.identity" + }, { // anything in the intial state should also be restored upon logout + func: "gpii.test.checkRestoredInitialState", + args: [ "{tests}.initialState", "{nameResolver}", "{testCaseHolder}.events.onCheckRestoredInitialStateComplete.fire"] + }, { + event: "{testCaseHolder}.events.onCheckRestoredInitialStateComplete", + listener: "fluid.identity" } ]); @@ -403,7 +423,7 @@ gpii.test.push = function (array, elements) { gpii.test.buildSingleTestFixture = function (testDef, rootGrades) { testDef.gradeNames = fluid.makeArray(testDef.gradeNames).concat(fluid.makeArray(rootGrades)); - testDef.expect = 4; + testDef.expect = 5; testDef.sequence = fluid.makeArray(testDef.sequence); gpii.test.unshift(testDef.sequence, gpii.test.loginSequence); diff --git a/tests/CloseConflictingAppsTests.js b/tests/CloseConflictingAppsTests.js new file mode 100644 index 000000000..52ba5d84a --- /dev/null +++ b/tests/CloseConflictingAppsTests.js @@ -0,0 +1,266 @@ +/* + * GPII Tests for ensuring that two conflicting apps will not be launched + * + * These are integration tests for ensuring that eg. two screenreaders will not be active at the same time on + * the system. Besides the obvious case of checking that the MM doesn't launch two screenreaders on login, + * it is also tested that an already running screenreader will be closed if the matchmaker finds that another + * (conflicting) matchmaker should be launched. + * + * Copyright 2016 Raising The Floor - International + * + * Licensed under the New BSD license. You may not use this file except in + * compliance with this License. + * + * You may obtain a copy of the License at + * https://github.com/GPII/universal/blob/master/LICENSE.txt + */ +"use strict"; + +var fluid = require("infusion"), + gpii = fluid.registerNamespace("gpii"); + +fluid.require("%universal"); + +gpii.loadTestingSupport(); + +fluid.registerNamespace("gpii.tests.conflictingApps"); + +gpii.tests.conflictingApps.jawsHandlerEntry = function (running) { + return { + "com.freedomscientific.jaws": [{ + "settings": { + "running": running + }, + "options": { + "verifySettings": true, + "getState": [ + { + "type": "gpii.processReporter.find", + "command": "jfw" + } + ], + "setTrue": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\JAWS17.exe\\}\"" + } + ], + "setFalse": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "jfw.exe" + }, + { + "type": "gpii.windows.closeProcessByName", + "filename": "fsSynth32.exe" + }, + { + "type": "gpii.windows.closeProcessByName", + "filename": "jhookldr.exe" + } + ] + } + }] + }; +}; + +gpii.tests.conflictingApps.NVDAHandlerEntry = function (running) { + return { + "org.nvda-project": [{ + "settings": { + "running": running + }, + "options": { + "verifySettings": true, + "getState": [ + { + "type": "gpii.processReporter.find", + "command": "nvda" + } + ], + "setTrue": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\nvda.exe\\}\"" + } + ], + "setFalse": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "nvda_service.exe" + },{ + "type": "gpii.windows.closeProcessByName", + "filename": "nvda.exe" + } + ] + } + }] + }; +}; + +gpii.tests.conflictingApps.testDefs = [ + { + name: "Only one screenreader is launched", + userToken: "screenreader_common", + initialState: { + "gpii.launchHandlers.flexibleHandler": fluid.extend({}, + gpii.tests.conflictingApps.jawsHandlerEntry(false), + gpii.tests.conflictingApps.NVDAHandlerEntry(false)) + }, + settingsHandlers: { + + "gpii.settingsHandlers.INISettingsHandler": { + "org.nvda-project": [ + { + "settings": { + "speech.espeak.rate": 17, + "speech.espeak.volume": 75, + "speech.espeak.pitch": 15, + "speech.espeak.rateBoost": true, + "speech.symbolLevel": 300, + "speech.espeak.voice": "en\\en-wi", + "reviewCursor.followFocus": false, + "reviewCursor.followCaret": true, + "reviewCursor.followMouse": true, + "keyboard.speakTypedWords": true, + "keyboard.speakTypedCharacters": false, + "presentation.reportHelpBalloons": false, + "speech.espeak.sayCapForCapitals": true + }, + "options": { + "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", + "allowNumberSignComments": true, + "allowSubSections": true + } + } + ], + "com.freedomscientific.jaws": [ + { + "settings": { + "Voice Profiles.ActiveVoiceProfileName": "GPII", + "options.SayAllIndicateCaps": true, + "options.TypingEcho": 2 + }, + "options": { + "filename": "${{environment}.APPDATA}\\Freedom Scientific\\JAWS\\17.0\\Settings\\enu\\DEFAULT.JCF" + } + }, + + { + "settings": { + "ENU-Global.Rate": 400, + "ENU-Global.Punctuation": 3, + "ENU-Global.Pitch": 16, + "ENU-Message.Rate": 400, + "ENU-Message.Punctuation": 3, + "ENU-Message.Pitch": 16, + "ENU-Keyboard.Rate": 400, + "ENU-Keyboard.Punctuation": 3, + "ENU-Keyboard.Pitch": 16, + "ENU-PCCursor.Rate": 400, + "ENU-PCCursor.Punctuation": 3, + "ENU-PCCursor.Pitch": 16, + "ENU-JAWSCursor.Rate": 400, + "ENU-JAWSCursor.Punctuation": 3, + "ENU-JAWSCursor.Pitch": 16, + "ENU-MenuAndDialog.Rate": 400, + "ENU-MenuAndDialog.Punctuation": 3, + "ENU-MenuAndDialog.Pitch": 16 + }, + "options": { + "filename": "${{environment}.APPDATA}\\Freedom Scientific\\JAWS\\17.0\\Settings\\VoiceProfiles\\GPII.VPF" + } + } + ] + }, + "gpii.launchHandlers.flexibleHandler": fluid.extend({}, + gpii.tests.conflictingApps.jawsHandlerEntry(false), + gpii.tests.conflictingApps.NVDAHandlerEntry(true)) + } + }, { + name: "Conflicting screenreader (jaws) is closed is Only one screenreader is launched", + userToken: "screenreader_common", + initialState: { + "gpii.launchHandlers.flexibleHandler": fluid.extend({}, + gpii.tests.conflictingApps.jawsHandlerEntry(true), + gpii.tests.conflictingApps.NVDAHandlerEntry(false)) + }, + settingsHandlers: { + + "gpii.settingsHandlers.INISettingsHandler": { + "org.nvda-project": [ + { + "settings": { + "speech.espeak.rate": 17, + "speech.espeak.volume": 75, + "speech.espeak.pitch": 15, + "speech.espeak.rateBoost": true, + "speech.symbolLevel": 300, + "speech.espeak.voice": "en\\en-wi", + "reviewCursor.followFocus": false, + "reviewCursor.followCaret": true, + "reviewCursor.followMouse": true, + "keyboard.speakTypedWords": true, + "keyboard.speakTypedCharacters": false, + "presentation.reportHelpBalloons": false, + "speech.espeak.sayCapForCapitals": true + }, + "options": { + "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", + "allowNumberSignComments": true, + "allowSubSections": true + } + } + ], + "com.freedomscientific.jaws": [ + { + "settings": { + "Voice Profiles.ActiveVoiceProfileName": "GPII", + "options.SayAllIndicateCaps": true, + "options.TypingEcho": 2 + }, + "options": { + "filename": "${{environment}.APPDATA}\\Freedom Scientific\\JAWS\\17.0\\Settings\\enu\\DEFAULT.JCF" + } + }, + + { + "settings": { + "ENU-Global.Rate": 400, + "ENU-Global.Punctuation": 3, + "ENU-Global.Pitch": 16, + "ENU-Message.Rate": 400, + "ENU-Message.Punctuation": 3, + "ENU-Message.Pitch": 16, + "ENU-Keyboard.Rate": 400, + "ENU-Keyboard.Punctuation": 3, + "ENU-Keyboard.Pitch": 16, + "ENU-PCCursor.Rate": 400, + "ENU-PCCursor.Punctuation": 3, + "ENU-PCCursor.Pitch": 16, + "ENU-JAWSCursor.Rate": 400, + "ENU-JAWSCursor.Punctuation": 3, + "ENU-JAWSCursor.Pitch": 16, + "ENU-MenuAndDialog.Rate": 400, + "ENU-MenuAndDialog.Punctuation": 3, + "ENU-MenuAndDialog.Pitch": 16 + }, + "options": { + "filename": "${{environment}.APPDATA}\\Freedom Scientific\\JAWS\\17.0\\Settings\\VoiceProfiles\\GPII.VPF" + } + } + ] + }, + "gpii.launchHandlers.flexibleHandler": fluid.extend({}, + gpii.tests.conflictingApps.jawsHandlerEntry(false), + gpii.tests.conflictingApps.NVDAHandlerEntry(true)) + } + } +]; + +module.exports = gpii.test.bootstrap({ + testDefs: "gpii.tests.conflictingApps.testDefs", + configName: "gpii.tests.multiScreenreader.config", + configPath: "%universal/tests/configs" +}, ["gpii.test.integration.testCaseHolder.windows"], + module, require, __dirname); diff --git a/tests/JournalIntegrationTests.js b/tests/JournalIntegrationTests.js index 219a9a23b..0a7719d7e 100644 --- a/tests/JournalIntegrationTests.js +++ b/tests/JournalIntegrationTests.js @@ -98,6 +98,20 @@ gpii.tests.journal.initialSettings = { } }; +gpii.tests.journal.settingsAfterCrash = { + "gpii.windows.enableRegisteredAT": { + "com.microsoft.windows.magnifier": [{ + "settings": { + "running": false + }, + "options": { + "registryName": "magnifierpane", + "queryProcess": "Magnify" + } + }] + } +}; + fluid.defaults("gpii.tests.journal.solutionsRegistryAdvisor", { gradeNames: "fluid.modelComponent", model: { @@ -332,8 +346,6 @@ gpii.tests.journal.stashInitial = function (settingsHandlersPayload, settingsSto // with values all `undefined` will confuse jqUnit.assertDeepEq in gpii.test.checkConfiguration settingsHandlers["gpii.windows.spiSettingsHandler"] = fluid.filterKeys(settingsHandlers["gpii.windows.spiSettingsHandler"], "com.microsoft.windows.mouseTrailing"); settingsHandlers["gpii.windows.registrySettingsHandler"] = fluid.filterKeys(settingsHandlers["gpii.windows.registrySettingsHandler"], "com.microsoft.windows.magnifier"); - // settingsHandlers["gpii.windows.spiSettingsHandler"]["com.microsoft.windows.mouseTrailing"].length = 1; - // settingsHandlers["gpii.windows.registrySettingsHandler"]["com.microsoft.windows.magnifier"].length = 1; testCaseHolder.settingsHandlers = settingsHandlers; }; @@ -362,7 +374,7 @@ gpii.tests.journal.normalLoginFixtures = [ gpii.tests.journal.fixtures = [ { name: "Journal state and restoration", - expect: 10, + expect: 11, sequenceSegments: [ { func: "gpii.tests.journal.stashJournalId", args: "{testCaseHolder}" @@ -399,6 +411,12 @@ gpii.tests.journal.fixtures = [ }, kettle.test.startServerSequence, { + func: "gpii.test.setSettings", + args: [gpii.tests.journal.settingsAfterCrash, "{nameResolver}", "{testCaseHolder}.events.onInitialSettingsComplete.fire"] + }, { + event: "{tests}.events.onInitialSettingsComplete", + listener: "fluid.identity" + }, { func: "{listJournalsRequest}.send" }, { event: "{listJournalsRequest}.events.onComplete", @@ -487,5 +505,5 @@ gpii.tests.journal.badJournalBaseTestDef = fluid.extend({ kettle.test.bootstrapServer(gpii.test.buildSegmentedFixtures( gpii.tests.journal.fixtures, gpii.tests.journal.baseTestDef)); -kettle.test.bootstrapServer(gpii.test.buildSegmentedFixtures( - gpii.tests.journal.badJournalFixtures, gpii.tests.journal.badJournalBaseTestDef)); +// kettle.test.bootstrapServer(gpii.test.buildSegmentedFixtures( +// gpii.tests.journal.badJournalFixtures, gpii.tests.journal.badJournalBaseTestDef)); diff --git a/tests/configs/gpii.tests.multiScreenreader.config.json b/tests/configs/gpii.tests.multiScreenreader.config.json new file mode 100644 index 000000000..0ce917b80 --- /dev/null +++ b/tests/configs/gpii.tests.multiScreenreader.config.json @@ -0,0 +1,18 @@ +{ + "type": "gpii.tests.multiScreenreader.config", + "options": { + "distributeOptions": { + "multiSH.rawPreferencesDataSource": { + "record": "%universal/testData/preferences/acceptanceTests/%userToken.json", + "target": "{that rawPreferencesServer rawPreferencesDataSource}.options.path", + "priority": "after:development.rawPreferencesDataSource" + }, + "multiSH.deviceReporter": { + "record": "%universal/tests/data/multiScreenreaderDeviceReporter.json", + "target": "{that deviceReporter installedSolutionsDataSource}.options.path", + "priority": "after:development.installedSolutionsPath" + } + } + }, + "mergeConfigs": "%universal/gpii/configs/gpii.config.development.all.local.json" +} diff --git a/tests/configs/gpii.tests.multiScreenreader.config.txt b/tests/configs/gpii.tests.multiScreenreader.config.txt new file mode 100644 index 000000000..4e792098a --- /dev/null +++ b/tests/configs/gpii.tests.multiScreenreader.config.txt @@ -0,0 +1,4 @@ +gpii.tests.multiScreenreader.config.json + +Is used for the integration test CloseConflictingAppsTest. It uses the NP sets of the testData's acceptanceTests folder and a device reporter that reports only two screenreaders (Jaws and NVDA) installed. + diff --git a/tests/data/multiScreenreaderDeviceReporter.json b/tests/data/multiScreenreaderDeviceReporter.json new file mode 100644 index 000000000..5e9147038 --- /dev/null +++ b/tests/data/multiScreenreaderDeviceReporter.json @@ -0,0 +1,9 @@ +[ + { + "id": "com.freedomscientific.jaws" + }, + + { + "id": "org.nvda-project" + } +] diff --git a/tests/platform/windows/configs/gpii.tests.acceptance.windows.builtIn.config.json b/tests/platform/windows/configs/gpii.tests.acceptance.windows.builtIn.config.json index 064856ecb..c7e30261c 100644 --- a/tests/platform/windows/configs/gpii.tests.acceptance.windows.builtIn.config.json +++ b/tests/platform/windows/configs/gpii.tests.acceptance.windows.builtIn.config.json @@ -8,6 +8,6 @@ "priority": "after:development.installedSolutionsPath" } } - }, + }, "mergeConfigs": "%universal/tests/configs/gpii.tests.acceptance.localInstall.config.json" } From 625a684395beeebb347af148f40bfcdbf4592c29 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Thu, 6 Apr 2017 12:49:14 +0200 Subject: [PATCH 14/44] GPII-1230: Added integration tests for closing conflicting solutions --- .../src/CanopyMatchMakerUtilities.js | 2 +- .../test/CanopyMatchMakerTests.js | 67 ++++- .../lifecycleManager/src/LifecycleManager.js | 44 +-- .../test/js/LifecycleManagerTests.js | 52 ++-- .../src/MatchMakerUtilities.js | 14 +- .../test/js/CanopyMatchMakerTests.js | 191 ------------- ...hMakerUtilitiesDisposeFromPriorityTests.js | 10 +- .../test/js/MatchMakerUtilitiesTests.js | 6 +- gpii/node_modules/testing/src/Testing.js | 24 +- testData/solutions/win32.json5 | 13 +- tests/CloseConflictingAppsTests.js | 266 ++++++++++++++++++ tests/JournalIntegrationTests.js | 28 +- .../gpii.tests.multiScreenreader.config.json | 18 ++ .../gpii.tests.multiScreenreader.config.txt | 4 + .../data/multiScreenreaderDeviceReporter.json | 9 + ...sts.acceptance.windows.builtIn.config.json | 2 +- .../windows/windows-builtIn-testSpec.js | 71 ++++- .../windows-dynamicDeviceReporter-testSpec.js | 141 ++++++---- .../platform/windows/windows-jaws-testSpec.js | 3 +- .../platform/windows/windows-nvda-testSpec.js | 205 +++++++------- .../windows/windows-readWrite-testSpec.js | 176 ++++-------- 21 files changed, 783 insertions(+), 563 deletions(-) delete mode 100644 gpii/node_modules/matchMakerFramework/test/js/CanopyMatchMakerTests.js create mode 100644 tests/CloseConflictingAppsTests.js create mode 100644 tests/configs/gpii.tests.multiScreenreader.config.json create mode 100644 tests/configs/gpii.tests.multiScreenreader.config.txt create mode 100644 tests/data/multiScreenreaderDeviceReporter.json diff --git a/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js b/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js index e773b3468..349b1c69b 100644 --- a/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js +++ b/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js @@ -103,7 +103,7 @@ gpii.canopyMatchMaker.utils.disposeFromCanopy = function (leaves, ranked, solrec for (var i = 0; i < ranked.length; ++i) { var sol = solrecs[ranked[i]]; - if (sol.disposition === "reject") { + if (sol.disposition === "reject" || sol.disposition === "deactivate") { continue; } diff --git a/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js b/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js index 36fb41680..a80c86c07 100644 --- a/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js +++ b/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js @@ -94,7 +94,7 @@ var matchFixtures = [ } } }, { - description: "Two magnifier preferences->best fit is launched", + description: "Two magnifier preferences->best fit is launched, the other one should not run", input: require("./data/full_mm_payload2.json"), preferences: { "gpii-default": { @@ -115,6 +115,13 @@ var matchFixtures = [ "http://registry.gpii.net/common/magnification": 150, "http://registry.gpii.net/common/invertColours": true } + }, + "fakemag1": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150, + "http://registry.gpii.net/common/invertColours": true + } } } } @@ -140,6 +147,12 @@ var matchFixtures = [ "settings": { "http://registry.gpii.net/common/magnification": 150 } + }, + "fakemag2": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150 + } } } } @@ -174,6 +187,13 @@ var matchFixtures = [ "http://registry.gpii.net/common/magnification": 150, "http://registry.gpii.net/common/pitch": 0.8 } + }, + "fakemag2": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150, + "http://registry.gpii.net/common/pitch": 0.8 + } } } } @@ -207,6 +227,12 @@ var matchFixtures = [ "settings": { "http://registry.gpii.net/common/magnification": 150 } + }, + "fakemag1": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150 + } } } } @@ -245,6 +271,12 @@ var matchFixtures = [ "settings": { "http://registry.gpii.net/common/magnification": 150 } + }, + "fakemag1": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150 + } } } } @@ -284,6 +316,12 @@ var matchFixtures = [ "settings": { "http://registry.gpii.net/common/magnification": 150 } + }, + "fakemag2": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150 + } } } } @@ -325,6 +363,13 @@ var matchFixtures = [ "http://registry.gpii.net/common/magnification": 150, "http://registry.gpii.net/common/invertColours": true } + }, + "fakemag1": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150, + "http://registry.gpii.net/common/invertColours": true + } } } } @@ -350,6 +395,12 @@ var matchFixtures = [ "settings": { "http://registry.gpii.net/applications/fakemag2": {} } + }, + "fakemag1": { + "active": false, + "settings": { + "http://registry.gpii.net/applications/fakemag2": {} + } } } } @@ -377,6 +428,13 @@ var matchFixtures = [ "http://registry.gpii.net/applications/fakemag2": {}, "http://registry.gpii.net/applications/fakemag1": {} } + }, + "fakemag2": { + "active": false, + "settings": { + "http://registry.gpii.net/applications/fakemag2": {}, + "http://registry.gpii.net/applications/fakemag1": {} + } } } } @@ -436,6 +494,13 @@ var matchFixtures = [ "http://registry.gpii.net/applications/fakemag2": {}, "http://registry.gpii.net/common/magnification": 150 } + }, + "fakemag2": { + "active": false, + "settings": { + "http://registry.gpii.net/applications/fakemag2": {}, + "http://registry.gpii.net/common/magnification": 150 + } } } } diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index 17c1f60f4..978be8314 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -237,7 +237,7 @@ var gpii = fluid.registerNamespace("gpii"); /** Remove all the settings blocks from a solutions registry entry */ - gpii.settingsHandlers.removeSettingsBlocks = function (solutionEntry) { + gpii.lifecycleManager.removeSettingsBlocks = function (solutionEntry) { solutionEntry.settingsHandlers = fluid.transform(solutionEntry.settingsHandlers, function (handler) { return fluid.filterKeys(handler, "settings", true); }); @@ -249,14 +249,14 @@ var gpii = fluid.registerNamespace("gpii"); * with almost identical argument list. */ gpii.lifecycleManager.recordSnapshotInSession = function (that, snapshot, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction) { - var toSnapshot = gpii.settingsHandlers.removeSettingsBlocks(fluid.copy(solutionRecord)); - - // Disabled the removing of all settingshandlers blocks to ensure that we have them available when restoring the system. - // This is particularly relevant for launch handlers, where we will need to run the "get" directives on logout to decide - // whether we an application is running or not, and consequently, whether to run the "update" or "stop" block - // toSnapshot.settingsHandlers = {}; - toSnapshot.settingsHandlers[settingsHandlerBlockName] = snapshot; if (rootAction === "start" || rootAction === "update") { + var toSnapshot = gpii.lifecycleManager.removeSettingsBlocks(fluid.copy(solutionRecord)); + + // Disabled the removing of all settingshandlers blocks to ensure that we have them available when restoring the system. + // This is particularly relevant for launch handlers, where we will need to run the "get" directives on logout to decide + // whether we an application is running or not, and consequently, whether to run the "update" or "stop" block + // toSnapshot.settingsHandlers = {}; + toSnapshot.settingsHandlers[settingsHandlerBlockName] = snapshot; // keep the settings that are already stored from the // original snapshot, but augment it with any settings from the new snapshot // that were not present in the original snapshot. @@ -311,6 +311,7 @@ var gpii = fluid.registerNamespace("gpii"); return that.invokeSettingsHandlerGet(solutionId, expanded); } else { var settingsPromise = that.invokeSettingsHandlerSet(solutionId, expanded); + settingsPromise.then(function (snapshot) { session.applier.change(["appliedSolutions", solutionId], solutionRecord); gpii.lifecycleManager.recordSnapshotInSession(that, snapshot, solutionId, solutionRecord, session, @@ -430,7 +431,7 @@ var gpii = fluid.registerNamespace("gpii"); } else { // if this is related to launching, overwrite entry with the appropriate settings, // that is: { running: true } if we're in a start block, else { running: false } - if (actionBlock === "start" || (actionBlock === "stop" && rootAction !== "stop") || actionBlock === "isRunning") { + if (actionBlock === "start" || actionBlock === "stop") { var launchSettings = { running: actionBlock === "start" ? true : false }; fluid.set(solutionRecord, [ "settingsHandlers", settingsHandlerBlockName, "settings"], launchSettings); } @@ -442,7 +443,9 @@ var gpii = fluid.registerNamespace("gpii"); // TODO (GPII-1230) Fix this up so we don't always run the full start and stops (including) // system restoration, etc. if (action === "start" || action === "configure" || action === "stop") { - return that.executeActions(solutionId, solutionRecord, session, action, rootAction); + return function () { + return that.executeActions(solutionId, solutionRecord, session, action, rootAction); + }; } else { fluid.fail("Unrecognised string action in LifecycleManager: " + action + " inside 'update' section for solution " + solutionId); @@ -511,9 +514,9 @@ var gpii = fluid.registerNamespace("gpii"); var actions; if (currentRunState === true) { // if it's already running if (recordedRunState === false) { // and it was not running on start - actions = [ "stop", "restore" ] + actions = [ "stop", "restore" ]; } else { // else update it - actions = [ "update" ] + actions = [ "update" ]; } } else { // if it is not running if (recordedRunState === true) { // and it was running when we started @@ -530,24 +533,7 @@ var gpii = fluid.registerNamespace("gpii"); }); var sequence = fluid.promise.sequence(tasks); - - // var promises = fluid.transform(session.model.originalSettings, function (changesSolutionRecord, solutionId) { - // var solutionRecord = gpii.lifecycleManager.transformSolutionSettings(changesSolutionRecord, gpii.settingsHandlers.changesToSettings); - // // if a solution was running on login, run the update block to ensure that restored settings are applied - // var recordedState = gpii.lifecycleManager.getSolutionRunningStateFromSnapshot(solutionRecord); - // var currentState = that.getSolutionRunningState(solutionId, changesSolutionRecord, session); - // var actions; - // if (recordedState === undefined) { // if we didn't do anything to solution state before, dont do it now - // actions = [ "restore" ] - // } else if (recordedState === true) { // if originally running and we stopped it, updait was started when we logged in, ensure that it is still started - // = recordedState ? [ "update" ] : [ "stop", "restore" ]; - // } - // } - // return that.applySolution(solutionId, solutionRecord, session, actions, rootAction); - // }); - // // TODO: In theory we could stop all solutions in parallel - // var sequence = fluid.promise.sequence(fluid.values(promises)); return sequence; }; diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index c21603de5..4e0ae3c52 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -73,7 +73,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt } return togo; - } + }; gpii.tests.lifecycleManager.buildSettingsHandlersEntry = function (settings, setRunning) { var togo = { @@ -89,10 +89,10 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt } }; if (settings !== undefined) { - fluid.set(togo, [ "settingsHandlers", "myconf", "settings" ], settings) + fluid.set(togo, [ "settingsHandlers", "myconf", "settings" ], settings); } if (setRunning !== undefined) { - fluid.set(togo, [ "settingsHandlers", "launcher", "settings" ], { running: setRunning }) + fluid.set(togo, [ "settingsHandlers", "launcher", "settings" ], { running: setRunning }); } return togo; }; @@ -371,7 +371,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt gpii.tests.lifecycleManager.settingsHandlerOriginalSystemSettings : origSettings; - var setRunning = (setRunning === undefined) ? false : setRunning; // default to false + setRunning = (setRunning === undefined) ? false : setRunning; // default to false var launchSettings = gpii.tests.lifecycleManager.launchHandlerOriginalSystemSettingsRunning(setRunning); // initialise the mock with the initial settings expected at the end of the test gpii.tests.lifecycleManager.backingMockSettingsHandler.set(settings); @@ -397,7 +397,6 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt } }; - // TODO KASPER: this is duplicate gpii.tests.lifecycleManager.mockLaunchHandler = { set: function (data) { var togo = fluid.promise(); @@ -414,7 +413,6 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt } }; - gpii.tests.lifecycleManager.createSettingsHandlerPayload = function (solutionId, settings) { if (settings === undefined) { return undefined; @@ -428,7 +426,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt ]; return togo; } - } + }; // TODO KASPER: Remove this and all references (probably) gpii.tests.lifecycleManager.assertExpectedExec = function () { @@ -476,7 +474,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt "running": setRunning } }] - } + }; }; gpii.tests.lifecycleManager.settingsHandlerExpectedInputNewSettings = { @@ -830,13 +828,12 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt gpii.tests.lifecycleManager.standardLifecycle, { "update": [ "configure" ] }), originalSettingsAfterUpdate: { - "other.application": [{ - "options": {}, - "settings": { - "mysetting": undefined - } - } - ] + "other.application": [{ + "options": {}, + "settings": { + "mysetting": undefined + } + }] }, runningAfterUpdate: true }, { @@ -888,7 +885,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt } else { // change to the format that is stoed by the mock settingshandler: expectedLastSettings = { - "org.gnome.desktop.a11y.magnifier": [ + "org.gnome.desktop.a11y.magnifier": [ { "options": {}, "settings": expSettings @@ -936,14 +933,14 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt var stopCycle = function () { jqUnit.assertDeepEq("Session not running after stop", lifecycleManager.getSession(123)); - jqUnit.assertEquals("Number of calls to launch handler", testDef.expectedLaunchHandlerCalls, gpii.tests.lifecycleManager.staticRepository.launchHandlerCalls) + jqUnit.assertEquals("Number of calls to launch handler", testDef.expectedLaunchHandlerCalls, gpii.tests.lifecycleManager.staticRepository.launchHandlerCalls); // Check that last calls to launch and settings handlers were actually the ones resetting to expected state jqUnit.assertDeepEq("checking last payload sent to settingshandler:", testDef.originalSettingsAfterUpdate || testDef.originalSettings, gpii.tests.lifecycleManager.staticRepository.settingsHandler); // Check that last calls to launch and settings handlers were actually the ones resetting to expected state gpii.tests.lifecycleManager.checkFinalSettingsPayload("checking last set launch settings", (originalRunSetting === undefined) ? undefined : { running: originalRunSetting }, gpii.tests.lifecycleManager.staticRepository.launchHandler); jqUnit.start(); - } + }; if (testDef.updatePayload) { lifecycleManager.update(gpii.tests.lifecycleManager.buildStartPayload(testDef.updatePayload), function () { @@ -971,7 +968,6 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.updateSettings)); var expectedAfterUpdate = gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.expectedSettings, test.runningAfterUpdate)); - var originalRunSetting = test.expectedLaunchHandlerCalls === 0 ? undefined : test.runningOnLogin; var originalSettingsAfterUpdate = test.originalSettingsAfterUpdate || test.originalSettings; var expectedOriginalSettingsAfterUpdate = gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, @@ -992,7 +988,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt expectedOriginalSettingsAfterUpdate: expectedOriginalSettingsAfterUpdate, runningAfterUpdate: test.runningAfterUpdate, originalSettingsAfterUpdate: gpii.tests.lifecycleManager.createSettingsHandlerPayload("org.gnome.desktop.a11y.magnifier", originalSettingsAfterUpdate) - } + }; gpii.tests.lifecycleManager.runLifecycleTest(testDef); }); @@ -1075,14 +1071,12 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt gpii.tests.lifecycleManager.initBackingMock(); var snapshotPromise = lifecycleManager.invokeSettingsHandlerGet("org.gnome.desktop.a11y.magnifier", gpii.tests.lifecycleManager.invokeSettingsHandlersRequest); var expected = { - "org.gnome.desktop.a11y.magnifier": [ - { - "settings": { - "cross-hairs-clip": false, - "cross-hairs-color": "red" - } - } - ] + "org.gnome.desktop.a11y.magnifier": [{ + "settings": { + "cross-hairs-clip": false, + "cross-hairs-color": "red" + } + }] }; snapshotPromise.then(function (snapshot) { jqUnit.assertDeepEq("invokeSettingsHandlerGet produced snapshot", expected, snapshot); @@ -1101,7 +1095,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt gpii.tests.lifecycleManager.buildStartTests(); fluid.each(gpii.tests.lifecycleManager.completeLifecycleTests, function (testDef) { gpii.tests.lifecycleManager.runLifecycleTest(testDef); - }) + }); jqUnit.asyncTest("gpii.lifecycleManager.update() tests for 'stop' reference", function () { // initial payload: diff --git a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js index 38f8ac4ad..6976e8ebc 100644 --- a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js +++ b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js @@ -189,10 +189,10 @@ var fluid = fluid || require("infusion"), var leaves = gpii.matchMakerFramework.utils.computeLeaves(context.preferences); var disposed = strategy(leaves, tmpSolrecs, data, ontologyMetadata); - togo[contextId] = []; + togo[contextId] = {}; fluid.each(disposed, function (solrec, solid) { - if (solrec.disposition === "accept") { - togo[contextId].push(solid); + if (solrec.disposition === "accept" || solrec.disposition === "deactivate") { + togo[contextId][solid] = (solrec.disposition === "accept"); // true if it should be running } }); }); @@ -327,8 +327,8 @@ var fluid = fluid || require("infusion"), for (var solutionId in solutionTypeMapping[type]) { var sol = solrecs[solutionId]; if (!sol.disposition) { - sol.disposition = "reject"; - sol.dispositionReason = disposeReason || "Solution rejected due to its type of " + type; + sol.disposition = "deactivate"; + sol.dispositionReason = disposeReason || "Solution rejected (deactivated) due to its type of " + type; } } }); @@ -394,9 +394,9 @@ var fluid = fluid || require("infusion"), applications: {} }; var appBlock = togo.inferredConfiguration[contextId].applications; - fluid.each(solArray, function (solutionId) { + fluid.each(solArray, function (active, solutionId) { var content = { - active: true, + active: active, settings: fullModel.preferences.contexts[contextId].preferences }; appBlock[solutionId] = content; diff --git a/gpii/node_modules/matchMakerFramework/test/js/CanopyMatchMakerTests.js b/gpii/node_modules/matchMakerFramework/test/js/CanopyMatchMakerTests.js deleted file mode 100644 index 179323e50..000000000 --- a/gpii/node_modules/matchMakerFramework/test/js/CanopyMatchMakerTests.js +++ /dev/null @@ -1,191 +0,0 @@ -/* - * GPII Canopy MatchMaker Tests - * - * Copyright 2012 OCAD University - * Copyright 2012 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 - */ - -/* global jqUnit, fluid */ - -var gpii = fluid.registerNamespace("gpii"); - -(function () { - "use strict"; - - fluid.registerNamespace("gpii.tests.canopyMatchMaker"); - - var magnifier = { - "settingsHandlers": { - "myconf": { - "type": "gpii.integrationTesting.mockSettingsHandler", - "capabilities": ["display.screenEnhancement"], - "capabilitiesTransformations": { - "mag-factor": "display.screenEnhancement.magnification", - "show-cross-hairs": "display.screenEnhancement.-provisional-showCrosshairs", - "mouse-tracking": { - "transform": { - "type": "fluid.transforms.valueMapper", - "defaultInputPath": "display.screenEnhancement.tracking", - "match": { - "mouse": "centered" - } - } - } - } - } - } - }; - - var lesserMagnifier = { - "settingsHandlers": { - "myconf": { - "type": "gpii.integrationTesting.mockSettingsHandler", - "capabilitiesTransformations": { - "mag-factor": "display.screenEnhancement.magnification" - } - }, - "yourconf": { - "type": "gpii.integrationTesting.mockSettingsHandler", - "capabilities": "display.screenEnhancement.magnification" - } - } - }; - - var magnifierLeaves = [ - "display.screenEnhancement.magnification", - "display.screenEnhancement.-provisional-showCrosshairs", - "display.screenEnhancement.tracking", - "display.screenEnhancement" - ]; - - var magnifierSkeleton = { - display: { - screenEnhancement: { - magnification: {}, - "-provisional-showCrosshairs": {}, - tracking: {} - } - } - }; - - var escapedLeaves = [ - "display.screenReader.applications.nvda\\.screenReader" - ]; - - var escapedSkeleton = { - display: { - screenReader: { - applications: { - "nvda.screenReader": {} - } - } - } - }; - - var sammyProfile = { - "display": { - "screenEnhancement": { - "fontSize": 24, - "foregroundColor": "white", - "backgroundColor": "black", - "fontFace": { - "fontName": ["Comic Sans"], - "genericFontFace": "sans serif" - }, - "magnification": 2.0, - "tracking": ["mouse"], - "invertImages": true, - "-provisional-showCrosshairs": true - } - } - }; - - var sammyLeaves = [ - "display.screenEnhancement.-provisional-showCrosshairs", - "display.screenEnhancement.backgroundColor", - "display.screenEnhancement.fontFace.fontName.0", - "display.screenEnhancement.fontFace.genericFontFace", - "display.screenEnhancement.fontSize", - "display.screenEnhancement.foregroundColor", - "display.screenEnhancement.invertImages", - "display.screenEnhancement.magnification", - "display.screenEnhancement.tracking.0" - ]; - - var expandFitness = function (fitnesses) { - return fluid.transform(fitnesses, function (fit, index) { - return { - fitness: fit, - index: index - }; - }); - }; - - var extractIndices = function (solns) { - return fluid.transform(solns, function (soln) { - return soln.index; - }); - }; - - gpii.tests.canopyMatchMaker.runTests = function () { - jqUnit.module("Utilities"); - - jqUnit.test("Path Utilities", function () { - jqUnit.assertEquals("Exact depth", 0, gpii.matchMakerFramework.utils.prefixLength("display.screenEnhancement.fontSize", sammyProfile)); - jqUnit.assertEquals("Near depth", 0, gpii.matchMakerFramework.utils.prefixLength("display.screenEnhancement.fontSize", sammyProfile)); - jqUnit.assertEquals("Mid depth", -1, gpii.matchMakerFramework.utils.prefixLength("display.unrecognizable", sammyProfile)); - jqUnit.assertEquals("Far depth", -2, gpii.matchMakerFramework.utils.prefixLength("display.unrecognizable.thing", sammyProfile)); - var skeleton = gpii.matchMakerFramework.utils.pathsToSkeleton(magnifierLeaves); - jqUnit.assertDeepEq("Computed model skeleton", magnifierSkeleton, skeleton); - - var skeleton2 = gpii.matchMakerFramework.utils.pathsToSkeleton(escapedLeaves); - jqUnit.assertDeepEq("Computed model escaped skeleton", escapedSkeleton, skeleton2); - }); - - jqUnit.test("Fitness computation", function () { - var fitness = gpii.matchMaker.canopy.computeFitness(sammyLeaves, magnifierSkeleton); - var expected = [0, 0, -1, -1, -1, -1, -1, -2, -3]; - jqUnit.assertDeepEq("Computed fitness vector", expected, fitness); - - var fitnesses = [ - [-1, -3, 0], - [0, 0, 0], - [0, 0], - [0, 0, 0, 0], - [-1, -3, -1] - ]; - var solns = gpii.matchMaker.canopy.sortSolutions(expandFitness(fitnesses)); - var indices = extractIndices(solns); - var expected2 = [3, 1, 2, 0, 4]; - jqUnit.assertDeepEq("Ranked fitnesses", expected2, indices); - }); - - jqUnit.module("MatchMaker"); - jqUnit.test("Rank and dispose solutions", function () { - var solutions = [lesserMagnifier, - magnifier - ]; - var expanded = gpii.matchMakerFramework.utils.expandSolutions(solutions, { "*": "*" }); - var ranked = gpii.matchMaker.canopy.rankSolutions(sammyLeaves, expanded); - var indices = extractIndices(ranked); - var expected = [1, 0]; - jqUnit.assertDeepEq("Ranked solutions", expected, indices); - - var disposed = gpii.matchMaker.canopy.disposeSolutionsImpl(sammyLeaves, ranked); - var itions = gpii.matchMakerFramework.utils.extractDispositions(disposed); - expected = ["reject", "accept"]; - jqUnit.assertDeepEq("Disposed solutions", expected, itions); - }); - }; - -})(); diff --git a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js index f088d22eb..4b704b3ad 100644 --- a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js +++ b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js @@ -98,11 +98,11 @@ var fluid = fluid || require("infusion"), var testData = [{ description: "Tie between highest priority, rest rejected", priorities: [2, 2, 1, 1, 1], - expectedDispositions: [undefined, undefined, "reject", "reject", "reject"] + expectedDispositions: [undefined, undefined, "deactivate", "deactivate", "deactivate"] }, { description: "Single highest priority wins, rest rejected", priorities: [2, 1, 1, 1, 1], - expectedDispositions: ["accept", "reject", "reject", "reject", "reject"] + expectedDispositions: ["accept", "deactivate", "deactivate", "deactivate", "deactivate"] }, { // description: "Only solution covering all required solution types selected", // priorities: [2, 1, 2, 1, 1], @@ -110,15 +110,15 @@ var fluid = fluid || require("infusion"), // }, { description: "Highest priority selected, solution type equivalents remove", priorities: [2, 1, 3, 1, 2], - expectedDispositions: ["reject", "reject", "accept", "reject", "accept"] + expectedDispositions: ["deactivate", "deactivate", "accept", "deactivate", "accept"] }, { description: "Tie between multiple solutions of different types", priorities: [2, 1, 2, 2, 2], - expectedDispositions: [undefined, "reject", undefined, undefined, undefined] + expectedDispositions: [undefined, "deactivate", undefined, undefined, undefined] }, { description: "Tie between multiple solutions of different types #2", priorities: [2, 1, 2, 1, 2], - expectedDispositions: [undefined, "reject", undefined, "reject", undefined] + expectedDispositions: [undefined, "deactivate", undefined, "deactivate", undefined] // }, { // description: "", // priorities: [1, null, 2, null, null], diff --git a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js index ed53b5ca7..c4c68cfdf 100644 --- a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js +++ b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js @@ -287,9 +287,9 @@ var fluid = fluid || require("infusion"), { description: "Basic payloads", disposed: { - "gpii-default": [ - "mac.dummy" - ] + "gpii-default": { + "mac.dummy": true + } }, fullModel: { "userToken": "mac", diff --git a/gpii/node_modules/testing/src/Testing.js b/gpii/node_modules/testing/src/Testing.js index 36b7a8651..7beb91481 100644 --- a/gpii/node_modules/testing/src/Testing.js +++ b/gpii/node_modules/testing/src/Testing.js @@ -212,6 +212,19 @@ gpii.test.checkRestoredConfiguration = function (settingsHandlers, settingsStore }); }; +gpii.test.checkRestoredInitialState = function (initialSettings, nameResolver, onComplete) { + if (initialSettings === undefined) { + jqUnit.assertTrue("No initial settings defined, so not checking", true); + onComplete(); + return; + } + var currentSettingsPromise = gpii.test.getSettings(initialSettings, nameResolver); + currentSettingsPromise.then(function (currentSettings) { + jqUnit.assertDeepEq("Checking that initital settings are also properly reset", gpii.test.extractSettingsBlocks(initialSettings), currentSettings); + onComplete(); + }); +}; + gpii.test.common.receiveVariableResolver = function (testCaseHolder, variableResolver) { testCaseHolder.variableResolver = variableResolver; }; @@ -258,7 +271,8 @@ fluid.defaults("gpii.test.common.testCaseHolder", { onInitialStateSet: null, onInitialStateConfirmed: null, onCheckConfigurationComplete: null, - onCheckRestoredConfigurationComplete: null + onCheckRestoredConfigurationComplete: null, + onCheckRestoredInitialStateComplete: null }, distributeOptions: { "common.testCaseHolder.variableResolver": { @@ -385,6 +399,12 @@ gpii.test.checkSequence = fluid.freezeRecursive([ }, { event: "{testCaseHolder}.events.onCheckRestoredConfigurationComplete", listener: "fluid.identity" + }, { // anything in the intial state should also be restored upon logout + func: "gpii.test.checkRestoredInitialState", + args: [ "{tests}.initialState", "{nameResolver}", "{testCaseHolder}.events.onCheckRestoredInitialStateComplete.fire"] + }, { + event: "{testCaseHolder}.events.onCheckRestoredInitialStateComplete", + listener: "fluid.identity" } ]); @@ -403,7 +423,7 @@ gpii.test.push = function (array, elements) { gpii.test.buildSingleTestFixture = function (testDef, rootGrades) { testDef.gradeNames = fluid.makeArray(testDef.gradeNames).concat(fluid.makeArray(rootGrades)); - testDef.expect = 4; + testDef.expect = 5; testDef.sequence = fluid.makeArray(testDef.sequence); gpii.test.unshift(testDef.sequence, gpii.test.loginSequence); diff --git a/testData/solutions/win32.json5 b/testData/solutions/win32.json5 index 60647ff8c..3fc4d9267 100644 --- a/testData/solutions/win32.json5 +++ b/testData/solutions/win32.json5 @@ -653,6 +653,11 @@ "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { + "verifySettings": true, + "retryOptions": { + rewriteEvery: 0, + numRetries: 40 + }, "setTrue": [ { "type": "gpii.launch.exec", @@ -668,7 +673,7 @@ "getState": [ { "type": "gpii.processReporter.find", - "command": "readandwrite" + "command": "ReadAndWrite" } ] } @@ -816,6 +821,12 @@ "launcher": { "type": "gpii.windows.enableRegisteredAT", "options": { + "verifySettings": true, + "retryOptions": { + "rewriteEvery": 0, + "numRetries": 20, + "retryInterval": 1000 + }, "registryName": "magnifierpane", "queryProcess": "Magnify" } diff --git a/tests/CloseConflictingAppsTests.js b/tests/CloseConflictingAppsTests.js new file mode 100644 index 000000000..52ba5d84a --- /dev/null +++ b/tests/CloseConflictingAppsTests.js @@ -0,0 +1,266 @@ +/* + * GPII Tests for ensuring that two conflicting apps will not be launched + * + * These are integration tests for ensuring that eg. two screenreaders will not be active at the same time on + * the system. Besides the obvious case of checking that the MM doesn't launch two screenreaders on login, + * it is also tested that an already running screenreader will be closed if the matchmaker finds that another + * (conflicting) matchmaker should be launched. + * + * Copyright 2016 Raising The Floor - International + * + * Licensed under the New BSD license. You may not use this file except in + * compliance with this License. + * + * You may obtain a copy of the License at + * https://github.com/GPII/universal/blob/master/LICENSE.txt + */ +"use strict"; + +var fluid = require("infusion"), + gpii = fluid.registerNamespace("gpii"); + +fluid.require("%universal"); + +gpii.loadTestingSupport(); + +fluid.registerNamespace("gpii.tests.conflictingApps"); + +gpii.tests.conflictingApps.jawsHandlerEntry = function (running) { + return { + "com.freedomscientific.jaws": [{ + "settings": { + "running": running + }, + "options": { + "verifySettings": true, + "getState": [ + { + "type": "gpii.processReporter.find", + "command": "jfw" + } + ], + "setTrue": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\JAWS17.exe\\}\"" + } + ], + "setFalse": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "jfw.exe" + }, + { + "type": "gpii.windows.closeProcessByName", + "filename": "fsSynth32.exe" + }, + { + "type": "gpii.windows.closeProcessByName", + "filename": "jhookldr.exe" + } + ] + } + }] + }; +}; + +gpii.tests.conflictingApps.NVDAHandlerEntry = function (running) { + return { + "org.nvda-project": [{ + "settings": { + "running": running + }, + "options": { + "verifySettings": true, + "getState": [ + { + "type": "gpii.processReporter.find", + "command": "nvda" + } + ], + "setTrue": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\nvda.exe\\}\"" + } + ], + "setFalse": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "nvda_service.exe" + },{ + "type": "gpii.windows.closeProcessByName", + "filename": "nvda.exe" + } + ] + } + }] + }; +}; + +gpii.tests.conflictingApps.testDefs = [ + { + name: "Only one screenreader is launched", + userToken: "screenreader_common", + initialState: { + "gpii.launchHandlers.flexibleHandler": fluid.extend({}, + gpii.tests.conflictingApps.jawsHandlerEntry(false), + gpii.tests.conflictingApps.NVDAHandlerEntry(false)) + }, + settingsHandlers: { + + "gpii.settingsHandlers.INISettingsHandler": { + "org.nvda-project": [ + { + "settings": { + "speech.espeak.rate": 17, + "speech.espeak.volume": 75, + "speech.espeak.pitch": 15, + "speech.espeak.rateBoost": true, + "speech.symbolLevel": 300, + "speech.espeak.voice": "en\\en-wi", + "reviewCursor.followFocus": false, + "reviewCursor.followCaret": true, + "reviewCursor.followMouse": true, + "keyboard.speakTypedWords": true, + "keyboard.speakTypedCharacters": false, + "presentation.reportHelpBalloons": false, + "speech.espeak.sayCapForCapitals": true + }, + "options": { + "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", + "allowNumberSignComments": true, + "allowSubSections": true + } + } + ], + "com.freedomscientific.jaws": [ + { + "settings": { + "Voice Profiles.ActiveVoiceProfileName": "GPII", + "options.SayAllIndicateCaps": true, + "options.TypingEcho": 2 + }, + "options": { + "filename": "${{environment}.APPDATA}\\Freedom Scientific\\JAWS\\17.0\\Settings\\enu\\DEFAULT.JCF" + } + }, + + { + "settings": { + "ENU-Global.Rate": 400, + "ENU-Global.Punctuation": 3, + "ENU-Global.Pitch": 16, + "ENU-Message.Rate": 400, + "ENU-Message.Punctuation": 3, + "ENU-Message.Pitch": 16, + "ENU-Keyboard.Rate": 400, + "ENU-Keyboard.Punctuation": 3, + "ENU-Keyboard.Pitch": 16, + "ENU-PCCursor.Rate": 400, + "ENU-PCCursor.Punctuation": 3, + "ENU-PCCursor.Pitch": 16, + "ENU-JAWSCursor.Rate": 400, + "ENU-JAWSCursor.Punctuation": 3, + "ENU-JAWSCursor.Pitch": 16, + "ENU-MenuAndDialog.Rate": 400, + "ENU-MenuAndDialog.Punctuation": 3, + "ENU-MenuAndDialog.Pitch": 16 + }, + "options": { + "filename": "${{environment}.APPDATA}\\Freedom Scientific\\JAWS\\17.0\\Settings\\VoiceProfiles\\GPII.VPF" + } + } + ] + }, + "gpii.launchHandlers.flexibleHandler": fluid.extend({}, + gpii.tests.conflictingApps.jawsHandlerEntry(false), + gpii.tests.conflictingApps.NVDAHandlerEntry(true)) + } + }, { + name: "Conflicting screenreader (jaws) is closed is Only one screenreader is launched", + userToken: "screenreader_common", + initialState: { + "gpii.launchHandlers.flexibleHandler": fluid.extend({}, + gpii.tests.conflictingApps.jawsHandlerEntry(true), + gpii.tests.conflictingApps.NVDAHandlerEntry(false)) + }, + settingsHandlers: { + + "gpii.settingsHandlers.INISettingsHandler": { + "org.nvda-project": [ + { + "settings": { + "speech.espeak.rate": 17, + "speech.espeak.volume": 75, + "speech.espeak.pitch": 15, + "speech.espeak.rateBoost": true, + "speech.symbolLevel": 300, + "speech.espeak.voice": "en\\en-wi", + "reviewCursor.followFocus": false, + "reviewCursor.followCaret": true, + "reviewCursor.followMouse": true, + "keyboard.speakTypedWords": true, + "keyboard.speakTypedCharacters": false, + "presentation.reportHelpBalloons": false, + "speech.espeak.sayCapForCapitals": true + }, + "options": { + "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", + "allowNumberSignComments": true, + "allowSubSections": true + } + } + ], + "com.freedomscientific.jaws": [ + { + "settings": { + "Voice Profiles.ActiveVoiceProfileName": "GPII", + "options.SayAllIndicateCaps": true, + "options.TypingEcho": 2 + }, + "options": { + "filename": "${{environment}.APPDATA}\\Freedom Scientific\\JAWS\\17.0\\Settings\\enu\\DEFAULT.JCF" + } + }, + + { + "settings": { + "ENU-Global.Rate": 400, + "ENU-Global.Punctuation": 3, + "ENU-Global.Pitch": 16, + "ENU-Message.Rate": 400, + "ENU-Message.Punctuation": 3, + "ENU-Message.Pitch": 16, + "ENU-Keyboard.Rate": 400, + "ENU-Keyboard.Punctuation": 3, + "ENU-Keyboard.Pitch": 16, + "ENU-PCCursor.Rate": 400, + "ENU-PCCursor.Punctuation": 3, + "ENU-PCCursor.Pitch": 16, + "ENU-JAWSCursor.Rate": 400, + "ENU-JAWSCursor.Punctuation": 3, + "ENU-JAWSCursor.Pitch": 16, + "ENU-MenuAndDialog.Rate": 400, + "ENU-MenuAndDialog.Punctuation": 3, + "ENU-MenuAndDialog.Pitch": 16 + }, + "options": { + "filename": "${{environment}.APPDATA}\\Freedom Scientific\\JAWS\\17.0\\Settings\\VoiceProfiles\\GPII.VPF" + } + } + ] + }, + "gpii.launchHandlers.flexibleHandler": fluid.extend({}, + gpii.tests.conflictingApps.jawsHandlerEntry(false), + gpii.tests.conflictingApps.NVDAHandlerEntry(true)) + } + } +]; + +module.exports = gpii.test.bootstrap({ + testDefs: "gpii.tests.conflictingApps.testDefs", + configName: "gpii.tests.multiScreenreader.config", + configPath: "%universal/tests/configs" +}, ["gpii.test.integration.testCaseHolder.windows"], + module, require, __dirname); diff --git a/tests/JournalIntegrationTests.js b/tests/JournalIntegrationTests.js index 219a9a23b..0a7719d7e 100644 --- a/tests/JournalIntegrationTests.js +++ b/tests/JournalIntegrationTests.js @@ -98,6 +98,20 @@ gpii.tests.journal.initialSettings = { } }; +gpii.tests.journal.settingsAfterCrash = { + "gpii.windows.enableRegisteredAT": { + "com.microsoft.windows.magnifier": [{ + "settings": { + "running": false + }, + "options": { + "registryName": "magnifierpane", + "queryProcess": "Magnify" + } + }] + } +}; + fluid.defaults("gpii.tests.journal.solutionsRegistryAdvisor", { gradeNames: "fluid.modelComponent", model: { @@ -332,8 +346,6 @@ gpii.tests.journal.stashInitial = function (settingsHandlersPayload, settingsSto // with values all `undefined` will confuse jqUnit.assertDeepEq in gpii.test.checkConfiguration settingsHandlers["gpii.windows.spiSettingsHandler"] = fluid.filterKeys(settingsHandlers["gpii.windows.spiSettingsHandler"], "com.microsoft.windows.mouseTrailing"); settingsHandlers["gpii.windows.registrySettingsHandler"] = fluid.filterKeys(settingsHandlers["gpii.windows.registrySettingsHandler"], "com.microsoft.windows.magnifier"); - // settingsHandlers["gpii.windows.spiSettingsHandler"]["com.microsoft.windows.mouseTrailing"].length = 1; - // settingsHandlers["gpii.windows.registrySettingsHandler"]["com.microsoft.windows.magnifier"].length = 1; testCaseHolder.settingsHandlers = settingsHandlers; }; @@ -362,7 +374,7 @@ gpii.tests.journal.normalLoginFixtures = [ gpii.tests.journal.fixtures = [ { name: "Journal state and restoration", - expect: 10, + expect: 11, sequenceSegments: [ { func: "gpii.tests.journal.stashJournalId", args: "{testCaseHolder}" @@ -399,6 +411,12 @@ gpii.tests.journal.fixtures = [ }, kettle.test.startServerSequence, { + func: "gpii.test.setSettings", + args: [gpii.tests.journal.settingsAfterCrash, "{nameResolver}", "{testCaseHolder}.events.onInitialSettingsComplete.fire"] + }, { + event: "{tests}.events.onInitialSettingsComplete", + listener: "fluid.identity" + }, { func: "{listJournalsRequest}.send" }, { event: "{listJournalsRequest}.events.onComplete", @@ -487,5 +505,5 @@ gpii.tests.journal.badJournalBaseTestDef = fluid.extend({ kettle.test.bootstrapServer(gpii.test.buildSegmentedFixtures( gpii.tests.journal.fixtures, gpii.tests.journal.baseTestDef)); -kettle.test.bootstrapServer(gpii.test.buildSegmentedFixtures( - gpii.tests.journal.badJournalFixtures, gpii.tests.journal.badJournalBaseTestDef)); +// kettle.test.bootstrapServer(gpii.test.buildSegmentedFixtures( +// gpii.tests.journal.badJournalFixtures, gpii.tests.journal.badJournalBaseTestDef)); diff --git a/tests/configs/gpii.tests.multiScreenreader.config.json b/tests/configs/gpii.tests.multiScreenreader.config.json new file mode 100644 index 000000000..0ce917b80 --- /dev/null +++ b/tests/configs/gpii.tests.multiScreenreader.config.json @@ -0,0 +1,18 @@ +{ + "type": "gpii.tests.multiScreenreader.config", + "options": { + "distributeOptions": { + "multiSH.rawPreferencesDataSource": { + "record": "%universal/testData/preferences/acceptanceTests/%userToken.json", + "target": "{that rawPreferencesServer rawPreferencesDataSource}.options.path", + "priority": "after:development.rawPreferencesDataSource" + }, + "multiSH.deviceReporter": { + "record": "%universal/tests/data/multiScreenreaderDeviceReporter.json", + "target": "{that deviceReporter installedSolutionsDataSource}.options.path", + "priority": "after:development.installedSolutionsPath" + } + } + }, + "mergeConfigs": "%universal/gpii/configs/gpii.config.development.all.local.json" +} diff --git a/tests/configs/gpii.tests.multiScreenreader.config.txt b/tests/configs/gpii.tests.multiScreenreader.config.txt new file mode 100644 index 000000000..4e792098a --- /dev/null +++ b/tests/configs/gpii.tests.multiScreenreader.config.txt @@ -0,0 +1,4 @@ +gpii.tests.multiScreenreader.config.json + +Is used for the integration test CloseConflictingAppsTest. It uses the NP sets of the testData's acceptanceTests folder and a device reporter that reports only two screenreaders (Jaws and NVDA) installed. + diff --git a/tests/data/multiScreenreaderDeviceReporter.json b/tests/data/multiScreenreaderDeviceReporter.json new file mode 100644 index 000000000..5e9147038 --- /dev/null +++ b/tests/data/multiScreenreaderDeviceReporter.json @@ -0,0 +1,9 @@ +[ + { + "id": "com.freedomscientific.jaws" + }, + + { + "id": "org.nvda-project" + } +] diff --git a/tests/platform/windows/configs/gpii.tests.acceptance.windows.builtIn.config.json b/tests/platform/windows/configs/gpii.tests.acceptance.windows.builtIn.config.json index 064856ecb..c7e30261c 100644 --- a/tests/platform/windows/configs/gpii.tests.acceptance.windows.builtIn.config.json +++ b/tests/platform/windows/configs/gpii.tests.acceptance.windows.builtIn.config.json @@ -8,6 +8,6 @@ "priority": "after:development.installedSolutionsPath" } } - }, + }, "mergeConfigs": "%universal/tests/configs/gpii.tests.acceptance.localInstall.config.json" } diff --git a/tests/platform/windows/windows-builtIn-testSpec.js b/tests/platform/windows/windows-builtIn-testSpec.js index ace416f75..e648790f6 100644 --- a/tests/platform/windows/windows-builtIn-testSpec.js +++ b/tests/platform/windows/windows-builtIn-testSpec.js @@ -35,6 +35,12 @@ gpii.tests.windows.builtIn = [ "running": false }, "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20, + retryInterval: 1000 + }, "registryName": "magnifierpane", "queryProcess": "Magnify" } @@ -229,6 +235,12 @@ gpii.tests.windows.builtIn = [ "running": true }, "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20, + retryInterval: 1000 + }, "registryName": "magnifierpane", "queryProcess": "Magnify" } @@ -245,6 +257,12 @@ gpii.tests.windows.builtIn = [ "running": false }, "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20, + retryInterval: 1000 + }, "registryName": "magnifierpane", "queryProcess": "Magnify" } @@ -430,6 +448,12 @@ gpii.tests.windows.builtIn = [ "running": true }, "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20, + retryInterval: 1000 + }, "registryName": "magnifierpane", "queryProcess": "Magnify" } @@ -455,6 +479,12 @@ gpii.tests.windows.builtIn = [ "running": true }, "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20, + retryInterval: 1000 + }, "registryName": "magnifierpane", "queryProcess": "Magnify" } @@ -640,6 +670,12 @@ gpii.tests.windows.builtIn = [ "running": true }, "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20, + retryInterval: 1000 + }, "registryName": "magnifierpane", "queryProcess": "Magnify" } @@ -656,7 +692,7 @@ gpii.tests.windows.builtIn = [ } } }, { - name: "Testing os_common - magnifier running on startup and keyboard both running on startup", + name: "Testing os_common - magnifier and keyboard both running on startup", userToken: "os_common", initialState: { "gpii.windows.enableRegisteredAT": { @@ -665,6 +701,12 @@ gpii.tests.windows.builtIn = [ "running": true }, "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20, + retryInterval: 1000 + }, "registryName": "magnifierpane", "queryProcess": "Magnify" } @@ -850,6 +892,12 @@ gpii.tests.windows.builtIn = [ "running": true }, "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20, + retryInterval: 1000 + }, "registryName": "magnifierpane", "queryProcess": "Magnify" } @@ -875,9 +923,24 @@ gpii.tests.windows.builtIn = [ "running": false }, "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20, + retryInterval: 1000 + }, "registryName": "magnifierpane", "queryProcess": "Magnify" } + }], + "com.microsoft.windows.onscreenKeyboard": [{ + "settings": { + "running": false + }, + "options": { + "registryName": "osk", + "queryProcess": "osk" + } }] } }, @@ -944,6 +1007,12 @@ gpii.tests.windows.builtIn = [ "running": true }, "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20, + retryInterval: 1000 + }, "registryName": "magnifierpane", "queryProcess": "Magnify" } diff --git a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js index ceffbebb3..3a10e4348 100644 --- a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js +++ b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js @@ -24,25 +24,89 @@ gpii.loadTestingSupport(); fluid.registerNamespace("gpii.tests.deviceReporterAware.windows"); -gpii.tests.deviceReporterAware.windows = [ +gpii.tests.deviceReporterAware.windows.flexibleHandlerEntries = { + nvda: function (running) { + return { + "org.nvda-project": [{ + "settings": { + "running": running + }, + "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 20, + retryInterval: 1000 + }, + "getState": [ + { + "type": "gpii.processReporter.find", + "command": "nvda" + } + ], + "setTrue": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\nvda.exe\\}\"" + } + ], + "setFalse": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "nvda_service.exe" + },{ + "type": "gpii.windows.closeProcessByName", + "filename": "nvda.exe" + } + ] + } + }] + }; + }, + readwrite: function (running) { + return { + "com.texthelp.readWriteGold": [{ + "settings": { + "running": running + }, + "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 40, + retryInterval: 1000 + }, + "setTrue": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_CURRENT_USER\\Software\\Texthelp\\Read&Write11\\InstallPath}\\ReadAndWrite.exe\"" + } + ], + "setFalse": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "ReadAndWrite.exe" + } + ], + "getState": [ + { + "type": "gpii.processReporter.find", + "command": "ReadAndWrite" + } + ] + } + }] + } + } +}; + + +gpii.tests.deviceReporterAware.windows.testDefs = [ { name: "Testing screenreader_nvda using Flat matchmaker", userToken: "screenreader_nvda", initialState: { - "gpii.launchHandlers.flexibleHandler": { - "org.nvda-project": [{ - "settings": { - "running": false - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "nvda" - }] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.deviceReporterAware.windows.flexibleHandlerEntries.nvda(false) }, gradeNames: "gpii.test.integration.deviceReporterAware.windows", settingsHandlers: { @@ -74,20 +138,7 @@ gpii.tests.deviceReporterAware.windows = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { - "org.nvda-project": [{ - "settings": { - "running": true - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "nvda" - }] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.deviceReporterAware.windows.flexibleHandlerEntries.nvda(true) }, deviceReporters: { "gpii.deviceReporter.registryKeyExists": { @@ -104,36 +155,10 @@ gpii.tests.deviceReporterAware.windows = [ userToken: "readwritegold_application1", gradeNames: "gpii.test.integration.deviceReporterAware.windows", initialState: { - "gpii.launchHandlers.flexibleHandler": { - "com.texthelp.readWriteGold": [{ - "settings": { - "running": false - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "readandwrite" - }] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.deviceReporterAware.windows.flexibleHandlerEntries.readwrite(false) }, settingsHandlers: { - "gpii.launchHandlers.flexibleHandler": { - "com.texthelp.readWriteGold": [{ - "settings": { - "running": true - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "readandwrite" - }] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.deviceReporterAware.windows.flexibleHandlerEntries.readwrite(true) }, deviceReporters: { "gpii.deviceReporter.registryKeyExists": { @@ -148,7 +173,7 @@ gpii.tests.deviceReporterAware.windows = [ ]; module.exports = gpii.test.bootstrap({ - testDefs: "gpii.tests.deviceReporterAware.windows", + testDefs: "gpii.tests.deviceReporterAware.windows.testDefs", configName: "windows-dynamicDeviceReporter-config", configPath: "%universal/tests/platform/windows/configs" }, ["gpii.test.integration.testCaseHolder.windows", "gpii.test.integration.deviceReporterAware.windows"], diff --git a/tests/platform/windows/windows-jaws-testSpec.js b/tests/platform/windows/windows-jaws-testSpec.js index 89da550e0..24693d37a 100644 --- a/tests/platform/windows/windows-jaws-testSpec.js +++ b/tests/platform/windows/windows-jaws-testSpec.js @@ -38,7 +38,8 @@ gpii.tests.windows.jaws.flexibleHandlerEntry = function (running) { "verifySettings": true, retryOptions: { rewriteEvery: 0, - numRetries: 20 + numRetries: 20, + retryInterval: 1000 }, "getState": [ { diff --git a/tests/platform/windows/windows-nvda-testSpec.js b/tests/platform/windows/windows-nvda-testSpec.js index 19a46c278..fdc6ba26d 100644 --- a/tests/platform/windows/windows-nvda-testSpec.js +++ b/tests/platform/windows/windows-nvda-testSpec.js @@ -38,7 +38,8 @@ gpii.tests.windows.nvda.flexibleHandlerEntry = function (running) { "verifySettings": true, retryOptions: { rewriteEvery: 0, - numRetries: 20 + numRetries: 20, + retryInterval: 1000 }, "getState": [ { @@ -104,107 +105,107 @@ gpii.tests.windows.nvda.testDef = [ }, "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(true) } - // }, { - // name: "Testing screenreader_nvda", - // userToken: "screenreader_nvda", - // initialState: { - // "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(false) - // }, - // settingsHandlers: { - // "gpii.settingsHandlers.INISettingsHandler": { - // "org.nvda-project": [ - // { - // "settings": { - // "speech.espeak.rate": 17, - // "speech.espeak.volume": 80, - // "speech.espeak.pitch": 60, - // "speech.espeak.rateBoost": true, - // "speech.synth": "espeak", - // "speech.outputDevice": "Microsoft Sound Mapper", - // "speech.symbolLevel": 300, - // "speech.espeak.voice": "en\\en-wi", - // "reviewCursor.followFocus": false, - // "reviewCursor.followCaret": true, - // "reviewCursor.followMouse": true, - // "keyboard.speakTypedWords": true, - // "keyboard.speakTypedCharacters": false, - // "presentation.reportHelpBalloons": false, - // "speech.espeak.sayCapForCapitals": true - // }, - // "options": { - // "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", - // "allowNumberSignComments": true, - // "allowSubSections": true - // } - // } - // ] - // }, - // "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(true) - // } - // }, { - // name: "Testing screenreader_common", - // userToken: "screenreader_common", - // initialState: { - // "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(false) - // }, - // settingsHandlers: { - // "gpii.settingsHandlers.INISettingsHandler": { - // "org.nvda-project": [ - // { - // "settings": { - // "speech.espeak.rate": 17, - // "speech.espeak.volume": 75, - // "speech.espeak.pitch": 15, - // "speech.espeak.rateBoost": true, - // "speech.symbolLevel": 300, - // "speech.espeak.voice": "en\\en-wi", - // "reviewCursor.followFocus": false, - // "reviewCursor.followCaret": true, - // "reviewCursor.followMouse": true, - // "keyboard.speakTypedWords": true, - // "keyboard.speakTypedCharacters": false, - // "presentation.reportHelpBalloons": false, - // "speech.espeak.sayCapForCapitals": true - // }, - // "options": { - // "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", - // "allowNumberSignComments": true, - // "allowSubSections": true - // } - // } - // ] - // }, - // "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(true) - // } - // }, { - // name: "Testing screenreader_orca", - // userToken: "screenreader_orca", - // initialState: { - // "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(false) - // }, - // settingsHandlers: { - // "gpii.settingsHandlers.INISettingsHandler": { - // "org.nvda-project": [ - // { - // "settings": { - // "speech.symbolLevel": 300, - // "speech.espeak.rate": 17, - // "speech.espeak.voice": "en\\en-wi", - // "keyboard.speakTypedWords": true, - // "speech.espeak.rateBoost": true, - // "keyboard.speakTypedCharacters": false, - // "presentation.reportHelpBalloons": false - // }, - // "options": { - // "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", - // "allowNumberSignComments": true, - // "allowSubSections": true - // } - // } - // ] - // }, - // "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(true) - // } + }, { + name: "Testing screenreader_nvda", + userToken: "screenreader_nvda", + initialState: { + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(false) + }, + settingsHandlers: { + "gpii.settingsHandlers.INISettingsHandler": { + "org.nvda-project": [ + { + "settings": { + "speech.espeak.rate": 17, + "speech.espeak.volume": 80, + "speech.espeak.pitch": 60, + "speech.espeak.rateBoost": true, + "speech.synth": "espeak", + "speech.outputDevice": "Microsoft Sound Mapper", + "speech.symbolLevel": 300, + "speech.espeak.voice": "en\\en-wi", + "reviewCursor.followFocus": false, + "reviewCursor.followCaret": true, + "reviewCursor.followMouse": true, + "keyboard.speakTypedWords": true, + "keyboard.speakTypedCharacters": false, + "presentation.reportHelpBalloons": false, + "speech.espeak.sayCapForCapitals": true + }, + "options": { + "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", + "allowNumberSignComments": true, + "allowSubSections": true + } + } + ] + }, + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(true) + } + }, { + name: "Testing screenreader_common", + userToken: "screenreader_common", + initialState: { + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(false) + }, + settingsHandlers: { + "gpii.settingsHandlers.INISettingsHandler": { + "org.nvda-project": [ + { + "settings": { + "speech.espeak.rate": 17, + "speech.espeak.volume": 75, + "speech.espeak.pitch": 15, + "speech.espeak.rateBoost": true, + "speech.symbolLevel": 300, + "speech.espeak.voice": "en\\en-wi", + "reviewCursor.followFocus": false, + "reviewCursor.followCaret": true, + "reviewCursor.followMouse": true, + "keyboard.speakTypedWords": true, + "keyboard.speakTypedCharacters": false, + "presentation.reportHelpBalloons": false, + "speech.espeak.sayCapForCapitals": true + }, + "options": { + "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", + "allowNumberSignComments": true, + "allowSubSections": true + } + } + ] + }, + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(true) + } + }, { + name: "Testing screenreader_orca", + userToken: "screenreader_orca", + initialState: { + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(false) + }, + settingsHandlers: { + "gpii.settingsHandlers.INISettingsHandler": { + "org.nvda-project": [ + { + "settings": { + "speech.symbolLevel": 300, + "speech.espeak.rate": 17, + "speech.espeak.voice": "en\\en-wi", + "keyboard.speakTypedWords": true, + "speech.espeak.rateBoost": true, + "keyboard.speakTypedCharacters": false, + "presentation.reportHelpBalloons": false + }, + "options": { + "filename": "${{environment}.APPDATA}\\nvda\\nvda.ini", + "allowNumberSignComments": true, + "allowSubSections": true + } + } + ] + }, + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.nvda.flexibleHandlerEntry(true) + } } ]; diff --git a/tests/platform/windows/windows-readWrite-testSpec.js b/tests/platform/windows/windows-readWrite-testSpec.js index 77a00f367..755663af5 100644 --- a/tests/platform/windows/windows-readWrite-testSpec.js +++ b/tests/platform/windows/windows-readWrite-testSpec.js @@ -19,40 +19,55 @@ fluid.require("%universal"); gpii.loadTestingSupport(); -fluid.registerNamespace("gpii.tests.windows"); +fluid.registerNamespace("gpii.tests.windows.readwrite"); -gpii.tests.windows.readWrite = [ +// To avoid duplicating this entire piece in each test. Given a true or false value +// as input, this will return a settingshandler entry, containing all the options from +// the solutions registry entry for NVDAs launchHandler, with a settings block with +// running: X - where X is replaced with the input parameter +gpii.tests.windows.readwrite.flexibleHandlerEntry = function (running) { + return { + "com.texthelp.readWriteGold": [{ + "settings": { + "running": running + }, + "options": { + "verifySettings": true, + retryOptions: { + rewriteEvery: 0, + numRetries: 40, + retryInterval: 1000 + }, + "setTrue": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_CURRENT_USER\\Software\\Texthelp\\Read&Write11\\InstallPath}\\ReadAndWrite.exe\"" + } + ], + "setFalse": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "ReadAndWrite.exe" + } + ], + "getState": [ + { + "type": "gpii.processReporter.find", + "command": "ReadAndWrite" + } + ] + } + }] + }; +}; + + +gpii.tests.windows.readwrite.testDefs = [ { name: "Testing rwg1 - running on login", userToken: "rwg1", initialState: { - "gpii.launchHandlers.flexibleHandler": { - "com.texthelp.readWriteGold": [{ - "settings": { - "running": true - }, - "options": { - "setTrue": [ - { - "type": "gpii.launch.exec", - "command": "\"${{registry}.HKEY_CURRENT_USER\\Software\\Texthelp\\Read&Write11\\InstallPath}\\ReadAndWrite.exe\"" - } - ], - "setFalse": [ - { - "type": "gpii.windows.closeProcessByName", - "filename": "ReadAndWrite.exe" - } - ], - "getState": [ - { - "type": "gpii.processReporter.find", - "command": "readandwrite" - } - ] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.readwrite.flexibleHandlerEntry(true) }, settingsHandlers: { "gpii.settingsHandlers.XMLHandler": { @@ -86,52 +101,13 @@ gpii.tests.windows.readWrite = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { - "com.texthelp.readWriteGold": [{ - "settings": { - "running": true - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "readandwrite" - }] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.readwrite.flexibleHandlerEntry(true) } }, { name: "Testing rwg1", userToken: "rwg1", initialState: { - "gpii.launchHandlers.flexibleHandler": { - "com.texthelp.readWriteGold": [{ - "settings": { - "running": false - }, - "options": { - "setTrue": [ - { - "type": "gpii.launch.exec", - "command": "\"${{registry}.HKEY_CURRENT_USER\\Software\\Texthelp\\Read&Write11\\InstallPath}\\ReadAndWrite.exe\"" - } - ], - "setFalse": [ - { - "type": "gpii.windows.closeProcessByName", - "filename": "ReadAndWrite.exe" - } - ], - "getState": [ - { - "type": "gpii.processReporter.find", - "command": "readandwrite" - } - ] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.readwrite.flexibleHandlerEntry(false) }, settingsHandlers: { "gpii.settingsHandlers.XMLHandler": { @@ -165,52 +141,13 @@ gpii.tests.windows.readWrite = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { - "com.texthelp.readWriteGold": [{ - "settings": { - "running": true - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "readandwrite" - }] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.readwrite.flexibleHandlerEntry(true) } }, { name: "Testing rwg2", userToken: "rwg2", initialState: { - "gpii.launchHandlers.flexibleHandler": { - "com.texthelp.readWriteGold": [{ - "settings": { - "running": false - }, - "options": { - "setTrue": [ - { - "type": "gpii.launch.exec", - "command": "\"${{registry}.HKEY_CURRENT_USER\\Software\\Texthelp\\Read&Write11\\InstallPath}\\ReadAndWrite.exe\"" - } - ], - "setFalse": [ - { - "type": "gpii.windows.closeProcessByName", - "filename": "ReadAndWrite.exe" - } - ], - "getState": [ - { - "type": "gpii.processReporter.find", - "command": "readandwrite" - } - ] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.readwrite.flexibleHandlerEntry(false) }, settingsHandlers: { "gpii.settingsHandlers.XMLHandler": { @@ -246,26 +183,13 @@ gpii.tests.windows.readWrite = [ } ] }, - "gpii.launchHandlers.flexibleHandler": { - "com.texthelp.readWriteGold": [{ - "settings": { - "running": true - }, - "options": { - // setTrue and setFalse blocks omitted for size/clarity - "getState": [{ - "type": "gpii.processReporter.find", - "command": "readandwrite" - }] - } - }] - } + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.readwrite.flexibleHandlerEntry(true) } } ]; module.exports = gpii.test.bootstrap({ - testDefs: "gpii.tests.windows.readWrite", + testDefs: "gpii.tests.windows.readwrite.testDefs", configName: "gpii.tests.acceptance.windows.readWrite.config", configPath: "%universal/tests/platform/windows/configs" }, ["gpii.test.integration.testCaseHolder.windows"], From c4ecb80a9e085f906618903c51d40c35e5ee4e70 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 19 Apr 2017 09:50:30 +0200 Subject: [PATCH 15/44] GPII-2106: Added reference to JIRA for which a test case showed fix --- .../lifecycleManager/test/js/LifecycleManagerTests.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index 4e0ae3c52..fea9be16d 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -498,7 +498,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt }; gpii.tests.lifecycleManager.startTestDefs = [{ - name: "Solution with only start and stop blocks", + name: "Solution with only start and stop blocks (GPII-2106)", basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( "org.gnome.desktop.a11y.magnifier", { @@ -785,7 +785,6 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt }]; - gpii.tests.lifecycleManager.completeLifecycleTests = [{ name: "Updating with normal reference to settingsHandler block, and a an application not in the original settings applied to the system", expect: 9, From eb2a8c3993b360c72fa1123f79876225d509fc30 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 19 Apr 2017 16:10:22 +0200 Subject: [PATCH 16/44] GPII-1230: Linted and cleaned code a bit --- documentation/CanopyMatchMaker.md | 7 +- documentation/MatchMakerFramework.md | 8 +- ....config.all.development.pr.production.json | 15 -- ...i.config.all.development.pr.production.txt | 23 --- .../test/js/LifecycleManagerTests.js | 17 -- gpii/node_modules/processReporter/README.md | 55 +----- gpii/node_modules/testing/src/Testing.js | 3 - .../processReporter/runningSolutions.json | 172 ------------------ tests/JournalIntegrationTests.js | 4 +- .../windows-dynamicDeviceReporter-testSpec.js | 2 +- .../windows/windows-readWrite-testSpec.js | 2 +- 11 files changed, 16 insertions(+), 292 deletions(-) delete mode 100644 gpii/configs/gpii.config.all.development.pr.production.json delete mode 100644 gpii/configs/gpii.config.all.development.pr.production.txt delete mode 100644 testData/processReporter/runningSolutions.json diff --git a/documentation/CanopyMatchMaker.md b/documentation/CanopyMatchMaker.md index 51df9a45f..b0aed4d79 100644 --- a/documentation/CanopyMatchMaker.md +++ b/documentation/CanopyMatchMaker.md @@ -25,13 +25,16 @@ To ensure that several conflicting solutions (e.g. two screenreaders) are not la The apptology is described in more details here: [Apptology.md](Apptology.md). +## Dispositions +As described below, the matchmaker will assign a disposition to each solution based on priority and canopy matching. There are three dispositions available: "accept", "reject" and "deactivate". "accept" means that the solution will be accepted (and started, if relevant for that solution). "reject" means we do not do anything to the solution. "deactivate" means that we ensure that the solution is not running (i.e. running stop if required). The latter case is relevant for solutions that are conflicting with other solutions that the user might need. + ## Disposing from prioriy: Explicit priorities are declared in the NP sets metadata section and will always be a floating point value of 1024 or more. Implicit priorities are deduced from application specific settings. When a user has application specific settings for a solution a priority of 512 is set for that solution. Goes through all solutions from high priority to low. If a solution already has a disposition, it is ignored. Else it will be selected (accepted). Any solution with the same type, but a lower priority (or no priority) will be rejected. If there are two or more solutions of the same priority _and_ the same type (even partly), these will be considered a "tie". All lower-priority solutions of this type will still be rejected. The tied solutions will have their current disposition and priority removed and left to be disposed by some other disposal algorithm. ## Disposing from Canopy -The Canopy matching strategy is used for deciding how to dispose solutions in case no priorities are available or there is a priority-tie between two applications of the same type. +The Canopy matching strategy is used for deciding how to dispose solutions in case no priorities are available or there is a priority-tie between two applications of the same type. * The canopy approach is based on a vectorial "fitness measure" of a solution plus a lexicographical ordering * It is similar to the strategy used in resolving CSS rules. @@ -45,7 +48,7 @@ The Canopy matching strategy is used for deciding how to dispose solutions in ca * Compute capabilities of solution * Compute vector of prefix depths for each leaf el path from NP set * Sort vector in descending order of fitness ("fitness vector") -* Rank solutions by fitness using lexicographic ordering +* Rank solutions by fitness using lexicographic ordering *The canopy matching* * Compute fitness vectors for each solution and sort in rank order diff --git a/documentation/MatchMakerFramework.md b/documentation/MatchMakerFramework.md index 9a4b3f9c1..65dcfbca6 100644 --- a/documentation/MatchMakerFramework.md +++ b/documentation/MatchMakerFramework.md @@ -46,7 +46,7 @@ Like all other Kettle apps, the Matchmaker Framework is defined by a config file ## API: -The matchmakers that can be called from the Matchmaker Framework need to adhere to the following API. +The matchmakers that can be called from the Matchmaker Framework need to adhere to the following API. ### URL: `/match` @@ -109,7 +109,7 @@ The input for these POST requests will be in the following format. Note that it } ] }, - environmentReporter: { + environmentReporter: { "http://registry.gpii.net/terms/environment/brightness": 60, "http://registry.gpii.net/terms/environment/sound": -6 "http://registry.gpii.net/terms/environment/timeOfDay": "18:29:00" @@ -121,7 +121,7 @@ The input for these POST requests will be in the following format. Note that it "gpii-default", "nighttime-at-home" ], - inverseCapabilities: { + inverseCapabilities: { "com.microsoft.windows.cursors": { "http://registry.gpii.net/common/mouseTrailing": 0.8, (...), @@ -148,7 +148,7 @@ The input for these POST requests will be in the following format. Note that it ### Return payload -The return payload from at call to `/match` should be in the following format: +The return payload from at call to `/match` should be in the following format. The "active" key expresses whether the application should be set to running. A `true` value means that it should be running, `undefined` means we leave it in its current run state and `false` mean we should actively ensure that it is not running. ``` { diff --git a/gpii/configs/gpii.config.all.development.pr.production.json b/gpii/configs/gpii.config.all.development.pr.production.json deleted file mode 100644 index e07369298..000000000 --- a/gpii/configs/gpii.config.all.development.pr.production.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "type": "all.development.pr.production", - "options": { - "distributeOptions": { - "gpii.config.deviceReporter.flowManager": { - "record": "{flowManager}.solutionsRegistryDataSource", - "target": "{that gpii.deviceReporter.live}.options.components.solutionsRegistryDataSource" - } - } - }, - "mergeConfigs": [ - "%deviceReporter/configs/gpii.deviceReporter.config.production.json", - "%universal/gpii/configs/gpii.config.development.base.local.json" - ] -} diff --git a/gpii/configs/gpii.config.all.development.pr.production.txt b/gpii/configs/gpii.config.all.development.pr.production.txt deleted file mode 100644 index 70b67de80..000000000 --- a/gpii/configs/gpii.config.all.development.pr.production.txt +++ /dev/null @@ -1,23 +0,0 @@ -all.development.pr.production.json -================================== - -This configuration runs the entire system locally and in development mode with the exception of the processReporter, -which runs in production mode. - -This mean that: -* All storage is on the local filesystem (as opposed to couchDB servers/remote URLs) -* The following components are running on the local machine: -** flowManager -** preferencesServer -** OntologyHandler -** rawPreferencesServer (reading preferences from file) -** solutionsRegistry (reading registry from file) -** deviceReporter (reading device context info from file) -** processReporter (reading processes dynamically) -** matchMakerFramework -** flatMatchMaker -** lifecycleManager - -Notes on testing: -This setup is used as a basis for the platform specific acceptance tests that make use of a dynamic process reporter. -Since the acceptance tests might use slightly different paths for the tests (ie. a special folder for reading prefs and solutionsRegistry), what is actually being used for testing is a slight variation of this config. For more details, see the txt files describing the configs in the acceptance tests folder of both universal and the platform specific repositories. diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index fea9be16d..ab2d935c2 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -428,23 +428,6 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt } }; - // TODO KASPER: Remove this and all references (probably) - gpii.tests.lifecycleManager.assertExpectedExec = function () { - jqUnit.assertDeepEq("Exec handler fired with expected arguments", { - "command": gpii.tests.lifecycleManager.fakeEnvironment.JAWS_DIR + "jaws.exe", - args: ["-settingsDirectory", gpii.tests.lifecycleManager.fakeEnvironment.WINDIR] - }, gpii.tests.lifecycleManager.staticRepository.execHandler); - }; - - gpii.tests.lifecycleManager.assertNoExec = function () { - jqUnit.assertUndefined("Exec handler has not been fired", - gpii.tests.lifecycleManager.staticRepository.execHandler); - }; - - gpii.tests.lifecycleManager.assertExpectedSettingsHandler = function (message, expected) { - jqUnit.assertDeepEq("expected input sent to settingsHandler" + message, expected, gpii.tests.lifecycleManager.staticRepository.settingsHandler); - }; - gpii.tests.lifecycleManager.settingsHandlerOriginalSystemSettings = { "org.gnome.desktop.a11y.magnifier": [{ "settings": { diff --git a/gpii/node_modules/processReporter/README.md b/gpii/node_modules/processReporter/README.md index 31f41d051..c5bacc17a 100644 --- a/gpii/node_modules/processReporter/README.md +++ b/gpii/node_modules/processReporter/README.md @@ -1,21 +1,7 @@ Process Reporter === -A server app deployed with a node.js server that returns the running status of a solution. - -### Process Reporter API - -The app currently supports the following urls: - - {urlToProcessReporterServer}/processes // GET ONLY - {urlToProcessReporterServer}/processes/{solution} // GET ONLY - -The first form cycles through the solutions registry, and for each entry, determines if the associated processes are running. The second form reports only the solution requested, for example: - - {urlToProcessReporterServer}/processes/org.gnome.desktop.a11y.magnifier - -In both cases, the Process Reporter uses the information stored in the `isRunning` block of a solutions registry entry. For example, the `isRunning` block for the Orca screen reader (the solution entry `org.gnome.orca`) is as -follows: +The Process Reporter uses the information stored in the `isRunning` block of a solutions registry entry to decide whether a solution is running. For example, the `isRunning` block for the Linux screen reader Orca (the solution entry `org.gnome.orca`) is as follows: ``` "isRunning": [ { @@ -25,47 +11,12 @@ follows: ] ``` -The payload returned is an array of solutions and their run state, followed by the platform: -``` -{ - "solutions": [ - { - "id": "org.gnome.desktop.a11y.applications", - "running": true - }, - { - "id": "org.gnome.orca", - "running": false - }, - ... - ], - "OS": - { - "id": "linux", - "version": "4.5.7-300.fc24.x86-64" -}} -``` - -If the status of only one solution is requested, then the payload is limited to that solution: +The main function is `gpii.processReporter.handleIsRunning`, which given a solutions registry entry will return `true` or `false` depending on whether the solution is running. -``` -{ - "solutions": - { - "id": "org.gnome.orca", - "running":false - }, - "OS": - { - "id": "linux", - "version": "4.5.7-300.fc24.x86-64" - } -} -``` ### Special cases -If the solutions registry entry does not have an `isRunning` block, then the solution is skipped and nothing is reported about its run-state. NOTE: This may be incorrect, and is currently under review. +If the solutions registry entry does not have an `isRunning` block, then `gpii.processReporter.handleIsRunning` will return undefined. Most solutions run-state is based on a corresponding entry in the underlying OS's process or tasklist table. For example, the Linux/GNOME solution `org.gnome.orca` is running if the `orca` screen reader process is running. Similarly, on Windows, `org.nvda-project` is running if there is an `nvda` process in the tasklist. Some solutions, however, are not strictly process-oriented. An example is the GNOME Shell screen magnifier (solution `org.gnome.desktop.a11y.magnifier`). The magnifier is not a separate process, but is built into GNOME Shell. The magnifier is running if (1) the `gnome-shell` process is running and (2) the `org.gnome.desktop.a11y.applications screen-magnifier-enabled` GSetting is `true`. diff --git a/gpii/node_modules/testing/src/Testing.js b/gpii/node_modules/testing/src/Testing.js index 7beb91481..d25911b71 100644 --- a/gpii/node_modules/testing/src/Testing.js +++ b/gpii/node_modules/testing/src/Testing.js @@ -192,9 +192,6 @@ gpii.test.checkConfiguration = function (settingsHandlers, nameResolver, onCompl configPromise.then(function (config) { var noOptions = gpii.test.extractSettingsBlocks(settingsHandlers); jqUnit.assertDeepEq(customMsg || "Checking that settings are set", noOptions, config); - // console.log(JSON.stringify(noOptions, null, 2)) - // console.log("VS") - // console.log(JSON.stringify(config, null, 2)) onComplete(); }); }; diff --git a/testData/processReporter/runningSolutions.json b/testData/processReporter/runningSolutions.json deleted file mode 100644 index 8abfd8459..000000000 --- a/testData/processReporter/runningSolutions.json +++ /dev/null @@ -1,172 +0,0 @@ -[ - { - "id": "org.gnome.desktop.interface", - "runnning": true - }, - - { - "id": "org.gnome.shell.overrides", - "runnning": true - }, - - { - "id": "org.gnome.desktop.wm.preferences", - "runnning": true - }, - - { - "id": "org.gnome.nautilus", - "runnning": true - }, - - { - "id": "org.gnome.desktop.a11y.keyboard", - "runnning": true - }, - - { - "id": "org.gnome.desktop.a11y.applications.onscreen-keyboard", - "runnning": true - }, - - { - "id": "org.gnome.orca", - "runnning": true - }, - - { - "id": "org.gnome.desktop.a11y.magnifier", - "runnning": true - }, - - { - "id": "com.microsoft.windows.magnifier", - "runnning": true - }, - - { - "id": "com.microsoft.windows.onscreenKeyboard", - "runnning": true - }, - - { - "id": "org.nvda-project", - "runnning": true - }, - - { - "id": "org.gnome.desktop.interface", - "runnning": true - }, - - { - "id": "org.gnome.nautilus", - "runnning": true - }, - - { - "id": "trace.easyOne.communicator.windows", - "runnning": true - }, - - { - "id": "trace.easyOne.communicator.linux", - "runnning": true - }, - - { - "id": "trace.easyOne.sudan.windows", - "runnning": true - }, - - { - "id": "trace.easyOne.sudan.linux", - "runnning": true - }, - - { - "id": "webinsight.webAnywhere.windows", - "runnning": true - }, - - { - "id": "webinsight.webAnywhere.linux", - "runnning": true - }, - - { - "id": "com.texthelp.readWriteGold", - "runnning": true - }, - - { - "id": "net.opendirective.maavis", - "runnning": true - }, - - { - "id": "com.microsoft.windows.highContrast", - "runnning": true - }, - - { - "id": "com.microsoft.windows.mouseTrailing", - "runnning": true - }, - - { - "id": "com.microsoft.windows.cursors", - "runnning": true - }, - - { - "id": "com.android.activitymanager", - "runnning": true - }, - - { - "id": "com.android.talkback", - "runnning": true - }, - - { - "id": "com.android.freespeech", - "runnning": true - }, - - { - "id": "org.chrome.cloud4chrome", - "runnning": true - }, - - { - "id": "com.android.settings.secure", - "runnning": true - }, - - { - "id": "com.android.audioManager", - "runnning": true - }, - - { - "id": "com.android.persistentConfiguration", - "runnning": true - }, - - { - "id": "org.alsa-project", - "runnning": true - }, - - { - "id": "org.freedesktop.xrandr", - "runnning": true - }, - - { - "id": "com.android.settings.system", - "runnning": true - } - -] diff --git a/tests/JournalIntegrationTests.js b/tests/JournalIntegrationTests.js index 0a7719d7e..f649d934b 100644 --- a/tests/JournalIntegrationTests.js +++ b/tests/JournalIntegrationTests.js @@ -505,5 +505,5 @@ gpii.tests.journal.badJournalBaseTestDef = fluid.extend({ kettle.test.bootstrapServer(gpii.test.buildSegmentedFixtures( gpii.tests.journal.fixtures, gpii.tests.journal.baseTestDef)); -// kettle.test.bootstrapServer(gpii.test.buildSegmentedFixtures( -// gpii.tests.journal.badJournalFixtures, gpii.tests.journal.badJournalBaseTestDef)); +kettle.test.bootstrapServer(gpii.test.buildSegmentedFixtures( + gpii.tests.journal.badJournalFixtures, gpii.tests.journal.badJournalBaseTestDef)); diff --git a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js index 3a10e4348..12f2fd06b 100644 --- a/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js +++ b/tests/platform/windows/windows-dynamicDeviceReporter-testSpec.js @@ -96,7 +96,7 @@ gpii.tests.deviceReporterAware.windows.flexibleHandlerEntries = { ] } }] - } + }; } }; diff --git a/tests/platform/windows/windows-readWrite-testSpec.js b/tests/platform/windows/windows-readWrite-testSpec.js index 755663af5..7d6878adf 100644 --- a/tests/platform/windows/windows-readWrite-testSpec.js +++ b/tests/platform/windows/windows-readWrite-testSpec.js @@ -183,7 +183,7 @@ gpii.tests.windows.readwrite.testDefs = [ } ] }, - "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.readwrite.flexibleHandlerEntry(true) + "gpii.launchHandlers.flexibleHandler": gpii.tests.windows.readwrite.flexibleHandlerEntry(true) } } ]; From 1afe72434ded0c1e7ca8fd68949b4e4c089eed15 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 19 Apr 2017 18:12:34 +0200 Subject: [PATCH 17/44] GPII-1230: Fixed failing web-based test --- .../lifecycleManager/test/js/LifecycleManagerTests.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index ab2d935c2..42923b8ab 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -1042,7 +1042,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt var expected = gpii.tests.lifecycleManager.settingsToChanges(gpii.tests.lifecycleManager.invokeSettingsHandlersExpectedSnapshot); snapshotPromise.then(function (snapshot) { jqUnit.assertDeepEq("invokeSettingsHandlers produced snapshot", expected, snapshot); - gpii.tests.lifecycleManager.assertExpectedSettingsHandler(" - standalone", gpii.tests.lifecycleManager.settingsHandlerExpectedInputNewSettings); + jqUnit.assertDeepEq("expected input sent to settingsHandler", gpii.tests.lifecycleManager.settingsHandlerExpectedInputNewSettings, gpii.tests.lifecycleManager.staticRepository.settingsHandler); jqUnit.start(); }); }); From 6db70de4b5c489f6e68e288b4322ddd6331b6f32 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 19 Apr 2017 18:14:32 +0200 Subject: [PATCH 18/44] GPII-1230: Fixed failing web based test --- .../html/PrivacySettings-test.html | 1 + .../test/js/LifecycleManagerTests.js | 68 +------------------ 2 files changed, 2 insertions(+), 67 deletions(-) diff --git a/gpii/node_modules/gpii-oauth2/gpii-oauth2-authz-server/webTests/components/privacySettings/html/PrivacySettings-test.html b/gpii/node_modules/gpii-oauth2/gpii-oauth2-authz-server/webTests/components/privacySettings/html/PrivacySettings-test.html index 5a1d5296b..9e2962eb5 100644 --- a/gpii/node_modules/gpii-oauth2/gpii-oauth2-authz-server/webTests/components/privacySettings/html/PrivacySettings-test.html +++ b/gpii/node_modules/gpii-oauth2/gpii-oauth2-authz-server/webTests/components/privacySettings/html/PrivacySettings-test.html @@ -46,6 +46,7 @@ + diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index ab2d935c2..ff7299d0c 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -1042,7 +1042,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt var expected = gpii.tests.lifecycleManager.settingsToChanges(gpii.tests.lifecycleManager.invokeSettingsHandlersExpectedSnapshot); snapshotPromise.then(function (snapshot) { jqUnit.assertDeepEq("invokeSettingsHandlers produced snapshot", expected, snapshot); - gpii.tests.lifecycleManager.assertExpectedSettingsHandler(" - standalone", gpii.tests.lifecycleManager.settingsHandlerExpectedInputNewSettings); + jqUnit.assertDeepEq("expected input sent to settingsHandler", gpii.tests.lifecycleManager.settingsHandlerExpectedInputNewSettings, gpii.tests.lifecycleManager.staticRepository.settingsHandler); jqUnit.start(); }); }); @@ -1078,71 +1078,5 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt fluid.each(gpii.tests.lifecycleManager.completeLifecycleTests, function (testDef) { gpii.tests.lifecycleManager.runLifecycleTest(testDef); }); - - jqUnit.asyncTest("gpii.lifecycleManager.update() tests for 'stop' reference", function () { - // initial payload: - var startPayload = fluid.extend(true, {}, gpii.tests.lifecycleManager.userOptions, { - lifecycleInstructions: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "red" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "stop" ] }) - }); - - gpii.tests.lifecycleManager.setup(); - jqUnit.expect(4); - - var lifecycleManager = gpii.lifecycleManager(gpii.tests.lifecycleManager.testOptions); - gpii.tests.lifecycleManager.initBackingMock(); - - lifecycleManager.start(startPayload, function (success) { - jqUnit.assertTrue("gpii.lifecycleManager.start() succeeds", success); - // check that things have 'started' - gpii.tests.lifecycleManager.assertExpectedExec(); - - lifecycleManager.update(startPayload, function () { - // check that things have 'stopped' - jqUnit.assertEquals("Expected pid has been sent to kill handler", - 8839, gpii.tests.lifecycleManager.staticRepository.killHandler.pid); - lifecycleManager.stop(gpii.tests.lifecycleManager.userOptions, function () { - gpii.tests.lifecycleManager.assertNoActiveSessions(lifecycleManager, "no active sessions running after stop"); - jqUnit.start(); - }); - }); - }); - }); - - jqUnit.asyncTest("gpii.lifecycleManager.update() tests for 'stop' and 'start' reference", function () { - // initial payload: - var startPayload = fluid.extend(true, {}, gpii.tests.lifecycleManager.userOptions, { - lifecycleInstructions: gpii.tests.lifecycleManager.buildLifecycleInstructions("org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.buildSettingsHandlersEntry({ "cross-hairs-clip": true, "cross-hairs-color": "red" }), - gpii.tests.lifecycleManager.noUpdateLifecycle, - { "update": [ "stop", "start" ] }) - }); - - gpii.tests.lifecycleManager.setup(); - jqUnit.expect(5); - - var lifecycleManager = gpii.lifecycleManager(gpii.tests.lifecycleManager.testOptions); - gpii.tests.lifecycleManager.initBackingMock(); - - lifecycleManager.start(startPayload, function (success) { - jqUnit.assertTrue("gpii.lifecycleManager.start() succeeds", success); - // check that things have 'started' - gpii.tests.lifecycleManager.assertExpectedExec(); - - lifecycleManager.update(startPayload, function () { - // check that things have 'stopped' - jqUnit.assertEquals("Expected pid has been sent to kill handler", - 8839, gpii.tests.lifecycleManager.staticRepository.killHandler.pid); - gpii.tests.lifecycleManager.assertExpectedExec(); - - lifecycleManager.stop(gpii.tests.lifecycleManager.userOptions, function () { - gpii.tests.lifecycleManager.assertNoActiveSessions(lifecycleManager, "no active sessions running after stop"); - jqUnit.start(); - }); - }); - }); - }); }; })(); From fed0fe06ad77a2bc30737548ec85fa873a0a95f9 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 19 Apr 2017 18:44:47 +0200 Subject: [PATCH 19/44] GPII-1230: Removed outdated multiSH stuff --- .../lifecycleManager/test/js/LifecycleManagerTests.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index ff7299d0c..d6c2b3ccc 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -196,7 +196,6 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt "otherSetting": "bar" } }, - isMultiSH: true, response: [{ "settings": { "weirdSetting": "foo" @@ -1014,7 +1013,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt jqUnit.test("gpii.lifecycleManager.specToSettingsHandler()", function () { fluid.each(gpii.tests.lifecycleManager.specToSettingsHandlerTests, function (spec, name) { jqUnit.expect(1); - var response = gpii.lifecycleManager.specToSettingsHandler("fake.solution", spec.request, spec.isMultiSH); + var response = gpii.lifecycleManager.specToSettingsHandler("fake.solution", spec.request); jqUnit.assertDeepEq(name, { "fake.solution": spec.response }, response); }); }); From c87f07ebd9c08e51ce46a36c9ec10004b846b171 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Thu, 27 Jul 2017 13:13:06 +0200 Subject: [PATCH 20/44] GPII-1230: Updated with latest master --- .dockerignore | 13 +++++ Dockerfile | 21 ++++--- README.md | 53 ++++++++++++++---- .../gpii.flowManager.config.production.json | 9 +++ ...i.preferencesServer.config.production.json | 20 ++++++- gpii/node_modules/testing/src/Integration.js | 3 + package.json | 8 +-- .../acceptanceTests/xrandr.json | 5 ++ .../acceptanceTests/os_gnome_display.json | 17 ++++++ .../org_freedesktop_xrandr.md | 34 +++++++++++ tests/platform/index-linux.js | 3 +- ....tests.acceptance.linux.xrandr.config.json | 13 +++++ tests/platform/linux/linux-xrandr-testSpec.js | 56 +++++++++++++++++++ .../platform/linux/linux-xrandr-testSpec.txt | 8 +++ 14 files changed, 235 insertions(+), 28 deletions(-) create mode 100644 testData/deviceReporter/acceptanceTests/xrandr.json create mode 100644 testData/preferences/acceptanceTests/os_gnome_display.json create mode 100644 testData/solutions/solutionsDescription/org_freedesktop_xrandr.md create mode 100644 tests/platform/linux/configs/gpii.tests.acceptance.linux.xrandr.config.json create mode 100644 tests/platform/linux/linux-xrandr-testSpec.js create mode 100644 tests/platform/linux/linux-xrandr-testSpec.txt diff --git a/.dockerignore b/.dockerignore index 6b8710a71..15dbf3325 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,14 @@ .git +node_modules +.vagrant + +npm-debug.log +*.bak + +browserify +report.tap +coverage +.nyc_output +instrumented +reports +.idea/ diff --git a/Dockerfile b/Dockerfile index aa47084ae..024de9f2f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,14 @@ -FROM inclusivedesign/nodejs:lts +FROM node:8-alpine -WORKDIR /etc/ansible/playbooks +WORKDIR /app +COPY . /app -COPY provisioning/* /etc/ansible/playbooks/ +RUN apk add --no-cache --virtual build-dependencies python make git g++ && \ + npm install && \ + chown -R node:node . && \ + npm cache clean --force && \ + apk del build-dependencies -ENV INSTALL_DIR=/opt/gpii/node_modules/universal +USER node -ENV UNIVERSAL_VARS_FILE=docker-vars.yml - -COPY . $INSTALL_DIR - -RUN ansible-playbook playbook.yml --tags "install,configure" - -CMD ["/bin/bash"] +CMD ["npm","start"] diff --git a/README.md b/README.md index 8bcc14193..4632a22e9 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,42 @@ If all is well, you will see a message like Note that this installation will not include any OS-specific features, but can be used to verify system function with basic preference sets which only start solutions which require filesystem-based configuration (XML, JSON or .INI files). +Environment Variables +--------------------- + +Through the use of Kettle [resolvers](https://github.com/fluid-project/kettle/blob/master/docs/ConfigsAndApplications.md#referring-to-external-data-via-resolvers), some pre-defined configuration files offer the ability to read environment variables to change commonly used settings. + +#### Preferences Server + +The Preferences Server with the `gpii.config.cloudBased.flowManager.production` configuration uses the following variables: + + * `GPII_PREFERENCES_LISTEN_PORT`: TCP port to listen on (default: 8081) + * `GPII_PREFERENCES_DATASOURCE_URL`: Location of CouchDB database (default: http://localhost:5984/preferences/%userToken) + +Example: + +``` +GPII_PREFERENCES_LISTEN_PORT=9090 \ +GPII_PREFERENCES_DATASOURCE_URL=https://localhost:5984/%userToken \ +NODE_ENV=gpii.config.cloudBased.flowManager.production \ +npm start +``` +#### Flow Manager + +The Flow Manager with the `gpii.config.cloudBased.flowManager.production` configuration uses the following variables: + + * `GPII_FLOWMANAGER_LISTEN_PORT`: TCP port to listen on (default: 8081) + * `GPII_FLOWMANAGER_PREFERENCES_URL`: Location of the Preferences Server (default: https://preferences.gpii.net/preferences/%userToken) + +Example: + +``` +GPII_FLOWMANAGER_LISTEN_PORT=9091 \ +GPII_FLOWMANAGER_PREFERENCES_URL=http://localhost:9090/preferences/%userToken \ +NODE_ENV=gpii.config.cloudBased.flowManager.production \ +npm start +``` + Recovering From System Corruption Using the Journal --------------------------------------------------- @@ -160,11 +196,14 @@ we use a `pretest` script to clean up previous coverage data before we run the t compile the actual report. You should not need to run the `pretest` scripts manually before running either the node or browser tests, or to run the `posttest` scripts afterward. -Building Docker Images ----------------------- +Docker Containers +----------------- -The Dockerfile can be used to build a containerized version of GPII Universal, at this time primarily for use by -downstream containers running components such the Preferences Server and Flow Manager in standalone cloud configuration. +The provided Dockerfile can be used to run GPII Universal directly. + +#### Build image + +To build a Docker image simply run: `docker build -t my-universal .` The following command can be used to build an image locally as long as it is run relative to the repository's `Dockerfile`: @@ -180,9 +219,3 @@ Universal image you can use this command: Or use the following command to download a particular image identified using a Git commit hash: `docker pull gpii/universal:` - -Additional notes: - -* The Docker image is built within the container using the [same Ansible role](https://github.com/idi-ops/ansible-nodejs) used to provision VMs, to simplify the management of different environments. -* Universal is installed to /opt/gpii/node_modules/universal to allow the node-based test cases to resolve. Regarding the tests: - * Currently, the node-based tests are always run when this container is built. If you would like to turn this off for local debugging or faster building, remove the `npm test` item in the `nodejs_app_commands` list in `provisioning/docker-vars.yml` diff --git a/gpii/node_modules/flowManager/configs/gpii.flowManager.config.production.json b/gpii/node_modules/flowManager/configs/gpii.flowManager.config.production.json index 1056bc189..4537d0348 100644 --- a/gpii/node_modules/flowManager/configs/gpii.flowManager.config.production.json +++ b/gpii/node_modules/flowManager/configs/gpii.flowManager.config.production.json @@ -16,6 +16,15 @@ "record": "@expand:kettle.resolvers.env(GPII_FLOWMANAGER_PREFERENCES_URL)", "target": "{that flowManager preferencesDataSource}.options.url", "priority": "after:preferencesDataSource.productionDataSource" + }, + "distributePort.productionPort": { + "record": 8081, + "target": "{that kettle.server}.options.port" + }, + "distributePort.productionEnvPort": { + "record": "@expand:kettle.resolvers.env(GPII_FLOWMANAGER_LISTEN_PORT)", + "target": "{that kettle.server}.options.port", + "priority": "after:distributePort.productionPort" } } }, diff --git a/gpii/node_modules/preferencesServer/configs/gpii.preferencesServer.config.production.json b/gpii/node_modules/preferencesServer/configs/gpii.preferencesServer.config.production.json index 6e567d5b5..d645bd658 100644 --- a/gpii/node_modules/preferencesServer/configs/gpii.preferencesServer.config.production.json +++ b/gpii/node_modules/preferencesServer/configs/gpii.preferencesServer.config.production.json @@ -3,7 +3,7 @@ "options": { "gradeNames": "fluid.component", "distributeOptions": { - "rawPreferencesDataSource": { + "rawPreferencesDataSource.productionDataSource": { "record": { "type": "kettle.dataSource.URL", "options": { @@ -13,13 +13,29 @@ }, "target": "{that preferencesServer rawPreferencesDataSource}" }, + "rawPreferencesDataSource.productionEnvUrl": { + "record": { + "type": "kettle.dataSource.URL", + "options": { + "gradeNames": "kettle.dataSource.CouchDB", + "url": "@expand:kettle.resolvers.env(GPII_PREFERENCES_DATASOURCE_URL)" + } + }, + "target": "{that preferencesServer rawPreferencesDataSource}", + "priority": "after:rawPreferencesDataSource.productionDataSource" + }, "logging": { "record": true, "target": "{that kettle.server}.options.logging" }, - "distributePort": { + "distributePort.productionPort": { "record": 8081, "target": "{that kettle.server}.options.port" + }, + "distributePort.productionEnvPort": { + "record": "@expand:kettle.resolvers.env(GPII_PREFERENCES_LISTEN_PORT)", + "target": "{that kettle.server}.options.port", + "priority": "after:distributePort.productionPort" } } }, diff --git a/gpii/node_modules/testing/src/Integration.js b/gpii/node_modules/testing/src/Integration.js index 9cac9d2d1..72c3fd5c3 100644 --- a/gpii/node_modules/testing/src/Integration.js +++ b/gpii/node_modules/testing/src/Integration.js @@ -409,6 +409,9 @@ fluid.defaults("gpii.test.integration.mockSettingsHandlerRegistry.linux", { }, "gpii.gsettings.launch": { optionsPathKey: gpii.test.integration.gsettingsLaunchKey + }, + "gpii.xrandr": { + optionsPathKey: "NONE" } } }); diff --git a/package.json b/package.json index 22b1f083e..c867b334a 100644 --- a/package.json +++ b/package.json @@ -13,12 +13,12 @@ "express-session": "1.15.3", "fluid-resolve": "1.2.0", "glob": "7.1.2", - "gpii-pouchdb": "1.0.2", - "infusion": "3.0.0-dev.20170322T234120Z.278de35", + "gpii-pouchdb": "1.0.4", + "infusion": "3.0.0-dev.20170713T172705Z.330ed53", "ini": "git://github.com/GPII/ini.git#be8a04aa22f5ad9321ebcbba7740314a53bc8ab2", "json5": "0.5.1", - "kettle": "1.6.0", - "node-jqunit": "1.1.4", + "kettle": "1.6.2", + "node-jqunit": "1.1.5", "node-uuid": "1.4.8", "mkdirp": "0.5.1", "oauth2orize": "1.8.0", diff --git a/testData/deviceReporter/acceptanceTests/xrandr.json b/testData/deviceReporter/acceptanceTests/xrandr.json new file mode 100644 index 000000000..c0e254ce5 --- /dev/null +++ b/testData/deviceReporter/acceptanceTests/xrandr.json @@ -0,0 +1,5 @@ +[ + { + "id": "org.freedesktop.xrandr" + } +] diff --git a/testData/preferences/acceptanceTests/os_gnome_display.json b/testData/preferences/acceptanceTests/os_gnome_display.json new file mode 100644 index 000000000..f6278b4ab --- /dev/null +++ b/testData/preferences/acceptanceTests/os_gnome_display.json @@ -0,0 +1,17 @@ +{ + "flat": { + "contexts": { + "gpii-default": { + "name": "Default preferences", + "preferences": { + "http://registry.gpii.net/applications/org.freedesktop.xrandr": { + "screen-resolution": { + "width": 800, + "height": 600 + } + } + } + } + } + } +} \ No newline at end of file diff --git a/testData/solutions/solutionsDescription/org_freedesktop_xrandr.md b/testData/solutions/solutionsDescription/org_freedesktop_xrandr.md new file mode 100644 index 000000000..e80f400a7 --- /dev/null +++ b/testData/solutions/solutionsDescription/org_freedesktop_xrandr.md @@ -0,0 +1,34 @@ +# X.Org XRandR + +## Details + +* __Name__: X.Org XRandR +* __Id__: org.freedesktop.xrandr +* __Platform__: GNU/Linux +* __Contact__: Joseph Scheuhammer + +## Description +__XRandR__ ("resize and rotate") is an extension to the X11 protocol that provides the ability to resize, rotate, and/or reflect the root window of a screen. +XRandR is free software developed under the umbrella of the X.org foundation, and maintained by the freedesktop.org. + +You'll find more information at: + + * [XRandR at X.org's wiki](https://www.x.org/wiki/Projects/XRandR/) + * [Source code at freedesktop's git repository](https://cgit.freedesktop.org/xorg/app/xrandr/) + +## Integration +XRandR is used by the GPII personalization framework as a display settings handler to change the screen resolution on GNOME/Linux desktops. + +To ensure that the solution is well integrated, there are Acceptance Tests (_tests/platform/linux/linux-xrandr-testSpec.js_) as well as tests of XRandR at a settings handler-level (_gpii/node_modules/xrandr/test/xrandrSettingsHandlerTests.js_). The latter are located in the linux repository. + +## Testing +When using an NP set that makes use of a display settings handler to change the screen resolution, XRandR should launch and re-configure the display resolution using the settings included in that NP set. + +### os_gnome_display + +The expected behaviour of using the NP set located at universal's _testData/preferences/acceptanceTests/os_gnome_display.json_ is: + +* When logging in, XRandR should be launched to change the screen resolution as specified in the above json file. In this particular case, it should change to 800 pixels wide by 600 pixels high. + +* When logging out, XRandR should launch again to restore the screen resolution to its original width and height. + diff --git a/tests/platform/index-linux.js b/tests/platform/index-linux.js index 4ce912522..87366ccb7 100644 --- a/tests/platform/index-linux.js +++ b/tests/platform/index-linux.js @@ -24,5 +24,6 @@ module.exports = [ "linux/linux-builtIn-testSpec.js", "linux/linux-orca-testSpec.js", "linux/linux-chrome-testSpec.js", - "linux/linux-dynamicDeviceReporter-testSpec.js" + "linux/linux-dynamicDeviceReporter-testSpec.js", + "linux/linux-xrandr-testSpec.js" ]; diff --git a/tests/platform/linux/configs/gpii.tests.acceptance.linux.xrandr.config.json b/tests/platform/linux/configs/gpii.tests.acceptance.linux.xrandr.config.json new file mode 100644 index 000000000..e724d8d2e --- /dev/null +++ b/tests/platform/linux/configs/gpii.tests.acceptance.linux.xrandr.config.json @@ -0,0 +1,13 @@ +{ + "type": "gpii.tests.acceptance.linux.xrandr", + "options": { + "distributeOptions": { + "acceptance.installedSolutionsPath": { + "record": "%universal/testData/deviceReporter/acceptanceTests/xrandr.json", + "target": "{that deviceReporter installedSolutionsDataSource}.options.path", + "priority": "after:development.installedSolutionsPath" + } + } + }, + "mergeConfigs": "%universal/tests/configs/gpii.tests.acceptance.localInstall.config.json" +} diff --git a/tests/platform/linux/linux-xrandr-testSpec.js b/tests/platform/linux/linux-xrandr-testSpec.js new file mode 100644 index 000000000..06ea7b4b8 --- /dev/null +++ b/tests/platform/linux/linux-xrandr-testSpec.js @@ -0,0 +1,56 @@ +/* +GPII Acceptance Testing + +Copyright 2017 Inclusive Design Research Centre, OCAD University. + +Licensed under the New BSD license. You may not use this file except in +compliance with this License. + +You may obtain a copy of the License at +https://github.com/GPII/universal/blob/master/LICENSE.txt + +The R&D leading to these results received funding from the +Department of Education - Grant H421A150005 (GPII-APCP). However, +these results do not necessarily represent the policy of the +Department of Education, and you should not assume endorsement by the +Federal Government. +*/ + +"use strict"; + +var fluid = require("infusion"), + gpii = fluid.registerNamespace("gpii"); + +fluid.require("%universal"); + +gpii.loadTestingSupport(); + +fluid.registerNamespace("gpii.tests.acceptance.linux.xrandr"); + +gpii.tests.acceptance.linux.xrandr.testDefs = fluid.freezeRecursive([ + { + name: "Testing os_linux_display using default matchmaker", + userToken: "os_gnome_display", + settingsHandlers: { + "gpii.xrandr": { + "some.app.id": [{ + "settings": { + "screen-resolution": { + "width": 800, + "height": 600 + } + } + }] + } + }, + processes: [] + } +]); + +module.exports = gpii.test.bootstrap({ + testDefs: "gpii.tests.acceptance.linux.xrandr.testDefs", + configName: "gpii.tests.acceptance.linux.xrandr.config", + configPath: "%universal/tests/platform/linux/configs" +}, ["gpii.test.integration.testCaseHolder.linux"], + module, require, __dirname); + diff --git a/tests/platform/linux/linux-xrandr-testSpec.txt b/tests/platform/linux/linux-xrandr-testSpec.txt new file mode 100644 index 000000000..981cdae8d --- /dev/null +++ b/tests/platform/linux/linux-xrandr-testSpec.txt @@ -0,0 +1,8 @@ +AcceptanceTests_xrandr.js + +Description: + +This tests the functionality of GNOME/Linux XRandR bridge, or the linux display +settings handler. It tests the system using one NP set: + (1) os_gnome_display: application specific gnome settings. + From 4b85dc483e40f5275572b8325f7a3d9b240d9e32 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Mon, 4 Sep 2017 12:50:06 +0200 Subject: [PATCH 21/44] GPII-1230: Factored out the selection of restore actions --- .../lifecycleManager/src/LifecycleManager.js | 45 ++++++++++++------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index 5fa9986b0..7cc93d7ac 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -544,6 +544,34 @@ var gpii = fluid.registerNamespace("gpii"); return fluid.promise.sequence(promises); }; + /** + * Based on the current state of an application (ie. if it is running or not), and the recorded state + * this function returns an array of actions for the lifecycle manager to run to get it to its + * recorded state + * + * @param currentRunState {boolean}: True if application is currently running + * @param recordedRunState {boolean}: True if application was running on login + * @return {Array} An array of actions (strings) that needs to be run to restore the application + * to its original state + */ + gpii.lifecycleManager.selectRestoreActions = function (currentRunState, recordedRunState) { + var actions; + if (currentRunState === true) { // if it's already running + if (recordedRunState === false) { // and it was not running on start + actions = [ "stop", "restore" ]; + } else { // else update it + actions = [ "update" ]; + } + } else { // if it is not running + if (recordedRunState === true) { // and it was running when we started + actions = [ "restore", "start" ]; + } else { // just restore settings + actions = [ "restore" ]; + } + } + return actions; + }; + /** Common utility used by gpii.lifecycleManager.stop and gpii.lifecycleManager.restoreSnapshot * @param session {gpii.lifecycleManager.session} which must contain * * A `originalSettings` snapshot in its model @@ -561,26 +589,11 @@ var gpii = fluid.registerNamespace("gpii"); }); tasks.push(function () { if (!fluid.isDestroyed(that)) { // See above comment for GPII-580 - // if solution is already running, call "update" directive - else use "start" directive var solutionRecord = gpii.lifecycleManager.transformSolutionSettings(changesSolutionRecord, gpii.settingsHandlers.changesToSettings); var recordedRunState = gpii.lifecycleManager.getSolutionRunningStateFromSnapshot(solutionRecord); var currentRunState = session.model.runningOnLogin[solutionId]; - var actions; - if (currentRunState === true) { // if it's already running - if (recordedRunState === false) { // and it was not running on start - actions = [ "stop", "restore" ]; - } else { // else update it - actions = [ "update" ]; - } - } else { // if it is not running - if (recordedRunState === true) { // and it was running when we started - actions = [ "restore", "start" ]; - } else { // just restore settings - actions = [ "restore" ]; - } - } - + var actions = gpii.lifecycleManager.selectRestoreActions(currentRunState, recordedRunState); // build structure for returned values (for later reset) return that.applySolution(solutionId, solutionRecord, session, actions, rootAction); } From 19f7889999efd740fbd9af1281ebbb3b0e27bf39 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 6 Sep 2017 16:35:52 +0200 Subject: [PATCH 22/44] GPII-1230: Addressed most of Antranigs comments --- .../test/CanopyMatchMakerTests.js | 2 +- .../lifecycleManager/src/LifecycleManager.js | 35 ++++------- .../test/js/LifecycleManagerTests.js | 22 ++++++- .../settingsHandlers/src/LaunchHandlers.js | 19 +++++- .../src/settingsHandlerUtilities.js | 26 ++++++++ .../web/js/SettingsHandlerUtilitiesTests.js | 61 +++++++++++++++++++ gpii/node_modules/testing/src/Testing.js | 10 +-- .../transformer/src/js/Transformer.js | 19 +----- .../test/html/TransformerTests.html | 1 + .../transformer/test/js/TransformerTests.js | 60 ------------------ .../deviceReporter/installedSolutions.json | 6 +- tests/DeviceReporterErrorTests.js | 2 +- tests/PayloadSizeTest.js | 2 +- .../windows/windows-builtIn-testSpec.js | 12 ++-- 14 files changed, 157 insertions(+), 120 deletions(-) diff --git a/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js b/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js index cd941c87b..7ebcb56f0 100644 --- a/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js +++ b/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js @@ -429,7 +429,7 @@ var matchFixtures = [ "fakemag2": { "active": false, "settings": { - "http://registry.gpii.net/applications/fakemag2": {}, + "http://registry.gpii.net/applications/fakemag2": {} } } } diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index 7cc93d7ac..cc6afb1ce 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -545,26 +545,30 @@ var gpii = fluid.registerNamespace("gpii"); }; /** - * Based on the current state of an application (ie. if it is running or not), and the recorded state + * Based on the current state of an application (ie. if it is running or not) and the desired state, * this function returns an array of actions for the lifecycle manager to run to get it to its * recorded state * * @param currentRunState {boolean}: True if application is currently running - * @param recordedRunState {boolean}: True if application was running on login + * @param desiredRunState {boolean}: True if application should be running + * @param isRestore {boolean}: If this is true, a "restore" will be used as the configuration action + * in the array that is returned. Else a "configure" will be used. In general, isRestore should be provided and + * true only of this is called by the logout/restore functionality of the system. * @return {Array} An array of actions (strings) that needs to be run to restore the application * to its original state */ - gpii.lifecycleManager.selectRestoreActions = function (currentRunState, recordedRunState) { + gpii.lifecycleManager.calculateLifecycleActions = function (currentRunState, desiredRunState, isRestore) { + var configurationType = isRestore ? "restore" : "configure"; var actions; if (currentRunState === true) { // if it's already running - if (recordedRunState === false) { // and it was not running on start - actions = [ "stop", "restore" ]; + if (desiredRunState === false) { // and it was not running on start + actions = [ "stop", configurationType ]; } else { // else update it actions = [ "update" ]; } } else { // if it is not running - if (recordedRunState === true) { // and it was running when we started - actions = [ "restore", "start" ]; + if (desiredRunState === true) { // and it was running when we started + actions = [ configurationType, "start" ]; } else { // just restore settings actions = [ "restore" ]; } @@ -593,7 +597,7 @@ var gpii = fluid.registerNamespace("gpii"); var recordedRunState = gpii.lifecycleManager.getSolutionRunningStateFromSnapshot(solutionRecord); var currentRunState = session.model.runningOnLogin[solutionId]; - var actions = gpii.lifecycleManager.selectRestoreActions(currentRunState, recordedRunState); + var actions = gpii.lifecycleManager.calculateLifecycleActions(currentRunState, recordedRunState, true); // build structure for returned values (for later reset) return that.applySolution(solutionId, solutionRecord, session, actions, rootAction); } @@ -786,20 +790,7 @@ var gpii = fluid.registerNamespace("gpii"); if (!fluid.isDestroyed(that)) { // See above comment for GPII-580 // if solution is already running, call "update" directive - else use "start" directive var isRunning = session.model.runningOnLogin[solutionId]; - var actions; - if (isRunning === true) { // if it's already running - if (solution.active === false) { // and it shouldn't - actions = [ "stop", "configure" ]; - } else { // else call "update" to make changes apply to a running solutions - actions = [ "update" ]; - } - } else { // if it is not running - if (solution.active === true) { // and we want it to run - actions = [ "configure", "start" ]; - } else { // else just configure it - actions = [ "configure" ]; - } - } + var actions = gpii.lifecycleManager.calculateLifecycleActions(isRunning, solution.active); // build structure for returned values (for later reset) return that.applySolution(solutionId, solution, session, actions, "start"); diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index 2960ad015..1632fae46 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -64,6 +64,24 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt return togo; }; + /** + * Used by a bunch of the tests to avoid having to write out the almost-identical full set of lifecycle + * instructions for each test. Instead one can have a "base set" of lifecycle instructions + * that can be shared across multiple tests/multiple phases of a single test, and then use + * this function to extend base set to match the specific test/test phase. + * + * The function takes an unlimited number of arguments. The first argument is mandatory and must + * be a set of lifecycle instructions entries keyed by solution ids. While the system wont explode + * if entries for multiple solutions are provided, only the "first" solution entry will be + * extended. The remaining arguments will be fluid.extended onto the first argument. + * + * @currentInstructions {Object} a set of lifecycle instructions keyed by a solution id. For example, + * this could be the output of the buildLifecycleInstructions function. + * @arguments {..Object..} The remaining arguments should be valid lifecycleInstructions that will + * be extended onto the original + * @return {Object} The original lifecycle instructions, but with the remaining arguments fluid.extend'ed + * onto the first solution entry in the currentInstructions + */ gpii.tests.lifecycleManager.extendLifecycleInstructions = function (currentInstructions) { var togo = fluid.copy(currentInstructions); var solId = Object.keys(currentInstructions)[0]; @@ -617,7 +635,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt expectedSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, expectedLaunchHandlerCalls: 2 }, { - name: "single pref changed without 'update' directive in solution registry entry", + name: "single pref changed without 'update' directive in solution registry entry", basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( "org.gnome.desktop.a11y.magnifier", gpii.tests.lifecycleManager.standardLifecycle @@ -1057,7 +1075,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt var ret = lifecycleManager.update(gpii.tests.lifecycleManager.startPayload); jqUnit.expect(1); ret.then(function (text) { - jqUnit.assertTrue("User with token 123 has no active session, so ignoring update request", true); + jqUnit.assertEquals("Response correct", text, "User with token 123 has no active session, so ignoring update request"); }); }); diff --git a/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js b/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js index cc9fb6b57..aab4720b1 100644 --- a/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js +++ b/gpii/node_modules/settingsHandlers/src/LaunchHandlers.js @@ -15,10 +15,25 @@ var fluid = fluid || require("infusion"), gpii = fluid.registerNamespace("gpii"); -fluid.registerNamespace("gpii.launchHandlers"); +/** + * The flexibleHandler is a highly customizable launch handler that is implemented to handle all + * the cases in which a solutions launch-cycle is too complex or specific to efficiently be handled + * in one of the standard launchHandlers. + * + * Besides the normal launch handler options like retryOptions and verifySettings, the flexible handler + * supports three directives: `getState`, `setTrue` and `setFalse`. + * + * `getState`: equals the launchHandlers "get" functionality, and should return a boolean value indicating + * whether the application is running or not. The content of this directive will be sent to the + * processReporters' handleIsRunning function + * `setTrue`: Is run when a "true" value is sent to the launch handler. The content of this block should + * be an array of objects that can be run as graded functions in infusion. The result of runnings these + * blocks should be that the application is running + * `setFalse`: Identical to `setTrue` but is run when a "false" is sent to the launch handler. The result from + * running the blocks in this directive should be that the application is closed/not running. + */ fluid.registerNamespace("gpii.launchHandlers.flexibleHandler"); - gpii.launchHandlers.flexibleHandler.set = function (payload) { return fluid.transform(payload, function (allSettingsBlocks, solutionId) { return fluid.transform(allSettingsBlocks, function (handlerData) { diff --git a/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js b/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js index 59a6e840f..54d68abce 100644 --- a/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js +++ b/gpii/node_modules/settingsHandlers/src/settingsHandlerUtilities.js @@ -55,6 +55,32 @@ gpii.toPromise = function (value) { fluid.registerNamespace("gpii.settingsHandlers"); +/** + * Filters out all the settings from the `settings` argument which are + * not in the `supportedSettings` argument + * + * @param settings {Object} Object in which each key is a setting name that is to be filtered. This + * object will be modified. + * @param supportedSettings {Object} Object in which each key is a setting name that will be filtered by + * @return {Object} the `settings`, filtered by the `supportedSettings` entries, meaning that + * any setting that is not in supportedSettings will not be in the return object. + */ +gpii.settingsHandlers.filterSupportedSettings = function (settings, supportedSettings) { + if (supportedSettings === undefined || settings === undefined) { + return settings; + } else { + var filteredSettings = {}; + // we cant simply use fluid.filterKeys because that wont handle the cases where + // there are 'undefined' values for the keys in handlerSpec.settings + for (var settingName in supportedSettings) { + if (settingName in settings) { + filteredSettings[settingName] = settings[settingName]; + } + } + return filteredSettings; + } +}; + // TODO: These utilities all clearly form part of some wider idiom of "payload handling" without some underpinnings // for which they are rather hard to follow. For example, they could benefit from some form of "JSON type system" // (whether provided via JSON schema or otherwise) in order to provide landmarks within the payloads, as well diff --git a/gpii/node_modules/settingsHandlers/test/web/js/SettingsHandlerUtilitiesTests.js b/gpii/node_modules/settingsHandlers/test/web/js/SettingsHandlerUtilitiesTests.js index d88a96cbe..d41c32833 100644 --- a/gpii/node_modules/settingsHandlers/test/web/js/SettingsHandlerUtilitiesTests.js +++ b/gpii/node_modules/settingsHandlers/test/web/js/SettingsHandlerUtilitiesTests.js @@ -26,6 +26,67 @@ fluid.registerNamespace("gpii.tests"); fluid.registerNamespace("gpii.tests.settingsHandlersUtilitiesTests"); + gpii.tests.settingsHandlersUtilitiesTests.filterSupportedSettingsSpecs = { + "If supportedSettings is undefined, return settings": { + settings: { + "weirdSetting": "foo" + }, + supportedSettings: undefined, + expected: { + "weirdSetting": "foo" + } + }, + "If settings is undefined, return undefined": { + settings: undefined, + supportedSettings: { + "weirdSetting": {} + }, + expected: undefined + }, + "Filter by supportedSettings": { + settings: { + "weirdSetting": "foo", + "otherSetting": "bar" + }, + supportedSettings: { + "weirdSetting": {} + }, + expected: { + "weirdSetting": "foo" + } + }, + "If supportedSettings directive is present - test no matching": { + settings: { + "weirdSetting": "foo", + "otherSetting": "bar" + }, + supportedSettings: { + "thirdSetting": {} + }, + expected: {} + }, + "Works with `undefined` values for settings (required when restoring)": { + settings: { + "weirdSetting": undefined, + "otherSetting": undefined + }, + supportedSettings: { + "weirdSetting": {} + }, + expected: { + "weirdSetting": undefined + } + } + }; + + jqUnit.test("filterSupportedSettings tests", function () { + fluid.each(gpii.tests.settingsHandlersUtilitiesTests, function (test, name) { + var result = gpii.settingsHandlers.filterSupportedSettings(test.settings, test.supportedSettings); + jqUnit.assertDeepEq(name, test.expected, result); + }); + }); + + jqUnit.test("settingsHandlers.setSettings", function () { // check simple json structure var result = gpii.settingsHandlers.setSettings( diff --git a/gpii/node_modules/testing/src/Testing.js b/gpii/node_modules/testing/src/Testing.js index 31616ebc8..300851199 100644 --- a/gpii/node_modules/testing/src/Testing.js +++ b/gpii/node_modules/testing/src/Testing.js @@ -144,8 +144,6 @@ gpii.test.operateSettings = function (settingsHandlers, nameResolver, method) { fluid.each(settingsHandlers, function (handlerBlock, handlerID) { var resolvedName = nameResolver ? nameResolver.resolveName(handlerID, "settingsHandler") : handlerID; var response = gpii.settingsHandlers.dispatchSettingsHandler(resolvedName, handlerBlock, method); - - // var response = fluid.invokeGlobalFunction(resolvedName + "." + method, [handlerBlock]); ret[handlerID] = response; }); var togo = gpii.test.settleStructure(ret); @@ -155,7 +153,11 @@ gpii.test.operateSettings = function (settingsHandlers, nameResolver, method) { return togo; }; -gpii.test.setInitialState = function (settingsHandlers, nameResolver, onComplete) { +/** + * Used for settings the initial settings of an application. This is among other used for tests + * where an application needs to be running on user login + */ +gpii.test.setInitialSettingsState = function (settingsHandlers, nameResolver, onComplete) { var promise = gpii.test.setSettings(settingsHandlers, nameResolver); promise.then(onComplete); }; @@ -339,7 +341,7 @@ gpii.test.initalStateSequence = fluid.freezeRecursive([ func: "gpii.test.expandSettings", args: [ "{tests}", "initialState" ] }, { - func: "gpii.test.setInitialState", + func: "gpii.test.setInitialSettingsState", args: [ "{tests}.initialState", "{nameResolver}", "{testCaseHolder}.events.onInitialStateSet.fire"] }, { event: "{testCaseHolder}.events.onInitialStateSet", diff --git a/gpii/node_modules/transformer/src/js/Transformer.js b/gpii/node_modules/transformer/src/js/Transformer.js index 247cb102a..3eab90ef4 100644 --- a/gpii/node_modules/transformer/src/js/Transformer.js +++ b/gpii/node_modules/transformer/src/js/Transformer.js @@ -32,23 +32,6 @@ var fluid = fluid || require("infusion"), } }); - gpii.transformer.filterSupportedSettings = function (settings, supportedSettings) { - if (supportedSettings === undefined || settings === undefined) { - return settings; - } else { - var filteredSettings = {}; - // we cant simply use fluid.filterKeys because that wont handle the cases where - // there are 'undefined' values for the keys in handlerSpec.settings - for (var settingName in supportedSettings) { - if (settingName in settings) { - filteredSettings[settingName] = settings[settingName]; - } - } - return filteredSettings; - } - }; - - /** * Helper function for `gpii.transformer.configurationToSettings`. Used to modify the settings handler * blocks to be in the format required (i.e. including the application specific settings to be @@ -63,7 +46,7 @@ var fluid = fluid || require("infusion"), */ gpii.transformer.transformOneSettingsHandler = function (settingsHandler, oneUserSolution, solutionId) { var appSettings = oneUserSolution.settings["http://registry.gpii.net/applications/" + solutionId]; - var settings = gpii.transformer.filterSupportedSettings(fluid.copy(appSettings), settingsHandler.supportedSettings); + var settings = gpii.settingsHandlers.filterSupportedSettings(fluid.copy(appSettings), settingsHandler.supportedSettings); if (settingsHandler.capabilitiesTransformations) { var inferred = fluid.model.transformWithRules(oneUserSolution.settings, settingsHandler.capabilitiesTransformations); diff --git a/gpii/node_modules/transformer/test/html/TransformerTests.html b/gpii/node_modules/transformer/test/html/TransformerTests.html index fa0cb2373..89f60b398 100644 --- a/gpii/node_modules/transformer/test/html/TransformerTests.html +++ b/gpii/node_modules/transformer/test/html/TransformerTests.html @@ -19,6 +19,7 @@ + diff --git a/gpii/node_modules/transformer/test/js/TransformerTests.js b/gpii/node_modules/transformer/test/js/TransformerTests.js index df903729e..b174aadea 100644 --- a/gpii/node_modules/transformer/test/js/TransformerTests.js +++ b/gpii/node_modules/transformer/test/js/TransformerTests.js @@ -565,66 +565,6 @@ fluid.setLogging(true); }); }); - gpii.tests.transformer.filterSupportedSettingsSpecs = { - "If supportedSettings is undefined, return settings": { - settings: { - "weirdSetting": "foo" - }, - supportedSettings: undefined, - expected: { - "weirdSetting": "foo" - } - }, - "If settings is undefined, return undefined": { - settings: undefined, - supportedSettings: { - "weirdSetting": {} - }, - expected: undefined - }, - "Filter by supportedSettings": { - settings: { - "weirdSetting": "foo", - "otherSetting": "bar" - }, - supportedSettings: { - "weirdSetting": {} - }, - expected: { - "weirdSetting": "foo", - } - }, - "If supportedSettings directive is present - test no matching": { - settings: { - "weirdSetting": "foo", - "otherSetting": "bar" - }, - supportedSettings: { - "thirdSetting": {} - }, - expected: {} - }, - "Works with `undefined` values for settings (required when restoring)": { - settings: { - "weirdSetting": undefined, - "otherSetting": undefined - }, - supportedSettings: { - "weirdSetting": {} - }, - expected: { - "weirdSetting": undefined, - } - } - }; - - jqUnit.test("filterSupportedSettings tests", function () { - fluid.each(gpii.tests.transformer.filterSupportedSettingsSpecs, function (test, name) { - var result = gpii.transformer.filterSupportedSettings(test.settings, test.supportedSettings); - jqUnit.assertDeepEq(name, test.expected, result); - }); - }); - /* --------------- gpii.transformer.timeInRange tests -------------------- */ gpii.tests.transformer.timeInRangeTests = { rules: { diff --git a/testData/deviceReporter/installedSolutions.json b/testData/deviceReporter/installedSolutions.json index a92724091..99a224b7e 100644 --- a/testData/deviceReporter/installedSolutions.json +++ b/testData/deviceReporter/installedSolutions.json @@ -1,14 +1,14 @@ [ { - "id": "org.gnome.desktop.interface" + "id": "fakemag1" }, { - "id": "org.gnome.shell.overrides" + "id": "fakemag2" }, { - "id": "org.gnome.desktop.wm.preferences" + "id": "fakescreenreader1" }, { diff --git a/tests/DeviceReporterErrorTests.js b/tests/DeviceReporterErrorTests.js index e1f27e957..059b879ab 100644 --- a/tests/DeviceReporterErrorTests.js +++ b/tests/DeviceReporterErrorTests.js @@ -20,7 +20,7 @@ var fluid = require("infusion"), gpii = fluid.registerNamespace("gpii"), kettle = fluid.registerNamespace("kettle"); -fluid.require("%universal") +fluid.require("%universal"); gpii.loadTestingSupport(); diff --git a/tests/PayloadSizeTest.js b/tests/PayloadSizeTest.js index 20bb06269..9ca26dbee 100644 --- a/tests/PayloadSizeTest.js +++ b/tests/PayloadSizeTest.js @@ -17,7 +17,7 @@ var fluid = require("infusion"), gpii = fluid.registerNamespace("gpii"), kettle = fluid.registerNamespace("kettle"); -fluid.require("%universal") +fluid.require("%universal"); gpii.loadTestingSupport(); diff --git a/tests/platform/windows/windows-builtIn-testSpec.js b/tests/platform/windows/windows-builtIn-testSpec.js index 0e9269348..386da3c80 100644 --- a/tests/platform/windows/windows-builtIn-testSpec.js +++ b/tests/platform/windows/windows-builtIn-testSpec.js @@ -368,11 +368,11 @@ gpii.tests.windows.builtIn = [ "settings": { "FilterKeysEnable": { "path": "pvParam.dwFlags.FKF_FILTERKEYSON", - "value": true + "value": false }, "BounceKeysInterval": { "path": "pvParam.iBounceMSec", - "value": 1000 + "value": 0 } }, "options": { @@ -590,11 +590,11 @@ gpii.tests.windows.builtIn = [ "settings": { "FilterKeysEnable": { "path": "pvParam.dwFlags.FKF_FILTERKEYSON", - "value": true + "value": false }, "BounceKeysInterval": { "path": "pvParam.iBounceMSec", - "value": 1000 + "value": 0 } }, "options": { @@ -812,11 +812,11 @@ gpii.tests.windows.builtIn = [ "settings": { "FilterKeysEnable": { "path": "pvParam.dwFlags.FKF_FILTERKEYSON", - "value": true + "value": false }, "BounceKeysInterval": { "path": "pvParam.iBounceMSec", - "value": 1000 + "value": 0 } }, "options": { From 44e13f82542b46a17ea9f1c2cc651ab73e3c7e0f Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Thu, 14 Sep 2017 18:49:25 +0200 Subject: [PATCH 23/44] GPII-1230: Dispose options from matchmaker are now only accept and reject again --- .../src/CanopyMatchMakerUtilities.js | 3 ++- .../flatMatchMaker/src/FlatMatchMaker.js | 5 +++- .../src/MatchMakerUtilities.js | 11 +++++--- ...hMakerUtilitiesDisposeFromPriorityTests.js | 25 +++++++++++-------- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js b/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js index 349b1c69b..b08f88afd 100644 --- a/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js +++ b/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js @@ -103,7 +103,7 @@ gpii.canopyMatchMaker.utils.disposeFromCanopy = function (leaves, ranked, solrec for (var i = 0; i < ranked.length; ++i) { var sol = solrecs[ranked[i]]; - if (sol.disposition === "reject" || sol.disposition === "deactivate") { + if (sol.disposition === "reject" || sol.active === false) { continue; } @@ -117,6 +117,7 @@ gpii.canopyMatchMaker.utils.disposeFromCanopy = function (leaves, ranked, solrec } if (inCanopy) { sol.disposition = "accept"; + sol.active = true; sol.dispositionReason = "Was the solution of this type that best fit user preferences"; gpii.matchMakerFramework.utils.rejectFromTypes(data.solutionTypes[sol.index], data.solutionTypeMapping, solrecs, "Another solution (" + sol.index + diff --git a/gpii/node_modules/flatMatchMaker/src/FlatMatchMaker.js b/gpii/node_modules/flatMatchMaker/src/FlatMatchMaker.js index 28a4955a8..ce66ccf46 100644 --- a/gpii/node_modules/flatMatchMaker/src/FlatMatchMaker.js +++ b/gpii/node_modules/flatMatchMaker/src/FlatMatchMaker.js @@ -99,7 +99,10 @@ if (solrec.priority !== undefined) { accepted = true; } - solrec.disposition = accepted ? "accept" : "reject"; + fluid.extend(solrec, { + disposition: accepted ? "accept" : "reject", + active: accepted ? true : false // always true if accepted + }); }); return solrecs; }; diff --git a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js index 4c614cf5e..c4ffcf51d 100644 --- a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js +++ b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js @@ -191,8 +191,8 @@ var fluid = fluid || require("infusion"), var disposed = strategy(leaves, tmpSolrecs, data, ontologyMetadata); togo[contextId] = {}; fluid.each(disposed, function (solrec, solid) { - if (solrec.disposition === "accept" || solrec.disposition === "deactivate") { - togo[contextId][solid] = (solrec.disposition === "accept"); // true if it should be running + if (solrec.disposition === "accept") { // only output accepted solutions + togo[contextId][solid] = solrec.active; // true if it should be running } }); }); @@ -270,6 +270,7 @@ var fluid = fluid || require("infusion"), // if no ties, mark the current solution as "accept" if (tied.length === 0) { solrecs[solutionId].disposition = "accept"; + solrecs[solutionId].active = true; solrecs[solutionId].dispositionReason = "Has a higher priority (" + priority + ") than any solution of the same type"; } else { @@ -301,6 +302,7 @@ var fluid = fluid || require("infusion"), delete solrecs[tiedSolutionId].priority; delete solrecs[tiedSolutionId].disposition; delete solrecs[tiedSolutionId].dispositionReason; + delete solrecs[tiedSolutionId].active; }); }; @@ -327,8 +329,9 @@ var fluid = fluid || require("infusion"), for (var solutionId in solutionTypeMapping[type]) { var sol = solrecs[solutionId]; if (!sol.disposition) { - sol.disposition = "deactivate"; - sol.dispositionReason = disposeReason || "Solution rejected (deactivated) due to its type of " + type; + sol.disposition = "accept"; + sol.active = false; + sol.dispositionReason = disposeReason || "Solution accepted but deactivated due to its type of " + type; } } }); diff --git a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js index 4b704b3ad..8827bf34e 100644 --- a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js +++ b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js @@ -92,37 +92,39 @@ var fluid = fluid || require("infusion"), } }; - // "undefined" disposition means that the solution is either tied with another solution - // or not present on the device. Decisions are based on priority and solution type - see + // `undefined` disposition means that the solution is either tied with another solution + // or not present on the device. `true` means that the solution should be configured and + // launched on startup, and `false` means configured but NOT launched on startup. + // Decisions are based on priority and solution type - see // the data block above. var testData = [{ description: "Tie between highest priority, rest rejected", priorities: [2, 2, 1, 1, 1], - expectedDispositions: [undefined, undefined, "deactivate", "deactivate", "deactivate"] + expectedDispositions: [undefined, undefined, false, false, false] }, { description: "Single highest priority wins, rest rejected", priorities: [2, 1, 1, 1, 1], - expectedDispositions: ["accept", "deactivate", "deactivate", "deactivate", "deactivate"] + expectedDispositions: [true, false, false, false, false] }, { // description: "Only solution covering all required solution types selected", // priorities: [2, 1, 2, 1, 1], - // expectedDispositions: ["accept", "reject", "reject", "reject", "reject"] + // expectedDispositions: [true, "reject", "reject", "reject", "reject"] // }, { description: "Highest priority selected, solution type equivalents remove", priorities: [2, 1, 3, 1, 2], - expectedDispositions: ["deactivate", "deactivate", "accept", "deactivate", "accept"] + expectedDispositions: [false, false, true, false, true] }, { description: "Tie between multiple solutions of different types", priorities: [2, 1, 2, 2, 2], - expectedDispositions: [undefined, "deactivate", undefined, undefined, undefined] + expectedDispositions: [undefined, false, undefined, undefined, undefined] }, { description: "Tie between multiple solutions of different types #2", priorities: [2, 1, 2, 1, 2], - expectedDispositions: [undefined, "deactivate", undefined, "deactivate", undefined] + expectedDispositions: [undefined, false, undefined, false, undefined] // }, { // description: "", // priorities: [1, null, 2, null, null], - // expectedDispositions: ["accept", undefined, "reject", undefined, undefined] + // expectedDispositions: [true, undefined, "reject", undefined, undefined] }]; @@ -168,8 +170,9 @@ var fluid = fluid || require("infusion"), gpii.matchMakerFramework.utils.disposeFromPriority(input.solrecs, input.data); fluid.each(fullData.solIds, function (solId, index) { - var msg = "Expecting solution " + solId + " to have disposition: " + expectedDispositions[index]; - jqUnit.assertEquals(msg, expectedDispositions[index], input.solrecs[solId].disposition); + var msg = "Expecting solution " + solId + " to be: " + expectedDispositions[index]; + var actual = input.solrecs[solId].disposition ? input.solrecs[solId].active : undefined; + jqUnit.assertEquals(msg, expectedDispositions[index], actual); }); }; From 1b5616c12e61424e53b1b9055f8a7ca2def3c36c Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 20 Dec 2017 15:10:45 +0100 Subject: [PATCH 24/44] GPII-1230: Updated windows tests to work with latest changes in registered AT handler --- testData/solutions/win32.json5 | 4 ++-- .../windows/windows-builtIn-testSpec.js | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/testData/solutions/win32.json5 b/testData/solutions/win32.json5 index 22df54af1..e4dcd58f2 100644 --- a/testData/solutions/win32.json5 +++ b/testData/solutions/win32.json5 @@ -970,7 +970,7 @@ "retryInterval": 1000 }, "registryName": "magnifierpane", - "queryProcess": "Magnify" + "queryProcess": "Magnify.exe" } } }, @@ -1044,7 +1044,7 @@ "type": "gpii.windows.enableRegisteredAT", "options": { "registryName": "osk", - "queryProcess": "osk" + "queryProcess": "osk.exe" } } }, diff --git a/tests/platform/windows/windows-builtIn-testSpec.js b/tests/platform/windows/windows-builtIn-testSpec.js index 386da3c80..6943adcb9 100644 --- a/tests/platform/windows/windows-builtIn-testSpec.js +++ b/tests/platform/windows/windows-builtIn-testSpec.js @@ -42,7 +42,7 @@ gpii.tests.windows.builtIn = [ retryInterval: 1000 }, "registryName": "magnifierpane", - "queryProcess": "Magnify" + "queryProcess": "Magnify.exe" } }] } @@ -266,7 +266,7 @@ gpii.tests.windows.builtIn = [ retryInterval: 1000 }, "registryName": "magnifierpane", - "queryProcess": "Magnify" + "queryProcess": "Magnify.exe" } }] } @@ -288,7 +288,7 @@ gpii.tests.windows.builtIn = [ retryInterval: 1000 }, "registryName": "magnifierpane", - "queryProcess": "Magnify" + "queryProcess": "Magnify.exe" } }], "com.microsoft.windows.onscreenKeyboard": [{ @@ -479,7 +479,7 @@ gpii.tests.windows.builtIn = [ retryInterval: 1000 }, "registryName": "magnifierpane", - "queryProcess": "Magnify" + "queryProcess": "Magnify.exe" } }], "com.microsoft.windows.onscreenKeyboard": [{ @@ -510,7 +510,7 @@ gpii.tests.windows.builtIn = [ retryInterval: 1000 }, "registryName": "magnifierpane", - "queryProcess": "Magnify" + "queryProcess": "Magnify.exe" } }], "com.microsoft.windows.onscreenKeyboard": [{ @@ -701,7 +701,7 @@ gpii.tests.windows.builtIn = [ retryInterval: 1000 }, "registryName": "magnifierpane", - "queryProcess": "Magnify" + "queryProcess": "Magnify.exe" } }], "com.microsoft.windows.onscreenKeyboard": [{ @@ -732,7 +732,7 @@ gpii.tests.windows.builtIn = [ retryInterval: 1000 }, "registryName": "magnifierpane", - "queryProcess": "Magnify" + "queryProcess": "Magnify.exe" } }], "com.microsoft.windows.onscreenKeyboard": [{ @@ -923,7 +923,7 @@ gpii.tests.windows.builtIn = [ retryInterval: 1000 }, "registryName": "magnifierpane", - "queryProcess": "Magnify" + "queryProcess": "Magnify.exe" } }], "com.microsoft.windows.onscreenKeyboard": [{ @@ -954,7 +954,7 @@ gpii.tests.windows.builtIn = [ retryInterval: 1000 }, "registryName": "magnifierpane", - "queryProcess": "Magnify" + "queryProcess": "Magnify.exe" } }], "com.microsoft.windows.onscreenKeyboard": [{ @@ -1038,7 +1038,7 @@ gpii.tests.windows.builtIn = [ retryInterval: 1000 }, "registryName": "magnifierpane", - "queryProcess": "Magnify" + "queryProcess": "Magnify.exe" } }] } From c2e06fc75b304217620a1d945c6b069b8bc09d3e Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 20 Dec 2017 18:18:48 +0100 Subject: [PATCH 25/44] GPII-1230: Fixed remaining instances of queryProcess without .exe --- tests/JournalIntegrationTests.js | 4 ++-- tests/platform/windows/windows-builtIn-testSpec.js | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/JournalIntegrationTests.js b/tests/JournalIntegrationTests.js index 7065bbf0b..8cfc89838 100644 --- a/tests/JournalIntegrationTests.js +++ b/tests/JournalIntegrationTests.js @@ -93,7 +93,7 @@ gpii.tests.journal.initialSettings = { }, "options": { "registryName": "magnifierpane", - "queryProcess": "Magnify" + "queryProcess": "Magnify.exe" } }] } @@ -107,7 +107,7 @@ gpii.tests.journal.settingsAfterCrash = { }, "options": { "registryName": "magnifierpane", - "queryProcess": "Magnify" + "queryProcess": "Magnify.exe" } }] } diff --git a/tests/platform/windows/windows-builtIn-testSpec.js b/tests/platform/windows/windows-builtIn-testSpec.js index 6943adcb9..b2549e410 100644 --- a/tests/platform/windows/windows-builtIn-testSpec.js +++ b/tests/platform/windows/windows-builtIn-testSpec.js @@ -297,7 +297,7 @@ gpii.tests.windows.builtIn = [ }, "options": { "registryName": "osk", - "queryProcess": "osk" + "queryProcess": "osk.exe" } }] } @@ -488,7 +488,7 @@ gpii.tests.windows.builtIn = [ }, "options": { "registryName": "osk", - "queryProcess": "osk" + "queryProcess": "osk.exe" } }] } @@ -519,7 +519,7 @@ gpii.tests.windows.builtIn = [ }, "options": { "registryName": "osk", - "queryProcess": "osk" + "queryProcess": "osk.exe" } }] } @@ -710,7 +710,7 @@ gpii.tests.windows.builtIn = [ }, "options": { "registryName": "osk", - "queryProcess": "osk" + "queryProcess": "osk.exe" } }] } @@ -741,7 +741,7 @@ gpii.tests.windows.builtIn = [ }, "options": { "registryName": "osk", - "queryProcess": "osk" + "queryProcess": "osk.exe" } }] } @@ -932,7 +932,7 @@ gpii.tests.windows.builtIn = [ }, "options": { "registryName": "osk", - "queryProcess": "osk" + "queryProcess": "osk.exe" } }] } @@ -963,7 +963,7 @@ gpii.tests.windows.builtIn = [ }, "options": { "registryName": "osk", - "queryProcess": "osk" + "queryProcess": "osk.exe" } }] } From 40965a55bffa5cc4ff5bf03321bc39d6e0c3277c Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Tue, 23 Jan 2018 13:38:29 +0100 Subject: [PATCH 26/44] GPII-2824: Updated and extended documentation of the matchmaker --- documentation/CanopyMatchMaker.md | 16 +- documentation/MatchMakerFramework.md | 351 ++++++++---------- .../src/MatchMakerFramework.js | 4 +- 3 files changed, 170 insertions(+), 201 deletions(-) diff --git a/documentation/CanopyMatchMaker.md b/documentation/CanopyMatchMaker.md index 51df9a45f..d9dab8afd 100644 --- a/documentation/CanopyMatchMaker.md +++ b/documentation/CanopyMatchMaker.md @@ -21,17 +21,13 @@ Broadly, the match making algorithm used by the canopy match maker is as follows More details are given below on solution types, as well as the two disposition methods used (priority and canopy). ## Solution Types: -To ensure that several conflicting solutions (e.g. two screenreaders) are not launched, "Types" are calculated for each solution, based on the capabilities they have (and in the future, on their explicitly stated types). The inference of solution type based on capabilities is based on the "apptology" tranformation, from the "flat" format into a solution type ontology. In the matchmaking process, each time a solution is 'accepted', any other conflicting solutions (i.e. of the same type) will be rejected. +To avoid that two conflicting solutions of the same time are run, the canopy matchmaker uses Solution Types, as described in [Match Maker Framework](MatchMakerFramework.md) under the section on utilities and concepts. -The apptology is described in more details here: [Apptology.md](Apptology.md). - -## Disposing from prioriy: -Explicit priorities are declared in the NP sets metadata section and will always be a floating point value of 1024 or more. Implicit priorities are deduced from application specific settings. When a user has application specific settings for a solution a priority of 512 is set for that solution. - -Goes through all solutions from high priority to low. If a solution already has a disposition, it is ignored. Else it will be selected (accepted). Any solution with the same type, but a lower priority (or no priority) will be rejected. If there are two or more solutions of the same priority _and_ the same type (even partly), these will be considered a "tie". All lower-priority solutions of this type will still be rejected. The tied solutions will have their current disposition and priority removed and left to be disposed by some other disposal algorithm. +## Disposing from priority: +If the user explicitly or implicitly has specified priorities in terms of applications, this will be used to select the relevant solutions. Priorities can be inferred from application specific settings, or they can be explicitly stated by the user. More information on disposition from priority can be found in [Match Maker Framework](MatchMakerFramework.md) under the utilities and concepts section. ## Disposing from Canopy -The Canopy matching strategy is used for deciding how to dispose solutions in case no priorities are available or there is a priority-tie between two applications of the same type. +The Canopy matching strategy is used for deciding how to dispose solutions in case no priorities are available or there is a priority-tie between two applications of the same type. * The canopy approach is based on a vectorial "fitness measure" of a solution plus a lexicographical ordering * It is similar to the strategy used in resolving CSS rules. @@ -45,7 +41,7 @@ The Canopy matching strategy is used for deciding how to dispose solutions in ca * Compute capabilities of solution * Compute vector of prefix depths for each leaf el path from NP set * Sort vector in descending order of fitness ("fitness vector") -* Rank solutions by fitness using lexicographic ordering +* Rank solutions by fitness using lexicographic ordering *The canopy matching* * Compute fitness vectors for each solution and sort in rank order @@ -53,5 +49,3 @@ The Canopy matching strategy is used for deciding how to dispose solutions in ca * For each solution, “raise the canopy” by setting the canopy value to the maximum of its old value and solution value * For each solution which “raised the canopy” at any leaf, accept it. Reject any solution of the same type. * For each solution which did not raise the canopy, reject it - - diff --git a/documentation/MatchMakerFramework.md b/documentation/MatchMakerFramework.md index d966c5751..76000c8d6 100644 --- a/documentation/MatchMakerFramework.md +++ b/documentation/MatchMakerFramework.md @@ -1,49 +1,94 @@ -## Matchmaker Framework +# Matchmaker Framework + +The matchmaker framework is a component and a set of utitilities that can run either locally or remotely depending on the configuration. Together with the actual matchmaker, it is respnosible for deciding how the users device should be configured based on their preferences, current context and the solution registry data. More specifically, the matchmaker framework has the following responsibility: + +* Doing the preprocessing - that is, preparing and augmenting the input payload for the specific matchmaker +* Making the decision of which matchmaker to call, and then call that matchmaker (for example the [Canopy MatchMaker](CanopyMatchMaker.md)) +* Doing the post-processing - that is, taking the return payload from the matchmakers, parse it and pass it on in the login (or other) flow. +* Generally providing utilities that can be used by matchmaker implementations. -A locally running component, with the following responsiblities: -* Doing the preprocessing - that is, preparing the input payload for the matchmakers -* Making the decision of which MM to call (i.e. hybrid matchmaking), and then call that MM -* Doing the post-processing - that is, taking the return payload from the matchmakers and transformat ## Configuration -Like all other Kettle apps, the Matchmaker Framework is defined by a config file. Generally, the Matchmaker Framework configs are located in the `configs` folder of the matchMakerFramework component. The declaration of what matchmakers are available to the Matchmaker Framework, and where to find them should be set under the `matchMakers` option of the `gpii.matchMakerFramework`. Each entry should have the name of the matchmaker as key, and then the value of an object which at least contains a `url`. For example, in the following config file, two matchmakers are listed to be available. The "default" matchmaker, located at the url http://localhost:8081 and the "RuleBased" one at the url http://localhost:8078. +The matchmaker framework itself is not a Kettle app, but it expect at least matchmaker implementation to be available on a URL. The available matchmaker implementation should be provided in the options block under a `matchMakers` directive. Here, matchmaker implementation can be listed by some identifier (key) and an object with a `{ url: "SOME URL" }` object each. For example the options of having two matchmakers available, where the default one will be on port 8081 will be done like: ``` { - "type": "matchMakerFramework.development.all.local", + "type": "my.matchmakerframework.config", "options": { - "gradeNames": ["fluid.component"], - "components": { - "server": { - "type": "kettle.server", - "options": { - "logging": true, - "components": { - "matchMakerFramework": { - "type": "gpii.matchMakerFramework", - "options": { - "matchMakers": { - "default": { - "url": "http://localhost:8081" - }, - "RuleBased": { - "url": "http://localhost:8078" - } - } - } - } + "distributeOptions": { + "untrusted.development.matchMakers": { + "record": { + "default": { + "url": "http://localhost:8081" + }, + "otherMM": { + "url": "http://localhost:8084" } - } + }, + "target": "{that flowManager}.options.matchMakers" } } - }, - "mergeConfigs": [ - "./base.json" - ] + } } + ``` +## Detailed Description: + + +### Main steps of the match maker frameworks matching process + +1. The matchmaking process is triggered by the `processMatch` event of the FlowManager. The actual matchmaking flow is dictated by a combination of the priorities in `gpii.flowmanager.processmatch.priorities`, and the `processMatch` listeners (which are different depending on whether the system runs in trusted or untrusted mode) +* Preprocess: + * Triggered when the initial data has been collected (preferences, context, solution registry entries, etc) + * Augments the match maker input with inferred common terms (see under important utilities/functions in this document) + * TODO: _Full solutions registry is currently being used when inferring common terms. This is because the users NP set might contain e.g. Linux app preferences, even if the user is logging into a windows box. We then need the linux solutions registry entries to get information (if available) about how to transform the linux app preferences into common terms (that in turn can be translated into app settings for windows)._ +* matchMakerDispatcher: + * Sends the matchmaker input data to the actual matchmaker. _While there is functionality in place for allowing multiple matchmakers, the system is currently hardcoded to use the “default” one, which is the Canopy matchmaker in all the default configs_. + * A promise is returned, which will contain the original matchmaker input along with the response from the matchmaker in a block keyed by `matchMakerOutput`. + * The return payload is built in: `gpii.matchMakerFramework.utils.buildReturnPayload` + + +### Important utilities and concepts in the Match Maker Framework + +**The Canopy Matchmaker**: While this is not part of the matchmaker framework, it is important to mention the Canopy Match Maker, which is an (the only) implementation of a matchmaker, which uses most of the utilities described in this document as well as a canopy matching algorithm. It is described in details here: https://github.com/GPII/universal/blob/master/documentation/CanopyMatchMaker.md + + +**Solution Types**: To ensure that several conflicting solutions (e.g. two screenreaders) are not launched, "Types" can be calculated for each solution, based on the capabilities they have (and in the future, on their explicitly stated types). The inference of solution type based on capabilities is based on the "apptology" tranformation, from the "flat" format into a solution type ontology. In the matchmaking process, each time a solution is 'accepted', any other conflicting solutions (i.e. of the same type) will be rejected. Adding solution type information can be done via the `gpii.matchMakerFramework.utils.addSolutionTypeInformation` function. + +The apptology is described in more details here: [Apptology.md](Apptology.md). + +**Common Term Inference**: If the solution registry entry for a solution has an `inverseCapabilitiesTransformations` block specified, or does not have a `capabilitiesTransformations` (in which case, the system attempts to automatically calculate the inverses), the matchmaker framework can infer common terms from application specific settings. This means, that if the user has application specific settings for e.g. windows magnifier, the equivalent common term preferences can be inferred and used in the matchmaking process (e.g. finding the relevant settings for the linux magnifier). The inference happens via the `gpii.matchMakerFramework.utils.inferCommonTerms` function, and if these should be merged with an NP set, this can be done via the `gpii.matchMakerFramework.utils.addInferredCommonTerms` function. It is worth stressing two things: The use of inferred common terms is not mandatory in a matchmaking flow, but available via the above functions, and something which _is_ being used in the canopy matchmaker. Secondly, there is no metadata generated saying that the common terms are inferred, meaning that once added to an NP set, the matchmaker has no way of knowing whether the term was originally in the NP set or was inferred. + +Also, hte full solutions registry is currently being used when inferring common terms. This is because the users NP set might contain e.g. Linux app preferences, even if the user is logging into a windows box. We then need the linux solutions registry entries to get information (if available) about how to transform the linux app preferences into common terms (that in turn can be translated into app settings for windows). This should be changed into a more dynamically loaded solution registry fetching based on the users application settings, once the solutions registry has been turned into a queriable service. + + +**gpii.matchMakerFramework.utils.disposeFromPriority**: Explicit priorities are declared in the NP sets metadata section and will always be a floating point value of 1024 or more. Implicit priorities are deduced from application specific settings. When a user has application specific settings for a solution a priority of 512 is set for that solution. + +This function goes through all solutions from high priority to low. If a solution already has a disposition, it is ignored. Else it will be selected (accepted). Any solution with the same type, but a lower priority (or no priority) will be rejected. If there are two or more solutions of the same priority _and_ the same type (even partly), these will be considered a "tie". All lower-priority solutions of this type will still be rejected. The tied solutions will have their current disposition and priority removed and left to be disposed by some other disposal algorithm. + + +**gpii.matchmakerframework.utils.disposeSolution:** In many ways the “Heart” of the matchmaking process. It is responsible for adding priorities, augmenting the solution and preference data and finally passing it to some disposition (matchmaker) strategy that is passed as a parameter. In more details the following happens: +1. The solutions are run through `gpii.matchMakerFramework.utils.expandSolutions` augmenting them to, besides the original solution registry data, a skeleton of the solutions capabilities is built is built - i.e. a hierarchical object matching the solutions capabilities. +1. Next solution priorities are added to each solution according to application settings via `gpii.matchMakerFramework.utils.expandSolutions`. That is, if a user has any application settings the solution is considered to have a priority of 512. +1. Following this, explicit priorities of the users NP set is added to each solution. That is, if a user has application priorities in their metadata, this is added. These values will always be above 1024, and hence take priority (overwrite) the implicit priorities from the step above. +1. A leaves structure of the preferences is calculated in the `gpii.matchMakerFramework.utils.computeLeaves` function. This is a structure with a key for each preference in an EL-path format and a value of true. This, in conjunction with the solutions skeleton is useful for looking up matches via fluids' getPath functionality. +1. Once all this data has been prepared, the information is sent to the strategy (e.g. canopy match makers algorithm) +1. Finally a disposition is assigned to each solution based on the output of the strategy. + + +**Preference filtering:** When using a the untrusted flowmanager, security dictates that no "irrelevant" or unnused preferences of settings should be sent to the local device. Since the users NP set does need to be sent to the local device for use in the PSP, a filtering needs to happen, to ensure that the only settings reaching the local device are those that have been used to configure the device. This filtering can be done using the `gpii.matchMakerFramework.utils.filterPreferencesForSolution` function. + + +**matchMakerDispatcher:** Sends the matchmaker input data to the actual matchmaker. While there is functionality in place for allowing multiple matchmakers, the system is currently hardcoded to use the “default” one, which is the Canopy matchmaker. + +A promise is returned, which will contain the original matchmaker input along with the matchmaker response in a block keyed by matchMakerOutput + +The dispatching happens in the function `gpii.matchMakerFramework.matchMakerDispatcher`. + + + ## API: The matchmakers that can be called from the Matchmaker Framework need to adhere to the following API. @@ -58,91 +103,66 @@ The input for these POST requests will be in the following format. Note that it ``` { - preferences: { - "contexts": { - "gpii-default": { - "name": "Default preferences", - "preferences": { - "http://registry.gpii.net/common/fontSize": 15, - "http://registry.gpii.net/common/speechRate": 15 - } - }, - "nighttime-at-home": { - "name": "Nighttime at home", - "preferences": { - "http://registry.gpii.net/common/fontSize": 18 - }, - "metadata": [ - { - "type": "required", - "scope": ["http://registry.gpii.net/common/fontSize"], - "value": 100 - } - ], - "conditions": [ - { - "type": "http://gpii.net/common/operators/inRange", - "max": 1800, - "min": 600, - "inputPath": "http://registry.gpii.net/conditions/timeOfDay" - } - ] - } +{ + "activeContexts": [], + "environmentReporter": {}, + "inferredCommonTerms": { + "gpii-default": { + "com.microsoft.windows.highContrast": { + "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrastTheme": "white-black" + }, + "net.gpii.uioPlus": { + "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrastTheme": "white-black" + } + } + }, + "userToken": "snapset_2a", + "preferences": { + "name": "Dark & Larger 125%", + "contexts": { + "gpii-default": { + "name": "Default preferences", + "preferences": { + "http://registry.gpii.net/common/cursorSize": 1, + "http://registry.gpii.net/common/DPIScale": 1.25, + "http://registry.gpii.net/applications/com.microsoft.windows.highContrast": { + "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrastTheme": "white-black" + }, + "http://registry.gpii.net/applications/net.gpii.uioPlus": { + "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrastTheme": "white-black" + } } - }, - deviceReporter: { - "OS": { - "id": "win32", - "version": "5.0.0" - }, - "solutions": [ - { - "id": "com.microsoft.windows.onscreenKeyboard" - }, { - "id": "com.microsoft.windows.desktop" - }, - (...) - { - "id": "org.nvda-project" - }, { - "id": "com.freedomScientific.jaws" - } - ] - }, - environmentReporter: { - "http://registry.gpii.net/terms/environment/brightness": 60, - "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.json5 - }, - activeContexts: [ - "gpii-default", - "nighttime-at-home" + } + } + }, + "deviceContext": { + "solutions": [ + { + "id": "com.microsoft.windows.magnifier" + }, + { + "id": "com.microsoft.windows.onscreenKeyboard" + }, + ... + { + "id": "com.microsoft.windows.narrator" + } ], - inverseCapabilities: { - "com.microsoft.windows.cursors": { - "http://registry.gpii.net/common/mouseTrailing": 0.8, - (...), - "http://registry.gpii.net/common/cursorSize": 0.60 - }, - (...), - "org.nvda-project": { - (...) - } - }, - rematch: { //out of scope for review - it would be useful to allow a MM specific block in the MM output, - //which can then be sent back in the rematch section to make the MM more informed - // [ ? - userFeedback: { - dislike: true - }, - previousOutput: { - // vast document previously output by matchmaker in this session - } - // ]? + "OS": { + "id": "win32", + "version": "6.1.7601" } + }, + "solutionsRegistryEntries": { + "com.microsoft.windows.magnifier": { .. }, + "com.microsoft.windows.narrator": { ... }, + .... + "com.microsoft.windows.filterKeys": { ... } + } } ``` @@ -152,82 +172,39 @@ The return payload from at call to `/match` should be in the following format: ``` { - "inferredConfiguration": { - "gpii-default": { - "applications": { - "com.microsoft.windows.desktop": { - "active": true, - "settings": { - "http://registry.gpii.net/common/fontSize": 200, - "http://registry.gpii.net/applications/com.microsoft.windows.desktop/otherSetting": "reallyBig" - } - }, - "org.cats": {} - } + "inferredConfiguration": { + "gpii-default": { + "applications": { + "com.microsoft.windows.highContrast": { + "active": true, + "settings": { + "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrastTheme": "white-black", + "http://registry.gpii.net/applications/com.microsoft.windows.highContrast": {} + } }, - "nighttime-at-home":{ - "applications": { - "com.microsoft.windows.desktop": { - "active": true, - "settings": { - "http://registry.gpii.net/common/fontSize": 800 /// <-- really? fontsize 800!? - } - } - }, - "conditions": [ - { - "type": "http://gpii.net/common/operators/(time?)inRange", - "max": 1800, - "min": 600, - "inputPath": "http://registry.gpii.net/conditions/timeOfDay" - } - ] + "com.microsoft.windows.screenDPI": { + "active": true, + "settings": { + "http://registry.gpii.net/common/DPIScale": 1.25 + } }, - "gpii-xyz-autogenerated12365478": { - "applications": { - "com.freedomScientic.jaws": { - "active": true, - "settings": { - "active": false, - "http://registry.gpii.net/common/speechRate": 800 - } - } - }, - "conditions": [ - { - "type": "http://gpii.net/common/operators/inRange", - "max": 10, - "min": 6, - "inputPath": "http://registry.gpii.net/conditions/sound" - } - ], - "metadata": [ - { - "scope": [ - "org.nvda-project" - ], - "type": "infoMessage", - "help": "....TBDwithalex...." - }, - { - "type": "PCPPopulation", - "scope": [], - "settings": { - "http: //registry.gpii.net/applications/com.microsoft.windows.desktop": [ - "fontSize" - ], - "com.microsoft.windows.desktop": [ - "http: //registry.gpii.net/common/fontSize" - ] - } - } - ] + "com.microsoft.windows.cursors": { + "active": true, + "settings": { + "http://registry.gpii.net/common/cursorSize": 1 + } + }, + "net.gpii.uioPlus": { + "active": true, + "settings": { + "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrastTheme": "white-black", + "http://registry.gpii.net/applications/net.gpii.uioPlus": {} + } } - }, - "status": { - "type": "success", - "code": 200, - "message": "Catsare(inconsistently)decent" + } } + } } ``` diff --git a/gpii/node_modules/matchMakerFramework/src/MatchMakerFramework.js b/gpii/node_modules/matchMakerFramework/src/MatchMakerFramework.js index 89b21a5df..37de7a48c 100644 --- a/gpii/node_modules/matchMakerFramework/src/MatchMakerFramework.js +++ b/gpii/node_modules/matchMakerFramework/src/MatchMakerFramework.js @@ -59,9 +59,7 @@ fluid.defaults("gpii.matchMakerFramework", { */ gpii.matchMakerFramework.preProcess = function (that, initialPayload) { var matchMakerInput = fluid.extend({ - activeContexts: [ // TODO calculate properly - "gpii-default" - ], + activeContexts: [], // set later in the process environmentReporter: {}, // TODO, inferredCommonTerms: gpii.matchMakerFramework.utils.inferCommonTerms(initialPayload.preferences, initialPayload.fullSolutionsRegistry) }, initialPayload); From 9ac98e9f958a90b96b84facc77f6a0e62b67bf37 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 7 Feb 2018 11:59:55 +0100 Subject: [PATCH 27/44] Broken stuff --- .../lifecycleManager/src/LifecycleManager.js | 32 ++--- .../test/js/LifecycleManagerTests.js | 26 ++-- testData/solutions/android.json5 | 28 +++-- testData/solutions/linux.json5 | 50 ++++---- testData/solutions/win32.json5 | 111 +++++++++++------- 5 files changed, 146 insertions(+), 101 deletions(-) diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index 1acd5ba1f..5b3f50476 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -333,7 +333,7 @@ var gpii = fluid.registerNamespace("gpii"); * model snapshot area in the LifecycleManager's session. Tightly bound to executeSettingsAction, executes one-to-one with it * with almost identical argument list. */ - gpii.lifecycleManager.recordSnapshotInSession = function (that, snapshot, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction) { + gpii.lifecycleManager.recordSnapshotInSession = function (that, snapshot, solutionId, solutionRecord, session, handlerType, settingsHandlerBlockName, rootAction) { if (rootAction === "start" || rootAction === "update") { var toSnapshot = gpii.lifecycleManager.removeSettingsBlocks(fluid.copy(solutionRecord)); @@ -341,7 +341,7 @@ var gpii = fluid.registerNamespace("gpii"); // This is particularly relevant for launch handlers, where we will need to run the "get" directives on logout to decide // whether we an application is running or not, and consequently, whether to run the "update" or "stop" block // toSnapshot.settingsHandlers = {}; - toSnapshot.settingsHandlers[settingsHandlerBlockName] = snapshot; + toSnapshot[handlerType][settingsHandlerBlockName] = snapshot; // keep the settings that are already stored from the // original snapshot, but augment it with any settings from the new snapshot // that were not present in the original snapshot. @@ -370,6 +370,7 @@ var gpii = fluid.registerNamespace("gpii"); return rootAction === "restore" && fluid.isPromise(promise) ? gpii.rejectToLog(promise, " while restoring journal snapshot") : promise; }; +fluid.logObjectRenderChars = 16000; /** * @param that {Object} The lifecycle manager component @@ -377,6 +378,7 @@ var gpii = fluid.registerNamespace("gpii"); * @param solutionRecord {Object} The solution registry entry for the solution * @param session {Component} The current session component. This function will attach the * solution record to the 'appliedSolutions' of the session's model (if successful) + * @param handlerType {String} The name of the handler block (i.e. "settings" or "launchers") * @param settingsHandlerBlockName {String} should be a reference to a settings block from the * settingsHandlers section. * @param rootAction {String} The root action on the LifecycleManager which is being serviced: "start", "stop", @@ -384,8 +386,8 @@ var gpii = fluid.registerNamespace("gpii"); * @return {Function} a nullary function (a task), that once executed will set the settings returning a promise * that will be resolved once the settings are successfully set. */ - gpii.lifecycleManager.executeSettingsAction = function (that, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction) { - var settingsHandlerBlock = solutionRecord.settingsHandlers[settingsHandlerBlockName]; + gpii.lifecycleManager.executeSettingsAction = function (that, solutionId, solutionRecord, session, handlerType, settingsHandlerBlockName, rootAction) { + var settingsHandlerBlock = solutionRecord[handlerType][settingsHandlerBlockName]; if (settingsHandlerBlock === undefined) { fluid.fail("Reference to non-existing settingsHandler block named " + settingsHandlerBlockName + " in solution " + solutionId); @@ -400,7 +402,7 @@ var gpii = fluid.registerNamespace("gpii"); settingsPromise.then(function (snapshot) { session.applier.change(["appliedSolutions", solutionId], solutionRecord); gpii.lifecycleManager.recordSnapshotInSession(that, snapshot, solutionId, solutionRecord, session, - settingsHandlerBlockName, rootAction); + handlerType, settingsHandlerBlockName, rootAction); }); return gpii.lifecycleManager.wrapRestorePromise(settingsPromise, rootAction); } @@ -506,21 +508,23 @@ var gpii = fluid.registerNamespace("gpii"); if (typeof(action) === "string") { // if the action is a reference to a settings block (settings. where is a key to // the settings handler block) - if (action.indexOf("settings.") === 0) { + if (action.startsWith("settings.")) { var settingsHandlerBlockName = action.substring("settings.".length); + return gpii.lifecycleManager.executeSettingsAction(that, solutionId, solutionRecord, session, "settingsHandlers", settingsHandlerBlockName, rootAction); + } else if (action.startsWith("launchers.")) { + var launchHandlerBlockName = action.substring("launchers.".length); if (actionBlock === "isRunning") { // if we're just checking for the run state, dont actually modify the solutionRecord with settings: - var tmpSolutionRecord = fluid.copy(solutionRecord); - fluid.set(tmpSolutionRecord, [ "settingsHandlers", settingsHandlerBlockName, "settings"], { running: null }); - return gpii.lifecycleManager.executeSettingsAction(that, solutionId, tmpSolutionRecord, session, settingsHandlerBlockName, rootAction); + solutionRecord = fluid.copy(solutionRecord); + fluid.set(solutionRecord, [ "launchHandlers", settingsHandlerBlockName, "settings"], { running: null }) + return gpii.lifecycleManager.executeSettingsAction(that, solutionId, solutionRecord, session, "launchHandlers", launchHandlerBlockName, rootAction); } else { - // if this is related to launching, overwrite entry with the appropriate settings, - // that is: { running: true } if we're in a start block, else { running: false } if (actionBlock === "start" || actionBlock === "stop") { + // Set appropritate settings (i.e. { running: true } if we're in a start block, else { running: false }. var launchSettings = { running: actionBlock === "start" ? true : false }; - fluid.set(solutionRecord, [ "settingsHandlers", settingsHandlerBlockName, "settings"], launchSettings); + fluid.set(solutionRecord, [ "launchHandlers", launchHandlerBlockName, "settings"], launchSettings); } - return gpii.lifecycleManager.executeSettingsAction(that, solutionId, solutionRecord, session, settingsHandlerBlockName, rootAction); + return gpii.lifecycleManager.executeSettingsAction(that, solutionId, solutionRecord, session, "launchHandlers", launchHandlerBlockName, rootAction); } } else if (actionBlock === "update") { // Keywords: "start", "stop", "configure" are allowed here as well, and @@ -536,7 +540,7 @@ var gpii = fluid.registerNamespace("gpii"); " inside 'update' section for solution " + solutionId); } } - } else { // TODO should be removed when GPII-1235 has been solved (lifecycle actions are settings handlers) + } else { // We allow free lifecycle actions, but strongly discourage them, since we dont have control of logging state like with settings/launch handlers return function () { var expanded = session.localResolver(action); var result = gpii.lifecycleManager.invokeAction(expanded, that.nameResolver); diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index 2176bf5cc..59275f41d 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -148,13 +148,13 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt "settings.myconf" ], "start": [ - "settings.launcher" + "launchers.launcher" ], "stop": [ - "settings.launcher" + "launchers.launcher" ], "isRunning": [ - "settings.launcher" + "launchers.launcher" ] }; @@ -431,13 +431,13 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt { "active": true, "start": [ - "settings.launcher" + "launchers.launcher" ], "stop": [ - "settings.launcher" + "launchers.launcher" ], "isRunning": [ - "settings.launcher" + "launchers.launcher" ] } ), @@ -459,7 +459,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt "settings.myconf" ], "isRunning": [ - "settings.launcher" + "launchers.launcher" ] } ), @@ -504,13 +504,13 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt "settings.myconf" ], "start": [ - "settings.launcher" + "launchers.launcher" ], "stop": [ - "settings.launcher" + "launchers.launcher" ], "isRunning": [ - "settings.launcher" + "launchers.launcher" ] } ), @@ -596,13 +596,13 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt "settings.myconf" ], "start": [ - "settings.launcher" + "launchers.launcher" ], "stop": [ - "settings.launcher" + "launchers.launcher" ], "isRunning": [ - "settings.launcher" + "launchers.launcher" ], "update": [ "stop", diff --git a/testData/solutions/android.json5 b/testData/solutions/android.json5 index a0eb70690..80eac4051 100644 --- a/testData/solutions/android.json5 +++ b/testData/solutions/android.json5 @@ -13,7 +13,9 @@ "capabilities": [ "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" ] - }, + } + }, + "launchHandlers": { "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { @@ -27,10 +29,10 @@ } }, "start": [ - "settings.launcher" + "launchers.launcher" ], "isRunning": [ - "settings.launcher" + "launchers.launcher" ] }, @@ -48,7 +50,9 @@ "capabilities": [ "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" ] - }, + } + }, + "launchHandlers": { "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { @@ -65,13 +69,13 @@ } }, "start": [ - "settings.launcher" + "launchers.launcher" ], "stop": [ - "settings.launcher" + "launchers.launcher" ], "isRunning": [ - "settings.launcher" + "launchers.launcher" ] }, @@ -440,7 +444,9 @@ } }, "inverseCapabilitiesTransformations": {} - }, + } + }, + "launchHandlers": { "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { @@ -464,13 +470,13 @@ } }, "start": [ - "settings.launcher" + "launchers.launcher" ], "stop": [ - "settings.launcher" + "launchers.launcher" ], "isRunning": [ - "settings.launcher" + "launchers.launcher" ], "configure": [ "settings.configuration" diff --git a/testData/solutions/linux.json5 b/testData/solutions/linux.json5 index 29dda8842..42b499345 100644 --- a/testData/solutions/linux.json5 +++ b/testData/solutions/linux.json5 @@ -83,7 +83,9 @@ } ] } - }, + } + }, + "launchHandlers": { "launcher": { "type": "gpii.gsettings.launch", "options": { @@ -105,13 +107,13 @@ "settings.configuration" ], "start": [ - "settings.launcher" + "launchers.launcher" ], "stop": [ - "settings.launcher" + "launchers.launcher" ], "isRunning": [ - "settings.launcher" + "launchers.launcher" ], "isInstalled": [ { @@ -1098,7 +1100,9 @@ } ] } - }, + } + }, + "launchHandlers": { "launcher": { "type": "gpii.gsettings.launch", "options": { @@ -1119,13 +1123,13 @@ "settings.configuration" ], "start": [ - "settings.launcher" + "launchers.launcher" ], "stop": [ - "settings.launcher" + "launchers.launcher" ], "isRunning": [ - "settings.launcher" + "launchers.launcher" ], "isInstalled": [ { @@ -1200,7 +1204,9 @@ "capabilities": [ "http://registry\\.gpii\\.net/common/simplification" ] - }, + } + }, + "launchHandlers": { "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { @@ -1219,13 +1225,13 @@ } }, "start": [ - "settings.launcher" + "launchers.launcher" ], "stop": [ - "settings.launcher" + "launchers.launcher" ], "isRunning": [ - "settings.launcher" + "launchers.launcher" ], "isInstalled": [ { @@ -1259,7 +1265,9 @@ "capabilities": [ "http://registry\\.gpii\\.net/common/simplification" ] - }, + } + }, + "launchHandlers": { "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { @@ -1278,13 +1286,13 @@ } }, "start": [ - "settings.launcher" + "launchers.launcher" ], "stop": [ - "settings.launcher" + "launchers.launcher" ], "isRunning": [ - "settings.launcher" + "launchers.launcher" ], "isInstalled": [ { @@ -1318,7 +1326,9 @@ "capabilities": [ "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" ] - }, + } + }, + "launchHandlers": { "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { @@ -1337,13 +1347,13 @@ } }, "start": [ - "settings.launcher" + "launchers.launcher" ], "stop": [ - "settings.launcher" + "launchers.launcher" ], "isRunning": [ - "settings.launcher" + "launchers.launcher" ], "isInstalled": [ { diff --git a/testData/solutions/win32.json5 b/testData/solutions/win32.json5 index e4dcd58f2..934691e52 100644 --- a/testData/solutions/win32.json5 +++ b/testData/solutions/win32.json5 @@ -607,7 +607,9 @@ } } } - }, + } + }, + "launchHandlers": { "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { @@ -659,10 +661,10 @@ "start" ], "start": [ - "settings.launcher" + "launchers.launcher" ], "stop": [ - "settings.launcher" + "launchers.launcher" ], "update": [ "stop", @@ -670,7 +672,7 @@ "start" ], "isRunning": [ - "settings.launcher" + "launchers.launcher" ], "isInstalled": [ { @@ -729,7 +731,9 @@ "ApplicationSettings.Spelling.SpellAsIType.$t": {}, "ApplicationSettings.Speech.optAutoUseScreenReading.$t": {} } - }, + } + }, + "launchHandlers": { "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { @@ -771,10 +775,10 @@ "start" ], "start": [ - "settings.launcher" + "launchers.launcher" ], "stop": [ - "settings.launcher" + "launchers.launcher" ], "update": [ "stop", @@ -782,7 +786,7 @@ "start" ], "isRunning": [ - "settings.launcher" + "launchers.launcher" ], "isInstalled": [ { @@ -959,7 +963,9 @@ } ] } - }, + } + }, + "launchHandlers": { "launcher": { "type": "gpii.windows.enableRegisteredAT", "options": { @@ -975,10 +981,10 @@ } }, "start": [ - "settings.launcher" + "launchers.launcher" ], "stop": [ - "settings.launcher" + "launchers.launcher" ], "update": [ "stop", @@ -986,7 +992,7 @@ "start" ], "isRunning": [ - "settings.launcher" + "launchers.launcher" ], "configure": [ "settings.configure" @@ -1039,7 +1045,9 @@ "literalValue": 0 } } - }, + } + }, + "launchHandlers": { "launcher": { "type": "gpii.windows.enableRegisteredAT", "options": { @@ -1049,10 +1057,10 @@ } }, "start": [ - "settings.launcher" + "launchers.launcher" ], "stop": [ - "settings.launcher" + "launchers.launcher" ], "update": [ "stop", @@ -1060,7 +1068,7 @@ "start" ], "isRunning": [ - "settings.launcher" + "launchers.launcher" ], "configure": [ "settings.configure" @@ -1317,6 +1325,9 @@ } } } + }, + "launchHandlers": { + }, "configure": [ "settings.configure", @@ -1740,7 +1751,9 @@ } ] } - }, + } + }, + "launchHandlers": { "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { @@ -1774,10 +1787,10 @@ } }, "start": [ - "settings.launcher" + "launchers.launcher" ], "stop": [ - "settings.launcher" + "launchers.launcher" ], "update": [ "stop", @@ -1785,7 +1798,7 @@ "start" ], "isRunning": [ - "settings.launcher" + "launchers.launcher" ], "configure": [ "settings.configs" @@ -1821,7 +1834,9 @@ "capabilities": [ "http://registry\\.gpii\\.net/common/simplification" ] - }, + } + }, + "launchHandlers": { "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { @@ -1840,13 +1855,13 @@ } }, "start": [ - "settings.launcher" + "launchers.launcher" ], "stop": [ - "settings.launcher" + "launchers.launcher" ], "isRunning": [ - "settings.launcher" + "launchers.launcher" ], // Although there are no settings to deal with, we need to pass through // the "configure" action in order to proceed with the "stop" directive @@ -1878,7 +1893,9 @@ "capabilities": [ "http://registry\\.gpii\\.net/common/pictorialSimplification" ] - }, + } + }, + "launchHandlers": { "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { @@ -1897,13 +1914,13 @@ } }, "start": [ - "settings.launcher" + "launchers.launcher" ], "stop": [ - "settings.launcher" + "launchers.launcher" ], "isRunning": [ - "settings.launcher" + "launchers.launcher" ], "isInstalled": [ { @@ -1928,7 +1945,9 @@ "capabilities": [ "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" ] - }, + } + }, + "launchHandlers": { "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { @@ -1947,13 +1966,13 @@ } }, "start": [ - "settings.launcher" + "launchers.launcher" ], "stop": [ - "settings.launcher" + "launchers.launcher" ], "isRunning": [ - "settings.launcher" + "launchers.launcher" ], "isInstalled": [ { @@ -2035,7 +2054,9 @@ ] }, "inverseCapabilitiesTransformations": {} - }, + } + }, + "launchHandlers": { "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { @@ -2072,10 +2093,10 @@ "settings.configuration" ], "start": [ - "settings.launcher" + "launchers.launcher" ], "stop": [ - "settings.launcher" + "launchers.launcher" ], "update": [ "stop", @@ -2083,7 +2104,7 @@ "start" ], "isRunning": [ - "settings.launcher" + "launchers.launcher" ], "isInstalled": [ { @@ -3087,7 +3108,9 @@ } ] } - }, + } + }, + "launchHandlers": { "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { @@ -3101,7 +3124,7 @@ } }, "start": [ - "settings.launcher" + "launchers.launcher" ], "stop": [], "update": [ @@ -3109,7 +3132,7 @@ "start" ], "isRunning": [ - "settings.launcher" + "launchers.launcher" ], "configure": [ "settings.configure" @@ -3186,7 +3209,9 @@ } }, "inverseCapabilitiesTransformations": {} - }, + } + }, + "launchHandlers": { "launcher": { "type": "gpii.launchHandlers.flexibleHandler", "options": { @@ -3218,13 +3243,13 @@ "settings.configuration" ], "isRunning": [ - "settings.launcher" + "launchers.launcher" ], "start": [ - "settings.launcher" + "launchers.launcher" ], "stop": [ - "settings.launcher" + "launchers.launcher" ], "update": [ "stop", From 4249807195d7700b57f93dd8c196b3bcaa86e558 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 7 Feb 2018 13:57:11 +0100 Subject: [PATCH 28/44] GPII-1230: Change an entry that i missed from settings. to launcher. --- gpii/node_modules/lifecycleManager/src/LifecycleManager.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index 5b3f50476..72ef65a40 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -666,9 +666,9 @@ fluid.logObjectRenderChars = 16000; gpii.lifecycleManager.getSolutionRunningStateFromSnapshot = function (solutionSnapshot) { // get isRunning entry from snapshot and block to run: var isRunningBlock = fluid.makeArray(solutionSnapshot.isRunning)[0]; - if (isRunningBlock && isRunningBlock.indexOf("settings.") === 0) { - var settingsHandlerBlockName = isRunningBlock.substring("settings.".length); - var recordedState = fluid.get(solutionSnapshot, ["settingsHandlers", settingsHandlerBlockName, "settings", "running"]); + if (isRunningBlock && isRunningBlock.indexOf("launchers.") === 0) { + var settingsHandlerBlockName = isRunningBlock.substring("launchers.".length); + var recordedState = fluid.get(solutionSnapshot, ["launchHandlers", settingsHandlerBlockName, "settings", "running"]); return recordedState; } }; From 72dc6f0f7dcd36718d72c86abe129efe59e02283 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 7 Feb 2018 14:21:48 +0100 Subject: [PATCH 29/44] GPII-1230: Added remaining instances of taking launchhandler block into account --- .../lifecycleManager/src/LifecycleManager.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index 72ef65a40..31081e2c9 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -323,8 +323,10 @@ var gpii = fluid.registerNamespace("gpii"); /** Remove all the settings blocks from a solutions registry entry */ gpii.lifecycleManager.removeSettingsBlocks = function (solutionEntry) { - solutionEntry.settingsHandlers = fluid.transform(solutionEntry.settingsHandlers, function (handler) { - return fluid.filterKeys(handler, "settings", true); + fluid.each(["settingsHandlers", "launchHandlers"], function (handlersBlock) { + solutionEntry[handlersBlock] = fluid.transform(solutionEntry[handlersBlock], function (handler) { + return fluid.filterKeys(handler, "settings", true); + }); }); return solutionEntry; }; @@ -415,15 +417,18 @@ fluid.logObjectRenderChars = 16000; * back to settings. In a future version of the SettingsHandler API, this will not be necessary. * This is called during the "stop" action to convert the snapshotted "originalSettings" model material back to material * suitable for being sent to executeSettingsAction, as well as at the corresponding point during the "journal restore" - * operation + * operationf * @param solutionSettings {Object} A settings block for a single solution, holding a member named `settingsHandlers` * @param transformer {Function} A function which will transform one settingsHandlers block in the supplied `solutionSettings` */ gpii.lifecycleManager.transformSolutionSettings = function (solutionSettings, transformer) { var togo = fluid.copy(solutionSettings); // safe since armoured - togo.settingsHandlers = fluid.transform(solutionSettings.settingsHandlers, function (handlerBlock) { - return gpii.settingsHandlers.transformOneSolutionSettings(handlerBlock, transformer); + fluid.each(["settingsHandlers", "launchHandlers"], function (handlersBlock) { + togo[handlersBlock] = fluid.transform(solutionSettings[handlersBlock], function (handler) { + return gpii.settingsHandlers.transformOneSolutionSettings(handler, transformer); + }); }); + return togo; }; From 536fc35d9ecea527024f888d8e3c7863ef5fa373 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Thu, 8 Feb 2018 12:17:15 +0100 Subject: [PATCH 30/44] GPII-1230: All tests passing again after splitting settings/launch handlers --- .../lifecycleManager/src/LifecycleManager.js | 17 +-- testData/solutions/linux.json5 | 13 +- tests/CloseConflictingAppsTests.js | 3 +- tests/MultiSettingsHandlerTests.js | 3 +- tests/all-tests.js | 1 + tests/data/multiSHSolutionRegistry.json | 111 +++++++++--------- 6 files changed, 72 insertions(+), 76 deletions(-) diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index 31081e2c9..9f0c081e0 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -241,7 +241,7 @@ var gpii = fluid.registerNamespace("gpii"); // that the transformation of common terms into application specific settings doesn't occur until the // transformation stage - so we don't have the full list of app-specific settings to filter until now. for (var settingName in handlerSpec.supportedSettings) { - if (settingName in handlerSpec.settings) { + if (handlerSpec.settings && settingName in handlerSpec.settings) { settings[settingName] = handlerSpec.settings[settingName]; } } @@ -372,7 +372,6 @@ var gpii = fluid.registerNamespace("gpii"); return rootAction === "restore" && fluid.isPromise(promise) ? gpii.rejectToLog(promise, " while restoring journal snapshot") : promise; }; -fluid.logObjectRenderChars = 16000; /** * @param that {Object} The lifecycle manager component @@ -518,19 +517,15 @@ fluid.logObjectRenderChars = 16000; return gpii.lifecycleManager.executeSettingsAction(that, solutionId, solutionRecord, session, "settingsHandlers", settingsHandlerBlockName, rootAction); } else if (action.startsWith("launchers.")) { var launchHandlerBlockName = action.substring("launchers.".length); + if (actionBlock === "isRunning") { // if we're just checking for the run state, dont actually modify the solutionRecord with settings: solutionRecord = fluid.copy(solutionRecord); - fluid.set(solutionRecord, [ "launchHandlers", settingsHandlerBlockName, "settings"], { running: null }) - return gpii.lifecycleManager.executeSettingsAction(that, solutionId, solutionRecord, session, "launchHandlers", launchHandlerBlockName, rootAction); - } else { - if (actionBlock === "start" || actionBlock === "stop") { - // Set appropritate settings (i.e. { running: true } if we're in a start block, else { running: false }. - var launchSettings = { running: actionBlock === "start" ? true : false }; - fluid.set(solutionRecord, [ "launchHandlers", launchHandlerBlockName, "settings"], launchSettings); - } - return gpii.lifecycleManager.executeSettingsAction(that, solutionId, solutionRecord, session, "launchHandlers", launchHandlerBlockName, rootAction); } + // Set appropritate settings (i.e. { running: true } if we're in a start block, else { running: false }. + var launchSettings = { running: actionBlock === "start" ? true : false }; + fluid.set(solutionRecord, [ "launchHandlers", launchHandlerBlockName, "settings"], launchSettings); + return gpii.lifecycleManager.executeSettingsAction(that, solutionId, solutionRecord, session, "launchHandlers", launchHandlerBlockName, rootAction); } else if (actionBlock === "update") { // Keywords: "start", "stop", "configure" are allowed here as well, and // and will result in evaluating the respective block diff --git a/testData/solutions/linux.json5 b/testData/solutions/linux.json5 index 42b499345..f3c97dcc2 100644 --- a/testData/solutions/linux.json5 +++ b/testData/solutions/linux.json5 @@ -91,9 +91,6 @@ "options": { "schema": "org.gnome.desktop.a11y.applications", "key": "screen-magnifier-enabled" - }, - "supportedSettings": { - "running": {} } } }, @@ -298,7 +295,9 @@ "capabilities": [ "http://registry\\.gpii\\.net/common/onScreenKeyboardEnabled" ] - }, + } + }, + "launchHandlers": { "launching": { "type": "gpii.gsettings.launch", "options": { @@ -310,13 +309,13 @@ "update": [ ], "start": [ - "settings.launching" + "launchers.launching" ], "stop": [ - "settings.launching" + "launchers.launching" ], "isRunning": [ - "settings.launching" + "launchers.launching" ], "isInstalled": [ { diff --git a/tests/CloseConflictingAppsTests.js b/tests/CloseConflictingAppsTests.js index 52ba5d84a..a7b81c785 100644 --- a/tests/CloseConflictingAppsTests.js +++ b/tests/CloseConflictingAppsTests.js @@ -108,7 +108,6 @@ gpii.tests.conflictingApps.testDefs = [ gpii.tests.conflictingApps.NVDAHandlerEntry(false)) }, settingsHandlers: { - "gpii.settingsHandlers.INISettingsHandler": { "org.nvda-project": [ { @@ -258,7 +257,7 @@ gpii.tests.conflictingApps.testDefs = [ } ]; -module.exports = gpii.test.bootstrap({ +module.exports = gpii.test.runTests({ testDefs: "gpii.tests.conflictingApps.testDefs", configName: "gpii.tests.multiScreenreader.config", configPath: "%universal/tests/configs" diff --git a/tests/MultiSettingsHandlerTests.js b/tests/MultiSettingsHandlerTests.js index eeb9eff45..474becb7e 100644 --- a/tests/MultiSettingsHandlerTests.js +++ b/tests/MultiSettingsHandlerTests.js @@ -56,8 +56,7 @@ gpii.tests.multiSHSupport.testDefs = [ } ] } - }, - processes: [] + } } ]; diff --git a/tests/all-tests.js b/tests/all-tests.js index d4ab0faf2..88afc65de 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -41,6 +41,7 @@ var testIncludes = [ "./UserLogonStateChangeTests.js", "./MultiSettingsHandlerTests.js", "./IntegrationTests.js", + "./CloseConflictingAppsTests.js", "./ContextIntegrationTests.js", "./JournalIntegrationTests.js", "./DeviceReporterErrorTests.js", diff --git a/tests/data/multiSHSolutionRegistry.json b/tests/data/multiSHSolutionRegistry.json index a1d593921..fbf9c8207 100644 --- a/tests/data/multiSHSolutionRegistry.json +++ b/tests/data/multiSHSolutionRegistry.json @@ -1,61 +1,64 @@ { - "fakemag1": { - "name": "Fake Magnifier 1", - "contexts": { - "OS": [ - { - "id": "win32" - } - ] - }, - "settingsHandlers": { - "configuration": { - "type": "gpii.settingsHandlers.JSONSettingsHandler", - "options": { - "filename": "/tmp/fakemag1.settings.json" - }, - "supportedSettings": { - "tilingMagnifiers": {}, - "magnification": {}, - "tracking": {} + "win32": { + "fakemag1": { + "name": "Fake Magnifier 1", + "contexts": { + "OS": [ + { + "id": "win32", + "version": ">=5.0" + } + ] + }, + "settingsHandlers": { + "configuration": { + "type": "gpii.settingsHandlers.JSONSettingsHandler", + "options": { + "filename": "/tmp/fakemag1.settings.json" + }, + "supportedSettings": { + "tilingMagnifiers": {}, + "magnification": {}, + "tracking": {} + }, + "capabilities": [ + "http://registry\\.gpii\\.net/common/magnifierEnabled" + ], + "capabilitiesTransformations": { + "magnification": "http://registry\\.gpii\\.net/common/magnification", + "tracking": "http://registry\\.gpii\\.net/common/tracking" + } }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/magnifierEnabled" - ], - "capabilitiesTransformations": { - "magnification": "http://registry\\.gpii\\.net/common/magnification", - "tracking": "http://registry\\.gpii\\.net/common/tracking" + "configuration1": { + "type": "gpii.settingsHandlers.JSONSettingsHandler", + "options": { + "filename": "/tmp/fakemag2.settings.json" + }, + "supportedSettings": { + "weirdSetting": {}, + "crazyColor": {} + }, + "capabilities": [], + "capabilitiesTransformations": { + "crazyColor": "http://registry\\.gpii\\.net/common/invertColours" + } } }, - "configuration1": { - "type": "gpii.settingsHandlers.JSONSettingsHandler", - "options": { - "filename": "/tmp/fakemag2.settings.json" - }, - "supportedSettings": { - "weirdSetting": {}, - "crazyColor": {} - }, - "capabilities": [], - "capabilitiesTransformations": { - "crazyColor": "http://registry\\.gpii\\.net/common/invertColours" + "configure": [ + "settings.configuration", + "settings.configuration1" + ], + "restore": [ + "settings.configuration", + "settings.configuration1" + ], + "start": [ ], + "stop": [ ], + "isInstalled": [ + { + "type": "gpii.deviceReporter.alwaysInstalled" } - } - }, - "configure": [ - "settings.configuration", - "settings.configuration1" - ], - "restore": [ - "settings.configuration", - "settings.configuration1" - ], - "start": [ ], - "stop": [ ], - "isInstalled": [ - { - "type": "gpii.deviceReporter.alwaysInstalled" - } - ] + ] + } } } From 8c3bbc263ea9e8bef7fbdd17404c5d6113e24f3a Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Thu, 8 Feb 2018 17:14:56 +0100 Subject: [PATCH 31/44] GPII-1230: Take liveness into account in case there is no 'update' directive --- .../flowManager/src/PCPChannel.js | 4 +- .../lifecycleManager/src/LifecycleManager.js | 28 +++- .../test/html/LifecycleManagerTest.html | 1 + .../test/js/LifecycleManagerTests.js | 123 ++++++++++++++++-- .../src/MatchMakerUtilities.js | 29 +++-- .../test/js/MatchMakerUtilitiesTests.js | 7 +- 6 files changed, 167 insertions(+), 25 deletions(-) diff --git a/gpii/node_modules/flowManager/src/PCPChannel.js b/gpii/node_modules/flowManager/src/PCPChannel.js index 15f18010f..fd047f207 100644 --- a/gpii/node_modules/flowManager/src/PCPChannel.js +++ b/gpii/node_modules/flowManager/src/PCPChannel.js @@ -199,14 +199,14 @@ gpii.pcpChannel.sessionToPCP = function (model, transformSpec) { var solution = model.solutionsRegistryEntries[solKey]; if (solution) { fluid.each(prefsVal, function (innerPrefsVal, innerPrefsKey) { - var liveness = gpii.matchMakerFramework.utils.getLeastLiveness(innerPrefsKey, [ solution ]); + var liveness = gpii.matchMakerFramework.utils.getLeastLiveness([ solution ], innerPrefsKey); gpii.pcpChannel.emitSettingControl(settingControls, schemas[innerPrefsKey], innerPrefsVal, [prefsKey, innerPrefsKey], liveness, solution.name); }); } } else { var activeSolutionIds = Object.keys(fluid.get(model, "activeConfiguration.inferredConfiguration.applications")); var activeSolutions = fluid.filterKeys(model.solutionsRegistryEntries, activeSolutionIds); - var liveness = gpii.matchMakerFramework.utils.getLeastLiveness(prefsKey, activeSolutions); + var liveness = gpii.matchMakerFramework.utils.getLeastLiveness(activeSolutions, prefsKey); gpii.pcpChannel.emitSettingControl(settingControls, schemas[prefsKey], prefsVal, [prefsKey], liveness); } }); diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index 9f0c081e0..6332f5d39 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -483,6 +483,32 @@ var gpii = fluid.registerNamespace("gpii"); return togo; }; + /** + * Infer an action block such as "start", "stop", "configure", etc. + * + * If some lifecycle block is not present, the system will use default actions for each block. These are as follows: + * * "start", "stop" and "isRunning": will by default be references to all launch handler blocks + * * "configure" and "restore": will by default be references to all settings handler blocks + * * "update": depends on the solutions "liveness" value where "live" means set settings only and + * "liveRestart"/"manualRestart"/"OSRestart" means a [stop, configure, start] cycle + */ + gpii.lifecycleManager.inferActionBlockSteps = function (actionName, solutionRecord) { + var steps = []; + if (["start", "stop", "isRunning"].indexOf(actionName) !== -1) { + // grab all lifecycle actions + } else if (["configure", "restore"].indexOf(actionName) !== -1) { + + } else if (actionName === "update") { + // check liveness: + var liveness = gpii.matchMakerFramework.utils.getLeastLiveness([solutionRecord]); + if (liveness === "live") { + steps = [ "configure" ]; + } else if (["liveRestart", "manualRestart", "OSRestart"].indexOf(liveness) !== -1) { + steps = [ "stop", "configure", "start"]; + } + } + return steps; + } /** Called for each solution during "start", "stop" and "update" phases * Actions to be performed are held in array "actions" and the settingsHandlers block from "solutions" (either Transformer * output, or snapshot output from "start" phase) encodes the settings to be set. @@ -503,7 +529,7 @@ var gpii = fluid.registerNamespace("gpii"); */ gpii.lifecycleManager.executeActions = function (that, solutionId, solutionRecord, session, actionBlock, rootAction) { - var steps = solutionRecord[actionBlock]; + var steps = solutionRecord[actionBlock] || gpii.lifecycleManager.inferActionBlockSteps(actionBlock, solutionRecord); if (steps === undefined) { fluid.log("No " + actionBlock + " actions defined for solution " + solutionId); return fluid.promise().resolve(); diff --git a/gpii/node_modules/lifecycleManager/test/html/LifecycleManagerTest.html b/gpii/node_modules/lifecycleManager/test/html/LifecycleManagerTest.html index ed00a1a19..3a29569f7 100644 --- a/gpii/node_modules/lifecycleManager/test/html/LifecycleManagerTest.html +++ b/gpii/node_modules/lifecycleManager/test/html/LifecycleManagerTest.html @@ -20,6 +20,7 @@ + diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index 59275f41d..8e5cc6cff 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -52,7 +52,10 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt /** * Create a solution entry, keyed by solution ID. - * All subsequent arguments will be part of the solution entry key by solId + * All subsequent arguments will be part of the solution entry + * + * The function will return an object with a single key (i.e. `solId`) with + * an object as value. All the remaining arguments in the object related to that key. */ gpii.tests.lifecycleManager.buildLifecycleInstructions = function (solId) { var togo = {}; @@ -99,10 +102,12 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt "myconf": { "type": "gpii.tests.lifecycleManager.mockSettingsHandler", "options": {} - }, + } + }, + "launchHandlers": { "launcher": { "type": "gpii.tests.lifecycleManager.mockLaunchHandler", - "options": {} + "options": {}, } } }; @@ -110,7 +115,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt fluid.set(togo, [ "settingsHandlers", "myconf", "settings" ], settings); } if (setRunning !== undefined) { - fluid.set(togo, [ "settingsHandlers", "launcher", "settings" ], { running: setRunning }); + fluid.set(togo, [ "launchHandlers", "launcher", "settings" ], { running: setRunning }); } return togo; }; @@ -709,6 +714,104 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt expectedSettings: { "cross-hairs-clip": true, "cross-hairs-color": "green", "iamasetting": 100 }, originalSettingsAfterUpdate: { "cross-hairs-clip": false, "cross-hairs-color": "red", "iamasetting": undefined }, expectedLaunchHandlerCalls: 2 + }, { + name: "Updating with no 'update' block in solutions registry entry and 'live' liveness", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle + ), + payloadExtras: { + settingsHandlers: { + myconf: { + liveness: "live" + } + } + }, + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: false, + loginSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, + runningAfterLogin: true, + updateSettings: { "cross-hairs-clip": true, "cross-hairs-color": "green" }, + runningAfterUpdate: true, + expectedSettings: { "cross-hairs-clip": true, "cross-hairs-color": "green" }, + expectedLaunchHandlerCalls: 2 + }, { + name: "Updating with no 'update' block in solutions registry entry and no liveness", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: false, + loginSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, + runningAfterLogin: true, + updateSettings: { "cross-hairs-clip": true, "cross-hairs-color": "green" }, + runningAfterUpdate: true, + expectedSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, + expectedLaunchHandlerCalls: 2 + }, { + name: "Updating with no 'update' block in solutions registry entry and 'liveRestart' liveness", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle + ), + payloadExtras: { + settingsHandlers: { + myconf: { + liveness: "liveRestart" + } + } + }, + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: false, + loginSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, + runningAfterLogin: true, + updateSettings: { "cross-hairs-clip": true, "cross-hairs-color": "green" }, + runningAfterUpdate: true, + expectedSettings: { "cross-hairs-clip": true, "cross-hairs-color": "green" }, + expectedLaunchHandlerCalls: 4 + }, { + name: "Updating with no 'update' block in solutions registry entry and 'manualRestart' liveness", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle + ), + payloadExtras: { + settingsHandlers: { + myconf: { + liveness: "manualRestart" + } + } + }, + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: false, + loginSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, + runningAfterLogin: true, + updateSettings: { "cross-hairs-clip": true, "cross-hairs-color": "green" }, + runningAfterUpdate: true, + expectedSettings: { "cross-hairs-clip": true, "cross-hairs-color": "green" }, + expectedLaunchHandlerCalls: 4 + }, { + name: "Updating with no 'update' block in solutions registry entry and 'OSRestart' liveness", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle + ), + payloadExtras: { + settingsHandlers: { + myconf: { + liveness: "OSRestart" + } + } + }, + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: false, + loginSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, + runningAfterLogin: true, + updateSettings: { "cross-hairs-clip": true, "cross-hairs-color": "green" }, + runningAfterUpdate: true, + expectedSettings: { "cross-hairs-clip": true, "cross-hairs-color": "green" }, + expectedLaunchHandlerCalls: 4 }]; gpii.tests.lifecycleManager.completeLifecycleTests = [{ @@ -943,19 +1046,19 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt gpii.tests.lifecycleManager.buildUpdateTests = function () { fluid.each(gpii.tests.lifecycleManager.updateTestDefs, function (test) { var expectedOriginal = gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, - gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.originalSettings, test.runningOnLogin)); + gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.originalSettings, test.runningOnLogin), test.payloadExtras); var loginPayload = gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, - gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.loginSettings)); + gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.loginSettings), test.payloadExtras); var expectedAfterLogin = gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, - gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.loginSettings, test.runningAfterLogin)); + gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.loginSettings, test.runningAfterLogin), test.payloadExtras); var updatePayload = gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, - gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.updateSettings)); + gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.updateSettings), test.payloadExtras); var expectedAfterUpdate = gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, - gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.expectedSettings, test.runningAfterUpdate)); + gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.expectedSettings, test.runningAfterUpdate), test.payloadExtras); var originalSettingsAfterUpdate = test.originalSettingsAfterUpdate || test.originalSettings; var expectedOriginalSettingsAfterUpdate = gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, - gpii.tests.lifecycleManager.buildSettingsHandlersEntry(originalSettingsAfterUpdate, test.runningOnLogin)); + gpii.tests.lifecycleManager.buildSettingsHandlersEntry(originalSettingsAfterUpdate, test.runningOnLogin), test.payloadExtras); var testDef = { name: "gpii.lifecycleManager.update() with active user session: " + test.name, diff --git a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js index e60e75508..7013a159b 100644 --- a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js +++ b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js @@ -635,28 +635,35 @@ var fluid = fluid || require("infusion"), ]; /** - * Given a term and one or more solutions registry entries, this function will walk each - * solution (and its settingshandlers) and find the lowest liveness for any solution that - * supports the term via its capabilities and/or capabilitiesTransformations. The lowest or least + * Given one or more solutions registry entries and optionally a term, this function will walk each + * solution (and its settingshandlers) and find the lowest liveness for any of the solutions. If a term is + * given, the liveliness reported is the lowest of those settingshandlers which supports that term + * (decided via its capabilities and/or capabilitiesTransformations). The lowest or least * liveness is dictated by gpii.matchMakerFramework.utils.livenessOrdering, where a lower * index means less/lower liveness. * - * @param term {String}: the term to find the liveness for * @param solutions {Array or Object} A list of the solutions that should be search for support of the term + * @param term {String} - optional. the term to find the liveness for * @return {String} returns the lowest/least liveness found by any solution provided that supports the term */ - gpii.matchMakerFramework.utils.getLeastLiveness = function (term, solutions) { + gpii.matchMakerFramework.utils.getLeastLiveness = function (solutions, term) { var leastLiveness; fluid.each(solutions, function (solution) { fluid.each(solution.settingsHandlers, function (handler) { - var capabilities = gpii.matchMakerFramework.utils.extractCapabilities(handler); - if (capabilities && capabilities.indexOf(fluid.pathUtil.composeSegments(term)) > -1) { - // if the liveness of term in current solution is lower than any previously checked solutions - var livenessOrder = gpii.matchMakerFramework.utils.livenessOrdering.indexOf(handler.liveness); - if (leastLiveness === undefined || livenessOrder < leastLiveness) { - leastLiveness = livenessOrder; + if (term !== undefined) { + // if term is defined, only check liveness of block if the term is within the capabilities + // of the block. If not, simply skip to next block + var capabilities = gpii.matchMakerFramework.utils.extractCapabilities(handler); + if (capabilities && capabilities.indexOf(fluid.pathUtil.composeSegments(term)) === -1) { + return; } } + + // if the liveness of term in current solution is lower than any previously checked solutions + var livenessOrder = gpii.matchMakerFramework.utils.livenessOrdering.indexOf(handler.liveness); + if (leastLiveness === undefined || livenessOrder < leastLiveness) { + leastLiveness = livenessOrder; + } }); }); return gpii.matchMakerFramework.utils.livenessOrdering[leastLiveness]; diff --git a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js index 324a92121..2c42047a9 100644 --- a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js +++ b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js @@ -1101,6 +1101,11 @@ var fluid = fluid || require("infusion"), term: "http://registry.gpii.net/common/pitch", solutions: fluid.filterKeys(gpii.tests.matchMakerUtilities.getLeastLiveness.solutions, [ "fakescreenreader1"]), expected: "manualRestart" + }, { + name: "No terms provided", + term: undefined, + solutions: fluid.filterKeys(gpii.tests.matchMakerUtilities.getLeastLiveness.solutions, [ "fakescreenreader1"]), + expected: "OSRestart" } ]; @@ -1108,7 +1113,7 @@ var fluid = fluid || require("infusion"), gpii.tests.matchMakerUtilities.getLeastLiveness.tests = function () { jqUnit.module("Tests for getLeastLiveness"); fluid.each(gpii.tests.matchMakerUtilities.getLeastLiveness.testData, function (testDef) { - var liveness = gpii.matchMakerFramework.utils.getLeastLiveness(testDef.term, testDef.solutions); + var liveness = gpii.matchMakerFramework.utils.getLeastLiveness(testDef.solutions, testDef.term); jqUnit.assertDeepEq(testDef.name, testDef.expected, liveness); }); }; From da90666874c72818231edb0a2cf59b39638d56ae Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Fri, 9 Feb 2018 12:13:59 +0100 Subject: [PATCH 32/44] GPII-1230: Support for implicit configure, restore, start and stop directives --- .../lifecycleManager/src/LifecycleManager.js | 20 +++- .../test/js/LifecycleManagerTests.js | 92 +++++++++++++++---- 2 files changed, 88 insertions(+), 24 deletions(-) diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index 6332f5d39..0a75032e7 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -426,6 +426,10 @@ var gpii = fluid.registerNamespace("gpii"); togo[handlersBlock] = fluid.transform(solutionSettings[handlersBlock], function (handler) { return gpii.settingsHandlers.transformOneSolutionSettings(handler, transformer); }); + // avoid the handlerBlock to be `undefined` if it's not defined in solutionsRegistry entry. This is necessary for testing assertion purposes + if (togo[handlersBlock] === undefined) { + delete togo[handlersBlock]; + } }); return togo; @@ -494,10 +498,16 @@ var gpii = fluid.registerNamespace("gpii"); */ gpii.lifecycleManager.inferActionBlockSteps = function (actionName, solutionRecord) { var steps = []; - if (["start", "stop", "isRunning"].indexOf(actionName) !== -1) { - // grab all lifecycle actions - } else if (["configure", "restore"].indexOf(actionName) !== -1) { - + if (["start", "stop", "isRunning"].indexOf(actionName) !== -1 && solutionRecord.launchHandlers) { + // grab all lifecycle block names and make these the steps + steps = fluid.transform(Object.keys(solutionRecord.launchHandlers), function (stepName) { + return "launchers." + stepName; + }); + } else if (["configure", "restore"].indexOf(actionName) !== -1 && solutionRecord.settingsHandlers) { + // grab all settingshandler block names and make these the steps + steps = fluid.transform(Object.keys(solutionRecord.settingsHandlers), function (stepName) { + return "settings." + stepName; + }); } else if (actionName === "update") { // check liveness: var liveness = gpii.matchMakerFramework.utils.getLeastLiveness([solutionRecord]); @@ -691,7 +701,7 @@ var gpii = fluid.registerNamespace("gpii"); gpii.lifecycleManager.getSolutionRunningStateFromSnapshot = function (solutionSnapshot) { // get isRunning entry from snapshot and block to run: - var isRunningBlock = fluid.makeArray(solutionSnapshot.isRunning)[0]; + var isRunningBlock = fluid.makeArray(solutionSnapshot.isRunning || gpii.lifecycleManager.inferActionBlockSteps("isRunning", solutionSnapshot))[0]; if (isRunningBlock && isRunningBlock.indexOf("launchers.") === 0) { var settingsHandlerBlockName = isRunningBlock.substring("launchers.".length); var recordedState = fluid.get(solutionSnapshot, ["launchHandlers", settingsHandlerBlockName, "settings", "running"]); diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index 8e5cc6cff..4c3cb000c 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -51,11 +51,8 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt }; /** - * Create a solution entry, keyed by solution ID. + * Create a solution entry keyed by solution ID. * All subsequent arguments will be part of the solution entry - * - * The function will return an object with a single key (i.e. `solId`) with - * an object as value. All the remaining arguments in the object related to that key. */ gpii.tests.lifecycleManager.buildLifecycleInstructions = function (solId) { var togo = {}; @@ -96,7 +93,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt return togo; }; - gpii.tests.lifecycleManager.buildSettingsHandlersEntry = function (settings, setRunning) { + gpii.tests.lifecycleManager.buildSettingsHandlersEntry = function (settings, setRunning, removeLifecycleHandlerBlock) { var togo = { "settingsHandlers": { "myconf": { @@ -113,10 +110,15 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt }; if (settings !== undefined) { fluid.set(togo, [ "settingsHandlers", "myconf", "settings" ], settings); + } else { + delete togo.settingsHandlers; } if (setRunning !== undefined) { fluid.set(togo, [ "launchHandlers", "launcher", "settings" ], { running: setRunning }); } + if (removeLifecycleHandlerBlock) { + delete togo.launchHandlers; + } return togo; }; @@ -430,7 +432,40 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt }; gpii.tests.lifecycleManager.startTestDefs = [{ - name: "Solution with only start and stop blocks (GPII-2106)", + name: "Solution with all lifecycle blocks", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + gpii.tests.lifecycleManager.standardLifecycle + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: false, + appliedSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, + runningAfterLogin: true, + expectedLaunchHandlerCalls: 2 + }, { + name: "Solution with no explicit configure and restore (GPII-2106)", + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + { + "active": true, + "start": [ + "launchers.launcher" + ], + "stop": [ + "launchers.launcher" + ], + "isRunning": [ + "launchers.launcher" + ] + } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: false, + appliedSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, + runningAfterLogin: true, + expectedLaunchHandlerCalls: 2 + }, { + name: "Solution with no configure and restore and no settingsHandler block", basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( "org.gnome.desktop.a11y.magnifier", { @@ -448,23 +483,39 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt ), originalSettings: undefined, runningOnLogin: false, - appliedSettings: {}, + appliedSettings: undefined, runningAfterLogin: true, expectedLaunchHandlerCalls: 2 }, { - name: "solution with only configure and restore blocks", + name: "no explicit start, stop, isRunning directives", basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( "org.gnome.desktop.a11y.magnifier", { "active": true, - "restore": [ + "configure": [ "settings.myconf" ], + "restore": [ + "settings.myconf" + ] + } + ), + originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, + runningOnLogin: false, + appliedSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, + runningAfterLogin: true, + expectedLaunchHandlerCalls: 2 + }, { + name: "no explicit start, stop, isRunning directives and no launchHandlers block", // expect no launch handler calls + basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( + "org.gnome.desktop.a11y.magnifier", + { + "active": true, "configure": [ "settings.myconf" ], - "isRunning": [ - "launchers.launcher" + "restore": [ + "settings.myconf" ] } ), @@ -472,12 +523,15 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt runningOnLogin: undefined, appliedSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, runningAfterLogin: undefined, - expectedLaunchHandlerCalls: 0 + expectedLaunchHandlerCalls: 0, + removeLifecycleHandlerBlock: true }, { - name: "Solution with all lifecycle blocks", + name: "no explicit lifecycle directives (i.e. start,stop,configure,restore,isRunning)", basePayload: gpii.tests.lifecycleManager.buildLifecycleInstructions( "org.gnome.desktop.a11y.magnifier", - gpii.tests.lifecycleManager.standardLifecycle + { + "active": true + } ), originalSettings: { "cross-hairs-clip": false, "cross-hairs-color": "red" }, runningOnLogin: false, @@ -944,7 +998,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt */ gpii.tests.lifecycleManager.runSequentialLifecycleTest = function (testDef) { var originalRunSetting = testDef.expectedLaunchHandlerCalls === 0 ? undefined : testDef.runningOnLogin; - jqUnit.asyncTest(testDef.name, function () { + jqUnit.asyncTest("Sequential " + testDef.name, function () { gpii.tests.lifecycleManager.setup(); jqUnit.expect(testDef.expect); var lifecycleManager = gpii.lifecycleManager(gpii.tests.lifecycleManager.testOptions); @@ -1005,7 +1059,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt */ gpii.tests.lifecycleManager.runAsyncLifecycleTest = function (testDef) { var originalRunSetting = testDef.expectedLaunchHandlerCalls === 0 ? undefined : testDef.runningOnLogin; - jqUnit.asyncTest(testDef.name, function () { + jqUnit.asyncTest("Async " + testDef.name, function () { gpii.tests.lifecycleManager.setup(); jqUnit.expect(testDef.expect); var lifecycleManager = gpii.lifecycleManager(gpii.tests.lifecycleManager.testOptions); @@ -1091,13 +1145,13 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt runningOnLogin: test.runningOnLogin, originalSettings: gpii.tests.lifecycleManager.createSettingsHandlerPayload("org.gnome.desktop.a11y.magnifier", test.originalSettings), loginPayload: gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, - gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.appliedSettings)), + gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.appliedSettings, undefined, test.removeLifecycleHandlerBlock)), expectedAfterLogin: gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, - gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.appliedSettings, test.runningAfterLogin)), + gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.appliedSettings, test.runningAfterLogin, test.removeLifecycleHandlerBlock)), runningAfterLogin: test.runningAfterLogin, // only expect launch handler settings to be in the original snapshot if we've run a launchHandler call during login expectedOriginal: gpii.tests.lifecycleManager.extendLifecycleInstructions(test.basePayload, - gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.originalSettings, test.expectedLaunchHandlerCalls === 0 ? undefined : test.runningOnLogin)) + gpii.tests.lifecycleManager.buildSettingsHandlersEntry(test.originalSettings, test.expectedLaunchHandlerCalls === 0 ? undefined : test.runningOnLogin, test.removeLifecycleHandlerBlock)) }; gpii.tests.lifecycleManager.runSequentialLifecycleTest(testDef); From dda19a0c7294d25a0469ab967ee9f6503c83e076 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 14 Feb 2018 09:25:15 +0100 Subject: [PATCH 33/44] GPII-1230: Renaming of all magnifierEnabled to magnification/enabled --- .../test/data/full_mm_payload1.json | 4 +- .../test/data/full_mm_payload2.json | 4 +- .../web/js/CanopyMatchMakerUtilitiesTests.js | 6 +-- .../test/FlatMatchMakerTests.js | 8 +-- .../test/data/full_mm_payload1.json | 4 +- .../test/data/matchmaker.output.payload.json | 20 +++---- .../test/js/MatchMakerUtilitiesTests.js | 54 +++++++++---------- .../test/preferencesServerTests.js | 2 +- gpii/node_modules/testing/src/Mocks.js | 3 +- testData/ontologies/flat.json5 | 2 +- .../ontologies/mappings/ISO24751-flat.json5 | 2 +- .../ontologies/mappings/flat-apptology.json5 | 2 +- .../acceptanceTests/chrome_font_size.json | 2 +- .../acceptanceTests/chrome_high_contrast.json | 2 +- .../acceptanceTests/chrome_magnification.json | 2 +- testData/preferences/li.json | 4 +- testData/preferences/manuel.json | 4 +- testData/preferences/review3/li.json | 4 +- testData/preferences/review3/manuel.json | 4 +- .../review3_chrome_high_contrast.json | 2 +- testData/solutions/darwin.json5 | 4 +- testData/solutions/web.json5 | 2 +- tests/data/multiSHSolutionRegistry.json | 2 +- 23 files changed, 72 insertions(+), 71 deletions(-) diff --git a/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload1.json b/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload1.json index 6f2dc7e5f..3f7cd31ab 100644 --- a/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload1.json +++ b/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload1.json @@ -7,7 +7,7 @@ "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/enabled": false, "http://registry.gpii.net/common/magnification": 1 } } @@ -47,7 +47,7 @@ "capabilitiesTransformations": { "setting1": "http://registry\\.gpii\\.net/common/fontSize", "setting2.path1": "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled", - "setting2.path2": "http://registry\\.gpii\\.net/common/magnifierEnabled", + "setting2.path2": "http://registry\\.gpii\\.net/common/magnification/enabled", "setting2.path3.hello": "http://registry\\.gpii\\.net/common/magnification" } } diff --git a/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload2.json b/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload2.json index 178fb961b..e264730f7 100644 --- a/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload2.json +++ b/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload2.json @@ -41,7 +41,7 @@ "filename": "/tmp/fakemag1.settings.json" }, "capabilities": [ - "http://registry\\.gpii\\.net/common/magnifierEnabled" + "http://registry\\.gpii\\.net/common/magnification/enabled" ], "capabilitiesTransformations": { "magnification": "http://registry\\.gpii\\.net/common/magnification" @@ -66,7 +66,7 @@ "filename": "/tmp/fakemag2.settings.json" }, "capabilities": [ - "http://registry\\.gpii\\.net/common/magnifierEnabled" + "http://registry\\.gpii\\.net/common/magnification/enabled" ], "capabilitiesTransformations": { "magnification": "http://registry\\.gpii\\.net/common/magnification", diff --git a/gpii/node_modules/canopyMatchMaker/test/web/js/CanopyMatchMakerUtilitiesTests.js b/gpii/node_modules/canopyMatchMaker/test/web/js/CanopyMatchMakerUtilitiesTests.js index d27d56b1c..004dfb487 100644 --- a/gpii/node_modules/canopyMatchMaker/test/web/js/CanopyMatchMakerUtilitiesTests.js +++ b/gpii/node_modules/canopyMatchMaker/test/web/js/CanopyMatchMakerUtilitiesTests.js @@ -192,7 +192,7 @@ var disposeStrategyFixtures = [ leavesArg: [ "display.screenEnhancement.fontSize", "display.screenEnhancement.magnification", - "display.screenEnhancement.-provisional-magnifierEnabled", + "display.screenEnhancement.-provisional-magnification/enabled", "display.screenReader.-provisional-screenReaderTTSEnabled" ], solRecsArg: { @@ -210,7 +210,7 @@ var disposeStrategyFixtures = [ "capabilitiesTransformations": { "setting1": "http://registry\\.gpii\\.net/common/fontSize", "setting2.path1": "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled", - "setting2.path2": "http://registry\\.gpii\\.net/common/magnifierEnabled", + "setting2.path2": "http://registry\\.gpii\\.net/common/magnification/enabled", "setting2.path3.hello": "http://registry\\.gpii\\.net/common/magnification" } } @@ -226,7 +226,7 @@ var disposeStrategyFixtures = [ "screenEnhancement": { "fontSize": {}, "magnification": {}, - "-provisional-magnifierEnabled": {} + "-provisional-magnification/enabled": {} }, "screenReader": { "-provisional-screenReaderTTSEnabled": {} diff --git a/gpii/node_modules/flatMatchMaker/test/FlatMatchMakerTests.js b/gpii/node_modules/flatMatchMaker/test/FlatMatchMakerTests.js index 328263549..76958c18d 100644 --- a/gpii/node_modules/flatMatchMaker/test/FlatMatchMakerTests.js +++ b/gpii/node_modules/flatMatchMaker/test/FlatMatchMakerTests.js @@ -47,7 +47,7 @@ leavesArg: [ "display.screenEnhancement.fontSize", "display.screenEnhancement.magnification", - "display.screenEnhancement.-provisional-magnifierEnabled", + "display.screenEnhancement.-provisional-magnification/enabled", "display.screenReader.-provisional-screenReaderTTSEnabled" ], solRecsArg: { @@ -65,7 +65,7 @@ "capabilitiesTransformations": { "setting1": "http://registry\\.gpii\\.net/common/fontSize", "setting2.path1": "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled", - "setting2.path2": "http://registry\\.gpii\\.net/common/magnifierEnabled", + "setting2.path2": "http://registry\\.gpii\\.net/common/magnification/enabled", "setting2.path3.hello": "http://registry\\.gpii\\.net/common/magnification" } } @@ -81,7 +81,7 @@ "screenEnhancement": { "fontSize": {}, "magnification": {}, - "-provisional-magnifierEnabled": {} + "-provisional-magnification/enabled": {} }, "screenReader": { "-provisional-screenReaderTTSEnabled": {} @@ -144,7 +144,7 @@ "settings": { "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/enabled": false, "http://registry.gpii.net/common/magnification": 1 } } diff --git a/gpii/node_modules/flatMatchMaker/test/data/full_mm_payload1.json b/gpii/node_modules/flatMatchMaker/test/data/full_mm_payload1.json index 6f2dc7e5f..3f7cd31ab 100644 --- a/gpii/node_modules/flatMatchMaker/test/data/full_mm_payload1.json +++ b/gpii/node_modules/flatMatchMaker/test/data/full_mm_payload1.json @@ -7,7 +7,7 @@ "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/enabled": false, "http://registry.gpii.net/common/magnification": 1 } } @@ -47,7 +47,7 @@ "capabilitiesTransformations": { "setting1": "http://registry\\.gpii\\.net/common/fontSize", "setting2.path1": "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled", - "setting2.path2": "http://registry\\.gpii\\.net/common/magnifierEnabled", + "setting2.path2": "http://registry\\.gpii\\.net/common/magnification/enabled", "setting2.path3.hello": "http://registry\\.gpii\\.net/common/magnification" } } diff --git a/gpii/node_modules/flowManager/test/data/matchmaker.output.payload.json b/gpii/node_modules/flowManager/test/data/matchmaker.output.payload.json index 363a29558..2f8e90ba7 100644 --- a/gpii/node_modules/flowManager/test/data/matchmaker.output.payload.json +++ b/gpii/node_modules/flowManager/test/data/matchmaker.output.payload.json @@ -15,7 +15,7 @@ "preferences": { "http://registry.gpii.net/common/screenReaderTTSEnabled": true, "http://registry.gpii.net/common/speechRate": 200, - "http://registry.gpii.net/common/magnifierEnabled": true, + "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 1.5, "http://registry.gpii.net/common/matchMakerType": "RuleBased" }, @@ -35,7 +35,7 @@ "preferences": { "http://registry.gpii.net/common/screenReaderTTSEnabled": true, "http://registry.gpii.net/common/speechRate": 200, - "http://registry.gpii.net/common/magnifierEnabled": true, + "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 2, "http://registry.gpii.net/common/highContrastEnabled": true, "http://registry.gpii.net/common/matchMakerType": "RuleBased" @@ -1308,7 +1308,7 @@ ] } }, - "magnifierEnabled": "http://registry\\.gpii\\.net/common/magnifierEnabled", + "magnifierEnabled": "http://registry\\.gpii\\.net/common/magnification/enabled", "magnification": { "transform": { "type": "fluid.transforms.quantize", @@ -1354,7 +1354,7 @@ "settings": { "http://registry.gpii.net/common/screenReaderTTSEnabled": true, "http://registry.gpii.net/common/speechRate": 200, - "http://registry.gpii.net/common/magnifierEnabled": true, + "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 1.5, "http://registry.gpii.net/common/matchMakerType": "RuleBased" } @@ -1364,7 +1364,7 @@ "settings": { "http://registry.gpii.net/common/screenReaderTTSEnabled": true, "http://registry.gpii.net/common/speechRate": 200, - "http://registry.gpii.net/common/magnifierEnabled": true, + "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 1.5, "http://registry.gpii.net/common/matchMakerType": "RuleBased" } @@ -1374,7 +1374,7 @@ "settings": { "http://registry.gpii.net/common/screenReaderTTSEnabled": true, "http://registry.gpii.net/common/speechRate": 200, - "http://registry.gpii.net/common/magnifierEnabled": true, + "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 1.5, "http://registry.gpii.net/common/matchMakerType": "RuleBased" } @@ -1388,7 +1388,7 @@ "settings": { "http://registry.gpii.net/common/screenReaderTTSEnabled": true, "http://registry.gpii.net/common/speechRate": 200, - "http://registry.gpii.net/common/magnifierEnabled": true, + "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 2, "http://registry.gpii.net/common/highContrastEnabled": true, "http://registry.gpii.net/common/matchMakerType": "RuleBased" @@ -1399,7 +1399,7 @@ "settings": { "http://registry.gpii.net/common/screenReaderTTSEnabled": true, "http://registry.gpii.net/common/speechRate": 200, - "http://registry.gpii.net/common/magnifierEnabled": true, + "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 2, "http://registry.gpii.net/common/highContrastEnabled": true, "http://registry.gpii.net/common/matchMakerType": "RuleBased" @@ -1410,7 +1410,7 @@ "settings": { "http://registry.gpii.net/common/screenReaderTTSEnabled": true, "http://registry.gpii.net/common/speechRate": 200, - "http://registry.gpii.net/common/magnifierEnabled": true, + "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 2, "http://registry.gpii.net/common/highContrastEnabled": true, "http://registry.gpii.net/common/matchMakerType": "RuleBased" @@ -1421,7 +1421,7 @@ "settings": { "http://registry.gpii.net/common/screenReaderTTSEnabled": true, "http://registry.gpii.net/common/speechRate": 200, - "http://registry.gpii.net/common/magnifierEnabled": true, + "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 2, "http://registry.gpii.net/common/highContrastEnabled": true, "http://registry.gpii.net/common/matchMakerType": "RuleBased" diff --git a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js index 2c42047a9..7c38bba28 100644 --- a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js +++ b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js @@ -300,7 +300,7 @@ var fluid = fluid || require("infusion"), "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/enabled": false, "http://registry.gpii.net/common/magnification": 1 } } @@ -340,7 +340,7 @@ var fluid = fluid || require("infusion"), "capabilitiesTransformations": { "setting1": "http://registry\\.gpii\\.net/common/fontSize", "setting2.path1": "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled", - "setting2.path2": "http://registry\\.gpii\\.net/common/magnifierEnabled", + "setting2.path2": "http://registry\\.gpii\\.net/common/magnification/enabled", "setting2.path3.hello": "http://registry\\.gpii\\.net/common/magnification" } } @@ -387,7 +387,7 @@ var fluid = fluid || require("infusion"), "screenEnhancement": { "fontSize": 16, "magnification": 1, - "-provisional-magnifierEnabled": false + "-provisional-magnification/enabled": false }, "screenReader": { "-provisional-screenReaderTTSEnabled": false @@ -407,7 +407,7 @@ var fluid = fluid || require("infusion"), "settings": { "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/enabled": false, "http://registry.gpii.net/common/magnification": 1 } } @@ -580,7 +580,7 @@ var fluid = fluid || require("infusion"), "filename": "/tmp/fakemag1.settings.json" }, "capabilities": [ - "http://registry\\.gpii\\.net/common/magnifierEnabled" + "http://registry\\.gpii\\.net/common/magnification/enabled" ], "capabilitiesTransformations": { "magnification": "http://registry\\.gpii\\.net/common/magnification" @@ -617,7 +617,7 @@ var fluid = fluid || require("infusion"), "filename": "/tmp/fakemag2.settings.json" }, "capabilities": [ - "http://registry\\.gpii\\.net/common/magnifierEnabled" + "http://registry\\.gpii\\.net/common/magnification/enabled" ], "capabilitiesTransformations": { "magnification": "http://registry\\.gpii\\.net/common/magnification", @@ -733,7 +733,7 @@ var fluid = fluid || require("infusion"), "settings": { "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/enabled": false, "http://registry.gpii.net/common/magnification": 1 } } @@ -748,7 +748,7 @@ var fluid = fluid || require("infusion"), "settings": { "http://registry.gpii.net/common/fontSize": 20, "http://registry.gpii.net/common/screenReaderTTSEnabled": false, - "http://registry.gpii.net/common/magnifierEnabled": false, + "http://registry.gpii.net/common/magnification/enabled": false, "http://registry.gpii.net/common/magnification": 1 } } @@ -776,7 +776,7 @@ var fluid = fluid || require("infusion"), "settings": { "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/enabled": false, "http://registry.gpii.net/common/magnification": 1 } } @@ -791,7 +791,7 @@ var fluid = fluid || require("infusion"), "settings": { "http://registry.gpii.net/common/fontSize": 20, "http://registry.gpii.net/common/screenReaderTTSEnabled": false, - "http://registry.gpii.net/common/magnifierEnabled": false, + "http://registry.gpii.net/common/magnification/enabled": false, "http://registry.gpii.net/common/magnification": 2 } } @@ -816,7 +816,7 @@ var fluid = fluid || require("infusion"), "fake.magnifier": { "active": true, "settings": { - "http://registry.gpii.net/common/magnifierEnabled": false, + "http://registry.gpii.net/common/magnification/enabled": false, "http://registry.gpii.net/common/magnification": 1 } } @@ -829,7 +829,7 @@ var fluid = fluid || require("infusion"), "fake.magnifier": { "active": true, "settings": { - "http://registry.gpii.net/common/magnifierEnabled": false, + "http://registry.gpii.net/common/magnification/enabled": false, "http://registry.gpii.net/common/magnification": 1 } } @@ -855,7 +855,7 @@ var fluid = fluid || require("infusion"), "fake.magnifier": { "active": true, "settings": { - "http://registry.gpii.net/common/magnifierEnabled": false, + "http://registry.gpii.net/common/magnification/enabled": false, "http://registry.gpii.net/common/magnification": 1 } }, @@ -875,7 +875,7 @@ var fluid = fluid || require("infusion"), "fake.magnifier": { "active": true, "settings": { - "http://registry.gpii.net/common/magnifierEnabled": false, + "http://registry.gpii.net/common/magnification/enabled": false, "http://registry.gpii.net/common/magnification": 2 } }, @@ -909,14 +909,14 @@ var fluid = fluid || require("infusion"), "fake.magnifier1": { "active": true, "settings": { - "http://registry.gpii.net/common/magnifierEnabled": false, + "http://registry.gpii.net/common/magnification/enabled": false, "http://registry.gpii.net/common/magnification": 1 } }, "fake.magnifier2": { "active": true, "settings": { - "http://registry.gpii.net/common/magnifierEnabled": false, + "http://registry.gpii.net/common/magnification/enabled": false, "http://registry.gpii.net/common/magnification": 1 } } @@ -929,14 +929,14 @@ var fluid = fluid || require("infusion"), "fake.magnifier1": { "active": true, "settings": { - "http://registry.gpii.net/common/magnifierEnabled": false, + "http://registry.gpii.net/common/magnification/enabled": false, "http://registry.gpii.net/common/magnification": 2 } }, "fake.magnifier2": { "active": true, "settings": { - "http://registry.gpii.net/common/magnifierEnabled": false, + "http://registry.gpii.net/common/magnification/enabled": false, "http://registry.gpii.net/common/magnification": 1 } } @@ -953,7 +953,7 @@ var fluid = fluid || require("infusion"), "http://registry.gpii.net/applications/fake.magnifier1": { "http://registry.gpii.net/common/magnification": 2 }, - "http://registry.gpii.net/common/magnifierEnabled": true + "http://registry.gpii.net/common/magnification/enabled": true } } } @@ -964,14 +964,14 @@ var fluid = fluid || require("infusion"), "fake.magnifier1": { "active": true, "settings": { - "http://registry.gpii.net/common/magnifierEnabled": false, + "http://registry.gpii.net/common/magnification/enabled": false, "http://registry.gpii.net/common/magnification": 1 } }, "fake.magnifier2": { "active": true, "settings": { - "http://registry.gpii.net/common/magnifierEnabled": false, + "http://registry.gpii.net/common/magnification/enabled": false, "http://registry.gpii.net/common/magnification": 1 } } @@ -984,14 +984,14 @@ var fluid = fluid || require("infusion"), "fake.magnifier1": { "active": true, "settings": { - "http://registry.gpii.net/common/magnifierEnabled": true, + "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 2 } }, "fake.magnifier2": { "active": true, "settings": { - "http://registry.gpii.net/common/magnifierEnabled": true, + "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 1 } } @@ -1019,7 +1019,7 @@ var fluid = fluid || require("infusion"), "filename": "/tmp/fakemag1.settings.json" }, "capabilities": [ - "http://registry\\.gpii\\.net/common/magnifierEnabled" + "http://registry\\.gpii\\.net/common/magnification/enabled" ], "capabilitiesTransformations": { "magnification": "http://registry\\.gpii\\.net/common/magnification" @@ -1036,7 +1036,7 @@ var fluid = fluid || require("infusion"), "filename": "/tmp/fakemag2.settings.json" }, "capabilities": [ - "http://registry\\.gpii\\.net/common/magnifierEnabled" + "http://registry\\.gpii\\.net/common/magnification/enabled" ], "capabilitiesTransformations": { "magnification": "http://registry\\.gpii\\.net/common/magnification", @@ -1083,12 +1083,12 @@ var fluid = fluid || require("infusion"), gpii.tests.matchMakerUtilities.getLeastLiveness.testData = [ { name: "Basic with single solution", - term: "http://registry.gpii.net/common/magnifierEnabled", + term: "http://registry.gpii.net/common/magnification/enabled", solutions: fluid.filterKeys(gpii.tests.matchMakerUtilities.getLeastLiveness.solutions, ["fakemag1"]), expected: "live" }, { name: "Term present in multiple solutions, least lively wins", - term: "http://registry.gpii.net/common/magnifierEnabled", + term: "http://registry.gpii.net/common/magnification/enabled", solutions: fluid.filterKeys(gpii.tests.matchMakerUtilities.getLeastLiveness.solutions, ["fakemag1", "fakemag2"]), expected: "liveRestart" }, { diff --git a/gpii/node_modules/preferencesServer/test/preferencesServerTests.js b/gpii/node_modules/preferencesServer/test/preferencesServerTests.js index 9cab62bf7..28f7947be 100644 --- a/gpii/node_modules/preferencesServer/test/preferencesServerTests.js +++ b/gpii/node_modules/preferencesServer/test/preferencesServerTests.js @@ -641,11 +641,11 @@ gpii.tests.preferencesServer.get.fixtures = [ "http://registry\\.gpii\\.net/common/foregroundColor", "http://registry\\.gpii\\.net/common/backgroundColor", "http://registry\\.gpii\\.net/common/fontFaceFontName", - "http://registry\\.gpii\\.net/common/magnifierEnabled", "http://registry\\.gpii\\.net/common/magnifierPosition", "http://registry\\.gpii\\.net/common/highContrastTheme", "http://registry\\.gpii\\.net/common/inputsLargerEnabled", "http://registry\\.gpii\\.net/common/highContrastEnabled", + "http://registry\\.gpii\\.net/common/magnification/enabled", "http://registry\\.gpii\\.net/common/fontFaceGenericFontFace" ] } diff --git a/gpii/node_modules/testing/src/Mocks.js b/gpii/node_modules/testing/src/Mocks.js index d62d808db..99b36b209 100644 --- a/gpii/node_modules/testing/src/Mocks.js +++ b/gpii/node_modules/testing/src/Mocks.js @@ -383,7 +383,8 @@ fluid.defaults("gpii.test.integration.mockSettingsHandlerRegistry.universal", { "gpii.launchHandlers.flexibleHandler": { optionsPathKey: gpii.test.integration.flexibleHandlerKey }, - "gpii.settingsHandlers.webSockets" : {} + "gpii.settingsHandlers.webSockets" : {}, + "gpii.settingsHandlers.noSettings": {} } }); diff --git a/testData/ontologies/flat.json5 b/testData/ontologies/flat.json5 index 9100d70d3..fbb12bbb5 100644 --- a/testData/ontologies/flat.json5 +++ b/testData/ontologies/flat.json5 @@ -164,7 +164,7 @@ "max": 100, "divisibleBy": 1 }, - "http://registry.gpii.net/common/magnifierEnabled": { + "http://registry.gpii.net/common/magnification/enabled": { "title": "Magnifier Enabled", "description": "Whether to enable/disable magnification", "type": "boolean", diff --git a/testData/ontologies/mappings/ISO24751-flat.json5 b/testData/ontologies/mappings/ISO24751-flat.json5 index 17511b5a3..d18994224 100644 --- a/testData/ontologies/mappings/ISO24751-flat.json5 +++ b/testData/ontologies/mappings/ISO24751-flat.json5 @@ -8,7 +8,7 @@ "http://registry\\.gpii\\.net/common/highlightColor": "display.screenEnhancement.highlightColor", "http://registry\\.gpii\\.net/common/fontFaceFontName": "display.screenEnhancement.fontFaceFontName", "http://registry\\.gpii\\.net/common/fontFaceGenericFontFace": "display.screenEnhancement.fontFaceGenericFontFace", - "http://registry\\.gpii\\.net/common/magnifierEnabled": "display.screenEnhancement.-provisional-magnifierEnabled", + "http://registry\\.gpii\\.net/common/magnification/enabled": "display.screenEnhancement.-provisional-magnification/enabled", "http://registry\\.gpii\\.net/common/magnification": "display.screenEnhancement.magnification", "http://registry\\.gpii\\.net/common/magnifierPosition": "display.screenEnhancement.-provisional-magnifierPosition", "http://registry\\.gpii\\.net/common/tracking": "display.screenEnhancement.tracking", diff --git a/testData/ontologies/mappings/flat-apptology.json5 b/testData/ontologies/mappings/flat-apptology.json5 index 7e0c1a6b3..dd36c89e1 100644 --- a/testData/ontologies/mappings/flat-apptology.json5 +++ b/testData/ontologies/mappings/flat-apptology.json5 @@ -2,7 +2,7 @@ "transform": [ { "type": "fluid.transforms.value", - "inputPath": "http://registry\\.gpii\\.net/common/magnifierEnabled", + "inputPath": "http://registry\\.gpii\\.net/common/magnification/enabled", "outputPath": "http://registry\\.gpii\\.net/common/magnifierApplication" }, { "type": "fluid.transforms.value", diff --git a/testData/preferences/acceptanceTests/chrome_font_size.json b/testData/preferences/acceptanceTests/chrome_font_size.json index a2d1a9930..1cfeb8ac9 100644 --- a/testData/preferences/acceptanceTests/chrome_font_size.json +++ b/testData/preferences/acceptanceTests/chrome_font_size.json @@ -6,7 +6,7 @@ "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/enabled": false, "http://registry.gpii.net/common/magnification": 1, "http://registry.gpii.net/common/highContrastEnabled": false, "http://registry.gpii.net/common/invertColours": false diff --git a/testData/preferences/acceptanceTests/chrome_high_contrast.json b/testData/preferences/acceptanceTests/chrome_high_contrast.json index 69ddcbe38..7ff143633 100644 --- a/testData/preferences/acceptanceTests/chrome_high_contrast.json +++ b/testData/preferences/acceptanceTests/chrome_high_contrast.json @@ -6,7 +6,7 @@ "preferences": { "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/screenReaderTTSEnabled": false, - "http://registry.gpii.net/common/magnifierEnabled": false, + "http://registry.gpii.net/common/magnification/enabled": false, "http://registry.gpii.net/common/magnification": 1, "http://registry.gpii.net/common/highContrastEnabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black", diff --git a/testData/preferences/acceptanceTests/chrome_magnification.json b/testData/preferences/acceptanceTests/chrome_magnification.json index 54f0ac3c4..6f70bc1a6 100644 --- a/testData/preferences/acceptanceTests/chrome_magnification.json +++ b/testData/preferences/acceptanceTests/chrome_magnification.json @@ -6,7 +6,7 @@ "preferences": { "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/screenReaderTTSEnabled": false, - "http://registry.gpii.net/common/magnifierEnabled": true, + "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 1.5, "http://registry.gpii.net/common/highContrastEnabled": false, "http://registry.gpii.net/common/invertColours": false diff --git a/testData/preferences/li.json b/testData/preferences/li.json index ae6a28928..8f54add47 100644 --- a/testData/preferences/li.json +++ b/testData/preferences/li.json @@ -7,7 +7,7 @@ "preferences": { "http://registry.gpii.net/common/screenReaderTTSEnabled": true, "http://registry.gpii.net/common/speechRate": 200, - "http://registry.gpii.net/common/magnifierEnabled": true, + "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 1.5, "http://registry.gpii.net/common/matchMakerType": "RuleBased" }, @@ -27,7 +27,7 @@ "preferences": { "http://registry.gpii.net/common/screenReaderTTSEnabled": true, "http://registry.gpii.net/common/speechRate": 200, - "http://registry.gpii.net/common/magnifierEnabled": true, + "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 2, "http://registry.gpii.net/common/highContrastEnabled": true, "http://registry.gpii.net/common/matchMakerType": "RuleBased" diff --git a/testData/preferences/manuel.json b/testData/preferences/manuel.json index 9c9631659..12660478a 100644 --- a/testData/preferences/manuel.json +++ b/testData/preferences/manuel.json @@ -6,7 +6,7 @@ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/magnifierEnabled": true, + "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 2, "http://registry.gpii.net/common/magnifierPosition": "TopHalf", "http://registry.gpii.net/applications/org.chrome.cloud4chrome": { @@ -27,7 +27,7 @@ "light-lim": { "name": "turn down light", "preferences": { - "http://registry.gpii.net/common/magnifierEnabled": true, + "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 2, "http://registry.gpii.net/common/magnifierPosition": "TopHalf", "http://registry.gpii.net/applications/org.chrome.cloud4chrome": { diff --git a/testData/preferences/review3/li.json b/testData/preferences/review3/li.json index f0e19d86f..018ad507d 100644 --- a/testData/preferences/review3/li.json +++ b/testData/preferences/review3/li.json @@ -6,7 +6,7 @@ "preferences": { "http://registry.gpii.net/common/screenReaderTTSEnabled": true, "http://registry.gpii.net/common/speechRate": 200, - "http://registry.gpii.net/common/magnifierEnabled": true, + "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 1.5, "http://registry.gpii.net/common/matchMakerType": "RuleBased" }, @@ -26,7 +26,7 @@ "preferences": { "http://registry.gpii.net/common/screenReaderTTSEnabled": true, "http://registry.gpii.net/common/speechRate": 200, - "http://registry.gpii.net/common/magnifierEnabled": true, + "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 2, "http://registry.gpii.net/common/highContrastEnabled": true, "http://registry.gpii.net/common/matchMakerType": "RuleBased" diff --git a/testData/preferences/review3/manuel.json b/testData/preferences/review3/manuel.json index 085e098f8..8a2af7f76 100644 --- a/testData/preferences/review3/manuel.json +++ b/testData/preferences/review3/manuel.json @@ -3,7 +3,7 @@ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/magnifierEnabled": true, + "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 2, "http://registry.gpii.net/common/magnifierPosition": "TopHalf", "http://registry.gpii.net/applications/org.chrome.cloud4chrome": { @@ -24,7 +24,7 @@ "light-lim": { "name": "turn down light", "preferences": { - "http://registry.gpii.net/common/magnifierEnabled": true, + "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 2, "http://registry.gpii.net/common/magnifierPosition": "TopHalf", "http://registry.gpii.net/applications/org.chrome.cloud4chrome": { diff --git a/testData/preferences/review3_chrome_high_contrast.json b/testData/preferences/review3_chrome_high_contrast.json index 69ddcbe38..7ff143633 100644 --- a/testData/preferences/review3_chrome_high_contrast.json +++ b/testData/preferences/review3_chrome_high_contrast.json @@ -6,7 +6,7 @@ "preferences": { "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/screenReaderTTSEnabled": false, - "http://registry.gpii.net/common/magnifierEnabled": false, + "http://registry.gpii.net/common/magnification/enabled": false, "http://registry.gpii.net/common/magnification": 1, "http://registry.gpii.net/common/highContrastEnabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black", diff --git a/testData/solutions/darwin.json5 b/testData/solutions/darwin.json5 index c5117ea61..9f82dacf6 100644 --- a/testData/solutions/darwin.json5 +++ b/testData/solutions/darwin.json5 @@ -15,7 +15,7 @@ "filename": "/tmp/fakemag1.settings.json" }, "capabilities": [ - "http://registry\\.gpii\\.net/common/magnifierEnabled" + "http://registry\\.gpii\\.net/common/magnification/enabled" ], "capabilitiesTransformations": { "magnification": "http://registry\\.gpii\\.net/common/magnification" @@ -53,7 +53,7 @@ "filename": "/tmp/fakemag2.settings.json" }, "capabilities": [ - "http://registry\\.gpii\\.net/common/magnifierEnabled" + "http://registry\\.gpii\\.net/common/magnification/enabled" ], "capabilitiesTransformations": { "magnification": "http://registry\\.gpii\\.net/common/magnification", diff --git a/testData/solutions/web.json5 b/testData/solutions/web.json5 index 5ffe0c141..969c55dab 100644 --- a/testData/solutions/web.json5 +++ b/testData/solutions/web.json5 @@ -42,7 +42,7 @@ ] } }, - "magnifierEnabled": "http://registry\\.gpii\\.net/common/magnifierEnabled", + "magnifierEnabled": "http://registry\\.gpii\\.net/common/magnification/enabled", "magnification": { "transform": { "type": "fluid.transforms.quantize", diff --git a/tests/data/multiSHSolutionRegistry.json b/tests/data/multiSHSolutionRegistry.json index fbf9c8207..55cbb0cdb 100644 --- a/tests/data/multiSHSolutionRegistry.json +++ b/tests/data/multiSHSolutionRegistry.json @@ -22,7 +22,7 @@ "tracking": {} }, "capabilities": [ - "http://registry\\.gpii\\.net/common/magnifierEnabled" + "http://registry\\.gpii\\.net/common/magnification/enabled" ], "capabilitiesTransformations": { "magnification": "http://registry\\.gpii\\.net/common/magnification", From c2b3dffcc099ce5e71a4f9480ff2b250518ec250 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 14 Feb 2018 15:36:36 +0100 Subject: [PATCH 34/44] GPII-1230: Saving to work on updating infusion related bug --- documentation/SolutionsRegistryFormat.md | 1 - .../test/data/full_mm_payload1.json | 4 +- .../test/data/full_mm_payload2.json | 19 ++- .../web/js/CanopyMatchMakerUtilitiesTests.js | 4 - .../test/data/standardMMInput.json | 11 +- .../test/data/standardMMOutput.json | 4 - .../test/FlatMatchMakerTests.js | 4 +- .../test/data/full_mm_payload1.json | 4 +- .../browserChannel_solutionsRegistry.json | 6 +- .../test/data/matchmaker.output.payload.json | 56 ++------ .../test/data/update_solutionsRegistry.json | 1 - .../src/MatchMakerUtilities.js | 28 ++-- .../test/js/MatchMakerUtilitiesTests.js | 49 +++---- .../transformer/test/js/TransformerTests.js | 2 - testData/solutions/android.json5 | 30 +---- testData/solutions/darwin.json5 | 18 +-- testData/solutions/linux.json5 | 70 +++------- testData/solutions/web.json5 | 23 ---- testData/solutions/win32.json5 | 125 +++++------------- tests/data/multiSHSolutionRegistry.json | 7 +- 20 files changed, 131 insertions(+), 335 deletions(-) diff --git a/documentation/SolutionsRegistryFormat.md b/documentation/SolutionsRegistryFormat.md index cc082e44b..ef061d0de 100644 --- a/documentation/SolutionsRegistryFormat.md +++ b/documentation/SolutionsRegistryFormat.md @@ -57,7 +57,6 @@ The `settingsHandlers` block is unique and one of the most important blocks in t "presentation.reportHelpBalloons": { ... metadata for setting ... }, "speech.nonTransformableSetting": { ... metadata for setting ... } }, - "capabilities": [], "capabilitiesTransformations": { "speech.espeak.pitch": { "transform": { diff --git a/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload1.json b/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload1.json index 3f7cd31ab..ee9edba18 100644 --- a/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload1.json +++ b/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload1.json @@ -43,7 +43,6 @@ "options": { "path": "/path/to/some/file.json" }, - "capabilities": [], "capabilitiesTransformations": { "setting1": "http://registry\\.gpii\\.net/common/fontSize", "setting2.path1": "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled", @@ -70,8 +69,7 @@ }, "settingsHandlers": { "otherconf": { - "type": "gpii.settingsHandlers.noSettings", - "capabilities": [] + "type": "gpii.settingsHandlers.noSettings" } }, "start": [], diff --git a/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload2.json b/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload2.json index e264730f7..6c2acf536 100644 --- a/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload2.json +++ b/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload2.json @@ -34,15 +34,15 @@ } ] }, + "capabilities": [ + "http://registry\\.gpii\\.net/common/magnification/enabled" + ], "settingsHandlers": { "configuration": { "type": "gpii.settingsHandlers.JSONSettingsHandler", "options": { "filename": "/tmp/fakemag1.settings.json" }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/magnification/enabled" - ], "capabilitiesTransformations": { "magnification": "http://registry\\.gpii\\.net/common/magnification" } @@ -59,15 +59,15 @@ } ] }, + "capabilities": [ + "http://registry\\.gpii\\.net/common/magnification/enabled" + ], "settingsHandlers": { "configuration": { "type": "gpii.settingsHandlers.JSONSettingsHandler", "options": { "filename": "/tmp/fakemag2.settings.json" }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/magnification/enabled" - ], "capabilitiesTransformations": { "magnification": "http://registry\\.gpii\\.net/common/magnification", "invert": "http://registry\\.gpii\\.net/common/invertColours" @@ -98,15 +98,15 @@ } ] }, + "capabilities": [ + "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" + ], "settingsHandlers": { "configuration": { "type": "gpii.settingsHandlers.JSONSettingsHandler", "options": { "filename": "/tmp/fakescreenreader1.json" }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" - ], "capabilitiesTransformations": { "pitch": "http://registry\\.gpii\\.net/common/pitch", "volumeTTS": "http://registry\\.gpii\\.net/common/volumeTTS", @@ -131,7 +131,6 @@ "options": { "filename": "/tmp/otherapp.json" }, - "capabilities": [], "capabilitiesTransformations": { "pitch": "http://registry\\.gpii\\.net/common/volume" } diff --git a/gpii/node_modules/canopyMatchMaker/test/web/js/CanopyMatchMakerUtilitiesTests.js b/gpii/node_modules/canopyMatchMaker/test/web/js/CanopyMatchMakerUtilitiesTests.js index 004dfb487..8a6dd3951 100644 --- a/gpii/node_modules/canopyMatchMaker/test/web/js/CanopyMatchMakerUtilitiesTests.js +++ b/gpii/node_modules/canopyMatchMaker/test/web/js/CanopyMatchMakerUtilitiesTests.js @@ -29,7 +29,6 @@ var magnifier = { "settingsHandlers": { "myconf": { "type": "gpii.integrationTesting.mockSettingsHandler", - "capabilities": ["display.screenEnhancement"], "capabilitiesTransformations": { "mag-factor": "display.screenEnhancement.magnification", "show-cross-hairs": "display.screenEnhancement.-provisional-showCrosshairs", @@ -57,7 +56,6 @@ var lesserMagnifier = { }, "yourconf": { "type": "gpii.integrationTesting.mockSettingsHandler", - "capabilities": "display.screenEnhancement.magnification" } } }; @@ -206,7 +204,6 @@ var disposeStrategyFixtures = [ "options": { "path": "/some/path/to/file.json" }, - "capabilities": [], "capabilitiesTransformations": { "setting1": "http://registry\\.gpii\\.net/common/fontSize", "setting2.path1": "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled", @@ -242,7 +239,6 @@ var disposeStrategyFixtures = [ "settingsHandlers": { "myconf": { "type": "gpii.settingsHandlers.noSettings", - "capabilities": [] } } }, diff --git a/gpii/node_modules/contextManager/test/data/standardMMInput.json b/gpii/node_modules/contextManager/test/data/standardMMInput.json index 9a7ad1570..15c29e12b 100644 --- a/gpii/node_modules/contextManager/test/data/standardMMInput.json +++ b/gpii/node_modules/contextManager/test/data/standardMMInput.json @@ -68,6 +68,9 @@ } ] }, + "capabilities": [ + "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" + ], "settingsHandlers": { "configuration1": { "type": "gpii.settingsHandlers.INISettingsHandler", @@ -75,9 +78,6 @@ "filename": "${{environment}.APPDATA}\\Freedom Scientific\\JAWS\\17.0\\Settings\\enu\\DEFAULT.JCF" }, "supportedSettings": {}, - "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" - ], "capabilitiesTransformations": {}, "inverseCapabilitiesTransformations": {} }, @@ -95,7 +95,6 @@ "ENU-Message.Rate": {}, "ENU-PCCursor.Rate": {} }, - "capabilities": [], "capabilitiesTransformations": { "ENU-Global\\.Rate": "http://registry\\.gpii\\.net/common/speechRate", "ENU-JAWSCursor\\.Rate": "http://registry\\.gpii\\.net/common/speechRate", @@ -156,7 +155,6 @@ "allowNumberSignComments": true, "allowSubSections": true }, - "capabilities": [], "capabilitiesTransformations": { "speech\\.espeak\\.rate": { "transform": { @@ -264,9 +262,6 @@ }, "verifySettings": true }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/mouseTrailing" - ], "capabilitiesTransformations": { "MouseTrails": { "transform": { diff --git a/gpii/node_modules/contextManager/test/data/standardMMOutput.json b/gpii/node_modules/contextManager/test/data/standardMMOutput.json index cf518c076..6a7eec50e 100644 --- a/gpii/node_modules/contextManager/test/data/standardMMOutput.json +++ b/gpii/node_modules/contextManager/test/data/standardMMOutput.json @@ -27,7 +27,6 @@ "speech\\.espeak\\.pitch": 63 } }, - "capabilities": [], "capabilitiesTransformations": { "speech\\.espeak\\.rate": { "transform": { @@ -140,9 +139,6 @@ }, "verifySettings": true }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/mouseTrailing" - ], "capabilitiesTransformations": { "MouseTrails": { "transform": { diff --git a/gpii/node_modules/flatMatchMaker/test/FlatMatchMakerTests.js b/gpii/node_modules/flatMatchMaker/test/FlatMatchMakerTests.js index 76958c18d..3b8a41d7c 100644 --- a/gpii/node_modules/flatMatchMaker/test/FlatMatchMakerTests.js +++ b/gpii/node_modules/flatMatchMaker/test/FlatMatchMakerTests.js @@ -61,7 +61,6 @@ "options": { "path": "/some/path/to/file.json" }, - "capabilities": [], "capabilitiesTransformations": { "setting1": "http://registry\\.gpii\\.net/common/fontSize", "setting2.path1": "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled", @@ -96,8 +95,7 @@ "contexts": {}, "settingsHandlers": { "myconf": { - "type": "gpii.settingsHandlers.noSettings", - "capabilities": [] + "type": "gpii.settingsHandlers.noSettings" } } }, diff --git a/gpii/node_modules/flatMatchMaker/test/data/full_mm_payload1.json b/gpii/node_modules/flatMatchMaker/test/data/full_mm_payload1.json index 3f7cd31ab..ee9edba18 100644 --- a/gpii/node_modules/flatMatchMaker/test/data/full_mm_payload1.json +++ b/gpii/node_modules/flatMatchMaker/test/data/full_mm_payload1.json @@ -43,7 +43,6 @@ "options": { "path": "/path/to/some/file.json" }, - "capabilities": [], "capabilitiesTransformations": { "setting1": "http://registry\\.gpii\\.net/common/fontSize", "setting2.path1": "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled", @@ -70,8 +69,7 @@ }, "settingsHandlers": { "otherconf": { - "type": "gpii.settingsHandlers.noSettings", - "capabilities": [] + "type": "gpii.settingsHandlers.noSettings" } }, "start": [], diff --git a/gpii/node_modules/flowManager/test/data/browserChannel_solutionsRegistry.json b/gpii/node_modules/flowManager/test/data/browserChannel_solutionsRegistry.json index 0f06106c9..6ed447d9b 100644 --- a/gpii/node_modules/flowManager/test/data/browserChannel_solutionsRegistry.json +++ b/gpii/node_modules/flowManager/test/data/browserChannel_solutionsRegistry.json @@ -14,8 +14,7 @@ "type": "gpii.settingsHandlers.webSockets", "options": { "path": "org.chrome.cloud4chrome" - }, - "capabilities": [] + } } }, "configure": [ @@ -39,8 +38,7 @@ "type": "gpii.settingsHandlers.webSockets", "options": { "path": "org.mozilla.cloud4firefox" - }, - "capabilities": [] + } } }, "configure": [ diff --git a/gpii/node_modules/flowManager/test/data/matchmaker.output.payload.json b/gpii/node_modules/flowManager/test/data/matchmaker.output.payload.json index 2f8e90ba7..a837b5c0e 100644 --- a/gpii/node_modules/flowManager/test/data/matchmaker.output.payload.json +++ b/gpii/node_modules/flowManager/test/data/matchmaker.output.payload.json @@ -187,7 +187,6 @@ "options": { "schema": "org.gnome.desktop.a11y.magnifier" }, - "capabilities": [], "capabilitiesTransformations": { "mag-factor": "http://registry\\.gpii\\.net/common/magnification", "show-cross-hairs": "http://registry\\.gpii\\.net/common/showCrosshairs", @@ -259,7 +258,6 @@ "settingsHandlers": [ { "type": "gpii.gsettings", - "capabilities": [], "capabilitiesTransformations": { "text-scaling-factor": { "transform": { @@ -341,7 +339,6 @@ "settingsHandlers": [ { "type": "gpii.gsettings", - "capabilities": [], "capabilitiesTransformations": { "font": "http://registry\\.gpii\\.net/common/0" }, @@ -375,13 +372,8 @@ } ] }, - "settingsHandlers": [ - { - "type": "gpii.settingsHandlers.noSettings", - "capabilities": [ - "http://registry\\.gpii\\.net/common/onScreenKeyboardEnabled" - ] - } + "capabilities": [ + "http://registry.gpii.net/common/onScreenKeyboardEnabled" ], "lifecycleManager": { "start": [ @@ -417,7 +409,6 @@ "settingsHandlers": [ { "type": "gpii.gsettings", - "capabilities": [], "capabilitiesTransformations": { "stickykeys-enable": "http://registry\\.gpii\\.net/common/stickyKeys", "slowkeys-enable": "http://registry\\.gpii\\.net/common/slowKeysEnabled", @@ -492,7 +483,6 @@ "settingsHandlers": [ { "type": "gpii.gsettings", - "capabilities": [], "options": { "schema": "org.gnome.desktop.wm.preferences" } @@ -526,7 +516,6 @@ "settingsHandlers": [ { "type": "gpii.gsettings", - "capabilities": [], "options": { "schema": "org.gnome.shell.overrides" } @@ -557,15 +546,15 @@ } ] }, + "capabilities": [ + "http://registry.gpii.net/common/screenReaderTTSEnabled" + ], "settingsHandlers": [ { "type": "gpii.orca", "options": { "user": "${{userToken}}" }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" - ], "capabilitiesTransformations": { "enableTutorialMessages": "http://registry\\.gpii\\.net/common/speakTutorialMessages", "enableEchoByCharacter": "http://registry\\.gpii\\.net/common/keyEcho", @@ -1073,7 +1062,6 @@ "settingsHandlers": [ { "type": "gpii.alsa", - "capabilities": [], "capabilitiesTransformations": { "masterVolume": { "transform": { @@ -1118,13 +1106,8 @@ } ] }, - "settingsHandlers": [ - { - "type": "gpii.settingsHandlers.noSettings", - "capabilities": [ - "http://registry\\.gpii\\.net/common/simplification" - ] - } + "capabilities": [ + "http://registry.gpii.net/common/simplification" ], "lifecycleManager": { "start": [ @@ -1165,13 +1148,8 @@ } ] }, - "settingsHandlers": [ - { - "type": "gpii.settingsHandlers.noSettings", - "capabilities": [ - "http://registry\\.gpii\\.net/common/pictorialSimplification" - ] - } + "capabilities": [ + "http://registry.gpii.net/common/pictorialSimplification" ], "lifecycleManager": { "start": [ @@ -1212,13 +1190,8 @@ } ] }, - "settingsHandlers": [ - { - "type": "gpii.settingsHandlers.noSettings", - "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" - ] - } + "capabilities": [ + "http://registry.gpii.net/common/screenReaderTTSEnabled" ], "lifecycleManager": { "start": [ @@ -1253,8 +1226,7 @@ }, "settingsHandlers": [ { - "type": "gpii.xrandr", - "capabilities": [] + "type": "gpii.xrandr" } ], "lifecycleManager": { @@ -1282,10 +1254,6 @@ "options": { "path": "org.chrome.cloud4chrome" }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/contrastTheme", - "http://registry\\.gpii\\.net/common/fontSize" - ], "capabilitiesTransformations": { "screenReaderTTSEnabled": "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled", "fontSize": { diff --git a/gpii/node_modules/flowManager/test/data/update_solutionsRegistry.json b/gpii/node_modules/flowManager/test/data/update_solutionsRegistry.json index af7ccf22d..051e75cfa 100644 --- a/gpii/node_modules/flowManager/test/data/update_solutionsRegistry.json +++ b/gpii/node_modules/flowManager/test/data/update_solutionsRegistry.json @@ -12,7 +12,6 @@ "settingsHandlers": { "myconf": { "type": "gpii.settingsHandlers.noSettings", - "capabilities": [], "capabilitiesTransformations": { "dummySetting1": "http://registry\\.gpii\\.net/common/fontSize", "dummySetting2": "http://registry\\.gpii\\.net/common/setting2" diff --git a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js index 7013a159b..62b1d13dd 100644 --- a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js +++ b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js @@ -44,20 +44,16 @@ var fluid = fluid || require("infusion"), * and the inputPaths of the capabilitiesTransformations block */ gpii.matchMakerFramework.utils.extractCapabilities = function (settingsHandler) { - var capabilities = fluid.model.transform.collectInputPaths(settingsHandler.capabilitiesTransformations || {}); - return capabilities.concat(fluid.makeArray(settingsHandler.capabilities)); + return fluid.model.transform.collectInputPaths(settingsHandler.capabilitiesTransformations || {}); }; /** - * Helper function for computeAndOntologizeCapabilitiesFromSettingsHandler. Grabs the capabilities (incl. those from the - * capabilities transformations) for a single settings handler. Returns them in the ontology - * provided via the transform spec + * Helper function for computeAndOntologizeCapabilitiesFromSolution. Takes an array of paths as input + * and returns them in the ontology provided via the transform spec */ - gpii.matchMakerFramework.utils.computeAndOntologizeCapabilitiesFromSettingsHandler = function (settingsHandler, transformSpec) { - var inputPaths = gpii.matchMakerFramework.utils.extractCapabilities(settingsHandler); - + gpii.matchMakerFramework.utils.transformCapabilitiesToLeaves = function (paths, transformSpec) { // Input paths are flat so need to be transformed into hierarchical - var skel = gpii.matchMakerFramework.utils.pathsToSkeleton(inputPaths, true); + var skel = gpii.matchMakerFramework.utils.pathsToSkeleton(paths, true); var hskeleton = fluid.model.transformWithRules(skel, transformSpec); return gpii.matchMakerFramework.utils.computeLeaves(hskeleton); @@ -79,12 +75,18 @@ var fluid = fluid || require("infusion"), * concatenated with the list given in the capabilities block of the solution entry. */ gpii.matchMakerFramework.utils.computeAndOntologizeCapabilitiesFromSolution = function (solution, transformSpec) { - var settingsHandlerBlocks = []; + var paths = []; fluid.each(solution.settingsHandlers, function (handlerBlock) { - var capabilities = gpii.matchMakerFramework.utils.computeAndOntologizeCapabilitiesFromSettingsHandler(handlerBlock, transformSpec); - settingsHandlerBlocks = settingsHandlerBlocks.concat(capabilities); + var inputPaths = gpii.matchMakerFramework.utils.extractCapabilities(handlerBlock); + var capabilities = gpii.matchMakerFramework.utils.transformCapabilitiesToLeaves(inputPaths, transformSpec); + paths = paths.concat(capabilities); }); - return settingsHandlerBlocks; + // grab the capabilities block from the solution if present: + if (solution.capabilities) { + var capabilities = gpii.matchMakerFramework.utils.transformCapabilitiesToLeaves(solution.capabilities, transformSpec); + paths = paths.concat(capabilities); + } + return paths; }; /** diff --git a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js index 7c38bba28..3727747a6 100644 --- a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js +++ b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js @@ -190,15 +190,15 @@ var fluid = fluid || require("infusion"), model: { "name": "GNOME Shell Magnifier", "contexts": {}, + "capabilities": [ + "http://registry\.gpii\\.net/common/magnification/enabled" + ], "settingsHandlers": { "configuration": { "type": "gpii.gsettings", "options": { "schema": "org.gnome.desktop.a11y.magnifier" }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/invertColours" - ], "capabilitiesTransformations": { "mag-factor": "http://registry\\.gpii\\.net/common/magnification", "show-cross-hairs": "http://registry\\.gpii\\.net/common/showCrosshairs", @@ -336,7 +336,6 @@ var fluid = fluid || require("infusion"), "options": { "path": "/path/to/some/file.json" }, - "capabilities": [], "capabilitiesTransformations": { "setting1": "http://registry\\.gpii\\.net/common/fontSize", "setting2.path1": "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled", @@ -363,8 +362,7 @@ var fluid = fluid || require("infusion"), }, "settingsHandlers": { "otherconf": { - "type": "gpii.settingsHandlers.noSettings", - "capabilities": [] + "type": "gpii.settingsHandlers.noSettings" } }, "start": [], @@ -573,15 +571,15 @@ var fluid = fluid || require("infusion"), } ] }, + "capabilities": [ + "http://registry\\.gpii\\.net/common/magnification/enabled" + ], "settingsHandlers": { "configuration": { "type": "gpii.settingsHandlers.JSONSettingsHandler", "options": { "filename": "/tmp/fakemag1.settings.json" }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/magnification/enabled" - ], "capabilitiesTransformations": { "magnification": "http://registry\\.gpii\\.net/common/magnification" } @@ -610,15 +608,15 @@ var fluid = fluid || require("infusion"), } ] }, + "capabilities": [ + "http://registry\\.gpii\\.net/common/magnification/enabled" + ], "settingsHandlers": { "configuration": { "type": "gpii.settingsHandlers.JSONSettingsHandler", "options": { "filename": "/tmp/fakemag2.settings.json" }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/magnification/enabled" - ], "capabilitiesTransformations": { "magnification": "http://registry\\.gpii\\.net/common/magnification", "invert": "http://registry\\.gpii\\.net/common/invertColours" @@ -648,15 +646,15 @@ var fluid = fluid || require("infusion"), } ] }, + "capabilities": [ + "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" + ], "settingsHandlers": { "configuration": { "type": "gpii.settingsHandlers.JSONSettingsHandler", "options": { "filename": "/tmp/fakescreenreader1.json" }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" - ], "capabilitiesTransformations": { "pitch": "http://registry\\.gpii\\.net/common/pitch", "volumeTTS": "http://registry\\.gpii\\.net/common/volumeTTS", @@ -1012,15 +1010,15 @@ var fluid = fluid || require("infusion"), gpii.tests.matchMakerUtilities.getLeastLiveness.solutions = { "fakemag1": { + "capabilities": [ + "http://registry\\.gpii\\.net/common/magnification/enabled" + ], "settingsHandlers": { "configuration": { "type": "gpii.settingsHandlers.JSONSettingsHandler", "options": { "filename": "/tmp/fakemag1.settings.json" }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/magnification/enabled" - ], "capabilitiesTransformations": { "magnification": "http://registry\\.gpii\\.net/common/magnification" }, @@ -1029,15 +1027,15 @@ var fluid = fluid || require("infusion"), } }, "fakemag2": { + "capabilities": [ + "http://registry\\.gpii\\.net/common/magnification/enabled" + ], "settingsHandlers": { "configuration": { "type": "gpii.settingsHandlers.JSONSettingsHandler", "options": { "filename": "/tmp/fakemag2.settings.json" }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/magnification/enabled" - ], "capabilitiesTransformations": { "magnification": "http://registry\\.gpii\\.net/common/magnification", "invert": "http://registry\\.gpii\\.net/common/invertColours" @@ -1047,15 +1045,15 @@ var fluid = fluid || require("infusion"), } }, "fakescreenreader1": { + "capabilities": [ + "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" + ], "settingsHandlers": { "configuration": { "type": "gpii.settingsHandlers.JSONSettingsHandler", "options": { "filename": "/tmp/fakescreenreader1.json" }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" - ], "capabilitiesTransformations": { "rate": "http://registry\\.gpii\\.net/common/speechRate" }, @@ -1066,9 +1064,6 @@ var fluid = fluid || require("infusion"), "options": { "filename": "/tmp/fakescreenreader1.json" }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" - ], "capabilitiesTransformations": { "pitch": "http://registry\\.gpii\\.net/common/pitch", "volumeTTS": "http://registry\\.gpii\\.net/common/volumeTTS", diff --git a/gpii/node_modules/transformer/test/js/TransformerTests.js b/gpii/node_modules/transformer/test/js/TransformerTests.js index 6d3dd4eb1..d90dd046c 100644 --- a/gpii/node_modules/transformer/test/js/TransformerTests.js +++ b/gpii/node_modules/transformer/test/js/TransformerTests.js @@ -53,7 +53,6 @@ fluid.setLogging(true); "ZoomIncrement": "REG_DWORD" } }, - "capabilities": [], "supportedSettings": { "Invert": {}, "Magnification": {}, @@ -146,7 +145,6 @@ fluid.setLogging(true); "encoding": "utf-8", "xml-tag": "" }, - "capabilities": [], "capabilitiesTransformations": { "user.$t": { "literalValue": 1 diff --git a/testData/solutions/android.json5 b/testData/solutions/android.json5 index 80eac4051..b8a9cc54d 100644 --- a/testData/solutions/android.json5 +++ b/testData/solutions/android.json5 @@ -7,14 +7,9 @@ "version": ">=0.1" }] }, - "settingsHandlers": { - "configuration": { - "type": "gpii.settingsHandlers.noSettings", - "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" - ] - } - }, + "capabilities": [ + "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" + ], "launchHandlers": { "launcher": { "type": "gpii.launchHandlers.flexibleHandler", @@ -44,14 +39,9 @@ "version": ">=0.1" }] }, - "settingsHandlers": { - "configuration": { - "type": "gpii.settingsHandlers.noSettings", - "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" - ] - } - }, + "capabilities": [ + "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" + ], "launchHandlers": { "launcher": { "type": "gpii.launchHandlers.flexibleHandler", @@ -96,8 +86,7 @@ "fontScale": {}, "locale": {} }, - "capabilities": [], - "capabilitiesTransformations": { + "capabilitiesTransformations": { "fontScale": { "transform": { "type": "fluid.transforms.binaryOp", @@ -200,7 +189,6 @@ "STREAM_MUSIC": {}, "STREAM_SYSTEM": {} }, - "capabilities": [], "capabilitiesTransformations": { "STREAM_MUSIC": { "transform": { @@ -261,7 +249,6 @@ "user_rotation": {}, "screen_off_timeout": {} }, - "capabilities": [], "capabilitiesTransformations": { "dim_screen": { "transform": { @@ -327,7 +314,6 @@ "tts_default_pitch": {}, "tts_default_rate": {} }, - "capabilities": [], "capabilitiesTransformations": { "tts_default_pitch": { "transform": { @@ -424,7 +410,6 @@ } } }, - "capabilities": [], "capabilitiesTransformations": { "map\\.string\\.fontsize\\.$t": { "transform": { @@ -506,7 +491,6 @@ "access_commonprefs_punctuation": {}, "access_commonprefs_capitalization": {} }, - "capabilities": [], "capabilitiesTransformations": { "access_commonprefs_speechrate": { "transform": { diff --git a/testData/solutions/darwin.json5 b/testData/solutions/darwin.json5 index 9f82dacf6..ca5e45ae6 100644 --- a/testData/solutions/darwin.json5 +++ b/testData/solutions/darwin.json5 @@ -8,15 +8,15 @@ } ] }, + "capabilities": [ + "http://registry\\.gpii\\.net/common/magnification/enabled" + ], "settingsHandlers": { "configuration": { "type": "gpii.settingsHandlers.JSONSettingsHandler", "options": { "filename": "/tmp/fakemag1.settings.json" }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/magnification/enabled" - ], "capabilitiesTransformations": { "magnification": "http://registry\\.gpii\\.net/common/magnification" } @@ -46,15 +46,15 @@ } ] }, + "capabilities": [ + "http://registry\\.gpii\\.net/common/magnification/enabled" + ], "settingsHandlers": { "configuration": { "type": "gpii.settingsHandlers.JSONSettingsHandler", "options": { "filename": "/tmp/fakemag2.settings.json" }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/magnification/enabled" - ], "capabilitiesTransformations": { "magnification": "http://registry\\.gpii\\.net/common/magnification", "invert": "http://registry\\.gpii\\.net/common/invertColours" @@ -85,15 +85,15 @@ } ] }, + "capabilities": [ + "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" + ], "settingsHandlers": { "configuration": { "type": "gpii.settingsHandlers.JSONSettingsHandler", "options": { "filename": "/tmp/fakescreenreader1.json" }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" - ], "capabilitiesTransformations": { "pitch": "http://registry\\.gpii\\.net/common/pitch", "volumeTTS": "http://registry\\.gpii\\.net/common/volumeTTS", diff --git a/testData/solutions/linux.json5 b/testData/solutions/linux.json5 index 265b0b3ad..9ef2365e6 100644 --- a/testData/solutions/linux.json5 +++ b/testData/solutions/linux.json5 @@ -24,7 +24,6 @@ "mouse-tracking": {}, "screen-position": {} }, - "capabilities": [], "capabilitiesTransformations": { "mag-factor": "http://registry\\.gpii\\.net/common/magnification", "show-cross-hairs": "http://registry\\.gpii\\.net/common/showCrosshairs", @@ -141,7 +140,6 @@ "gtk-theme": {}, "icon-theme": {} }, - "capabilities": [], "capabilitiesTransformations": { "text-scaling-factor": { "transform": { @@ -260,7 +258,6 @@ "supportedSettings": { "font": {} }, - "capabilities": [], "capabilitiesTransformations": { "font": "http://registry\\.gpii\\.net/common/0" }, @@ -292,14 +289,9 @@ "version": ">=2.6.26" }] }, - "settingsHandlers": { - "configuration": { - "type": "gpii.settingsHandlers.noSettings", - "capabilities": [ - "http://registry\\.gpii\\.net/common/onScreenKeyboardEnabled" - ] - } - }, + "capabilities": [ + "http://registry\\.gpii\\.net/common/onScreenKeyboardEnabled" + ], "launchHandlers": { "launching": { "type": "gpii.gsettings.launch", @@ -351,7 +343,6 @@ "mousekeys-max-speed": {}, "mousekeys-accel-time": {} }, - "capabilities": [], "capabilitiesTransformations": { "stickykeys-enable": "http://registry\\.gpii\\.net/common/stickyKeys", "slowkeys-enable": "http://registry\\.gpii\\.net/common/slowKeysEnabled", @@ -425,7 +416,6 @@ "configuration": { "type": "gpii.gsettings", "liveness": "live", - "capabilities": [], "options": { "schema": "org.gnome.desktop.wm.preferences" } @@ -453,13 +443,10 @@ "version": ">=2.6.26" }] }, - "settingsHandlers": { "configuration": { "type": "gpii.gsettings", "liveness": "live", - "capabilities": [ - ], "options": { "schema": "org.gnome.shell.overrides" } @@ -487,6 +474,9 @@ "version": ">=2.6.26" }] }, + "capabilities": [ + "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" + ], "settingsHandlers": { "configuration": { "type": "gpii.orca", @@ -507,9 +497,6 @@ "voices.default.family": {}, "verbalizePunctuationStyle": {} }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" - ], "capabilitiesTransformations": { "enableTutorialMessages": "http://registry\\.gpii\\.net/common/speakTutorialMessages", "enableEchoByCharacter": "http://registry\\.gpii\\.net/common/keyEcho", @@ -1162,7 +1149,6 @@ "supportedSettings": { "masterVolume": {} }, - "capabilities": [], "capabilitiesTransformations": { "masterVolume": { "transform": { @@ -1205,14 +1191,9 @@ } ] }, - "settingsHandlers": { - "configuration": { - "type": "gpii.settingsHandlers.noSettings", - "capabilities": [ - "http://registry\\.gpii\\.net/common/simplification" - ] - } - }, + "capabilities": [ + "http://registry\\.gpii\\.net/common/simplification" + ], "launchHandlers": { "launcher": { "type": "gpii.launchHandlers.flexibleHandler", @@ -1266,12 +1247,12 @@ } ] }, + "capabilities": [ + "http://registry\\.gpii\\.net/common/simplification" + ], "settingsHandlers": { "configuration": { - "type": "gpii.settingsHandlers.noSettings", - "capabilities": [ - "http://registry\\.gpii\\.net/common/simplification" - ] + "type": "gpii.settingsHandlers.noSettings" } }, "launchHandlers": { @@ -1327,14 +1308,9 @@ } ] }, - "settingsHandlers": { - "configuration": { - "type": "gpii.settingsHandlers.noSettings", - "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" - ] - } - }, + "capabilities": [ + "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" + ], "launchHandlers": { "launcher": { "type": "gpii.launchHandlers.flexibleHandler", @@ -1390,7 +1366,6 @@ "configuration": { "type": "gpii.xrandr", "liveness": "liveRestart", - "capabilities": [], "supportedSettings": { "screen-resolution": {} } @@ -1432,19 +1407,6 @@ "simplifiedUiEnabled": {}, "syllabificationEnabled": {} }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/lineSpace", - "http://registry\\.gpii\\.net/common/fontSize", - "http://registry\\.gpii\\.net/common/characterSpace", - "http://registry\\.gpii\\.net/common/inputsLargerEnabled", - "http://registry\\.gpii\\.net/common/highContrastEnabled", - "http://registry\\.gpii\\.net/common/highContrastTheme", - "http://registry\\.gpii\\.net/common/selfVoicingEnabled", - "http://registry\\.gpii\\.net/common/highlightColor", - "http://registry\\.gpii\\.net/common/tableOfContents", - "http://registry\\.gpii\\.net/common/supportTool", - "http://registry\\.gpii\\.net/common/simplifiedUiEnabled" - ], "capabilitiesTransformations": { "lineSpace": "http://registry\\.gpii\\.net/common/lineSpace", "fontSize": { diff --git a/testData/solutions/web.json5 b/testData/solutions/web.json5 index 969c55dab..0bd5c5965 100644 --- a/testData/solutions/web.json5 +++ b/testData/solutions/web.json5 @@ -20,7 +20,6 @@ "highContrastTheme": {}, "invertColours": {} }, - "capabilities": [], "capabilitiesTransformations": { "screenReaderTTSEnabled": "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled", "fontSize": { @@ -96,7 +95,6 @@ "tracking": {}, "magnification": {} }, - "capabilities": [], "capabilitiesTransformations": { "fontSize": { "transform":{ @@ -196,12 +194,6 @@ "language": {}, "theme": {} }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/highContrastTheme", - "http://registry\\.gpii\\.net/common/fontSize", - "http://registry\\.gpii\\.net/common/volume", - "http://registry\\.gpii\\.net/common/language" - ], "capabilitiesTransformations": { "theme": { "transform": { @@ -292,11 +284,6 @@ "highContrastTheme": {}, "volume": {} }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/highContrastTheme", - "http://registry\\.gpii\\.net/common/fontSize", - "http://registry\\.gpii\\.net/common/volume" - ], "capabilitiesTransformations": { "fontSize": { "transform": { @@ -367,7 +354,6 @@ "access_commonprefs_capitalization": {}, "access_commonprefs_c4a_enable_braille": {} }, - "capabilities": [], "capabilitiesTransformations": { "access_commonprefs_speechrate": { "transform": { @@ -435,11 +421,6 @@ "buttonSize": {}, "fontFace": {} }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/highContrastTheme", - "http://registry\\.gpii\\.net/common/fontSize", - "http://registry\\.gpii\\.net/common/highContrastEnabled" - ], "capabilitiesTransformations": { "language": "http://registry\\.gpii\\.net/common/language", "contrastTheme": { @@ -522,10 +503,6 @@ "inputsLarger": {} }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/highContrastTheme", - "http://registry\\.gpii\\.net/common/highContrastEnabled" - ], "capabilitiesTransformations": { "language": "http://registry\\.gpii\\.net/common/language", "textSize": { diff --git a/testData/solutions/win32.json5 b/testData/solutions/win32.json5 index d01321c66..e54546853 100644 --- a/testData/solutions/win32.json5 +++ b/testData/solutions/win32.json5 @@ -8,6 +8,9 @@ } ] }, + "capabilities": [ + "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" + ], "settingsHandlers": { "configuration1": { "type": "gpii.settingsHandlers.INISettingsHandler", @@ -76,9 +79,6 @@ } } }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" - ], "capabilitiesTransformations": { "Voice Profiles\\.ActiveVoiceProfileName": { "literalValue": "GPII" @@ -243,7 +243,6 @@ "ENU-Message.SynthLangString": {}, "ENU-PCCursor.SynthLangString": {} }, - "capabilities": [], "capabilitiesTransformations": { "Options\\.PrimarySynthesizer": "http://registry\\.gpii\\.net/common/speechSynthesizer", "ENU-Global\\.Rate": "http://registry\\.gpii\\.net/common/speechRate", @@ -697,6 +696,9 @@ } ] }, + "capabilities": [ + "http://registry\\.gpii\\.net/common/languageAssistance" + ], "settingsHandlers": { "configuration": { "type": "gpii.settingsHandlers.XMLHandler", @@ -706,9 +708,6 @@ "encoding": "utf-8", "xml-tag": "" }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/languageAssistance" - ], "capabilitiesTransformations": { "ApplicationSettings": "ApplicationSettings" }, @@ -812,6 +811,9 @@ } ] }, + "capabilities": [ + "http://registry.gpii.net/common/magnification/enabled" + ], "settingsHandlers": { "configure": { "type": "gpii.windows.registrySettingsHandler", @@ -886,7 +888,6 @@ }, "ZoomIncrement": {} }, - "capabilities": [], "capabilitiesTransformations": { "Invert": { "transform": { @@ -1021,6 +1022,9 @@ } ] }, + "capabilities": [ + "http://registry\\.gpii\\.net/common/onScreenKeyboardEnabled" + ], "settingsHandlers": { "configure": { "type": "gpii.windows.registrySettingsHandler", @@ -1042,9 +1046,6 @@ } } }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/onScreenKeyboardEnabled" - ], "capabilitiesTransformations": { "NavigationMode": { "literalValue": 0 @@ -1099,6 +1100,9 @@ } ] }, + "capabilities": [ + "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" + ], "settingsHandlers": { "configure": { "type": "gpii.windows.registrySettingsHandler", @@ -1125,14 +1129,6 @@ "EchoChars": {}, "EchoWords": {} }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled", - "http://registry\\.gpii\\.net/common/speechRate", - "http://registry\\.gpii\\.net/common/trackingTTS", - "http://registry\\.gpii\\.net/common/keyEcho", - "http://registry\\.gpii\\.net/common/wordEcho", - "http://registry\\.gpii\\.net/common/pitch" - ], "capabilitiesTransformations": { "SpeechSpeed": { "transform": { @@ -1303,9 +1299,6 @@ "ShowKeyboardIntroduction": {}, "ShowBrowserSelection": {} }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/volumeTTS" - ], "capabilitiesTransformations": { "SpeechVolume": { "transform": { @@ -1405,7 +1398,6 @@ "speech.symbolLevel": {}, "speech.espeak.voice": {} }, - "capabilities": [], "capabilitiesTransformations": { "speech\\.espeak\\.pitch": { "transform": { @@ -1834,15 +1826,9 @@ } ] }, - - "settingsHandlers": { - "configure": { - "type": "gpii.settingsHandlers.noSettings", - "capabilities": [ - "http://registry\\.gpii\\.net/common/simplification" - ] - } - }, + "capabilities": [ + "http://registry\\.gpii\\.net/common/simplification" + ], "launchHandlers": { "launcher": { "type": "gpii.launchHandlers.flexibleHandler", @@ -1894,14 +1880,9 @@ } ] }, - "settingsHandlers": { - "configure": { - "type": "gpii.settingsHandlers.noSettings", - "capabilities": [ - "http://registry\\.gpii\\.net/common/pictorialSimplification" - ] - } - }, + "capabilities": [ + "http://registry\\.gpii\\.net/common/pictorialSimplification" + ], "launchHandlers": { "launcher": { "type": "gpii.launchHandlers.flexibleHandler", @@ -1946,14 +1927,9 @@ } ] }, - "settingsHandlers": { - "configure": { - "type": "gpii.settingsHandlers.noSettings", - "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" - ] - } - }, + "capabilities": [ + "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" + ], "launchHandlers": { "launcher": { "type": "gpii.launchHandlers.flexibleHandler", @@ -1998,7 +1974,6 @@ } ] }, - "settingsHandlers": { "configuration": { "type": "gpii.settingsHandlers.JSONSettingsHandler", @@ -2012,11 +1987,6 @@ "speakLabels": {}, "theme": {} }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/selfVoicingEnabled", - "http://registry\\.gpii\\.net/common/highContrastEnabled", - "http://registry\\.gpii\\.net/common/highContrastTheme" - ], "capabilitiesTransformations": { "transform": [ { @@ -2155,9 +2125,6 @@ } } }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/highContrastEnabled" - ], "capabilitiesTransformations": { "HighContrastOn": { "transform": { @@ -2202,9 +2169,6 @@ } } }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/highContrastTheme" - ], "capabilitiesTransformations": { "LastHighContrastTheme": { "transform": { @@ -2268,7 +2232,6 @@ "supportedSettings": { "StickyKeysOn": {} }, - "capabilities": [], "capabilitiesTransformations": { "StickyKeysOn": { "transform": { @@ -2354,7 +2317,6 @@ } } }, - "capabilities": [], "capabilitiesTransformations": { "FilterKeysEnable": { "transform": { @@ -2571,7 +2533,6 @@ } } }, - "capabilities": [], "capabilitiesTransformations": { "MouseKeysOn": { "transform": { @@ -2701,9 +2662,6 @@ } } }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/mouseTrailing" - ], "capabilitiesTransformations": { "MouseTrails": { "transform": { @@ -2754,10 +2712,6 @@ "configuration": { "type": "gpii.windows.displaySettingsHandler", "liveness": "liveRestart", - "capabilities": [ - "display.screenEnhancement.screenResolution", - "applications.com\\.microsoft\\.windows\\.screenResolution.id" - ], "supportedSettings": { "screen-resolution": { "schema": { @@ -2800,10 +2754,6 @@ "supportedSettings": { "screen-dpi": {} }, - "capabilities": [ - "display.screenEnhancement.screenScale", - "applications.com\\.microsoft\\.windows\\.screenDPI.id" - ], "supportedSettings": { "screen-dpi": { "schema": { @@ -2885,9 +2835,6 @@ "UpArrow": {}, "Wait": {} }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/cursorSize" - ], "capabilitiesTransformations": { "Arrow": { "transform": { @@ -3194,7 +3141,6 @@ "highContrastEnabled": {}, "fontSize": {} }, - "capabilities": [], "capabilitiesTransformations": { "user.$t": { "literalValue": 1 @@ -3304,19 +3250,6 @@ "simplifiedUiEnabled": {}, "syllabificationEnabled": {} }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/lineSpace", - "http://registry\\.gpii\\.net/common/fontSize", - "http://registry\\.gpii\\.net/common/characterSpace", - "http://registry\\.gpii\\.net/common/inputsLargerEnabled", - "http://registry\\.gpii\\.net/common/highContrastEnabled", - "http://registry\\.gpii\\.net/common/highContrastTheme", - "http://registry\\.gpii\\.net/common/selfVoicingEnabled", - "http://registry\\.gpii\\.net/common/highlightColor", - "http://registry\\.gpii\\.net/common/tableOfContents", - "http://registry\\.gpii\\.net/common/supportTool", - "http://registry\\.gpii\\.net/common/simplifiedUiEnabled" - ], "capabilitiesTransformations": { "lineSpace": "http://registry\\.gpii\\.net/common/lineSpace", "fontSize": { @@ -3416,10 +3349,12 @@ "configure": { "type": "gpii.settingsHandlers.noSettings", "liveness": "OSRestart", - "capabilities": [ - "http://registry\\.gpii\\.net/common/speechControl" - ], - "supportedSettings": {} + "capabilitiesTransformations": { + "sc": "http://registry\\.gpii\\.net/common/speechControl" + }, + "supportedSettings": { + "sc": {} + } } }, "configure": [], diff --git a/tests/data/multiSHSolutionRegistry.json b/tests/data/multiSHSolutionRegistry.json index 55cbb0cdb..8afe67c11 100644 --- a/tests/data/multiSHSolutionRegistry.json +++ b/tests/data/multiSHSolutionRegistry.json @@ -10,6 +10,9 @@ } ] }, + "capabilities": [ + "http://registry\\.gpii\\.net/common/magnification/enabled" + ], "settingsHandlers": { "configuration": { "type": "gpii.settingsHandlers.JSONSettingsHandler", @@ -21,9 +24,6 @@ "magnification": {}, "tracking": {} }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/magnification/enabled" - ], "capabilitiesTransformations": { "magnification": "http://registry\\.gpii\\.net/common/magnification", "tracking": "http://registry\\.gpii\\.net/common/tracking" @@ -38,7 +38,6 @@ "weirdSetting": {}, "crazyColor": {} }, - "capabilities": [], "capabilitiesTransformations": { "crazyColor": "http://registry\\.gpii\\.net/common/invertColours" } From 82307b11b5f387930ad2a42a6de16e733753d4cd Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Fri, 16 Feb 2018 15:13:38 +0100 Subject: [PATCH 35/44] GPII-1230: Web based tests passing again --- .../matchMakerFramework/src/MatchMakerUtilities.js | 6 ++++++ .../matchMakerFramework/test/js/MatchMakerUtilitiesTests.js | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js index ab0d46d7a..4600d3eab 100644 --- a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js +++ b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js @@ -508,6 +508,12 @@ var fluid = fluid || require("infusion"), fluid.each(payload.solutionsRegistryEntries, function (entry, entryId) { // first get an array of what solution types the current entry is: var solutionTypes = gpii.matchMakerFramework.utils.computeAndOntologizeCapabilitiesFromSolution(entry, transformSpec); + // Make sure entries are unique + var uniqueTypes = {}; + fluid.each(solutionTypes, function (type) { + uniqueTypes[type] = true; + }); + solutionTypes = Object.keys(uniqueTypes); fluid.set(payload, [ "solutionTypes", entryId], solutionTypes); // now add solution ID to the return array in the appropriate places: for (var i in solutionTypes) { diff --git a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js index 3727747a6..37293d86c 100644 --- a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js +++ b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js @@ -264,7 +264,6 @@ var fluid = fluid || require("infusion"), expectedISO: [ "display.screenEnhancement.tracking", "display.screenEnhancement.magnification", - "display.screenEnhancement.-provisional-invertColours", "display.screenEnhancement.-provisional-magnifierPosition" ], expectedApptology: [ @@ -1078,12 +1077,12 @@ var fluid = fluid || require("infusion"), gpii.tests.matchMakerUtilities.getLeastLiveness.testData = [ { name: "Basic with single solution", - term: "http://registry.gpii.net/common/magnification/enabled", + term: "http://registry.gpii.net/common/magnification", solutions: fluid.filterKeys(gpii.tests.matchMakerUtilities.getLeastLiveness.solutions, ["fakemag1"]), expected: "live" }, { name: "Term present in multiple solutions, least lively wins", - term: "http://registry.gpii.net/common/magnification/enabled", + term: "http://registry.gpii.net/common/magnification", solutions: fluid.filterKeys(gpii.tests.matchMakerUtilities.getLeastLiveness.solutions, ["fakemag1", "fakemag2"]), expected: "liveRestart" }, { From 84c534f11aaa6ccd31bc1df6b5145e699555a3d1 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 21 Feb 2018 13:42:18 +0100 Subject: [PATCH 36/44] GPII-1230: *enabled functionality working but needs tests, linting and checking of web based tests --- documentation/BrowserChannel.md | 4 +- documentation/FlowManager.md | 2 +- documentation/PreferencesServer.md | 14 +- .../canopyMatchMaker/src/CanopyMatchMaker.js | 1 + .../src/CanopyMatchMakerUtilities.js | 11 +- .../test/CanopyMatchMakerTests.js | 5 +- .../test/data/full_mm_payload1.json | 4 +- .../test/data/full_mm_payload2.json | 2 +- .../web/js/CanopyMatchMakerUtilitiesTests.js | 6 +- .../test/data/standardMMInput.json | 2 +- .../test/FlatMatchMakerTests.js | 8 +- .../test/data/full_mm_payload1.json | 13 +- .../flowManager/test/PCPChannelTests.js | 4 +- .../flowManager/test/data/chrome2.json | 4 +- .../test/data/chrome_and_firefox.json | 8 +- .../flowManager/test/data/firefox.json | 4 +- .../test/data/matchmaker.output.payload.json | 50 ++--- .../test/shared/BrowserChannelTestDefs.js | 8 +- .../src/MatchMakerFramework.js | 3 +- .../src/MatchMakerUtilities.js | 166 ++++++++++++----- .../test/MatchMakerFrameworkTests.js | 4 +- .../test/data/common_only.json | 2 +- .../inverseCapabilities/os_win7_expected.json | 6 +- ...hMakerUtilitiesDisposeFromPriorityTests.js | 2 +- .../test/js/MatchMakerUtilitiesTests.js | 24 +-- .../data/np_ISO24751Only_singleContext.json | 2 +- ...51Only_singleContext_wildcardMetadata.json | 2 +- .../test/data/np_flatOnly_multiContext.json | 2 +- .../test/data/np_flatOnly_singleContext.json | 4 +- .../test/data/np_mixed_multiContext.json | 2 +- .../test/data/np_mixed_singleContext.json | 4 +- .../preferencesServer/test/data/np_tiny.json | 2 +- .../test/preferencesServerTests.js | 172 +++++++++--------- .../test/RawPreferencesTest.js | 12 +- .../transformer/test/js/TransformerTests.js | 8 +- testData/ontologies/flat.json5 | 16 +- .../ontologies/mappings/ISO24751-flat.json5 | 20 +- .../ontologies/mappings/flat-apptology.json5 | 8 +- testData/preferences/GPII-270-rbmm-demo.json | 2 +- testData/preferences/MikelVargas.json | 8 +- .../acceptanceTests/chrome_font_size.json | 4 +- .../acceptanceTests/chrome_high_contrast.json | 4 +- .../acceptanceTests/chrome_magnification.json | 4 +- .../acceptanceTests/fm_gnome_keyboard.json | 8 +- .../acceptanceTests/maavis_highcontrast.json | 2 +- .../acceptanceTests/maavis_selfvoicing.json | 2 +- .../acceptanceTests/olb_Alicia_cmn.json | 4 +- .../acceptanceTests/olb_Carla.json | 4 +- .../acceptanceTests/olb_KimCallahan.json | 2 +- .../preferences/acceptanceTests/olb_Lara.json | 2 +- .../acceptanceTests/olb_QinKesheng.json | 2 +- .../acceptanceTests/os_common.json | 6 +- .../acceptanceTests/os_common2.json | 2 +- .../acceptanceTests/os_common2.txt | 2 +- .../acceptanceTests/screenreader_common.json | 2 +- .../preferences/acceptanceTests/tvm_lara.json | 2 +- .../uioPlus_character_space.json | 10 +- .../acceptanceTests/uioPlus_defaults.json | 10 +- .../acceptanceTests/uioPlus_font_size.json | 10 +- .../uioPlus_high_contrast.json | 10 +- .../uioPlus_highlight_colour.json | 10 +- .../uioPlus_inputs_larger.json | 10 +- .../acceptanceTests/uioPlus_line_space.json | 10 +- .../uioPlus_multiple_settings.json | 10 +- .../uioPlus_multiple_support_tool.json | 10 +- .../acceptanceTests/uioPlus_self_voicing.json | 10 +- .../acceptanceTests/uioPlus_simplified.json | 10 +- .../acceptanceTests/uioPlus_support_tool.json | 10 +- .../uioPlus_syllabification.json | 10 +- .../acceptanceTests/uioPlus_toc.json | 10 +- .../uioPlus_unhandled_support_tool.json | 10 +- testData/preferences/chris.json | 2 +- testData/preferences/chromeDefault.json | 2 +- testData/preferences/li.json | 6 +- testData/preferences/mary.json | 2 +- testData/preferences/mickey.json | 2 +- testData/preferences/olb_Alicia_app.json | 2 +- testData/preferences/olb_Alicia_cmn.json | 4 +- testData/preferences/olb_Carla.json | 4 +- testData/preferences/olb_KimCallahan.json | 2 +- testData/preferences/olb_Lara.json | 2 +- testData/preferences/omnitor1.json | 2 +- testData/preferences/omnitor2.json | 2 +- testData/preferences/review3/chris.json | 2 +- testData/preferences/review3/li.json | 6 +- testData/preferences/review3/mary.json | 2 +- testData/preferences/review3/vladimir.json | 16 +- .../preferences/review3/vladimir_smm.json | 16 +- .../review3_chrome_high_contrast.json | 4 +- testData/preferences/review4/Alicia.json | 6 +- testData/preferences/slater.json | 2 +- testData/preferences/snapset_2a.json | 4 +- testData/preferences/snapset_2b.json | 4 +- testData/preferences/snapset_2c.json | 4 +- testData/preferences/snapset_3.json | 2 +- testData/preferences/snapset_4a.json | 3 +- testData/preferences/snapset_4d.json | 4 +- testData/preferences/sociable1.json | 2 +- testData/preferences/sociable2.json | 4 +- testData/preferences/uioPlusCommon.json | 10 +- .../preferences/uioPlus_character_space.json | 10 +- testData/preferences/uioPlus_defaults.json | 10 +- testData/preferences/uioPlus_font_size.json | 10 +- .../preferences/uioPlus_high_contrast.json | 10 +- .../preferences/uioPlus_highlight_colour.json | 10 +- .../preferences/uioPlus_inputs_larger.json | 10 +- testData/preferences/uioPlus_line_space.json | 10 +- .../uioPlus_multiple_settings.json | 10 +- .../uioPlus_multiple_support_tool.json | 10 +- .../preferences/uioPlus_self_voicing.json | 10 +- testData/preferences/uioPlus_simplified.json | 10 +- .../preferences/uioPlus_support_tool.json | 10 +- .../preferences/uioPlus_syllabification.json | 10 +- testData/preferences/uioPlus_toc.json | 10 +- .../uioPlus_unhandled_support_tool.json | 10 +- testData/preferences/vladimir.json | 16 +- testData/solutions/android.json5 | 6 +- testData/solutions/darwin.json5 | 2 +- testData/solutions/linux.json5 | 32 ++-- testData/solutions/web.json5 | 18 +- testData/solutions/win32.json5 | 56 +++--- .../AcceptanceTests_chrome_testDefs.json | 12 +- .../platform/linux/linux-builtIn-testSpec.txt | 2 +- 123 files changed, 666 insertions(+), 574 deletions(-) diff --git a/documentation/BrowserChannel.md b/documentation/BrowserChannel.md index 035678ba9..86744a205 100644 --- a/documentation/BrowserChannel.md +++ b/documentation/BrowserChannel.md @@ -65,8 +65,8 @@ The workflow between the client and server can be summarised as follows: * When the flow manager emits either the _connectionSucceeded_ (after being registered) or the _onSettingsChanged_ (after a user login/logout) signal to the client, it is delivering the current available settings for the client in the following way: ``` { - "screenReaderTTSEnabled":false, - "highContrastEnabled":true, + "screenReaderTTS/enabled":false, + "highContrast/enabled":true, "invertColours":false, "magnifierEnabled":true, "magnification":2, diff --git a/documentation/FlowManager.md b/documentation/FlowManager.md index 5be1ee654..0d185e672 100644 --- a/documentation/FlowManager.md +++ b/documentation/FlowManager.md @@ -201,7 +201,7 @@ OR if the last login/logout process for finished less than 5 seconds a "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/onScreenKeyboardEnabled": true, + "http://registry.gpii.net/common/onScreenKeyboard/enabled": true, "http://registry.gpii.net/common/initDelay": 0.120, "http://registry.gpii.net/common/cursorSpeed": 0.850 } diff --git a/documentation/PreferencesServer.md b/documentation/PreferencesServer.md index 049508458..2700ba28b 100644 --- a/documentation/PreferencesServer.md +++ b/documentation/PreferencesServer.md @@ -33,11 +33,11 @@ Return payload: "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/onScreenKeyboardEnabled": true, + "http://registry.gpii.net/common/onScreenKeyboard/enabled": true, "http://registry.gpii.net/common/initDelay": 0.120, "http://registry.gpii.net/common/cursorSpeed": 0.850, "http://registry.gpii.net/common/cursorAcceleration": 0.800, - "http://registry.gpii.net/common/mouseEmulationEnabled": true, + "http://registry.gpii.net/common/mouseEmulation/enabled": true, "http://registry.gpii.net/common/unknown": true, "http://registry.gpii.net/applications/org.alsa-project": { "volume": 14, @@ -70,7 +70,7 @@ Return payload: "cursorSpeed": 0.85, "cursorAcceleration": 0.8, "-provisional-initDelay": 0.12, - "-provisional-mouseEmulationEnabled": true + "-provisional-mouseEmulation/enabled": true } }, "applications": { @@ -110,11 +110,11 @@ Example POST body: "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/onScreenKeyboardEnabled": true, + "http://registry.gpii.net/common/onScreenKeyboard/enabled": true, "http://registry.gpii.net/common/initDelay": 0.120, "http://registry.gpii.net/common/cursorSpeed": 0.850, "http://registry.gpii.net/common/cursorAcceleration": 0.800, - "http://registry.gpii.net/common/mouseEmulationEnabled": true, + "http://registry.gpii.net/common/mouseEmulation/enabled": true, "http://registry.gpii.net/common/unknown": true, "http://registry.gpii.net/applications/org.alsa-project": { "volume": 14, @@ -138,11 +138,11 @@ Given that the above payload was stored with the token `123e4567-e89b-12d3-a456- "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/onScreenKeyboardEnabled": true, + "http://registry.gpii.net/common/onScreenKeyboard/enabled": true, "http://registry.gpii.net/common/initDelay": 0.120, "http://registry.gpii.net/common/cursorSpeed": 0.850, "http://registry.gpii.net/common/cursorAcceleration": 0.800, - "http://registry.gpii.net/common/mouseEmulationEnabled": true, + "http://registry.gpii.net/common/mouseEmulation/enabled": true, "http://registry.gpii.net/common/unknown": true, "http://registry.gpii.net/applications/org.alsa-project": { "volume": 14, diff --git a/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMaker.js b/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMaker.js index b75b0e4ee..04113db2d 100644 --- a/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMaker.js +++ b/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMaker.js @@ -79,6 +79,7 @@ gpii.canopyMatchMaker.matchPost.handleRequest = function (canopyMatchMaker, requ gpii.canopyMatchMaker.match = function (ontologyHandler, payload, disposeStrategy) { // augment payload with inferred common terms payload.preferences = gpii.matchMakerFramework.utils.addInferredCommonTerms(payload.preferences, payload.inferredCommonTerms); + gpii.matchMakerFramework.utils.addCapabilitiesInformation(payload); // augment payload with information about the solution types var appTransformSpec = gpii.ontologyHandler.getTransformSpec(ontologyHandler.ontologyTransformSpecs, "flat", "apptology"); diff --git a/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js b/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js index b08f88afd..e6cee813c 100644 --- a/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js +++ b/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js @@ -75,16 +75,16 @@ gpii.canopyMatchMaker.utils.rankSolutions = function (leaves, solrecs, ontologic * @leaves {object} * @solrecs {object} map of solutions keyed by solution id. */ -gpii.canopyMatchMaker.utils.disposeStrategy = function (leaves, solrecs, data, ontologyMetadata) { +gpii.canopyMatchMaker.utils.disposeStrategy = function (leaves, solrecs, data, contextId, ontologyMetadata) { var ontologicalMetricName = fluid.get(ontologyMetadata, "ontologicalMetricFunction") || "gpii.canopyMatchMaker.utils.prefixLength"; var ontologicalMetricFunction = fluid.getGlobalValue(ontologicalMetricName); // if we already have priority for some solutions, accept these and reject any applications // of same type. - gpii.matchMakerFramework.utils.disposeFromPriority(solrecs, data); + gpii.matchMakerFramework.utils.disposeFromPriority(solrecs, data, contextId); // rank remaining solutions based on fit to preferences var ranked = gpii.canopyMatchMaker.utils.rankSolutions(leaves, solrecs, ontologicalMetricFunction); // dispose based on canopy - var disposed = gpii.canopyMatchMaker.utils.disposeFromCanopy(leaves, ranked, solrecs, data, ontologicalMetricFunction); + var disposed = gpii.canopyMatchMaker.utils.disposeFromCanopy(leaves, ranked, solrecs, data, contextId, ontologicalMetricFunction); // re-key by solution id: var togo = {}; fluid.each(disposed, function (val) { @@ -93,7 +93,7 @@ gpii.canopyMatchMaker.utils.disposeStrategy = function (leaves, solrecs, data, o return togo; }; -gpii.canopyMatchMaker.utils.disposeFromCanopy = function (leaves, ranked, solrecs, data, ontologicalMetricFunction) { +gpii.canopyMatchMaker.utils.disposeFromCanopy = function (leaves, ranked, solrecs, data, contextId, ontologicalMetricFunction) { // Set default canopy to negative leaf depth. To raise the canopy, a preference needs to // match at least one level into the leaf. var canopy = fluid.transform(leaves, function (leaf) { @@ -116,8 +116,9 @@ gpii.canopyMatchMaker.utils.disposeFromCanopy = function (leaves, ranked, solrec } } if (inCanopy) { + var prefActive = gpii.matchMakerFramework.utils.getActiveFromEnabledTerms(data.specialPrefs[contextId] || {}, data.specialCapabilities[sol.index], data.solutionsRegistryEntries[sol.index], sol.index); sol.disposition = "accept"; - sol.active = true; + sol.active = (prefActive !== undefined) ? prefActive : true; sol.dispositionReason = "Was the solution of this type that best fit user preferences"; gpii.matchMakerFramework.utils.rejectFromTypes(data.solutionTypes[sol.index], data.solutionTypeMapping, solrecs, "Another solution (" + sol.index + diff --git a/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js b/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js index 5422710ef..3d73f0777 100644 --- a/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js +++ b/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js @@ -50,7 +50,7 @@ var matchFixtures = [ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/screenReaderTTSEnabled": true + "http://registry.gpii.net/common/screenReaderTTS/enabled": true } } }, @@ -61,7 +61,7 @@ var matchFixtures = [ "fakescreenreader1": { "active": true, "settings": { - "http://registry.gpii.net/common/screenReaderTTSEnabled": true + "http://registry.gpii.net/common/screenReaderTTS/enabled": true } } } @@ -522,6 +522,7 @@ var matchFixtures = [ gpii.canopyMatchMaker.tests.match = function (ontologyHandler) { fluid.each(matchFixtures, function (fixture) { fluid.set(fixture.input, ["preferences", "contexts"], fixture.preferences); + fluid.set(fixture.input, ["specialPrefs"], gpii.matchMakerFramework.utils.findSpecialPreferences(fixture.input.preferences)); var result = gpii.canopyMatchMaker.match(ontologyHandler, fixture.input, gpii.canopyMatchMaker.utils.disposeStrategy); jqUnit.assertDeepEq(fixture.description, fixture.expect, result); }); diff --git a/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload1.json b/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload1.json index ee9edba18..55e437fab 100644 --- a/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload1.json +++ b/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload1.json @@ -6,7 +6,7 @@ "name": "Default preferences", "preferences": { "http://registry.gpii.net/common/fontSize": 16, - "http://registry.gpii.net/common/screenReaderTTSEnabled": false, + "http://registry.gpii.net/common/screenReaderTTS/enabled": false, "http://registry.gpii.net/common/magnification/enabled": false, "http://registry.gpii.net/common/magnification": 1 } @@ -45,7 +45,7 @@ }, "capabilitiesTransformations": { "setting1": "http://registry\\.gpii\\.net/common/fontSize", - "setting2.path1": "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled", + "setting2.path1": "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled", "setting2.path2": "http://registry\\.gpii\\.net/common/magnification/enabled", "setting2.path3.hello": "http://registry\\.gpii\\.net/common/magnification" } diff --git a/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload2.json b/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload2.json index 6c2acf536..703aef92c 100644 --- a/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload2.json +++ b/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload2.json @@ -99,7 +99,7 @@ ] }, "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" + "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled" ], "settingsHandlers": { "configuration": { diff --git a/gpii/node_modules/canopyMatchMaker/test/web/js/CanopyMatchMakerUtilitiesTests.js b/gpii/node_modules/canopyMatchMaker/test/web/js/CanopyMatchMakerUtilitiesTests.js index 8a6dd3951..e860c5bc2 100644 --- a/gpii/node_modules/canopyMatchMaker/test/web/js/CanopyMatchMakerUtilitiesTests.js +++ b/gpii/node_modules/canopyMatchMaker/test/web/js/CanopyMatchMakerUtilitiesTests.js @@ -191,7 +191,7 @@ var disposeStrategyFixtures = [ "display.screenEnhancement.fontSize", "display.screenEnhancement.magnification", "display.screenEnhancement.-provisional-magnification/enabled", - "display.screenReader.-provisional-screenReaderTTSEnabled" + "display.screenReader.-provisional-screenReaderTTS/enabled" ], solRecsArg: { "test.dummy": { @@ -206,7 +206,7 @@ var disposeStrategyFixtures = [ }, "capabilitiesTransformations": { "setting1": "http://registry\\.gpii\\.net/common/fontSize", - "setting2.path1": "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled", + "setting2.path1": "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled", "setting2.path2": "http://registry\\.gpii\\.net/common/magnification/enabled", "setting2.path3.hello": "http://registry\\.gpii\\.net/common/magnification" } @@ -226,7 +226,7 @@ var disposeStrategyFixtures = [ "-provisional-magnification/enabled": {} }, "screenReader": { - "-provisional-screenReaderTTSEnabled": {} + "-provisional-screenReaderTTS/enabled": {} } } }, diff --git a/gpii/node_modules/contextManager/test/data/standardMMInput.json b/gpii/node_modules/contextManager/test/data/standardMMInput.json index 15c29e12b..7114339fd 100644 --- a/gpii/node_modules/contextManager/test/data/standardMMInput.json +++ b/gpii/node_modules/contextManager/test/data/standardMMInput.json @@ -69,7 +69,7 @@ ] }, "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" + "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled" ], "settingsHandlers": { "configuration1": { diff --git a/gpii/node_modules/flatMatchMaker/test/FlatMatchMakerTests.js b/gpii/node_modules/flatMatchMaker/test/FlatMatchMakerTests.js index 3b8a41d7c..6bb3b84ce 100644 --- a/gpii/node_modules/flatMatchMaker/test/FlatMatchMakerTests.js +++ b/gpii/node_modules/flatMatchMaker/test/FlatMatchMakerTests.js @@ -48,7 +48,7 @@ "display.screenEnhancement.fontSize", "display.screenEnhancement.magnification", "display.screenEnhancement.-provisional-magnification/enabled", - "display.screenReader.-provisional-screenReaderTTSEnabled" + "display.screenReader.-provisional-screenReaderTTS/enabled" ], solRecsArg: { "test.dummy": { @@ -63,7 +63,7 @@ }, "capabilitiesTransformations": { "setting1": "http://registry\\.gpii\\.net/common/fontSize", - "setting2.path1": "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled", + "setting2.path1": "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled", "setting2.path2": "http://registry\\.gpii\\.net/common/magnification/enabled", "setting2.path3.hello": "http://registry\\.gpii\\.net/common/magnification" } @@ -83,7 +83,7 @@ "-provisional-magnification/enabled": {} }, "screenReader": { - "-provisional-screenReaderTTSEnabled": {} + "-provisional-screenReaderTTS/enabled": {} } } }, @@ -141,7 +141,7 @@ "active": true, "settings": { "http://registry.gpii.net/common/fontSize": 16, - "http://registry.gpii.net/common/screenReaderTTSEnabled": false, + "http://registry.gpii.net/common/screenReaderTTS/enabled": false, "http://registry.gpii.net/common/magnification/enabled": false, "http://registry.gpii.net/common/magnification": 1 } diff --git a/gpii/node_modules/flatMatchMaker/test/data/full_mm_payload1.json b/gpii/node_modules/flatMatchMaker/test/data/full_mm_payload1.json index ee9edba18..d4982eb78 100644 --- a/gpii/node_modules/flatMatchMaker/test/data/full_mm_payload1.json +++ b/gpii/node_modules/flatMatchMaker/test/data/full_mm_payload1.json @@ -6,7 +6,7 @@ "name": "Default preferences", "preferences": { "http://registry.gpii.net/common/fontSize": 16, - "http://registry.gpii.net/common/screenReaderTTSEnabled": false, + "http://registry.gpii.net/common/screenReaderTTS/enabled": false, "http://registry.gpii.net/common/magnification/enabled": false, "http://registry.gpii.net/common/magnification": 1 } @@ -27,6 +27,15 @@ "version": "12.5.0" } }, + "solutionCapabilities": { + "mac.dummy": [ + "http://registry\\.gpii\\.net/common/fontSize", + "http://registry\\.gpii\\.net/common/magnification/enabled", + "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled", + "http://registry\\.gpii\\.net/common/magnification" + ], + "mac.dummy_empty": [] + }, "solutionsRegistryEntries": { "mac.dummy": { "name": "Mac dummy", @@ -45,7 +54,7 @@ }, "capabilitiesTransformations": { "setting1": "http://registry\\.gpii\\.net/common/fontSize", - "setting2.path1": "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled", + "setting2.path1": "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled", "setting2.path2": "http://registry\\.gpii\\.net/common/magnification/enabled", "setting2.path3.hello": "http://registry\\.gpii\\.net/common/magnification" } diff --git a/gpii/node_modules/flowManager/test/PCPChannelTests.js b/gpii/node_modules/flowManager/test/PCPChannelTests.js index f26015b3a..5f4160730 100644 --- a/gpii/node_modules/flowManager/test/PCPChannelTests.js +++ b/gpii/node_modules/flowManager/test/PCPChannelTests.js @@ -126,7 +126,7 @@ gpii.tests.pcpChannel.payloads = { }, "liveness": "live" }, - "http://registry\\.gpii\\.net/applications/com\\.microsoft\\.windows\\.highContrast.http://registry\\.gpii\\.net/common/highContrastEnabled": { + "http://registry\\.gpii\\.net/applications/com\\.microsoft\\.windows\\.highContrast.http://registry\\.gpii\\.net/common/highContrast/enabled": { "value": true, "schema": { "title": "High Contrast", @@ -152,7 +152,7 @@ gpii.tests.pcpChannel.payloads = { "solutionName": "Windows High Contrast", "liveness": "live" }, - "http://registry\\.gpii\\.net/applications/net\\.gpii\\.uioPlus.http://registry\\.gpii\\.net/common/highContrastEnabled": { + "http://registry\\.gpii\\.net/applications/net\\.gpii\\.uioPlus.http://registry\\.gpii\\.net/common/highContrast/enabled": { "value": true, "schema": { "title": "High Contrast", diff --git a/gpii/node_modules/flowManager/test/data/chrome2.json b/gpii/node_modules/flowManager/test/data/chrome2.json index ee1079223..dde799ddc 100644 --- a/gpii/node_modules/flowManager/test/data/chrome2.json +++ b/gpii/node_modules/flowManager/test/data/chrome2.json @@ -5,8 +5,8 @@ "name": "Default preferences", "preferences": { "http://registry.gpii.net/applications/org.chrome.cloud4chrome": { - "screenReaderTTSEnabled": false, - "highContrastEnabled": true, + "screenReaderTTS/enabled": false, + "highContrast/enabled": true, "invertColours": false, "magnifierEnabled": true, "magnification": 2, diff --git a/gpii/node_modules/flowManager/test/data/chrome_and_firefox.json b/gpii/node_modules/flowManager/test/data/chrome_and_firefox.json index dd29e7041..598161bb8 100644 --- a/gpii/node_modules/flowManager/test/data/chrome_and_firefox.json +++ b/gpii/node_modules/flowManager/test/data/chrome_and_firefox.json @@ -5,8 +5,8 @@ "name": "Default preferences", "preferences": { "http://registry.gpii.net/applications/org.chrome.cloud4chrome": { - "screenReaderTTSEnabled": false, - "highContrastEnabled": true, + "screenReaderTTS/enabled": false, + "highContrast/enabled": true, "invertColours": false, "magnifierEnabled": true, "magnification": 2, @@ -15,8 +15,8 @@ "highContrastTheme": "white-black" }, "http://registry.gpii.net/applications/org.mozilla.cloud4firefox": { - "screenReaderTTSEnabled": false, - "highContrastEnabled": true, + "screenReaderTTS/enabled": false, + "highContrast/enabled": true, "invertColours": false, "magnifierEnabled": true, "magnification": 2, diff --git a/gpii/node_modules/flowManager/test/data/firefox.json b/gpii/node_modules/flowManager/test/data/firefox.json index e3c5a8e16..56dac6a44 100644 --- a/gpii/node_modules/flowManager/test/data/firefox.json +++ b/gpii/node_modules/flowManager/test/data/firefox.json @@ -5,8 +5,8 @@ "name": "Default preferences", "preferences": { "http://registry.gpii.net/applications/org.mozilla.cloud4firefox": { - "screenReaderTTSEnabled": false, - "highContrastEnabled": true, + "screenReaderTTS/enabled": false, + "highContrast/enabled": true, "invertColours": false, "magnifierEnabled": true, "magnification": 2, diff --git a/gpii/node_modules/flowManager/test/data/matchmaker.output.payload.json b/gpii/node_modules/flowManager/test/data/matchmaker.output.payload.json index a837b5c0e..80ae07a49 100644 --- a/gpii/node_modules/flowManager/test/data/matchmaker.output.payload.json +++ b/gpii/node_modules/flowManager/test/data/matchmaker.output.payload.json @@ -13,7 +13,7 @@ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/screenReaderTTSEnabled": true, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, "http://registry.gpii.net/common/speechRate": 200, "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 1.5, @@ -33,11 +33,11 @@ "turn-down-light": { "name": "turn down light", "preferences": { - "http://registry.gpii.net/common/screenReaderTTSEnabled": true, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, "http://registry.gpii.net/common/speechRate": 200, "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 2, - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/matchMakerType": "RuleBased" }, "metadata": [ @@ -292,7 +292,7 @@ "gtk-theme": { "transform": { "type": "fluid.transforms.condition", - "conditionPath": "http://registry\\.gpii\\.net/common/highContrastEnabled", + "conditionPath": "http://registry\\.gpii\\.net/common/highContrast/enabled", "true": "HighContrast", "false": "Adwaita" } @@ -300,7 +300,7 @@ "icon-theme": { "transform": { "type": "fluid.transforms.condition", - "conditionPath": "http://registry\\.gpii\\.net/common/highContrastEnabled", + "conditionPath": "http://registry\\.gpii\\.net/common/highContrast/enabled", "true": "HighContrast", "false": "gnome" } @@ -373,7 +373,7 @@ ] }, "capabilities": [ - "http://registry.gpii.net/common/onScreenKeyboardEnabled" + "http://registry.gpii.net/common/onScreenKeyboard/enabled" ], "lifecycleManager": { "start": [ @@ -411,7 +411,7 @@ "type": "gpii.gsettings", "capabilitiesTransformations": { "stickykeys-enable": "http://registry\\.gpii\\.net/common/stickyKeys", - "slowkeys-enable": "http://registry\\.gpii\\.net/common/slowKeysEnabled", + "slowkeys-enable": "http://registry\\.gpii\\.net/common/slowKeys/enabled", "slowkeys-delay": { "transform": { "type": "fluid.transforms.linearScale", @@ -419,7 +419,7 @@ "factor": 1000 } }, - "bouncekeys-enable": "http://registry\\.gpii\\.net/common/debounceEnabled", + "bouncekeys-enable": "http://registry\\.gpii\\.net/common/debounce/enabled", "bouncekeys-delay": { "transform": { "type": "fluid.transforms.linearScale", @@ -427,7 +427,7 @@ "factor": 1000 } }, - "mousekeys-enable": "http://registry\\.gpii\\.net/common/mouseEmulationEnabled", + "mousekeys-enable": "http://registry\\.gpii\\.net/common/mouseEmulation/enabled", "mousekeys-init-delay": { "transform": { "type": "fluid.transforms.linearScale", @@ -547,7 +547,7 @@ ] }, "capabilities": [ - "http://registry.gpii.net/common/screenReaderTTSEnabled" + "http://registry.gpii.net/common/screenReaderTTS/enabled" ], "settingsHandlers": [ { @@ -560,7 +560,7 @@ "enableEchoByCharacter": "http://registry\\.gpii\\.net/common/keyEcho", "enableEchoByWord": "http://registry\\.gpii\\.net/common/wordEcho", "enableBraille": "http://registry\\.gpii\\.net/common/screenReaderBrailleOutput", - "enableSpeech": "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled", + "enableSpeech": "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled", "sayAllStyle": { "transform": { "type": "fluid.transforms.valueMapper", @@ -1191,7 +1191,7 @@ ] }, "capabilities": [ - "http://registry.gpii.net/common/screenReaderTTSEnabled" + "http://registry.gpii.net/common/screenReaderTTS/enabled" ], "lifecycleManager": { "start": [ @@ -1255,7 +1255,7 @@ "path": "org.chrome.cloud4chrome" }, "capabilitiesTransformations": { - "screenReaderTTSEnabled": "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled", + "screenReaderTTS/enabled": "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled", "fontSize": { "transform": { "type": "fluid.transforms.quantize", @@ -1297,7 +1297,7 @@ ] } }, - "highContrastEnabled": "http://registry\\.gpii\\.net/common/highContrastEnabled", + "highContrast/enabled": "http://registry\\.gpii\\.net/common/highContrast/enabled", "highContrastTheme": "http://registry\\.gpii\\.net/common/highContrastTheme", "invertColours": "http://registry\\.gpii\\.net/common/invertColours" } @@ -1320,7 +1320,7 @@ "org.gnome.desktop.a11y.magnifier": { "active": true, "settings": { - "http://registry.gpii.net/common/screenReaderTTSEnabled": true, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, "http://registry.gpii.net/common/speechRate": 200, "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 1.5, @@ -1330,7 +1330,7 @@ "org.gnome.orca": { "active": true, "settings": { - "http://registry.gpii.net/common/screenReaderTTSEnabled": true, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, "http://registry.gpii.net/common/speechRate": 200, "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 1.5, @@ -1340,7 +1340,7 @@ "org.chrome.cloud4chrome": { "active": true, "settings": { - "http://registry.gpii.net/common/screenReaderTTSEnabled": true, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, "http://registry.gpii.net/common/speechRate": 200, "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 1.5, @@ -1354,44 +1354,44 @@ "org.gnome.desktop.a11y.magnifier": { "active": true, "settings": { - "http://registry.gpii.net/common/screenReaderTTSEnabled": true, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, "http://registry.gpii.net/common/speechRate": 200, "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 2, - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/matchMakerType": "RuleBased" } }, "org.gnome.desktop.interface": { "active": true, "settings": { - "http://registry.gpii.net/common/screenReaderTTSEnabled": true, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, "http://registry.gpii.net/common/speechRate": 200, "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 2, - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/matchMakerType": "RuleBased" } }, "org.gnome.orca": { "active": true, "settings": { - "http://registry.gpii.net/common/screenReaderTTSEnabled": true, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, "http://registry.gpii.net/common/speechRate": 200, "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 2, - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/matchMakerType": "RuleBased" } }, "org.chrome.cloud4chrome": { "active": true, "settings": { - "http://registry.gpii.net/common/screenReaderTTSEnabled": true, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, "http://registry.gpii.net/common/speechRate": 200, "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 2, - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/matchMakerType": "RuleBased" } } diff --git a/gpii/node_modules/flowManager/test/shared/BrowserChannelTestDefs.js b/gpii/node_modules/flowManager/test/shared/BrowserChannelTestDefs.js index 5c8326424..1d60732ad 100644 --- a/gpii/node_modules/flowManager/test/shared/BrowserChannelTestDefs.js +++ b/gpii/node_modules/flowManager/test/shared/BrowserChannelTestDefs.js @@ -25,8 +25,8 @@ gpii.tests.flowManager.browserChannel.chromeAndFirefoxUserToken = "chrome_and_fi gpii.tests.flowManager.browserChannel.payloads = { "org.chrome.cloud4chrome": { - "screenReaderTTSEnabled": false, - "highContrastEnabled": true, + "screenReaderTTS/enabled": false, + "highContrast/enabled": true, "invertColours": false, "magnifierEnabled": true, "magnification": 2, @@ -35,8 +35,8 @@ gpii.tests.flowManager.browserChannel.payloads = { "highContrastTheme": "white-black" }, "org.mozilla.cloud4firefox": { - "screenReaderTTSEnabled": false, - "highContrastEnabled": true, + "screenReaderTTS/enabled": false, + "highContrast/enabled": true, "invertColours": false, "magnifierEnabled": true, "magnification": 2, diff --git a/gpii/node_modules/matchMakerFramework/src/MatchMakerFramework.js b/gpii/node_modules/matchMakerFramework/src/MatchMakerFramework.js index 89b21a5df..f54221c07 100644 --- a/gpii/node_modules/matchMakerFramework/src/MatchMakerFramework.js +++ b/gpii/node_modules/matchMakerFramework/src/MatchMakerFramework.js @@ -63,7 +63,8 @@ gpii.matchMakerFramework.preProcess = function (that, initialPayload) { "gpii-default" ], environmentReporter: {}, // TODO, - inferredCommonTerms: gpii.matchMakerFramework.utils.inferCommonTerms(initialPayload.preferences, initialPayload.fullSolutionsRegistry) + inferredCommonTerms: gpii.matchMakerFramework.utils.inferCommonTerms(initialPayload.preferences, initialPayload.fullSolutionsRegistry), + specialPrefs: gpii.matchMakerFramework.utils.findSpecialPreferences(initialPayload.preferences) }, initialPayload); // remove full solutions registry from the payload, now that we've used it // to avoid sending a too large payload to the matchmaker (see GPII-1880) diff --git a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js index 4600d3eab..feffca1fd 100644 --- a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js +++ b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js @@ -30,9 +30,7 @@ var fluid = fluid || require("infusion"), /** * APP_SETTING_PRIORITY: the priority that an application is given if the user has application * specific settings in their NP set for that application, but has no explicit priority for - * that application. - * MIN_USER_PRIORITY: If an explicit priority is set by the user for an application, this is - * the minimum value it should have, to avoid conflicting with system generated priorities. + * that application. * MIN_USER_PRIORITY: If an explicit priority is set by the user for an application, this is * the minimum value it should have, to avoid conflicting with system generated priorities. */ gpii.matchMakerFramework.APP_SETTING_PRIORITY = 512; @@ -48,10 +46,11 @@ var fluid = fluid || require("infusion"), }; /** + // TODO KASPER UPDATE DOCS * Helper function for computeAndOntologizeCapabilitiesFromSolution. Takes an array of paths as input * and returns them in the ontology provided via the transform spec */ - gpii.matchMakerFramework.utils.transformCapabilitiesToLeaves = function (paths, transformSpec) { + gpii.matchMakerFramework.utils.transformCapabilitiesToOntologizedLeaves = function (paths, transformSpec) { // Input paths are flat so need to be transformed into hierarchical var skel = gpii.matchMakerFramework.utils.pathsToSkeleton(paths, true); var hskeleton = fluid.model.transformWithRules(skel, transformSpec); @@ -60,6 +59,7 @@ var fluid = fluid || require("infusion"), }; /** + // TODO KASPER: Update docs * Given a solution entry, all the capabilities of that solution will be calculated based on * input paths in the transformations (specified in the capabilitiesTransformations block) and * on the list in the capabilities block of that solution. The collected capabilities will be @@ -74,17 +74,14 @@ var fluid = fluid || require("infusion"), * @return {Array} An array of el-paths to all the input paths of the capabilitiesTransformations * concatenated with the list given in the capabilities block of the solution entry. */ - gpii.matchMakerFramework.utils.computeAndOntologizeCapabilitiesFromSolution = function (solution, transformSpec) { + gpii.matchMakerFramework.utils.computeCapabilitiesFromSolution = function (solution) { var paths = []; fluid.each(solution.settingsHandlers, function (handlerBlock) { - var inputPaths = gpii.matchMakerFramework.utils.extractCapabilities(handlerBlock); - var capabilities = gpii.matchMakerFramework.utils.transformCapabilitiesToLeaves(inputPaths, transformSpec); - paths = paths.concat(capabilities); + paths = paths.concat(gpii.matchMakerFramework.utils.extractCapabilities(handlerBlock)); }); // grab the capabilities block from the solution if present: if (solution.capabilities) { - var capabilities = gpii.matchMakerFramework.utils.transformCapabilitiesToLeaves(solution.capabilities, transformSpec); - paths = paths.concat(capabilities); + paths = paths.concat(solution.capabilities); } return paths; }; @@ -142,9 +139,10 @@ var fluid = fluid || require("infusion"), }; /** - * Given a list of solutions, calculate the capabilities and generate a skeleton based on those. + * Given a list of solutions and capabilities, ontologize the capabilities and generate a skeleton based on those. * - * @param solutions {Object} list of solution entries in the same format as the solutions registry + * @param solutions {Object} list of solution entries in the same format as the solutions registry\ + * // TODO KASPER * @param transformSpec {Object} transformation rules to translate from the format the input paths are * given in in the solutions entries' capabilitiesTransformations block, to the ontology * that the skeleton should be in @@ -153,13 +151,13 @@ var fluid = fluid || require("infusion"), * entry. 'skeleton' which contains the capabilities of the solution. 'index' which contains * the solution id. */ - gpii.matchMakerFramework.utils.expandSolutions = function (solutions, transformSpec) { + gpii.matchMakerFramework.utils.expandSolutions = function (solutions, capabilities, transformSpec) { return fluid.transform(solutions, function (solution, solutionId) { var solutionIdObj = {}; solutionIdObj["http://registry.gpii.net/applications/" + solutionId] = {}; var transformedId = fluid.model.transformWithRules(solutionIdObj, transformSpec); - var paths = gpii.matchMakerFramework.utils.computeAndOntologizeCapabilitiesFromSolution(solution, transformSpec); + var paths = gpii.matchMakerFramework.utils.transformCapabilitiesToOntologizedLeaves(capabilities[solutionId], transformSpec); var skeleton = fluid.extend(true, {}, gpii.matchMakerFramework.utils.pathsToSkeleton(paths), transformedId); return { @@ -170,6 +168,22 @@ var fluid = fluid || require("infusion"), }); }; + /* TODO KASPER: Doc and tests */ + gpii.matchMakerFramework.utils.getActiveFromEnabledTerms = function (specialPrefs, specialCapabilities, solution, solutionId) { + var active; + + // see if solution has any enabled flags: + fluid.each(specialCapabilities, function (term) { + // if we have an /enabled term and this is not just a settings transformation: + if (term.endsWith("/enabled") && solution.capabilities && solution.capabilities.includes(term)) { + // set the active flag based on the users' preference value + active = fluid.get(specialPrefs, [ solutionId, term ]) || specialPrefs[term]; + } + }); + + return active; + }; + /** * Function that takes a MM payload set as input that *includes* an entry of * preferences in a hierarchical format, as well as a strategy for selecting solutions @@ -186,7 +200,7 @@ var fluid = fluid || require("infusion"), * to launch in that context */ gpii.matchMakerFramework.utils.disposeSolutions = function (data, strategy, transformSpec, ontologyMetadata) { - var solrecs = gpii.matchMakerFramework.utils.expandSolutions(data.solutionsRegistryEntries, transformSpec); + var solrecs = gpii.matchMakerFramework.utils.expandSolutions(data.solutionsRegistryEntries, data.solutionCapabilities, transformSpec); var togo = {}; // calculate match for each of the contexts fluid.each(data.hierarchicalPrefs.contexts, function (context, contextId) { @@ -199,7 +213,7 @@ var fluid = fluid || require("infusion"), gpii.matchMakerFramework.utils.parsePriorities(context, tmpSolrecs); var leaves = gpii.matchMakerFramework.utils.computeLeaves(context.preferences); - var disposed = strategy(leaves, tmpSolrecs, data, ontologyMetadata); + var disposed = strategy(leaves, tmpSolrecs, data, contextId, ontologyMetadata); togo[contextId] = {}; fluid.each(disposed, function (solrec, solid) { if (solrec.disposition === "accept") { // only output accepted solutions @@ -230,12 +244,12 @@ var fluid = fluid || require("infusion"), * have a format identical to the output of the gpii.matchMakerFramework.utils.expandSolutions * function. Each entry in this object will potentially be modified by the * modification/addition/deletion of the disposition, priority and/or dispositionReason. - * @param typeInfo {Object}: contains information about the type each solution is. More precisely, + * @param data {Object}: contains information about the type each solution is. More precisely, * the value for the key `solutionTypeMapping` is a map of : pairs. The second key, `solutionTypes` is a map of * with as values. */ - gpii.matchMakerFramework.utils.disposeFromPriority = function (solrecs, typeInfo) { + gpii.matchMakerFramework.utils.disposeFromPriority = function (solrecs, data, contextId) { // sort into prioritized map, eg: { 1024: [sola, solb], 200 [solc] } var prioritiesMap = {}; fluid.each(solrecs, function (sol) { @@ -253,7 +267,7 @@ var fluid = fluid || require("infusion"), // for each solution as sol for (var solutionId in sols) { var tied = []; - var solutionType = typeInfo.solutionTypes[solutionId]; + var solutionType = data.solutionTypes[solutionId]; // if a disposition is already decided for this solution, or if priority has been // removed (in case of ties), ignore it. if (solrecs[solutionId].disposition || !solrecs[solutionId].priority) { @@ -268,20 +282,24 @@ var fluid = fluid || require("infusion"), continue; } // if solutions are of equal type: - if (gpii.matchMakerFramework.utils.containsSameValue(solutionType, typeInfo.solutionTypes[otherId])) { + if (gpii.matchMakerFramework.utils.containsSameValue(solutionType, data.solutionTypes[otherId])) { // since we tie with another solution, resolve by other disposal means tied.push(otherId); } } // before accepting a solution, make sure all solutions of that type are marked reject - gpii.matchMakerFramework.utils.rejectFromTypes(typeInfo.solutionTypes[solutionId], - typeInfo.solutionTypeMapping, solrecs, + gpii.matchMakerFramework.utils.rejectFromTypes(data.solutionTypes[solutionId], + data.solutionTypeMapping, solrecs, "Another solution of same type with higher priority was found."); // if no ties, mark the current solution as "accept" if (tied.length === 0) { solrecs[solutionId].disposition = "accept"; - solrecs[solutionId].active = true; + var prefActive = gpii.matchMakerFramework.utils.getActiveFromEnabledTerms(data.specialPrefs[contextId] || {}, + data.specialCapabilities[solutionId], + data.solutionsRegistryEntries[solutionId], + solutionId); + solrecs[solutionId].active = (prefActive !== undefined) ? prefActive : true; solrecs[solutionId].dispositionReason = "Has a higher priority (" + priority + ") than any solution of the same type"; } else { @@ -371,7 +389,7 @@ var fluid = fluid || require("infusion"), if (metadata.type === "priority") { fluid.each(metadata.scope, function (applicationId) { // set the priority of the application if it's part of our solrecs list: - var solrec = solrecs[applicationId.substr("http://registry.gpii.net/applications/".length)]; + var solrec = solrecs[gpii.matchMakerFramework.utils.applicationIdFromTerm(applicationId)]; if (solrec) { solrec.priority = metadata.value; } @@ -399,7 +417,7 @@ var fluid = fluid || require("infusion"), var applicationString = "http://registry.gpii.net/applications/" + solutionId; // find supported common terms: - var supportedCommonArr = gpii.matchMakerFramework.utils.computeAndOntologizeCapabilitiesFromSolution(solutionEntry, { "": "" }); + var supportedCommonArr = gpii.matchMakerFramework.utils.computeCapabilitiesFromSolution(solutionEntry); var supportedCommon = {}; // create object of keys that are unescaped common term URIs and values of true fluid.each(supportedCommonArr, function (common) { fluid.set(supportedCommon, common, true, fluid.model.escapedSetConfig); @@ -409,7 +427,7 @@ var fluid = fluid || require("infusion"), if (filtered[applicationString]) { // application block for this solution fluid.each(filtered[applicationString], function (value, preference) { // move all common terms outside application block: - if (preference.startsWith("http://registry.gpii.net/common/")) { + if (gpii.matchMakerFramework.utils.isCommonTerm(preference)) { filtered[preference] = value; delete filtered[applicationString][preference]; } @@ -419,7 +437,7 @@ var fluid = fluid || require("infusion"), // top level: filter everything that is not the application block and supported common terms return fluid.remove_if(filtered, function (value, preference) { // Keep preference if it is a supported common term - if (preference.startsWith("http://registry.gpii.net/common/") && supportedCommon[preference] === true) { + if (gpii.matchMakerFramework.utils.isCommonTerm(preference) && supportedCommon[preference] === true) { return false; } // Also leave the applicaiton specific block @@ -487,6 +505,33 @@ var fluid = fluid || require("infusion"), return togo; }; + /** TODO doc + tests **/ + gpii.matchMakerFramework.utils.extractSpecialCapabilities = function (capabilities) { + return fluid.remove_if(fluid.copy(capabilities), function (term) { + return !term.endsWith("/enabled"); + }); + }; + + /** + * Adds information about the supported capabilities for each solution (in the flat format). + * The result will be a list of inputPaths from the capabilitiesTransformations of the settingshandlers + * as well as the content of the solutions "capabiliites" entry. + * + * NOTE: This will modify the supplied payload + * + * @param payload {Object} An object with the format of a standard matchmaker input payload. At a very + * minimum this payload should have a `solutionRegistryEntries` key with a hashmap of + * (solutionID => solution registry entry) pairs. Note that this object will be modified by + * addition of two toplevel keys: `solutionTypes` and `solutionTypeMapping`. + */ + gpii.matchMakerFramework.utils.addCapabilitiesInformation = function (payload) { + fluid.each(payload.solutionsRegistryEntries, function (solution, solutionId) { + var capabilities = gpii.matchMakerFramework.utils.computeCapabilitiesFromSolution(solution); + fluid.set(payload, [ "solutionCapabilities", solutionId ], capabilities); + fluid.set(payload, [ "specialCapabilities", solutionId ], gpii.matchMakerFramework.utils.extractSpecialCapabilities(capabilities)); + }); + }; + /** * Adds information about the solutions types to the payload paramater, which should be in the * format of an input payload for matchmakers. @@ -498,22 +543,22 @@ var fluid = fluid || require("infusion"), * NOTE: this function will modify the supplied `payload` * * @param payload {Object} An object with the format of a standard matchmaker input payload. At a very - * minimum this payload should have a `solutionRegistryEntries` key with a hashmap of - * (solutionID => solution registry entry) pairs. Note that this object will be modified by - * addition of two toplevel keys: `solutionTypes` and `solutionTypeMapping`. + * minimum this payload should have a `solutionRegistryEntries` key with the solution entries as well + * as a 'solutionCapabilities' key, which contains information about a solutions capabilities (i.e. via + * the addCapabilitiesInformation function). * @param transformSpec {Object} ontology transform spec translating from common terms into * a solution type ontology. */ gpii.matchMakerFramework.utils.addSolutionTypeInformation = function (payload, transformSpec) { - fluid.each(payload.solutionsRegistryEntries, function (entry, entryId) { + fluid.each(payload.solutionCapabilities, function (entry, entryId) { // first get an array of what solution types the current entry is: - var solutionTypes = gpii.matchMakerFramework.utils.computeAndOntologizeCapabilitiesFromSolution(entry, transformSpec); - // Make sure entries are unique - var uniqueTypes = {}; - fluid.each(solutionTypes, function (type) { - uniqueTypes[type] = true; - }); - solutionTypes = Object.keys(uniqueTypes); + var solutionTypes = gpii.matchMakerFramework.utils.transformCapabilitiesToOntologizedLeaves(entry, transformSpec); + // // Make sure entries are unique // TODO KASPER + // var uniqueTypes = {}; + // fluid.each(solutionTypes, function (type) { + // uniqueTypes[type] = true; + // }); + // solutionTypes = Object.keys(uniqueTypes); fluid.set(payload, [ "solutionTypes", entryId], solutionTypes); // now add solution ID to the return array in the appropriate places: for (var i in solutionTypes) { @@ -523,13 +568,25 @@ var fluid = fluid || require("infusion"), }); }; + gpii.matchMakerFramework.utils.isApplicationTerm = function (term) { + return term.startsWith("http://registry.gpii.net/applications/"); + }; + + gpii.matchMakerFramework.utils.isCommonTerm = function (term) { + return term.startsWith("http://registry.gpii.net/common/"); + }; + + gpii.matchMakerFramework.utils.applicationIdFromTerm = function (term) { + return term.substring("http://registry.gpii.net/applications/".length); + }; + gpii.matchMakerFramework.utils.inferCommonTermsFromApplicationsPrefs = function (prefsId, prefsBlock, flattenedSolutionsRegistry) { var togo = {}; - if (prefsId.startsWith("http://registry.gpii.net/applications/")) { - var solutionId = prefsId.substring("http://registry.gpii.net/applications/".length); + if (gpii.matchMakerFramework.utils.isApplicationTerm(prefsId)) { + var solutionId = gpii.matchMakerFramework.utils.applicationIdFromTerm(prefsId); // add any common terms from the application block directly as inferred: togo[solutionId] = fluid.remove_if(fluid.copy(prefsBlock), function (val, key) { - return (!key.startsWith("http://registry.gpii.net/common/")); // keep if it's a common term + return (!gpii.matchMakerFramework.utils.isCommonTerm(key)); // keep if it's a common term }); // transform the application specific settings and add them to inferred list if (solutionId in flattenedSolutionsRegistry) { @@ -555,6 +612,27 @@ var fluid = fluid || require("infusion"), return togo; }; + /** TODO KASPER: Doc and tests + */ + gpii.matchMakerFramework.utils.findSpecialPreferences = function (preferences) { + return fluid.transform(fluid.copy(preferences.contexts), function (context) { + var togo = {}; + fluid.each(context.preferences, function (prefsBlock, prefsId) { + if (prefsId.endsWith("/enabled")) { + togo[prefsId] = prefsBlock; + } else if (gpii.matchMakerFramework.utils.isApplicationTerm(prefsId)) { + var applicationId = gpii.matchMakerFramework.utils.applicationIdFromTerm(prefsId); + fluid.each(prefsBlock, function (appPrefVal, appPrefId) { + if (appPrefId.endsWith("/enabled")) { + fluid.set(togo, [ applicationId, appPrefId ], appPrefVal); + } + }); + } + }); + return togo; + }); + }; + /** * Converts application specific settings into common terms, keyed by application ids. Given a * set of preferences, for each application block in those preferences, the settings for which @@ -621,10 +699,10 @@ var fluid = fluid || require("infusion"), var inferred = fluid.copy(inferredConfiguration); fluid.each(preferences.contexts, function (contextBlock, contextName) { fluid.each(contextBlock.preferences, function (val, pref) { - if (pref.startsWith("http://registry.gpii.net/common/")) { + if (gpii.matchMakerFramework.utils.isCommonTerm(pref)) { gpii.matchMakerFramework.utils.updateSingleInferredConfiguration(inferred, contextName, pref, val); - } else if (pref.startsWith("http://registry.gpii.net/applications/")) { - var solutionId = pref.substring("http://registry.gpii.net/applications/".length); + } else if (gpii.matchMakerFramework.utils.isApplicationTerm(pref)) { + var solutionId = gpii.matchMakerFramework.utils.applicationIdFromTerm(pref); fluid.each(val, function (solPrefVal, solPref) { gpii.matchMakerFramework.utils.updateSingleInferredConfiguration(inferred, contextName, solPref, solPrefVal, solutionId); }); diff --git a/gpii/node_modules/matchMakerFramework/test/MatchMakerFrameworkTests.js b/gpii/node_modules/matchMakerFramework/test/MatchMakerFrameworkTests.js index 8d0998d76..15941f718 100644 --- a/gpii/node_modules/matchMakerFramework/test/MatchMakerFrameworkTests.js +++ b/gpii/node_modules/matchMakerFramework/test/MatchMakerFrameworkTests.js @@ -112,7 +112,7 @@ gpii.tests.matchMakerFramework.inferCommonTermsFixtures = { "http://registry.gpii.net/common/mouseTrailing": 10 }, "com.microsoft.windows.highContrast": { - "http://registry.gpii.net/common/highContrastEnabled": true + "http://registry.gpii.net/common/highContrast/enabled": true }, "com.microsoft.windows.cursors": { "http://registry.gpii.net/common/cursorSize": 1 @@ -140,7 +140,7 @@ gpii.tests.matchMakerFramework.inferCommonTermsFixtures = { expected: { "gpii-default": { "com.microsoft.windows.highContrast": { - "http://registry.gpii.net/common/highContrastEnabled": true + "http://registry.gpii.net/common/highContrast/enabled": true }, "com.microsoft.windows.magnifier": { "http://registry.gpii.net/common/tracking": [], diff --git a/gpii/node_modules/matchMakerFramework/test/data/common_only.json b/gpii/node_modules/matchMakerFramework/test/data/common_only.json index f71a818ec..e29459a8f 100644 --- a/gpii/node_modules/matchMakerFramework/test/data/common_only.json +++ b/gpii/node_modules/matchMakerFramework/test/data/common_only.json @@ -10,7 +10,7 @@ "http://registry.gpii.net/common/cursorSize": 0.9, "http://registry.gpii.net/common/fontSize": 9, "http://registry.gpii.net/common/mouseTrailing": 10, - "http://registry.gpii.net/common/highContrastEnabled": true + "http://registry.gpii.net/common/highContrast/enabled": true } } } diff --git a/gpii/node_modules/matchMakerFramework/test/inverseCapabilities/os_win7_expected.json b/gpii/node_modules/matchMakerFramework/test/inverseCapabilities/os_win7_expected.json index 46256f3f6..9aa828483 100644 --- a/gpii/node_modules/matchMakerFramework/test/inverseCapabilities/os_win7_expected.json +++ b/gpii/node_modules/matchMakerFramework/test/inverseCapabilities/os_win7_expected.json @@ -1,7 +1,7 @@ { "gpii-default": { "com.microsoft.windows.highContrast": { - "http://registry.gpii.net/common/highContrastEnabled": true + "http://registry.gpii.net/common/highContrast/enabled": true }, "com.microsoft.windows.cursors": { "http://registry.gpii.net/common/cursorSize": 1 @@ -23,10 +23,10 @@ }, "com.microsoft.windows.mouseKeys": { "http://registry.gpii.net/common/cursorSpeed": 0.2571428571426, - "http://registry.gpii.net/common/mouseEmulationEnabled": true + "http://registry.gpii.net/common/mouseEmulation/enabled": true }, "com.microsoft.windows.filterKeys": { - "http://registry.gpii.net/common/debounceEnabled": true, + "http://registry.gpii.net/common/debounce/enabled": true, "http://registry.gpii.net/common/debounceInterval": 1 }, "com.microsoft.windows.screenResolution": {}, diff --git a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js index 8827bf34e..4ed88c15b 100644 --- a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js +++ b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js @@ -168,7 +168,7 @@ var fluid = fluid || require("infusion"), gpii.tests.matchMakerUtilities.disposeFromPriority.singleTest = function (priorities, expectedDispositions) { var input = gpii.tests.matchMakerUtilities.disposeFromPriority.setPriorities(priorities); - gpii.matchMakerFramework.utils.disposeFromPriority(input.solrecs, input.data); + gpii.matchMakerFramework.utils.disposeFromPriority(input.solrecs, input.data TODO KASPER); fluid.each(fullData.solIds, function (solId, index) { var msg = "Expecting solution " + solId + " to be: " + expectedDispositions[index]; var actual = input.solrecs[solId].disposition ? input.solrecs[solId].active : undefined; diff --git a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js index 37293d86c..8f0733705 100644 --- a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js +++ b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js @@ -298,7 +298,7 @@ var fluid = fluid || require("infusion"), "name": "Default preferences", "preferences": { "http://registry.gpii.net/common/fontSize": 16, - "http://registry.gpii.net/common/screenReaderTTSEnabled": false, + "http://registry.gpii.net/common/screenReaderTTS/enabled": false, "http://registry.gpii.net/common/magnification/enabled": false, "http://registry.gpii.net/common/magnification": 1 } @@ -337,7 +337,7 @@ var fluid = fluid || require("infusion"), }, "capabilitiesTransformations": { "setting1": "http://registry\\.gpii\\.net/common/fontSize", - "setting2.path1": "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled", + "setting2.path1": "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled", "setting2.path2": "http://registry\\.gpii\\.net/common/magnification/enabled", "setting2.path3.hello": "http://registry\\.gpii\\.net/common/magnification" } @@ -387,7 +387,7 @@ var fluid = fluid || require("infusion"), "-provisional-magnification/enabled": false }, "screenReader": { - "-provisional-screenReaderTTSEnabled": false + "-provisional-screenReaderTTS/enabled": false } } } @@ -403,7 +403,7 @@ var fluid = fluid || require("infusion"), "active": true, "settings": { "http://registry.gpii.net/common/fontSize": 16, - "http://registry.gpii.net/common/screenReaderTTSEnabled": false, + "http://registry.gpii.net/common/screenReaderTTS/enabled": false, "http://registry.gpii.net/common/magnification/enabled": false, "http://registry.gpii.net/common/magnification": 1 } @@ -646,7 +646,7 @@ var fluid = fluid || require("infusion"), ] }, "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" + "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled" ], "settingsHandlers": { "configuration": { @@ -729,7 +729,7 @@ var fluid = fluid || require("infusion"), "active": true, "settings": { "http://registry.gpii.net/common/fontSize": 16, - "http://registry.gpii.net/common/screenReaderTTSEnabled": false, + "http://registry.gpii.net/common/screenReaderTTS/enabled": false, "http://registry.gpii.net/common/magnification/enabled": false, "http://registry.gpii.net/common/magnification": 1 } @@ -744,7 +744,7 @@ var fluid = fluid || require("infusion"), "active": true, "settings": { "http://registry.gpii.net/common/fontSize": 20, - "http://registry.gpii.net/common/screenReaderTTSEnabled": false, + "http://registry.gpii.net/common/screenReaderTTS/enabled": false, "http://registry.gpii.net/common/magnification/enabled": false, "http://registry.gpii.net/common/magnification": 1 } @@ -772,7 +772,7 @@ var fluid = fluid || require("infusion"), "active": true, "settings": { "http://registry.gpii.net/common/fontSize": 16, - "http://registry.gpii.net/common/screenReaderTTSEnabled": false, + "http://registry.gpii.net/common/screenReaderTTS/enabled": false, "http://registry.gpii.net/common/magnification/enabled": false, "http://registry.gpii.net/common/magnification": 1 } @@ -787,7 +787,7 @@ var fluid = fluid || require("infusion"), "active": true, "settings": { "http://registry.gpii.net/common/fontSize": 20, - "http://registry.gpii.net/common/screenReaderTTSEnabled": false, + "http://registry.gpii.net/common/screenReaderTTS/enabled": false, "http://registry.gpii.net/common/magnification/enabled": false, "http://registry.gpii.net/common/magnification": 2 } @@ -860,7 +860,7 @@ var fluid = fluid || require("infusion"), "active": true, "settings": { "http://registry.gpii.net/common/fontSize": 12, - "http://registry.gpii.net/common/screenReaderTTSEnabled": false + "http://registry.gpii.net/common/screenReaderTTS/enabled": false } } } @@ -880,7 +880,7 @@ var fluid = fluid || require("infusion"), "active": true, "settings": { "http://registry.gpii.net/common/fontSize": 20, - "http://registry.gpii.net/common/screenReaderTTSEnabled": false + "http://registry.gpii.net/common/screenReaderTTS/enabled": false } } } @@ -1045,7 +1045,7 @@ var fluid = fluid || require("infusion"), }, "fakescreenreader1": { "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" + "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled" ], "settingsHandlers": { "configuration": { diff --git a/gpii/node_modules/preferencesServer/test/data/np_ISO24751Only_singleContext.json b/gpii/node_modules/preferencesServer/test/data/np_ISO24751Only_singleContext.json index f352244b4..a47a4b6be 100644 --- a/gpii/node_modules/preferencesServer/test/data/np_ISO24751Only_singleContext.json +++ b/gpii/node_modules/preferencesServer/test/data/np_ISO24751Only_singleContext.json @@ -11,7 +11,7 @@ "-provisional-initDelay": 0.120, "cursorSpeed": 0.850, "cursorAcceleration": 0.800, - "-provisional-mouseEmulationEnabled": true + "-provisional-mouseEmulation/enabled": true } }, "unknown": true, diff --git a/gpii/node_modules/preferencesServer/test/data/np_ISO24751Only_singleContext_wildcardMetadata.json b/gpii/node_modules/preferencesServer/test/data/np_ISO24751Only_singleContext_wildcardMetadata.json index ed460b7eb..54817706f 100644 --- a/gpii/node_modules/preferencesServer/test/data/np_ISO24751Only_singleContext_wildcardMetadata.json +++ b/gpii/node_modules/preferencesServer/test/data/np_ISO24751Only_singleContext_wildcardMetadata.json @@ -11,7 +11,7 @@ "-provisional-initDelay": 0.120, "cursorSpeed": 0.850, "cursorAcceleration": 0.800, - "-provisional-mouseEmulationEnabled": true + "-provisional-mouseEmulation/enabled": true } }, "unknown": true, diff --git a/gpii/node_modules/preferencesServer/test/data/np_flatOnly_multiContext.json b/gpii/node_modules/preferencesServer/test/data/np_flatOnly_multiContext.json index 3edcc5389..505296ae6 100644 --- a/gpii/node_modules/preferencesServer/test/data/np_flatOnly_multiContext.json +++ b/gpii/node_modules/preferencesServer/test/data/np_flatOnly_multiContext.json @@ -6,7 +6,7 @@ "name": "Default preferences", "preferences": { "http://registry.gpii.net/common/cursorAcceleration": 0.800, - "http://registry.gpii.net/common/mouseEmulationEnabled": true, + "http://registry.gpii.net/common/mouseEmulation/enabled": true, "http://registry.gpii.net/common/unknown": true, "http://registry.gpii.net/applications/org.alsa-project": { "volume": 14, diff --git a/gpii/node_modules/preferencesServer/test/data/np_flatOnly_singleContext.json b/gpii/node_modules/preferencesServer/test/data/np_flatOnly_singleContext.json index f48ad31c3..33b1a2b0f 100644 --- a/gpii/node_modules/preferencesServer/test/data/np_flatOnly_singleContext.json +++ b/gpii/node_modules/preferencesServer/test/data/np_flatOnly_singleContext.json @@ -5,11 +5,11 @@ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/onScreenKeyboardEnabled": true , + "http://registry.gpii.net/common/onScreenKeyboard/enabled": true , "http://registry.gpii.net/common/initDelay": 0.120 , "http://registry.gpii.net/common/cursorSpeed": 0.850 , "http://registry.gpii.net/common/cursorAcceleration": 0.800 , - "http://registry.gpii.net/common/mouseEmulationEnabled": true , + "http://registry.gpii.net/common/mouseEmulation/enabled": true , "http://registry.gpii.net/common/unknown": true , "http://registry.gpii.net/applications/org.alsa-project": { "volume": 14, diff --git a/gpii/node_modules/preferencesServer/test/data/np_mixed_multiContext.json b/gpii/node_modules/preferencesServer/test/data/np_mixed_multiContext.json index 42a76f6a6..6f28d055c 100644 --- a/gpii/node_modules/preferencesServer/test/data/np_mixed_multiContext.json +++ b/gpii/node_modules/preferencesServer/test/data/np_mixed_multiContext.json @@ -8,7 +8,7 @@ "http://registry.gpii.net/common/initDelay": 0.120, "http://registry.gpii.net/common/cursorSpeed": 0.850, "http://registry.gpii.net/common/cursorAcceleration": 0.800, - "http://registry.gpii.net/common/mouseEmulationEnabled": true, + "http://registry.gpii.net/common/mouseEmulation/enabled": true, "http://registry.gpii.net/common/flatOnly": true, "http://registry.gpii.net/applications/org.alsa-project": { "volume": 14, diff --git a/gpii/node_modules/preferencesServer/test/data/np_mixed_singleContext.json b/gpii/node_modules/preferencesServer/test/data/np_mixed_singleContext.json index 5947b1159..780afde23 100644 --- a/gpii/node_modules/preferencesServer/test/data/np_mixed_singleContext.json +++ b/gpii/node_modules/preferencesServer/test/data/np_mixed_singleContext.json @@ -5,11 +5,11 @@ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/onScreenKeyboardEnabled": true , + "http://registry.gpii.net/common/onScreenKeyboard/enabled": true , "http://registry.gpii.net/common/initDelay": 0.120 , "http://registry.gpii.net/common/cursorSpeed": 0.850 , "http://registry.gpii.net/common/cursorAcceleration": 0.800 , - "http://registry.gpii.net/common/mouseEmulationEnabled": true , + "http://registry.gpii.net/common/mouseEmulation/enabled": true , "http://registry.gpii.net/common/flatOnly": true, "http://registry.gpii.net/applications/org.alsa-project": { "volume": 14 diff --git a/gpii/node_modules/preferencesServer/test/data/np_tiny.json b/gpii/node_modules/preferencesServer/test/data/np_tiny.json index 692810819..c40679ca3 100644 --- a/gpii/node_modules/preferencesServer/test/data/np_tiny.json +++ b/gpii/node_modules/preferencesServer/test/data/np_tiny.json @@ -5,7 +5,7 @@ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/onScreenKeyboardEnabled": true + "http://registry.gpii.net/common/onScreenKeyboard/enabled": true }, "metadata": [] } diff --git a/gpii/node_modules/preferencesServer/test/preferencesServerTests.js b/gpii/node_modules/preferencesServer/test/preferencesServerTests.js index 5cec0c0cf..1b3982cc0 100644 --- a/gpii/node_modules/preferencesServer/test/preferencesServerTests.js +++ b/gpii/node_modules/preferencesServer/test/preferencesServerTests.js @@ -148,11 +148,11 @@ gpii.tests.preferencesServer.get.fixtures = [ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/onScreenKeyboardEnabled": true, + "http://registry.gpii.net/common/onScreenKeyboard/enabled": true, "http://registry.gpii.net/common/initDelay": 0.120, "http://registry.gpii.net/common/cursorSpeed": 0.850, "http://registry.gpii.net/common/cursorAcceleration": 0.800, - "http://registry.gpii.net/common/mouseEmulationEnabled": true, + "http://registry.gpii.net/common/mouseEmulation/enabled": true, "http://registry.gpii.net/common/unknown": true, "http://registry.gpii.net/applications/org.alsa-project": { "volume": 14, @@ -186,11 +186,11 @@ gpii.tests.preferencesServer.get.fixtures = [ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/onScreenKeyboardEnabled": true, + "http://registry.gpii.net/common/onScreenKeyboard/enabled": true, "http://registry.gpii.net/common/initDelay": 0.120, "http://registry.gpii.net/common/cursorSpeed": 0.850, "http://registry.gpii.net/common/cursorAcceleration": 0.800, - "http://registry.gpii.net/common/mouseEmulationEnabled": true, + "http://registry.gpii.net/common/mouseEmulation/enabled": true, "http://registry.gpii.net/common/unknown": true, "http://registry.gpii.net/applications/org.alsa-project": { "volume": 14, @@ -224,11 +224,11 @@ gpii.tests.preferencesServer.get.fixtures = [ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/onScreenKeyboardEnabled": true, + "http://registry.gpii.net/common/onScreenKeyboard/enabled": true, "http://registry.gpii.net/common/initDelay": 0.120, "http://registry.gpii.net/common/cursorSpeed": 0.850, "http://registry.gpii.net/common/cursorAcceleration": 0.800, - "http://registry.gpii.net/common/mouseEmulationEnabled": true, + "http://registry.gpii.net/common/mouseEmulation/enabled": true, "http://registry.gpii.net/applications/org.alsa-project": { "volume": 14, "pitch": 100 @@ -264,7 +264,7 @@ gpii.tests.preferencesServer.get.fixtures = [ "cursorSpeed": 0.85, "cursorAcceleration": 0.8, "-provisional-initDelay": 0.12, - "-provisional-mouseEmulationEnabled": true + "-provisional-mouseEmulation/enabled": true } }, "applications": { @@ -307,7 +307,7 @@ gpii.tests.preferencesServer.get.fixtures = [ "name": "Default preferences", "preferences": { "http://registry.gpii.net/common/cursorAcceleration": 0.800, - "http://registry.gpii.net/common/mouseEmulationEnabled": true, + "http://registry.gpii.net/common/mouseEmulation/enabled": true, "http://registry.gpii.net/common/unknown": true, "http://registry.gpii.net/applications/org.alsa-project": { "volume": 14, @@ -360,7 +360,7 @@ gpii.tests.preferencesServer.get.fixtures = [ "control": { "mouseEmulation": { "cursorAcceleration": 0.8, - "-provisional-mouseEmulationEnabled": true + "-provisional-mouseEmulation/enabled": true } }, "applications": { @@ -420,11 +420,11 @@ gpii.tests.preferencesServer.get.fixtures = [ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/onScreenKeyboardEnabled": true, + "http://registry.gpii.net/common/onScreenKeyboard/enabled": true, "http://registry.gpii.net/common/initDelay": 0.120, "http://registry.gpii.net/common/cursorSpeed": 0.850, "http://registry.gpii.net/common/cursorAcceleration": 0.800, - "http://registry.gpii.net/common/mouseEmulationEnabled": true, + "http://registry.gpii.net/common/mouseEmulation/enabled": true, "http://registry.gpii.net/common/flatOnly": true, "http://registry.gpii.net/common/fontSize": 24, "http://registry.gpii.net/applications/org.alsa-project": { @@ -457,9 +457,9 @@ gpii.tests.preferencesServer.get.fixtures = [ "http://registry.gpii.net/common/initDelay": 0.120, "http://registry.gpii.net/common/cursorSpeed": 0.850, "http://registry.gpii.net/common/cursorAcceleration": 0.800, - "http://registry.gpii.net/common/mouseEmulationEnabled": true, + "http://registry.gpii.net/common/mouseEmulation/enabled": true, "http://registry.gpii.net/common/flatOnly": true, - "http://registry.gpii.net/common/onScreenKeyboardEnabled": true, + "http://registry.gpii.net/common/onScreenKeyboard/enabled": true, "http://registry.gpii.net/applications/org.alsa-project": { "volume": 14, "pitch": 100 @@ -521,7 +521,7 @@ gpii.tests.preferencesServer.get.fixtures = [ "cursorSpeed": 0.85, "cursorAcceleration": 0.8, "-provisional-initDelay": 0.12, - "-provisional-mouseEmulationEnabled": true + "-provisional-mouseEmulation/enabled": true } }, "applications": { @@ -586,71 +586,73 @@ gpii.tests.preferencesServer.get.fixtures = [ userToken: "np_ISO24751Only_singleContext_wildcardMetadata", url: "%userToken?view=flat", expected: { - "name": "ISO24751 set", - "contexts": { - "gpii-default": { - "name": "Default preferences", - "preferences": { - "http://registry.gpii.net/common/initDelay": 0.120, - "http://registry.gpii.net/common/cursorSpeed": 0.850, - "http://registry.gpii.net/common/cursorAcceleration": 0.800, - "http://registry.gpii.net/common/mouseEmulationEnabled": true, - "http://registry.gpii.net/common/onScreenKeyboardEnabled": true, - "http://registry.gpii.net/applications/org.alsa-project": { - "volume": 14, - "pitch": 100 - } - }, - "metadata": [{ - "type": "provenance", - "scope": [ - "http://registry\\.gpii\\.net/common/initDelay", - "http://registry\\.gpii\\.net/common/stickyKeys", - "http://registry\\.gpii\\.net/common/cursorSpeed", - "http://registry\\.gpii\\.net/common/speechControl", - "http://registry\\.gpii\\.net/common/hapticFeedback", - "http://registry\\.gpii\\.net/common/slowKeysEnabled", - "http://registry\\.gpii\\.net/common/debounceEnabled", - "http://registry\\.gpii\\.net/common/tableOfContents", - "http://registry\\.gpii\\.net/common/slowKeysInterval", - "http://registry\\.gpii\\.net/common/debounceInterval", - "http://registry\\.gpii\\.net/common/cursorAcceleration", - "http://registry\\.gpii\\.net/common/mouseEmulationEnabled", - "http://registry\\.gpii\\.net/common/onScreenKeyboardEnabled" - ], - "source": "snapshotter" - }] - } + "contexts": { + "gpii-default": { + "name": "Default preferences", + "preferences": { + "http://registry.gpii.net/common/initDelay": 0.12, + "http://registry.gpii.net/common/cursorSpeed": 0.85, + "http://registry.gpii.net/common/cursorAcceleration": 0.8, + "http://registry.gpii.net/common/mouseEmulation/enabled": true, + "http://registry.gpii.net/applications/org.alsa-project": { + "volume": 14, + "pitch": 100 + }, + "http://registry.gpii.net/common/onScreenKeyboard/enabled": true }, "metadata": [ { - "type": "doNotShare", + "type": "provenance", "scope": [ - "http://registry\\.gpii\\.net/common/fontSize", - "http://registry\\.gpii\\.net/common/tracking", - "http://registry\\.gpii\\.net/common/DPIScale", - "http://registry\\.gpii\\.net/common/lineSpace", - "http://registry\\.gpii\\.net/common/cursorSize", - "http://registry\\.gpii\\.net/common/trackingTTS", - "http://registry\\.gpii\\.net/common/invertImages", - "http://registry\\.gpii\\.net/common/magnification", - "http://registry\\.gpii\\.net/common/invertColours", - "http://registry\\.gpii\\.net/common/mouseTrailing", - "http://registry\\.gpii\\.net/common/characterSpace", - "http://registry\\.gpii\\.net/common/highlightColor", - "http://registry\\.gpii\\.net/common/foregroundColor", - "http://registry\\.gpii\\.net/common/backgroundColor", - "http://registry\\.gpii\\.net/common/fontFaceFontName", - "http://registry\\.gpii\\.net/common/magnifierPosition", - "http://registry\\.gpii\\.net/common/highContrastTheme", - "http://registry\\.gpii\\.net/common/inputsLargerEnabled", - "http://registry\\.gpii\\.net/common/highContrastEnabled", - "http://registry\\.gpii\\.net/common/magnification/enabled", - "http://registry\\.gpii\\.net/common/fontFaceGenericFontFace" - ] + "http://registry\\.gpii\\.net/common/initDelay", + "http://registry\\.gpii\\.net/common/stickyKeys", + "http://registry\\.gpii\\.net/common/cursorSpeed", + "http://registry\\.gpii\\.net/common/speechControl", + "http://registry\\.gpii\\.net/common/hapticFeedback", + "http://registry\\.gpii\\.net/common/tableOfContents", + "http://registry\\.gpii\\.net/common/slowKeysInterval", + "http://registry\\.gpii\\.net/common/slowKeys/enabled", + "http://registry\\.gpii\\.net/common/debounce/enabled", + "http://registry\\.gpii\\.net/common/debounceInterval", + "http://registry\\.gpii\\.net/common/cursorAcceleration", + "http://registry\\.gpii\\.net/common/mouseEmulation/enabled", + "http://registry\\.gpii\\.net/common/onScreenKeyboard/enabled" + ], + "source": "snapshotter" } ] } + }, + "name": "ISO24751 set", + "metadata": [ + { + "type": "doNotShare", + "scope": [ + "http://registry\\.gpii\\.net/common/fontSize", + "http://registry\\.gpii\\.net/common/tracking", + "http://registry\\.gpii\\.net/common/DPIScale", + "http://registry\\.gpii\\.net/common/lineSpace", + "http://registry\\.gpii\\.net/common/cursorSize", + "http://registry\\.gpii\\.net/common/trackingTTS", + "http://registry\\.gpii\\.net/common/invertImages", + "http://registry\\.gpii\\.net/common/magnification", + "http://registry\\.gpii\\.net/common/invertColours", + "http://registry\\.gpii\\.net/common/mouseTrailing", + "http://registry\\.gpii\\.net/common/characterSpace", + "http://registry\\.gpii\\.net/common/highlightColor", + "http://registry\\.gpii\\.net/common/foregroundColor", + "http://registry\\.gpii\\.net/common/backgroundColor", + "http://registry\\.gpii\\.net/common/fontFaceFontName", + "http://registry\\.gpii\\.net/common/magnifierPosition", + "http://registry\\.gpii\\.net/common/highContrastTheme", + "http://registry\\.gpii\\.net/common/inputsLarger/enabled", + "http://registry\\.gpii\\.net/common/highContrast/enabled", + "http://registry\\.gpii\\.net/common/magnification/enabled", + "http://registry\\.gpii\\.net/common/fontFaceGenericFontFace" + ] + } + ] +} } ]; @@ -708,11 +710,11 @@ gpii.tests.preferencesServer.post.fixtures = [ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/onScreenKeyboardEnabled": true, + "http://registry.gpii.net/common/onScreenKeyboard/enabled": true, "http://registry.gpii.net/common/initDelay": 0.120, "http://registry.gpii.net/common/cursorSpeed": 0.850, "http://registry.gpii.net/common/cursorAcceleration": 0.800, - "http://registry.gpii.net/common/mouseEmulationEnabled": true, + "http://registry.gpii.net/common/mouseEmulation/enabled": true, "http://registry.gpii.net/common/unknown": true, "http://registry.gpii.net/applications/org.alsa-project": { "volume": 14, @@ -737,11 +739,11 @@ gpii.tests.preferencesServer.post.fixtures = [ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/onScreenKeyboardEnabled": true, + "http://registry.gpii.net/common/onScreenKeyboard/enabled": true, "http://registry.gpii.net/common/initDelay": 0.120, "http://registry.gpii.net/common/cursorSpeed": 0.850, "http://registry.gpii.net/common/cursorAcceleration": 0.800, - "http://registry.gpii.net/common/mouseEmulationEnabled": true, + "http://registry.gpii.net/common/mouseEmulation/enabled": true, "http://registry.gpii.net/common/unknown": true, "http://registry.gpii.net/applications/org.alsa-project": { "volume": 14, @@ -851,7 +853,7 @@ gpii.tests.preferencesServer.put.fixtures = [ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/onScreenKeyboardEnabled": false + "http://registry.gpii.net/common/onScreenKeyboard/enabled": false }, "metadata": [ { @@ -874,7 +876,7 @@ gpii.tests.preferencesServer.put.fixtures = [ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/onScreenKeyboardEnabled": false + "http://registry.gpii.net/common/onScreenKeyboard/enabled": false }, "metadata": [ { @@ -959,10 +961,10 @@ gpii.tests.preferencesServer.put.fixtures = [ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/onScreenKeyboardEnabled": true, + "http://registry.gpii.net/common/onScreenKeyboard/enabled": true, "http://registry.gpii.net/common/initDelay": 0.120, "http://registry.gpii.net/common/cursorAcceleration": 0.800, - "http://registry.gpii.net/common/mouseEmulationEnabled": true, + "http://registry.gpii.net/common/mouseEmulation/enabled": true, "http://registry.gpii.net/common/flatOnly": true, "http://registry.gpii.net/applications/org.alsa-project": { "volume": 14 @@ -1027,11 +1029,11 @@ gpii.tests.preferencesServer.put.fixtures = [ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/onScreenKeyboardEnabled": true, + "http://registry.gpii.net/common/onScreenKeyboard/enabled": true, "http://registry.gpii.net/common/initDelay": 0.120, "http://registry.gpii.net/common/cursorSpeed": 0.850, "http://registry.gpii.net/common/cursorAcceleration": 0.800, - "http://registry.gpii.net/common/mouseEmulationEnabled": true, + "http://registry.gpii.net/common/mouseEmulation/enabled": true, "http://registry.gpii.net/common/flatOnly": true, "http://registry.gpii.net/applications/org.alsa-project": { "volume": 14 @@ -1080,7 +1082,7 @@ gpii.tests.preferencesServer.put.fixtures = [ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/onScreenKeyboardEnabled": true + "http://registry.gpii.net/common/onScreenKeyboard/enabled": true } } } @@ -1091,7 +1093,7 @@ gpii.tests.preferencesServer.put.fixtures = [ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/onScreenKeyboardEnabled": true + "http://registry.gpii.net/common/onScreenKeyboard/enabled": true } } } @@ -1128,7 +1130,7 @@ gpii.tests.preferencesServer.put.fixtures = [ "http://registry.gpii.net/common/initDelay": 0.120, "http://registry.gpii.net/common/cursorSpeed": 0.850, "http://registry.gpii.net/common/cursorAcceleration": 0.800, - "http://registry.gpii.net/common/mouseEmulationEnabled": true, + "http://registry.gpii.net/common/mouseEmulation/enabled": true, "http://registry.gpii.net/common/unknown": true, "http://registry.gpii.net/applications/org.alsa-project": { "volume": 14, diff --git a/gpii/node_modules/rawPreferencesServer/test/RawPreferencesTest.js b/gpii/node_modules/rawPreferencesServer/test/RawPreferencesTest.js index c07aba064..f4ac6de20 100644 --- a/gpii/node_modules/rawPreferencesServer/test/RawPreferencesTest.js +++ b/gpii/node_modules/rawPreferencesServer/test/RawPreferencesTest.js @@ -169,11 +169,11 @@ gpii.tests.rawPreferencesServer.post.fixtures = [ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/onScreenKeyboardEnabled": [{ "value": true }], + "http://registry.gpii.net/common/onScreenKeyboard/enabled": [{ "value": true }], "http://registry.gpii.net/common/initDelay": [{ "value": 0.120 }], "http://registry.gpii.net/common/cursorSpeed": [{ "value": 0.850 }], "http://registry.gpii.net/common/cursorAcceleration": [{ "value": 0.800 }], - "http://registry.gpii.net/common/mouseEmulationEnabled": [{ "value": true }], + "http://registry.gpii.net/common/mouseEmulation/enabled": [{ "value": true }], "http://registry.gpii.net/common/unknown": [{ "value": true }] } } @@ -259,8 +259,8 @@ gpii.tests.rawPreferencesServer.put.fixtures = [ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/onScreenKeyboardEnabled": [{ "value": true }], - "http://registry.gpii.net/common/mouseEmulationEnabled": [{ "value": true }], + "http://registry.gpii.net/common/onScreenKeyboard/enabled": [{ "value": true }], + "http://registry.gpii.net/common/mouseEmulation/enabled": [{ "value": true }], "http://registry.gpii.net/common/unknown": [{ "value": true }] } } @@ -277,11 +277,11 @@ gpii.tests.rawPreferencesServer.put.fixtures = [ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/onScreenKeyboardEnabled": [{ "value": true }], + "http://registry.gpii.net/common/onScreenKeyboard/enabled": [{ "value": true }], "http://registry.gpii.net/common/initDelay": [{ "value": 0.120 }], "http://registry.gpii.net/common/cursorSpeed": [{ "value": 0.850 }], "http://registry.gpii.net/common/cursorAcceleration": [{ "value": 0.800 }], - "http://registry.gpii.net/common/mouseEmulationEnabled": [{ "value": true }], + "http://registry.gpii.net/common/mouseEmulation/enabled": [{ "value": true }], "http://registry.gpii.net/common/unknown": [{ "value": true }] } } diff --git a/gpii/node_modules/transformer/test/js/TransformerTests.js b/gpii/node_modules/transformer/test/js/TransformerTests.js index d90dd046c..e32316c77 100644 --- a/gpii/node_modules/transformer/test/js/TransformerTests.js +++ b/gpii/node_modules/transformer/test/js/TransformerTests.js @@ -155,11 +155,11 @@ fluid.setLogging(true); "careCenter.$t": { "literalValue": 1 }, - "screenReaderTTSEnabled": { - "value": "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" + "screenReaderTTS/enabled": { + "value": "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled" }, - "highContrastEnabled": { - "value": "http://registry\\.gpii\\.net/common/highContrastEnabled" + "highContrast/enabled": { + "value": "http://registry\\.gpii\\.net/common/highContrast/enabled" }, "fontSize": { "value": { diff --git a/testData/ontologies/flat.json5 b/testData/ontologies/flat.json5 index fbb12bbb5..760f1f9bc 100644 --- a/testData/ontologies/flat.json5 +++ b/testData/ontologies/flat.json5 @@ -88,7 +88,7 @@ // TODO: We should present the value to the user in a human readable format. // i.e.: "English (US)" instead of "en-US" or "Mandarin" instead of "zh-cmn" }, - "http://registry.gpii.net/common/screenReaderTTSEnabled": { + "http://registry.gpii.net/common/screenReaderTTS/enabled": { "title": "TTS enabled", "description": "Whether to enable/disable text to speech from screen reader", "type": "boolean", @@ -111,13 +111,13 @@ "max": 1, "divisibleBy": 0.1 }, - "http://registry.gpii.net/common/selfVoicingEnabled": { + "http://registry.gpii.net/common/selfVoicing/enabled": { "title": "Self Voicing", "description": "Whether to enable/disable self voicing", "type": "boolean", "default": false }, - "http://registry.gpii.net/common/highContrastEnabled": { + "http://registry.gpii.net/common/highContrast/enabled": { "title": "High Contrast", "description": "Whether to enable/disable High Contrast", "type": "boolean", @@ -232,13 +232,13 @@ "default": "normal", "enum": ["high", "normal", "low", "very low"] }, - "http://registry.gpii.net/common/onScreenKeyboardEnabled": { + "http://registry.gpii.net/common/onScreenKeyboard/enabled": { "title": "On-Screen keyboard", "description": "Whether to enable/disable the on-screen keyboard", "type": "boolean", "default": "false" }, - "http://registry.gpii.net/common/mouseEmulationEnabled": { + "http://registry.gpii.net/common/mouseEmulation/enabled": { "title": "Mouse emulation", "description": "Whether to enable/disable the mouse emulation", "type": "boolean", @@ -288,19 +288,19 @@ "type": "boolean", "default": "false" }, - "http://registry.gpii.net/common/captionsEnabled": { + "http://registry.gpii.net/common/captions/enabled": { "title": "Captions", "description": "Whether to enable/disable captions on videos", "type": "boolean", "default": "false" }, - "http://registry.gpii.net/common/subtitlesEnabled": { + "http://registry.gpii.net/common/subtitles/enabled": { "title": "Subtitles", "description": "Whether to enable/disable subtitles on videos", "type": "boolean", "default": "false" }, - "http://registry.gpii.net/common/audioDescriptionEnabled": { + "http://registry.gpii.net/common/audioDescription/enabled": { "title": "Audio Description", "description": "Whether to enable/disable audio description on videos", "type": "boolean", diff --git a/testData/ontologies/mappings/ISO24751-flat.json5 b/testData/ontologies/mappings/ISO24751-flat.json5 index d18994224..f7797a834 100644 --- a/testData/ontologies/mappings/ISO24751-flat.json5 +++ b/testData/ontologies/mappings/ISO24751-flat.json5 @@ -2,7 +2,7 @@ "http://registry\\.gpii\\.net/common/fontSize": "display.screenEnhancement.fontSize", "http://registry\\.gpii\\.net/common/lineSpace": "display.screenEnhancement.-provisional-lineSpace", "http://registry\\.gpii\\.net/common/characterSpace": "display.screenEnhancement.-provisional-characterSpace", - "http://registry\\.gpii\\.net/common/inputsLargerEnabled": "display.screenEnhancement.-provisional-inputsLargerEnabled", + "http://registry\\.gpii\\.net/common/inputsLarger/enabled": "display.screenEnhancement.-provisional-inputsLarger/enabled", "http://registry\\.gpii\\.net/common/foregroundColor": "display.screenEnhancement.foregroundColor", "http://registry\\.gpii\\.net/common/backgroundColor": "display.screenEnhancement.backgroundColor", "http://registry\\.gpii\\.net/common/highlightColor": "display.screenEnhancement.highlightColor", @@ -16,7 +16,7 @@ "http://registry\\.gpii\\.net/common/invertImages": "display.screenEnhancement.invertImages", "http://registry\\.gpii\\.net/common/invertColours": "display.screenEnhancement.-provisional-invertColours", "http://registry\\.gpii\\.net/common/cursorSize": "display.screenEnhancement.cursorSize", - "http://registry\\.gpii\\.net/common/highContrastEnabled": "display.screenEnhancement.-provisional-highContrastEnabled", + "http://registry\\.gpii\\.net/common/highContrast/enabled": "display.screenEnhancement.-provisional-highContrast/enabled", "http://registry\\.gpii\\.net/common/highContrastTheme": "display.screenEnhancement.-provisional-highContrastTheme", "http://registry\\.gpii\\.net/common/mouseTrailing": "display.screenEnhancement.mouseTrailing", "http://registry\\.gpii\\.net/common/screenReaderBrailleOutput": "display.screenReader.-provisional-screenReaderBrailleOutput", @@ -27,32 +27,32 @@ "http://registry\\.gpii\\.net/common/wordEcho": "display.screenReader.-provisional-wordEcho", "http://registry\\.gpii\\.net/common/announceCapitals": "display.screenReader.-provisional-announceCapitals", "http://registry\\.gpii\\.net/common/punctuationVerbosity": "display.screenReader.-provisional-punctuationVerbosity", - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled": "display.screenReader.-provisional-screenReaderTTSEnabled", + "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled": "display.screenReader.-provisional-screenReaderTTS/enabled", "http://registry\\.gpii\\.net/common/pitch": "display.textReadingHighlight.pitch", "http://registry\\.gpii\\.net/common/readingUnit": "display.textReadingHighlight.readingUnit", "http://registry\\.gpii\\.net/common/volumeTTS": "display.textReadingHighlight.-provisional-volumeTTS", - "http://registry\\.gpii\\.net/common/selfVoicingEnabled": "display.textReadingHighlight.-provisional-selfVoicingEnabled", + "http://registry\\.gpii\\.net/common/selfVoicing/enabled": "display.textReadingHighlight.-provisional-selfVoicing/enabled", "http://registry\\.gpii\\.net/common/brailleMode": "display.braille.-provisional-brailleMode", "http://registry\\.gpii\\.net/common/screenOffTime": "display.-provisional-screenOffTime", "http://registry\\.gpii\\.net/common/screenRotation": "display.-provisional-screenRotation", "http://registry\\.gpii\\.net/common/screenDefaultRotation": "display.-provisional-screenDefaultRotation", "http://registry\\.gpii\\.net/common/screenDim": "display.-provisional-screenDim", - "http://registry\\.gpii\\.net/common/onScreenKeyboardEnabled": "control.onscreenKeyboard", + "http://registry\\.gpii\\.net/common/onScreenKeyboard/enabled": "control.onscreenKeyboard", "http://registry\\.gpii\\.net/common/initDelay": "control.mouseEmulation.-provisional-initDelay", "http://registry\\.gpii\\.net/common/cursorSpeed": "control.mouseEmulation.cursorSpeed", "http://registry\\.gpii\\.net/common/cursorAcceleration": "control.mouseEmulation.cursorAcceleration", - "http://registry\\.gpii\\.net/common/mouseEmulationEnabled": "control.mouseEmulation.-provisional-mouseEmulationEnabled", + "http://registry\\.gpii\\.net/common/mouseEmulation/enabled": "control.mouseEmulation.-provisional-mouseEmulation/enabled", "http://registry\\.gpii\\.net/common/stickyKeys": "control.keyboardEnhancement.stickyKeys", "http://registry\\.gpii\\.net/common/slowKeysInterval": "control.keyboardEnhancement.slowKeys.slowKeysInterval", - "http://registry\\.gpii\\.net/common/slowKeysEnabled": "control.keyboardEnhancement.slowKeys.-provisional-slowKeysEnabled", - "http://registry\\.gpii\\.net/common/debounceEnabled": "control.keyboardEnhancement.debounceKeys.-provisional-debounceEnabled", + "http://registry\\.gpii\\.net/common/slowKeys/enabled": "control.keyboardEnhancement.slowKeys.-provisional-slowKeys/enabled", + "http://registry\\.gpii\\.net/common/debounce/enabled": "control.keyboardEnhancement.debounceKeys.-provisional-debounce/enabled", "http://registry\\.gpii\\.net/common/debounceInterval": "control.keyboardEnhancement.debounceKeys.debounceInterval", "http://registry\\.gpii\\.net/common/hapticFeedback": "control.-provisional-hapticFeedback", "http://registry\\.gpii\\.net/common/tableOfContents": "control.structuralNavigation.tableOfContents", "http://registry\\.gpii\\.net/common/adaptationPreference": "content.adaptationPreference", "http://registry\\.gpii\\.net/common/supportTool": "content.supportTool", - "http://registry\\.gpii\\.net/common/simplifiedUiEnabled": "-provisional-cognitiveSupport.-provisional-simplifiedUiEnabled", - "http://registry\\.gpii\\.net/common/syllabificationEnabled": "-provisional-cognitiveSupport.-provisional-syllabificationEnabled", + "http://registry\\.gpii\\.net/common/simplifiedUi/enabled": "-provisional-cognitiveSupport.-provisional-simplifiedUi/enabled", + "http://registry\\.gpii\\.net/common/syllabification/enabled": "-provisional-cognitiveSupport.-provisional-syllabification/enabled", "http://registry\\.gpii\\.net/common/volume": "-provisional-general.-provisional-volume", "http://registry\\.gpii\\.net/common/language": "language", "http://registry\\.gpii\\.net/common/DPIScale": "display.screenEnhancement.-provisional-DPIScale", diff --git a/testData/ontologies/mappings/flat-apptology.json5 b/testData/ontologies/mappings/flat-apptology.json5 index dd36c89e1..1b1d086ba 100644 --- a/testData/ontologies/mappings/flat-apptology.json5 +++ b/testData/ontologies/mappings/flat-apptology.json5 @@ -10,9 +10,9 @@ "outputPath": "http://registry\\.gpii\\.net/common/magnifierApplication" } ], - "http://registry\\.gpii\\.net/common/screenReaderApplication": "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled", + "http://registry\\.gpii\\.net/common/screenReaderApplication": "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled", "http://registry\\.gpii\\.net/common/stickyKeysApplication": "http://registry\\.gpii\\.net/common/stickyKeys", - "http://registry\\.gpii\\.net/common/slowKeysApplication": "http://registry\\.gpii\\.net/common/slowKeysEnabled", - "http://registry\\.gpii\\.net/common/debounceKeysApplication": "http://registry\\.gpii\\.net/common/debounceEnabled", - "http://registry\\.gpii\\.net/common/onScreenKeyboardApplication": "http://registry\\.gpii\\.net/common/onScreenKeyboardEnabled" + "http://registry\\.gpii\\.net/common/slowKeysApplication": "http://registry\\.gpii\\.net/common/slowKeys/enabled", + "http://registry\\.gpii\\.net/common/debounceKeysApplication": "http://registry\\.gpii\\.net/common/debounce/enabled", + "http://registry\\.gpii\\.net/common/onScreenKeyboardApplication": "http://registry\\.gpii\\.net/common/onScreenKeyboard/enabled" } \ No newline at end of file diff --git a/testData/preferences/GPII-270-rbmm-demo.json b/testData/preferences/GPII-270-rbmm-demo.json index 2c9977f9d..80601226f 100644 --- a/testData/preferences/GPII-270-rbmm-demo.json +++ b/testData/preferences/GPII-270-rbmm-demo.json @@ -23,7 +23,7 @@ "http://registry.gpii.net/common/punctuationVerbosity": "some", "http://registry.gpii.net/common/readingUnit": "word", "http://registry.gpii.net/common/auditoryOutLanguage": "GR", - "http://registry.gpii.net/common/screenReaderTTSEnabled": true, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, "http://registry.gpii.net/common/pitch": 0.4, "http://registry.gpii.net/common/volumeTTS": 0.5, diff --git a/testData/preferences/MikelVargas.json b/testData/preferences/MikelVargas.json index 8d5a45862..5b7c73873 100644 --- a/testData/preferences/MikelVargas.json +++ b/testData/preferences/MikelVargas.json @@ -5,15 +5,15 @@ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/onScreenKeyboardEnabled": true, + "http://registry.gpii.net/common/onScreenKeyboard/enabled": true, "http://registry.gpii.net/common/initDelay": 0.120, "http://registry.gpii.net/common/cursorSpeed": 0.850, "http://registry.gpii.net/common/cursorAcceleration": 0.800, - "http://registry.gpii.net/common/mouseEmulationEnabled": true, + "http://registry.gpii.net/common/mouseEmulation/enabled": true, "http://registry.gpii.net/common/stickyKeys": true, - "http://registry.gpii.net/common/slowKeysEnabled": true, + "http://registry.gpii.net/common/slowKeys/enabled": true, "http://registry.gpii.net/common/slowKeysInterval": 0.4, - "http://registry.gpii.net/common/debounceEnabled": true, + "http://registry.gpii.net/common/debounce/enabled": true, "http://registry.gpii.net/common/debounceInterval": 0.20 } } diff --git a/testData/preferences/acceptanceTests/chrome_font_size.json b/testData/preferences/acceptanceTests/chrome_font_size.json index 1cfeb8ac9..d8b5cb244 100644 --- a/testData/preferences/acceptanceTests/chrome_font_size.json +++ b/testData/preferences/acceptanceTests/chrome_font_size.json @@ -5,10 +5,10 @@ "name": "Default preferences", "preferences": { "http://registry.gpii.net/common/fontSize": 16, - "http://registry.gpii.net/common/screenReaderTTSEnabled": false, + "http://registry.gpii.net/common/screenReaderTTS/enabled": false, "http://registry.gpii.net/common/magnification/enabled": false, "http://registry.gpii.net/common/magnification": 1, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/invertColours": false } } diff --git a/testData/preferences/acceptanceTests/chrome_high_contrast.json b/testData/preferences/acceptanceTests/chrome_high_contrast.json index 7ff143633..2d7a3452d 100644 --- a/testData/preferences/acceptanceTests/chrome_high_contrast.json +++ b/testData/preferences/acceptanceTests/chrome_high_contrast.json @@ -5,10 +5,10 @@ "name": "Default preferences", "preferences": { "http://registry.gpii.net/common/fontSize": 12, - "http://registry.gpii.net/common/screenReaderTTSEnabled": false, + "http://registry.gpii.net/common/screenReaderTTS/enabled": false, "http://registry.gpii.net/common/magnification/enabled": false, "http://registry.gpii.net/common/magnification": 1, - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black", "http://registry.gpii.net/common/invertColours": false } diff --git a/testData/preferences/acceptanceTests/chrome_magnification.json b/testData/preferences/acceptanceTests/chrome_magnification.json index 6f70bc1a6..aeff7d679 100644 --- a/testData/preferences/acceptanceTests/chrome_magnification.json +++ b/testData/preferences/acceptanceTests/chrome_magnification.json @@ -5,10 +5,10 @@ "name": "Default preferences", "preferences": { "http://registry.gpii.net/common/fontSize": 12, - "http://registry.gpii.net/common/screenReaderTTSEnabled": false, + "http://registry.gpii.net/common/screenReaderTTS/enabled": false, "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 1.5, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/invertColours": false } } diff --git a/testData/preferences/acceptanceTests/fm_gnome_keyboard.json b/testData/preferences/acceptanceTests/fm_gnome_keyboard.json index 6805d1e6f..7d3133fdf 100644 --- a/testData/preferences/acceptanceTests/fm_gnome_keyboard.json +++ b/testData/preferences/acceptanceTests/fm_gnome_keyboard.json @@ -4,15 +4,15 @@ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/onScreenKeyboardEnabled": true, + "http://registry.gpii.net/common/onScreenKeyboard/enabled": true, "http://registry.gpii.net/common/initDelay": 0.120, "http://registry.gpii.net/common/cursorSpeed": 0.850, "http://registry.gpii.net/common/cursorAcceleration": 0.800, - "http://registry.gpii.net/common/mouseEmulationEnabled": true, + "http://registry.gpii.net/common/mouseEmulation/enabled": true, "http://registry.gpii.net/common/stickyKeys": true, - "http://registry.gpii.net/common/slowKeysEnabled": true, + "http://registry.gpii.net/common/slowKeys/enabled": true, "http://registry.gpii.net/common/slowKeysInterval": 0.4, - "http://registry.gpii.net/common/debounceEnabled": true, + "http://registry.gpii.net/common/debounce/enabled": true, "http://registry.gpii.net/common/debounceInterval": 0.20 } } diff --git a/testData/preferences/acceptanceTests/maavis_highcontrast.json b/testData/preferences/acceptanceTests/maavis_highcontrast.json index e0c5f4582..6dde61761 100644 --- a/testData/preferences/acceptanceTests/maavis_highcontrast.json +++ b/testData/preferences/acceptanceTests/maavis_highcontrast.json @@ -4,7 +4,7 @@ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "yellow-black" } } diff --git a/testData/preferences/acceptanceTests/maavis_selfvoicing.json b/testData/preferences/acceptanceTests/maavis_selfvoicing.json index a042e7d24..c14336a29 100644 --- a/testData/preferences/acceptanceTests/maavis_selfvoicing.json +++ b/testData/preferences/acceptanceTests/maavis_selfvoicing.json @@ -4,7 +4,7 @@ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/selfVoicingEnabled": true + "http://registry.gpii.net/common/selfVoicing/enabled": true } } } diff --git a/testData/preferences/acceptanceTests/olb_Alicia_cmn.json b/testData/preferences/acceptanceTests/olb_Alicia_cmn.json index 4c943790e..5c1e6743c 100644 --- a/testData/preferences/acceptanceTests/olb_Alicia_cmn.json +++ b/testData/preferences/acceptanceTests/olb_Alicia_cmn.json @@ -5,9 +5,9 @@ "name": "Default preferences", "preferences": { "http://registry.gpii.net/common/language": "en-GB", - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black", - "http://registry.gpii.net/common/simplifiedUiEnabled": true + "http://registry.gpii.net/common/simplifiedUi/enabled": true } } } diff --git a/testData/preferences/acceptanceTests/olb_Carla.json b/testData/preferences/acceptanceTests/olb_Carla.json index fcb3447f1..442d20836 100644 --- a/testData/preferences/acceptanceTests/olb_Carla.json +++ b/testData/preferences/acceptanceTests/olb_Carla.json @@ -7,9 +7,9 @@ "http://registry.gpii.net/common/language": "en-GB", "http://registry.gpii.net/common/fontSize": 24, "http://registry.gpii.net/common/linkAdaptation": "emphasizeLinks", - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black", - "http://registry.gpii.net/common/signLanguageEnabled": false, + "http://registry.gpii.net/common/signLanguage/enabled": false, "http://registry.gpii.net/applications/eu.gpii.olb": { "lineSpacing": 2, "inputsLarger": true diff --git a/testData/preferences/acceptanceTests/olb_KimCallahan.json b/testData/preferences/acceptanceTests/olb_KimCallahan.json index 9e7731769..a8ac9ecdd 100644 --- a/testData/preferences/acceptanceTests/olb_KimCallahan.json +++ b/testData/preferences/acceptanceTests/olb_KimCallahan.json @@ -5,7 +5,7 @@ "name": "Default preferences", "preferences": { "http://registry.gpii.net/common/language": "en-US", - "http://registry.gpii.net/common/signLanguageEnabled": true, + "http://registry.gpii.net/common/signLanguage/enabled": true, "http://registry.gpii.net/common/signLanguage": "ase", "http://registry.gpii.net/common/signLanguageInterpreterType": "avatar", "http://registry.gpii.net/applications/eu.gpii.olb": { diff --git a/testData/preferences/acceptanceTests/olb_Lara.json b/testData/preferences/acceptanceTests/olb_Lara.json index d79dea92d..bf4f9db3b 100644 --- a/testData/preferences/acceptanceTests/olb_Lara.json +++ b/testData/preferences/acceptanceTests/olb_Lara.json @@ -5,7 +5,7 @@ "name": "Default preferences", "preferences": { "http://registry.gpii.net/common/language": "de-DE", - "http://registry.gpii.net/common/signLanguageEnabled": true, + "http://registry.gpii.net/common/signLanguage/enabled": true, "http://registry.gpii.net/common/signLanguage": "gsg", "http://registry.gpii.net/common/signLanguageInterpreterType": "human", "http://registry.gpii.net/applications/eu.gpii.olb": { diff --git a/testData/preferences/acceptanceTests/olb_QinKesheng.json b/testData/preferences/acceptanceTests/olb_QinKesheng.json index be951574d..ea8fe83be 100644 --- a/testData/preferences/acceptanceTests/olb_QinKesheng.json +++ b/testData/preferences/acceptanceTests/olb_QinKesheng.json @@ -5,7 +5,7 @@ "name": "Default preferences", "preferences": { "http://registry.gpii.net/common/language": "zho", - "http://registry.gpii.net/common/signLanguageEnabled": true, + "http://registry.gpii.net/common/signLanguage/enabled": true, "http://registry.gpii.net/common/signLanguage": "csl", "http://registry.gpii.net/common/signLanguageInterpreterType": "avatar" } diff --git a/testData/preferences/acceptanceTests/os_common.json b/testData/preferences/acceptanceTests/os_common.json index fc3f21153..a3bf53e72 100644 --- a/testData/preferences/acceptanceTests/os_common.json +++ b/testData/preferences/acceptanceTests/os_common.json @@ -11,14 +11,14 @@ "http://registry.gpii.net/common/cursorSize": 0.9, "http://registry.gpii.net/common/fontSize": 9, "http://registry.gpii.net/common/mouseTrailing": 10, - "http://registry.gpii.net/common/highContrastEnabled": true, - "http://registry.gpii.net/common/mouseEmulationEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, + "http://registry.gpii.net/common/mouseEmulation/enabled": true, "http://registry.gpii.net/common/cursorAcceleration": 1, "http://registry.gpii.net/common/cursorSpeed": 1, "http://registry.gpii.net/common/stickyKeys": true, "http://registry.gpii.net/common/debounceEnable": true, "http://registry.gpii.net/common/debounceInterval": 1, - "http://registry.gpii.net/common/onScreenKeyboardEnabled": true + "http://registry.gpii.net/common/onScreenKeyboard/enabled": true } } } diff --git a/testData/preferences/acceptanceTests/os_common2.json b/testData/preferences/acceptanceTests/os_common2.json index 378dbae51..3a910e0bd 100644 --- a/testData/preferences/acceptanceTests/os_common2.json +++ b/testData/preferences/acceptanceTests/os_common2.json @@ -4,7 +4,7 @@ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/highContrastEnabled": false + "http://registry.gpii.net/common/highContrast/enabled": false } } } diff --git a/testData/preferences/acceptanceTests/os_common2.txt b/testData/preferences/acceptanceTests/os_common2.txt index 2a0ad106b..ee30fbab2 100644 --- a/testData/preferences/acceptanceTests/os_common2.txt +++ b/testData/preferences/acceptanceTests/os_common2.txt @@ -1,7 +1,7 @@ os_common2.json =============== -This NP set is used to check the behaviour under GNU/Linux when highContrastEnabled is set to false. +This NP set is used to check the behaviour under GNU/Linux when highContrast/enabled is set to false. When logging in with this NP set, GNOME should use its default values for gtk-theme and icon-theme. So if you want to see this in action: diff --git a/testData/preferences/acceptanceTests/screenreader_common.json b/testData/preferences/acceptanceTests/screenreader_common.json index 2455b703b..9246a037c 100644 --- a/testData/preferences/acceptanceTests/screenreader_common.json +++ b/testData/preferences/acceptanceTests/screenreader_common.json @@ -10,7 +10,7 @@ "http://registry.gpii.net/common/announceCapitals": true , "http://registry.gpii.net/common/readingUnit": "word" , "http://registry.gpii.net/common/punctuationVerbosity": "all" , - "http://registry.gpii.net/common/screenReaderTTSEnabled": true , + "http://registry.gpii.net/common/screenReaderTTS/enabled": true , "http://registry.gpii.net/common/trackingTTS": ["mouse", "caret"], "http://registry.gpii.net/common/speechRate": 400 , "http://registry.gpii.net/common/auditoryOutLanguage": "en-BS", diff --git a/testData/preferences/acceptanceTests/tvm_lara.json b/testData/preferences/acceptanceTests/tvm_lara.json index 97e8071cd..4befc46e9 100644 --- a/testData/preferences/acceptanceTests/tvm_lara.json +++ b/testData/preferences/acceptanceTests/tvm_lara.json @@ -5,7 +5,7 @@ "name": "Default preferences", "preferences": { "http://registry.gpii.net/common/language": "el", - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black", "http://registry.gpii.net/common/fontSize": 24, "http://registry.gpii.net/common/sessionTimeout": 60 diff --git a/testData/preferences/acceptanceTests/uioPlus_character_space.json b/testData/preferences/acceptanceTests/uioPlus_character_space.json index 2b54a94a7..5f263d51b 100644 --- a/testData/preferences/acceptanceTests/uioPlus_character_space.json +++ b/testData/preferences/acceptanceTests/uioPlus_character_space.json @@ -7,14 +7,14 @@ "http://registry.gpii.net/common/lineSpace": 1, "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/characterSpace": 1, - "http://registry.gpii.net/common/selfVoicingEnabled": false, - "http://registry.gpii.net/common/inputsLargerEnabled": false, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/selfVoicing/enabled": false, + "http://registry.gpii.net/common/inputsLarger/enabled": false, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/highlightColor": "default", "http://registry.gpii.net/common/tableOfContents": false, "http://registry.gpii.net/common/supportTool": [], - "http://registry.gpii.net/common/simplifiedUiEnabled": false, - "http://registry.gpii.net/common/syllabificationEnabled": false + "http://registry.gpii.net/common/simplifiedUi/enabled": false, + "http://registry.gpii.net/common/syllabification/enabled": false } } } diff --git a/testData/preferences/acceptanceTests/uioPlus_defaults.json b/testData/preferences/acceptanceTests/uioPlus_defaults.json index e7e4d2b69..ba1b096a7 100644 --- a/testData/preferences/acceptanceTests/uioPlus_defaults.json +++ b/testData/preferences/acceptanceTests/uioPlus_defaults.json @@ -7,14 +7,14 @@ "http://registry.gpii.net/common/lineSpace": 1, "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/characterSpace": 0, - "http://registry.gpii.net/common/selfVoicingEnabled": false, - "http://registry.gpii.net/common/inputsLargerEnabled": false, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/selfVoicing/enabled": false, + "http://registry.gpii.net/common/inputsLarger/enabled": false, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/highlightColor": "default", "http://registry.gpii.net/common/tableOfContents": false, "http://registry.gpii.net/common/supportTool": [], - "http://registry.gpii.net/common/simplifiedUiEnabled": false, - "http://registry.gpii.net/common/syllabificationEnabled": false + "http://registry.gpii.net/common/simplifiedUi/enabled": false, + "http://registry.gpii.net/common/syllabification/enabled": false } } } diff --git a/testData/preferences/acceptanceTests/uioPlus_font_size.json b/testData/preferences/acceptanceTests/uioPlus_font_size.json index 9356f7cf3..5b666aa9d 100644 --- a/testData/preferences/acceptanceTests/uioPlus_font_size.json +++ b/testData/preferences/acceptanceTests/uioPlus_font_size.json @@ -7,14 +7,14 @@ "http://registry.gpii.net/common/lineSpace": 1, "http://registry.gpii.net/common/fontSize": 24, "http://registry.gpii.net/common/characterSpace": 0, - "http://registry.gpii.net/common/selfVoicingEnabled": false, - "http://registry.gpii.net/common/inputsLargerEnabled": false, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/selfVoicing/enabled": false, + "http://registry.gpii.net/common/inputsLarger/enabled": false, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/highlightColor": "default", "http://registry.gpii.net/common/tableOfContents": false, "http://registry.gpii.net/common/supportTool": [], - "http://registry.gpii.net/common/simplifiedUiEnabled": false, - "http://registry.gpii.net/common/syllabificationEnabled": false + "http://registry.gpii.net/common/simplifiedUi/enabled": false, + "http://registry.gpii.net/common/syllabification/enabled": false } } } diff --git a/testData/preferences/acceptanceTests/uioPlus_high_contrast.json b/testData/preferences/acceptanceTests/uioPlus_high_contrast.json index 3e229da55..dda680380 100644 --- a/testData/preferences/acceptanceTests/uioPlus_high_contrast.json +++ b/testData/preferences/acceptanceTests/uioPlus_high_contrast.json @@ -7,15 +7,15 @@ "http://registry.gpii.net/common/lineSpace": 1, "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/characterSpace": 0, - "http://registry.gpii.net/common/selfVoicingEnabled": false, - "http://registry.gpii.net/common/inputsLargerEnabled": false, - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/selfVoicing/enabled": false, + "http://registry.gpii.net/common/inputsLarger/enabled": false, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black", "http://registry.gpii.net/common/highlightColor": "default", "http://registry.gpii.net/common/tableOfContents": false, "http://registry.gpii.net/common/supportTool": [], - "http://registry.gpii.net/common/simplifiedUiEnabled": false, - "http://registry.gpii.net/common/syllabificationEnabled": false + "http://registry.gpii.net/common/simplifiedUi/enabled": false, + "http://registry.gpii.net/common/syllabification/enabled": false } } } diff --git a/testData/preferences/acceptanceTests/uioPlus_highlight_colour.json b/testData/preferences/acceptanceTests/uioPlus_highlight_colour.json index 677c28e92..8c97751fc 100644 --- a/testData/preferences/acceptanceTests/uioPlus_highlight_colour.json +++ b/testData/preferences/acceptanceTests/uioPlus_highlight_colour.json @@ -7,14 +7,14 @@ "http://registry.gpii.net/common/lineSpace": 1, "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/characterSpace": 0, - "http://registry.gpii.net/common/selfVoicingEnabled": false, - "http://registry.gpii.net/common/inputsLargerEnabled": false, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/selfVoicing/enabled": false, + "http://registry.gpii.net/common/inputsLarger/enabled": false, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/highlightColor": "yellow", "http://registry.gpii.net/common/tableOfContents": false, "http://registry.gpii.net/common/supportTool": [], - "http://registry.gpii.net/common/simplifiedUiEnabled": false, - "http://registry.gpii.net/common/syllabificationEnabled": false + "http://registry.gpii.net/common/simplifiedUi/enabled": false, + "http://registry.gpii.net/common/syllabification/enabled": false } } } diff --git a/testData/preferences/acceptanceTests/uioPlus_inputs_larger.json b/testData/preferences/acceptanceTests/uioPlus_inputs_larger.json index f08c1dab1..53d086544 100644 --- a/testData/preferences/acceptanceTests/uioPlus_inputs_larger.json +++ b/testData/preferences/acceptanceTests/uioPlus_inputs_larger.json @@ -7,14 +7,14 @@ "http://registry.gpii.net/common/lineSpace": 1, "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/characterSpace": 0, - "http://registry.gpii.net/common/selfVoicingEnabled": false, - "http://registry.gpii.net/common/inputsLargerEnabled": true, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/selfVoicing/enabled": false, + "http://registry.gpii.net/common/inputsLarger/enabled": true, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/highlightColor": "default", "http://registry.gpii.net/common/tableOfContents": false, "http://registry.gpii.net/common/supportTool": [], - "http://registry.gpii.net/common/simplifiedUiEnabled": false, - "http://registry.gpii.net/common/syllabificationEnabled": false + "http://registry.gpii.net/common/simplifiedUi/enabled": false, + "http://registry.gpii.net/common/syllabification/enabled": false } } } diff --git a/testData/preferences/acceptanceTests/uioPlus_line_space.json b/testData/preferences/acceptanceTests/uioPlus_line_space.json index 1e7edb6b0..2415297bf 100644 --- a/testData/preferences/acceptanceTests/uioPlus_line_space.json +++ b/testData/preferences/acceptanceTests/uioPlus_line_space.json @@ -7,14 +7,14 @@ "http://registry.gpii.net/common/lineSpace": 2, "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/characterSpace": 0, - "http://registry.gpii.net/common/selfVoicingEnabled": false, - "http://registry.gpii.net/common/inputsLargerEnabled": false, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/selfVoicing/enabled": false, + "http://registry.gpii.net/common/inputsLarger/enabled": false, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/highlightColor": "default", "http://registry.gpii.net/common/tableOfContents": false, "http://registry.gpii.net/common/supportTool": [], - "http://registry.gpii.net/common/simplifiedUiEnabled": false, - "http://registry.gpii.net/common/syllabificationEnabled": false + "http://registry.gpii.net/common/simplifiedUi/enabled": false, + "http://registry.gpii.net/common/syllabification/enabled": false } } } diff --git a/testData/preferences/acceptanceTests/uioPlus_multiple_settings.json b/testData/preferences/acceptanceTests/uioPlus_multiple_settings.json index ee3406cb3..cc9720baa 100644 --- a/testData/preferences/acceptanceTests/uioPlus_multiple_settings.json +++ b/testData/preferences/acceptanceTests/uioPlus_multiple_settings.json @@ -7,15 +7,15 @@ "http://registry.gpii.net/common/lineSpace": 1.3, "http://registry.gpii.net/common/fontSize": 16, "http://registry.gpii.net/common/characterSpace": 2, - "http://registry.gpii.net/common/selfVoicingEnabled": true, - "http://registry.gpii.net/common/inputsLargerEnabled": true, - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/selfVoicing/enabled": true, + "http://registry.gpii.net/common/inputsLarger/enabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "yellow-black", "http://registry.gpii.net/common/highlightColor": "green", "http://registry.gpii.net/common/tableOfContents": true, "http://registry.gpii.net/common/supportTool": ["dictionary"], - "http://registry.gpii.net/common/simplifiedUiEnabled": true, - "http://registry.gpii.net/common/syllabificationEnabled": true + "http://registry.gpii.net/common/simplifiedUi/enabled": true, + "http://registry.gpii.net/common/syllabification/enabled": true } } } diff --git a/testData/preferences/acceptanceTests/uioPlus_multiple_support_tool.json b/testData/preferences/acceptanceTests/uioPlus_multiple_support_tool.json index 80d345cb4..f5a1b74ff 100644 --- a/testData/preferences/acceptanceTests/uioPlus_multiple_support_tool.json +++ b/testData/preferences/acceptanceTests/uioPlus_multiple_support_tool.json @@ -7,14 +7,14 @@ "http://registry.gpii.net/common/lineSpace": 1, "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/characterSpace": 0, - "http://registry.gpii.net/common/selfVoicingEnabled": false, - "http://registry.gpii.net/common/inputsLargerEnabled": false, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/selfVoicing/enabled": false, + "http://registry.gpii.net/common/inputsLarger/enabled": false, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/highlightColor": "default", "http://registry.gpii.net/common/tableOfContents": false, "http://registry.gpii.net/common/supportTool": ["dictionary", "thesaurus"], - "http://registry.gpii.net/common/simplifiedUiEnabled": false, - "http://registry.gpii.net/common/syllabificationEnabled": false + "http://registry.gpii.net/common/simplifiedUi/enabled": false, + "http://registry.gpii.net/common/syllabification/enabled": false } } } diff --git a/testData/preferences/acceptanceTests/uioPlus_self_voicing.json b/testData/preferences/acceptanceTests/uioPlus_self_voicing.json index 707aad3e9..41979fe7b 100644 --- a/testData/preferences/acceptanceTests/uioPlus_self_voicing.json +++ b/testData/preferences/acceptanceTests/uioPlus_self_voicing.json @@ -7,14 +7,14 @@ "http://registry.gpii.net/common/lineSpace": 1, "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/characterSpace": 0, - "http://registry.gpii.net/common/selfVoicingEnabled": true, - "http://registry.gpii.net/common/inputsLargerEnabled": false, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/selfVoicing/enabled": true, + "http://registry.gpii.net/common/inputsLarger/enabled": false, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/highlightColor": "default", "http://registry.gpii.net/common/tableOfContents": false, "http://registry.gpii.net/common/supportTool": [], - "http://registry.gpii.net/common/simplifiedUiEnabled": false, - "http://registry.gpii.net/common/syllabificationEnabled": false + "http://registry.gpii.net/common/simplifiedUi/enabled": false, + "http://registry.gpii.net/common/syllabification/enabled": false } } } diff --git a/testData/preferences/acceptanceTests/uioPlus_simplified.json b/testData/preferences/acceptanceTests/uioPlus_simplified.json index c1c11cc6f..500d329f8 100644 --- a/testData/preferences/acceptanceTests/uioPlus_simplified.json +++ b/testData/preferences/acceptanceTests/uioPlus_simplified.json @@ -7,14 +7,14 @@ "http://registry.gpii.net/common/lineSpace": 1, "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/characterSpace": 0, - "http://registry.gpii.net/common/selfVoicingEnabled": false, - "http://registry.gpii.net/common/inputsLargerEnabled": false, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/selfVoicing/enabled": false, + "http://registry.gpii.net/common/inputsLarger/enabled": false, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/highlightColor": "default", "http://registry.gpii.net/common/tableOfContents": false, "http://registry.gpii.net/common/supportTool": [], - "http://registry.gpii.net/common/simplifiedUiEnabled": true, - "http://registry.gpii.net/common/syllabificationEnabled": false + "http://registry.gpii.net/common/simplifiedUi/enabled": true, + "http://registry.gpii.net/common/syllabification/enabled": false } } } diff --git a/testData/preferences/acceptanceTests/uioPlus_support_tool.json b/testData/preferences/acceptanceTests/uioPlus_support_tool.json index 048cc213f..02dd218fe 100644 --- a/testData/preferences/acceptanceTests/uioPlus_support_tool.json +++ b/testData/preferences/acceptanceTests/uioPlus_support_tool.json @@ -7,14 +7,14 @@ "http://registry.gpii.net/common/lineSpace": 1, "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/characterSpace": 0, - "http://registry.gpii.net/common/selfVoicingEnabled": false, - "http://registry.gpii.net/common/inputsLargerEnabled": false, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/selfVoicing/enabled": false, + "http://registry.gpii.net/common/inputsLarger/enabled": false, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/highlightColor": "default", "http://registry.gpii.net/common/tableOfContents": false, "http://registry.gpii.net/common/supportTool": ["dictionary"], - "http://registry.gpii.net/common/simplifiedUiEnabled": false, - "http://registry.gpii.net/common/syllabificationEnabled": false + "http://registry.gpii.net/common/simplifiedUi/enabled": false, + "http://registry.gpii.net/common/syllabification/enabled": false } } } diff --git a/testData/preferences/acceptanceTests/uioPlus_syllabification.json b/testData/preferences/acceptanceTests/uioPlus_syllabification.json index edd27c201..291fa9fdb 100644 --- a/testData/preferences/acceptanceTests/uioPlus_syllabification.json +++ b/testData/preferences/acceptanceTests/uioPlus_syllabification.json @@ -7,14 +7,14 @@ "http://registry.gpii.net/common/lineSpace": 1, "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/characterSpace": 0, - "http://registry.gpii.net/common/selfVoicingEnabled": false, - "http://registry.gpii.net/common/inputsLargerEnabled": false, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/selfVoicing/enabled": false, + "http://registry.gpii.net/common/inputsLarger/enabled": false, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/highlightColor": "default", "http://registry.gpii.net/common/tableOfContents": false, "http://registry.gpii.net/common/supportTool": [], - "http://registry.gpii.net/common/simplifiedUiEnabled": false, - "http://registry.gpii.net/common/syllabificationEnabled": true + "http://registry.gpii.net/common/simplifiedUi/enabled": false, + "http://registry.gpii.net/common/syllabification/enabled": true } } } diff --git a/testData/preferences/acceptanceTests/uioPlus_toc.json b/testData/preferences/acceptanceTests/uioPlus_toc.json index 73fbbbd96..b8432969f 100644 --- a/testData/preferences/acceptanceTests/uioPlus_toc.json +++ b/testData/preferences/acceptanceTests/uioPlus_toc.json @@ -7,14 +7,14 @@ "http://registry.gpii.net/common/lineSpace": 1, "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/characterSpace": 0, - "http://registry.gpii.net/common/selfVoicingEnabled": false, - "http://registry.gpii.net/common/inputsLargerEnabled": false, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/selfVoicing/enabled": false, + "http://registry.gpii.net/common/inputsLarger/enabled": false, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/highlightColor": "default", "http://registry.gpii.net/common/tableOfContents": true, "http://registry.gpii.net/common/supportTool": [], - "http://registry.gpii.net/common/simplifiedUiEnabled": false, - "http://registry.gpii.net/common/syllabificationEnabled": false + "http://registry.gpii.net/common/simplifiedUi/enabled": false, + "http://registry.gpii.net/common/syllabification/enabled": false } } } diff --git a/testData/preferences/acceptanceTests/uioPlus_unhandled_support_tool.json b/testData/preferences/acceptanceTests/uioPlus_unhandled_support_tool.json index 2d457ce62..ea213b2b0 100644 --- a/testData/preferences/acceptanceTests/uioPlus_unhandled_support_tool.json +++ b/testData/preferences/acceptanceTests/uioPlus_unhandled_support_tool.json @@ -7,14 +7,14 @@ "http://registry.gpii.net/common/lineSpace": 1, "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/characterSpace": 0, - "http://registry.gpii.net/common/selfVoicingEnabled": false, - "http://registry.gpii.net/common/inputsLargerEnabled": false, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/selfVoicing/enabled": false, + "http://registry.gpii.net/common/inputsLarger/enabled": false, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/highlightColor": "default", "http://registry.gpii.net/common/tableOfContents": false, "http://registry.gpii.net/common/supportTool": ["thesaurus"], - "http://registry.gpii.net/common/simplifiedUiEnabled": false, - "http://registry.gpii.net/common/syllabificationEnabled": false + "http://registry.gpii.net/common/simplifiedUi/enabled": false, + "http://registry.gpii.net/common/syllabification/enabled": false } } } diff --git a/testData/preferences/chris.json b/testData/preferences/chris.json index 99b447ab6..7a3483714 100644 --- a/testData/preferences/chris.json +++ b/testData/preferences/chris.json @@ -5,7 +5,7 @@ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/screenReaderTTSEnabled": true, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, "http://registry.gpii.net/common/screenReaderBrailleOutput": true, "http://registry.gpii.net/common/speechRate": 350, "http://registry.gpii.net/applications/com.microsoft.windows.displaySettings": { diff --git a/testData/preferences/chromeDefault.json b/testData/preferences/chromeDefault.json index b563521de..ba48b431e 100644 --- a/testData/preferences/chromeDefault.json +++ b/testData/preferences/chromeDefault.json @@ -5,7 +5,7 @@ "name": "Default preferences", "preferences": { "http://registry.gpii.net/applications/org.chrome.cloud4chrome": { - "screenReaderTTSEnabled": false, + "screenReaderTTS/enabled": false, "highContrast": "none", "magnification": 1, "fontSize": "medium", diff --git a/testData/preferences/li.json b/testData/preferences/li.json index 8f54add47..bd03d54fc 100644 --- a/testData/preferences/li.json +++ b/testData/preferences/li.json @@ -5,7 +5,7 @@ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/screenReaderTTSEnabled": true, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, "http://registry.gpii.net/common/speechRate": 200, "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 1.5, @@ -25,11 +25,11 @@ "turn-down-light": { "name": "turn down light", "preferences": { - "http://registry.gpii.net/common/screenReaderTTSEnabled": true, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, "http://registry.gpii.net/common/speechRate": 200, "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 2, - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/matchMakerType": "RuleBased" }, "metadata": [ diff --git a/testData/preferences/mary.json b/testData/preferences/mary.json index 018b8ea19..2c1f84aa1 100644 --- a/testData/preferences/mary.json +++ b/testData/preferences/mary.json @@ -5,7 +5,7 @@ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/onScreenKeyboardEnabled": true, + "http://registry.gpii.net/common/onScreenKeyboard/enabled": true, "http://registry.gpii.net/common/matchMakerType": "RuleBased" } } diff --git a/testData/preferences/mickey.json b/testData/preferences/mickey.json index c3e34ad09..756ff61a7 100644 --- a/testData/preferences/mickey.json +++ b/testData/preferences/mickey.json @@ -5,7 +5,7 @@ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/mouseEmulationEnabled": true, + "http://registry.gpii.net/common/mouseEmulation/enabled": true, "http://registry.gpii.net/common/initDelay": 0.120, "http://registry.gpii.net/common/cursorSpeed": 0.850, "http://registry.gpii.net/common/cursorAcceleration": 0.800 diff --git a/testData/preferences/olb_Alicia_app.json b/testData/preferences/olb_Alicia_app.json index 0d4fc3a73..0ca38f522 100644 --- a/testData/preferences/olb_Alicia_app.json +++ b/testData/preferences/olb_Alicia_app.json @@ -5,7 +5,7 @@ "name": "Default preferences", "preferences": { "http://registry.gpii.net/common/language": "en-GB", - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black", "http://registry.gpii.net/applications/eu.gpii.olb": { "simplifiedUiEnabled": true diff --git a/testData/preferences/olb_Alicia_cmn.json b/testData/preferences/olb_Alicia_cmn.json index 4c943790e..5c1e6743c 100644 --- a/testData/preferences/olb_Alicia_cmn.json +++ b/testData/preferences/olb_Alicia_cmn.json @@ -5,9 +5,9 @@ "name": "Default preferences", "preferences": { "http://registry.gpii.net/common/language": "en-GB", - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black", - "http://registry.gpii.net/common/simplifiedUiEnabled": true + "http://registry.gpii.net/common/simplifiedUi/enabled": true } } } diff --git a/testData/preferences/olb_Carla.json b/testData/preferences/olb_Carla.json index fcb3447f1..442d20836 100644 --- a/testData/preferences/olb_Carla.json +++ b/testData/preferences/olb_Carla.json @@ -7,9 +7,9 @@ "http://registry.gpii.net/common/language": "en-GB", "http://registry.gpii.net/common/fontSize": 24, "http://registry.gpii.net/common/linkAdaptation": "emphasizeLinks", - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black", - "http://registry.gpii.net/common/signLanguageEnabled": false, + "http://registry.gpii.net/common/signLanguage/enabled": false, "http://registry.gpii.net/applications/eu.gpii.olb": { "lineSpacing": 2, "inputsLarger": true diff --git a/testData/preferences/olb_KimCallahan.json b/testData/preferences/olb_KimCallahan.json index 9e7731769..a8ac9ecdd 100644 --- a/testData/preferences/olb_KimCallahan.json +++ b/testData/preferences/olb_KimCallahan.json @@ -5,7 +5,7 @@ "name": "Default preferences", "preferences": { "http://registry.gpii.net/common/language": "en-US", - "http://registry.gpii.net/common/signLanguageEnabled": true, + "http://registry.gpii.net/common/signLanguage/enabled": true, "http://registry.gpii.net/common/signLanguage": "ase", "http://registry.gpii.net/common/signLanguageInterpreterType": "avatar", "http://registry.gpii.net/applications/eu.gpii.olb": { diff --git a/testData/preferences/olb_Lara.json b/testData/preferences/olb_Lara.json index d79dea92d..bf4f9db3b 100644 --- a/testData/preferences/olb_Lara.json +++ b/testData/preferences/olb_Lara.json @@ -5,7 +5,7 @@ "name": "Default preferences", "preferences": { "http://registry.gpii.net/common/language": "de-DE", - "http://registry.gpii.net/common/signLanguageEnabled": true, + "http://registry.gpii.net/common/signLanguage/enabled": true, "http://registry.gpii.net/common/signLanguage": "gsg", "http://registry.gpii.net/common/signLanguageInterpreterType": "human", "http://registry.gpii.net/applications/eu.gpii.olb": { diff --git a/testData/preferences/omnitor1.json b/testData/preferences/omnitor1.json index a6c6ff5e9..10daf83e0 100644 --- a/testData/preferences/omnitor1.json +++ b/testData/preferences/omnitor1.json @@ -5,7 +5,7 @@ "name": "Default preferences", "preferences": { "http://registry.gpii.net/common/fontSize": 12, - "http://registry.gpii.net/common/highContrastEnabled": false + "http://registry.gpii.net/common/highContrast/enabled": false } } } diff --git a/testData/preferences/omnitor2.json b/testData/preferences/omnitor2.json index 759931b34..59ee79d2a 100644 --- a/testData/preferences/omnitor2.json +++ b/testData/preferences/omnitor2.json @@ -5,7 +5,7 @@ "name": "Default preferences", "preferences": { "http://registry.gpii.net/common/fontSize": 25, - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "yellow-black" } } diff --git a/testData/preferences/review3/chris.json b/testData/preferences/review3/chris.json index 2dc683ea1..6f8879536 100644 --- a/testData/preferences/review3/chris.json +++ b/testData/preferences/review3/chris.json @@ -4,7 +4,7 @@ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/screenReaderTTSEnabled": true, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, "http://registry.gpii.net/common/screenReaderBrailleOutput": true, "http://registry.gpii.net/common/speechRate": 350, "http://registry.gpii.net/applications/com.microsoft.windows.displaySettings": { diff --git a/testData/preferences/review3/li.json b/testData/preferences/review3/li.json index 018ad507d..27e1f7d70 100644 --- a/testData/preferences/review3/li.json +++ b/testData/preferences/review3/li.json @@ -4,7 +4,7 @@ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/screenReaderTTSEnabled": true, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, "http://registry.gpii.net/common/speechRate": 200, "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 1.5, @@ -24,11 +24,11 @@ "turn-down-light": { "name": "turn down light", "preferences": { - "http://registry.gpii.net/common/screenReaderTTSEnabled": true, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, "http://registry.gpii.net/common/speechRate": 200, "http://registry.gpii.net/common/magnification/enabled": true, "http://registry.gpii.net/common/magnification": 2, - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/matchMakerType": "RuleBased" }, "metadata": [ diff --git a/testData/preferences/review3/mary.json b/testData/preferences/review3/mary.json index ca72002b2..8b61c0843 100644 --- a/testData/preferences/review3/mary.json +++ b/testData/preferences/review3/mary.json @@ -4,7 +4,7 @@ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/onScreenKeyboardEnabled": true, + "http://registry.gpii.net/common/onScreenKeyboard/enabled": true, "http://registry.gpii.net/common/matchMakerType": "RuleBased" } } diff --git a/testData/preferences/review3/vladimir.json b/testData/preferences/review3/vladimir.json index 99ed44bae..259d3ab03 100644 --- a/testData/preferences/review3/vladimir.json +++ b/testData/preferences/review3/vladimir.json @@ -4,15 +4,15 @@ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black", "http://registry.gpii.net/common/cursorSize": 0.5, "http://registry.gpii.net/common/mouseTrailing": 5, - "http://registry.gpii.net/common/screenReaderTTSEnabled": true, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, "http://registry.gpii.net/common/speechRate": 300, "http://registry.gpii.net/applications/org.chrome.cloud4chrome": { "fontSize": "medium", - "highContrastEnabled": true + "highContrast/enabled": true }, "http://registry.gpii.net/common/matchMakerType": "RuleBased" }, @@ -20,7 +20,7 @@ { "type": "required", "scope": [ - "http://registry.gpii.net/common/screenReaderTTSEnabled" + "http://registry.gpii.net/common/screenReaderTTS/enabled" ], "value": 1024 }, @@ -36,16 +36,16 @@ "subway": { "name": "subway", "preferences": { - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black", "http://registry.gpii.net/common/cursorSize": 0.5, "http://registry.gpii.net/common/mouseTrailing": 5, - "http://registry.gpii.net/common/screenReaderTTSEnabled": true, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, "http://registry.gpii.net/common/speechRate": 300, "http://registry.gpii.net/common/volumeTTS": 0.9, "http://registry.gpii.net/applications/org.chrome.cloud4chrome": { "fontSize": "medium", - "highContrastEnabled": true + "highContrast/enabled": true }, "http://registry.gpii.net/common/matchMakerType": "RuleBased" }, @@ -53,7 +53,7 @@ { "type": "required", "scope": [ - "http://registry.gpii.net/common/screenReaderTTSEnabled" + "http://registry.gpii.net/common/screenReaderTTS/enabled" ], "value": 1024 }, diff --git a/testData/preferences/review3/vladimir_smm.json b/testData/preferences/review3/vladimir_smm.json index 06a8b747b..e55337f36 100644 --- a/testData/preferences/review3/vladimir_smm.json +++ b/testData/preferences/review3/vladimir_smm.json @@ -4,15 +4,15 @@ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black", "http://registry.gpii.net/common/cursorSize": 0.5, "http://registry.gpii.net/common/mouseTrailing": 5, - "http://registry.gpii.net/common/screenReaderTTSEnabled": true, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, "http://registry.gpii.net/common/speechRate": 300, "http://registry.gpii.net/applications/org.chrome.cloud4chrome": { "fontSize": "medium", - "highContrastEnabled": true + "highContrast/enabled": true }, "http://registry.gpii.net/common/matchMakerType": "Statistical" }, @@ -20,7 +20,7 @@ { "type": "required", "scope": [ - "http://registry.gpii.net/common/screenReaderTTSEnabled" + "http://registry.gpii.net/common/screenReaderTTS/enabled" ], "value": 1024 }, @@ -36,16 +36,16 @@ "subway": { "name": "subway", "preferences": { - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black", "http://registry.gpii.net/common/cursorSize": 0.5, "http://registry.gpii.net/common/mouseTrailing": 5, - "http://registry.gpii.net/common/screenReaderTTSEnabled": true, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, "http://registry.gpii.net/common/speechRate": 300, "http://registry.gpii.net/common/volumeTTS": 0.9, "http://registry.gpii.net/applications/org.chrome.cloud4chrome": { "fontSize": "medium", - "highContrastEnabled": true + "highContrast/enabled": true }, "http://registry.gpii.net/common/matchMakerType": "Statistical" }, @@ -53,7 +53,7 @@ { "type": "required", "scope": [ - "http://registry.gpii.net/common/screenReaderTTSEnabled" + "http://registry.gpii.net/common/screenReaderTTS/enabled" ], "value": 1024 }, diff --git a/testData/preferences/review3_chrome_high_contrast.json b/testData/preferences/review3_chrome_high_contrast.json index 7ff143633..2d7a3452d 100644 --- a/testData/preferences/review3_chrome_high_contrast.json +++ b/testData/preferences/review3_chrome_high_contrast.json @@ -5,10 +5,10 @@ "name": "Default preferences", "preferences": { "http://registry.gpii.net/common/fontSize": 12, - "http://registry.gpii.net/common/screenReaderTTSEnabled": false, + "http://registry.gpii.net/common/screenReaderTTS/enabled": false, "http://registry.gpii.net/common/magnification/enabled": false, "http://registry.gpii.net/common/magnification": 1, - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black", "http://registry.gpii.net/common/invertColours": false } diff --git a/testData/preferences/review4/Alicia.json b/testData/preferences/review4/Alicia.json index ed75d13e8..8c0af2cc7 100644 --- a/testData/preferences/review4/Alicia.json +++ b/testData/preferences/review4/Alicia.json @@ -4,15 +4,15 @@ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/screenReaderTTSEnabled": true, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, "http://registry.gpii.net/common/speechRate": 350, "http://registry.gpii.net/common/volumeTTS": 0.6, - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black", "http://registry.gpii.net/common/auditoryOutLanguage": "en", "http://registry.gpii.net/common/language": "en", "http://registry.gpii.net/common/screenResolution": "low", - "http://registry.gpii.net/common/simplifiedUiEnabled": true, + "http://registry.gpii.net/common/simplifiedUi/enabled": true, "http://registry.gpii.net/common/matchMakerType": "RuleBased" } } diff --git a/testData/preferences/slater.json b/testData/preferences/slater.json index 5b898ee25..5630c93d5 100644 --- a/testData/preferences/slater.json +++ b/testData/preferences/slater.json @@ -5,7 +5,7 @@ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/screenReaderTTSEnabled": true, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, "http://registry.gpii.net/common/speechRate": 140, "http://registry.gpii.net/common/trackingTTS": ["focus"], "http://registry.gpii.net/common/keyEcho": true, diff --git a/testData/preferences/snapset_2a.json b/testData/preferences/snapset_2a.json index da74d7187..7de476622 100644 --- a/testData/preferences/snapset_2a.json +++ b/testData/preferences/snapset_2a.json @@ -8,11 +8,11 @@ "http://registry.gpii.net/common/cursorSize": 1.0, "http://registry.gpii.net/common/DPIScale": 1.25, "http://registry.gpii.net/applications/com.microsoft.windows.highContrast": { - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black" }, "http://registry.gpii.net/applications/net.gpii.uioPlus": { - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black" } } diff --git a/testData/preferences/snapset_2b.json b/testData/preferences/snapset_2b.json index 629a913e9..04b07e16b 100644 --- a/testData/preferences/snapset_2b.json +++ b/testData/preferences/snapset_2b.json @@ -8,11 +8,11 @@ "http://registry.gpii.net/common/cursorSize": 1.0, "http://registry.gpii.net/common/DPIScale": 1.50, "http://registry.gpii.net/applications/com.microsoft.windows.highContrast": { - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black" }, "http://registry.gpii.net/applications/net.gpii.uioPlus": { - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black" } } diff --git a/testData/preferences/snapset_2c.json b/testData/preferences/snapset_2c.json index 3e5a5bfd3..07cc84521 100644 --- a/testData/preferences/snapset_2c.json +++ b/testData/preferences/snapset_2c.json @@ -8,11 +8,11 @@ "http://registry.gpii.net/common/cursorSize": 1.0, "http://registry.gpii.net/common/DPIScale": 1.75, "http://registry.gpii.net/applications/com.microsoft.windows.highContrast": { - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black" }, "http://registry.gpii.net/applications/net.gpii.uioPlus": { - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black" } } diff --git a/testData/preferences/snapset_3.json b/testData/preferences/snapset_3.json index 60bac4be2..5a9e2ebc4 100644 --- a/testData/preferences/snapset_3.json +++ b/testData/preferences/snapset_3.json @@ -7,7 +7,7 @@ "preferences": { "http://registry.gpii.net/common/DPIScale": 1.50, "http://registry.gpii.net/common/cursorSize": 1.0, - "http://registry.gpii.net/common/selfVoicingEnabled": true, + "http://registry.gpii.net/common/selfVoicing/enabled": true, "http://registry.gpii.net/common/supportTool": ["dictionary"] } } diff --git a/testData/preferences/snapset_4a.json b/testData/preferences/snapset_4a.json index ffd91320a..d792ca518 100644 --- a/testData/preferences/snapset_4a.json +++ b/testData/preferences/snapset_4a.json @@ -6,8 +6,7 @@ "name": "Default preferences", "preferences": { "http://registry.gpii.net/common/magnification": 2, - "http://registry.gpii.net/common/magnifierPosition": "Lens", - "http://registry.gpii.net/common/supportTool": ["dictionary"] + "http://registry.gpii.net/common/magnifier/enabled": false } } } diff --git a/testData/preferences/snapset_4d.json b/testData/preferences/snapset_4d.json index fe1ccaa3f..c8be8bbe9 100644 --- a/testData/preferences/snapset_4d.json +++ b/testData/preferences/snapset_4d.json @@ -8,12 +8,12 @@ "http://registry.gpii.net/common/magnification": 2, "http://registry.gpii.net/common/magnifierPosition": "Lens", "http://registry.gpii.net/applications/com.microsoft.windows.highContrast": { - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black" }, "http://registry.gpii.net/applications/net.gpii.uioPlus": { "http://registry.gpii.net/common/supportTool": ["dictionary"], - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black" } } diff --git a/testData/preferences/sociable1.json b/testData/preferences/sociable1.json index 1bac55e6f..4c56b99cc 100644 --- a/testData/preferences/sociable1.json +++ b/testData/preferences/sociable1.json @@ -5,7 +5,7 @@ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/screenReaderTTSEnabled": true + "http://registry.gpii.net/common/screenReaderTTS/enabled": true } } } diff --git a/testData/preferences/sociable2.json b/testData/preferences/sociable2.json index c95212fa1..e7ce3b65f 100644 --- a/testData/preferences/sociable2.json +++ b/testData/preferences/sociable2.json @@ -6,8 +6,8 @@ "name": "Default preferences", "preferences": { "http://registry.gpii.net/common/fontSize": 24, - "http://registry.gpii.net/common/highContrastEnabled": true, - "http://registry.gpii.net/common/screenReaderTTSEnabled": true + "http://registry.gpii.net/common/highContrast/enabled": true, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true } } } diff --git a/testData/preferences/uioPlusCommon.json b/testData/preferences/uioPlusCommon.json index 55e78176a..aba51ae27 100644 --- a/testData/preferences/uioPlusCommon.json +++ b/testData/preferences/uioPlusCommon.json @@ -7,15 +7,15 @@ "http://registry.gpii.net/common/lineSpace": 2, "http://registry.gpii.net/common/fontSize": 24, "http://registry.gpii.net/common/characterSpace": 0, - "http://registry.gpii.net/common/selfVoicingEnabled": true, - "http://registry.gpii.net/common/inputsLargerEnabled": true, - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/selfVoicing/enabled": true, + "http://registry.gpii.net/common/inputsLarger/enabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black", "http://registry.gpii.net/common/highlightColor": "green", "http://registry.gpii.net/common/tableOfContents": true, "http://registry.gpii.net/common/supportTool": ["dictionary"], - "http://registry.gpii.net/common/simplifiedUiEnabled": true, - "http://registry.gpii.net/common/syllabificationEnabled": false + "http://registry.gpii.net/common/simplifiedUi/enabled": true, + "http://registry.gpii.net/common/syllabification/enabled": false } } } diff --git a/testData/preferences/uioPlus_character_space.json b/testData/preferences/uioPlus_character_space.json index 2b54a94a7..5f263d51b 100644 --- a/testData/preferences/uioPlus_character_space.json +++ b/testData/preferences/uioPlus_character_space.json @@ -7,14 +7,14 @@ "http://registry.gpii.net/common/lineSpace": 1, "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/characterSpace": 1, - "http://registry.gpii.net/common/selfVoicingEnabled": false, - "http://registry.gpii.net/common/inputsLargerEnabled": false, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/selfVoicing/enabled": false, + "http://registry.gpii.net/common/inputsLarger/enabled": false, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/highlightColor": "default", "http://registry.gpii.net/common/tableOfContents": false, "http://registry.gpii.net/common/supportTool": [], - "http://registry.gpii.net/common/simplifiedUiEnabled": false, - "http://registry.gpii.net/common/syllabificationEnabled": false + "http://registry.gpii.net/common/simplifiedUi/enabled": false, + "http://registry.gpii.net/common/syllabification/enabled": false } } } diff --git a/testData/preferences/uioPlus_defaults.json b/testData/preferences/uioPlus_defaults.json index e7e4d2b69..ba1b096a7 100644 --- a/testData/preferences/uioPlus_defaults.json +++ b/testData/preferences/uioPlus_defaults.json @@ -7,14 +7,14 @@ "http://registry.gpii.net/common/lineSpace": 1, "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/characterSpace": 0, - "http://registry.gpii.net/common/selfVoicingEnabled": false, - "http://registry.gpii.net/common/inputsLargerEnabled": false, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/selfVoicing/enabled": false, + "http://registry.gpii.net/common/inputsLarger/enabled": false, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/highlightColor": "default", "http://registry.gpii.net/common/tableOfContents": false, "http://registry.gpii.net/common/supportTool": [], - "http://registry.gpii.net/common/simplifiedUiEnabled": false, - "http://registry.gpii.net/common/syllabificationEnabled": false + "http://registry.gpii.net/common/simplifiedUi/enabled": false, + "http://registry.gpii.net/common/syllabification/enabled": false } } } diff --git a/testData/preferences/uioPlus_font_size.json b/testData/preferences/uioPlus_font_size.json index 9356f7cf3..5b666aa9d 100644 --- a/testData/preferences/uioPlus_font_size.json +++ b/testData/preferences/uioPlus_font_size.json @@ -7,14 +7,14 @@ "http://registry.gpii.net/common/lineSpace": 1, "http://registry.gpii.net/common/fontSize": 24, "http://registry.gpii.net/common/characterSpace": 0, - "http://registry.gpii.net/common/selfVoicingEnabled": false, - "http://registry.gpii.net/common/inputsLargerEnabled": false, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/selfVoicing/enabled": false, + "http://registry.gpii.net/common/inputsLarger/enabled": false, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/highlightColor": "default", "http://registry.gpii.net/common/tableOfContents": false, "http://registry.gpii.net/common/supportTool": [], - "http://registry.gpii.net/common/simplifiedUiEnabled": false, - "http://registry.gpii.net/common/syllabificationEnabled": false + "http://registry.gpii.net/common/simplifiedUi/enabled": false, + "http://registry.gpii.net/common/syllabification/enabled": false } } } diff --git a/testData/preferences/uioPlus_high_contrast.json b/testData/preferences/uioPlus_high_contrast.json index 3e229da55..dda680380 100644 --- a/testData/preferences/uioPlus_high_contrast.json +++ b/testData/preferences/uioPlus_high_contrast.json @@ -7,15 +7,15 @@ "http://registry.gpii.net/common/lineSpace": 1, "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/characterSpace": 0, - "http://registry.gpii.net/common/selfVoicingEnabled": false, - "http://registry.gpii.net/common/inputsLargerEnabled": false, - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/selfVoicing/enabled": false, + "http://registry.gpii.net/common/inputsLarger/enabled": false, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black", "http://registry.gpii.net/common/highlightColor": "default", "http://registry.gpii.net/common/tableOfContents": false, "http://registry.gpii.net/common/supportTool": [], - "http://registry.gpii.net/common/simplifiedUiEnabled": false, - "http://registry.gpii.net/common/syllabificationEnabled": false + "http://registry.gpii.net/common/simplifiedUi/enabled": false, + "http://registry.gpii.net/common/syllabification/enabled": false } } } diff --git a/testData/preferences/uioPlus_highlight_colour.json b/testData/preferences/uioPlus_highlight_colour.json index 677c28e92..8c97751fc 100644 --- a/testData/preferences/uioPlus_highlight_colour.json +++ b/testData/preferences/uioPlus_highlight_colour.json @@ -7,14 +7,14 @@ "http://registry.gpii.net/common/lineSpace": 1, "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/characterSpace": 0, - "http://registry.gpii.net/common/selfVoicingEnabled": false, - "http://registry.gpii.net/common/inputsLargerEnabled": false, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/selfVoicing/enabled": false, + "http://registry.gpii.net/common/inputsLarger/enabled": false, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/highlightColor": "yellow", "http://registry.gpii.net/common/tableOfContents": false, "http://registry.gpii.net/common/supportTool": [], - "http://registry.gpii.net/common/simplifiedUiEnabled": false, - "http://registry.gpii.net/common/syllabificationEnabled": false + "http://registry.gpii.net/common/simplifiedUi/enabled": false, + "http://registry.gpii.net/common/syllabification/enabled": false } } } diff --git a/testData/preferences/uioPlus_inputs_larger.json b/testData/preferences/uioPlus_inputs_larger.json index f08c1dab1..53d086544 100644 --- a/testData/preferences/uioPlus_inputs_larger.json +++ b/testData/preferences/uioPlus_inputs_larger.json @@ -7,14 +7,14 @@ "http://registry.gpii.net/common/lineSpace": 1, "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/characterSpace": 0, - "http://registry.gpii.net/common/selfVoicingEnabled": false, - "http://registry.gpii.net/common/inputsLargerEnabled": true, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/selfVoicing/enabled": false, + "http://registry.gpii.net/common/inputsLarger/enabled": true, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/highlightColor": "default", "http://registry.gpii.net/common/tableOfContents": false, "http://registry.gpii.net/common/supportTool": [], - "http://registry.gpii.net/common/simplifiedUiEnabled": false, - "http://registry.gpii.net/common/syllabificationEnabled": false + "http://registry.gpii.net/common/simplifiedUi/enabled": false, + "http://registry.gpii.net/common/syllabification/enabled": false } } } diff --git a/testData/preferences/uioPlus_line_space.json b/testData/preferences/uioPlus_line_space.json index 1e7edb6b0..2415297bf 100644 --- a/testData/preferences/uioPlus_line_space.json +++ b/testData/preferences/uioPlus_line_space.json @@ -7,14 +7,14 @@ "http://registry.gpii.net/common/lineSpace": 2, "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/characterSpace": 0, - "http://registry.gpii.net/common/selfVoicingEnabled": false, - "http://registry.gpii.net/common/inputsLargerEnabled": false, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/selfVoicing/enabled": false, + "http://registry.gpii.net/common/inputsLarger/enabled": false, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/highlightColor": "default", "http://registry.gpii.net/common/tableOfContents": false, "http://registry.gpii.net/common/supportTool": [], - "http://registry.gpii.net/common/simplifiedUiEnabled": false, - "http://registry.gpii.net/common/syllabificationEnabled": false + "http://registry.gpii.net/common/simplifiedUi/enabled": false, + "http://registry.gpii.net/common/syllabification/enabled": false } } } diff --git a/testData/preferences/uioPlus_multiple_settings.json b/testData/preferences/uioPlus_multiple_settings.json index ee3406cb3..cc9720baa 100644 --- a/testData/preferences/uioPlus_multiple_settings.json +++ b/testData/preferences/uioPlus_multiple_settings.json @@ -7,15 +7,15 @@ "http://registry.gpii.net/common/lineSpace": 1.3, "http://registry.gpii.net/common/fontSize": 16, "http://registry.gpii.net/common/characterSpace": 2, - "http://registry.gpii.net/common/selfVoicingEnabled": true, - "http://registry.gpii.net/common/inputsLargerEnabled": true, - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/selfVoicing/enabled": true, + "http://registry.gpii.net/common/inputsLarger/enabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "yellow-black", "http://registry.gpii.net/common/highlightColor": "green", "http://registry.gpii.net/common/tableOfContents": true, "http://registry.gpii.net/common/supportTool": ["dictionary"], - "http://registry.gpii.net/common/simplifiedUiEnabled": true, - "http://registry.gpii.net/common/syllabificationEnabled": true + "http://registry.gpii.net/common/simplifiedUi/enabled": true, + "http://registry.gpii.net/common/syllabification/enabled": true } } } diff --git a/testData/preferences/uioPlus_multiple_support_tool.json b/testData/preferences/uioPlus_multiple_support_tool.json index 80d345cb4..f5a1b74ff 100644 --- a/testData/preferences/uioPlus_multiple_support_tool.json +++ b/testData/preferences/uioPlus_multiple_support_tool.json @@ -7,14 +7,14 @@ "http://registry.gpii.net/common/lineSpace": 1, "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/characterSpace": 0, - "http://registry.gpii.net/common/selfVoicingEnabled": false, - "http://registry.gpii.net/common/inputsLargerEnabled": false, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/selfVoicing/enabled": false, + "http://registry.gpii.net/common/inputsLarger/enabled": false, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/highlightColor": "default", "http://registry.gpii.net/common/tableOfContents": false, "http://registry.gpii.net/common/supportTool": ["dictionary", "thesaurus"], - "http://registry.gpii.net/common/simplifiedUiEnabled": false, - "http://registry.gpii.net/common/syllabificationEnabled": false + "http://registry.gpii.net/common/simplifiedUi/enabled": false, + "http://registry.gpii.net/common/syllabification/enabled": false } } } diff --git a/testData/preferences/uioPlus_self_voicing.json b/testData/preferences/uioPlus_self_voicing.json index 707aad3e9..41979fe7b 100644 --- a/testData/preferences/uioPlus_self_voicing.json +++ b/testData/preferences/uioPlus_self_voicing.json @@ -7,14 +7,14 @@ "http://registry.gpii.net/common/lineSpace": 1, "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/characterSpace": 0, - "http://registry.gpii.net/common/selfVoicingEnabled": true, - "http://registry.gpii.net/common/inputsLargerEnabled": false, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/selfVoicing/enabled": true, + "http://registry.gpii.net/common/inputsLarger/enabled": false, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/highlightColor": "default", "http://registry.gpii.net/common/tableOfContents": false, "http://registry.gpii.net/common/supportTool": [], - "http://registry.gpii.net/common/simplifiedUiEnabled": false, - "http://registry.gpii.net/common/syllabificationEnabled": false + "http://registry.gpii.net/common/simplifiedUi/enabled": false, + "http://registry.gpii.net/common/syllabification/enabled": false } } } diff --git a/testData/preferences/uioPlus_simplified.json b/testData/preferences/uioPlus_simplified.json index c1c11cc6f..500d329f8 100644 --- a/testData/preferences/uioPlus_simplified.json +++ b/testData/preferences/uioPlus_simplified.json @@ -7,14 +7,14 @@ "http://registry.gpii.net/common/lineSpace": 1, "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/characterSpace": 0, - "http://registry.gpii.net/common/selfVoicingEnabled": false, - "http://registry.gpii.net/common/inputsLargerEnabled": false, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/selfVoicing/enabled": false, + "http://registry.gpii.net/common/inputsLarger/enabled": false, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/highlightColor": "default", "http://registry.gpii.net/common/tableOfContents": false, "http://registry.gpii.net/common/supportTool": [], - "http://registry.gpii.net/common/simplifiedUiEnabled": true, - "http://registry.gpii.net/common/syllabificationEnabled": false + "http://registry.gpii.net/common/simplifiedUi/enabled": true, + "http://registry.gpii.net/common/syllabification/enabled": false } } } diff --git a/testData/preferences/uioPlus_support_tool.json b/testData/preferences/uioPlus_support_tool.json index 048cc213f..02dd218fe 100644 --- a/testData/preferences/uioPlus_support_tool.json +++ b/testData/preferences/uioPlus_support_tool.json @@ -7,14 +7,14 @@ "http://registry.gpii.net/common/lineSpace": 1, "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/characterSpace": 0, - "http://registry.gpii.net/common/selfVoicingEnabled": false, - "http://registry.gpii.net/common/inputsLargerEnabled": false, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/selfVoicing/enabled": false, + "http://registry.gpii.net/common/inputsLarger/enabled": false, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/highlightColor": "default", "http://registry.gpii.net/common/tableOfContents": false, "http://registry.gpii.net/common/supportTool": ["dictionary"], - "http://registry.gpii.net/common/simplifiedUiEnabled": false, - "http://registry.gpii.net/common/syllabificationEnabled": false + "http://registry.gpii.net/common/simplifiedUi/enabled": false, + "http://registry.gpii.net/common/syllabification/enabled": false } } } diff --git a/testData/preferences/uioPlus_syllabification.json b/testData/preferences/uioPlus_syllabification.json index edd27c201..291fa9fdb 100644 --- a/testData/preferences/uioPlus_syllabification.json +++ b/testData/preferences/uioPlus_syllabification.json @@ -7,14 +7,14 @@ "http://registry.gpii.net/common/lineSpace": 1, "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/characterSpace": 0, - "http://registry.gpii.net/common/selfVoicingEnabled": false, - "http://registry.gpii.net/common/inputsLargerEnabled": false, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/selfVoicing/enabled": false, + "http://registry.gpii.net/common/inputsLarger/enabled": false, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/highlightColor": "default", "http://registry.gpii.net/common/tableOfContents": false, "http://registry.gpii.net/common/supportTool": [], - "http://registry.gpii.net/common/simplifiedUiEnabled": false, - "http://registry.gpii.net/common/syllabificationEnabled": true + "http://registry.gpii.net/common/simplifiedUi/enabled": false, + "http://registry.gpii.net/common/syllabification/enabled": true } } } diff --git a/testData/preferences/uioPlus_toc.json b/testData/preferences/uioPlus_toc.json index 73fbbbd96..b8432969f 100644 --- a/testData/preferences/uioPlus_toc.json +++ b/testData/preferences/uioPlus_toc.json @@ -7,14 +7,14 @@ "http://registry.gpii.net/common/lineSpace": 1, "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/characterSpace": 0, - "http://registry.gpii.net/common/selfVoicingEnabled": false, - "http://registry.gpii.net/common/inputsLargerEnabled": false, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/selfVoicing/enabled": false, + "http://registry.gpii.net/common/inputsLarger/enabled": false, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/highlightColor": "default", "http://registry.gpii.net/common/tableOfContents": true, "http://registry.gpii.net/common/supportTool": [], - "http://registry.gpii.net/common/simplifiedUiEnabled": false, - "http://registry.gpii.net/common/syllabificationEnabled": false + "http://registry.gpii.net/common/simplifiedUi/enabled": false, + "http://registry.gpii.net/common/syllabification/enabled": false } } } diff --git a/testData/preferences/uioPlus_unhandled_support_tool.json b/testData/preferences/uioPlus_unhandled_support_tool.json index 2d457ce62..ea213b2b0 100644 --- a/testData/preferences/uioPlus_unhandled_support_tool.json +++ b/testData/preferences/uioPlus_unhandled_support_tool.json @@ -7,14 +7,14 @@ "http://registry.gpii.net/common/lineSpace": 1, "http://registry.gpii.net/common/fontSize": 12, "http://registry.gpii.net/common/characterSpace": 0, - "http://registry.gpii.net/common/selfVoicingEnabled": false, - "http://registry.gpii.net/common/inputsLargerEnabled": false, - "http://registry.gpii.net/common/highContrastEnabled": false, + "http://registry.gpii.net/common/selfVoicing/enabled": false, + "http://registry.gpii.net/common/inputsLarger/enabled": false, + "http://registry.gpii.net/common/highContrast/enabled": false, "http://registry.gpii.net/common/highlightColor": "default", "http://registry.gpii.net/common/tableOfContents": false, "http://registry.gpii.net/common/supportTool": ["thesaurus"], - "http://registry.gpii.net/common/simplifiedUiEnabled": false, - "http://registry.gpii.net/common/syllabificationEnabled": false + "http://registry.gpii.net/common/simplifiedUi/enabled": false, + "http://registry.gpii.net/common/syllabification/enabled": false } } } diff --git a/testData/preferences/vladimir.json b/testData/preferences/vladimir.json index 836895063..508317c5f 100644 --- a/testData/preferences/vladimir.json +++ b/testData/preferences/vladimir.json @@ -5,15 +5,15 @@ "gpii-default": { "name": "Default preferences", "preferences": { - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black", "http://registry.gpii.net/common/cursorSize": 0.5, "http://registry.gpii.net/common/mouseTrailing": 5, - "http://registry.gpii.net/common/screenReaderTTSEnabled": true, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, "http://registry.gpii.net/common/speechRate": 300, "http://registry.gpii.net/applications/org.chrome.cloud4chrome": { "fontSize": "medium", - "highContrastEnabled": true + "highContrast/enabled": true }, "http://registry.gpii.net/common/matchMakerType": "RuleBased" }, @@ -21,7 +21,7 @@ { "type": "required", "scope": [ - "http://registry.gpii.net/common/screenReaderTTSEnabled" + "http://registry.gpii.net/common/screenReaderTTS/enabled" ], "value": 1024 }, @@ -37,16 +37,16 @@ "subway": { "name": "subway", "preferences": { - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black", "http://registry.gpii.net/common/cursorSize": 0.5, "http://registry.gpii.net/common/mouseTrailing": 5, - "http://registry.gpii.net/common/screenReaderTTSEnabled": true, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, "http://registry.gpii.net/common/speechRate": 300, "http://registry.gpii.net/common/volumeTTS": 0.9, "http://registry.gpii.net/applications/org.chrome.cloud4chrome": { "fontSize": "medium", - "highContrastEnabled": true + "highContrast/enabled": true }, "http://registry.gpii.net/common/matchMakerType": "RuleBased" }, @@ -54,7 +54,7 @@ { "type": "required", "scope": [ - "http://registry.gpii.net/common/screenReaderTTSEnabled" + "http://registry.gpii.net/common/screenReaderTTS/enabled" ], "value": 1024 }, diff --git a/testData/solutions/android.json5 b/testData/solutions/android.json5 index b8a9cc54d..f52663c0e 100644 --- a/testData/solutions/android.json5 +++ b/testData/solutions/android.json5 @@ -8,7 +8,7 @@ }] }, "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" + "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled" ], "launchHandlers": { "launcher": { @@ -40,7 +40,7 @@ }] }, "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" + "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled" ], "launchHandlers": { "launcher": { @@ -421,7 +421,7 @@ "map\\.string\\.theme\\.$t": { "transform": { "type": "fluid.transforms.condition", - "conditionPath": "http://registry\\.gpii\\.net/common/highContrastEnabled", + "conditionPath": "http://registry\\.gpii\\.net/common/highContrast/enabled", "true": "yellow-black", "truePath": "http://registry\\.gpii\\.net/common/highContrastTheme", "false": "none" diff --git a/testData/solutions/darwin.json5 b/testData/solutions/darwin.json5 index ca5e45ae6..b35f8bf47 100644 --- a/testData/solutions/darwin.json5 +++ b/testData/solutions/darwin.json5 @@ -86,7 +86,7 @@ ] }, "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" + "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled" ], "settingsHandlers": { "configuration": { diff --git a/testData/solutions/linux.json5 b/testData/solutions/linux.json5 index 9ef2365e6..0e618877e 100644 --- a/testData/solutions/linux.json5 +++ b/testData/solutions/linux.json5 @@ -171,7 +171,7 @@ "gtk-theme": { "transform": { "type": "fluid.transforms.condition", - "conditionPath": "http://registry\\.gpii\\.net/common/highContrastEnabled", + "conditionPath": "http://registry\\.gpii\\.net/common/highContrast/enabled", "true": "HighContrast", "false": "Adwaita" } @@ -179,7 +179,7 @@ "icon-theme": { "transform": { "type": "fluid.transforms.condition", - "conditionPath": "http://registry\\.gpii\\.net/common/highContrastEnabled", + "conditionPath": "http://registry\\.gpii\\.net/common/highContrast/enabled", "true": "HighContrast", "false": "gnome" } @@ -205,7 +205,7 @@ }, { "type": "fluid.transforms.binaryOp", - "outputPath": "http://registry\\.gpii\\.net/common/highContrastEnabled", + "outputPath": "http://registry\\.gpii\\.net/common/highContrast/enabled", "left": { "transform": { "type": "fluid.transforms.binaryOp", @@ -290,7 +290,7 @@ }] }, "capabilities": [ - "http://registry\\.gpii\\.net/common/onScreenKeyboardEnabled" + "http://registry\\.gpii\\.net/common/onScreenKeyboard/enabled" ], "launchHandlers": { "launching": { @@ -345,7 +345,7 @@ }, "capabilitiesTransformations": { "stickykeys-enable": "http://registry\\.gpii\\.net/common/stickyKeys", - "slowkeys-enable": "http://registry\\.gpii\\.net/common/slowKeysEnabled", + "slowkeys-enable": "http://registry\\.gpii\\.net/common/slowKeys/enabled", "slowkeys-delay": { "transform": { "type": "fluid.transforms.linearScale", @@ -353,7 +353,7 @@ "factor": 1000 } }, - "bouncekeys-enable": "http://registry\\.gpii\\.net/common/debounceEnabled", + "bouncekeys-enable": "http://registry\\.gpii\\.net/common/debounce/enabled", "bouncekeys-delay": { "transform": { "type": "fluid.transforms.linearScale", @@ -361,7 +361,7 @@ "factor": 1000 } }, - "mousekeys-enable": "http://registry\\.gpii\\.net/common/mouseEmulationEnabled", + "mousekeys-enable": "http://registry\\.gpii\\.net/common/mouseEmulation/enabled", "mousekeys-init-delay": { "transform": { "type": "fluid.transforms.linearScale", @@ -475,7 +475,7 @@ }] }, "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" + "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled" ], "settingsHandlers": { "configuration": { @@ -502,7 +502,7 @@ "enableEchoByCharacter": "http://registry\\.gpii\\.net/common/keyEcho", "enableEchoByWord": "http://registry\\.gpii\\.net/common/wordEcho", "enableBraille": "http://registry\\.gpii\\.net/common/screenReaderBrailleOutput", - "enableSpeech": "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled", + "enableSpeech": "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled", "sayAllStyle": { "transform": { "type": "fluid.transforms.valueMapper", @@ -967,7 +967,7 @@ "http://registry\\.gpii\\.net/common/keyEcho": "enableEchoByCharacter", "http://registry\\.gpii\\.net/common/wordEcho": "enableEchoByWord", "http://registry\\.gpii\\.net/common/screenReaderBrailleOutput": "enableBraille", - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled": "enableSpeech", + "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled": "enableSpeech", "transform": [ { "type": "fluid.transforms.valueMapper", @@ -1309,7 +1309,7 @@ ] }, "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" + "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled" ], "launchHandlers": { "launcher": { @@ -1424,11 +1424,11 @@ } }, "characterSpace": "http://registry\\.gpii\\.net/common/characterSpace", - "inputsLargerEnabled": "http://registry\\.gpii\\.net/common/inputsLargerEnabled", + "inputsLargerEnabled": "http://registry\\.gpii\\.net/common/inputsLarger/enabled", "contrastTheme": { "transform": { "type": "fluid.transforms.condition", - "conditionPath": "http://registry\\.gpii\\.net/common/highContrastEnabled", + "conditionPath": "http://registry\\.gpii\\.net/common/highContrast/enabled", "true": { "transform": { "type": "fluid.transforms.valueMapper", @@ -1445,7 +1445,7 @@ "false": "default" } }, - "selfVoicingEnabled": "http://registry\\.gpii\\.net/common/selfVoicingEnabled", + "selfVoicingEnabled": "http://registry\\.gpii\\.net/common/selfVoicing/enabled", "selectionTheme": "http://registry\\.gpii\\.net/common/highlightColor", "tableOfContentsEnabled": "http://registry\\.gpii\\.net/common/tableOfContents", "dictionaryEnabled": { @@ -1471,8 +1471,8 @@ } } }, - "simplifiedUiEnabled": "http://registry\\.gpii\\.net/common/simplifiedUiEnabled", - "syllabificationEnabled": "http://registry\\.gpii\\.net/common/syllabificationEnabled" + "simplifiedUiEnabled": "http://registry\\.gpii\\.net/common/simplifiedUi/enabled", + "syllabificationEnabled": "http://registry\\.gpii\\.net/common/syllabification/enabled" }, "inverseCapabilitiesTransformations": {} } diff --git a/testData/solutions/web.json5 b/testData/solutions/web.json5 index 0bd5c5965..9e2070fc0 100644 --- a/testData/solutions/web.json5 +++ b/testData/solutions/web.json5 @@ -12,16 +12,16 @@ "myconf": { "type": "gpii.settingsHandlers.noSettings", "supportedSettings": { - "screenReaderTTSEnabled": {}, + "screenReaderTTS/enabled": {}, "fontSize": {}, "magnifierEnabled": {}, "magnification": {}, - "highContrastEnabled": {}, + "highContrast/enabled": {}, "highContrastTheme": {}, "invertColours": {} }, "capabilitiesTransformations": { - "screenReaderTTSEnabled": "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled", + "screenReaderTTS/enabled": "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled", "fontSize": { "transform":{ "type": "fluid.transforms.quantize", @@ -61,7 +61,7 @@ ] } }, - "highContrastEnabled": "http://registry\\.gpii\\.net/common/highContrastEnabled", + "highContrast/enabled": "http://registry\\.gpii\\.net/common/highContrast/enabled", "highContrastTheme": "http://registry\\.gpii\\.net/common/highContrastTheme", "invertColours": "http://registry\\.gpii\\.net/common/invertColours" }, @@ -426,7 +426,7 @@ "contrastTheme": { "transform": { "type": "fluid.transforms.condition", - "conditionPath": "http://registry\\.gpii\\.net/common/highContrastEnabled", + "conditionPath": "http://registry\\.gpii\\.net/common/highContrast/enabled", "true": { "transform": { "type": "fluid.transforms.valueMapper", @@ -535,7 +535,7 @@ "contrastTheme": { "transform": { "type": "fluid.transforms.condition", - "conditionPath": "http://registry\\.gpii\\.net/common/highContrastEnabled", + "conditionPath": "http://registry\\.gpii\\.net/common/highContrast/enabled", "true": { "transform": { "type": "fluid.transforms.valueMapper", @@ -550,7 +550,7 @@ } } }, - "signLanguageEnabled": "http://registry\\.gpii\\.net/common/signLanguageEnabled", + "signLanguageEnabled": "http://registry\\.gpii\\.net/common/signLanguage/enabled", "signLanguage": { "transform": { "type": "fluid.transforms.valueMapper", @@ -575,8 +575,8 @@ } } }, - "pictogramsEnabled": "http://registry\\.gpii\\.net/common/pictogramsEnabled", - "simplifiedUiEnabled": "http://registry\\.gpii\\.net/common/simplifiedUiEnabled" + "pictogramsEnabled": "http://registry\\.gpii\\.net/common/pictograms/enabled", + "simplifiedUiEnabled": "http://registry\\.gpii\\.net/common/simplifiedUi/enabled" }, "inverseCapabilitiesTransformations": {} } diff --git a/testData/solutions/win32.json5 b/testData/solutions/win32.json5 index 1bd9bf337..b2e228bb8 100644 --- a/testData/solutions/win32.json5 +++ b/testData/solutions/win32.json5 @@ -9,7 +9,7 @@ ] }, "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" + "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled" ], "settingsHandlers": { "configuration1": { @@ -1023,7 +1023,7 @@ ] }, "capabilities": [ - "http://registry\\.gpii\\.net/common/onScreenKeyboardEnabled" + "http://registry\\.gpii\\.net/common/onScreenKeyboard/enabled" ], "settingsHandlers": { "configure": { @@ -1101,7 +1101,7 @@ ] }, "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" + "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled" ], "settingsHandlers": { "configure": { @@ -1432,7 +1432,7 @@ }, { "type": "fluid.transforms.valueMapper", - "defaultInputPath": "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled", + "defaultInputPath": "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled", "match": { "false": { "outputValue": { @@ -1624,7 +1624,7 @@ }, { "type": "fluid.transforms.condition", - "outputPath": "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled", + "outputPath": "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled", "false": true, "true": false, "condition": { @@ -1928,7 +1928,7 @@ ] }, "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" + "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled" ], "launchHandlers": { "launcher": { @@ -1991,25 +1991,25 @@ "transform": [ { "type": "fluid.transforms.condition", - "conditionPath": "http://registry\\.gpii\\.net/common/selfVoicingEnabled", + "conditionPath": "http://registry\\.gpii\\.net/common/selfVoicing/enabled", "outputPath": "speakOnActivate", "true": "yes", "false": "no" }, { "type": "fluid.transforms.condition", - "conditionPath": "http://registry\\.gpii\\.net/common/selfVoicingEnabled", + "conditionPath": "http://registry\\.gpii\\.net/common/selfVoicing/enabled", "outputPath": "speakTitles", "true": "yes", "false": "no" }, { "type": "fluid.transforms.condition", - "conditionPath": "http://registry\\.gpii\\.net/common/selfVoicingEnabled", + "conditionPath": "http://registry\\.gpii\\.net/common/selfVoicing/enabled", "outputPath": "speakLabels", "true": "yes", "false": "no" }, { "type": "fluid.transforms.condition", - "conditionPath": "http://registry\\.gpii\\.net/common/highContrastEnabled", + "conditionPath": "http://registry\\.gpii\\.net/common/highContrast/enabled", "condition": false, "outputPath": "theme", "false": "colour", @@ -2129,7 +2129,7 @@ "HighContrastOn": { "transform": { "type": "fluid.transforms.value", - "inputPath": "http://registry\\.gpii\\.net/common/highContrastEnabled", + "inputPath": "http://registry\\.gpii\\.net/common/highContrast/enabled", "outputPath": "value" }, "path": { @@ -2141,7 +2141,7 @@ } }, "inverseCapabilitiesTransformations": { - "http://registry\\.gpii\\.net/common/highContrastEnabled": "HighContrastOn.value" + "http://registry\\.gpii\\.net/common/highContrast/enabled": "HighContrastOn.value" } }, "configureTheme": { @@ -2324,9 +2324,9 @@ "FilterKeysEnable": { "transform": { "type": "fluid.transforms.binaryOp", - "leftPath": "http://registry\\.gpii\\.net/common/debounceEnabled", + "leftPath": "http://registry\\.gpii\\.net/common/debounce/enabled", "left": false, - "rightPath": "http://registry\\.gpii\\.net/common/slowKeysEnabled", + "rightPath": "http://registry\\.gpii\\.net/common/slowKeys/enabled", "right": false, "operator": "||", "outputPath": "value" @@ -2341,7 +2341,7 @@ "SlowKeysInterval": { "transform": { "type": "fluid.transforms.condition", - "conditionPath": "http://registry\\.gpii\\.net/common/slowKeysEnabled", + "conditionPath": "http://registry\\.gpii\\.net/common/slowKeys/enabled", "true": { "transform": { "type": "fluid.transforms.linearScale", @@ -2365,7 +2365,7 @@ "condition": { "transform": { "type": "fluid.transforms.binaryOp", - "leftPath": "http://registry\\.gpii\\.net/common/slowKeysEnabled", + "leftPath": "http://registry\\.gpii\\.net/common/slowKeys/enabled", "left": false, "right": false, "operator": "===" @@ -2374,7 +2374,7 @@ "true": { "transform": { "type": "fluid.transforms.condition", - "conditionPath": "http://registry\\.gpii\\.net/common/debounceEnabled", + "conditionPath": "http://registry\\.gpii\\.net/common/debounce/enabled", "true": { "transform": { "type": "fluid.transforms.linearScale", @@ -2398,7 +2398,7 @@ } }, "inverseCapabilitiesTransformations": { - "http://registry\\.gpii\\.net/common/slowKeysEnabled": { + "http://registry\\.gpii\\.net/common/slowKeys/enabled": { "transform": { "type": "fluid.transforms.condition", "condition": { @@ -2432,7 +2432,7 @@ } } }, - "http://registry\\.gpii\\.net/common/debounceEnabled": { + "http://registry\\.gpii\\.net/common/debounce/enabled": { "transform": { "type": "fluid.transforms.condition", "condition": { @@ -2540,7 +2540,7 @@ "MouseKeysOn": { "transform": { "type": "fluid.transforms.value", - "inputPath": "http://registry\\.gpii\\.net/common/mouseEmulationEnabled", + "inputPath": "http://registry\\.gpii\\.net/common/mouseEmulation/enabled", "outputPath": "value" }, "path": { @@ -2601,7 +2601,7 @@ } }, "inverseCapabilitiesTransformations": { - "http://registry\\.gpii\\.net/common/mouseEmulationEnabled": "MouseKeysOn.value", + "http://registry\\.gpii\\.net/common/mouseEmulation/enabled": "MouseKeysOn.value", "http://registry\\.gpii\\.net/common/cursorSpeed": { "transform": { "type": "fluid.transforms.linearScale", @@ -3158,10 +3158,10 @@ "literalValue": 1 }, "screenReaderTTSEnabled": { - "value": "http://registry\\.gpii\\.net/common/screenReaderTTSEnabled" + "value": "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled" }, "highContrastEnabled": { - "value": "http://registry\\.gpii\\.net/common/highContrastEnabled" + "value": "http://registry\\.gpii\\.net/common/highContrast/enabled" }, "fontSize": { "value": { @@ -3273,11 +3273,11 @@ } }, "characterSpace": "http://registry\\.gpii\\.net/common/characterSpace", - "inputsLargerEnabled": "http://registry\\.gpii\\.net/common/inputsLargerEnabled", + "inputsLargerEnabled": "http://registry\\.gpii\\.net/common/inputsLarger/enabled", "contrastTheme": { "transform": { "type": "fluid.transforms.condition", - "conditionPath": "http://registry\\.gpii\\.net/common/highContrastEnabled", + "conditionPath": "http://registry\\.gpii\\.net/common/highContrast/enabled", "true": { "transform": { "type": "fluid.transforms.valueMapper", @@ -3294,7 +3294,7 @@ "false": "default" } }, - "selfVoicingEnabled": "http://registry\\.gpii\\.net/common/selfVoicingEnabled", + "selfVoicingEnabled": "http://registry\\.gpii\\.net/common/selfVoicing/enabled", "selectionTheme": "http://registry\\.gpii\\.net/common/highlightColor", "tableOfContentsEnabled": "http://registry\\.gpii\\.net/common/tableOfContents", "dictionaryEnabled": { @@ -3320,8 +3320,8 @@ } } }, - "simplifiedUiEnabled": "http://registry\\.gpii\\.net/common/simplifiedUiEnabled", - "syllabificationEnabled": "http://registry\\.gpii\\.net/common/syllabificationEnabled" + "simplifiedUiEnabled": "http://registry\\.gpii\\.net/common/simplifiedUi/enabled", + "syllabificationEnabled": "http://registry\\.gpii\\.net/common/syllabification/enabled" }, "inverseCapabilitiesTransformations": {} } diff --git a/tests/platform/cloud/AcceptanceTests_chrome_testDefs.json b/tests/platform/cloud/AcceptanceTests_chrome_testDefs.json index 5499dada8..94b5e1bc9 100644 --- a/tests/platform/cloud/AcceptanceTests_chrome_testDefs.json +++ b/tests/platform/cloud/AcceptanceTests_chrome_testDefs.json @@ -19,8 +19,8 @@ "magnifierEnabled": false, "magnification": 1, "highContrastTheme": "white-black", - "highContrastEnabled": true, - "screenReaderTTSEnabled": false + "highContrast/enabled": true, + "screenReaderTTS/enabled": false } } }, @@ -34,8 +34,8 @@ "invertColours": false, "magnifierEnabled": false, "magnification": 1, - "highContrastEnabled": false, - "screenReaderTTSEnabled": false + "highContrast/enabled": false, + "screenReaderTTS/enabled": false } } }, @@ -49,8 +49,8 @@ "invertColours": false, "magnifierEnabled": true, "magnification": 2, - "highContrastEnabled": false, - "screenReaderTTSEnabled": false + "highContrast/enabled": false, + "screenReaderTTS/enabled": false } } } diff --git a/tests/platform/linux/linux-builtIn-testSpec.txt b/tests/platform/linux/linux-builtIn-testSpec.txt index 3e22fe2d8..99f2097da 100644 --- a/tests/platform/linux/linux-builtIn-testSpec.txt +++ b/tests/platform/linux/linux-builtIn-testSpec.txt @@ -7,5 +7,5 @@ onscreen keyboard, etc. It tests the system using four NP sets: (1) os_common: common terms compatible with linux built in settings (2) os_win7: application specific windows settings (3) os_gnome: application specific gnome settings - (4) os_common2: this is only used to check when highContrastEnabled=false + (4) os_common2: this is only used to check when highContrast/enabled=false From 82c34de0c2e662d83a6fd367a780572619a95271 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Thu, 22 Feb 2018 11:49:14 +0100 Subject: [PATCH 37/44] GPII-1230: Fixing the last remaining tests, still missing documentation and linting --- .../canopyMatchMaker/src/CanopyMatchMaker.js | 4 +- .../src/CanopyMatchMakerUtilities.js | 12 +- .../test/CanopyMatchMakerTests.js | 198 +++++++++++-- ..._mm_payload1.json => pre_mm_payload1.json} | 7 - ..._mm_payload2.json => pre_mm_payload2.json} | 11 +- .../web/js/CanopyMatchMakerUtilitiesTests.js | 12 +- .../flatMatchMaker/src/FlatMatchMaker.js | 2 +- .../test/FlatMatchMakerTests.js | 3 +- ..._mm_payload1.json => pre_mm_payload1.json} | 16 - .../flowManager/src/FlowManagerRequests.js | 2 +- .../src/MatchMakerFramework.js | 25 -- .../src/MatchMakerUtilities.js | 114 ++++--- ...hMakerUtilitiesDisposeFromPriorityTests.js | 7 +- .../test/js/MatchMakerUtilitiesTests.js | 210 ++++--------- testData/solutions/android.json5 | 67 +---- testData/solutions/linux.json5 | 130 +------- testData/solutions/win32.json5 | 278 +----------------- 17 files changed, 361 insertions(+), 737 deletions(-) rename gpii/node_modules/canopyMatchMaker/test/data/{full_mm_payload1.json => pre_mm_payload1.json} (94%) rename gpii/node_modules/canopyMatchMaker/test/data/{full_mm_payload2.json => pre_mm_payload2.json} (94%) rename gpii/node_modules/flatMatchMaker/test/data/{full_mm_payload1.json => pre_mm_payload1.json} (82%) diff --git a/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMaker.js b/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMaker.js index 04113db2d..6dcd86693 100644 --- a/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMaker.js +++ b/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMaker.js @@ -78,8 +78,8 @@ gpii.canopyMatchMaker.matchPost.handleRequest = function (canopyMatchMaker, requ */ gpii.canopyMatchMaker.match = function (ontologyHandler, payload, disposeStrategy) { // augment payload with inferred common terms - payload.preferences = gpii.matchMakerFramework.utils.addInferredCommonTerms(payload.preferences, payload.inferredCommonTerms); - gpii.matchMakerFramework.utils.addCapabilitiesInformation(payload); + payload.preferences = gpii.matchMakerFramework.utils.addInferredCommonTermsToPreferences(payload.preferences, payload.inferredCommonTerms); + // gpii.matchMakerFramework.utils.addCapabilitiesInformation(payload); // augment payload with information about the solution types var appTransformSpec = gpii.ontologyHandler.getTransformSpec(ontologyHandler.ontologyTransformSpecs, "flat", "apptology"); diff --git a/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js b/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js index e6cee813c..c6827193f 100644 --- a/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js +++ b/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js @@ -103,7 +103,7 @@ gpii.canopyMatchMaker.utils.disposeFromCanopy = function (leaves, ranked, solrec for (var i = 0; i < ranked.length; ++i) { var sol = solrecs[ranked[i]]; - if (sol.disposition === "reject" || sol.active === false) { + if (sol.disposition === "reject") { // TODO KASPER || sol.active === false) { continue; } @@ -116,7 +116,11 @@ gpii.canopyMatchMaker.utils.disposeFromCanopy = function (leaves, ranked, solrec } } if (inCanopy) { - var prefActive = gpii.matchMakerFramework.utils.getActiveFromEnabledTerms(data.specialPrefs[contextId] || {}, data.specialCapabilities[sol.index], data.solutionsRegistryEntries[sol.index], sol.index); + // if solution is already disposed, dont redo it. Previous steps make sure canopy is raised accordingly + if (sol.disposition !== undefined) { + continue; + } + var prefActive = gpii.matchMakerFramework.utils.getActiveValueFromEnabledTerms(data.specialPreferences[contextId] || {}, data.specialCapabilities[sol.index], data.solutionsRegistryEntries[sol.index], sol.index); sol.disposition = "accept"; sol.active = (prefActive !== undefined) ? prefActive : true; sol.dispositionReason = "Was the solution of this type that best fit user preferences"; @@ -124,6 +128,10 @@ gpii.canopyMatchMaker.utils.disposeFromCanopy = function (leaves, ranked, solrec data.solutionTypeMapping, solrecs, "Another solution (" + sol.index + ") covering more preferences was found found."); } else { + // if solution is already disposed, dont redo it. Previous steps make sure canopy is raised accordingly + if (sol.disposition !== undefined) { + continue; + } sol.disposition = "reject"; sol.dispositionReason = "Was not in canopy."; } diff --git a/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js b/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js index 3d73f0777..b52ec78d0 100644 --- a/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js +++ b/gpii/node_modules/canopyMatchMaker/test/CanopyMatchMakerTests.js @@ -45,7 +45,7 @@ fluid.defaults("gpii.canopyMatchMaker.tests", { var matchFixtures = [ { description: "Screenreader preference -> screenreader should be launched and configured", - input: require("./data/full_mm_payload2.json"), + input: require("./data/pre_mm_payload2.json"), preferences: { "gpii-default": { "name": "Default preferences", @@ -70,7 +70,7 @@ var matchFixtures = [ } }, { description: "Screenreader preference (not matching apptology) -> screenreader should be launched and configured", - input: require("./data/full_mm_payload2.json"), + input: require("./data/pre_mm_payload2.json"), preferences: { "gpii-default": { "name": "Default preferences", @@ -95,7 +95,7 @@ var matchFixtures = [ } }, { description: "Two magnifier preferences->best fit is launched, the other one should not run", - input: require("./data/full_mm_payload2.json"), + input: require("./data/pre_mm_payload2.json"), preferences: { "gpii-default": { "name": "Default preferences", @@ -128,7 +128,7 @@ var matchFixtures = [ } }, { description: "Equally good magnifier fit->first hit is launched", - input: require("./data/full_mm_payload2.json"), + input: require("./data/pre_mm_payload2.json"), preferences: { "gpii-default": { "name": "Default preferences", @@ -159,7 +159,7 @@ var matchFixtures = [ } }, { description: "magnifier and screen reader pref->both are launched", - input: require("./data/full_mm_payload2.json"), + input: require("./data/pre_mm_payload2.json"), preferences: { "gpii-default": { "name": "Default preferences", @@ -198,7 +198,7 @@ var matchFixtures = [ }, { description: "APPLICATION PRIORITIES: prioritized magnifier is launched despite " + "the other one being first hit", - input: require("./data/full_mm_payload2.json"), + input: require("./data/pre_mm_payload2.json"), preferences: { "gpii-default": { "name": "Default preferences", @@ -236,7 +236,7 @@ var matchFixtures = [ } }, { description: "APPLICATION PRIORITIES: Different priority levels for magnifiers", - input: require("./data/full_mm_payload2.json"), + input: require("./data/pre_mm_payload2.json"), preferences: { "gpii-default": { "name": "Default preferences", @@ -281,7 +281,7 @@ var matchFixtures = [ }, { description: "APPLICATION PRIORITIES: Same priority levels for magnifiers," + " - where canopy uses first hit match", - input: require("./data/full_mm_payload2.json"), + input: require("./data/pre_mm_payload2.json"), preferences: { "gpii-default": { "name": "Default preferences", @@ -326,7 +326,7 @@ var matchFixtures = [ }, { description: "APPLICATION PRIORITIES: Same priority levels for magnifiers" + " - best canopy fit selected", - input: require("./data/full_mm_payload2.json"), + input: require("./data/pre_mm_payload2.json"), preferences: { "gpii-default": { "name": "Default preferences", @@ -372,7 +372,7 @@ var matchFixtures = [ } }, { description: "Application specific preference for magnifier - overrides canopy best fit", - input: require("./data/full_mm_payload2.json"), + input: require("./data/pre_mm_payload2.json"), preferences: { "gpii-default": { "name": "Default preferences", @@ -401,7 +401,7 @@ var matchFixtures = [ } }, { description: "Application settings for multiple magnifiers - canopy best fit used", - input: require("./data/full_mm_payload2.json"), + input: require("./data/pre_mm_payload2.json"), preferences: { "gpii-default": { "name": "Default preferences", @@ -433,7 +433,7 @@ var matchFixtures = [ } }, { description: "Application settings for app with no specific type", - input: require("./data/full_mm_payload2.json"), + input: require("./data/pre_mm_payload2.json"), preferences: { "gpii-default": { "name": "Default preferences", @@ -458,7 +458,7 @@ var matchFixtures = [ } }, { description: "Expl. user priorities overrides application settings implicit priority", - input: require("./data/full_mm_payload2.json"), + input: require("./data/pre_mm_payload2.json"), preferences: { "gpii-default": { "name": "Default preferences", @@ -496,9 +496,173 @@ var matchFixtures = [ } } } + }, { + description: "/enabled support - when 'magnification/enabled: false' preference comes from transformation, we still have 'active: true'", + input: require("./data/pre_mm_payload2.json"), + preferences: { + "gpii-default": { + "name": "Default preferences", + "preferences": { + "http://registry.gpii.net/common/magnification": 150, + "http://registry.gpii.net/common/magnification/enabled": false + }, + "metadata": [{ // We select fakemag2 + "type": "priority", + "scope": [ + "http://registry.gpii.net/applications/fakemag2" + ], + "value": 1024 + }] + } + }, + expect: { + "inferredConfiguration": { + "gpii-default": { + "applications": { + "fakemag1": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150, + "http://registry.gpii.net/common/magnification/enabled": false + } + }, + "fakemag2": { + "active": true, + "settings": { + "http://registry.gpii.net/common/magnification": 150, + "http://registry.gpii.net/common/magnification/enabled": false + } + } + } + } + } + } + }, { + description: "/enabled support - when 'magnification/enabled: true' preference comes from transformation, we still have 'active: true' only on relevant solution", + input: require("./data/pre_mm_payload2.json"), + preferences: { + "gpii-default": { + "name": "Default preferences", + "preferences": { + "http://registry.gpii.net/common/magnification": 150, + "http://registry.gpii.net/common/magnification/enabled": true + }, + "metadata": [{ // We select fakemag2 + "type": "priority", + "scope": [ + "http://registry.gpii.net/applications/fakemag2" + ], + "value": 1024 + }] + } + }, + expect: { + "inferredConfiguration": { + "gpii-default": { + "applications": { + "fakemag1": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150, + "http://registry.gpii.net/common/magnification/enabled": true + } + }, + "fakemag2": { + "active": true, + "settings": { + "http://registry.gpii.net/common/magnification": 150, + "http://registry.gpii.net/common/magnification/enabled": true + } + } + } + } + } + } + }, { + description: "/enabled support - when 'magnification/enabled: false' preference comes from capabilities block, we have 'active: false'", + input: require("./data/pre_mm_payload2.json"), + preferences: { + "gpii-default": { + "name": "Default preferences", + "preferences": { + "http://registry.gpii.net/common/magnification": 150, + "http://registry.gpii.net/common/magnification/enabled": false + }, + "metadata": [{ // We select fakemag1 + "type": "priority", + "scope": [ + "http://registry.gpii.net/applications/fakemag1" + ], + "value": 1024 + }] + } + }, + expect: { + "inferredConfiguration": { + "gpii-default": { + "applications": { + "fakemag1": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150, + "http://registry.gpii.net/common/magnification/enabled": false + } + }, + "fakemag2": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150, + "http://registry.gpii.net/common/magnification/enabled": false + } + } + } + } + } + } + }, { + description: "/enabled support - when 'magnification/enabled: true' preference comes from capabilities block, we have 'active: true'", + input: require("./data/pre_mm_payload2.json"), + preferences: { + "gpii-default": { + "name": "Default preferences", + "preferences": { + "http://registry.gpii.net/common/magnification": 150, + "http://registry.gpii.net/common/magnification/enabled": true + }, + "metadata": [{ // We select fakemag1 + "type": "priority", + "scope": [ + "http://registry.gpii.net/applications/fakemag1" + ], + "value": 1024 + }] + } + }, + expect: { + "inferredConfiguration": { + "gpii-default": { + "applications": { + "fakemag1": { + "active": true, + "settings": { + "http://registry.gpii.net/common/magnification": 150, + "http://registry.gpii.net/common/magnification/enabled": true + } + }, + "fakemag2": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification": 150, + "http://registry.gpii.net/common/magnification/enabled": true + } + } + } + } + } + } }, { description: "GPII-2074: Non-matching applications are ignored", - input: require("./data/full_mm_payload2.json"), + input: require("./data/pre_mm_payload2.json"), preferences: { "gpii-default": { "name": "Default preferences", @@ -521,9 +685,9 @@ var matchFixtures = [ gpii.canopyMatchMaker.tests.match = function (ontologyHandler) { fluid.each(matchFixtures, function (fixture) { - fluid.set(fixture.input, ["preferences", "contexts"], fixture.preferences); - fluid.set(fixture.input, ["specialPrefs"], gpii.matchMakerFramework.utils.findSpecialPreferences(fixture.input.preferences)); - var result = gpii.canopyMatchMaker.match(ontologyHandler, fixture.input, gpii.canopyMatchMaker.utils.disposeStrategy); + fluid.set(fixture.input, ["preferences", "contexts"], fixture.preferences); // add testCase specific preferences + var mmInput = gpii.matchMakerFramework.utils.preProcess(fixture.input); // run MM preprocessing to add datastructures + var result = gpii.canopyMatchMaker.match(ontologyHandler, mmInput, gpii.canopyMatchMaker.utils.disposeStrategy); jqUnit.assertDeepEq(fixture.description, fixture.expect, result); }); }; diff --git a/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload1.json b/gpii/node_modules/canopyMatchMaker/test/data/pre_mm_payload1.json similarity index 94% rename from gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload1.json rename to gpii/node_modules/canopyMatchMaker/test/data/pre_mm_payload1.json index 55e437fab..840ce5861 100644 --- a/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload1.json +++ b/gpii/node_modules/canopyMatchMaker/test/data/pre_mm_payload1.json @@ -75,12 +75,5 @@ "start": [], "stop": [] } - }, - "activeContexts": [ - "gpii-default" - ], - "environmentReporter": {}, - "inferredCommonTerms": { - "gpii-default": {} } } \ No newline at end of file diff --git a/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload2.json b/gpii/node_modules/canopyMatchMaker/test/data/pre_mm_payload2.json similarity index 94% rename from gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload2.json rename to gpii/node_modules/canopyMatchMaker/test/data/pre_mm_payload2.json index 703aef92c..647c2e040 100644 --- a/gpii/node_modules/canopyMatchMaker/test/data/full_mm_payload2.json +++ b/gpii/node_modules/canopyMatchMaker/test/data/pre_mm_payload2.json @@ -59,9 +59,6 @@ } ] }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/magnification/enabled" - ], "settingsHandlers": { "configuration": { "type": "gpii.settingsHandlers.JSONSettingsHandler", @@ -69,6 +66,7 @@ "filename": "/tmp/fakemag2.settings.json" }, "capabilitiesTransformations": { + "enableMagnification": "http://registry\\.gpii\\.net/common/magnification/enabled", "magnification": "http://registry\\.gpii\\.net/common/magnification", "invert": "http://registry\\.gpii\\.net/common/invertColours" } @@ -137,12 +135,5 @@ } } } - }, - "activeContexts": [ - "gpii-default" - ], - "environmentReporter": {}, - "inferredCommonTerms": { - "gpii-default": {} } } \ No newline at end of file diff --git a/gpii/node_modules/canopyMatchMaker/test/web/js/CanopyMatchMakerUtilitiesTests.js b/gpii/node_modules/canopyMatchMaker/test/web/js/CanopyMatchMakerUtilitiesTests.js index e860c5bc2..f0c559153 100644 --- a/gpii/node_modules/canopyMatchMaker/test/web/js/CanopyMatchMakerUtilitiesTests.js +++ b/gpii/node_modules/canopyMatchMaker/test/web/js/CanopyMatchMakerUtilitiesTests.js @@ -158,7 +158,17 @@ gpii.tests.canopyMatchMaker.runBasicTests = function () { "lesserMag": lesserMagnifier, "mag": magnifier }; - var solrecs = gpii.matchMakerFramework.utils.expandSolutions(solutions, { "*": "*" }); + var capabilities = { + lesserMag: [ + "display.screenEnhancement.magnification" + ], + mag: [ + "display.screenEnhancement.magnification", + "display.screenEnhancement.-provisional-showCrosshairs", + "display.screenEnhancement.tracking" + ] + } + var solrecs = gpii.matchMakerFramework.utils.expandSolutions(solutions, capabilities, { "*": "*" }); var ranked = gpii.canopyMatchMaker.utils.rankSolutions(sammyLeaves, solrecs, gpii.canopyMatchMaker.utils.ISO24751.ontologicalMetric); var minimalData = { solutionTypes: { diff --git a/gpii/node_modules/flatMatchMaker/src/FlatMatchMaker.js b/gpii/node_modules/flatMatchMaker/src/FlatMatchMaker.js index 30a733809..b076e5f9e 100644 --- a/gpii/node_modules/flatMatchMaker/src/FlatMatchMaker.js +++ b/gpii/node_modules/flatMatchMaker/src/FlatMatchMaker.js @@ -78,7 +78,7 @@ * buildReturnPayload function of the MM framework. */ gpii.flatMatchMaker.match = function (ontologyHandler, payload, disposeStrategy) { - payload.preferences = gpii.matchMakerFramework.utils.addInferredCommonTerms(payload.preferences, payload.inferredCommonTerms); + payload.preferences = gpii.matchMakerFramework.utils.addInferredCommonTermsToPreferences(payload.preferences, payload.inferredCommonTerms); payload.hierarchicalPrefs = ontologyHandler.prefsToOntology(payload.preferences, "flat", "ISO24751"); var transformSpec = gpii.ontologyHandler.getTransformSpec(ontologyHandler.ontologyTransformSpecs, "flat", "ISO24751"); diff --git a/gpii/node_modules/flatMatchMaker/test/FlatMatchMakerTests.js b/gpii/node_modules/flatMatchMaker/test/FlatMatchMakerTests.js index 6bb3b84ce..a3726f990 100644 --- a/gpii/node_modules/flatMatchMaker/test/FlatMatchMakerTests.js +++ b/gpii/node_modules/flatMatchMaker/test/FlatMatchMakerTests.js @@ -132,7 +132,7 @@ var matchFixtures = [ { description: "Full match call test", - input: require("./data/full_mm_payload1.json"), + input: require("./data/pre_mm_payload1.json"), expect: { "inferredConfiguration": { "gpii-default": { @@ -155,6 +155,7 @@ gpii.flatMatchMaker.tests.match = function (ontologyHandler) { fluid.each(matchFixtures, function (fixture) { + fixture.input = gpii.matchMakerFramework.utils.preProcess(fixture.input); var result = gpii.flatMatchMaker.match(ontologyHandler, fixture.input, gpii.flatMatchMaker.disposeStrategy); jqUnit.assertDeepEq(fixture.description, fixture.expect, result); }); diff --git a/gpii/node_modules/flatMatchMaker/test/data/full_mm_payload1.json b/gpii/node_modules/flatMatchMaker/test/data/pre_mm_payload1.json similarity index 82% rename from gpii/node_modules/flatMatchMaker/test/data/full_mm_payload1.json rename to gpii/node_modules/flatMatchMaker/test/data/pre_mm_payload1.json index d4982eb78..840ce5861 100644 --- a/gpii/node_modules/flatMatchMaker/test/data/full_mm_payload1.json +++ b/gpii/node_modules/flatMatchMaker/test/data/pre_mm_payload1.json @@ -27,15 +27,6 @@ "version": "12.5.0" } }, - "solutionCapabilities": { - "mac.dummy": [ - "http://registry\\.gpii\\.net/common/fontSize", - "http://registry\\.gpii\\.net/common/magnification/enabled", - "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled", - "http://registry\\.gpii\\.net/common/magnification" - ], - "mac.dummy_empty": [] - }, "solutionsRegistryEntries": { "mac.dummy": { "name": "Mac dummy", @@ -84,12 +75,5 @@ "start": [], "stop": [] } - }, - "activeContexts": [ - "gpii-default" - ], - "environmentReporter": {}, - "inferredCommonTerms": { - "gpii-default": {} } } \ No newline at end of file diff --git a/gpii/node_modules/flowManager/src/FlowManagerRequests.js b/gpii/node_modules/flowManager/src/FlowManagerRequests.js index 7d63c81fa..f36c885e0 100644 --- a/gpii/node_modules/flowManager/src/FlowManagerRequests.js +++ b/gpii/node_modules/flowManager/src/FlowManagerRequests.js @@ -180,7 +180,7 @@ processMatch: [{ // Definition of the MatchMaking processing chain priority: gpii.flowManager.processMatch.priorities.preProcess, namespace: "preProcess", - listener: "{flowManager}.matchMakerFramework.preProcess" + listener: "gpii.matchMakerFramework.utils.preProcess" }, { priority: gpii.flowManager.processMatch.priorities.matchMakerDispatcher, namespace: "matchMakerDispatcher", diff --git a/gpii/node_modules/matchMakerFramework/src/MatchMakerFramework.js b/gpii/node_modules/matchMakerFramework/src/MatchMakerFramework.js index f54221c07..26d122405 100644 --- a/gpii/node_modules/matchMakerFramework/src/MatchMakerFramework.js +++ b/gpii/node_modules/matchMakerFramework/src/MatchMakerFramework.js @@ -38,10 +38,6 @@ fluid.defaults("gpii.matchMakerFramework", { } }, invokers: { - preProcess: { - funcName: "gpii.matchMakerFramework.preProcess", - args: ["{that}", "{arguments}.0"] - }, // initialPayload matchMakerDispatcher: { funcName: "gpii.matchMakerFramework.matchMakerDispatcher", args: ["{that}", "{arguments}.0"] @@ -52,27 +48,6 @@ fluid.defaults("gpii.matchMakerFramework", { } }); -/* - * responsible for building the input payload to the matchmaker, via a bunch of helper functions - * initialPayload consists of: - * userToken, preferences, deviceContext, solutionsRegistryEntries - */ -gpii.matchMakerFramework.preProcess = function (that, initialPayload) { - var matchMakerInput = fluid.extend({ - activeContexts: [ // TODO calculate properly - "gpii-default" - ], - environmentReporter: {}, // TODO, - inferredCommonTerms: gpii.matchMakerFramework.utils.inferCommonTerms(initialPayload.preferences, initialPayload.fullSolutionsRegistry), - specialPrefs: gpii.matchMakerFramework.utils.findSpecialPreferences(initialPayload.preferences) - }, initialPayload); - // remove full solutions registry from the payload, now that we've used it - // to avoid sending a too large payload to the matchmaker (see GPII-1880) - delete matchMakerInput.fullSolutionsRegistry; - - return matchMakerInput; -}; - /** * Asynchronous function responsible for, given a matchMaker input payload, deciding which matchmaker is most * suitable to do the actual matching process and send the payload there. Once the matchmaker diff --git a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js index feffca1fd..d8d50274d 100644 --- a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js +++ b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js @@ -36,6 +36,27 @@ var fluid = fluid || require("infusion"), gpii.matchMakerFramework.APP_SETTING_PRIORITY = 512; gpii.matchMakerFramework.MIN_USER_PRIORITY = 1024; + /* + * responsible for building the input payload to the matchmaker, via a bunch of helper functions + * initialPayload consists of: + * userToken, preferences, deviceContext, solutionsRegistryEntries + */ + gpii.matchMakerFramework.utils.preProcess = function (initialPayload) { + var matchMakerInput = fluid.extend({ + activeContexts: [ // TODO calculate properly + "gpii-default" + ], + environmentReporter: {}, // TODO, + inferredCommonTerms: gpii.matchMakerFramework.utils.inferCommonTerms(initialPayload.preferences, initialPayload.fullSolutionsRegistry), + specialPreferences: gpii.matchMakerFramework.utils.findSpecialPreferences(initialPayload.preferences) + }, initialPayload); + gpii.matchMakerFramework.utils.addCapabilitiesInformation(matchMakerInput); + // remove full solutions registry from the payload, now that we've used it + // to avoid sending a too large payload to the matchmaker (see GPII-1880) + delete matchMakerInput.fullSolutionsRegistry; + + return matchMakerInput; + }; /** * extracts the capabilities from a settingshandler block based on the `capabilities` entry @@ -46,10 +67,18 @@ var fluid = fluid || require("infusion"), }; /** - // TODO KASPER UPDATE DOCS - * Helper function for computeAndOntologizeCapabilitiesFromSolution. Takes an array of paths as input - * and returns them in the ontology provided via the transform spec - */ + * Takes an array of paths as input and returns them in the ontology provided via the transform spec. + * The result will be an array list of el-paths in the ontology transformed to. + * + * @param paths {Array} An array of supported capabilities by a solution (as returned by the + * gpii.matchMakerFramework.utils.computeCapabilitiesFromSolution function) + * @param transformSpec {Object} transformation rules to transform the input paths from the solution + * registry format into the format desired in the output array. If if one would like the result + * as a list of ISO24751 el-paths and the solutionsregistry transformations are given in + * the flat format, a transformation rules for 'flat' to ISO24751 should be given + * @return {Array} An array of el-paths to all the input paths of the given capabilities in the + * ontology produced by the transformSpec + */ gpii.matchMakerFramework.utils.transformCapabilitiesToOntologizedLeaves = function (paths, transformSpec) { // Input paths are flat so need to be transformed into hierarchical var skel = gpii.matchMakerFramework.utils.pathsToSkeleton(paths, true); @@ -59,20 +88,12 @@ var fluid = fluid || require("infusion"), }; /** - // TODO KASPER: Update docs * Given a solution entry, all the capabilities of that solution will be calculated based on * input paths in the transformations (specified in the capabilitiesTransformations block) and - * on the list in the capabilities block of that solution. The collected capabilities will be - * transformed via the transformspec, and the result will be an array list of el-paths in the - * ontology transformed to. + * on the list in the capabilities block of that solution * * @param solution {Object} A single solution entry, as can be found in the solutions registry - * @param transformSpec {Object} transformation rules to transform the input paths from the solution - * registry format into the format desired in the output array. If if one would like the result - * as a list of ISO24751 el-paths and the solutionsregistry transformations are given in - * the flat format, a transformation rules for 'flat' to ISO24751 should be given - * @return {Array} An array of el-paths to all the input paths of the capabilitiesTransformations - * concatenated with the list given in the capabilities block of the solution entry. + * @return {Array} An array capabilities supported by the given solution */ gpii.matchMakerFramework.utils.computeCapabilitiesFromSolution = function (solution) { var paths = []; @@ -168,16 +189,28 @@ var fluid = fluid || require("infusion"), }); }; - /* TODO KASPER: Doc and tests */ - gpii.matchMakerFramework.utils.getActiveFromEnabledTerms = function (specialPrefs, specialCapabilities, solution, solutionId) { + /** + * Based on the /enabled terms from a users' NP set and the /enabled capabilities from the solution, + * this function returns what the 'active' value of the solution should be. + * + * @param specialPreferences {Object} the specialPreferences value of the relevant context (from the value of the same name in the match maker input payload) + * @param specialCapabilities {Array} the solutions specialCapabilities (from the value of the same name in the match maker input payload) + * @param solution {Object} the solution registry entry of the solution for which to decide the 'active' value + * @param solutionId {String} the solution id + * @return {boolean} the value of the 'active' flag of the solution. + **/ + gpii.matchMakerFramework.utils.getActiveValueFromEnabledTerms = function (specialPreferences, specialCapabilities, solution, solutionId) { var active; // see if solution has any enabled flags: fluid.each(specialCapabilities, function (term) { // if we have an /enabled term and this is not just a settings transformation: if (term.endsWith("/enabled") && solution.capabilities && solution.capabilities.includes(term)) { - // set the active flag based on the users' preference value - active = fluid.get(specialPrefs, [ solutionId, term ]) || specialPrefs[term]; + // set the active flag based on the users' preference value (from solution specific pref or general pref) + active = fluid.get(specialPreferences[solutionId], term, fluid.model.escapedGetConfig); + if (active === undefined) { + active = fluid.get(specialPreferences, term, fluid.model.escapedGetConfig); + } } }); @@ -295,7 +328,7 @@ var fluid = fluid || require("infusion"), // if no ties, mark the current solution as "accept" if (tied.length === 0) { solrecs[solutionId].disposition = "accept"; - var prefActive = gpii.matchMakerFramework.utils.getActiveFromEnabledTerms(data.specialPrefs[contextId] || {}, + var prefActive = gpii.matchMakerFramework.utils.getActiveValueFromEnabledTerms(data.specialPreferences[contextId] || {}, data.specialCapabilities[solutionId], data.solutionsRegistryEntries[solutionId], solutionId); @@ -494,7 +527,7 @@ var fluid = fluid || require("infusion"), * @param inferred {Object} Inferred common terms, as provided in the MM input * @return {Object} A copy of the preferences object with the inferred common terms merged in */ - gpii.matchMakerFramework.utils.addInferredCommonTerms = function (preferences, inferred) { + gpii.matchMakerFramework.utils.addInferredCommonTermsToPreferences = function (preferences, inferred) { var togo = fluid.copy(preferences); fluid.each(inferred, function (context, contextId) { var tcont = togo.contexts[contextId]; @@ -505,7 +538,13 @@ var fluid = fluid || require("infusion"), return togo; }; - /** TODO doc + tests **/ + /** + * Simple function that takes a list of capabilities and extract all 'special' capabilities. + * This is currently all terms ending with /enabled + * + * @param capabilities {Array} an array of term/capabilities + * @return {Array} an array of all capabilities that are special (i.e. ends with /enabled) + **/ gpii.matchMakerFramework.utils.extractSpecialCapabilities = function (capabilities) { return fluid.remove_if(fluid.copy(capabilities), function (term) { return !term.endsWith("/enabled"); @@ -513,9 +552,10 @@ var fluid = fluid || require("infusion"), }; /** - * Adds information about the supported capabilities for each solution (in the flat format). - * The result will be a list of inputPaths from the capabilitiesTransformations of the settingshandlers - * as well as the content of the solutions "capabiliites" entry. + * Adds information about the supported capabilities for each solution (in the flat format) and special capabilities. + * Two things will be added to the payload: + * (1) A list of inputPaths from the capabilitiesTransformations of the settingshandlers as well as the content of the solutions "capabiliites" entry. + * (2) A list of special capabilities, meaning the (1) list run through the extractSpecialCapabilities function * * NOTE: This will modify the supplied payload * @@ -550,20 +590,14 @@ var fluid = fluid || require("infusion"), * a solution type ontology. */ gpii.matchMakerFramework.utils.addSolutionTypeInformation = function (payload, transformSpec) { - fluid.each(payload.solutionCapabilities, function (entry, entryId) { + fluid.each(payload.solutionCapabilities, function (capabilities, solutionId) { // first get an array of what solution types the current entry is: - var solutionTypes = gpii.matchMakerFramework.utils.transformCapabilitiesToOntologizedLeaves(entry, transformSpec); - // // Make sure entries are unique // TODO KASPER - // var uniqueTypes = {}; - // fluid.each(solutionTypes, function (type) { - // uniqueTypes[type] = true; - // }); - // solutionTypes = Object.keys(uniqueTypes); - fluid.set(payload, [ "solutionTypes", entryId], solutionTypes); + var solutionTypes = gpii.matchMakerFramework.utils.transformCapabilitiesToOntologizedLeaves(capabilities, transformSpec); + fluid.set(payload, [ "solutionTypes", solutionId], solutionTypes); // now add solution ID to the return array in the appropriate places: for (var i in solutionTypes) { // add solution ID to the solution type - fluid.set(payload, ["solutionTypeMapping", solutionTypes[i], entryId], true); + fluid.set(payload, ["solutionTypeMapping", solutionTypes[i], solutionId], true); } }); }; @@ -612,7 +646,17 @@ var fluid = fluid || require("infusion"), return togo; }; - /** TODO KASPER: Doc and tests + /** + * Given a preference set, return a nested structure of context->appliactionBlock->special setting->value + * and context->special setting->value. + * + * This function will walk an NP set and look for any /enabled terms. Anything that is not an /enabled + * term will not be kept. A structure if returned containing the contexts on the outer level. Each context + * will have any non application specific /enabled terms, as well as any application block with its contained + * /enabled terms. + * + * @preferences {Object} a preferences set + * @return {Object} The NP set with only context names and /enabled terms */ gpii.matchMakerFramework.utils.findSpecialPreferences = function (preferences) { return fluid.transform(fluid.copy(preferences.contexts), function (context) { diff --git a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js index 4ed88c15b..842269c88 100644 --- a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js +++ b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesDisposeFromPriorityTests.js @@ -88,7 +88,10 @@ var fluid = fluid || require("infusion"), solC: true, solD: true } - } + }, + specialCapabilities: {}, + specialPreferences: {}, + solutionsRegistryEntries: {} } }; @@ -168,7 +171,7 @@ var fluid = fluid || require("infusion"), gpii.tests.matchMakerUtilities.disposeFromPriority.singleTest = function (priorities, expectedDispositions) { var input = gpii.tests.matchMakerUtilities.disposeFromPriority.setPriorities(priorities); - gpii.matchMakerFramework.utils.disposeFromPriority(input.solrecs, input.data TODO KASPER); + gpii.matchMakerFramework.utils.disposeFromPriority(input.solrecs, input.data, undefined); fluid.each(fullData.solIds, function (solId, index) { var msg = "Expecting solution " + solId + " to be: " + expectedDispositions[index]; var actual = input.solrecs[solId].disposition ? input.solrecs[solId].active : undefined; diff --git a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js index 8f0733705..1cd36d3ed 100644 --- a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js +++ b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js @@ -187,11 +187,11 @@ var fluid = fluid || require("infusion"), var computeAndOntologizeCapabilitiesFromSolutionFixture = { description: "solution incl capabilities and transformations", - model: { + solution: { "name": "GNOME Shell Magnifier", "contexts": {}, "capabilities": [ - "http://registry\.gpii\\.net/common/magnification/enabled" + "http://registry\\.gpii\\.net/common/magnification/enabled" ], "settingsHandlers": { "configuration": { @@ -218,42 +218,14 @@ var fluid = fluid || require("infusion"), "type": "fluid.transforms.valueMapper", "defaultInputPath": "http://registry\\.gpii\\.net/common/magnifierPosition", "match": { - "FullScreen": "full-screen", - "Lens": "full-screen", - "LeftHalf": "left-half", - "RightHalf": "right-half", - "TopHalf": "top-half", - "BottomHalf": "bottom-half" - }, - "noMatch": { - "outputValue": "full-screen" + "FullScreen": "full-screen" } } - } + }, + "someSetting": "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled" } } }, - "update": [ - "settings.configuration" - ], - "configure": [ - "settings.configuration" - ], - "restore": [ - "settings.configuration" - ], - "start": [ - { - "type": "gpii.launch.exec", - "command": "gsettings set org.gnome.desktop.a11y.applications screen-magnifier-enabled true" - } - ], - "stop": [ - { - "type": "gpii.launch.exec", - "command": "gsettings set org.gnome.desktop.a11y.applications screen-magnifier-enabled false" - } - ], "isInstalled": [ { "type": "gpii.packageKit.find", @@ -261,25 +233,46 @@ var fluid = fluid || require("infusion"), } ] }, + expectedCapabilities: [ + "http://registry\\.gpii\\.net/common/tracking", + "http://registry\\.gpii\\.net/common/magnification", + "http://registry\\.gpii\\.net/common/showCrosshairs", + "http://registry\\.gpii\\.net/common/magnifierPosition", + "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled", + "http://registry\\.gpii\\.net/common/magnification/enabled" + ], + expectedSpecialCapabilities: [ + "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled", + "http://registry\\.gpii\\.net/common/magnification/enabled" + ], expectedISO: [ "display.screenEnhancement.tracking", "display.screenEnhancement.magnification", - "display.screenEnhancement.-provisional-magnifierPosition" + "display.screenEnhancement.-provisional-magnifierPosition", + "display.screenEnhancement.-provisional-magnification/enabled", + "display.screenReader.-provisional-screenReaderTTS/enabled" ], expectedApptology: [ - "http://registry\\.gpii\\.net/common/magnifierApplication" + "http://registry\\.gpii\\.net/common/magnifierApplication", + "http://registry\\.gpii\\.net/common/screenReaderApplication" ] }; gpii.tests.matchMakerUtilities.computeAndOntologizeCapabilitiesFromSolution = function () { var fixture = computeAndOntologizeCapabilitiesFromSolutionFixture; - var flatToISOSpec = fluid.model.transform.invertConfiguration(transformSpec); - var resultISO = gpii.matchMakerFramework.utils.computeAndOntologizeCapabilitiesFromSolution(fixture.model, flatToISOSpec); - jqUnit.assertDeepEq(fixture.description, fixture.expectedISO, resultISO); + var capabilities = gpii.matchMakerFramework.utils.computeCapabilitiesFromSolution(fixture.solution); + jqUnit.assertDeepEq("Capabilities computed by gpii.matchMakerFramework.utils.computeCapabilitiesFromSolution", fixture.expectedCapabilities, capabilities); + + var specialCapabilities = gpii.matchMakerFramework.utils.extractSpecialCapabilities(capabilities); + jqUnit.assertDeepEq("Special capabilities computed by gpii.matchMakerFramework.utils.extractSpecialCapabilities", fixture.expectedSpecialCapabilities, specialCapabilities); - // var resultApptology = gpii.matchMakerFramework.utils.computeAndOntologizeCapabilitiesFromSolution(fixture.model, apptologyTransformSpec); - // jqUnit.assertDeepEq(fixture.description, fixture.expectedApptology, resultApptology); + var flatToISOSpec = fluid.model.transform.invertConfiguration(transformSpec); + var resultISO = gpii.matchMakerFramework.utils.transformCapabilitiesToOntologizedLeaves(capabilities, flatToISOSpec); + jqUnit.assertDeepEq("Capabilities to ISO leaves (gpii.matchMakerFramework.utils.transformCapabilitiesToOntologizedLeaves)", fixture.expectedISO, resultISO); + + var resultApptology = gpii.matchMakerFramework.utils.transformCapabilitiesToOntologizedLeaves(capabilities, apptologyTransformSpec); + jqUnit.assertDeepEq("Capabilities to apptology (gpii.matchMakerFramework.utils.transformCapabilitiesToOntologizedLeaves)", fixture.expectedApptology, resultApptology); }; var buildReturnPayloadFixtures = [ @@ -549,10 +542,10 @@ var fluid = fluid || require("infusion"), } ]; - gpii.tests.matchMakerUtilities.testaddInferredCommonTerms = function () { + gpii.tests.matchMakerUtilities.testaddInferredCommonTermsToPreferences = function () { jqUnit.module("Inferred common terms merging"); fluid.each(inferredCommonfixtures, function (fixture) { - var result = gpii.matchMakerFramework.utils.addInferredCommonTerms(fixture.preferences, fixture.inferred); + var result = gpii.matchMakerFramework.utils.addInferredCommonTermsToPreferences(fixture.preferences, fixture.inferred); jqUnit.assertDeepEq(fixture.name, fixture.expect, result); }); }; @@ -560,121 +553,22 @@ var fluid = fluid || require("infusion"), var addSolutionTypeInformationFixtures = [{ name: "Three solutions, two of same type", payload: { - solutionsRegistryEntries: { - "fakemag1": { - "name": "Fake Magnifier 1", - "contexts": { - "OS": [ - { - "id": "darwin" - } - ] - }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/magnification/enabled" - ], - "settingsHandlers": { - "configuration": { - "type": "gpii.settingsHandlers.JSONSettingsHandler", - "options": { - "filename": "/tmp/fakemag1.settings.json" - }, - "capabilitiesTransformations": { - "magnification": "http://registry\\.gpii\\.net/common/magnification" - } - } - }, - "configure": [ - "settings.configuration" - ], - "restore": [ - "settings.configuration" - ], - "start": [], - "stop": [], - "isInstalled": [ - { - "type": "gpii.deviceReporter.alwaysInstalled" - } - ] - }, - "fakemag2": { - "name": "Fake Magnifier 2 - fully featured", - "contexts": { - "OS": [ - { - "id": "darwin" - } - ] - }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/magnification/enabled" - ], - "settingsHandlers": { - "configuration": { - "type": "gpii.settingsHandlers.JSONSettingsHandler", - "options": { - "filename": "/tmp/fakemag2.settings.json" - }, - "capabilitiesTransformations": { - "magnification": "http://registry\\.gpii\\.net/common/magnification", - "invert": "http://registry\\.gpii\\.net/common/invertColours" - } - } - }, - "configure": [ - "settings.configuration" - ], - "restore": [ - "settings.configuration" - ], - "start": [], - "stop": [], - "isInstalled": [ - { - "type": "gpii.deviceReporter.alwaysInstalled" - } - ] - }, - "fakescreenreader1": { - "name": "fake screenreader", - "contexts": { - "OS": [ - { - "id": "darwin" - } - ] - }, - "capabilities": [ - "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled" - ], - "settingsHandlers": { - "configuration": { - "type": "gpii.settingsHandlers.JSONSettingsHandler", - "options": { - "filename": "/tmp/fakescreenreader1.json" - }, - "capabilitiesTransformations": { - "pitch": "http://registry\\.gpii\\.net/common/pitch", - "volumeTTS": "http://registry\\.gpii\\.net/common/volumeTTS", - "rate": "http://registry\\.gpii\\.net/common/speechRate" - } - } - }, - "configure": [ - "settings.configuration" - ], - "restore": [ - "settings.configuration" - ], - "start": [], - "stop": [], - "isInstalled": [ - { - "type": "gpii.deviceReporter.alwaysInstalled" - } - ] - } + solutionCapabilities: { + "fakemag1": [ + "http://registry\\.gpii\\.net/common/magnification/enabled", + "http://registry\\.gpii\\.net/common/magnification" + ], + "fakemag2": [ + "http://registry\\.gpii\\.net/common/magnification/enabled", + "http://registry\\.gpii\\.net/common/magnification", + "http://registry\\.gpii\\.net/common/invertColours" + ], + "fakescreenreader1": [ + "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled", + "http://registry\\.gpii\\.net/common/pitch", + "http://registry\\.gpii\\.net/common/volumeTTS", + "http://registry\\.gpii\\.net/common/speechRate" + ] } }, expectedSolutionTypes: { @@ -1123,7 +1017,7 @@ var fluid = fluid || require("infusion"), jqUnit.test("Paths to Skeleton", gpii.tests.matchMakerUtilities.pathsToSkeleton); jqUnit.test("Compute Capabilities From Solution", gpii.tests.matchMakerUtilities.computeAndOntologizeCapabilitiesFromSolution); jqUnit.test("Build Return Payload", gpii.tests.matchMakerUtilities.buildReturnPayload); - jqUnit.test("Merging inferred common terms with preferences", gpii.tests.matchMakerUtilities.testaddInferredCommonTerms); + jqUnit.test("Merging inferred common terms with preferences", gpii.tests.matchMakerUtilities.testaddInferredCommonTermsToPreferences); jqUnit.test("Adding solution type information to payload", gpii.tests.matchMakerUtilities.testAddSolutionTypeInformation); jqUnit.test("Updated Inferred Configuration with preferences", gpii.tests.matchMakerUtilities.updateInferredConfiguration); jqUnit.test("Test getLeastLiveness functionality", gpii.tests.matchMakerUtilities.getLeastLiveness.tests); diff --git a/testData/solutions/android.json5 b/testData/solutions/android.json5 index f52663c0e..757fa7e62 100644 --- a/testData/solutions/android.json5 +++ b/testData/solutions/android.json5 @@ -57,16 +57,7 @@ }] } } - }, - "start": [ - "launchers.launcher" - ], - "stop": [ - "launchers.launcher" - ], - "isRunning": [ - "launchers.launcher" - ] + } }, "com.android.persistentConfiguration": { @@ -86,7 +77,8 @@ "fontScale": {}, "locale": {} }, - "capabilitiesTransformations": { + "liveness": "live", + "capabilitiesTransformations": { "fontScale": { "transform": { "type": "fluid.transforms.binaryOp", @@ -163,13 +155,7 @@ }, "inverseCapabilitiesTransformations": {} } - }, - "configure": [ - "settings.configuration" - ], - "restore": [ - "settings.configuration" - ] + } }, "com.android.audioManager": { @@ -185,6 +171,7 @@ "settingsHandlers": { "configuration": { "type": "gpii.androidAudioManager.volume", + "liveness": "live", "supportedSettings": { "STREAM_MUSIC": {}, "STREAM_SYSTEM": {} @@ -217,13 +204,7 @@ }, "inverseCapabilitiesTransformations": {} } - }, - "configure": [ - "settings.configuration" - ], - "restore": [ - "settings.configuration" - ] + } }, "com.android.settings.system": { @@ -239,6 +220,7 @@ "settingsHandlers": { "configuration": { "type": "gpii.androidSettings", + "liveness": "live", "options": { "settingType": "System" }, @@ -285,13 +267,7 @@ }, "inverseCapabilitiesTransformations": {} } - }, - "configure": [ - "settings.configuration" - ], - "restore": [ - "settings.configuration" - ] + } }, "com.android.settings.secure": { @@ -307,6 +283,7 @@ "settingsHandlers": { "configuration": { "type": "gpii.androidSettings", + "liveness": "live", "options": { "settingType": "Secure" }, @@ -371,13 +348,7 @@ }, "inverseCapabilitiesTransformations": {} } - }, - "configure": [ - "settings.configuration" - ], - "restore": [ - "settings.configuration" - ] + } }, "se.omnitor.ecmobile": { @@ -391,6 +362,7 @@ "settingsHandlers": { "configuration": { "type": "gpii.settingsHandlers.XMLHandler", + "liveness": "manualRestart", "supportedSettings": { "map.string.fontsize.$t": {}, "map.string.theme.$t": {} @@ -453,22 +425,7 @@ }] } } - }, - "start": [ - "launchers.launcher" - ], - "stop": [ - "launchers.launcher" - ], - "isRunning": [ - "launchers.launcher" - ], - "configure": [ - "settings.configuration" - ], - "restore": [ - "settings.configuration" - ] + } }, "es.codefactory.android.app.ma": { diff --git a/testData/solutions/linux.json5 b/testData/solutions/linux.json5 index 0e618877e..ef0cf1bc2 100644 --- a/testData/solutions/linux.json5 +++ b/testData/solutions/linux.json5 @@ -97,21 +97,6 @@ "update": [ "settings.configuration" ], - "configure": [ - "settings.configuration" - ], - "restore": [ - "settings.configuration" - ], - "start": [ - "launchers.launcher" - ], - "stop": [ - "launchers.launcher" - ], - "isRunning": [ - "launchers.launcher" - ], "isInstalled": [ { "type": "gpii.packageKit.find", @@ -228,12 +213,6 @@ } } }, - "configure": [ - "settings.configuration" - ], - "restore": [ - "settings.configuration" - ], "isInstalled": [ { "type": "gpii.packageKit.find", @@ -267,12 +246,6 @@ "inverseCapabilitiesTransformations": {} } }, - "configure": [ - "settings.configuration" - ], - "restore": [ - "settings.configuration" - ], "isInstalled": [ { "type": "gpii.packageKit.find", @@ -301,17 +274,7 @@ } } }, - "update": [ - ], - "start": [ - "launchers.launching" - ], - "stop": [ - "launchers.launching" - ], - "isRunning": [ - "launchers.launching" - ], + "update": [], "isInstalled": [ { "type": "gpii.packageKit.find", @@ -389,12 +352,6 @@ } } }, - "configure": [ - "settings.configuration" - ], - "restore": [ - "settings.configuration" - ], "isInstalled": [ { "type": "gpii.packageKit.find", @@ -421,12 +378,6 @@ } } }, - "configure": [ - "settings.configuration" - ], - "restore": [ - "settings.configuration" - ], "isInstalled": [ { "type": "gpii.packageKit.find", @@ -452,12 +403,6 @@ } } }, - "configure": [ - "settings.configuration" - ], - "restore": [ - "settings.configuration" - ], "isInstalled": [ { "type": "gpii.packageKit.find", @@ -1104,26 +1049,6 @@ } } }, - "update": [ - "stop", - "configure", - "start" - ], - "configure": [ - "settings.configuration" - ], - "restore": [ - "settings.configuration" - ], - "start": [ - "launchers.launcher" - ], - "stop": [ - "launchers.launcher" - ], - "isRunning": [ - "launchers.launcher" - ], "isInstalled": [ { "type": "gpii.packageKit.find", @@ -1160,15 +1085,6 @@ } } }, - "configure": [ - "settings.configuration" - ], - "restore": [ - "settings.configuration" - ], - "update": [ - "settings.configuration" - ], "isInstalled": [ { "type": "gpii.packageKit.find", @@ -1212,15 +1128,6 @@ } } }, - "start": [ - "launchers.launcher" - ], - "stop": [ - "launchers.launcher" - ], - "isRunning": [ - "launchers.launcher" - ], "isInstalled": [ { "type": "gpii.packageKit.find", @@ -1273,15 +1180,6 @@ } } }, - "start": [ - "launchers.launcher" - ], - "stop": [ - "launchers.launcher" - ], - "isRunning": [ - "launchers.launcher" - ], "isInstalled": [ { "type": "gpii.packageKit.find", @@ -1329,15 +1227,6 @@ } } }, - "start": [ - "launchers.launcher" - ], - "stop": [ - "launchers.launcher" - ], - "isRunning": [ - "launchers.launcher" - ], "isInstalled": [ { "type": "gpii.packageKit.find", @@ -1370,13 +1259,7 @@ "screen-resolution": {} } } - }, - "configure": [ - "settings.configuration" - ], - "restore": [ - "settings.configuration" - ] + } }, "net.gpii.uioPlus": { @@ -1477,15 +1360,6 @@ "inverseCapabilitiesTransformations": {} } }, - "update": [ - "configure" - ], - "configure": [ - "settings.configuration" - ], - "restore": [ - "settings.configuration" - ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" diff --git a/testData/solutions/win32.json5 b/testData/solutions/win32.json5 index b2e228bb8..345b7b6e7 100644 --- a/testData/solutions/win32.json5 +++ b/testData/solutions/win32.json5 @@ -648,33 +648,6 @@ } } }, - "configure": [ - "settings.configuration1", - "settings.configuration2" - ], - "restore": [ - "settings.configuration1", - "settings.configuration2" - ], - "update": [ - "stop", - "configure", - "start" - ], - "start": [ - "launchers.launcher" - ], - "stop": [ - "launchers.launcher" - ], - "update": [ - "stop", - "configure", - "start" - ], - "isRunning": [ - "launchers.launcher" - ], "isInstalled": [ { "type": "gpii.deviceReporter.registryKeyExists", @@ -765,31 +738,6 @@ } } }, - "configure": [ - "settings.configuration" - ], - "restore": [ - "settings.configuration" - ], - "update": [ - "stop", - "configure", - "start" - ], - "start": [ - "launchers.launcher" - ], - "stop": [ - "launchers.launcher" - ], - "update": [ - "stop", - "configure", - "start" - ], - "isRunning": [ - "launchers.launcher" - ], "isInstalled": [ { "type": "gpii.deviceReporter.registryKeyExists", @@ -985,26 +933,6 @@ } } }, - "start": [ - "launchers.launcher" - ], - "stop": [ - "launchers.launcher" - ], - "update": [ - "stop", - "configure", - "start" - ], - "isRunning": [ - "launchers.launcher" - ], - "configure": [ - "settings.configure" - ], - "restore": [ - "settings.configure" - ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" @@ -1062,26 +990,6 @@ } } }, - "start": [ - "launchers.launcher" - ], - "stop": [ - "launchers.launcher" - ], - "update": [ - "stop", - "configure", - "start" - ], - "isRunning": [ - "launchers.launcher" - ], - "configure": [ - "settings.configure" - ], - "restore": [ - "settings.configure" - ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" @@ -1325,22 +1233,6 @@ } } }, - "launchHandlers": { - - }, - "configure": [ - "settings.configure", - "settings.configureNoRoam" - ], - "restore": [ - "settings.configure", - "settings.configureNoRoam" - ], - "update": [ - "stop", - "configure", - "start" - ], "start": [ { "type": "gpii.windows.enableRegisteredAT", @@ -1777,7 +1669,7 @@ { "type": "gpii.windows.closeProcessByName", "filename": "nvda_service.exe" - },{ + }, { "type": "gpii.windows.closeProcessByName", "filename": "nvda.exe" } @@ -1785,26 +1677,6 @@ } } }, - "start": [ - "launchers.launcher" - ], - "stop": [ - "launchers.launcher" - ], - "update": [ - "stop", - "configure", - "start" - ], - "isRunning": [ - "launchers.launcher" - ], - "configure": [ - "settings.configs" - ], - "restore": [ - "settings.configs" - ], "isInstalled": [ { "type": "gpii.deviceReporter.registryKeyExists", @@ -1847,22 +1719,6 @@ } } }, - "start": [ - "launchers.launcher" - ], - "stop": [ - "launchers.launcher" - ], - "isRunning": [ - "launchers.launcher" - ], - // Although there are no settings to deal with, we need to pass through - // the "configure" action in order to proceed with the "stop" directive - // when keying out. This is a current limitation of the system, you can - // check https://issues.gpii.net/browse/GPII-2106 and - // https://issues.gpii.net/browse/GPII-1235 for more detailed information. - // - "configure": [ "settings.configure" ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" @@ -1901,15 +1757,6 @@ } } }, - "start": [ - "launchers.launcher" - ], - "stop": [ - "launchers.launcher" - ], - "isRunning": [ - "launchers.launcher" - ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" @@ -1948,15 +1795,6 @@ } } }, - "start": [ - "launchers.launcher" - ], - "stop": [ - "launchers.launcher" - ], - "isRunning": [ - "launchers.launcher" - ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" @@ -2064,26 +1902,6 @@ } } }, - "configure": [ - "settings.configuration" - ], - "restore": [ - "settings.configuration" - ], - "start": [ - "launchers.launcher" - ], - "stop": [ - "launchers.launcher" - ], - "update": [ - "stop", - "configure", - "start" - ], - "isRunning": [ - "launchers.launcher" - ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" @@ -2186,18 +2004,6 @@ } } }, - "configure": [ - "settings.configureTheme", - "settings.configure" - ], - "restore": [ - "settings.configureTheme", - "settings.configure" - ], - "update": [ - "settings.configureTheme", - "settings.configure" - ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" @@ -2252,15 +2058,6 @@ } } }, - "update": [ - "configure" - ], - "configure": [ - "settings.configure" - ], - "restore": [ - "settings.configure" - ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" @@ -2469,15 +2266,6 @@ } } }, - "configure": [ - "settings.configure" - ], - "update": [ - "configure" - ], - "restore": [ - "settings.configure" - ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" @@ -2614,15 +2402,6 @@ } } }, - "update": [ - "configure" - ], - "configure": [ - "settings.configure" - ], - "restore": [ - "settings.configure" - ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" @@ -2688,15 +2467,6 @@ } } }, - "update": [ - "configure" - ], - "configure": [ - "settings.configure" - ], - "restore": [ - "settings.configure" - ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" @@ -2730,12 +2500,6 @@ } } }, - "configure": [ - "settings.configuration" - ], - "restore": [ - "settings.configuration" - ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" @@ -2776,15 +2540,6 @@ } } }, - "configure": [ - "settings.configure" - ], - "restore": [ - "settings.configure" - ], - "update": [ - "configure" - ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" @@ -3205,27 +2960,7 @@ ] } } - }, - "configure": [ - "settings.configuration" - ], - "restore": [ - "settings.configuration" - ], - "isRunning": [ - "launchers.launcher" - ], - "start": [ - "launchers.launcher" - ], - "stop": [ - "launchers.launcher" - ], - "update": [ - "stop", - "configure", - "start" - ] + } }, "net.gpii.uioPlus": { @@ -3326,15 +3061,6 @@ "inverseCapabilitiesTransformations": {} } }, - "configure": [ - "settings.configuration" - ], - "restore": [ - "settings.configuration" - ], - "update": [ - "configure" - ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" From 3e28eb7c89dab4ab1b99a96fdb24f1e6c0e39e27 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Tue, 27 Feb 2018 14:46:12 +0100 Subject: [PATCH 38/44] GPII-1230: All tests passing again. Still missing documentation --- .../src/CanopyMatchMakerUtilities.js | 2 +- .../web/js/CanopyMatchMakerUtilitiesTests.js | 18 ++- .../lifecycleManager/src/LifecycleManager.js | 3 +- .../test/js/LifecycleManagerTests.js | 2 +- .../src/MatchMakerUtilities.js | 6 +- .../test/js/MatchMakerUtilitiesTests.js | 12 +- .../test/preferencesServerTests.js | 120 +++++++++--------- .../transformer/src/js/Transformer.js | 2 +- tests/configs/gpii.tests.multiSH.config.json | 4 +- ...try.json => multiSHSolutionsRegistry.json} | 0 10 files changed, 88 insertions(+), 81 deletions(-) rename tests/data/{multiSHSolutionRegistry.json => multiSHSolutionsRegistry.json} (100%) diff --git a/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js b/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js index c6827193f..e1198ab87 100644 --- a/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js +++ b/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js @@ -103,7 +103,7 @@ gpii.canopyMatchMaker.utils.disposeFromCanopy = function (leaves, ranked, solrec for (var i = 0; i < ranked.length; ++i) { var sol = solrecs[ranked[i]]; - if (sol.disposition === "reject") { // TODO KASPER || sol.active === false) { + if (sol.disposition === "reject") { continue; } diff --git a/gpii/node_modules/canopyMatchMaker/test/web/js/CanopyMatchMakerUtilitiesTests.js b/gpii/node_modules/canopyMatchMaker/test/web/js/CanopyMatchMakerUtilitiesTests.js index f0c559153..d10fd0b42 100644 --- a/gpii/node_modules/canopyMatchMaker/test/web/js/CanopyMatchMakerUtilitiesTests.js +++ b/gpii/node_modules/canopyMatchMaker/test/web/js/CanopyMatchMakerUtilitiesTests.js @@ -55,7 +55,7 @@ var lesserMagnifier = { } }, "yourconf": { - "type": "gpii.integrationTesting.mockSettingsHandler", + "type": "gpii.integrationTesting.mockSettingsHandler" } } }; @@ -167,7 +167,7 @@ gpii.tests.canopyMatchMaker.runBasicTests = function () { "display.screenEnhancement.-provisional-showCrosshairs", "display.screenEnhancement.tracking" ] - } + }; var solrecs = gpii.matchMakerFramework.utils.expandSolutions(solutions, capabilities, { "*": "*" }); var ranked = gpii.canopyMatchMaker.utils.rankSolutions(sammyLeaves, solrecs, gpii.canopyMatchMaker.utils.ISO24751.ontologicalMetric); var minimalData = { @@ -177,14 +177,17 @@ gpii.tests.canopyMatchMaker.runBasicTests = function () { }, solutionTypeMapping: { "http://registry.gpii.net/common/magnifier": [ "lesserMag", "mag" ] - } + }, + specialPreferences: {}, + specialCapabilities: {}, + solutionsRegistryEntries: {} }; // var indices = extractIndices(ranked); var expected = ["mag", "lesserMag"]; jqUnit.assertDeepEq("Ranked solutions", expected, ranked); - var disposed = gpii.canopyMatchMaker.utils.disposeFromCanopy(sammyLeaves, ranked, solrecs, minimalData, gpii.canopyMatchMaker.utils.ISO24751.ontologicalMetric); + var disposed = gpii.canopyMatchMaker.utils.disposeFromCanopy(sammyLeaves, ranked, solrecs, minimalData, "gpii-default", gpii.canopyMatchMaker.utils.ISO24751.ontologicalMetric); var itions = gpii.canopyMatchMaker.utils.extractDispositions(disposed); expected = { "mag": "accept", @@ -248,7 +251,7 @@ var disposeStrategyFixtures = [ "contexts": {}, "settingsHandlers": { "myconf": { - "type": "gpii.settingsHandlers.noSettings", + "type": "gpii.settingsHandlers.noSettings" } } }, @@ -286,7 +289,10 @@ gpii.tests.canopyMatchMaker.disposeStrategyTests = function () { solutionTypeMapping: { "http://registry.gpii.net/common/someType": [ "test.dummy" ], "http://registry.gpii.net/common/someOtherType": [ "test.dummy_2" ] - } + }, + specialPreferences: {}, + specialCapabilities: {}, + solutionsRegistryEntries: {} }; var result = gpii.canopyMatchMaker.utils.disposeStrategy(fixture.leavesArg, fixture.solRecsArg, data); var expected = $.extend(true, {}, fixture.solRecsArg, fixture.expect); diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index 0a75032e7..2c6cbd037 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -518,7 +518,8 @@ var gpii = fluid.registerNamespace("gpii"); } } return steps; - } + }; + /** Called for each solution during "start", "stop" and "update" phases * Actions to be performed are held in array "actions" and the settingsHandlers block from "solutions" (either Transformer * output, or snapshot output from "start" phase) encodes the settings to be set. diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index 4c3cb000c..4e00f4317 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -104,7 +104,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt "launchHandlers": { "launcher": { "type": "gpii.tests.lifecycleManager.mockLaunchHandler", - "options": {}, + "options": {} } } }; diff --git a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js index d8d50274d..e88886deb 100644 --- a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js +++ b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js @@ -163,7 +163,7 @@ var fluid = fluid || require("infusion"), * Given a list of solutions and capabilities, ontologize the capabilities and generate a skeleton based on those. * * @param solutions {Object} list of solution entries in the same format as the solutions registry\ - * // TODO KASPER + * @param capabilities {Object} (array)listings of solution capabilities, keyed by solution ID * @param transformSpec {Object} transformation rules to translate from the format the input paths are * given in in the solutions entries' capabilitiesTransformations block, to the ontology * that the skeleton should be in @@ -560,7 +560,7 @@ var fluid = fluid || require("infusion"), * NOTE: This will modify the supplied payload * * @param payload {Object} An object with the format of a standard matchmaker input payload. At a very - * minimum this payload should have a `solutionRegistryEntries` key with a hashmap of + * minimum this payload should have a `solutionsRegistryEntries` key with a hashmap of * (solutionID => solution registry entry) pairs. Note that this object will be modified by * addition of two toplevel keys: `solutionTypes` and `solutionTypeMapping`. */ @@ -583,7 +583,7 @@ var fluid = fluid || require("infusion"), * NOTE: this function will modify the supplied `payload` * * @param payload {Object} An object with the format of a standard matchmaker input payload. At a very - * minimum this payload should have a `solutionRegistryEntries` key with the solution entries as well + * minimum this payload should have a `solutionsRegistryEntries` key with the solution entries as well * as a 'solutionCapabilities' key, which contains information about a solutions capabilities (i.e. via * the addCapabilitiesInformation function). * @param transformSpec {Object} ontology transform spec translating from common terms into diff --git a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js index 1cd36d3ed..1a536fabf 100644 --- a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js +++ b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js @@ -234,12 +234,12 @@ var fluid = fluid || require("infusion"), ] }, expectedCapabilities: [ - "http://registry\\.gpii\\.net/common/tracking", - "http://registry\\.gpii\\.net/common/magnification", - "http://registry\\.gpii\\.net/common/showCrosshairs", - "http://registry\\.gpii\\.net/common/magnifierPosition", - "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled", - "http://registry\\.gpii\\.net/common/magnification/enabled" + "http://registry\\.gpii\\.net/common/tracking", + "http://registry\\.gpii\\.net/common/magnification", + "http://registry\\.gpii\\.net/common/showCrosshairs", + "http://registry\\.gpii\\.net/common/magnifierPosition", + "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled", + "http://registry\\.gpii\\.net/common/magnification/enabled" ], expectedSpecialCapabilities: [ "http://registry\\.gpii\\.net/common/screenReaderTTS/enabled", diff --git a/gpii/node_modules/preferencesServer/test/preferencesServerTests.js b/gpii/node_modules/preferencesServer/test/preferencesServerTests.js index 1b3982cc0..aace2d63d 100644 --- a/gpii/node_modules/preferencesServer/test/preferencesServerTests.js +++ b/gpii/node_modules/preferencesServer/test/preferencesServerTests.js @@ -586,73 +586,73 @@ gpii.tests.preferencesServer.get.fixtures = [ userToken: "np_ISO24751Only_singleContext_wildcardMetadata", url: "%userToken?view=flat", expected: { - "contexts": { - "gpii-default": { - "name": "Default preferences", - "preferences": { - "http://registry.gpii.net/common/initDelay": 0.12, - "http://registry.gpii.net/common/cursorSpeed": 0.85, - "http://registry.gpii.net/common/cursorAcceleration": 0.8, - "http://registry.gpii.net/common/mouseEmulation/enabled": true, - "http://registry.gpii.net/applications/org.alsa-project": { - "volume": 14, - "pitch": 100 - }, - "http://registry.gpii.net/common/onScreenKeyboard/enabled": true + "contexts": { + "gpii-default": { + "name": "Default preferences", + "preferences": { + "http://registry.gpii.net/common/initDelay": 0.12, + "http://registry.gpii.net/common/cursorSpeed": 0.85, + "http://registry.gpii.net/common/cursorAcceleration": 0.8, + "http://registry.gpii.net/common/mouseEmulation/enabled": true, + "http://registry.gpii.net/applications/org.alsa-project": { + "volume": 14, + "pitch": 100 + }, + "http://registry.gpii.net/common/onScreenKeyboard/enabled": true + }, + "metadata": [ + { + "type": "provenance", + "scope": [ + "http://registry\\.gpii\\.net/common/initDelay", + "http://registry\\.gpii\\.net/common/stickyKeys", + "http://registry\\.gpii\\.net/common/cursorSpeed", + "http://registry\\.gpii\\.net/common/speechControl", + "http://registry\\.gpii\\.net/common/hapticFeedback", + "http://registry\\.gpii\\.net/common/tableOfContents", + "http://registry\\.gpii\\.net/common/slowKeysInterval", + "http://registry\\.gpii\\.net/common/slowKeys/enabled", + "http://registry\\.gpii\\.net/common/debounce/enabled", + "http://registry\\.gpii\\.net/common/debounceInterval", + "http://registry\\.gpii\\.net/common/cursorAcceleration", + "http://registry\\.gpii\\.net/common/mouseEmulation/enabled", + "http://registry\\.gpii\\.net/common/onScreenKeyboard/enabled" + ], + "source": "snapshotter" + } + ] + } }, + "name": "ISO24751 set", "metadata": [ { - "type": "provenance", + "type": "doNotShare", "scope": [ - "http://registry\\.gpii\\.net/common/initDelay", - "http://registry\\.gpii\\.net/common/stickyKeys", - "http://registry\\.gpii\\.net/common/cursorSpeed", - "http://registry\\.gpii\\.net/common/speechControl", - "http://registry\\.gpii\\.net/common/hapticFeedback", - "http://registry\\.gpii\\.net/common/tableOfContents", - "http://registry\\.gpii\\.net/common/slowKeysInterval", - "http://registry\\.gpii\\.net/common/slowKeys/enabled", - "http://registry\\.gpii\\.net/common/debounce/enabled", - "http://registry\\.gpii\\.net/common/debounceInterval", - "http://registry\\.gpii\\.net/common/cursorAcceleration", - "http://registry\\.gpii\\.net/common/mouseEmulation/enabled", - "http://registry\\.gpii\\.net/common/onScreenKeyboard/enabled" - ], - "source": "snapshotter" + "http://registry\\.gpii\\.net/common/fontSize", + "http://registry\\.gpii\\.net/common/tracking", + "http://registry\\.gpii\\.net/common/DPIScale", + "http://registry\\.gpii\\.net/common/lineSpace", + "http://registry\\.gpii\\.net/common/cursorSize", + "http://registry\\.gpii\\.net/common/trackingTTS", + "http://registry\\.gpii\\.net/common/invertImages", + "http://registry\\.gpii\\.net/common/magnification", + "http://registry\\.gpii\\.net/common/invertColours", + "http://registry\\.gpii\\.net/common/mouseTrailing", + "http://registry\\.gpii\\.net/common/characterSpace", + "http://registry\\.gpii\\.net/common/highlightColor", + "http://registry\\.gpii\\.net/common/foregroundColor", + "http://registry\\.gpii\\.net/common/backgroundColor", + "http://registry\\.gpii\\.net/common/fontFaceFontName", + "http://registry\\.gpii\\.net/common/magnifierPosition", + "http://registry\\.gpii\\.net/common/highContrastTheme", + "http://registry\\.gpii\\.net/common/inputsLarger/enabled", + "http://registry\\.gpii\\.net/common/highContrast/enabled", + "http://registry\\.gpii\\.net/common/magnification/enabled", + "http://registry\\.gpii\\.net/common/fontFaceGenericFontFace" + ] } ] } - }, - "name": "ISO24751 set", - "metadata": [ - { - "type": "doNotShare", - "scope": [ - "http://registry\\.gpii\\.net/common/fontSize", - "http://registry\\.gpii\\.net/common/tracking", - "http://registry\\.gpii\\.net/common/DPIScale", - "http://registry\\.gpii\\.net/common/lineSpace", - "http://registry\\.gpii\\.net/common/cursorSize", - "http://registry\\.gpii\\.net/common/trackingTTS", - "http://registry\\.gpii\\.net/common/invertImages", - "http://registry\\.gpii\\.net/common/magnification", - "http://registry\\.gpii\\.net/common/invertColours", - "http://registry\\.gpii\\.net/common/mouseTrailing", - "http://registry\\.gpii\\.net/common/characterSpace", - "http://registry\\.gpii\\.net/common/highlightColor", - "http://registry\\.gpii\\.net/common/foregroundColor", - "http://registry\\.gpii\\.net/common/backgroundColor", - "http://registry\\.gpii\\.net/common/fontFaceFontName", - "http://registry\\.gpii\\.net/common/magnifierPosition", - "http://registry\\.gpii\\.net/common/highContrastTheme", - "http://registry\\.gpii\\.net/common/inputsLarger/enabled", - "http://registry\\.gpii\\.net/common/highContrast/enabled", - "http://registry\\.gpii\\.net/common/magnification/enabled", - "http://registry\\.gpii\\.net/common/fontFaceGenericFontFace" - ] - } - ] -} } ]; diff --git a/gpii/node_modules/transformer/src/js/Transformer.js b/gpii/node_modules/transformer/src/js/Transformer.js index b24ccb225..ce5c4dc09 100644 --- a/gpii/node_modules/transformer/src/js/Transformer.js +++ b/gpii/node_modules/transformer/src/js/Transformer.js @@ -86,7 +86,7 @@ fluid.registerNamespace("gpii.transformer"); var oneSolution = fluid.copy(solutionsRegistryEntries[solutionId]); if (oneSolution === undefined) { fluid.log("The configuration to be applied contains an entry for " + solutionId + - " which was not found in the solutionRegistry. Aborting configuration"); + " which was not found in the solutionsRegistry. Aborting configuration"); return undefined; } delete oneSolution.contexts; // solutions registry entries should include this as "old device reporter context info" diff --git a/tests/configs/gpii.tests.multiSH.config.json b/tests/configs/gpii.tests.multiSH.config.json index 35345e8df..601cb36f3 100644 --- a/tests/configs/gpii.tests.multiSH.config.json +++ b/tests/configs/gpii.tests.multiSH.config.json @@ -12,8 +12,8 @@ "target": "{that deviceReporter installedSolutionsDataSource}.options.path", "priority": "after:development.installedSolutionsPath" }, - "multiSH.solutionRegistry": { - "record": "%gpii-universal/tests/data/multiSHSolutionRegistry.json", + "multiSH.solutionsRegistry": { + "record": "%gpii-universal/tests/data/multiSHsolutionsRegistry.json", "target": "{that flowManager solutionsRegistryDataSource}.options.path", "priority": "after:flowManager.development.solutions" } diff --git a/tests/data/multiSHSolutionRegistry.json b/tests/data/multiSHSolutionsRegistry.json similarity index 100% rename from tests/data/multiSHSolutionRegistry.json rename to tests/data/multiSHSolutionsRegistry.json From 27d43a42c5680b9a228a8410ebbf29ebbe0604f4 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Tue, 27 Feb 2018 19:24:45 +0100 Subject: [PATCH 39/44] GPII-1230: Added an extra test. Addressed two minor comments from Antranig --- .../flatMatchMaker/src/FlatMatchMaker.js | 5 +- .../lifecycleManager/src/LifecycleManager.js | 3 +- .../src/MatchMakerUtilities.js | 7 +- .../test/js/MatchMakerUtilitiesTests.js | 108 ++++++++++++++++++ 4 files changed, 119 insertions(+), 4 deletions(-) diff --git a/gpii/node_modules/flatMatchMaker/src/FlatMatchMaker.js b/gpii/node_modules/flatMatchMaker/src/FlatMatchMaker.js index b076e5f9e..245de97c6 100644 --- a/gpii/node_modules/flatMatchMaker/src/FlatMatchMaker.js +++ b/gpii/node_modules/flatMatchMaker/src/FlatMatchMaker.js @@ -89,7 +89,10 @@ /* * Very simple strategy that accepts any solution for which any preference el-path matches * a one of the solutions capabilities (inferred from the capabilities transformations and - * capabilities block of that solution) + * capabilities block of that solution). + * + * We consider that any accepted solution will be activated because of the simple-minded + * policy adopted by the flat matchmaker */ gpii.flatMatchMaker.disposeStrategy = function (leaves, solrecs) { fluid.each(solrecs, function (solrec) { diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index 2c6cbd037..d8328dbd7 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -339,10 +339,9 @@ var gpii = fluid.registerNamespace("gpii"); if (rootAction === "start" || rootAction === "update") { var toSnapshot = gpii.lifecycleManager.removeSettingsBlocks(fluid.copy(solutionRecord)); - // Disabled the removing of all settingshandlers blocks to ensure that we have them available when restoring the system. + // d not remove the settingshandlers blocks, since we need them when restoring the system. // This is particularly relevant for launch handlers, where we will need to run the "get" directives on logout to decide // whether we an application is running or not, and consequently, whether to run the "update" or "stop" block - // toSnapshot.settingsHandlers = {}; toSnapshot[handlerType][settingsHandlerBlockName] = snapshot; // keep the settings that are already stored from the // original snapshot, but augment it with any settings from the new snapshot diff --git a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js index e88886deb..9504b385f 100644 --- a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js +++ b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js @@ -207,7 +207,8 @@ var fluid = fluid || require("infusion"), // if we have an /enabled term and this is not just a settings transformation: if (term.endsWith("/enabled") && solution.capabilities && solution.capabilities.includes(term)) { // set the active flag based on the users' preference value (from solution specific pref or general pref) - active = fluid.get(specialPreferences[solutionId], term, fluid.model.escapedGetConfig); + var applicationBlockKey = gpii.matchMakerFramework.utils.makeApplicationTerm(solutionId); + active = fluid.get(specialPreferences[applicationBlockKey], term, fluid.model.escapedGetConfig); if (active === undefined) { active = fluid.get(specialPreferences, term, fluid.model.escapedGetConfig); } @@ -614,6 +615,10 @@ var fluid = fluid || require("infusion"), return term.substring("http://registry.gpii.net/applications/".length); }; + gpii.matchMakerFramework.utils.makeApplicationTerm = function (applicationId) { + return "http://registry.gpii.net/applications/" + applicationId; + } + gpii.matchMakerFramework.utils.inferCommonTermsFromApplicationsPrefs = function (prefsId, prefsBlock, flattenedSolutionsRegistry) { var togo = {}; if (gpii.matchMakerFramework.utils.isApplicationTerm(prefsId)) { diff --git a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js index 1a536fabf..0c5677ef0 100644 --- a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js +++ b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js @@ -1006,6 +1006,113 @@ var fluid = fluid || require("infusion"), }); }; + gpii.tests.matchMakerUtilities.getActiveValueFromEnabledTermsData = [ + { + name: "no enabled terms in users' NP set", + args: { + specialPreferences: {}, + specialCapabilities: [ + "http://registry\\.gpii\\.net/common/magnification/enabled" + ], + solution: { + capabilities: [ + "http://registry\\.gpii\\.net/common/magnification/enabled" + ] + }, + solutionId: "my.solution" + }, + expected: undefined + }, { + name: "no enabled term in solutions capability", + args: { + specialPreferences: { + "http://registry.gpii.net/common/magnification/enabled": true + }, + specialCapabilities: [ + ], + solution: {}, + solutionId: "my.solution" + }, + expected: undefined + }, { + name: "enabled term in outer level of prefs - 'true' value", + args: { + specialPreferences: { + "http://registry.gpii.net/common/magnification/enabled": true + }, + specialCapabilities: [ + "http://registry\\.gpii\\.net/common/magnification/enabled" + ], + solution: { + capabilities: [ + "http://registry\\.gpii\\.net/common/magnification/enabled" + ] + }, + solutionId: "my.solution" + }, + expected: true + }, { + name: "enabled term in outer level of prefs - 'false' value", + args: { + specialPreferences: { + "http://registry.gpii.net/common/magnification/enabled": false + }, + specialCapabilities: [ + "http://registry\\.gpii\\.net/common/magnification/enabled" + ], + solution: { + capabilities: [ + "http://registry\\.gpii\\.net/common/magnification/enabled" + ] + }, + solutionId: "my.solution" + }, + expected: false + }, { + name: "enabled term in application specific block of prefs", + args: { + specialPreferences: { + "http://registry.gpii.net/applications/my.solution": { + "http://registry.gpii.net/common/magnification/enabled": true + } + }, + specialCapabilities: [ + "http://registry\\.gpii\\.net/common/magnification/enabled" + ], + solution: { + capabilities: [ + "http://registry\\.gpii\\.net/common/magnification/enabled" + ] + }, + solutionId: "my.solution" + }, + expected: true + }, { + name: "enabled capability is from capabilities transformations (not from solution's capabilities block)", + args: { + specialPreferences: { + "http://registry.gpii.net/common/magnification/enabled": true + }, + specialCapabilities: [ + "http://registry\\.gpii\\.net/common/magnification/enabled" + ], + solution: { + capabilities: [] + }, + solutionId: "my.solution" + }, + expected: undefined + } + ]; + + + gpii.tests.matchMakerUtilities.getActiveValueFromEnabledTerms = function () { + jqUnit.module("Tests for getActiveValueFromEnabledTerms"); + fluid.each(gpii.tests.matchMakerUtilities.getActiveValueFromEnabledTermsData, function (def) { + var result = gpii.matchMakerFramework.utils.getActiveValueFromEnabledTerms(def.args.specialPreferences, def.args.specialCapabilities, def.args.solution, def.args.solutionId); + jqUnit.assertDeepEq(def.name, def.expected, result); + }); + }; @@ -1021,6 +1128,7 @@ var fluid = fluid || require("infusion"), jqUnit.test("Adding solution type information to payload", gpii.tests.matchMakerUtilities.testAddSolutionTypeInformation); jqUnit.test("Updated Inferred Configuration with preferences", gpii.tests.matchMakerUtilities.updateInferredConfiguration); jqUnit.test("Test getLeastLiveness functionality", gpii.tests.matchMakerUtilities.getLeastLiveness.tests); + jqUnit.test("Test getActiveValueFromEnabledTerms", gpii.tests.matchMakerUtilities.getActiveValueFromEnabledTerms); }; })(); From f2a8881ed1f19939ae12a50fce0a167e7955e7bd Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Tue, 27 Feb 2018 20:08:14 +0100 Subject: [PATCH 40/44] GPII-1230: Fixed minor linting error --- .../matchMakerFramework/src/MatchMakerUtilities.js | 2 +- .../matchMakerFramework/test/js/MatchMakerUtilitiesTests.js | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js index 9504b385f..92931cde7 100644 --- a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js +++ b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js @@ -617,7 +617,7 @@ var fluid = fluid || require("infusion"), gpii.matchMakerFramework.utils.makeApplicationTerm = function (applicationId) { return "http://registry.gpii.net/applications/" + applicationId; - } + }; gpii.matchMakerFramework.utils.inferCommonTermsFromApplicationsPrefs = function (prefsId, prefsBlock, flattenedSolutionsRegistry) { var togo = {}; diff --git a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js index 0c5677ef0..3b6a4f24d 100644 --- a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js +++ b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js @@ -1105,7 +1105,6 @@ var fluid = fluid || require("infusion"), } ]; - gpii.tests.matchMakerUtilities.getActiveValueFromEnabledTerms = function () { jqUnit.module("Tests for getActiveValueFromEnabledTerms"); fluid.each(gpii.tests.matchMakerUtilities.getActiveValueFromEnabledTermsData, function (def) { @@ -1115,8 +1114,6 @@ var fluid = fluid || require("infusion"), }; - - gpii.tests.matchMakerUtilities.runTests = function () { jqUnit.module("MatchMakerUtilities"); jqUnit.test("Contains same value", gpii.tests.matchMakerUtilities.containsSameValue); @@ -1130,5 +1127,4 @@ var fluid = fluid || require("infusion"), jqUnit.test("Test getLeastLiveness functionality", gpii.tests.matchMakerUtilities.getLeastLiveness.tests); jqUnit.test("Test getActiveValueFromEnabledTerms", gpii.tests.matchMakerUtilities.getActiveValueFromEnabledTerms); }; - })(); From f44b1fb176b4d5df5cf23664cf83d9755785f45b Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 28 Feb 2018 12:37:51 +0100 Subject: [PATCH 41/44] GPII-1230: Now taking 'enabled' terms into account on updates (from the PSP) --- .../flowManager/src/PCPChannel.js | 2 +- .../src/MatchMakerUtilities.js | 11 +- .../test/js/MatchMakerUtilitiesTests.js | 188 ++++++++++++++++-- 3 files changed, 184 insertions(+), 17 deletions(-) diff --git a/gpii/node_modules/flowManager/src/PCPChannel.js b/gpii/node_modules/flowManager/src/PCPChannel.js index fd047f207..1f28ea1b4 100644 --- a/gpii/node_modules/flowManager/src/PCPChannel.js +++ b/gpii/node_modules/flowManager/src/PCPChannel.js @@ -103,7 +103,7 @@ gpii.pcpChannel.updatePreferences = function (pcpChannel, lifecycleManager, newP session.applier.change(["preferences", "contexts", session.model.activeContextName, "preferences"], contextualPrefs); // get new inferred configuration to be applied: - var newInferred = gpii.matchMakerFramework.utils.updateInferredConfiguration(session.model.preferences, session.model.matchMakerOutput.inferredConfiguration); + var newInferred = gpii.matchMakerFramework.utils.updateInferredConfiguration(session.model.preferences, session.model.matchMakerOutput.inferredConfiguration, session.model.solutionsRegistryEntries); // full payload from session: var fullPayload = fluid.extend(true, {}, session.model); diff --git a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js index 92931cde7..03f7f17cf 100644 --- a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js +++ b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js @@ -744,7 +744,7 @@ var fluid = fluid || require("infusion"), * This feature is required by the PCP to allow updating e.g. a top-level common term and * ensuring that the relevant applications are affected by it */ - gpii.matchMakerFramework.utils.updateInferredConfiguration = function (preferences, inferredConfiguration) { + gpii.matchMakerFramework.utils.updateInferredConfiguration = function (preferences, inferredConfiguration, solutionsRegistryEntries) { var inferred = fluid.copy(inferredConfiguration); fluid.each(preferences.contexts, function (contextBlock, contextName) { fluid.each(contextBlock.preferences, function (val, pref) { @@ -757,6 +757,15 @@ var fluid = fluid || require("infusion"), }); } }); + // get active value from */enabled preferences: + fluid.each(inferred[contextName].applications, function (solutionBlock, solutionId) { + var solutionCapabilities = fluid.get(solutionsRegistryEntries, [ solutionId, "capabilities" ]) || {}; + var active = gpii.matchMakerFramework.utils.getActiveValueFromEnabledTerms(contextBlock.preferences, solutionCapabilities, + solutionsRegistryEntries[solutionId], solutionId); + if (active !== undefined) { + solutionBlock.active = active; + } + }); }); return inferred; }; diff --git a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js index 3b6a4f24d..be6a1830d 100644 --- a/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js +++ b/gpii/node_modules/matchMakerFramework/test/js/MatchMakerUtilitiesTests.js @@ -604,8 +604,25 @@ var fluid = fluid || require("infusion"), }; + gpii.tests.matchMakerUtilities.updateInferredConfigurationSolutionRegistryEntries = { + "fake.magnifier1": { + "capabilities": [] + }, + "fake.magnifier2": { + "capabilities": [] + }, + "fake.magnifier3": { + "capabilities": [ + "http://registry\\.gpii\\.net/common/magnification/enabled" + ] + }, + "fontSizer": { + "capabilities": [] + } + }; + gpii.tests.matchMakerUtilities.updateInferredConfigurationTestDefs = [{ - name: "Basic: single top-level common term, single application", + name: "single top-level common term, single application", preferences: { "contexts": { "gpii-default": { @@ -619,7 +636,7 @@ var fluid = fluid || require("infusion"), inferredConfiguration: { "gpii-default": { "applications": { - "fake.magnifier": { + "fake.magnifier1": { "active": true, "settings": { "http://registry.gpii.net/common/fontSize": 16, @@ -634,7 +651,7 @@ var fluid = fluid || require("infusion"), expected: { "gpii-default": { "applications": { - "fake.magnifier": { + "fake.magnifier1": { "active": true, "settings": { "http://registry.gpii.net/common/fontSize": 20, @@ -647,7 +664,7 @@ var fluid = fluid || require("infusion"), } } }, { - name: "Basic: multiple top-level common terms in preferences, single application", + name: "multiple top-level common terms in preferences, single application", preferences: { "contexts": { "gpii-default": { @@ -662,7 +679,7 @@ var fluid = fluid || require("infusion"), inferredConfiguration: { "gpii-default": { "applications": { - "fake.magnifier": { + "fake.magnifier1": { "active": true, "settings": { "http://registry.gpii.net/common/fontSize": 16, @@ -677,7 +694,7 @@ var fluid = fluid || require("infusion"), expected: { "gpii-default": { "applications": { - "fake.magnifier": { + "fake.magnifier1": { "active": true, "settings": { "http://registry.gpii.net/common/fontSize": 20, @@ -690,7 +707,7 @@ var fluid = fluid || require("infusion"), } } }, { - name: "Basic: common terms in preferences not matching applications in inferred", + name: "common terms in preferences not matching applications in inferred", preferences: { "contexts": { "gpii-default": { @@ -704,7 +721,7 @@ var fluid = fluid || require("infusion"), inferredConfiguration: { "gpii-default": { "applications": { - "fake.magnifier": { + "fake.magnifier1": { "active": true, "settings": { "http://registry.gpii.net/common/magnification/enabled": false, @@ -717,7 +734,7 @@ var fluid = fluid || require("infusion"), expected: { "gpii-default": { "applications": { - "fake.magnifier": { + "fake.magnifier1": { "active": true, "settings": { "http://registry.gpii.net/common/magnification/enabled": false, @@ -728,7 +745,7 @@ var fluid = fluid || require("infusion"), } } }, { - name: "Basic: multiple top-level common terms in preferences, multiple application", + name: "multiple top-level common terms in preferences, multiple application", preferences: { "contexts": { "gpii-default": { @@ -743,7 +760,7 @@ var fluid = fluid || require("infusion"), inferredConfiguration: { "gpii-default": { "applications": { - "fake.magnifier": { + "fake.magnifier1": { "active": true, "settings": { "http://registry.gpii.net/common/magnification/enabled": false, @@ -763,7 +780,7 @@ var fluid = fluid || require("infusion"), expected: { "gpii-default": { "applications": { - "fake.magnifier": { + "fake.magnifier1": { "active": true, "settings": { "http://registry.gpii.net/common/magnification/enabled": false, @@ -781,7 +798,7 @@ var fluid = fluid || require("infusion"), } } }, { - name: "Basic: Common terms in preferences scoped to an application", + name: "Common terms in preferences scoped to an application", preferences: { "contexts": { "gpii-default": { @@ -835,7 +852,7 @@ var fluid = fluid || require("infusion"), } } }, { - name: "Basic: Common terms in preferences, both scoped and not scoped to an application", + name: "Common terms in preferences, both scoped and not scoped to an application", preferences: { "contexts": { "gpii-default": { @@ -889,12 +906,153 @@ var fluid = fluid || require("infusion"), } } } + }, { + name: "'enabled' term in updated preferences, resulting in 'active' change", + preferences: { + "contexts": { + "gpii-default": { + "name": "Default preferences", + "preferences": { + "http://registry.gpii.net/common/magnification/enabled": false + } + } + } + }, + inferredConfiguration: { + "gpii-default": { + "applications": { + "fake.magnifier3": { + "active": true, + "settings": { + "http://registry.gpii.net/common/fontSize": 16, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, + "http://registry.gpii.net/common/magnification/enabled": true, + "http://registry.gpii.net/common/magnification": 1 + } + } + } + } + }, + expected: { + "gpii-default": { + "applications": { + "fake.magnifier3": { + "active": false, + "settings": { + "http://registry.gpii.net/common/fontSize": 16, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, + "http://registry.gpii.net/common/magnification/enabled": false, + "http://registry.gpii.net/common/magnification": 1 + } + } + } + } + } + }, { + name: "application scoped 'enabled' term in updated preferences, resulting in 'active' change", + preferences: { + "contexts": { + "gpii-default": { + "name": "Default preferences", + "preferences": { + "http://registry.gpii.net/applications/fake.magnifier3": { + "http://registry.gpii.net/common/magnification/enabled": false + } + } + } + } + }, + inferredConfiguration: { + "gpii-default": { + "applications": { + "fake.magnifier3": { + "active": true, + "settings": { + "http://registry.gpii.net/common/fontSize": 16, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, + "http://registry.gpii.net/common/magnification/enabled": true, + "http://registry.gpii.net/common/magnification": 1 + } + } + } + } + }, + expected: { + "gpii-default": { + "applications": { + "fake.magnifier3": { + "active": false, + "settings": { + "http://registry.gpii.net/common/fontSize": 16, + "http://registry.gpii.net/common/screenReaderTTS/enabled": true, + "http://registry.gpii.net/common/magnification/enabled": false, + "http://registry.gpii.net/common/magnification": 1 + } + } + } + } + } + }, { + name: "application scoped 'enabled' term in updated preferences, but for other application (i.e. no 'active' change)", + preferences: { + "contexts": { + "gpii-default": { + "name": "Default preferences", + "preferences": { + "http://registry.gpii.net/applications/fake.magnifier2": { + "http://registry.gpii.net/common/magnification/enabled": true + } + } + } + } + }, + inferredConfiguration: { + "gpii-default": { + "applications": { + "fake.magnifier2": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification/enabled": false, + "http://registry.gpii.net/common/magnification": 1 + } + }, + "fake.magnifier3": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification/enabled": false, + "http://registry.gpii.net/common/magnification": 1 + } + } + } + } + }, + expected: { + "gpii-default": { + "applications": { + "fake.magnifier2": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification/enabled": true, + "http://registry.gpii.net/common/magnification": 1 + } + }, + "fake.magnifier3": { + "active": false, + "settings": { + "http://registry.gpii.net/common/magnification/enabled": false, + "http://registry.gpii.net/common/magnification": 1 + } + } + } + } + } }]; gpii.tests.matchMakerUtilities.updateInferredConfiguration = function () { jqUnit.module("Tests for updateInferredConfiguration"); fluid.each(gpii.tests.matchMakerUtilities.updateInferredConfigurationTestDefs, function (testDef) { - var result = gpii.matchMakerFramework.utils.updateInferredConfiguration(testDef.preferences, testDef.inferredConfiguration); + var result = gpii.matchMakerFramework.utils.updateInferredConfiguration(testDef.preferences, testDef.inferredConfiguration, + gpii.tests.matchMakerUtilities.updateInferredConfigurationSolutionRegistryEntries); jqUnit.assertDeepEq(testDef.name, testDef.expected, result); }); }; From 982911a2815e40174f18082ee6c63ce39b579292 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Wed, 28 Feb 2018 16:06:19 +0100 Subject: [PATCH 42/44] GPII-1230: Documentation now updated according to latest functionality --- documentation/LifecycleManager.md | 4 +- documentation/MatchMakerFramework.md | 169 +++++++++++------------ documentation/SolutionsRegistryFormat.md | 141 ++++++++++++++----- testData/solutions/win32.json5 | 2 +- 4 files changed, 186 insertions(+), 130 deletions(-) diff --git a/documentation/LifecycleManager.md b/documentation/LifecycleManager.md index 908b3d283..794bd972e 100644 --- a/documentation/LifecycleManager.md +++ b/documentation/LifecycleManager.md @@ -12,10 +12,10 @@ The queue is run sequentially, and an item is considered "done" once the promise #### Main functions of lifecycle manager: -The lifecycle manager have three invokers that are generally the ones that will be called from the general system, namely "start", "stop" and "update". These invokers are manually created, so are not obvious to spot on the component defaults block, but the are the ones to be used (instead of the processStart, processStop and processUpdate). They will add the relevant task to the Lifecycle Managers queue: +The lifecycle manager have three invokers that are generally the ones that will be called from the general system, namely "start", "stop" and "update". These invokers are manually created, so are not obvious to spot on the component defaults block, but they are the ones to be used (instead of the processStart, processStop and processUpdate). They will add the relevant task to the Lifecycle Managers queue: `start`: Should be called when keying in (configuring the system) `stop`: Should be called when keying out (restoring the system) `update`: Should be called when changing the settings of an already configured system (updating the applied settings) - +Note that these are unrelated to, and should not be confused with the "start", "stop" and "update" directives from solutions registry entries. diff --git a/documentation/MatchMakerFramework.md b/documentation/MatchMakerFramework.md index a400d1a57..a16b188e6 100644 --- a/documentation/MatchMakerFramework.md +++ b/documentation/MatchMakerFramework.md @@ -103,108 +103,97 @@ The input for these POST requests will be in the following format. Note that it ``` { -{ - "activeContexts": [], - "environmentReporter": {}, - "inferredCommonTerms": { - "gpii-default": { - "com.microsoft.windows.highContrast": { - "http://registry.gpii.net/common/highContrastEnabled": true, - "http://registry.gpii.net/common/highContrastTheme": "white-black" - }, - "net.gpii.uioPlus": { - "http://registry.gpii.net/common/highContrastEnabled": true, - "http://registry.gpii.net/common/highContrastTheme": "white-black" - } - } - }, - "userToken": "snapset_2a", - "preferences": { - "name": "Dark & Larger 125%", - "contexts": { - "gpii-default": { - "name": "Default preferences", - "preferences": { - "http://registry.gpii.net/common/cursorSize": 1, - "http://registry.gpii.net/common/DPIScale": 1.25, - "http://registry.gpii.net/applications/com.microsoft.windows.highContrast": { - "http://registry.gpii.net/common/highContrastEnabled": true, - "http://registry.gpii.net/common/highContrastTheme": "white-black" - }, - "http://registry.gpii.net/applications/net.gpii.uioPlus": { - "http://registry.gpii.net/common/highContrastEnabled": true, - "http://registry.gpii.net/common/highContrastTheme": "white-black" - } + "activeContexts": [], + "environmentReporter": {}, + "inferredCommonTerms": { + "gpii-default": { + "com.microsoft.windows.highContrast": { + "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrastTheme": "white-black" + }, + (...), + "org.gnome.desktop.a11y.magnifier": { ... }, } - } - } - }, - "deviceContext": { - "solutions": [ - { - "id": "com.microsoft.windows.magnifier" - }, - { - "id": "com.microsoft.windows.onscreenKeyboard" - }, - ... - { - "id": "com.microsoft.windows.narrator" - } - ], - "OS": { - "id": "win32", - "version": "6.1.7601" + }, + "specialPreferences": { + "gpii-default": {} + }, + "userToken": "carla", + "preferences": { ... } // unmodified preferences set + "deviceContext": { + "solutions": [ + { "id": "com.texthelp.readWriteGold" }, + (...), + { "id": "org.gnome.desktop.a11y.magnifier" } + ], + "OS": { + "id": "win32", + "version": "6.1.7601" + } + }, + "solutionsRegistryEntries": { + "com.texthelp.readWriteGold": { ... }, + (..) + "org.gnome.desktop.a11y.magnifier": { ... } + }, + "solutionCapabilities": { + "com.texthelp.readWriteGold": [ ... ], + (...), + "org.gnome.desktop.a11y.magnifier": [ ... ] + }, + "specialCapabilities": { + "com.microsoft.windows.filterKeys": [ + "http://registry\\.gpii\\.net/common/debounce/enabled", + "http://registry\\.gpii\\.net/common/slowKeys/enabled", + "http://registry\\.gpii\\.net/common/slowKeys/enabled", + "http://registry\\.gpii\\.net/common/debounce/enabled", + "http://registry\\.gpii\\.net/common/slowKeys/enabled" + ], + (...), + "com.microsoft.windows.mouseKeys": [ ... ] } - }, - "solutionsRegistryEntries": { - "com.microsoft.windows.magnifier": { .. }, - "com.microsoft.windows.narrator": { ... }, - .... - "com.microsoft.windows.filterKeys": { ... } - } } + ``` + + ### Return payload The return payload from at call to `/match` should be in the following format. The "active" key expresses whether the application should be set to running. A `true` value means that it should be running, `undefined` means we leave it in its current run state and `false` mean we should actively ensure that it is not running. ``` { - "inferredConfiguration": { - "gpii-default": { - "applications": { - "com.microsoft.windows.highContrast": { - "active": true, - "settings": { - "http://registry.gpii.net/common/highContrastEnabled": true, - "http://registry.gpii.net/common/highContrastTheme": "white-black", - "http://registry.gpii.net/applications/com.microsoft.windows.highContrast": {} - } - }, - "com.microsoft.windows.screenDPI": { - "active": true, - "settings": { - "http://registry.gpii.net/common/DPIScale": 1.25 - } - }, - "com.microsoft.windows.cursors": { - "active": true, - "settings": { - "http://registry.gpii.net/common/cursorSize": 1 - } - }, - "net.gpii.uioPlus": { - "active": true, - "settings": { - "http://registry.gpii.net/common/highContrastEnabled": true, - "http://registry.gpii.net/common/highContrastTheme": "white-black", - "http://registry.gpii.net/applications/net.gpii.uioPlus": {} - } + "inferredConfiguration": { + "gpii-default": { + "applications": { + "com.microsoft.windows.magnifier": { + "active": true, + "settings": { + "http://registry.gpii.net/common/tracking": ["mouse", "mouse", "caret"], + "http://registry.gpii.net/common/magnification": 2, + "http://registry.gpii.net/common/invertColours": true, + "http://registry.gpii.net/common/magnifierPosition": "RightHalf", + "http://registry.gpii.net/applications/com.microsoft.windows.magnifier": { + "Magnification": 200, + "ZoomIncrement": 50, + "Invert": 0, + "FollowMouse": 1, + "FollowFocus": 1, + "FollowCaret": 1, + "MagnificationMode": 1 + } + } + }, + "net.gpii.uioPlus": { + "active": true, + "settings": { + "http://registry.gpii.net/common/fontSize": 24, + "http://registry.gpii.net/common/tableOfContents": false + } + } + } } - } } - } } ``` diff --git a/documentation/SolutionsRegistryFormat.md b/documentation/SolutionsRegistryFormat.md index ef061d0de..f9d6bde9a 100644 --- a/documentation/SolutionsRegistryFormat.md +++ b/documentation/SolutionsRegistryFormat.md @@ -1,6 +1,6 @@ -## Solutions Registry format +# Solutions Registry format -### Overall format: +## Overall format: Each entry in the solution registry should have a unique ID (`Solution.id` in the below example), as well as a name (`name`), and a description of which context it requires to run (`context`). Besides these, information can be provided describing different potential aspects of its lifecycle. This can for example be information about how to start and stop the solution, detect whether it is running, set its settings, etc. These will all be described in the below. The overall structure and allowed keys in a solution description can be seen here. ``` @@ -8,23 +8,25 @@ Each entry in the solution registry should have a unique ID (`Solution.id` in th "name": "My Solution" "contexts": { ... }, "settingsHandlers": { ... }, + "launchHandlers": { ... }, + "capabilities": [ .. ], "configure": [ .. ], "restore": [ .. ], "update": [ .. ], "start": [ .. ], "stop": [ .. ], + "isRunning": [ ..], "isInstalled": [ .. ], - // Not yet supported. Post-Cloud4All features. + // Not yet supported. "install": [ ... ], "uninstall": [ ... ], "makeConfigurable": [ ... ], - "isRunning": [ ... ], "isConfigurable": [ ... ] } ``` -### contexts +## contexts The `contexts` block describes what the required context is for the solution to run. Currently only one type of context is supported, namely `OS`. The context block is **mandatory**. **Example Context**: @@ -38,8 +40,8 @@ The `contexts` block describes what the required context is for the solution to } ``` -### settingsHandlers -The `settingsHandlers` block is unique and one of the most important blocks in the solutions registry entry. It consists of zero or more settingsHandler entries, each keyed by an arbitrary name (that is unique within this solutions settingsHandlers block). Inside each settingsHandler entry, the properties for that settingsHandler is provided. The entries in the settingsHandlers block can be referred to from the other lifecycle blocks of the solutions registry entry. The settingsHandlers block is mandatory. +## settingsHandlers +The `settingsHandlers` block is unique and one of the most important blocks in the solutions registry entry. It consists of zero or more settingsHandler entries, each keyed by an arbitrary name (that is unique within this solutions settingsHandlers block). Inside each settingsHandler entry, the properties for that settingsHandler is provided. The entries in the settingsHandlers block can be referred to from the lifecycle blocks of the solutions registry entry. The settingsHandlers block is mandatory, but can be empty. **Example settingsHandlers block**: ``` @@ -81,6 +83,7 @@ The `settingsHandlers` block is unique and one of the most important blocks in t }, "otherconf": { "type": "gpii.settingsHandlers.XMLHandler", + "liveness:: "liveRestart", "options": { "filename": "${{environment}.HOME}\\mySettings.ini" }, @@ -94,13 +97,12 @@ The `settingsHandlers` block is unique and one of the most important blocks in t } ``` -An important thing to notice here is that this solution example has two references to settingsHandler - one XMLHandler which has been given a reference `myconf` and an INIHandler referred to as `otherconf`. +An important thing to notice here is that this solution example has two settingsHandlers - one XMLHandler which has been given a reference `myconf` and an INIHandler referred to as `otherconf`. Each settingsHandler block can contain the following information: * **type (mandatory):** the type of settingshandler -* **liveness (mandatory):** Describes the update behavior of this solution: `"live"` means that the settings can be applied live without needing to restart the solution. `"liveRestart"` means that the a restart is required but considered low-impact enough for e.g. the PCP to trigger this automatically but not on a framerate of e.g. dragging a slider. `"manualRestart"` means that a change in settings requires a restart and that the restart of the solution is considered high-impact and slow. `"OSRestart"` means that a restart of the OS required. +* **liveness (mandatory):** Describes the update behavior of this solution: `"live"` means that the settings can be applied live without needing to restart the solution. `"liveRestart"` means that the a restart is required but considered low-impact enough for e.g. the PCP to trigger this automatically but not on a framerate of e.g. dragging a slider. `"manualRestart"` means that a change in settings requires a restart and that the restart of the solution is considered high-impact and slow. `"OSRestart"` means that a restart of the operating system required. * **options:** Any options that should be passed to the settingsHandler. This is specific to the type of settingshandler specified in the "type" block. -* **capabilities:** Is used to specify the capabilities of the solution (i.e. the settings/terms that the solution is capable of handling). Note that the framework can automatically deduce capabilities from the `capabilitiesTransformations` block, so if a setting is specified here, the system will automatically consider it a capability which means it does not need to specified in the `capabilities` block. * **capabilitiesTransformations**: Transformations from common terms to application specific settings can be defined here. These will enable the framework to automatically translate common terms from a user's NP set into application settings. Any common terms listed here, will automatically be added to the `capabilities` of the solution. * **inverseCapabilitiesTransformations**: This block describes transformations from application settings to common terms. If this block is present, the transformations specified will be used by the framework to deduce common terms based on any application specific settings in the users NP set. If this key is not present, the framework will attempt to do the inversion itself, based on the `capabilitiesTransformations`. If this block is present, but empty, the system will make no attempt to automatically invert the `capabilitiesTransformations`. * **supportedSettings (mandatory when multiple settingsHandlers)**: This block is used to determine which application specific settings are relevant to the settingshandler, and also serves as location for providing metadata (such as default values, data type, validation information, etc) about the setting. Currently no relevant metadata is supported, so the empty object (`{}`) should be used as value. If a solution only has a single settingsHandler block, all the settings will be passed to that handler by default. But in case there are multiple settingsHandlers, the system needs some way of determining which settings to apply to which handler. The `supportedSettings` directive is used for this: @@ -109,15 +111,75 @@ Each settingsHandler block can contain the following information: -### configure, restore, start and stop -These four lifecycle blocks have different meanings to the system but has the same format. Their meanings are the following: +## launchHandlers: + +The `launchHandlers` are very similar to the `settingsHandlers` block in both form, functionality and implementation, but have a different area of responsibility. As the name suggests, rather than being responsible for modifying settings, they are responsible for the 'launch' state of the application. That is, they are responsible for any actions related to stopping or starting the application, and detecting whether it is running. + +There are two main difference from settingshandlers: (1) internally, launch handlers only have one setting (`running`) which can be true or false depending on the (desired) state of solution and (2) launch handlers do not get their settings from the users NP directly, rather they get the value for `running` from the matchmaker. This is because the decision of which applications to run/stop/update on login depends on what is available on the system and what the matchmaker decides best works for the user. + +On a technical level, launch handlers work exactly as settings handlers, in that they have two methods `get` and `set` for getting and setting the current run-state of and application, respectively. They ignore all "settings" passed in the payload, except for the `running` setting, which should be a boolean value. An implementation of a launch handler should support 3 actions: reading the current run-state of an application (i.e. the `get` call), starting an application (i.e. when `set` is called with a `true` value) and stopping an application (i.e. when `set` is called with a `false` value). + +**Example launchHandlers block**: +``` +"launchHandlers:" { + "launcher": { + "type": "gpii.launchHandlers.flexibleHandler", + "options": { + "setTrue": [ + { + "type": "gpii.launch.exec", + "command": "\"${{registry}.HKEY_CURRENT_USER\\Software\\Texthelp\\Read&Write11\\InstallPath}\\ReadAndWrite.exe\"" + } + ], + "setFalse": [ + { + "type": "gpii.windows.closeProcessByName", + "filename": "ReadAndWrite.exe" + } + ], + "getState": [ + { + "type": "gpii.processReporter.find", + "command": "ReadAndWrite" + } + ] + } + } +} +``` + +As can be seen, the structure of the `launchHandlers` block is very similar to the `settingsHandlers` block. It supports any number of launchHandler entries, keyed by some reference string (in this case "launcher", but it could be anything) that can be used in the lifecycle blocks to reference it. + +Each launch handler will have a `type` entry, describing its type, as well as an `options` block. The content of the `options` block will depend on the launch handler. + +## Capabilities +While most of the users preferences for a certain application or group of applications are handled in the various `settingsHandlers` entries, there are some preferences that can affect the application in other ways than in its configuration. These are `enabled` terms, such as `http://registry.gpii.net/common/magnification/enabled`, which can have a special meaning. If a setting like this should affect whether the solution should be started at all, it should be listed in the solutions capabilities block. If a preference like this should just affect a certain feature/setting of the application, it should _not_ be listed in the capabilities. + +For clarity, lets take two different solutions: +1. `Solution A` is a combined screen reader and magnifier. It supports a `magOff` setting which will turn the magnification feature off, but still read what is on the screen. In this case, it would have `http://registry.gpii.net/common/magnification/enabled` in one of its settingsHandlers' capabilitiesTransformation block, where it would be transformed into an appropriate `magOff` value. This will affect whether the magnification feature is enabled, but otherwise allow the application to run normally. It should _not_ have the `http://registry\\.gpii\\.net/common/magnification/enabled` listed in its capabilities, since a value of `false` would mean that the application would not be started at all - meaning that the screenreader features would not be usable either. +2. `Solution B` is a magnifier application. If the user does not want magnification enabled, there is no sense in having this application running. In this case, it _should_ have the `http://registry\\.gpii\\.net/common/magnification/enabled` listed in its capabilities. This effect is that if the user have a preference for this term, it would affect whether the `Solution B` is launched or not. Note that `Solution B` would still be configured according to the users preferences (just not launched) on user login, in case the user manually starts it later. + +**Example capabilities block**: +``` +"capabilities": [ + "http://registry\\.gpii\\.net/common/magnification/enabled" +] +``` + +## Lifecycle Blocks: configure, restore, start, stop, update and isRunning + +Lifecycle blocks describe what should happen when the system needs to configure, start, update, etc., an application. Neither of these blocks are mandatory as the system will infer their content in case they are not specified. + +### configure and restore + +These blocks describe how to configure and restore a solution, that is: * `configure`: Configure the solution with the users setting (e.g. on login) * `restore`: Restore the settings of the system from before the user logged in -* `start`: Launch/start the solution -* `stop`: Stop/kill the solution -Each of these lifecycle blocks allow the same content - which is an array with entries that are either references to settingsHandlers blocks or customized lifecycle blocks. To reference a settingsHandler block, the keyword `settings.` is used, where `` should be replaced with the name of a settingsHandler block. In the case of `configure` and `start`, a consequence of referencing a settingsHandler is that the settings given in the settingsHandler and users preferences set will be applied to that solution (and their original values will be saved to the system - if the user just logged in). In the case of `restore` and `stop`, the settings that have previously been written using the settingshandler(s) in question will be restored. Alternative to referencings setting and restoring settings, arbitrary lifecycle actions are allowed - the syntax for this is an object that contains at least a `type` key for the function to call. None of these blocks are mandatory. +Each of these lifecycle blocks allow the same content - which is an array with entries that are either references to settingsHandlers blocks or customized lifecycle blocks. To reference a settingsHandler block, the keyword `settings.` is used, where `` should be replaced with the name of a settingsHandler block. The meaning of referencing a settingsHandler is telling the system that the users preferences set will be applied to that solution via the referenced settingshandler. Alternative to referencings setting and restoring settings, arbitrary lifecycle actions are allowed - the syntax for this is an object that contains at least a `type` key for the function to call and any further key/value pairs that are needed by the type. + +If the `configure` and/or `restore` blocks are omitted from a solution entry, they will be inferred as containing references to all the solutions settingshandlers (if any). **Example blocks**: ``` @@ -126,26 +188,43 @@ Each of these lifecycle blocks allow the same content - which is an array with e ], "restore": [ "settings.myconf" -], +] +``` + +### start, stop and isRunning + +These blocks all have to do with the run-state of a solution. Their meanings are the following: + +* `start`: Launch/start the solution +* `stop`: Stop/kill the solution +* `isRunning`: Detect whether the application is currently running + +Similar to the configuration related blocks, each of these lifecycle blocks allow the same content - which is an array with entries that are either references to launcHandler blocks or customized lifecycle blocks. To reference a launchHandler block, the keyword `launchers.` is used, where `` should be replaced with the name of a `launchHandler` block. Internally, when referencing a launchHandler, different things will happen depending on which lifecycle block the reference is from. A reference from `start` or `stop` will call the launch handlers `.set` method with a `running` value of `true` or `false`, respectively. This should have the effect of starting or stopping the process. In case of a reference from `isRunning`, a call will be made to the launch handlers `.set` method. Alternative to referencing launch handler blocks, arbitrary lifecycle actions are allowed - the syntax for this is an object that contains at least a `type` key for the function to call. + +None of these blocks are mandatory. If one is omitted from the solution registry entry, it will be inferred as containing references to all launchHandlers specified for that solution (if any). + +**Example blocks**: +``` "start": [ - { - "type": "gpii.launch.exec", - "command": "\"${{registry}.HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\nvda.exe\\}\"" - } + "launchers.myLauncher" ], "stop": [ + "launchers.myLauncher" +], +"isRunning": [ + "launchers.myLauncher", { - "type": "gpii.windows.killProcessByName", - "filename": "nvda.exe" + "type": "gpii.runCheckers.myCustomChecker", + "command": "applicationChecker.exe /n myApplication" } ] ``` ### update -The `update` block works very similarly to the configure, restore, start and stop blocks. It describes what should happen when the configuration needs to be updated (e.g. due to context changes, PCP adjustments, etc). +The `update` block works very similarly to the lifecycle blocks. It describes what should happen when the configuration needs to be updated (e.g. due to context changes, PCP adjustments, etc). -The format of the `update` block allows for the same entries as the configure, restore, start and stop blocks - that is: arbitrary lifecycle action blocks and `settings.`. Unlike for the other lifecycle blocks, the `update` block furthermore allows references to the `start`, `stop` and `configure` blocks. This is done by putting a string with the name of that block. When the system encounters one of these references, the entries of that block will be run. +The format of the `update` block allows for the same entries as the other lifecycle blocks - that is: arbitrary lifecycle action blocks and references to `settings.` and `launchers.`. Unlike for the other lifecycle blocks, the `update` block furthermore allows references to the `start`, `stop` and `configure` blocks. This is done by putting a string with the name of that block. When the system encounters one of these references, the entries of that block will be run. **Example block**: ``` @@ -163,6 +242,7 @@ The format of the `update` block allows for the same entries as the configure, r In the above example, the process of updating the application settings would consists of running the contents of the `configure` block (that is `"settings.myconf"`), followed by a custom lifecycle actions. +If the `update` block is omitted, it will be inferred by the system. What the inferred content will be depends on the solutions' liveness. If any of the settingsHandlers have a `liveness` value of less than "live", the inferred content will be `[ "stop", "configure", "start" ]`, i.e. a cycle of stopping, configuring and starting the application. If all settingsHandlers are "live", that means that it supports settings being updated live and a value of `[ "configure" ]` is inferred. ### isInstalled: @@ -187,19 +267,6 @@ This directive is used to detect whether a solution is installed. If any of thes ### UNIMPLEMENTED BLOCKS There are several advanced options that we're not planning to implement in the short term, but which will make the implementation of things like the ORCA settings handler much less horrible. -#### isRunning: -To detect whether a solution is running - this is planned to be integrated in the relatively short run. If any of these blocks evaluate to `true` (implicit OR), the application is considered to be running. - -**Example Entry**: -``` -"isRunning": [ - { - "type": "gpii.processReporter.find", - "command": "orca" - } -] -``` - #### isConfigurable This is run before configuration to ensure that the application is actually ready to be configured. This is relevant for applications where e.g. a configuration file needs to be present, a tutorial needs to be run on the first launch, etc. diff --git a/testData/solutions/win32.json5 b/testData/solutions/win32.json5 index 345b7b6e7..836df6fe3 100644 --- a/testData/solutions/win32.json5 +++ b/testData/solutions/win32.json5 @@ -760,7 +760,7 @@ ] }, "capabilities": [ - "http://registry.gpii.net/common/magnification/enabled" + "http://registry\\.gpii\\.net/common/magnification/enabled" ], "settingsHandlers": { "configure": { From 4a9f6914ffb209a521f8c02c9f7565f7b58ac898 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Mon, 12 Mar 2018 18:10:16 +0100 Subject: [PATCH 43/44] GPII-1230: Addressed some of antranigs comments --- .../canopyMatchMaker/src/CanopyMatchMaker.js | 1 - .../src/CanopyMatchMakerUtilities.js | 4 ++-- .../lifecycleManager/src/LifecycleManager.js | 4 ++-- .../test/js/LifecycleManagerTests.js | 12 ++++++++---- .../matchMakerFramework/src/MatchMakerUtilities.js | 13 ++++++++----- .../ontologyHandler/src/ontologyHandler.js | 2 +- .../test/preferencesServerTests.js | 2 +- 7 files changed, 22 insertions(+), 16 deletions(-) diff --git a/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMaker.js b/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMaker.js index 6dcd86693..94c808cfd 100644 --- a/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMaker.js +++ b/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMaker.js @@ -79,7 +79,6 @@ gpii.canopyMatchMaker.matchPost.handleRequest = function (canopyMatchMaker, requ gpii.canopyMatchMaker.match = function (ontologyHandler, payload, disposeStrategy) { // augment payload with inferred common terms payload.preferences = gpii.matchMakerFramework.utils.addInferredCommonTermsToPreferences(payload.preferences, payload.inferredCommonTerms); - // gpii.matchMakerFramework.utils.addCapabilitiesInformation(payload); // augment payload with information about the solution types var appTransformSpec = gpii.ontologyHandler.getTransformSpec(ontologyHandler.ontologyTransformSpecs, "flat", "apptology"); diff --git a/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js b/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js index e1198ab87..5af199b0c 100644 --- a/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js +++ b/gpii/node_modules/canopyMatchMaker/src/CanopyMatchMakerUtilities.js @@ -116,7 +116,7 @@ gpii.canopyMatchMaker.utils.disposeFromCanopy = function (leaves, ranked, solrec } } if (inCanopy) { - // if solution is already disposed, dont redo it. Previous steps make sure canopy is raised accordingly + // if solution is already disposed, don't redo it. Previous steps make sure canopy is raised accordingly if (sol.disposition !== undefined) { continue; } @@ -128,7 +128,7 @@ gpii.canopyMatchMaker.utils.disposeFromCanopy = function (leaves, ranked, solrec data.solutionTypeMapping, solrecs, "Another solution (" + sol.index + ") covering more preferences was found found."); } else { - // if solution is already disposed, dont redo it. Previous steps make sure canopy is raised accordingly + // if solution is already disposed, don't redo it. Previous steps make sure canopy is raised accordingly if (sol.disposition !== undefined) { continue; } diff --git a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js index d8328dbd7..c5dd73d1c 100644 --- a/gpii/node_modules/lifecycleManager/src/LifecycleManager.js +++ b/gpii/node_modules/lifecycleManager/src/LifecycleManager.js @@ -555,7 +555,7 @@ var gpii = fluid.registerNamespace("gpii"); var launchHandlerBlockName = action.substring("launchers.".length); if (actionBlock === "isRunning") { - // if we're just checking for the run state, dont actually modify the solutionRecord with settings: + // if we're just checking for the run state, don't actually modify the solutionRecord with settings: solutionRecord = fluid.copy(solutionRecord); } // Set appropritate settings (i.e. { running: true } if we're in a start block, else { running: false }. @@ -576,7 +576,7 @@ var gpii = fluid.registerNamespace("gpii"); " inside 'update' section for solution " + solutionId); } } - } else { // We allow free lifecycle actions, but strongly discourage them, since we dont have control of logging state like with settings/launch handlers + } else { // We allow free lifecycle actions, but strongly discourage them, since we don't have control of logging state like with settings/launch handlers return function () { var expanded = session.localResolver(action); var result = gpii.lifecycleManager.invokeAction(expanded, that.nameResolver); diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index 4e00f4317..64b9c62bf 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -75,17 +75,21 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt * if entries for multiple solutions are provided, only the "first" solution entry will be * extended. The remaining arguments will be fluid.extended onto the first argument. * - * @currentInstructions {Object} a set of lifecycle instructions keyed by a solution id. For example, + * @param currentInstructions {Object} a set of lifecycle instructions keyed by a solution id. For example, * this could be the output of the buildLifecycleInstructions function. - * @arguments {..Object..} The remaining arguments should be valid lifecycleInstructions that will + * @param arguments {..Object..} The remaining arguments should be valid lifecycleInstructions that will * be extended onto the original - * @return {Object} The original lifecycle instructions, but with the remaining arguments fluid.extend'ed + * @param return {Object} The original lifecycle instructions, but with the remaining arguments fluid.extend'ed * onto the first solution entry in the currentInstructions */ gpii.tests.lifecycleManager.extendLifecycleInstructions = function (currentInstructions) { var togo = fluid.copy(currentInstructions); + if (Object.keys(currentInstructions.length > 1)) { + jqUnit.assertTrue("Instructions passed to extendLifecycleInstructions didn't contain an entry as expected", false); + } var solId = Object.keys(currentInstructions)[0]; + for (var i = 1; i < arguments.length; ++i) { togo[solId] = fluid.extend(true, {}, togo[solId], arguments[i]); } @@ -703,7 +707,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt runningOnLogin: false, loginSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, runningAfterLogin: true, - updateSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, // dont expect these to apply + updateSettings: { "cross-hairs-clip": false, "cross-hairs-color": "green" }, // don't expect these to apply runningAfterUpdate: true, expectedSettings: { "cross-hairs-clip": true, "cross-hairs-color": "red" }, expectedLaunchHandlerCalls: 2 diff --git a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js index 41e868bda..2e911ce76 100644 --- a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js +++ b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js @@ -30,7 +30,8 @@ var fluid = fluid || require("infusion"), /** * APP_SETTING_PRIORITY: the priority that an application is given if the user has application * specific settings in their NP set for that application, but has no explicit priority for - * that application. * MIN_USER_PRIORITY: If an explicit priority is set by the user for an application, this is * the minimum value it should have, to avoid conflicting with system generated priorities. + * that application. * MIN_USER_PRIORITY: If an explicit priority is set by the user for an application, this is + * the minimum value it should have, to avoid conflicting with system generated priorities. */ gpii.matchMakerFramework.APP_SETTING_PRIORITY = 512; @@ -38,16 +39,18 @@ var fluid = fluid || require("infusion"), /* * responsible for building the input payload to the matchmaker, via a bunch of helper functions - * initialPayload consists of: - * userToken, preferences, deviceContext, solutionsRegistryEntries + * + * @params initialPayload {Object}: The initial payload sent to the matchmaking framework. It should as a + * minimum contain: userToken, preferences, deviceContext, solutionsRegistryEntries + * The values from this object will become part of the new matchmaker input object returned from this function, */ gpii.matchMakerFramework.utils.preProcess = function (initialPayload) { var matchMakerInput = fluid.extend({ activeContexts: [], // set later in the process - environmentReporter: {}, // TODO, + environmentReporter: {}, // for holding any environment information inferredCommonTerms: gpii.matchMakerFramework.utils.inferCommonTerms(initialPayload.preferences, initialPayload.fullSolutionsRegistry), specialPreferences: gpii.matchMakerFramework.utils.findSpecialPreferences(initialPayload.preferences) - }, initialPayload); + }, fluid.copy(initialPayload)); gpii.matchMakerFramework.utils.addCapabilitiesInformation(matchMakerInput); // remove full solutions registry from the payload, now that we've used it // to avoid sending a too large payload to the matchmaker (see GPII-1880) diff --git a/gpii/node_modules/ontologyHandler/src/ontologyHandler.js b/gpii/node_modules/ontologyHandler/src/ontologyHandler.js index a947ac3b8..e80f2aee9 100644 --- a/gpii/node_modules/ontologyHandler/src/ontologyHandler.js +++ b/gpii/node_modules/ontologyHandler/src/ontologyHandler.js @@ -405,7 +405,7 @@ URLs - this aspect is taken care of in the preferences server component. var togo = []; fluid.each(metadata, function (entry) { - // if metadata section is application priority, we dont want to have the + // if metadata section is application priority, we don't want to have the // scope ontologized. We want to keep the flat-style application ID if (entry.type === "priority") { togo.push(entry); diff --git a/gpii/node_modules/preferencesServer/test/preferencesServerTests.js b/gpii/node_modules/preferencesServer/test/preferencesServerTests.js index aace2d63d..7dd94d969 100644 --- a/gpii/node_modules/preferencesServer/test/preferencesServerTests.js +++ b/gpii/node_modules/preferencesServer/test/preferencesServerTests.js @@ -822,7 +822,7 @@ gpii.tests.preferencesServer.put.copyNPSet = function (toToken, fromToken) { if (!toToken) { return; } - if (fromToken === undefined) { // if fromToken is undefined, it means we dont want to copy anything + if (fromToken === undefined) { // if fromToken is undefined, it means we don't want to copy anything return; } var rawPrefs = fs.readFileSync(__dirname + "/data/" + fromToken + ".json"); From 1f54342e53365d8f06f8774c72c82193dba71302 Mon Sep 17 00:00:00 2001 From: Kasper Markus Date: Fri, 23 Mar 2018 10:50:29 +0100 Subject: [PATCH 44/44] GPII-1230: Fixed an error in the lifecycle manager tests --- documentation/MatchMakerFramework.md | 2 +- .../lifecycleManager/test/js/LifecycleManagerTests.js | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/documentation/MatchMakerFramework.md b/documentation/MatchMakerFramework.md index a16b188e6..42cac5693 100644 --- a/documentation/MatchMakerFramework.md +++ b/documentation/MatchMakerFramework.md @@ -108,7 +108,7 @@ The input for these POST requests will be in the following format. Note that it "inferredCommonTerms": { "gpii-default": { "com.microsoft.windows.highContrast": { - "http://registry.gpii.net/common/highContrastEnabled": true, + "http://registry.gpii.net/common/highContrast/enabled": true, "http://registry.gpii.net/common/highContrastTheme": "white-black" }, (...), diff --git a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js index 64b9c62bf..77446a9d9 100644 --- a/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js +++ b/gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js @@ -83,13 +83,12 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt * onto the first solution entry in the currentInstructions */ gpii.tests.lifecycleManager.extendLifecycleInstructions = function (currentInstructions) { - var togo = fluid.copy(currentInstructions); - if (Object.keys(currentInstructions.length > 1)) { + if (Object.keys(currentInstructions).length < 1) { jqUnit.assertTrue("Instructions passed to extendLifecycleInstructions didn't contain an entry as expected", false); } + var togo = fluid.copy(currentInstructions); var solId = Object.keys(currentInstructions)[0]; - for (var i = 1; i < arguments.length; ++i) { togo[solId] = fluid.extend(true, {}, togo[solId], arguments[i]); }