diff --git a/examples/pcpChannelClient/pcpChannelClient.js b/examples/pcpChannelClient/pcpChannelClient.js index cc8ea27ff..482f2fa73 100644 --- a/examples/pcpChannelClient/pcpChannelClient.js +++ b/examples/pcpChannelClient/pcpChannelClient.js @@ -41,10 +41,9 @@ socket.on("message", function (data) { // socket.send(JSON.stringify({"path": ["activeContextName"], "value": "bright", type: "ADD"})); socket.send(JSON.stringify( { - "path": [ "preferences", "http://registry\\.gpii\\.net/common/DPIScale" ], + "path": [ "settingControls", "http://registry\\.gpii\\.net/common/DPIScale", "value" ], "type": "ADD", - "value": 1.75 + "value": false })); - }); diff --git a/gpii/node_modules/flowManager/src/PCPChannel.js b/gpii/node_modules/flowManager/src/PCPChannel.js index daa82a4f4..3d7cc362a 100644 --- a/gpii/node_modules/flowManager/src/PCPChannel.js +++ b/gpii/node_modules/flowManager/src/PCPChannel.js @@ -108,9 +108,6 @@ gpii.pcpChannel.updatePreferences = function (pcpChannel, lifecycleManager, newP // full payload from session: var fullPayload = fluid.extend(true, {}, session.model); fluid.set(fullPayload, ["matchMakerOutput", "inferredConfiguration"], newInferred); - fullPayload.activeConfiguration = { - inferredConfiguration: fluid.extend(true, {}, newInferred[session.model.activeContextName]) - }; gpii.lifecycleManager.addLifecycleInstructionsToPayload(fullPayload); session.applier.change(["activeConfiguration"], fullPayload.activeConfiguration); @@ -287,24 +284,7 @@ gpii.pcpChannel.bindWs = function (handler, pcpChannel) { handler.sendTypedMessage("modelChanged", {path: [], type: "ADD", value: pcpChannel.model}); }; -/** - * Adjusts the preference message payload to match the local model. E.g. a preference change from the PCP has the - * following path: [ "preferences", "http://registry\\.gpii\\.net/common/magnification" ] which should be - * translated to something that matches the PCP Channels model, such as - * [ "settingControls", "http://registry\\.gpii\\.net/common/magnification", "value" ] - * - * @param message {Object} the message recieved via the PCP socket. WARNING - note that the `path` value of - * this object will be modified. - */ -gpii.pcpChannel.adjustPreferenceMessage = function (message) { - message.path[0] = "settingControls"; - message.path.push("value"); -}; - gpii.pcpChannel.receiveMessage = function (message, pcpChannel) { fluid.log("pcpChannel received a message: ", message); - if (message.path && message.path[0] === "preferences") { - gpii.pcpChannel.adjustPreferenceMessage(message); // Modify to fit model if it is a change in preferences - } pcpChannel.applier.change(message.path, message.value, "ADD", "PCP"); }; diff --git a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js index a228e72de..60d74bd5e 100644 --- a/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js +++ b/gpii/node_modules/matchMakerFramework/src/MatchMakerUtilities.js @@ -383,6 +383,7 @@ var fluid = fluid || require("infusion"), var filtered = fluid.copy(allPreferences); var applicationString = "http://registry.gpii.net/applications/" + solutionId; + // find supported common terms: var supportedCommonArr = gpii.matchMakerFramework.utils.computeAndOntologizeCapabilitiesFromSolution(solutionEntry, { "": "" }); var supportedCommon = {}; // create object of keys that are unescaped common term URIs and values of true @@ -390,11 +391,14 @@ var fluid = fluid || require("infusion"), fluid.set(supportedCommon, common, true, fluid.model.escapedSetConfig); }); - // filter any common terms *inside the application block* to ensure only valid common terms are there: - if (allPreferences[applicationString]) { // application block for this solution - fluid.remove_if(filtered[applicationString], function (value, preference) { - // Remove if it is not a supported term: - return (preference.startsWith("http://registry.gpii.net/common/") && !supportedCommon[preference]); + // move any common terms from the application block to the outer level: + 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/")) { + filtered[preference] = value; + delete filtered[applicationString][preference]; + } }); } diff --git a/testData/solutions/win32.json5 b/testData/solutions/win32.json5 index 23f3e5545..1237f73ce 100644 --- a/testData/solutions/win32.json5 +++ b/testData/solutions/win32.json5 @@ -2078,6 +2078,10 @@ "settings.configureTheme", "settings.configure" ], + "update": [ + "settings.configureTheme", + "settings.configure" + ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" diff --git a/tests/shared/PCPIntegrationTestDefs.js b/tests/shared/PCPIntegrationTestDefs.js index 610fd35de..503f8c86e 100644 --- a/tests/shared/PCPIntegrationTestDefs.js +++ b/tests/shared/PCPIntegrationTestDefs.js @@ -181,7 +181,72 @@ gpii.tests.pcpIntegration.testDefs = [ args: ["{arguments}.0", "modelChanged"] }, { funcName: "gpii.tests.pcpIntegration.sendMsg", - args: [ "{pcpClient}", [ "preferences","http://registry\\.gpii\\.net/common/magnification"], 3] + args: [ "{pcpClient}", [ "settingControls", "http://registry\\.gpii\\.net/common/magnification", "value" ], 3] + }, { + event: "{pcpClient}.events.onReceiveMessage", + listener: "gpii.tests.pcpIntegration.checkPayload", + args: ["{arguments}.0", "preferencesApplied"] + }, { + func: "gpii.test.checkConfiguration", + args: ["{tests}.options.data.afterChange1.settingsHandlers", "{nameResolver}", "{testCaseHolder}.events.onCheckConfigurationComplete.fire"] + }, { + event: "{testCaseHolder}.events.onCheckConfigurationComplete", + listener: "fluid.identity" + }, { + func: "{logoutRequest}.send" + }, { + event: "{logoutRequest}.events.onComplete", + listener: "gpii.test.logoutRequestListen" + }, { + func: "gpii.test.checkRestoredConfiguration", + args: ["{tests}.options.data.initial.settingsHandlers", "{tests}.settingsStore", "{nameResolver}", "{testCaseHolder}.events.onCheckRestoredConfigurationComplete.fire"] + }, { + event: "{testCaseHolder}.events.onCheckRestoredConfigurationComplete", + listener: "fluid.identity" + } + ] + ] + }, { + name: "Settings change by PCP with scoped common term", + expect: 9, + sequence: [ + [ + { + func: "gpii.test.expandSettings", + args: [ "{tests}", [ "contexts" ]] + }, { + func: "gpii.test.snapshotSettings", + args: ["{tests}.options.data.initial.settingsHandlers", "{tests}.settingsStore", "{nameResolver}", "{testCaseHolder}.events.onSnapshotComplete.fire"] + }, { + event: "{testCaseHolder}.events.onSnapshotComplete", + listener: "fluid.identity" + }, { + func: "{loginRequest}.send" + }, { + event: "{loginRequest}.events.onComplete", + listener: "gpii.test.loginRequestListen" + }, { + func: "gpii.test.checkConfiguration", + args: ["{tests}.options.data.initial.settingsHandlers", "{nameResolver}", "{testCaseHolder}.events.onCheckConfigurationComplete.fire"] + }, { + event: "{testCaseHolder}.events.onCheckConfigurationComplete", + listener: "fluid.identity" + }, { + func: "{pcpClient}.connect" + }, { + event: "{pcpClient}.events.onConnect", + listener: "gpii.tests.pcpIntegration.connectionSucceeded" + }, { + event: "{pcpClient}.events.onReceiveMessage", + listener: "gpii.tests.pcpIntegration.checkPayload", + args: ["{arguments}.0", "modelChanged"] + }, { + funcName: "gpii.tests.pcpIntegration.sendMsg", + args: [ "{pcpClient}", [ "settingControls", "http://registry\\.gpii\\.net/applications/org\\.gnome\\.desktop\\.a11y\\.magnifier.http://registry\\.gpii\\.net/common/magnification", "value" ], 3] + }, { + event: "{pcpClient}.events.onReceiveMessage", + listener: "gpii.tests.pcpIntegration.checkPayload", + args: ["{arguments}.0", "modelChanged"] }, { event: "{pcpClient}.events.onReceiveMessage", listener: "gpii.tests.pcpIntegration.checkPayload", @@ -242,7 +307,7 @@ gpii.tests.pcpIntegration.testDefs = [ args: ["{arguments}.0", "modelChanged"] }, { funcName: "gpii.tests.pcpIntegration.sendMsg", - args: ["{pcpClient}", [ "preferences","http://registry\\.gpii\\.net/common/magnification"], 3] + args: ["{pcpClient}", [ "settingControls", "http://registry\\.gpii\\.net/common/magnification", "value" ], 3] }, { event: "{pcpClient}.events.onReceiveMessage", listener: "gpii.tests.pcpIntegration.checkPayload", @@ -255,7 +320,7 @@ gpii.tests.pcpIntegration.testDefs = [ listener: "fluid.identity" }, { funcName: "gpii.tests.pcpIntegration.sendMsg", - args: ["{pcpClient}", [ "preferences","http://registry\\.gpii\\.net/common/volume"], 0.75] + args: ["{pcpClient}", [ "settingControls", "http://registry\\.gpii\\.net/common/volume", "value" ], 0.75] }, { event: "{pcpClient}.events.onReceiveMessage", listener: "gpii.tests.pcpIntegration.checkPayload", @@ -377,7 +442,7 @@ gpii.tests.pcpIntegration.testDefs = [ args: ["{arguments}.0", "modelChanged"] }, { funcName: "gpii.tests.pcpIntegration.sendMsg", - args: ["{pcpClient}", [ "preferences","http://registry\\.gpii\\.net/common/magnification"], 3] + args: ["{pcpClient}", [ "settingControls", "http://registry\\.gpii\\.net/common/magnification", "value" ], 3] }, { event: "{pcpClient}.events.onReceiveMessage", listener: "gpii.tests.pcpIntegration.checkPayload", @@ -453,7 +518,7 @@ gpii.tests.pcpIntegration.testDefs = [ args: ["{arguments}.0", "modelChanged"] }, { funcName: "gpii.tests.pcpIntegration.sendMsg", - args: ["{pcpClient}", [ "preferences","http://registry\\.gpii\\.net/common/magnification"], 3] + args: ["{pcpClient}", [ "settingControls", "http://registry\\.gpii\\.net/common/magnification", "value" ], 3] }, { event: "{pcpClient}.events.onReceiveMessage", listener: "gpii.tests.pcpIntegration.checkPayload",