From 7bd5d07a1d24a30a8aeb4926544981bee07b1746 Mon Sep 17 00:00:00 2001 From: Yusuf Murodov Date: Fri, 1 Mar 2024 16:33:57 +0500 Subject: [PATCH 1/4] EDGRTAC-81: Fix edge rtac scenarios --- .../edge-rtac/features/rtac.feature | 30 +++++++++++++++---- .../holdings/holdings-entity-request.json | 3 +- .../samples/item/item-entity-request.json | 3 +- edge-rtac/src/main/resources/karate-config.js | 1 + edge-rtac/src/main/resources/logback-test.xml | 1 + .../test/java/org/folio/EdgeRtacTests.java | 4 +-- 6 files changed, 32 insertions(+), 10 deletions(-) diff --git a/edge-rtac/src/main/resources/core_platform/edge-rtac/features/rtac.feature b/edge-rtac/src/main/resources/core_platform/edge-rtac/features/rtac.feature index a506b5214..09996e3d4 100644 --- a/edge-rtac/src/main/resources/core_platform/edge-rtac/features/rtac.feature +++ b/edge-rtac/src/main/resources/core_platform/edge-rtac/features/rtac.feature @@ -23,12 +23,15 @@ Feature: rtac tests * call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostInstance') * call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostServicePoint') * call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostLocation') - * call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostHoldings') + * def createHoldingsResponse = call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostHoldings') + * def expectedHoldingsCopyNumber = createHoldingsResponse.copyNumber * def createFirstItemResponse = call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostItem') * def expectedFirstItemId = createFirstItemResponse.itemId + * def expectedFirstItemCopyNumber = createFirstItemResponse.copyNumber * def itemStatusName = 'Checked out' * def createSecondItemResponse = call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostItem') * def expectedSecondItemId = createSecondItemResponse.itemId + * def expectedSecondItemCopyNumber = createSecondItemResponse.copyNumber Given url edgeUrl And path 'rtac/' + instanceId @@ -38,6 +41,7 @@ Feature: rtac tests And match response.holdings.holding.length == 2 # api response is getting shuffled for each run, matching response by converting into an array. And match [expectedFirstItemId,expectedSecondItemId] contains call expectedData response.holdings,'holdings' + And match [expectedHoldingsCopyNumber,expectedFirstItemCopyNumber,expectedSecondItemCopyNumber] contains call expectedData response.holdings,'holdings' And match ['Available','Checked out'] contains call expectedData response.holdings,'status' # deleteItem * call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@DeleteItems') @@ -51,19 +55,23 @@ Feature: rtac tests * def instanceId = firstInstanceId * call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostServicePoint') * call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostLocation') - * call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostHoldings') + * def createFirstHoldingsResponse = call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostHoldings') + * def expectedFirstHoldingsCopyNumber = createFirstHoldingsResponse.copyNumber; * def createFirstItemResponse = call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostItem') * def expectedFirstItemId = createFirstItemResponse.itemId + * def expectedFirstItemCopyNumber = createFirstItemResponse.copyNumber; # 2nd instance * def createInstanceResponse = call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostInstance') * def secondInstanceId = createInstanceResponse.instanceEntityRequest.id * def instanceId = secondInstanceId * call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostServicePoint') * call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostLocation') - * call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostHoldings') + * def createSecondHoldingsResponse = call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostHoldings') + * def expectedSecondHoldingsCopyNumber = createSecondHoldingsResponse.copyNumber; * def itemStatusName = 'Checked out' * def createSecondItemResponse = call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostItem') * def expectedSecondItemId = createSecondItemResponse.itemId + * def expectedSecondItemCopyNumber = createSecondItemResponse.copyNumber; Given url edgeUrl And path 'rtac?instanceIds=' + firstInstanceId + ',' + secondInstanceId @@ -74,6 +82,8 @@ Feature: rtac tests And match response.instances.holdings.length == 2 And match [firstInstanceId,secondInstanceId] contains call expectedData response.instances.holdings,'instances' And match [expectedFirstItemId,expectedSecondItemId] contains call expectedData response.instances.holdings,'holdings' + And match [expectedFirstItemCopyNumber,expectedSecondItemCopyNumber] contains call expectedData response.instances.holdings,'holdings' + And match [expectedFirstHoldingsCopyNumber,expectedSecondHoldingsCopyNumber] contains call expectedData response.instances.holdings,'holdings' And match ['Available','Checked out'] contains call expectedData response.instances.holdings,'status' # deleteItem * call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@DeleteItems') @@ -87,7 +97,8 @@ Feature: rtac tests * def instanceId = firstInstanceId * call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostServicePoint') * call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostLocation') - * call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostHoldings') + * def createFirstHoldingsResponse = call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostHoldings') + * def expectedFirstHoldingsCopyNumber = createFirstHoldingsResponse.copyNumber; * def createFirstItemResponse = call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostItem') * def expectedFirstItemId = createFirstItemResponse.itemId # 2nd instance @@ -96,7 +107,8 @@ Feature: rtac tests * def instanceId = secondInstanceId * call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostServicePoint') * call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostLocation') - * call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostHoldings') + * def createSecondHoldingsResponse = call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostHoldings') + * def expectedSecondHoldingsCopyNumber = createSecondHoldingsResponse.copyNumber; * def itemStatusName = 'Checked out' * def createSecondItemResponse = call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostItem') * def expectedSecondItemId = createSecondItemResponse.itemId @@ -110,12 +122,15 @@ Feature: rtac tests And match response.instances.holdings.length == 2 And match [firstInstanceId,secondInstanceId] contains call expectedData response.instances.holdings,'instances' And match [expectedFirstItemId,expectedSecondItemId] contains call expectedData response.instances.holdings,'holdings' + And match [expectedFirstItemCopyNumber,expectedSecondItemCopyNumber] contains call expectedData response.instances.holdings,'holdings' + And match [expectedFirstHoldingsCopyNumber,expectedSecondHoldingsCopyNumber] contains call expectedData response.instances.holdings,'holdings' And match ['Available','Checked out'] contains call expectedData response.instances.holdings,'status' # deleteItem * call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@DeleteItems') # delete newspaper MaterialType * call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@DeleteMaterialType') - Scenario: For periodical/serial, return only holdings information including availability for each instance UUID included in request WHEN &fullPeriodicals=false OR no parameter is omitted + + Scenario: For periodical/serial, return only holdings information including availability for each instance UUID included in request WHEN &fullPeriodicals=false OR no parameter is omitted # 1st instance # create journal materialType * def materialTypeName = 'journal' @@ -131,6 +146,7 @@ Feature: rtac tests * def firstHoldings = call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostHoldings') * def firstHoldingsId = firstHoldings.response.id * def holdingId = firstHoldingsId + * def firstHoldingsCopyNumber = firstHoldings.copyNumber * def createFirstItemResponse = call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostItem') * def expectedFirstItemId = createFirstItemResponse.itemId # 2nd instance @@ -142,6 +158,7 @@ Feature: rtac tests * def secondHoldings = call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostHoldings') * def secondHoldingsId = secondHoldings.response.id * def holdingId = secondHoldingsId + * def secondHoldingsCopyNumber = secondHoldings.copyNumber * def createSecondItemResponse = call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@PostItem') * def expectedSecondItemId = createSecondItemResponse.itemId @@ -153,6 +170,7 @@ Feature: rtac tests Then status 200 And match response.instances.holdings.length == 2 And match [firstHoldingsId,secondHoldingsId] contains call expectedData response.instances.holdings,'holdings' + And match [firstHoldingsCopyNumber,secondHoldingsCopyNumber] contains call expectedData response.instances.holdings,'holdings' And match [firstInstanceId,secondInstanceId] contains call expectedData response.instances.holdings,'instances' # deleteItem * call read('classpath:prokopovych/edge-rtac/features/util/initData.feature@DeleteItems') diff --git a/edge-rtac/src/main/resources/core_platform/edge-rtac/features/samples/holdings/holdings-entity-request.json b/edge-rtac/src/main/resources/core_platform/edge-rtac/features/samples/holdings/holdings-entity-request.json index ae2edde0a..5f2864d74 100644 --- a/edge-rtac/src/main/resources/core_platform/edge-rtac/features/samples/holdings/holdings-entity-request.json +++ b/edge-rtac/src/main/resources/core_platform/edge-rtac/features/samples/holdings/holdings-entity-request.json @@ -1,5 +1,6 @@ { "id": "#(holdingId)", "instanceId": "#(instanceId)", - "permanentLocationId": "#(locationId)" + "permanentLocationId": "#(locationId)", + "copyNumber": "1" } diff --git a/edge-rtac/src/main/resources/core_platform/edge-rtac/features/samples/item/item-entity-request.json b/edge-rtac/src/main/resources/core_platform/edge-rtac/features/samples/item/item-entity-request.json index 8a337f655..76cae5aeb 100644 --- a/edge-rtac/src/main/resources/core_platform/edge-rtac/features/samples/item/item-entity-request.json +++ b/edge-rtac/src/main/resources/core_platform/edge-rtac/features/samples/item/item-entity-request.json @@ -10,5 +10,6 @@ }, "status": { "name": "#(itemStatusName)" - } + }, + "copyNumber": "1" } diff --git a/edge-rtac/src/main/resources/karate-config.js b/edge-rtac/src/main/resources/karate-config.js index 53be53e10..ca9a8e0ad 100644 --- a/edge-rtac/src/main/resources/karate-config.js +++ b/edge-rtac/src/main/resources/karate-config.js @@ -1,6 +1,7 @@ function fn() { karate.configure('logPrettyRequest', true); + karate.configure('logPrettyResponse', true); var retryConfig = { count: 20, interval: 30000 } karate.configure('retry', retryConfig) diff --git a/edge-rtac/src/main/resources/logback-test.xml b/edge-rtac/src/main/resources/logback-test.xml index 16b84d888..ccd07a9d1 100644 --- a/edge-rtac/src/main/resources/logback-test.xml +++ b/edge-rtac/src/main/resources/logback-test.xml @@ -1,5 +1,6 @@ + diff --git a/edge-rtac/src/test/java/org/folio/EdgeRtacTests.java b/edge-rtac/src/test/java/org/folio/EdgeRtacTests.java index cde892334..0891afa2f 100644 --- a/edge-rtac/src/test/java/org/folio/EdgeRtacTests.java +++ b/edge-rtac/src/test/java/org/folio/EdgeRtacTests.java @@ -14,12 +14,12 @@ class EdgeRtacTests extends TestBase { public EdgeRtacTests() { - super(new TestIntegrationService(new TestModuleConfiguration("classpath:prokopovych/edge-rtac/features/"))); + super(new TestIntegrationService(new TestModuleConfiguration("classpath:core_platform/edge-rtac/features/"))); } @BeforeAll public void setup() { - runFeature("classpath:prokopovych/edge-rtac/rtac-junit.feature"); + runFeature("classpath:core_platform/edge-rtac/rtac-junit.feature"); } @Test From bb21d93e97f13636a3711e682305929ba9e143f1 Mon Sep 17 00:00:00 2001 From: Renat Safiulin Date: Mon, 4 Mar 2024 17:19:44 +0500 Subject: [PATCH 2/4] change https to http --- edge-rtac/src/main/resources/karate-config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/edge-rtac/src/main/resources/karate-config.js b/edge-rtac/src/main/resources/karate-config.js index ca9a8e0ad..a2e7db0ad 100644 --- a/edge-rtac/src/main/resources/karate-config.js +++ b/edge-rtac/src/main/resources/karate-config.js @@ -94,8 +94,8 @@ function fn() { // edge modules cannot run properly on dedicated environment for the Karate tests // short term solution is to have the module run on testing // This is not ideal as it negates a lot of the purpose of the tests - config.baseUrl = 'https://folio-snapshot-2-okapi.dev.folio.org:443'; - config.edgeUrl = 'https://folio-snapshot-2.dev.folio.org:8000'; + config.baseUrl = 'http://folio-snapshot-2-okapi.dev.folio.org:443'; + config.edgeUrl = 'http://folio-snapshot-2.dev.folio.org:8000'; config.apikey = 'eyJzIjoiNXNlNGdnbXk1TiIsInQiOiJkaWt1IiwidSI6ImRpa3UifQ=='; config.admin = { tenant: 'diku', From dc4542739c7f8dc4ea914df469773371378a07b5 Mon Sep 17 00:00:00 2001 From: Arsen <151620067+aatoyan@users.noreply.github.com> Date: Tue, 5 Mar 2024 19:13:56 +0400 Subject: [PATCH 3/4] enable test --- edge-rtac/src/test/java/org/folio/EdgeRtacTests.java | 1 - 1 file changed, 1 deletion(-) diff --git a/edge-rtac/src/test/java/org/folio/EdgeRtacTests.java b/edge-rtac/src/test/java/org/folio/EdgeRtacTests.java index 0891afa2f..e9f430da0 100644 --- a/edge-rtac/src/test/java/org/folio/EdgeRtacTests.java +++ b/edge-rtac/src/test/java/org/folio/EdgeRtacTests.java @@ -9,7 +9,6 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -@Disabled @FolioTest(team = "prokopovych", module = "edge-rtac") class EdgeRtacTests extends TestBase { From a8cdb6a6f013d062362be22f21c1023801838446 Mon Sep 17 00:00:00 2001 From: Arsen <151620067+aatoyan@users.noreply.github.com> Date: Tue, 5 Mar 2024 19:15:20 +0400 Subject: [PATCH 4/4] http to https --- edge-rtac/src/main/resources/karate-config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/edge-rtac/src/main/resources/karate-config.js b/edge-rtac/src/main/resources/karate-config.js index a2e7db0ad..ca9a8e0ad 100644 --- a/edge-rtac/src/main/resources/karate-config.js +++ b/edge-rtac/src/main/resources/karate-config.js @@ -94,8 +94,8 @@ function fn() { // edge modules cannot run properly on dedicated environment for the Karate tests // short term solution is to have the module run on testing // This is not ideal as it negates a lot of the purpose of the tests - config.baseUrl = 'http://folio-snapshot-2-okapi.dev.folio.org:443'; - config.edgeUrl = 'http://folio-snapshot-2.dev.folio.org:8000'; + config.baseUrl = 'https://folio-snapshot-2-okapi.dev.folio.org:443'; + config.edgeUrl = 'https://folio-snapshot-2.dev.folio.org:8000'; config.apikey = 'eyJzIjoiNXNlNGdnbXk1TiIsInQiOiJkaWt1IiwidSI6ImRpa3UifQ=='; config.admin = { tenant: 'diku',