Skip to content

Commit

Permalink
Remove channel and chaincode ops from Fabric v1 (#1411)
Browse files Browse the repository at this point in the history
Signed-off-by: CaptainIRS <[email protected]>
  • Loading branch information
CaptainIRS authored Jul 20, 2022
1 parent 5025d20 commit 78e4e84
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 925 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ const semver = require('semver');
const { DefaultEventHandlerStrategies, DefaultQueryHandlerStrategies, Gateway } = require('fabric-network');
const { ConnectorBase, CaliperUtils, TxStatus, ConfigUtil } = require('@hyperledger/caliper-core');
const FabricConnectorContext = require('../../FabricConnectorContext');
const FabricChannelOperations = require('./FabricChannelOperations');
const FabricChaincodeOperations = require('./FabricChaincodeOperations');

const logger = CaliperUtils.getLogger('connectors/v1/FabricGateway');

Expand Down Expand Up @@ -133,18 +131,14 @@ class V1FabricGateway extends ConnectorBase {
const tlsInfo = this.connectorConfiguration.isMutualTLS() ? 'mutual'
: ((await this.connectorConfiguration.getConnectionProfileDefinitionForOrganization(defaultOrganization)).isTLSEnabled() ? 'server' : 'none');
logger.info(`Fabric SDK version: ${this.fabricNetworkVersion.toString()}; TLS based on ${defaultOrganization}: ${tlsInfo}`);

const fabricChannelOperations = new FabricChannelOperations(this.connectorConfiguration);
await fabricChannelOperations.createChannelsAndJoinPeers();
}

/**
* Installs and initializes the specified contracts.
* @async
*/
async installSmartContract() {
const fabricChaincodeOperations = new FabricChaincodeOperations(this.connectorConfiguration);
await fabricChaincodeOperations.installAndInstantiateChaincodes();
logger.warn(`Install smart contract not available with Fabric SDK version: ${this.fabricNetworkVersion.toString()}`);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ const FabricConstants = require('fabric-client/lib/Constants');
const {ConnectorBase, CaliperUtils, TxStatus, Version, ConfigUtil} = require('@hyperledger/caliper-core');
const FabricConnectorContext = require('../../FabricConnectorContext');
const ClientCreator = require('./ClientCreator');
const FabricChannelOperations = require('./FabricChannelOperations');
const FabricChaincodeOperations = require('./FabricChaincodeOperations');
const logger = CaliperUtils.getLogger('connectors/v1/FabricNonGateway');

/**
Expand Down Expand Up @@ -129,18 +127,14 @@ class V1Fabric extends ConnectorBase {
const tlsInfo = this.connectorConfiguration.isMutualTLS() ? 'mutual'
: ((await this.connectorConfiguration.getConnectionProfileDefinitionForOrganization(defaultOrganization)).isTLSEnabled() ? 'server' : 'none');
logger.info(`Fabric SDK version: ${this.fabricNetworkVersion.toString()}; TLS based on ${defaultOrganization}: ${tlsInfo}`);

const fabricChannelOperations = new FabricChannelOperations(this.connectorConfiguration);
await fabricChannelOperations.createChannelsAndJoinPeers();
}

/**
* Installs and initializes the specified contracts.
* @async
*/
async installSmartContract() {
const fabricChaincodeOperations = new FabricChaincodeOperations(this.connectorConfiguration);
await fabricChaincodeOperations.installAndInstantiateChaincodes();
logger.warn(`Install smart contract not available with Fabric SDK version: ${this.fabricNetworkVersion.toString()}`);
}

/**
Expand Down
5 changes: 1 addition & 4 deletions packages/caliper-fabric/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"semver": "7.1.1"
},
"devDependencies": {
"fabric-protos": "2.1.0",
"chai": "^3.5.0",
"chai-as-promised": "^7.1.1",
"eslint": "^5.16.0",
Expand Down Expand Up @@ -88,8 +87,6 @@
"lib/identity-management/IWallet*",
"lib/connector-versions/v1/fabric-gateway.js",
"lib/connector-versions/v1/fabric.js",
"lib/connector-versions/v1/FabricChaincodeOperations.js",
"lib/connector-versions/v1/FabricChannelOperations.js",
"lib/connector-versions/v2/fabric-gateway.js",
"lib/connector-versions/v2/registrarHelper.js"
],
Expand All @@ -105,4 +102,4 @@
"lines": 1
},
"license": "Apache-2.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,6 @@ describe('A Node-SDK V1 Fabric Gateway', () => {
mockery.registerMock('fabric-client', Client);
mockery.registerMock('fabric-client/lib/Constants', Constants);
mockery.registerMock('fabric-network/package', {version: '1.4.11'});
mockery.registerMock('./FabricChannelOperations', class {
/** */
async createChannelsAndJoinPeers() {}
});
mockery.registerMock('./FabricChaincodeOperations', class {
/** */
async installAndInstantiateChaincodes() {}
});

FabricGateway = require('../../../lib/connector-versions/v1/FabricGateway');
GenerateWallet = require('../../utils/GenerateWallet');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,6 @@ describe('A Node-SDK V1 Fabric Non Gateway', () => {
mockery.registerMock('fabric-client', Client);
mockery.registerMock('fabric-client/lib/Constants', Constants);
mockery.registerMock('fabric-client/package', {version: '1.4.11'});
mockery.registerMock('./FabricChannelOperations', class {
/** */
async createChannelsAndJoinPeers() {}
});
mockery.registerMock('./FabricChaincodeOperations', class {
/** */
async installAndInstantiateChaincodes() {}
});

FabricNonGateway = require('../../../lib/connector-versions/v1/FabricNonGateway');
FabricConnectorContext = require('../../../lib/FabricConnectorContext');
Expand Down

0 comments on commit 78e4e84

Please sign in to comment.