diff --git a/.gitignore b/.gitignore index 79daed249..404782c9a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ # Ignore any generated html files, but include the report html template *.html -!/packages/caliper-core/lib/report/template/report.html +!/packages/caliper-core/lib/master/report/template/report.html # Ignore DS_Store files from Mac **.DS_Store diff --git a/packages/caliper-core/.gitignore b/packages/caliper-core/.gitignore index 9b68215d9..4b0226dfe 100644 --- a/packages/caliper-core/.gitignore +++ b/packages/caliper-core/.gitignore @@ -2,7 +2,7 @@ # Ignore any generated html files, but include the report html template *.html -!/lib/report/template/report.html +!/lib/master/report/template/report.html # Ignore DS_Store files from Mac **.DS_Store diff --git a/packages/caliper-core/index.js b/packages/caliper-core/index.js index abf8b61ae..74dc678db 100644 --- a/packages/caliper-core/index.js +++ b/packages/caliper-core/index.js @@ -14,10 +14,10 @@ 'use strict'; -module.exports.BlockchainInterface = require('./lib/blockchain-interface'); -module.exports.CaliperLocalClient = require('./lib/client/caliper-local-client'); -module.exports.TxStatus = require('./lib/transaction-status'); -module.exports.CaliperUtils = require('./lib/utils/caliper-utils'); -module.exports.Version = require('./lib/utils/version'); -module.exports.ConfigUtil = require('./lib/config/config-util'); -module.exports.CaliperFlow = require('./lib/caliper-flow'); +module.exports.BlockchainInterface = require('./lib/common/core/blockchain-interface'); +module.exports.CaliperLocalClient = require('./lib/worker/client/caliper-local-client'); +module.exports.TxStatus = require('./lib/common/core/transaction-status'); +module.exports.CaliperUtils = require('./lib/common/utils/caliper-utils'); +module.exports.Version = require('./lib/common/utils/version'); +module.exports.ConfigUtil = require('./lib/common/config/config-util'); +module.exports.CaliperFlow = require('./lib/master/caliper-flow'); diff --git a/packages/caliper-core/lib/config/Config.js b/packages/caliper-core/lib/common/config/Config.js similarity index 100% rename from packages/caliper-core/lib/config/Config.js rename to packages/caliper-core/lib/common/config/Config.js diff --git a/packages/caliper-core/lib/config/config-util.js b/packages/caliper-core/lib/common/config/config-util.js similarity index 100% rename from packages/caliper-core/lib/config/config-util.js rename to packages/caliper-core/lib/common/config/config-util.js diff --git a/packages/caliper-core/lib/config/default.yaml b/packages/caliper-core/lib/common/config/default.yaml similarity index 100% rename from packages/caliper-core/lib/config/default.yaml rename to packages/caliper-core/lib/common/config/default.yaml diff --git a/packages/caliper-core/lib/blockchain-interface.js b/packages/caliper-core/lib/common/core/blockchain-interface.js similarity index 100% rename from packages/caliper-core/lib/blockchain-interface.js rename to packages/caliper-core/lib/common/core/blockchain-interface.js diff --git a/packages/caliper-core/lib/blockchain.js b/packages/caliper-core/lib/common/core/blockchain.js similarity index 98% rename from packages/caliper-core/lib/blockchain.js rename to packages/caliper-core/lib/common/core/blockchain.js index 7f855dd59..cee48fd09 100644 --- a/packages/caliper-core/lib/blockchain.js +++ b/packages/caliper-core/lib/common/core/blockchain.js @@ -14,7 +14,7 @@ 'use strict'; -const Logger = require('./utils/caliper-utils').getLogger('blockchain'); +const Logger = require('../utils/caliper-utils').getLogger('blockchain'); /** * BlockChain class, define operations to interact with the blockchain system under test @@ -38,7 +38,7 @@ class Blockchain { } /** - * Initialise test environment, e.g. create a fabric channel for the test + * Initialize test environment, e.g. create a fabric channel for the test * @async */ async init() { diff --git a/packages/caliper-core/lib/transaction-status.js b/packages/caliper-core/lib/common/core/transaction-status.js similarity index 90% rename from packages/caliper-core/lib/transaction-status.js rename to packages/caliper-core/lib/common/core/transaction-status.js index 46ccf9977..12cdf659d 100644 --- a/packages/caliper-core/lib/transaction-status.js +++ b/packages/caliper-core/lib/common/core/transaction-status.js @@ -37,7 +37,7 @@ class TxStatus { } /** - * Getter of the tx's id + * Getter of the tx id * @return {string}, id */ GetID() { @@ -45,7 +45,7 @@ class TxStatus { } /** - * Setter of the tx's id + * Setter of the tx id * @param {string} id, id */ SetID(id) { @@ -53,7 +53,7 @@ class TxStatus { } /** - * Getter of the tx's status + * Getter of the tx status * @return {string}, status */ GetStatus() { @@ -61,7 +61,7 @@ class TxStatus { } /** - * Check if the tx has been committed succesfully + * Check if the tx has been committed successfully * @return {boolean} committed or not */ IsCommitted() { @@ -69,7 +69,7 @@ class TxStatus { } /** - * Set the tx's status to 'success' + * Set the tx status to 'success' * The 'time_final' will also be recorded * @param {number} time The epoch time to record for the status change. */ @@ -79,7 +79,7 @@ class TxStatus { } /** - * Getter of the tx's creating time + * Getter of the tx creating time * @return {int} create time in ms */ GetTimeCreate() { @@ -87,7 +87,7 @@ class TxStatus { } /** - * Getter of the tx's final time + * Getter of the tx final time * @return {int} final time in ms */ GetTimeFinal() { @@ -95,7 +95,7 @@ class TxStatus { } /** - * Set the tx's status to 'failed' + * Set the tx status to 'failed' * The 'time_final' will also be recorded */ SetStatusFail() { @@ -104,7 +104,7 @@ class TxStatus { } /** - * Check if the tx's status is verified + * Check if the tx status is verified * @return {boolean}, verified or not */ IsVerified() { @@ -112,7 +112,7 @@ class TxStatus { } /** - * Setter of the tx's verification state + * Setter of the tx verification state * @param {*} isVerified, verified or not */ SetVerification(isVerified) { @@ -120,7 +120,7 @@ class TxStatus { } /** - * Getter of the blockchain sepecified flag + * Getter of the blockchain specified flag * @return {any}, flag */ GetFlag() { diff --git a/packages/caliper-core/lib/prometheus/prometheus-push-client.js b/packages/caliper-core/lib/common/prometheus/prometheus-push-client.js similarity index 100% rename from packages/caliper-core/lib/prometheus/prometheus-push-client.js rename to packages/caliper-core/lib/common/prometheus/prometheus-push-client.js diff --git a/packages/caliper-core/lib/prometheus/prometheus-query-client.js b/packages/caliper-core/lib/common/prometheus/prometheus-query-client.js similarity index 100% rename from packages/caliper-core/lib/prometheus/prometheus-query-client.js rename to packages/caliper-core/lib/common/prometheus/prometheus-query-client.js diff --git a/packages/caliper-core/lib/prometheus/prometheus-query-helper.js b/packages/caliper-core/lib/common/prometheus/prometheus-query-helper.js similarity index 100% rename from packages/caliper-core/lib/prometheus/prometheus-query-helper.js rename to packages/caliper-core/lib/common/prometheus/prometheus-query-helper.js diff --git a/packages/caliper-core/lib/utils/benchmark-validator.js b/packages/caliper-core/lib/common/utils/benchmark-validator.js similarity index 100% rename from packages/caliper-core/lib/utils/benchmark-validator.js rename to packages/caliper-core/lib/common/utils/benchmark-validator.js diff --git a/packages/caliper-core/lib/utils/caliper-utils.js b/packages/caliper-core/lib/common/utils/caliper-utils.js similarity index 98% rename from packages/caliper-core/lib/utils/caliper-utils.js rename to packages/caliper-core/lib/common/utils/caliper-utils.js index 011879c83..db1580704 100644 --- a/packages/caliper-core/lib/utils/caliper-utils.js +++ b/packages/caliper-core/lib/common/utils/caliper-utils.js @@ -78,19 +78,19 @@ class CaliperUtils { /** * parse a yaml file. - * @param {String} filenameOrFilepath the yaml file path + * @param {String} filenameOrFilePath the yaml file path * @return {object} the parsed data. */ - static parseYaml(filenameOrFilepath) { - if (!filenameOrFilepath) { + static parseYaml(filenameOrFilePath) { + if (!filenameOrFilePath) { throw new Error('Util.parseYaml: the name or path of a file is undefined'); } try{ - return yaml.safeLoad(fs.readFileSync(filenameOrFilepath),'utf8'); + return yaml.safeLoad(fs.readFileSync(filenameOrFilePath),'utf8'); } catch(err) { - throw new Error(`Failed to parse the ${filenameOrFilepath}: ${(err.message || err)}`); + throw new Error(`Failed to parse the ${filenameOrFilePath}: ${(err.message || err)}`); } } diff --git a/packages/caliper-core/lib/utils/log-formats.js b/packages/caliper-core/lib/common/utils/log-formats.js similarity index 100% rename from packages/caliper-core/lib/utils/log-formats.js rename to packages/caliper-core/lib/common/utils/log-formats.js diff --git a/packages/caliper-core/lib/utils/logging-util.js b/packages/caliper-core/lib/common/utils/logging-util.js similarity index 99% rename from packages/caliper-core/lib/utils/logging-util.js rename to packages/caliper-core/lib/common/utils/logging-util.js index 20e7349a2..3ede7d74a 100644 --- a/packages/caliper-core/lib/utils/logging-util.js +++ b/packages/caliper-core/lib/common/utils/logging-util.js @@ -108,7 +108,7 @@ function _processFormatOptions() { // so the user can change them from the command line or from evn vars // 2) The sub-properties of the formats are also queried directly for the same reason // 3) The formats are applied in the following order: timestamp, label, json, - // if not json, then padding, align, attributeformat, colorize + // if not json, then padding, align, AttributeFormat, colorize let formatKey = conf.keys.Logging.Formats; diff --git a/packages/caliper-core/lib/utils/version.js b/packages/caliper-core/lib/common/utils/version.js similarity index 100% rename from packages/caliper-core/lib/utils/version.js rename to packages/caliper-core/lib/common/utils/version.js diff --git a/packages/caliper-core/lib/caliper-flow.js b/packages/caliper-core/lib/master/caliper-flow.js similarity index 95% rename from packages/caliper-core/lib/caliper-flow.js rename to packages/caliper-core/lib/master/caliper-flow.js index 296bc1bcb..a4681abbb 100644 --- a/packages/caliper-core/lib/caliper-flow.js +++ b/packages/caliper-core/lib/master/caliper-flow.js @@ -14,14 +14,14 @@ 'use strict'; -const Blockchain = require('./blockchain'); -const CaliperUtils = require('./utils/caliper-utils'); -const ClientOrchestrator = require('./client/client-orchestrator'); +const Blockchain = require('../common/core/blockchain'); +const CaliperUtils = require('../common/utils/caliper-utils'); +const ClientOrchestrator = require('../worker/client/client-orchestrator'); const MonitorOrchestrator = require('./monitor/monitor-orchestrator'); const Report = require('./report/report'); const DefaultTest = require('./test-runners/default-test'); const TestObserver = require('./test-observers/test-observer'); -const BenchValidator = require('./utils/benchmark-validator'); +const BenchValidator = require('../common/utils/benchmark-validator'); const logger = CaliperUtils.getLogger('caliper-flow'); diff --git a/packages/caliper-core/lib/monitor/monitor-docker.js b/packages/caliper-core/lib/master/monitor/monitor-docker.js similarity index 99% rename from packages/caliper-core/lib/monitor/monitor-docker.js rename to packages/caliper-core/lib/master/monitor/monitor-docker.js index 817310163..702778158 100644 --- a/packages/caliper-core/lib/monitor/monitor-docker.js +++ b/packages/caliper-core/lib/master/monitor/monitor-docker.js @@ -15,7 +15,7 @@ 'use strict'; -const Util = require('../utils/caliper-utils'); +const Util = require('../../common/utils/caliper-utils'); const Logger = Util.getLogger('monitor-docker'); const MonitorInterface = require('./monitor-interface'); const MonitorUtilities = require('./monitor-utilities'); diff --git a/packages/caliper-core/lib/monitor/monitor-interface.js b/packages/caliper-core/lib/master/monitor/monitor-interface.js similarity index 100% rename from packages/caliper-core/lib/monitor/monitor-interface.js rename to packages/caliper-core/lib/master/monitor/monitor-interface.js diff --git a/packages/caliper-core/lib/monitor/monitor-orchestrator.js b/packages/caliper-core/lib/master/monitor/monitor-orchestrator.js similarity index 98% rename from packages/caliper-core/lib/monitor/monitor-orchestrator.js rename to packages/caliper-core/lib/master/monitor/monitor-orchestrator.js index 59dbae2ef..ca60cb1e4 100644 --- a/packages/caliper-core/lib/monitor/monitor-orchestrator.js +++ b/packages/caliper-core/lib/master/monitor/monitor-orchestrator.js @@ -18,7 +18,7 @@ const DockerMonitor = require('./monitor-docker.js'); const ProcessMonitor = require('./monitor-process.js'); const PrometheusMonitor = require('./monitor-prometheus.js'); -const Util = require('../utils/caliper-utils'); +const Util = require('../../common/utils/caliper-utils'); const logger= Util.getLogger('monitor.js'); const NONE = 'none'; diff --git a/packages/caliper-core/lib/monitor/monitor-process.js b/packages/caliper-core/lib/master/monitor/monitor-process.js similarity index 99% rename from packages/caliper-core/lib/monitor/monitor-process.js rename to packages/caliper-core/lib/master/monitor/monitor-process.js index 75e5e3595..a98fbae98 100644 --- a/packages/caliper-core/lib/monitor/monitor-process.js +++ b/packages/caliper-core/lib/master/monitor/monitor-process.js @@ -16,7 +16,7 @@ const MonitorInterface = require('./monitor-interface'); const MonitorUtilities = require('./monitor-utilities'); -const Util = require('../utils/caliper-utils'); +const Util = require('../../common/utils/caliper-utils'); const Logger = Util.getLogger('monitor-process'); const ps = require('ps-node'); diff --git a/packages/caliper-core/lib/monitor/monitor-prometheus.js b/packages/caliper-core/lib/master/monitor/monitor-prometheus.js similarity index 94% rename from packages/caliper-core/lib/monitor/monitor-prometheus.js rename to packages/caliper-core/lib/master/monitor/monitor-prometheus.js index c57c9f2a5..421b315b2 100644 --- a/packages/caliper-core/lib/monitor/monitor-prometheus.js +++ b/packages/caliper-core/lib/master/monitor/monitor-prometheus.js @@ -14,13 +14,13 @@ 'use strict'; -const Util = require('../utils/caliper-utils.js'); +const Util = require('../../common/utils/caliper-utils.js'); const Logger = Util.getLogger('monitor-prometheus.js'); const MonitorInterface = require('./monitor-interface'); -const PrometheusPushClient = require('../prometheus/prometheus-push-client'); -const PrometheusQueryClient = require('../prometheus/prometheus-query-client'); -const PrometheusQueryHelper = require('../prometheus/prometheus-query-helper'); +const PrometheusPushClient = require('../../common/prometheus/prometheus-push-client'); +const PrometheusQueryClient = require('../../common/prometheus/prometheus-query-client'); +const PrometheusQueryHelper = require('../../common/prometheus/prometheus-query-helper'); /** * Prometheus monitor implementation diff --git a/packages/caliper-core/lib/monitor/monitor-utilities.js b/packages/caliper-core/lib/master/monitor/monitor-utilities.js similarity index 100% rename from packages/caliper-core/lib/monitor/monitor-utilities.js rename to packages/caliper-core/lib/master/monitor/monitor-utilities.js diff --git a/packages/caliper-core/lib/report/report-builder.js b/packages/caliper-core/lib/master/report/report-builder.js similarity index 98% rename from packages/caliper-core/lib/report/report-builder.js rename to packages/caliper-core/lib/master/report/report-builder.js index 89c27585e..1396bfdc5 100644 --- a/packages/caliper-core/lib/report/report-builder.js +++ b/packages/caliper-core/lib/master/report/report-builder.js @@ -15,9 +15,9 @@ 'use strict'; -const Config = require('../config/config-util'); -const Utils = require('../utils/caliper-utils'); -const Logger = Utils.getLogger('caliper-flow'); +const Config = require('../../common/config/config-util'); +const Utils = require('../../common/utils/caliper-utils'); +const Logger = Utils.getLogger('report-builder'); const fs = require('fs'); const Mustache = require('mustache'); const path = require('path'); diff --git a/packages/caliper-core/lib/report/report.js b/packages/caliper-core/lib/master/report/report.js similarity index 98% rename from packages/caliper-core/lib/report/report.js rename to packages/caliper-core/lib/master/report/report.js index a5f2cdcea..e068bbd86 100644 --- a/packages/caliper-core/lib/report/report.js +++ b/packages/caliper-core/lib/master/report/report.js @@ -15,9 +15,9 @@ 'use strict'; const ReportBuilder = require('./report-builder'); -const PrometheusQueryHelper = require('../prometheus/prometheus-query-helper'); -const Blockchain = require('../blockchain'); -const CaliperUtils = require('../utils/caliper-utils'); +const PrometheusQueryHelper = require('../../common/prometheus/prometheus-query-helper'); +const Blockchain = require('../../common/core/blockchain'); +const CaliperUtils = require('../../common/utils/caliper-utils'); const Logger = CaliperUtils.getLogger('report-builder'); const table = require('table'); diff --git a/packages/caliper-core/lib/report/template/report.html b/packages/caliper-core/lib/master/report/template/report.html old mode 100644 new mode 100755 similarity index 99% rename from packages/caliper-core/lib/report/template/report.html rename to packages/caliper-core/lib/master/report/template/report.html index 93746bc07..5d499d5c3 --- a/packages/caliper-core/lib/report/template/report.html +++ b/packages/caliper-core/lib/master/report/template/report.html @@ -1,7 +1,7 @@ - Caliper Report + Hyperledger Caliper Report