How to use infusion - 10 common examples

To help you get started, we’ve selected a few infusion examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GPII / universal / gpii / node_modules / testing / index.js View on Github external
"use strict";

var fluid = require("infusion"),
    kettle = fluid.registerNamespace("kettle");

kettle.loadTestingSupport();

// Some definitions to make sure that errors during request get logged to the console. This should really be
// a default
fluid.defaults("gpii.test.errorLoggingRequest", {
    listeners: {
        "onRequestError.log": "fluid.logUncaughtException",
        "onRequestError.logActivity": {
            funcName: "fluid.logActivity",
            args: [null],
            priority: "after:log"
        }
    }
});
github GPII / universal / tests / MultiUserTests.js View on Github external
Seventh Framework Programme (FP7/2007-2013) under grant agreement no. 289016.

You may obtain a copy of the License at
https://github.com/GPII/universal/blob/master/LICENSE.txt
*/


"use strict";

var fluid = require("infusion"),
    kettle = fluid.registerNamespace("kettle"),
    path = require("path"),
    jqUnit = jqUnit || fluid.require("jqUnit"),
    gpii = fluid.registerNamespace("gpii");

fluid.registerNamespace("gpii.tests.multiUserSupport");

require("../index.js");

gpii.loadTestingSupport();

/*
 * Initial function to be called when the user hits the /match URL. Simply calls the
 *  gpii.flatMatchMaker.match function and fires the 'onSuccess' event when it returns
 */
