Skip to content

Commit

Permalink
This is a test for webhooks
Browse files Browse the repository at this point in the history
This also includes 
- Now wallets are replicated to MongoDB
- Ledger transaction simulator is being tested on BlockchainManager
  • Loading branch information
martin-headspace committed Nov 1, 2017
1 parent b777153 commit 3bd1392
Show file tree
Hide file tree
Showing 6 changed files with 223 additions and 129 deletions.
2 changes: 2 additions & 0 deletions composer-logs/trace_20171102-104326-214.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
2017-11-01T16:43:33.681Z ERROR HLFConnectionManager :fabric-client() [client-utils.js]: sendPeersProposal - Promise is rejected: Error: chaincode error (status: 500, message: Error installing chaincode code lyra-cli:0.14.1(chaincode /var/hyperledger/production/chaincodes/lyra-cli.0.14.1 exists))
at /usr/local/lib/node_modules/composer-cli/node_modules/fabric-client/node_modules/grpc/src/node/src/client.js:434:17 {}$
4 changes: 4 additions & 0 deletions composer-logs/trace_20171102-104350-957.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
2017-11-01T16:43:52.582Z ERROR HLFConnectionManager :fabric-client() [client-utils.js]: sendPeersProposal - Promise is rejected: Error: chaincode error (status: 500, message: Error: The current identity must be activated (ACTIVATION_REQUIRED))
at /usr/local/lib/node_modules/composer-cli/node_modules/fabric-client/node_modules/grpc/src/node/src/client.js:434:17 {}$
2017-11-01T16:43:52.583Z ERROR HLFConnection :queryChainCode() {"message":"Error trying to query business network. Error: chaincode error (status: 500, message: Error: The current identity must be activated (ACTIVATION_REQUIRED))","stack":"Error: Error trying to query business network. Error: chaincode error (status: 500, message: Error: The current identity must be activated (ACTIVATION_REQUIRED))\n at channel.queryByChaincode.then.catch (/usr/local/lib/node_modules/composer-cli/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:749:34)\n at <anonymous>"}$
2017-11-01T16:43:52.583Z ERROR HLFConnection :ping() {"message":"Error trying to ping. Error: Error trying to query business network. Error: chaincode error (status: 500, message: Error: The current identity must be activated (ACTIVATION_REQUIRED))","stack":"Error: Error trying to ping. Error: Error trying to query business network. Error: chaincode error (status: 500, message: Error: The current identity must be activated (ACTIVATION_REQUIRED))\n at _checkRuntimeVersions.then.catch (/usr/local/lib/node_modules/composer-cli/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:663:34)\n at <anonymous>"}$
107 changes: 67 additions & 40 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ var yargs = require('yargs')
alias: 't'
}
})
.command('ledger', 'Checks if ledger is synced', {
transactions: {
description: 'Amount of transactions to launch into the ledger',
require: true,
alias: 't'
}
})
.help()
.argv;

Expand Down Expand Up @@ -183,13 +190,33 @@ switch (yargs._[0]) {
case 'cannon':
console.log(chalk.bold.cyan('Lyra CLI App'), chalk.bold.green('Made by Aabo Technologies © 2017'));
hyper.transactionCannon(yargs.transactions)
.then(()=>{
process.exit(0);
})
.catch(function(error){
console.log('An error occured: ', chalk.bold.red(error));
process.exit(1);
})
.then(() => {
process.exit(0);
})
.catch(function (error) {
console.log('An error occured: ', chalk.bold.red(error));
process.exit(1);
})
break;

case 'ledger':
console.log(chalk.bold.cyan('Lyra CLI App'), chalk.bold.green('Made by Aabo Technologies © 2017'));
hyper.getTransactionSchedule(yargs.transactions)
.then((schedule) => {
return hyper.isLedgerStateCorrect(schedule);
})
.then((result) => {
if (result) {
console.log(chalk.green('Success!'));
} else {
console.log(chalk.red('Not Success'));
}
process.exit(0);
})
.catch(function (error) {
console.log('An error occured: ', chalk.bold.red(error));
process.exit(1);
});
break;

default:
Expand Down Expand Up @@ -227,7 +254,7 @@ function author() {

/**@description Shows the menu with the main options
* @returns {Nothing}
*/
*/

function mainMenu() {
/** Displays the main menu */
Expand Down Expand Up @@ -313,7 +340,7 @@ function debugMenu() {
.then(() => {
debugMenu();
})
.catch(function(error){
.catch(function (error) {
console.log('An error occured: ', chalk.bold.red(error));
process.exit(1);
});
Expand All @@ -323,7 +350,7 @@ function debugMenu() {
.then(() => {
debugMenu();
})
.catch(function(error){
.catch(function (error) {
console.log('An error occured: ', chalk.bold.red(error));
process.exit(1);
});
Expand All @@ -336,7 +363,7 @@ function debugMenu() {
.then(() => {
debugMenu();
})
.catch(function(error){
.catch(function (error) {
console.log('An error occured: ', chalk.bold.red(error));
process.exit(1);
});
Expand All @@ -346,7 +373,7 @@ function debugMenu() {
.then(() => {
debugMenu();
})
.catch(function(error){
.catch(function (error) {
console.log('An error occured: ', chalk.bold.red(error));
process.exit(1);
});
Expand All @@ -373,7 +400,7 @@ function testingMenu() {
})
)
);

var questions = [{
type: "list",
name: "initial",
Expand All @@ -388,19 +415,19 @@ function testingMenu() {
}];

inquirer.prompt(questions).then(function (answers) {
switch (answers.initial){
switch (answers.initial) {
case 'Create batch accounts':
batchCreation('test');
break;
break;

case 'Start the transaction cannon':
startTheCannon();
break;
break;

case 'Go back to the main menu':
clear();
mainMenu();
break;
clear();
mainMenu();
break;
}
});
}
Expand All @@ -409,7 +436,7 @@ function testingMenu() {
* @returns {Nothing}
*/

function startTheCannon(){
function startTheCannon() {
var questions = [{
type: 'input',
name: 'transactions',
Expand All @@ -418,13 +445,13 @@ function startTheCannon(){
}];
inquirer.prompt(questions).then(function (answers) {
hyper.transactionCannon(answers.transactions)
.then(()=>{
testingMenu();
})
.catch(function(error){
console.log('An error occured: ', chalk.bold.red(error));
process.exit(1);
});
.then(() => {
testingMenu();
})
.catch(function (error) {
console.log('An error occured: ', chalk.bold.red(error));
process.exit(1);
});
});
}

Expand Down Expand Up @@ -455,18 +482,18 @@ function batchCreation(whereTo) {
];

inquirer.prompt(questions).then(function (answers) {
hyper.batchAccount(answers.clientNumber,answers.bottom,answers.top)
.then(()=>{
if('debug'){
debugMenu();
}else{
testingMenu();
}
})
.catch(function(error){
console.log('An error occured: ', chalk.bold.red(error));
process.exit(1);
});
hyper.batchAccount(answers.clientNumber, answers.bottom, answers.top)
.then(() => {
if ('debug') {
debugMenu();
} else {
testingMenu();
}
})
.catch(function (error) {
console.log('An error occured: ', chalk.bold.red(error));
process.exit(1);
});
});
}

Expand Down Expand Up @@ -495,7 +522,7 @@ function makeTransaction() {
.then(() => {
mainMenu();
})
.catch(function(error){
.catch(function (error) {
console.log('An error occured: ', chalk.bold.red(error));
process.exit(1);
});
Expand Down
Loading

0 comments on commit 3bd1392

Please sign in to comment.