From e1866cdf9218857ce8b29a00b09a970cf7f7f5f2 Mon Sep 17 00:00:00 2001
From: Sagar Khole <sagar.khole@ayanworks.com>
Date: Mon, 16 May 2022 14:51:48 +0530
Subject: [PATCH] connection manager BDD

---
 features/connection/createConnection.feature  | 22 ++++++++++++++++
 .../connection/findByConnectionId.feature     | 17 +++++++++++++
 features/connection/getConnection.feature     | 25 +++++++++++++++++++
 .../connection/makeConnectionTrusted.feature  | 17 +++++++++++++
 .../connection/membershipCredential.feature   | 25 +++++++++++++++++++
 features/connection/updateConnection.feature  | 23 +++++++++++++++++
 6 files changed, 129 insertions(+)
 create mode 100644 features/connection/createConnection.feature
 create mode 100644 features/connection/findByConnectionId.feature
 create mode 100644 features/connection/getConnection.feature
 create mode 100644 features/connection/makeConnectionTrusted.feature
 create mode 100644 features/connection/membershipCredential.feature
 create mode 100644 features/connection/updateConnection.feature

diff --git a/features/connection/createConnection.feature b/features/connection/createConnection.feature
new file mode 100644
index 0000000..b64bacd
--- /dev/null
+++ b/features/connection/createConnection.feature
@@ -0,0 +1,22 @@
+Feature: Webhook call for create connection
+
+    Scenario: Received validated DTO from NATS call .
+        Given Webhook valid object .
+        When  passed connection status as invited.
+        And   passed valid connection id.
+        And   role should be inviter.
+        Then  should create the connection.
+
+    Scenario: Received validated DTO from NATS call .
+        Given Webhook valid object .
+        When  passed connection status as invited.
+        And   passed invalid connection id.
+        And   role should be inviter.
+        Then  should return valid status code 400(BAD_REQUEST).
+
+    Scenario: Received validated DTO from NATS call .
+        Given Webhook valid object .
+        When  passed connection status as invited.
+        And   passed valid connection id.
+        And   role is invitee.
+        Then  should return valid status code 400(BAD_REQUEST).
\ No newline at end of file
diff --git a/features/connection/findByConnectionId.feature b/features/connection/findByConnectionId.feature
new file mode 100644
index 0000000..7c9930e
--- /dev/null
+++ b/features/connection/findByConnectionId.feature
@@ -0,0 +1,17 @@
+Feature: Get connection details By Id
+    Return the single connection details
+
+    Scenario: Provide valid connection ID
+        Given The connection ID available.
+        When  provide valid connection ID.
+        Then  should return connection details.
+
+    Scenario: Provide invalid connection ID.
+        Given The connection ID available.
+        When  provide invalid connection ID.
+        Then  should return no data found.
+
+    Scenario: Not Provide a connection ID.
+        Given The connection ID not available.
+        When  not provide connection ID.
+        Then  should return connection request required Connction ID.
\ No newline at end of file
diff --git a/features/connection/getConnection.feature b/features/connection/getConnection.feature
new file mode 100644
index 0000000..23bf1d7
--- /dev/null
+++ b/features/connection/getConnection.feature
@@ -0,0 +1,25 @@
+Feature: Get Connection API
+    Return the list of connections or single conneection created on OCM environment
+
+    Scenario: Provide validated page and pageSize and partcipant ID.
+        When  passed valid page.
+        And   passed valid pageSize.
+        And   passed valid participant ID.
+        Then  should get connection list.
+
+    Scenario: Provide validated page and pageSize and partcipant ID.
+        When  passed valid page.
+        And   passed valid pageSize.
+        And   passed valid participant ID.
+        Then  should get http status 404.
+
+    Scenario: Provide invalid page and pageSize
+        When passed invalid page.
+        And  passed invalid pageSize.
+        Then should return no data available.
+
+    Scenario: Not Provide partcipant id OR Connction ID or participant DID
+        When  not provid participant ID
+        And not provid connection ID
+        And nor provid partcipant DID
+        Then should return message "Participant ID/ connection ID / participant DID must be provided" with status code 400.
diff --git a/features/connection/makeConnectionTrusted.feature b/features/connection/makeConnectionTrusted.feature
new file mode 100644
index 0000000..c16f57a
--- /dev/null
+++ b/features/connection/makeConnectionTrusted.feature
@@ -0,0 +1,17 @@
+Feature: Make connection trusted against connection ID.
+    Update connection  status to trusted.
+
+    Scenario: Provide valid connection ID
+        Given The connection ID available.
+        When  provide valid connection ID.
+        Then  should update current connection state to trusted state.
+
+    Scenario: Provide invalid connection ID.
+        Given The connection ID available.
+        When  provide invalid connection ID.
+        Then  should return an exception.
+
+    Scenario: Not Provide a connection ID.
+        Given The connection ID not available.
+        When  not provide connection ID.
+        Then  should return connection request required Connction ID.
\ No newline at end of file
diff --git a/features/connection/membershipCredential.feature b/features/connection/membershipCredential.feature
new file mode 100644
index 0000000..15c31bb
--- /dev/null
+++ b/features/connection/membershipCredential.feature
@@ -0,0 +1,25 @@
+Feature: Create connection invitation URL
+
+    Scenario: Connction Invitation URL is created successfully as member
+        Given The participant is registered on GAIAX ecosystem
+        And The Principal is set to connect with Participant
+        When The Participant_id is provided in URL
+        And Alis is set to "member"
+        Then the Connection Invitation URL should be created.
+        And if user accepts the connection it should go in complete state.
+
+    Scenario: Connction Invitation URL is created successfully as subscriber.
+        Given The participant is registered on GAIAX ecosystem
+        And The Principal is set to connect with Participant
+        When The Participant_id is provided in URL
+        And Alis is set to "subscriber"
+        Then the Connection Invitation URL should be created
+        And if user accepts the connection it should go in complete state.
+
+    Scenario: Connction Invitation URL is created successfully but not as member or subscriber.
+        Given The participant is registered on GAIAX ecosystem
+        And The Principal is set to connect with Participant
+        When The Participant_id is provided in URL
+        Then the Connection Invitation URL should be created.
+        And if user accepts the connection it should go in complete state.
+        But connection will never goes in trusted state.
diff --git a/features/connection/updateConnection.feature b/features/connection/updateConnection.feature
new file mode 100644
index 0000000..5ffb84d
--- /dev/null
+++ b/features/connection/updateConnection.feature
@@ -0,0 +1,23 @@
+Feature: Webhook call for update connection
+
+    Scenario: Received validated DTO from NATS call .
+        Given Webhook valid object .
+        When  passed valid connection status other than invited.
+        And   passed valid connection id.
+        And   role should be inviter.
+        Then  should update the connection.
+
+    Scenario: Received validated DTO from NATS call .
+        Given Webhook valid object .
+        When  passed connection status as invited.
+        And   passed invalid connection id.
+        And   role should be inviter.
+        Then  should return valid status code 404(NOT_FOUND).
+
+    Scenario: Received validated DTO from NATS call .
+        Given Webhook valid object .
+        When  passed valid connection status other than invited.
+        And   passed valid connection id.
+        And   role is invitee.
+        Then  should return valid status code 400(BAD_REQUEST).
+
-- 
GitLab