gpii.tests.multiUserSupport.flatMatchMakerMockMatch = function (ontologyHandler, body) {
    // fake a matchmaking process and return a payload dependent on users/preferences:
    var responseOptions = {
        "multiuser1": {
            "inferredConfiguration": {
                "gpii-default": {
                    "applications": {
github GPII / universal / tests / UserLogonRequestTests.js View on Github external
*
 * Licensed under the New BSD license. You may not use this file except in
 * compliance with this License.
 *
 * The research leading to these results has received funding from the European Union's
 * Seventh Framework Programme (FP7/2007-2013)
 * under grant agreement no. 289016.
 *
 * You may obtain a copy of the License at
 * https://github.com/GPII/universal/blob/master/LICENSE.txt
 */

"use strict";

var fluid = require("infusion"),
    gpii = fluid.registerNamespace("gpii");

require("./shared/UserLogonRequestTestDefs.js");

// With all-in-local config, nonexistent GPII keys are able to key in and key out.
// Note that with untrusted config, nonexistent GPII keys can only key in with client credentials that have privilege
// to create nonexistent GPII keys and prefs safes.
gpii.tests.userLogonRequest.nonexistentKeyInTestDefs = [{
    name: "Testing login and logout with a nonexistent GPII key",
    expect: 2,
    gpiiKey: "bogusToken",
    sequence: [
        {
            // login with a non-existing GPII key
            task: "{lifecycleManager}.performLogin",
            args: ["{testCaseHolder}.options.gpiiKey"],
            resolve: "gpii.tests.userLogonRequest.testLoginResponse",
github GPII / universal / tests / shared / FlowManagerSettingsPutTestDefs.js View on Github external
});

fluid.defaults("gpii.tests.cloud.oauth2.settingsPut.disruption.mainSequence", {
    gradeNames: ["gpii.test.disruption.settings.sequenceGrade"],
    testCaseGradeNames: "gpii.tests.cloud.oauth2.settingsPut.requests",
    sequenceElements: {
        mainSequence: {
            priority: "after:startServer",
            gradeNames: "gpii.tests.cloud.oauth2.settingsPut.mainSequence"
        }
    }
});

// For failed test case that are rejected by /settings endpoint
// 1. rejected when requesting /settings without providing an access token
fluid.defaults("gpii.tests.cloud.oauth2.settingsPut.settingsPutNoAccessTokenSequence", {
    gradeNames: ["fluid.test.sequenceElement"],
    sequence: [
        { funcName: "fluid.log", args: ["Flowmanager rejected put settings sequence -- no access token..."]},
        {
            func: "{settingsPutRequest}.send",
            args: ["{testCaseHolder}.options.updatedPrefsSet"]
        },
        {
            event: "{settingsPutRequest}.events.onComplete",
            listener: "gpii.test.verifyStatusCodeResponse",
            args: ["{arguments}.0", "{settingsPutRequest}", "{testCaseHolder}.options.expectedStatusCode"]
        }
    ]
});

fluid.defaults("gpii.tests.cloud.oauth2.settingsPut.disruption.settingsPutNoAccessTokenSequence", {
github GPII / universal / tests / production / SettingsPutProductionTests.js View on Github external
fluid.registerNamespace("gpii.test.cloudBased.oauth2");

/*
 * ========================================================================
 * Testing of untrusted local config with the live cloud based flow manager
 * ========================================================================
 */

require("./ProductionTestsUtils.js");
require("../shared/FlowManagerSettingsPutTestDefs.js");

gpii.loadTestingSupport();

// PUT /settings tests

fluid.defaults("gpii.tests.productionConfigTesting.settingsPut.testCaseHolder", {
    gradeNames: [
        "gpii.test.cloudBased.oauth2.testCaseHolder",
        "gpii.tests.cloud.oauth2.accessTokensDeleteRequests"
    ],
    productionHostConfig: {
        hostname: "flowmanager",
        port: 9082
    },
    distributeOptions: {
        "accessTokenRequest.hostConfig": {
            source: "{that}.options.productionHostConfig",
            target: "{that accessTokenRequest}.options"
        },
        "settingsPutRequest.hostConfig": {
            source: "{that}.options.productionHostConfig",
            target: "{that settingsPutRequest}.options"
github colinbdclark / osc.js / tests / electron-tests / app.js View on Github external
/*jshint node:true*/

"use strict";

var fluid = require("infusion"),
    osc = require("osc");

require("infusion-electron");

var oscjs = fluid.registerNamespace("oscjs");

fluid.defaults("oscjs.tests.electron.app", {
    gradeNames: "electron.app",

    components: {
        browserTestWindow: {
            createOnEvent: "onReady",
            type: "oscjs.tests.electron.browserTestWindow"
        },

        // We need a separate window for Electron-specific tests
        // because qunit-composite uses iFrames, which are sandboxed from the
        // Electron Node.js API (e.g. require()).
        electronTestWindow: {
            createOnEvent: "onReady",
            type: "oscjs.tests.electron.electronTestWindow",
            options: {
                windowOptions: {
github GPII / universal / tests / ProductionConfigTests.js View on Github external
gpii.tests.productionConfigTesting.testGetForDeletion = function (data, request) {
    var expected = request.options.expectedStatusCodes;
    var actual = request.nativeResponse.statusCode;
    jqUnit.assertNotEquals(
        "Deleting record from database using " + request.options.path +
        ", status: " + actual,
        expected.indexOf(actual), -1
    );
    // Mark and store the to-be-deleted record
    if (actual === 201 || actual === 200) {
        request.options.docToRemove = JSON.parse(data);
        request.options.docToRemove._deleted = true;
    }
    fluid.log(request.options.docToRemove);
};
github GPII / universal / tests / platform / cloud / AcceptanceTests_chrome_oauth2.js View on Github external
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 research leading to these results has received funding from the European Union's
Seventh Framework Programme (FP7/2007-2013) under grant agreement no. 289016.
*/

"use strict";
var fluid = require("infusion"),
    gpii = fluid.registerNamespace("gpii");

fluid.require("%universal");

fluid.registerNamespace("gpii.tests.cloud.oauth2.chrome");
gpii.loadTestingSupport();

gpii.tests.cloud.oauth2.chrome.common = {
    client_id: "org.chrome.cloud4chrome",
    client_secret: "client_secret_chrome",
    redirect_uri: "http://org.chrome.cloud4chrome/the-client%27s-uri/",
    state: "The Client's Unique State",
    username: "bob",
    password: "b"
};

// A grade, applied to the testCaseHolder itself, to be used for testing whether
// the access token supplied for the settings request is checked. This overrides
// the definition of the settings request so that the member, ordinarily returned
github GPII / universal / tests / production / all-tests.js View on Github external
https://github.com/GPII/universal/blob/master/LICENSE.txt

WARNING:  Do not run these tests directly.  They are called from within the
"vagrantCloudBasedContainers.sh" after it has initialized the environment.
*/

"use strict";

var fluid = require("infusion"),
    kettle = fluid.require("kettle");

// Ensure this happens first, to catch errors during code loading.
kettle.loadTestingSupport();

// Pass the current `require` to `fluid.require`, as nyc's instrumentation is hooked into it.
fluid.require("%gpii-universal", require);

var testIncludes = [
    "./CloudStatusProductionTests.js",
    "./SettingsGetProductionTests.js",
    "./SettingsPutProductionTests.js"
];

fluid.each(testIncludes, function (path) {
    require(path);
});
github GPII / universal / tests / platform / windows / windows-jaws-testSpec.js View on Github external
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 research leading to these results has received funding from the European Union's
Seventh Framework Programme (FP7/2007-2013) under grant agreement no. 289016.
*/

"use strict";

var fluid = require("infusion"),
    gpii = fluid.registerNamespace("gpii");

fluid.require("%gpii-universal");

gpii.loadTestingSupport();

fluid.registerNamespace("gpii.tests.windows.jaws");

// 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": {