-
Notifications
You must be signed in to change notification settings - Fork 515
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FABN-1396] convert base endorse scenario test
- convert js-cucmber endorse sceanrio test - update typedefs Change-Id: I1ae84acd4a751a3a1409ce00e60b5951f008b6a6 Signed-off-by: [email protected] <[email protected]>
- Loading branch information
Showing
18 changed files
with
682 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
/** | ||
* Copyright 2017 Kapil Sachdeva All Rights Reserved. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
} | ||
}, | ||
"files": [ | ||
"types/index.d.ts" | ||
"index.d.ts" | ||
], | ||
"formatCodeOptions": { | ||
"indentSize": 4, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
@base_api | ||
Feature: Use base API to perform core operations | ||
|
||
Background: | ||
Given I place a scenario start message BASE API FEATURE | ||
Given I deploy a tls Fabric network | ||
And I use the cli to create and join the channel named baseapichannel on the deployed network | ||
And I use the cli to deploy a node smart contract named fabcar at version 1.0.0 for all organizations on channel baseapichannel with endorsement policy 1of and arguments ["initLedger"] | ||
|
||
Scenario: Using only fabric-base I can propose, endorse and commit a transaction on instantiated node chaincode | ||
Given I have created a client named leon based on information in profile ccp-tls under organization Org1 | ||
And I have used the client named leon to create a channel object for the channel named baseapichannel | ||
When I build a new endorsement request named myFirstRequest for smart contract named fabcar with arguments [createCar, 2000, GMC, Savana, grey, Jones] as client leon on channel baseapichannel | ||
And I commit the endorsement request named myFirstRequest as client leon on channel baseapichannel | ||
Then the request named myFirstRequest for client leon has a general result matching "{\"result\":\"SUCCESS\"}" | ||
And the request named myFirstRequest for client leon has a event result matching "{\"result\":\"Commit success\"}" | ||
And the request named myFirstRequest for client leon has a commit result matching "{\"status\":\"SUCCESS\"}" | ||
|
||
Scenario: Using only fabric-base I can send a query request to peers and recieve a valid result | ||
Given I have created a client named leon based on information in profile ccp-tls under organization Org1 | ||
And I have used the client named leon to create a channel object for the channel named baseapichannel | ||
When I submit a query named myFirstQuery with args [queryCar,CAR0] for contract fabcar as client leon on channel baseapichannel | ||
Then the query named myFirstQuery for client leon has a general result matching "{\"result\":\"SUCCESS\"}" | ||
And the query named myFirstQuery for client leon has a peer0 result matching "{\"color\":\"blue\",\"docType\":\"car\",\"make\":\"Toyota\",\"model\":\"Prius\",\"owner\":\"Tomoko\"}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
'use strict'; | ||
|
||
import * as BaseUtils from './lib/utility/baseUtils'; | ||
import * as ClientHelper from './lib/utility/clientUtils'; | ||
import { Constants } from './constants'; | ||
import { CommonConnectionProfileHelper } from './lib/utility/commonConnectionProfileHelper'; | ||
|
||
import * as path from 'path'; | ||
import { Given, When, Then } from 'cucumber'; | ||
|
||
Given(/^I have created a client named (.+?) based on information in profile (.+?) under organization (.+?)$/, { timeout: Constants.HUGE_TIME as number }, async (clientName: string, ccpName: string, userOrg: string) => { | ||
|
||
// Get a CCP Helper | ||
const profilePath: string = path.join(__dirname, '../config', ccpName); | ||
const ccp: CommonConnectionProfileHelper = new CommonConnectionProfileHelper(profilePath, true); | ||
|
||
// Create the user | ||
await ClientHelper.createAdminClient(clientName, ccp, userOrg); | ||
}); | ||
|
||
Given(/^I have used the client named (.+?) to create a channel object for the channel named (.+?)$/, { timeout: Constants.HUGE_TIME as number }, async (clientName: string, channelName: string) => { | ||
await ClientHelper.createChannelWithClient(clientName, channelName); | ||
}); | ||
|
||
When(/^I build a new endorsement request named (.+?) for smart contract named (.+?) with arguments (.+?) as client (.+?) on channel (.+?)$/, { timeout: Constants.HUGE_TIME as number }, async (requestName: string, contractName: string, requestArgs: string, clientName: string, channelName: string) => { | ||
await ClientHelper.buildChannelRequest(requestName, contractName, requestArgs, clientName, channelName); | ||
}); | ||
|
||
When(/^I commit the endorsement request named (.+?) as client (.+?) on channel (.+?)$/, { timeout: Constants.HUGE_TIME as number }, async (requestName: string, clientName: string, channelName: string) => { | ||
await ClientHelper.commitChannelRequest(requestName, clientName, channelName); | ||
}); | ||
|
||
When(/^I submit a query named (.+?) with args (.+?) for contract (.+?) as client (.+?) on channel (.+?)$/, { timeout: Constants.HUGE_TIME as number }, async (queryName: string, queryArgs: string, contractName: string, clientName: string, channelName: string) => { | ||
await ClientHelper.submitChannelRequest(clientName, channelName, contractName, queryArgs, queryName); | ||
}); | ||
|
||
Then(/^the (request|query) named (.+?) for client (.+?) has a (.+?) result matching (.+?)$/, { timeout: Constants.HUGE_TIME as number }, (responseType: string, requestName: string, clientName: string, fieldName: string, expectedResult: string) => { | ||
ClientHelper.validateChannelRequestResponse(clientName, responseType === 'request', requestName, fieldName, expectedResult); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.