From 96fd131d2f3646396bb87beb084759199cf7ca27 Mon Sep 17 00:00:00 2001 From: Andrew Hurt <31732124+awjh-ibm@users.noreply.github.com> Date: Thu, 1 Mar 2018 13:47:08 +0000 Subject: [PATCH] fixed tests for cloud wallet addition and assed options field to a PlaceOrderEvent (#150) Signed-off-by: awjh-ibm --- package.json | 2 +- packages/animaltracking-network/test/mozart.cto.js | 4 ++-- packages/basic-sample-network/test/sample.js | 4 ++-- packages/bond-network/test/Bond.js | 4 ++-- packages/carauction-network/test/CarAuction.js | 4 ++-- packages/digitalproperty-network/test/DigitalLandTitle.js | 4 ++-- packages/marbles-network/test/MarblesTests.js | 4 ++-- packages/perishable-network/test/perishable.js | 4 ++-- packages/pii-network/test/pii.js | 4 ++-- packages/trade-network/test/trading.js | 4 ++-- packages/vehicle-lifecycle-network/test/util.js | 4 ++-- packages/vehicle-manufacture-network/lib/script.js | 1 + .../models/org.acme.vehicle_network.cto | 1 + packages/vehicle-manufacture-network/test/script.js | 4 ++-- 14 files changed, 25 insertions(+), 23 deletions(-) diff --git a/package.json b/package.json index 9a351e8..48dda8b 100644 --- a/package.json +++ b/package.json @@ -31,4 +31,4 @@ ], "author": "Hyperledger Composer", "license": "Apache-2.0" -} \ No newline at end of file +} diff --git a/packages/animaltracking-network/test/mozart.cto.js b/packages/animaltracking-network/test/mozart.cto.js index 7eb33f1..e5c77db 100644 --- a/packages/animaltracking-network/test/mozart.cto.js +++ b/packages/animaltracking-network/test/mozart.cto.js @@ -16,7 +16,7 @@ const AdminConnection = require('composer-admin').AdminConnection; const BusinessNetworkConnection = require('composer-client').BusinessNetworkConnection; -const { BusinessNetworkDefinition, CertificateUtil, IdCard, MemoryCardStore } = require('composer-common'); +const { BusinessNetworkDefinition, CertificateUtil, IdCard } = require('composer-common'); const path = require('path'); const Util = require('./util'); @@ -26,7 +26,7 @@ require('chai').should(); describe('Animal Tracking Network', function() { // In-memory card store for testing so cards are not persisted to the file system - const cardStore = new MemoryCardStore(); + const cardStore = require('composer-common').NetworkCardStoreManager.getCardStore( { type: 'composer-wallet-inmemory' } ); let adminConnection; let businessNetworkConnection; diff --git a/packages/basic-sample-network/test/sample.js b/packages/basic-sample-network/test/sample.js index e2d8894..45267bd 100644 --- a/packages/basic-sample-network/test/sample.js +++ b/packages/basic-sample-network/test/sample.js @@ -16,7 +16,7 @@ const AdminConnection = require('composer-admin').AdminConnection; const BusinessNetworkConnection = require('composer-client').BusinessNetworkConnection; -const { BusinessNetworkDefinition, CertificateUtil, IdCard, MemoryCardStore } = require('composer-common'); +const { BusinessNetworkDefinition, CertificateUtil, IdCard } = require('composer-common'); const path = require('path'); const chai = require('chai'); @@ -25,7 +25,7 @@ chai.use(require('chai-as-promised')); describe('Sample', () => { // In-memory card store for testing so cards are not persisted to the file system - const cardStore = new MemoryCardStore(); + const cardStore = require('composer-common').NetworkCardStoreManager.getCardStore( { type: 'composer-wallet-inmemory' } ); // Embedded connection used for local testing const connectionProfile = { diff --git a/packages/bond-network/test/Bond.js b/packages/bond-network/test/Bond.js index 5b9d8c7..49aba72 100644 --- a/packages/bond-network/test/Bond.js +++ b/packages/bond-network/test/Bond.js @@ -16,7 +16,7 @@ const AdminConnection = require('composer-admin').AdminConnection; const BusinessNetworkConnection = require('composer-client').BusinessNetworkConnection; -const { BusinessNetworkDefinition, CertificateUtil, IdCard, MemoryCardStore } = require('composer-common'); +const { BusinessNetworkDefinition, CertificateUtil, IdCard } = require('composer-common'); const path = require('path'); require('chai').should(); @@ -25,7 +25,7 @@ const namespace = 'org.acme.bond'; describe('Publish Bond', () => { // In-memory card store for testing so cards are not persisted to the file system - const cardStore = new MemoryCardStore(); + const cardStore = require('composer-common').NetworkCardStoreManager.getCardStore( { type: 'composer-wallet-inmemory' } ); let adminConnection; let businessNetworkConnection; diff --git a/packages/carauction-network/test/CarAuction.js b/packages/carauction-network/test/CarAuction.js index a973831..02a3ec6 100644 --- a/packages/carauction-network/test/CarAuction.js +++ b/packages/carauction-network/test/CarAuction.js @@ -16,7 +16,7 @@ const AdminConnection = require('composer-admin').AdminConnection; const BusinessNetworkConnection = require('composer-client').BusinessNetworkConnection; -const { BusinessNetworkDefinition, CertificateUtil, IdCard, MemoryCardStore } = require('composer-common'); +const { BusinessNetworkDefinition, CertificateUtil, IdCard } = require('composer-common'); const path = require('path'); require('chai').should(); @@ -25,7 +25,7 @@ const NS = 'org.acme.vehicle.auction'; describe('CarAuction', () => { // In-memory card store for testing so cards are not persisted to the file system - const cardStore = new MemoryCardStore(); + const cardStore = require('composer-common').NetworkCardStoreManager.getCardStore( { type: 'composer-wallet-inmemory' } ); let adminConnection; let businessNetworkConnection; diff --git a/packages/digitalproperty-network/test/DigitalLandTitle.js b/packages/digitalproperty-network/test/DigitalLandTitle.js index 31efac7..085e01a 100644 --- a/packages/digitalproperty-network/test/DigitalLandTitle.js +++ b/packages/digitalproperty-network/test/DigitalLandTitle.js @@ -16,14 +16,14 @@ const AdminConnection = require('composer-admin').AdminConnection; const BusinessNetworkConnection = require('composer-client').BusinessNetworkConnection; -const { BusinessNetworkDefinition, CertificateUtil, IdCard, MemoryCardStore } = require('composer-common'); +const { BusinessNetworkDefinition, CertificateUtil, IdCard } = require('composer-common'); const path = require('path'); require('chai').should(); describe('DigitalLandTitle', () => { // In-memory card store for testing so cards are not persisted to the file system - const cardStore = new MemoryCardStore(); + const cardStore = require('composer-common').NetworkCardStoreManager.getCardStore( { type: 'composer-wallet-inmemory' } ); let adminConnection; let businessNetworkConnection; diff --git a/packages/marbles-network/test/MarblesTests.js b/packages/marbles-network/test/MarblesTests.js index 7aa9261..6b08706 100644 --- a/packages/marbles-network/test/MarblesTests.js +++ b/packages/marbles-network/test/MarblesTests.js @@ -16,7 +16,7 @@ const AdminConnection = require('composer-admin').AdminConnection; const BusinessNetworkConnection = require('composer-client').BusinessNetworkConnection; -const { BusinessNetworkDefinition, CertificateUtil, IdCard, MemoryCardStore } = require('composer-common'); +const { BusinessNetworkDefinition, CertificateUtil, IdCard } = require('composer-common'); const path = require('path'); require('chai').should(); @@ -25,7 +25,7 @@ const namespace = 'org.hyperledger_composer.marbles'; describe('Marbles', () => { // In-memory card store for testing so cards are not persisted to the file system - const cardStore = new MemoryCardStore(); + const cardStore = require('composer-common').NetworkCardStoreManager.getCardStore( { type: 'composer-wallet-inmemory' } ); let adminConnection; let businessNetworkConnection; diff --git a/packages/perishable-network/test/perishable.js b/packages/perishable-network/test/perishable.js index 15eab63..7770184 100644 --- a/packages/perishable-network/test/perishable.js +++ b/packages/perishable-network/test/perishable.js @@ -16,7 +16,7 @@ const AdminConnection = require('composer-admin').AdminConnection; const BusinessNetworkConnection = require('composer-client').BusinessNetworkConnection; -const { BusinessNetworkDefinition, CertificateUtil, IdCard, MemoryCardStore } = require('composer-common'); +const { BusinessNetworkDefinition, CertificateUtil, IdCard } = require('composer-common'); const path = require('path'); require('chai').should(); @@ -28,7 +28,7 @@ let importer_id = 'supermarket@email.com'; describe('Perishable Shipping Network', () => { // In-memory card store for testing so cards are not persisted to the file system - const cardStore = new MemoryCardStore(); + const cardStore = require('composer-common').NetworkCardStoreManager.getCardStore( { type: 'composer-wallet-inmemory' } ); let adminConnection; let businessNetworkConnection; let factory; diff --git a/packages/pii-network/test/pii.js b/packages/pii-network/test/pii.js index 660ccc8..490544a 100644 --- a/packages/pii-network/test/pii.js +++ b/packages/pii-network/test/pii.js @@ -16,7 +16,7 @@ const AdminConnection = require('composer-admin').AdminConnection; const BusinessNetworkConnection = require('composer-client').BusinessNetworkConnection; -const { BusinessNetworkDefinition, CertificateUtil, IdCard, MemoryCardStore } = require('composer-common'); +const { BusinessNetworkDefinition, CertificateUtil, IdCard } = require('composer-common'); const path = require('path'); require('chai').should(); @@ -25,7 +25,7 @@ const namespace = 'org.acme.pii'; describe('Acl checking', () => { // In-memory card store for testing so cards are not persisted to the file system - const cardStore = new MemoryCardStore(); + const cardStore = require('composer-common').NetworkCardStoreManager.getCardStore( { type: 'composer-wallet-inmemory' } ); // Embedded connection used for local testing const connectionProfile = { diff --git a/packages/trade-network/test/trading.js b/packages/trade-network/test/trading.js index 190554e..08e42d4 100644 --- a/packages/trade-network/test/trading.js +++ b/packages/trade-network/test/trading.js @@ -16,7 +16,7 @@ const AdminConnection = require('composer-admin').AdminConnection; const BusinessNetworkConnection = require('composer-client').BusinessNetworkConnection; -const { BusinessNetworkDefinition, CertificateUtil, IdCard, MemoryCardStore } = require('composer-common'); +const { BusinessNetworkDefinition, CertificateUtil, IdCard } = require('composer-common'); const path = require('path'); require('chai').should(); @@ -25,7 +25,7 @@ const namespace = 'org.acme.trading'; describe('Commodity Trading', () => { // In-memory card store for testing so cards are not persisted to the file system - const cardStore = new MemoryCardStore(); + const cardStore = require('composer-common').NetworkCardStoreManager.getCardStore( { type: 'composer-wallet-inmemory' } ); let adminConnection; let businessNetworkConnection; diff --git a/packages/vehicle-lifecycle-network/test/util.js b/packages/vehicle-lifecycle-network/test/util.js index ceafa9c..5762dd3 100644 --- a/packages/vehicle-lifecycle-network/test/util.js +++ b/packages/vehicle-lifecycle-network/test/util.js @@ -16,14 +16,14 @@ const AdminConnection = require('composer-admin').AdminConnection; const BusinessNetworkConnection = require('composer-client').BusinessNetworkConnection; -const { BusinessNetworkDefinition, CertificateUtil, IdCard, MemoryCardStore } = require('composer-common'); +const { BusinessNetworkDefinition, CertificateUtil, IdCard } = require('composer-common'); const path = require('path'); const NS = 'org.acme.vehicle.lifecycle'; const NS_M = 'org.acme.vehicle.lifecycle.manufacturer'; const NS_D = 'org.vda'; -const cardStore = new MemoryCardStore(); +const cardStore = require('composer-common').NetworkCardStoreManager.getCardStore( { type: 'composer-wallet-inmemory' } ); const adminCardName = 'admin'; let adminConnection; diff --git a/packages/vehicle-manufacture-network/lib/script.js b/packages/vehicle-manufacture-network/lib/script.js index 2933802..4a90a54 100644 --- a/packages/vehicle-manufacture-network/lib/script.js +++ b/packages/vehicle-manufacture-network/lib/script.js @@ -40,6 +40,7 @@ async function placeOrder(orderRequest) { // eslint-disable-line no-unused-vars const placeOrderEvent = factory.newEvent(namespace, 'PlaceOrderEvent'); placeOrderEvent.orderId = order.orderId; placeOrderEvent.vehicleDetails = order.vehicleDetails; + placeOrderEvent.options = order.options; placeOrderEvent.orderer = order.orderer; emit(placeOrderEvent); } diff --git a/packages/vehicle-manufacture-network/models/org.acme.vehicle_network.cto b/packages/vehicle-manufacture-network/models/org.acme.vehicle_network.cto index 92799ff..786461f 100644 --- a/packages/vehicle-manufacture-network/models/org.acme.vehicle_network.cto +++ b/packages/vehicle-manufacture-network/models/org.acme.vehicle_network.cto @@ -59,6 +59,7 @@ transaction PlaceOrder { event PlaceOrderEvent { o String orderId o VehicleDetails vehicleDetails + o Options options --> Person orderer } diff --git a/packages/vehicle-manufacture-network/test/script.js b/packages/vehicle-manufacture-network/test/script.js index 3cb5455..77ea2ed 100644 --- a/packages/vehicle-manufacture-network/test/script.js +++ b/packages/vehicle-manufacture-network/test/script.js @@ -16,7 +16,7 @@ const AdminConnection = require('composer-admin').AdminConnection; const BusinessNetworkConnection = require('composer-client').BusinessNetworkConnection; -const { BusinessNetworkDefinition, CertificateUtil, IdCard, MemoryCardStore } = require('composer-common'); +const { BusinessNetworkDefinition, CertificateUtil, IdCard } = require('composer-common'); const path = require('path'); const chai = require('chai'); @@ -28,7 +28,7 @@ const orderId = '1000-1000-1000-1000'; const vin = '1a2b3c4d5e6f7g8h9'; describe('Manufacture network', () => { - const cardStore = new MemoryCardStore(); + const cardStore = require('composer-common').NetworkCardStoreManager.getCardStore( { type: 'composer-wallet-inmemory' } ); let adminConnection; let businessNetworkConnection; let factory;