forked from hyperledger-cacti/cacti
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cc-tx-viz): add methods to fabric connector
Signed-off-by: Iulia Mihaiu <maramih.2007@yahoo.com>
- Loading branch information
Showing
12 changed files
with
302 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
"caio", | ||
"cccs", | ||
"ccid", | ||
"cctx", | ||
"cids", | ||
"Corda", | ||
"Cordapp", | ||
|
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,2 @@ | ||
cactus-openapi-spec-plugin-consortium-manual.json | ||
src/main/typescript/generated/openapi/typescript-axios/.npmignore |
173 changes: 173 additions & 0 deletions
173
packages/cactus-plugin-cc-tx-visualization/src/main/json/openapi.json
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,173 @@ | ||
{ | ||
"openapi": "3.0.3", | ||
"info": { | ||
"title": "Hyperledger Cactus Plugin - Consortium Web Service", | ||
"description": "Manage a Cactus consortium through the APIs. Needs administrative privileges.", | ||
"version": "0.0.1", | ||
"license": { | ||
"name": "Apache 2.0", | ||
"url": "https://www.apache.org/licenses/LICENSE-2.0.html" | ||
} | ||
}, | ||
"servers": [ | ||
{ | ||
"url": "https://www.cactus.stream/{basePath}", | ||
"description": "Public test instance", | ||
"variables": { | ||
"basePath": { | ||
"default": "" | ||
} | ||
} | ||
}, | ||
{ | ||
"url": "http://localhost:4000/{basePath}", | ||
"description": "Local test instance", | ||
"variables": { | ||
"basePath": { | ||
"default": "" | ||
} | ||
} | ||
} | ||
], | ||
"components": { | ||
"schemas": { | ||
"GetNodeJwsResponse": { | ||
"type": "object", | ||
"required": [ | ||
"jws" | ||
], | ||
"properties": { | ||
"jws": { | ||
"description": "The JSON Web Signature of the Cactus node.", | ||
"$ref": "../../../../cactus-core-api/src/main/json/openapi.json#/components/schemas/JWSGeneral", | ||
"nullable": false | ||
} | ||
} | ||
}, | ||
"GetConsortiumJwsResponse": { | ||
"type": "object", | ||
"required": [ | ||
"jws" | ||
], | ||
"properties": { | ||
"jws": { | ||
"description": "The JSON Web Signature of the Cactus consortium.", | ||
"$ref": "../../../../cactus-core-api/src/main/json/openapi.json#/components/schemas/JWSGeneral", | ||
"nullable": false, | ||
"format": "The general format which is a JSON object, not a string." | ||
} | ||
} | ||
}, | ||
"PrometheusExporterMetricsResponse": { | ||
"type": "string", | ||
"nullable": false | ||
}, | ||
"GetNodeJwsRequest": { | ||
"type": "object", | ||
"properties": { | ||
} | ||
}, | ||
"GetConsortiumJwsRequest": { | ||
"type": "object", | ||
"properties": { | ||
} | ||
} | ||
} | ||
}, | ||
"paths": { | ||
"/api/v1/plugins/@hyperledger/cactus-plugin-consortium-manual/consortium/jws": { | ||
"post": { | ||
"x-hyperledger-cactus": { | ||
"http": { | ||
"verbLowerCase": "post", | ||
"path": "/api/v1/plugins/@hyperledger/cactus-plugin-consortium-manual/consortium/jws" | ||
} | ||
}, | ||
"operationId": "getConsortiumJwsV1", | ||
"summary": "Retrieves a consortium JWS", | ||
"description": "The JWS asserting the consortium metadata (pub keys and hosts of nodes)", | ||
"parameters": [], | ||
"requestBody": { | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/GetConsortiumJwsRequest" | ||
} | ||
} | ||
} | ||
}, | ||
"responses": { | ||
"200": { | ||
"description": "OK", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/GetConsortiumJwsResponse" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"/api/v1/plugins/@hyperledger/cactus-plugin-consortium-manual/node/jws": { | ||
"post": { | ||
"x-hyperledger-cactus": { | ||
"http": { | ||
"verbLowerCase": "post", | ||
"path": "/api/v1/plugins/@hyperledger/cactus-plugin-consortium-manual/node/jws" | ||
} | ||
}, | ||
"operationId": "getNodeJwsV1", | ||
"summary": "Retrieves the JWT of a Cactus Node", | ||
"parameters": [], | ||
"requestBody": { | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/GetNodeJwsRequest" | ||
} | ||
} | ||
} | ||
}, | ||
"responses": { | ||
"200": { | ||
"description": "OK", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/GetNodeJwsResponse" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"/api/v1/plugins/@hyperledger/cactus-plugin-consortium-manual/get-prometheus-exporter-metrics": { | ||
"get": { | ||
"x-hyperledger-cactus": { | ||
"http": { | ||
"verbLowerCase": "get", | ||
"path": "/api/v1/plugins/@hyperledger/cactus-plugin-consortium-manual/get-prometheus-exporter-metrics" | ||
} | ||
}, | ||
"operationId": "getPrometheusMetricsV1", | ||
"summary": "Get the Prometheus Metrics", | ||
"parameters": [], | ||
"responses": { | ||
"200": { | ||
"description": "OK", | ||
"content": { | ||
"text/plain": { | ||
"schema": { | ||
"$ref": "#/components/schemas/PrometheusExporterMetricsResponse" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
...gin-cc-tx-visualization/src/main/typescript/generated/openapi/typescript-axios/.gitignore
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,4 @@ | ||
wwwroot/*.js | ||
node_modules | ||
typings | ||
dist |
26 changes: 26 additions & 0 deletions
26
...lization/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator-ignore
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,26 @@ | ||
# OpenAPI Generator Ignore | ||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator | ||
|
||
# Use this file to prevent files from being overwritten by the generator. | ||
# The patterns follow closely to .gitignore or .dockerignore. | ||
|
||
# As an example, the C# client generator defines ApiClient.cs. | ||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: | ||
#ApiClient.cs | ||
|
||
# You can match any string of characters against a directory, file or extension with a single asterisk (*): | ||
#foo/*/qux | ||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux | ||
|
||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**): | ||
#foo/**/qux | ||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux | ||
|
||
# You can also negate patterns with an exclamation (!). | ||
# For example, you can ignore all files in a docs folder with the file extension .md: | ||
#docs/*.md | ||
# Then explicitly reverse the ignore rule for a single file: | ||
#!docs/README.md | ||
|
||
git_push.sh | ||
.npmignore |
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
44 changes: 43 additions & 1 deletion
44
packages/cactus-plugin-cc-tx-visualization/src/test/typescript/unit/instantiation.test.ts
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,18 +1,60 @@ | ||
/* eslint-disable prettier/prettier */ | ||
import { PluginRegistry } from "@hyperledger/cactus-core"; | ||
import test, { Test } from "tape"; | ||
import { v4 as uuidv4 } from "uuid"; | ||
import { | ||
IPluginCcTxVisualizationOptions, | ||
PluginCcTxVisualization, | ||
} from "../../../main/typescript/plugin-cc-tx-visualization"; | ||
import { ICactusPlugin } from "@hyperledger/cactus-core-api"; | ||
|
||
test("Instantiation", (t: Test) => { | ||
test("Basic Instantiation", (t: Test) => { | ||
const options: IPluginCcTxVisualizationOptions = { | ||
instanceId: uuidv4(), | ||
connectorRegistry: new PluginRegistry(), | ||
}; | ||
|
||
const pluginCcTxVisualization: PluginCcTxVisualization = new PluginCcTxVisualization( | ||
options, | ||
); | ||
|
||
t.ok(pluginCcTxVisualization, "Instantiated"); | ||
t.end(); | ||
}); | ||
|
||
test("Dummy Connector Instantiaton", (t: Test) => { | ||
class DummyPlugin implements ICactusPlugin{ | ||
private readonly instanceId: string; | ||
|
||
constructor(){ | ||
this.instanceId = "CCTX_DUMMY_" + uuidv4(); | ||
} | ||
public getInstanceId(): string { | ||
return this.instanceId; | ||
} | ||
public getPackageName(): string { | ||
return "DummyPlugin"; | ||
} | ||
public async onPluginInit(): Promise<unknown> { | ||
return; | ||
} | ||
|
||
} | ||
|
||
|
||
//add connector reference to the registry | ||
const connectorRegistryTest = new PluginRegistry(); | ||
connectorRegistryTest.add(new DummyPlugin()); | ||
|
||
const options: IPluginCcTxVisualizationOptions = { | ||
instanceId: uuidv4(), | ||
connectorRegistry: connectorRegistryTest, | ||
}; | ||
|
||
const pluginCcTxVisualization: PluginCcTxVisualization = new PluginCcTxVisualization( | ||
options, | ||
); | ||
|
||
t.ok(pluginCcTxVisualization, "Instantiated with a dummy connector"); | ||
t.end(); | ||
}); |
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.