How to use the @hyperledger/caliper-core.CaliperUtils.stringifyYaml function in @hyperledger/caliper-core

To help you get started, we’ve selected a few @hyperledger/caliper-core 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 hyperledger / caliper / packages / caliper-fabric / lib / fabric.js View on Github external
constructor(networkConfig, workspace_root) {
        super(networkConfig);
        this.bcType = 'fabric';
        this.workspaceRoot = workspace_root;
        this.version = new Version(require('fabric-client/package').version);

        this.network = undefined;
        if (typeof networkConfig === 'string') {
            let configPath = CaliperUtils.resolvePath(networkConfig, workspace_root);
            this.network = CaliperUtils.parseYaml(configPath);
        } else if (typeof networkConfig === 'object' && networkConfig !== null) {
            // clone the object to prevent modification by other objects
            this.network = CaliperUtils.parseYamlString(CaliperUtils.stringifyYaml(networkConfig));
        } else {
            throw new Error('[FabricNetwork.constructor] Parameter \'networkConfig\' is neither a file path nor an object');
        }

        this.clientProfiles = new Map();
        this.adminProfiles = new Map();
        this.registrarProfiles = new Map();
        this.eventSources = [];
        this.clientIndex = 0;
        this.txIndex = -1;
        this.randomTargetPeerCache = new Map();
        this.channelEventSourcesCache = new Map();
        this.randomTargetOrdererCache = new Map();
        this.wallet = undefined;
        this.userContracts = new Map();
github hyperledger / caliper / packages / caliper-fabric / lib / fabricNetwork.js View on Github external
constructor(networkConfig, workspace_root) {
        CaliperUtils.assertDefined(networkConfig, '[FabricNetwork.constructor] Parameter \'networkConfig\' if undefined or null');

        this.network = undefined;
        if (typeof networkConfig === 'string') {
            let configPath = CaliperUtils.resolvePath(networkConfig, workspace_root);
            this.network = CaliperUtils.parseYaml(configPath);
        } else if (typeof networkConfig === 'object' && networkConfig !== null) {
            // clone the object to prevent modification by other objects
            this.network = CaliperUtils.parseYamlString(CaliperUtils.stringifyYaml(networkConfig));
        } else {
            throw new Error('[FabricNetwork.constructor] Parameter \'networkConfig\' is neither a file path nor an object');
        }

        this.clientConfigs = {};
        this.compatibilityMode = false; // if event URLs are detected for the peers, we're using Fabric 1.0
        this.tls = false;
        this.mutualTls = false;
        this.contractMapping = new Map();
        this._processConfiguration(workspace_root);
    }
github hyperledger / caliper / packages / caliper-fabric / lib / fabricNetwork.js View on Github external
getNewNetworkObject() {
        return CaliperUtils.parseYamlString(CaliperUtils.stringifyYaml(this.network));
    }