diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f9200c4e..6a623ce3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -69,7 +69,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=mycloudnexus_kraken_java + run: ./mvnw -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.organization=${{ vars.SONAR_ORGANIZATION }} -Dsonar.projectKey=${{ vars.SONAR_JAVA_PROJECT_KEY }} nodejs-unit-test: name: nodejs-unit-test @@ -119,4 +119,8 @@ jobs: uses: SonarSource/sonarcloud-github-action@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + with: + args: > + -Dsonar.organization=${{ vars.SONAR_ORGANIZATION }} + -Dsonar.projectKey=${{ vars.SONAR_NODEJS_PROJECT_KEY }} diff --git a/kraken-app/kraken-app-hub/src/test/resources/expected/expected-9-quote.uni.add.sync.json b/kraken-app/kraken-app-hub/src/test/resources/expected/expected-9-quote.uni.add.sync.json index 0ce6db17..cdde7155 100644 --- a/kraken-app/kraken-app-hub/src/test/resources/expected/expected-9-quote.uni.add.sync.json +++ b/kraken-app/kraken-app-hub/src/test/resources/expected/expected-9-quote.uni.add.sync.json @@ -1,7 +1,7 @@ { "id": "${entity.id}", "buyerRequestedQuoteLevel": "${mefRequestBody.buyerRequestedQuoteLevel}", - "relatedContactInformation": "${T(com.consoleconnect.kraken.operator.gateway.func.SpelFunc).appendSellerInformation('sellerContactInformation',env.seller.name,env.seller.emailAddress,env.seller.number,mefRequestBody.relatedContactInformation)}", + "relatedContactInformation": "${T(com.consoleconnect.kraken.operator.gateway.func.SpelFunc).appendSellerInformation('sellerContactInformation',env.seller.name,env.seller.emailAddress,env.seller.number,mefRequestBody[relatedContactInformation]?:'')}", "quoteItem": [ { "requestedQuoteItemTerm": "${mefRequestBody.quoteItem[0].requestedQuoteItemTerm}", diff --git a/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets-mappers/api-target-mapper.order.eline.add.yaml b/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets-mappers/api-target-mapper.order.eline.add.yaml index 12451236..1fe52815 100644 --- a/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets-mappers/api-target-mapper.order.eline.add.yaml +++ b/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets-mappers/api-target-mapper.order.eline.add.yaml @@ -191,5 +191,14 @@ spec: targetLocation: BODY customizedField: false requiredMapping: true + - name: mapper.order.eline.add.product.id + title: product instance id + description: "" + source: "" + sourceLocation: BODY + target: "@{{productOrderItem[0].product.id}}" + targetLocation: BODY + customizedField: false + requiredMapping: false diff --git a/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets-mappers/api-target-mapper.order.uni.add.yaml b/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets-mappers/api-target-mapper.order.uni.add.yaml index 46e7aa5b..ce09c554 100644 --- a/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets-mappers/api-target-mapper.order.uni.add.yaml +++ b/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets-mappers/api-target-mapper.order.uni.add.yaml @@ -170,4 +170,13 @@ spec: sourceLocation: BODY targetLocation: BODY requiredMapping: false + - name: mapper.order.uni.add.product.id + title: product instance id + description: "" + source: "" + sourceLocation: BODY + target: "@{{productOrderItem[0].product.id}}" + targetLocation: BODY + customizedField: false + requiredMapping: false diff --git a/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets/api-target.inventory.eline.list.yaml b/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets/api-target.inventory.eline.list.yaml index 7d2aee9b..dc7ab316 100644 --- a/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets/api-target.inventory.eline.list.yaml +++ b/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets/api-target.inventory.eline.list.yaml @@ -31,6 +31,12 @@ spec: "externalId":"${entity.request[externalId]?:''}", "productRelationship":"${entity.request.productOrderItem[0].product.productRelationship}", "billingAccount":"${entity.request.productOrderItem[0].billingAccount}", - "productOrderItem":"${entity.renderedResponse.productOrderItem}" + "productOrderItem":[ + { + "productOrderHref":"", + "productOrderItemId":"${entity.renderedResponse.productOrderItem[0]['id']}", + "productOrderId":"${entity.renderedResponse['orderId']}" + } + ] } ] \ No newline at end of file diff --git a/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets/api-target.inventory.uni.list.yaml b/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets/api-target.inventory.uni.list.yaml index 2a29e6df..30ebb4c2 100644 --- a/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets/api-target.inventory.uni.list.yaml +++ b/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets/api-target.inventory.uni.list.yaml @@ -31,6 +31,12 @@ spec: "externalId":"${entity.request[externalId]?:''}", "productRelationship":"${entity.request.productOrderItem[0].product.productRelationship}", "billingAccount":"${entity.request.productOrderItem[0].billingAccount}", - "productOrderItem":"${entity.renderedResponse.productOrderItem}" + "productOrderItem":[ + { + "productOrderHref":"", + "productOrderItemId":"${entity.renderedResponse.productOrderItem[0]['id']}", + "productOrderId":"${entity.renderedResponse['orderId']}" + } + ] } ] \ No newline at end of file diff --git a/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets/api-target.quote.eline.add.sync.yaml b/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets/api-target.quote.eline.add.sync.yaml index 985942ac..9c4e6f50 100644 --- a/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets/api-target.quote.eline.add.sync.yaml +++ b/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets/api-target.quote.eline.add.sync.yaml @@ -25,7 +25,7 @@ spec: { "id": "${entity.id}", "buyerRequestedQuoteLevel": "${mefRequestBody.buyerRequestedQuoteLevel}", - "relatedContactInformation": "${T(com.consoleconnect.kraken.operator.gateway.func.SpelFunc).appendSellerInformation('sellerContactInformation', env.seller.name, env.seller.emailAddress, env.seller.number, mefRequestBody.relatedContactInformation)}", + "relatedContactInformation": "${T(com.consoleconnect.kraken.operator.gateway.func.SpelFunc).appendSellerInformation('sellerContactInformation', env.seller.name, env.seller.emailAddress, env.seller.number, mefRequestBody[relatedContactInformation]?:'')}", "quoteItem": [{ "requestedQuoteItemTerm": "${mefRequestBody.quoteItem[0].requestedQuoteItemTerm}", "product": "${mefRequestBody.quoteItem[0].product}", diff --git a/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets/api-target.quote.uni.add.sync.yaml b/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets/api-target.quote.uni.add.sync.yaml index a6e386ca..d7d7ffca 100644 --- a/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets/api-target.quote.uni.add.sync.yaml +++ b/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets/api-target.quote.uni.add.sync.yaml @@ -26,7 +26,7 @@ spec: { "id": "${entity.id}", "buyerRequestedQuoteLevel": "${mefRequestBody.buyerRequestedQuoteLevel}", - "relatedContactInformation": "${T(com.consoleconnect.kraken.operator.gateway.func.SpelFunc).appendSellerInformation('sellerContactInformation', env.seller.name, env.seller.emailAddress, env.seller.number, mefRequestBody.relatedContactInformation)}", + "relatedContactInformation": "${T(com.consoleconnect.kraken.operator.gateway.func.SpelFunc).appendSellerInformation('sellerContactInformation', env.seller.name, env.seller.emailAddress, env.seller.number, mefRequestBody[relatedContactInformation]?:'')}", "quoteItem": [ { "requestedQuoteItemTerm": "${mefRequestBody.quoteItem[0].requestedQuoteItemTerm}", diff --git a/kraken-app/kraken-app-hub/src/test/resources/mock/apis/api.address.yaml b/kraken-app/kraken-app-hub/src/test/resources/mock/apis/api.address.yaml index a02ec876..e06a7ecb 100644 --- a/kraken-app/kraken-app-hub/src/test/resources/mock/apis/api.address.yaml +++ b/kraken-app/kraken-app-hub/src/test/resources/mock/apis/api.address.yaml @@ -142,9 +142,12 @@ links: - targetAssetKey: mef.sonata.api-target-mapper.address.validate relationship: implementation.target-mapper group: mef.sonata.api-target.address.validate - - targetAssetKey: mef.sonata.api.matrix.address.validate + - targetAssetKey: mef.sonata.api.matrix.address.validation relationship: implementation.matrix group: mef.sonata.api-target.address.validate - targetAssetKey: mef.sonata.api-target-mapper.address.retrieve relationship: implementation.target-mapper - group: mef.sonata.api-target.address.retrieve \ No newline at end of file + group: mef.sonata.api-target.address.retrieve + + + diff --git a/kraken-app/kraken-app-hub/src/test/resources/mock/apis/api.order.yaml b/kraken-app/kraken-app-hub/src/test/resources/mock/apis/api.order.yaml index f31e5495..4a6278bf 100644 --- a/kraken-app/kraken-app-hub/src/test/resources/mock/apis/api.order.yaml +++ b/kraken-app/kraken-app-hub/src/test/resources/mock/apis/api.order.yaml @@ -41,26 +41,41 @@ spec: console.log("input: " + jsonStr); let input = JSON.parse(jsonStr); let targetAPIConfigKey = ''; - if(input.productOrderItem['product']['productConfiguration']['@type'] == 'UNI' && input.productOrderItem['action'] == 'add') { + let matrixConfigKey = ''; + let errorMsg = ''; + let type = input.productOrderItem['product']['productConfiguration']['@type']; + let action = input.productOrderItem['action']; + let typeArr = ['UNI', 'ACCESS_E_LINE']; + let actionArr = ['add', 'delete']; + if(type == 'UNI' && action == 'add') { targetAPIConfigKey = 'mef.sonata.api-target.order.uni.add'; matrixConfigKey = 'mef.sonata.api.matrix.order.uni.add' - } else if(input.productOrderItem['product']['productConfiguration']['@type'] == 'ACCESS_E_LINE' && input.productOrderItem['action'] == 'add') { + } else if(type == 'ACCESS_E_LINE' && action == 'add') { targetAPIConfigKey = 'mef.sonata.api-target.order.eline.add'; matrixConfigKey = 'mef.sonata.api.matrix.order.eline.add' - } else if(input.productOrderItem['product']['productConfiguration']['@type'] == 'UNI' && input.productOrderItem['action'] == 'delete') { + } else if(type == 'UNI' && action == 'delete') { targetAPIConfigKey = 'mef.sonata.api-target.order.uni.delete'; matrixConfigKey = 'mef.sonata.api.matrix.order.uni.delete' - } else if(input.productOrderItem['product']['productConfiguration']['@type'] == 'ACCESS_E_LINE' && input.productOrderItem['action'] == 'delete') { + } else if(type == 'ACCESS_E_LINE' && action == 'delete') { targetAPIConfigKey = 'mef.sonata.api-target.order.eline.delete'; matrixConfigKey = 'mef.sonata.api.matrix.order.eline.delete' } else { + errorArr = ['api use case is not supported :']; + if (!typeArr.includes(type)){ + errorArr.push(`expect productOrderItem.product.productConfiguration.@type in [ ${typeArr} ], but ${type}.`); + } + if (!actionArr.includes(action)) { + errorArr.push(`expect productOrderItem.action in [ ${actionArr} ], but ${action}`) + } + errorMsg = errorArr.join(' '); targetAPIConfigKey = 'targetKey:notFound'; } let ret = { orderType: input.productOrderItem['product']['productConfiguration']['@type'], orderAction: input.productOrderItem['action'], targetAPIConfigKey: targetAPIConfigKey, - matrixConfigKey: matrixConfigKey + matrixConfigKey: matrixConfigKey, + errorMsg: errorMsg }; return JSON.stringify(ret); } @@ -98,7 +113,6 @@ spec: env: path: ${targetApiConfig.endpoints[0].path} method: ${targetApiConfig.endpoints[0].method} - - id: modify-request-body actionType: buildin@modify-request-body env: @@ -303,4 +317,4 @@ links: group: mef.sonata.api-target.order.eline.delete - targetAssetKey: mef.sonata.api.matrix.order.eline.delete relationship: implementation.matrix - group: mef.sonata.api-target.order.eline.delete \ No newline at end of file + group: mef.sonata.api-target.order.eline.delete diff --git a/kraken-app/kraken-app-hub/src/test/resources/mock/apis/api.product.offering.yaml b/kraken-app/kraken-app-hub/src/test/resources/mock/apis/api.product.offering.yaml deleted file mode 100644 index 37e7c4a9..00000000 --- a/kraken-app/kraken-app-hub/src/test/resources/mock/apis/api.product.offering.yaml +++ /dev/null @@ -1,266 +0,0 @@ ---- -kind: kraken.component.api -apiVersion: v1 -metadata: - key: mef.sonata.api.poq - name: Product Offering Qualification (POQ) API Management - labels: - mef-api-release: grace - poq-api-version: v7 - version: 3 -spec: - supportedProductTypesAndActions: - - path: /mefApi/sonata/productOfferingQualification/v7/productOfferingQualification - method: post - actionTypes: - - add - productTypes: - - UNI - - ACCESS_E_LINE - - path: /mefApi/sonata/productOfferingQualification/v7/productOfferingQualification/{id} - method: get - productTypes: - - UNI - - ACCESS_E_LINE - mappings: - - uri: ${env.target.url} - trigger: - path: /mefApi/sonata/productOfferingQualification/v7/productOfferingQualification - method: post - metadata: - cacheRequestBody: true - actions: - - id: calculate_poq_order_type_and_action_via_javascript - actionType: engine@javascript - env: - productOfferingQualificationItem: ${body['productOfferingQualificationItem'][0]} - with: - code: | - (jsonStr) => { - console.log("input: " + jsonStr); - let input = JSON.parse(jsonStr); - let targetAPIConfigKey = ''; - if(input.productOfferingQualificationItem['product']['productConfiguration']['@type'] == 'UNI') { - targetAPIConfigKey = 'mef.sonata.api-target.poq.uni.add'; - } else if(input.productOfferingQualificationItem['product']['productConfiguration']['@type'] == 'ACCESS_E_LINE') { - targetAPIConfigKey = 'mef.sonata.api-target.poq.eline.add'; - } else { - targetAPIConfigKey = 'targetKey:notFound'; - } - let ret = { - productOfferingType: input.productOfferingQualificationItem['product']['productConfiguration']['@type'], - targetAPIConfigKey: targetAPIConfigKey - }; - return JSON.stringify(ret); - } - outputKey: productOfferingQualification - - - id: persist_http_request - actionType: buildin@db - env: - bizType: ${productOfferingQualification.productOfferingType} - with: - action: create - properties: - - headers - - queryParameters - - requestBody - preRequest: true - - - id: load-downstream-api-config - actionType: buildin@load-target-api-config - env: - configKey: ${productOfferingQualification.targetAPIConfigKey} - mefQuery: ${query} - mefRequestBody: ${body} - entity: ${entity} - with: - render: true - outputKey: targetApiConfig - - - id: rewrite-path - actionType: buildin@rewrite-path - env: - path: ${targetApiConfig.endpoints[0].path} - method: ${targetApiConfig.endpoints[0].method} - - - id: modify-request-body-for-poq-add - actionType: buildin@modify-request-body - env: - code: ${targetApiConfig.endpoints[0].requestBody} - - - id: modify-response-body-for-poq-add - actionType: buildin@modify-response-body - with: - engine: spel - successStatus: 201 - env: - code: ${targetApiConfig.endpoints[0].responseBody} - inputs: ${targetApiConfig.inputs} - mefRequestBody: ${body} - - - actionType: buildin@db - with: - action: update - properties: - - responseBody - - responseStatusCode - preRequest: false - postRequest: true - order: -4 - - - uri: ${env.target.url} - trigger: - path: /mefApi/sonata/productOfferingQualification/v7/productOfferingQualification/** - method: get - metadata: - cacheRequestBody: false - actions: - - name: retrieve productOfferingQualification Identifier from path - actionType: buildin@pattern - env: - input: ${path} - pattern: /mefApi/sonata/productOfferingQualification/v7/productOfferingQualification/(?.*) - - - id: read request payload by id - actionType: buildin@db - env: - id: ${segment} - with: - action: read - preRequest: true - - - id: calculate_product_offering_type_read_via_javascript - actionType: engine@javascript - env: - bizType: ${entity.bizType} - with: - code: | - (jsonStr) => { - console.log("input: " + jsonStr); - let input = JSON.parse(jsonStr); - let targetAPIConfigKey = ''; - if(input.bizType == 'UNI') { - targetAPIConfigKey = 'mef.sonata.api-target.poq.uni.read'; - } else if(input.bizType == 'ACCESS_E_LINE') { - targetAPIConfigKey = 'mef.sonata.api-target.poq.eline.read'; - } else { - targetAPIConfigKey = 'notImplemented'; - } - let ret = { - productOfferingType: input.bizType, - targetAPIConfigKey: targetAPIConfigKey - }; - return JSON.stringify(ret); - } - outputKey: productOfferingQualification - - - id: load-downstream-api-config - actionType: buildin@load-target-api-config - env: - configKey: ${productOfferingQualification.targetAPIConfigKey} - mefQuery: ${query} - entity: ${entity} - with: - render: true - outputKey: targetApiConfig - - - id: rewrite-path - actionType: buildin@rewrite-path - env: - path: ${targetApiConfig.endpoints[0].path} - method: ${targetApiConfig.endpoints[0].method} - - - id: modify-request-body - actionType: buildin@modify-request-body - env: - code: ${targetApiConfig.endpoints[0].requestBody} - - - id: modify-response-body - actionType: buildin@modify-response-body - with: - engine: spel - env: - code: ${targetApiConfig.endpoints[0].responseBody} - inputs: ${targetApiConfig.inputs} - - - trigger: - path: /mefApi/sonata/productOfferingQualification/v7/productOfferingQualification/hub - method: post - metadata: - cacheRequestBody: true - actions: - - - id: calculate_poq_event_types_via_javascript - actionType: engine@javascript - env: - query: ${body.query} - with: - code: | - (jsonStr) => { - console.log("input: " + jsonStr); - let input = JSON.parse(jsonStr); - let query = input.query; - let arr = query.split("="); - let eventArr = arr[1].split(","); - let ret = { - "eventTypes": eventArr, - "targetAPIConfigKey": "mef.sonata.api-target.hub.add" - }; - return JSON.stringify(ret); - } - outputKey: event - - id: register-poq-event - actionType: buildin@register-event - env: - eventTypes: ${event.eventTypes} - with: - action: register - - - id: load-downstream-api-config - actionType: buildin@load-target-api-config - env: - configKey: ${event.targetAPIConfigKey} - mefRequestBody: ${body} - entity: ${entity} - with: - render: true - outputKey: targetApiConfig - - - id: mock-response - actionType: buildin@mock-response - - - id: modify-response-body - actionType: buildin@modify-response-body - with: - engine: spel - env: - code: ${targetApiConfig.endpoints[0].responseBody} - inputs: ${targetApiConfig.inputs} -links: - - targetAssetKey: mef.sonata.api-target.poq.eline.add - relationship: implementation.target - group: mef.sonata.api-target.poq.eline.add - - targetAssetKey: mef.sonata.api-target.poq.eline.read - relationship: implementation.target - group: mef.sonata.api-target.poq.eline.read - - targetAssetKey: mef.sonata.api-target.poq.uni.add - relationship: implementation.target - group: mef.sonata.api-target.poq.uni.add - - targetAssetKey: mef.sonata.api-target.poq.uni.read - relationship: implementation.target - group: mef.sonata.api-target.poq.uni.read - - targetAssetKey: mef.sonata.api-target-mapper.poq.eline.add - relationship: implementation.target-mapper - group: mef.sonata.api-target.poq.eline.add - - targetAssetKey: mef.sonata.api-target-mapper.poq.eline.read - relationship: implementation.target-mapper - group: mef.sonata.api-target.poq.eline.read - - targetAssetKey: mef.sonata.api-target-mapper.poq.uni.add - relationship: implementation.target-mapper - group: mef.sonata.api-target.poq.uni.add - - targetAssetKey: mef.sonata.api-target-mapper.poq.uni.read - relationship: implementation.target-mapper - group: mef.sonata.api-target.poq.uni.read - - targetAssetKey: mef.sonata.api-spec.product.offering.qualification - relationship: implementation.standard.api-spec \ No newline at end of file diff --git a/kraken-app/kraken-app-hub/src/test/resources/mock/apis/api.quote.yaml b/kraken-app/kraken-app-hub/src/test/resources/mock/apis/api.quote.yaml index 382ba0c0..e0bc525f 100644 --- a/kraken-app/kraken-app-hub/src/test/resources/mock/apis/api.quote.yaml +++ b/kraken-app/kraken-app-hub/src/test/resources/mock/apis/api.quote.yaml @@ -341,4 +341,4 @@ links: group: mef.sonata.api-target.quote.uni.read.sync - targetAssetKey: mef.sonata.api-target-mapper.quote.eline.read.sync relationship: implementation.target-mapper - group: mef.sonata.api-target.quote.eline.read.sync \ No newline at end of file + group: mef.sonata.api-target.quote.eline.read.sync diff --git a/kraken-app/kraken-app-hub/src/test/resources/mock/mapping-matrix/mapping.matrix.order.eline.add.yaml b/kraken-app/kraken-app-hub/src/test/resources/mock/mapping-matrix/mapping.matrix.order.eline.add.yaml index 2e477951..abdc5926 100644 --- a/kraken-app/kraken-app-hub/src/test/resources/mock/mapping-matrix/mapping.matrix.order.eline.add.yaml +++ b/kraken-app/kraken-app-hub/src/test/resources/mock/mapping-matrix/mapping.matrix.order.eline.add.yaml @@ -48,13 +48,11 @@ spec: expectType: EXPECTED_EXIST value: true errorMsg: "requestedItemTerm.name should exist in request" - - name: productRelationship_relationshipType_0 + - name: productOrderItem[0].product.productRelationship[0].relationshipType path: "$.body.productOrderItem[0].product.productRelationship[0].relationshipType" - expectType: EXPECTED_EXIST - value: true - errorMsg: "productRelationship[0].relationshipType should exist in request" - - name: productRelationship_relationshipType_1 + expectType: EXPECTED + value: "CONNECTS_TO_ENNI" + - name: productOrderItem[0].product.productRelationship[1].relationshipType path: "$.body.productOrderItem[0].product.productRelationship[1].relationshipType" - expectType: EXPECTED_EXIST - value: true - errorMsg: "productRelationship[1].relationshipType should exist in request" + expectType: EXPECTED + value: "CONNECTS_TO_UNI" \ No newline at end of file diff --git a/kraken-app/kraken-app-hub/src/test/resources/mock/mapping-matrix/mapping.matrix.order.uni.add.yaml b/kraken-app/kraken-app-hub/src/test/resources/mock/mapping-matrix/mapping.matrix.order.uni.add.yaml index d76ac96b..a4886c35 100644 --- a/kraken-app/kraken-app-hub/src/test/resources/mock/mapping-matrix/mapping.matrix.order.uni.add.yaml +++ b/kraken-app/kraken-app-hub/src/test/resources/mock/mapping-matrix/mapping.matrix.order.uni.add.yaml @@ -18,14 +18,14 @@ spec: path: "$.body.productOrderItem[*].['action']" expectType: EXPECTED value: add - - name: productOrderItem_product_place_role + - name: productOrderItem[0].product.place[0].role path: "$.body.productOrderItem[0].product.place[0].role" - expectType: EXPECTED_EXIST - value: true - - name: productOrderItem_product_place_@type + expectType: EXPECTED + value: "INSTALL_LOCATION" + - name: productOrderItem[0].product.place[0].@type path: "$.body.productOrderItem[0].product.place[0].@type" - expectType: EXPECTED_EXIST - value: true + expectType: EXPECTED + value: "GeographicAddressRef" - name: relatedContactInformation_emailAddress path: "$.body.relatedContactInformation[*]" expectType: EXPECTED_TRUE diff --git a/kraken-app/kraken-app-hub/src/test/resources/mock/mapping-matrix/mapping.matrix.quote.eline.add.yaml b/kraken-app/kraken-app-hub/src/test/resources/mock/mapping-matrix/mapping.matrix.quote.eline.add.yaml index 4bc3d050..6c22de46 100644 --- a/kraken-app/kraken-app-hub/src/test/resources/mock/mapping-matrix/mapping.matrix.quote.eline.add.yaml +++ b/kraken-app/kraken-app-hub/src/test/resources/mock/mapping-matrix/mapping.matrix.quote.eline.add.yaml @@ -13,6 +13,7 @@ spec: - name: enabled expectType: EXPECTED value: false + errorMsg: "api use case is not supported : disabled : instantSyncQuote==false" - name: product_type_eline path: "$.body.quoteItem[*].product.productConfiguration.['@type']" expectType: EXPECTED diff --git a/kraken-app/kraken-app-hub/src/test/resources/mock/mapping-matrix/mapping.matrix.quote.uni.add.yaml b/kraken-app/kraken-app-hub/src/test/resources/mock/mapping-matrix/mapping.matrix.quote.uni.add.yaml index 52657801..ba5cd132 100644 --- a/kraken-app/kraken-app-hub/src/test/resources/mock/mapping-matrix/mapping.matrix.quote.uni.add.yaml +++ b/kraken-app/kraken-app-hub/src/test/resources/mock/mapping-matrix/mapping.matrix.quote.uni.add.yaml @@ -13,6 +13,7 @@ spec: - name: enabled expectType: EXPECTED value: false + errorMsg: "api use case is not supported : disabled : instantSyncQuote==false" - name: product_type_UNI path: "$.body.quoteItem[*].product.productConfiguration.['@type']" expectType: EXPECTED diff --git a/kraken-java-sdk/kraken-java-sdk-controller/src/main/java/com/consoleconnect/kraken/operator/controller/api/v3/TemplateUpgradeV3Controller.java b/kraken-java-sdk/kraken-java-sdk-controller/src/main/java/com/consoleconnect/kraken/operator/controller/api/v3/TemplateUpgradeV3Controller.java index 789952b0..1a0c21d1 100644 --- a/kraken-java-sdk/kraken-java-sdk-controller/src/main/java/com/consoleconnect/kraken/operator/controller/api/v3/TemplateUpgradeV3Controller.java +++ b/kraken-java-sdk/kraken-java-sdk-controller/src/main/java/com/consoleconnect/kraken/operator/controller/api/v3/TemplateUpgradeV3Controller.java @@ -138,7 +138,7 @@ public HttpResponse> listTemplateChangeLog( @Operation(summary = "stage environment upgrade check") @GetMapping("/stage-upgrade-check") - public HttpResponse> checkStageUpgradeCondition( + public HttpResponse checkStageUpgradeCondition( @PathVariable("productId") String productId, @RequestParam(value = "templateUpgradeId", required = false) String templateUpgradeId, @RequestParam String envId) { @@ -147,7 +147,7 @@ public HttpResponse> checkStageUpgradeCondition( @Operation(summary = "product environment upgrade check") @GetMapping("/production-upgrade-check") - public HttpResponse> checkProductionUpgradeCondition( + public HttpResponse checkProductionUpgradeCondition( @PathVariable("productId") String productId, @RequestParam(value = "templateUpgradeId", required = false) String templateUpgradeId, @RequestParam String envId) { diff --git a/kraken-java-sdk/kraken-java-sdk-controller/src/main/java/com/consoleconnect/kraken/operator/controller/dto/TemplateUpgradeCheckDTO.java b/kraken-java-sdk/kraken-java-sdk-controller/src/main/java/com/consoleconnect/kraken/operator/controller/dto/TemplateUpgradeCheckDTO.java new file mode 100644 index 00000000..8f6e186d --- /dev/null +++ b/kraken-java-sdk/kraken-java-sdk-controller/src/main/java/com/consoleconnect/kraken/operator/controller/dto/TemplateUpgradeCheckDTO.java @@ -0,0 +1,13 @@ +package com.consoleconnect.kraken.operator.controller.dto; + +import java.util.ArrayList; +import java.util.List; +import lombok.Data; + +@Data +public class TemplateUpgradeCheckDTO { + Boolean compatible; + Boolean mapperCompleted; + Boolean newerTemplate; + List errorMessages = new ArrayList<>(); +} diff --git a/kraken-java-sdk/kraken-java-sdk-controller/src/main/java/com/consoleconnect/kraken/operator/controller/service/TemplateUpgradeService.java b/kraken-java-sdk/kraken-java-sdk-controller/src/main/java/com/consoleconnect/kraken/operator/controller/service/TemplateUpgradeService.java index 0aa537e3..460e8bcd 100644 --- a/kraken-java-sdk/kraken-java-sdk-controller/src/main/java/com/consoleconnect/kraken/operator/controller/service/TemplateUpgradeService.java +++ b/kraken-java-sdk/kraken-java-sdk-controller/src/main/java/com/consoleconnect/kraken/operator/controller/service/TemplateUpgradeService.java @@ -890,7 +890,7 @@ public String stageUpgradeV3(TemplateUpgradeEvent event) { if (!SystemStateEnum.CAN_UPGRADE_STATES.contains(systemInfo.getStatus())) { throw KrakenException.badRequest("The current system status does not support upgrade"); } - checkIsLatestUpgrade(event.getTemplateUpgradeId()); + checkIsLatestUpgrade(event.getTemplateUpgradeId(), true); List stageRunningMappers = productDeploymentService.listRunningApiMapperDeploymentV3(event.getEnvId()); List runningMapperKeys = @@ -1015,7 +1015,7 @@ public String deployProductionV3( throw KrakenException.badRequest( "System state is:" + systemInfo.getStatus() + ". Not allowed to production upgrade"); } - checkIsLatestUpgrade(templateUpgradeId); + checkIsLatestUpgrade(templateUpgradeId, true); return deployProduction(templateUpgradeId, stageEnvId, productionEnvId, userId); } @@ -1055,7 +1055,8 @@ public TemplateUpgradeReleaseVO generateTemplateUpgradeReleaseVO( return templateUpgradeReleaseVO; } - private void checkIsLatestUpgrade(String currentTemplateUpgradeId) { + private boolean checkIsLatestUpgrade( + String currentTemplateUpgradeId, boolean shouldThrowException) { UnifiedAssetDto latestControlPlaneDeployment = unifiedAssetService .findBySpecification( @@ -1073,16 +1074,21 @@ private void checkIsLatestUpgrade(String currentTemplateUpgradeId) { .getLabels() .get(LabelConstants.LABEL_APP_TEMPLATE_UPGRADE_ID); if (!StringUtils.equals(expectedTemplateUpgradeId, currentTemplateUpgradeId)) { - throw KrakenException.badRequest( - "This mapping template is deprecated.A newer version mapping template started to upgrade."); + if (shouldThrowException) { + throw KrakenException.badRequest( + "This mapping template is deprecated.A newer version mapping template started to upgrade."); + } else { + return true; + } } + return false; } - public List stageCheck(String templateUpgradeId, String stageEnvId) { - List resultList = new ArrayList<>(); + public TemplateUpgradeCheckDTO stageCheck(String templateUpgradeId, String stageEnvId) { + TemplateUpgradeCheckDTO templateUpgradeCheckDTO = new TemplateUpgradeCheckDTO(); Environment environment = environmentService.findOne(stageEnvId); if (!environment.getName().equalsIgnoreCase(EnvNameEnum.STAGE.name())) { - resultList.add("error environment: not stage environment"); + throw KrakenException.badRequest("error environment: not stage environment"); } List stageRunningMappers = productDeploymentService.listRunningApiMapperDeploymentV3(stageEnvId); @@ -1094,34 +1100,20 @@ public List stageCheck(String templateUpgradeId, String stageEnvId) { .filter(t -> runningMapperKeys.contains(t.getTargetMapperKey())) .anyMatch( t -> t.getMappingStatus().equalsIgnoreCase(MappingStatusEnum.INCOMPLETE.getDesc())); - if (existedInCompleted) { - resultList.add( - "Please adjust and complete the incomplete mapping use cases that will be upgraded to data plane."); - } - try { - checkIsLatestUpgrade(templateUpgradeId); - } catch (Exception e) { - resultList.add(e.getMessage()); - } - return resultList; + templateUpgradeCheckDTO.setMapperCompleted(!existedInCompleted); + templateUpgradeCheckDTO.setNewerTemplate(checkIsLatestUpgrade(templateUpgradeId, false)); + return templateUpgradeCheckDTO; } - public List productionCheck(String templateUpgradeId, String productionEnvId) { - List resultList = new ArrayList<>(); + public TemplateUpgradeCheckDTO productionCheck(String templateUpgradeId, String productionEnvId) { + TemplateUpgradeCheckDTO templateUpgradeCheckDTO = new TemplateUpgradeCheckDTO(); Environment environment = environmentService.findOne(productionEnvId); if (!environment.getName().equalsIgnoreCase(EnvNameEnum.PRODUCTION.name())) { - resultList.add("error environment: not production environment"); + throw KrakenException.badRequest("error environment: not production environment"); } - if (!checkStageCompatibility(templateUpgradeId)) { - resultList.add( - "Kraken version running in stage data plane is not compatible with this mapping template. Please upgrade kraken in stage data plane and Start verification"); - } - try { - checkIsLatestUpgrade(templateUpgradeId); - } catch (Exception e) { - resultList.add(e.getMessage()); - } - return resultList; + templateUpgradeCheckDTO.setCompatible(checkStageCompatibility(templateUpgradeId)); + templateUpgradeCheckDTO.setNewerTemplate(checkIsLatestUpgrade(templateUpgradeId, false)); + return templateUpgradeCheckDTO; } public boolean checkStageCompatibility(String templateUpgradeId) { diff --git a/kraken-java-sdk/kraken-java-sdk-controller/src/test/java/com/consoleconnect/kraken/operator/controller/v2/TemplateUpgradeControllerTest.java b/kraken-java-sdk/kraken-java-sdk-controller/src/test/java/com/consoleconnect/kraken/operator/controller/v2/TemplateUpgradeControllerTest.java index 61e9716c..d85eec1d 100644 --- a/kraken-java-sdk/kraken-java-sdk-controller/src/test/java/com/consoleconnect/kraken/operator/controller/v2/TemplateUpgradeControllerTest.java +++ b/kraken-java-sdk/kraken-java-sdk-controller/src/test/java/com/consoleconnect/kraken/operator/controller/v2/TemplateUpgradeControllerTest.java @@ -52,6 +52,7 @@ import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort; import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.jdbc.Sql; import org.springframework.test.web.reactive.server.WebTestClient; @@ -239,7 +240,26 @@ void givenStageUpgraded_whenCheckStageUpgrade_thenReturnData() { .build(TestContextConstants.PRODUCT_ID), body -> { assertThat(body, hasJsonPath("$.code", equalTo(200))); - assertThat(body, hasJsonPath("$.data", hasSize(0))); + assertThat(body, hasJsonPath("$.data.mapperCompleted", is(true))); + }); + } + + @Test + @Order(6) + void givenStageUpgradedAndErrorEnv_whenCheckStageUpgrade_thenReturnCode400() { + String url = "/v3/products/{productId}/template-upgrade/stage-upgrade-check"; + UnifiedAssetDto assetDto = + unifiedAssetService.findByKind(AssetKindEnum.PRODUCT_TEMPLATE_UPGRADE.getKind()).get(0); + testClientHelper.getAndVerify( + uriBuilder -> + uriBuilder + .path(url) + .queryParam("templateUpgradeId", assetDto.getId()) + .queryParam("envId", TestApplication.productionEnvId) + .build(TestContextConstants.PRODUCT_ID), + HttpStatus.BAD_REQUEST, + body -> { + assertThat(body, hasJsonPath("$.reason", containsString("not stage environment"))); }); } @@ -254,11 +274,30 @@ void givenProductionUpgraded_whenCheckProductionUpgrade_thenReturnData() { uriBuilder .path(url) .queryParam("templateUpgradeId", assetDto.getId()) - .queryParam("envId", TestApplication.envId) + .queryParam("envId", TestApplication.productionEnvId) .build(TestContextConstants.PRODUCT_ID), body -> { assertThat(body, hasJsonPath("$.code", equalTo(200))); - assertThat(body, hasJsonPath("$.data", hasSize(greaterThanOrEqualTo(1)))); + assertThat(body, hasJsonPath("$.data.compatible", is(true))); + }); + } + + @Test + @Order(6) + void givenProductionUpgradedAndErrorEnv_whenCheckProductionUpgrade_thenReturnCode400() { + String url = "/v3/products/{productId}/template-upgrade/production-upgrade-check"; + UnifiedAssetDto assetDto = + unifiedAssetService.findByKind(AssetKindEnum.PRODUCT_TEMPLATE_UPGRADE.getKind()).get(0); + testClientHelper.getAndVerify( + uriBuilder -> + uriBuilder + .path(url) + .queryParam("templateUpgradeId", assetDto.getId()) + .queryParam("envId", TestApplication.envId) + .build(TestContextConstants.PRODUCT_ID), + HttpStatus.BAD_REQUEST, + body -> { + assertThat(body, hasJsonPath("$.reason", containsString("not production environment"))); }); } } diff --git a/kraken-java-sdk/kraken-java-sdk-gateway/src/main/java/com/consoleconnect/kraken/operator/gateway/runner/JavaScriptEngineActionRunner.java b/kraken-java-sdk/kraken-java-sdk-gateway/src/main/java/com/consoleconnect/kraken/operator/gateway/runner/JavaScriptEngineActionRunner.java index 721987bd..80c6fe70 100644 --- a/kraken-java-sdk/kraken-java-sdk-gateway/src/main/java/com/consoleconnect/kraken/operator/gateway/runner/JavaScriptEngineActionRunner.java +++ b/kraken-java-sdk/kraken-java-sdk-gateway/src/main/java/com/consoleconnect/kraken/operator/gateway/runner/JavaScriptEngineActionRunner.java @@ -1,12 +1,15 @@ package com.consoleconnect.kraken.operator.gateway.runner; import com.consoleconnect.kraken.operator.core.enums.ActionTypeEnum; +import com.consoleconnect.kraken.operator.core.exception.KrakenException; import com.consoleconnect.kraken.operator.core.model.AppProperty; import com.consoleconnect.kraken.operator.core.model.facet.ComponentAPIFacets; +import com.consoleconnect.kraken.operator.core.toolkit.JsonToolkit; import com.consoleconnect.kraken.operator.gateway.template.JavaScriptEngine; import java.util.Map; import java.util.Optional; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.web.server.ServerWebExchange; @@ -15,6 +18,7 @@ public class JavaScriptEngineActionRunner extends AbstractActionRunner { private final JavaScriptEngine javaScriptEngine; + public static final String ERROR_MSG_VAR = "errorMsg"; public JavaScriptEngineActionRunner(AppProperty appProperty, JavaScriptEngine javaScriptEngine) { super(appProperty); @@ -37,7 +41,16 @@ public Optional runIt( javaScriptEngine.addSourceIfNotPresent(scriptId, code); String resultInJson = javaScriptEngine.execute(scriptId, inputs); log.info("resultInJson:{}", resultInJson); + handleErrorMsg(resultInJson); outputs.put(action.getOutputKey(), resultInJson); return Optional.empty(); } + + private void handleErrorMsg(String resultJson) { + Map map = JsonToolkit.fromJson(resultJson, Map.class); + String errorMsg = (String) map.get(ERROR_MSG_VAR); + if (StringUtils.isNotBlank(errorMsg)) { + throw KrakenException.badRequest(errorMsg); + } + } } diff --git a/kraken-java-sdk/kraken-java-sdk-gateway/src/main/java/com/consoleconnect/kraken/operator/gateway/runner/MappingMatrixCheckerActionRunner.java b/kraken-java-sdk/kraken-java-sdk-gateway/src/main/java/com/consoleconnect/kraken/operator/gateway/runner/MappingMatrixCheckerActionRunner.java index e0827c79..d2d7866f 100644 --- a/kraken-java-sdk/kraken-java-sdk-gateway/src/main/java/com/consoleconnect/kraken/operator/gateway/runner/MappingMatrixCheckerActionRunner.java +++ b/kraken-java-sdk/kraken-java-sdk-gateway/src/main/java/com/consoleconnect/kraken/operator/gateway/runner/MappingMatrixCheckerActionRunner.java @@ -107,13 +107,8 @@ protected void onCheck(Map inputs) { MESSAGE_ALERT.formatted(":lack in check rules for target key: " + targetKey)); } // check enable/disable - Optional enabledOpt = - facets.get(targetKey).stream() - .filter(check -> CHECK_NAME_ENABLED.equalsIgnoreCase(check.name)) - .findFirst(); - if (enabledOpt.isPresent() && enabledOpt.get().value.equals("false")) { - throw KrakenException.badRequest(MESSAGE_ALERT.formatted(":disabled")); - } + enableChecking(facets, targetKey); + if (unifiedAssetRepository.findOneByKey(targetKey).isEmpty()) { throw KrakenException.badRequest(MESSAGE_ALERT.formatted(":not deployed")); } @@ -141,13 +136,29 @@ protected void onCheck(Map inputs) { } } + public void enableChecking(Map> facets, String targetKey) { + Optional enabledOpt = + facets.get(targetKey).stream() + .filter(check -> CHECK_NAME_ENABLED.equalsIgnoreCase(check.name)) + .findFirst(); + if (enabledOpt.isPresent() && "false".equals(enabledOpt.get().value)) { + if (Objects.isNull(enabledOpt.get().errorMsg)) { + throw KrakenException.badRequest(MESSAGE_ALERT.formatted(":disabled")); + } else { + throw KrakenException.badRequest(enabledOpt.get().errorMsg); + } + } + } + public boolean check(DocumentContext documentContext, PathCheck pathCheck) { Object realValue = null; try { realValue = documentContext.read(pathCheck.path()); } catch (Exception e) { log.error("read json path error!"); - throwException(pathCheck, String.format("path %s not exist in request.", pathCheck.name)); + throwException( + pathCheck, + String.format("The parameter %s does not exist in the request.", pathCheck.name)); } if (realValue instanceof JSONArray array) { return array.stream().allMatch(value -> checkExpect(pathCheck, value)); diff --git a/kraken-java-sdk/kraken-java-sdk-gateway/src/test/java/com/consoleconnect/kraken/operator/gateway/runner/JavaScriptEngineActionRunnerTest.java b/kraken-java-sdk/kraken-java-sdk-gateway/src/test/java/com/consoleconnect/kraken/operator/gateway/runner/JavaScriptEngineActionRunnerTest.java new file mode 100644 index 00000000..eb284bd6 --- /dev/null +++ b/kraken-java-sdk/kraken-java-sdk-gateway/src/test/java/com/consoleconnect/kraken/operator/gateway/runner/JavaScriptEngineActionRunnerTest.java @@ -0,0 +1,59 @@ +package com.consoleconnect.kraken.operator.gateway.runner; + +import static com.consoleconnect.kraken.operator.gateway.runner.SpelEngineActionRunner.INPUT_CODE; + +import com.consoleconnect.kraken.operator.core.exception.KrakenException; +import com.consoleconnect.kraken.operator.core.model.facet.ComponentAPIFacets; +import com.consoleconnect.kraken.operator.core.toolkit.JsonToolkit; +import com.consoleconnect.kraken.operator.core.toolkit.YamlToolkit; +import com.consoleconnect.kraken.operator.gateway.CustomConfig; +import com.consoleconnect.kraken.operator.gateway.template.SpELEngine; +import com.consoleconnect.kraken.operator.test.AbstractIntegrationTest; +import com.consoleconnect.kraken.operator.test.MockIntegrationTest; +import java.util.HashMap; +import java.util.Map; +import lombok.SneakyThrows; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; +import org.mockito.Mockito; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.web.server.ServerWebExchange; + +@MockIntegrationTest +@ContextConfiguration(classes = CustomConfig.class) +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) +class JavaScriptEngineActionRunnerTest extends AbstractIntegrationTest { + + @Autowired private JavaScriptEngineActionRunner runner; + + @Test + @SneakyThrows + void givenRequestMissAction_whenExecuteJavascriptAction_thenThrowException() { + ComponentAPIFacets.Action action = + YamlToolkit.parseYaml( + readFileToString("/mockData/api.order.mock.yaml"), ComponentAPIFacets.Action.class) + .get(); + String code = (String) action.getWith().get("code"); + Map request = + JsonToolkit.fromJson( + readFileToString("/mockData/create_order_miss_action_request.json"), Map.class); + ServerWebExchange exchange = Mockito.mock(ServerWebExchange.class); + Assertions.assertThrowsExactly( + KrakenException.class, + () -> + runner.runIt( + exchange, + action, + Map.of( + "body", + request, + INPUT_CODE, + code, + "productOrderItem", + SpELEngine.evaluate("${productOrderItem[0]}", request, Object.class)), + Map.of("order", new HashMap<>()))); + } +} diff --git a/kraken-java-sdk/kraken-java-sdk-gateway/src/test/java/com/consoleconnect/kraken/operator/gateway/runner/MappingMatrixCheckerActionRunnerTest.java b/kraken-java-sdk/kraken-java-sdk-gateway/src/test/java/com/consoleconnect/kraken/operator/gateway/runner/MappingMatrixCheckerActionRunnerTest.java index 11a64bfb..f6b373bc 100644 --- a/kraken-java-sdk/kraken-java-sdk-gateway/src/test/java/com/consoleconnect/kraken/operator/gateway/runner/MappingMatrixCheckerActionRunnerTest.java +++ b/kraken-java-sdk/kraken-java-sdk-gateway/src/test/java/com/consoleconnect/kraken/operator/gateway/runner/MappingMatrixCheckerActionRunnerTest.java @@ -94,7 +94,7 @@ void givenParamMissing_whenOnCheck_thenReturnException() { } @Test - @Order(5) + @Order(4) @SneakyThrows void givenPayload_whenOnCheck_thenReturnOK() { Map inputs = new HashMap<>(); @@ -108,7 +108,7 @@ void givenPayload_whenOnCheck_thenReturnOK() { } @Test - @Order(5) + @Order(4) void givenPayloadWithNoRoute_whenOnCheck_thenThrow422() { Map inputs = new HashMap<>(); inputs.put("targetKey", "targetKey:notFound"); @@ -118,27 +118,35 @@ void givenPayloadWithNoRoute_whenOnCheck_thenThrow422() { } @Test - @Order(5) + @Order(4) @SneakyThrows void givenPayloadMissEnum_whenOnCheck_thenReturnError() { - validateRequest("/mockData/productOrderRequestMissEnum.json", "MBPS"); + validateOrderRequest("/mockData/productOrderRequestMissEnum.json", "MBPS"); } @Test - @Order(5) + @Order(4) @SneakyThrows void givenPayloadWrongConstant_whenOnCheck_thenReturnError() { - validateRequest("/mockData/productOrderRequestMissConstant.json", "productOffering"); + validateOrderRequest("/mockData/productOrderRequestMissConstant.json", "productOffering"); } @Test - @Order(5) + @Order(4) @SneakyThrows void givenPayloadMissMappingParam_whenOnCheck_thenReturnError() { - validateRequest("/mockData/productOrderRequestMissMappingParam.json", "productOffering"); + validateOrderRequest("/mockData/productOrderRequestMissMappingParam.json", "productOffering"); } - private void validateRequest(String request, String matchedMsg) throws IOException { + @Test + @Order(4) + @SneakyThrows + void givenErrorMsgInMatrixItem_whenChecking_thenThrowsExceptionMessageAsExpected() { + String expected = "api use case is not supported : disabled : instantSyncQuote==false"; + validateQuoteRequest("/mockData/quoteWithInstantSyncFalse.json", expected); + } + + private void validateOrderRequest(String request, String matchedMsg) throws IOException { Map inputs = new HashMap<>(); inputs.put("query", Map.of("buyerId", "test-company")); inputs.put("body", JsonToolkit.fromJson(readFileToString(request), Object.class)); @@ -151,6 +159,18 @@ private void validateRequest(String request, String matchedMsg) throws IOExcepti krakenException.getCause().getMessage(), Matchers.containsString(matchedMsg)); } + private void validateQuoteRequest(String request, String matchedMsg) throws IOException { + Map inputs = new HashMap<>(); + inputs.put("query", Map.of("buyerId", "test-company")); + inputs.put("body", JsonToolkit.fromJson(readFileToString(request), Object.class)); + inputs.put("targetKey", "mef.sonata.api-target.quote.uni.add"); + inputs.put("mappingMatrixKey", "mef.sonata.api.matrix.quote.uni.add"); + KrakenException krakenException = + Assertions.assertThrowsExactly( + KrakenException.class, () -> mappingMatrixCheckerActionRunner.onCheck(inputs)); + MatcherAssert.assertThat(krakenException.getMessage(), Matchers.containsString(matchedMsg)); + } + @Test @Order(6) void givenCheckPath_whenCheckExpect_thenReturnException() { diff --git a/kraken-java-sdk/kraken-java-sdk-gateway/src/test/resources/deployment-config/components/api-targets-mappers/api-target-mapper.quote.uni.add.yaml b/kraken-java-sdk/kraken-java-sdk-gateway/src/test/resources/deployment-config/components/api-targets-mappers/api-target-mapper.quote.uni.add.yaml new file mode 100644 index 00000000..3360985f --- /dev/null +++ b/kraken-java-sdk/kraken-java-sdk-gateway/src/test/resources/deployment-config/components/api-targets-mappers/api-target-mapper.quote.uni.add.yaml @@ -0,0 +1,60 @@ +--- +kind: kraken.component.api-target-mapper +apiVersion: v1 +metadata: + key: mef.sonata.api-target-mapper.quote.uni.add + name: Mapper Of Creating Quote UNI + description: This operation creates a Quote entity +spec: + trigger: + path: /mefApi/sonata/quoteManagement/v8/quote + method: post + productType: uni + actionType: add + endpoints: + - id: create quote for port + path: /api/pricing/calculate + method: post + serverKey: mef.sonata.api-target-spec.con1718940696857 + mappers: + request: + response: + - name: mapper.quote.uni.add.state + title: Quote State Mapping + description: quote state mapping + source: "answered" + sourceLocation: "" + target: "@{{quoteItem[0].state}}" + targetType: enum + targetLocation: BODY + requiredMapping: true + targetValues: + - accepted + - acknowledged + - answered + - approved.orderable + - approved.orderableAlternate + - inProgress + - inProgress.draft + - abandoned + - rejected + - unableToProvide + valueMapping: + answered: answered too + ACCEPTED: accepted + - name: mapper.quote.uni.add.price.value + title: Quote Price Value Mapping + description: quote price mapping + source: "@{{responseBody.results[*].price}}" + sourceLocation: BODY + target: "@{{quoteItem[0].quoteItemPrice[*].price.dutyFreeAmount.value}}" + targetLocation: BODY + requiredMapping: true + - name: mapper.quote.uni.add.price.unit + title: Quote Price Unit Mapping + description: quote price mapping + source: "USD" + sourceLocation: BODY + target: "@{{quoteItem[0].quoteItemPrice[*].price.dutyFreeAmount.unit}}" + targetLocation: BODY + requiredMapping: true \ No newline at end of file diff --git a/kraken-java-sdk/kraken-java-sdk-gateway/src/test/resources/deployment-config/components/api-targets/api-target.quote.uni.add.yaml b/kraken-java-sdk/kraken-java-sdk-gateway/src/test/resources/deployment-config/components/api-targets/api-target.quote.uni.add.yaml new file mode 100644 index 00000000..90c0d6e1 --- /dev/null +++ b/kraken-java-sdk/kraken-java-sdk-gateway/src/test/resources/deployment-config/components/api-targets/api-target.quote.uni.add.yaml @@ -0,0 +1,51 @@ +--- +kind: kraken.component.api-target +apiVersion: v1 +metadata: + key: mef.sonata.api-target.quote.uni.add + name: Quote Management API + mapperKey: mef.sonata.api-target-mapper.quote.uni.add + version: 1 +spec: + inputs: + - mefQuery + - mefRequestBody + - entity + trigger: + path: /mefApi/sonata/quoteManagement/v8/quote + method: post + productType: uni + actionType: add + endpoints: + - id: create quote for port + path: "" + method: "" + requestBody: ${mefRequestBody.quoteItem[0].product.productConfiguration.uni} + responseBody: | + { + "id": "${entity.id}", + "buyerRequestedQuoteLevel": "${mefRequestBody.buyerRequestedQuoteLevel}", + "relatedContactInformation": "${T(com.consoleconnect.kraken.operator.gateway.func.SpelFunc).appendSellerInformation('sellerContactInformation', env.seller.name, env.seller.emailAddress, env.seller.number, mefRequestBody.relatedContactInformation)}", + "quoteItem": [ + { + "quoteItem": "${mefRequestBody.quoteItem[0].requestedQuoteItemTerm}}", + "requestedQuoteItemTerm": "${mefRequestBody.quoteItem[0].requestedQuoteItemTerm}}", + "product": "${mefRequestBody.quoteItem[0].product}", + "state": "", + "quoteItemPrice": [{ + "price": { + "dutyFreeAmount": { + "unit": "", + "value": "" + } + } + }] + } + ], + "quoteDate": "${T(com.consoleconnect.kraken.operator.core.toolkit.DateTime).nowInUTCFormatted()}", + "externalId":"${mefRequestBody[externalId]?:''}", + "instantSyncQuote":"${mefRequestBody[instantSyncQuote]?:''}", + "requestedQuoteCompletionDate": "${mefRequestBody[requestedQuoteCompletionDate]?:''}", + "quoteLevel": "${mefRequestBody.buyerRequestedQuoteLevel}", + "state": "((mefResponseBody.quoteItem[0].quoteItemPrice[0].price.dutyFreeAmount.value == '' ? 'unableToProvide': 'approved.orderable'))" + } \ No newline at end of file diff --git a/kraken-java-sdk/kraken-java-sdk-gateway/src/test/resources/deployment-config/components/apis/mef.sonata.api.quote.yaml b/kraken-java-sdk/kraken-java-sdk-gateway/src/test/resources/deployment-config/components/apis/mef.sonata.api.quote.yaml new file mode 100644 index 00000000..382ba0c0 --- /dev/null +++ b/kraken-java-sdk/kraken-java-sdk-gateway/src/test/resources/deployment-config/components/apis/mef.sonata.api.quote.yaml @@ -0,0 +1,344 @@ +--- +kind: kraken.component.api +apiVersion: v1 +metadata: + key: mef.sonata.api.quote + name: Quote Management + labels: + mef-api-release: grace + quote-api-version: v8 + version: 8 +spec: + supportedProductTypesAndActions: + - path: /mefApi/sonata/quoteManagement/v8/quote + method: post + actionTypes: + - add + productTypes: + - UNI + - ACCESS_E_LINE + - path: /mefApi/sonata/quoteManagement/v8/quote/{id} + method: get + productTypes: + - UNI + - ACCESS_E_LINE + mappings: + - uri: ${env.target.url} + trigger: + path: /mefApi/sonata/quoteManagement/v8/quote + method: post + metadata: + cacheRequestBody: true + actions: + - id: calculate_quote_type_and_action_via_javascript + actionType: engine@javascript + env: + quoteItem: ${body['quoteItem'][0]} + instantSyncQuote: ${body.instantSyncQuote} + with: + code: | + (jsonStr) => { + console.log("input: " + jsonStr); + let input = JSON.parse(jsonStr); + let targetAPIConfigKey = ''; + let forwardDownstream = true; + if(input.quoteItem['product']['productConfiguration']['@type'] == 'UNI') { + if(input.instantSyncQuote === true) { + targetAPIConfigKey = 'mef.sonata.api-target.quote.uni.add.sync'; + matrixConfigKey = 'mef.sonata.api.matrix.quote.uni.add.sync' + } else { + targetAPIConfigKey = 'mef.sonata.api-target.quote.uni.add'; + matrixConfigKey = 'mef.sonata.api.matrix.quote.uni.add' + } + } else if(input.quoteItem['product']['productConfiguration']['@type'] == 'ACCESS_E_LINE') { + if(input.instantSyncQuote === true) { + targetAPIConfigKey = 'mef.sonata.api-target.quote.eline.add.sync'; + matrixConfigKey = 'mef.sonata.api.matrix.quote.eline.add.sync' + } else { + targetAPIConfigKey = 'mef.sonata.api-target.quote.eline.add'; + matrixConfigKey = 'mef.sonata.api.matrix.quote.eline.add' + } + } else { + targetAPIConfigKey = 'targetKey:notFound'; + } + let ret = { + quoteType: input.quoteItem['product']['productConfiguration']['@type'], + instantSyncQuote: input.instantSyncQuote, + forwardDownstream: forwardDownstream, + targetAPIConfigKey: targetAPIConfigKey, + matrixConfigKey: matrixConfigKey + }; + return JSON.stringify(ret); + } + outputKey: quote + + - id: mapping_matrix_check_quote + actionType: buildin@mapping-matrix-checker + env: + mappingMatrixKey: ${quote.matrixConfigKey} + targetKey: ${quote.targetAPIConfigKey} + - id: persist_http_request + actionType: buildin@db + env: + bizType: ${quote.quoteType} + with: + action: create + properties: + - headers + - queryParameters + - requestBody + preRequest: true + + - id: load-downstream-api-config + actionType: buildin@load-target-api-config + env: + configKey: ${quote.targetAPIConfigKey} + mefQuery: ${query} + mefRequestBody: ${body} + entity: ${entity} + with: + render: true + outputKey: targetApiConfig + + - id: rewrite-path + actionType: buildin@rewrite-path + env: + path: ${targetApiConfig.endpoints[0].path} + method: ${targetApiConfig.endpoints[0].method} + + - id: modify-request-body-for-quote-add + actionType: buildin@modify-request-body + env: + code: ${targetApiConfig.endpoints[0].requestBody} + + - id: modify-response-body-for-quote-add + actionType: buildin@modify-response-body + with: + engine: spel + successStatus: 201 + env: + code: ${targetApiConfig.endpoints[0].responseBody} + inputs: ${targetApiConfig.inputs} + mefRequestBody: ${body} + postResultRender: true + + - actionType: buildin@db + with: + action: update + properties: + - responseBody + - responseStatusCode + - renderedResponseBody + preRequest: false + postRequest: true + order: -4 + + - uri: ${env.target.url} + trigger: + path: /mefApi/sonata/quoteManagement/v8/quote/** + method: get + metadata: + cacheRequestBody: false + actions: + - name: retrieve quoteId from path + actionType: buildin@pattern + env: + input: ${path} + pattern: /mefApi/sonata/quoteManagement/v8/quote/(?.*) + + - id: read request payload by id + actionType: buildin@db + env: + id: ${segment} + blankIdErrMsg: "quote id cannot be blank" + notExistedErrMsg: "quote id does not exist" + with: + action: read + preRequest: true + + - id: calculate_quote_type_for_read_via_javascript + actionType: engine@javascript + env: + bizType: ${entity.bizType} + instantSyncQuote: ${entity.request.instantSyncQuote} + with: + code: | + (jsonStr) => { + console.log("input: " + jsonStr); + let input = JSON.parse(jsonStr); + let targetAPIConfigKey = ''; + let forwardDownstream = true; + if(input.bizType == 'UNI') { + if(input.instantSyncQuote === true) { + targetAPIConfigKey = 'mef.sonata.api-target.quote.uni.read.sync'; + forwardDownstream = false; + } else { + targetAPIConfigKey = 'mef.sonata.api-target.quote.uni.read'; + } + } else if(input.bizType == 'ACCESS_E_LINE') { + if(input.instantSyncQuote === true) { + targetAPIConfigKey = 'mef.sonata.api-target.quote.eline.read.sync'; + forwardDownstream = false; + } else { + targetAPIConfigKey = 'mef.sonata.api-target.quote.eline.read'; + } + } else { + targetAPIConfigKey = 'targetKey:notFound'; + } + let ret = { + quoteType: input.bizType, + instantSyncQuote: input.instantSyncQuote, + forwardDownstream: forwardDownstream, + targetAPIConfigKey: targetAPIConfigKey + }; + return JSON.stringify(ret); + } + outputKey: quote + - id: load-downstream-api-config-quote-read + actionType: buildin@load-target-api-config + env: + configKey: ${quote.targetAPIConfigKey} + mefQuery: ${query} + entity: ${entity} + with: + render: true + outputKey: targetApiConfig + + - id: rewrite-path + actionType: buildin@rewrite-path + env: + path: ${targetApiConfig.endpoints[0].path} + method: ${targetApiConfig.endpoints[0].method} + + - id: mock-response + actionType: buildin@mock-response + env: + forwardDownstream: ${quote.forwardDownstream} + + - id: modify-request-body + actionType: buildin@modify-request-body + env: + code: ${targetApiConfig.endpoints[0].requestBody} + + - id: modify-response-body + actionType: buildin@modify-response-body + with: + engine: spel + env: + code: ${targetApiConfig.endpoints[0].responseBody} + inputs: ${targetApiConfig.inputs} + - trigger: + path: /mefApi/sonata/quoteManagement/v8/quote/hub + method: post + metadata: + cacheRequestBody: true + actions: + - id: calculate_quote_event_types_via_javascript + actionType: engine@javascript + env: + query: ${body.query} + with: + code: | + (jsonStr) => { + console.log("input: " + jsonStr); + let input = JSON.parse(jsonStr); + let query = input.query; + let arr = query.split("="); + let eventArr = arr[1].split(","); + let ret = { + "eventTypes": eventArr, + "targetAPIConfigKey": "mef.sonata.api-target.hub.add" + }; + return JSON.stringify(ret); + } + outputKey: event + - id: register-quote-event + actionType: buildin@register-event + env: + eventTypes: ${event.eventTypes} + with: + action: register + + - id: load-downstream-api-config + actionType: buildin@load-target-api-config + env: + configKey: ${event.targetAPIConfigKey} + mefRequestBody: ${body} + entity: ${entity} + with: + render: true + outputKey: targetApiConfig + + - id: mock-response + actionType: buildin@mock-response + + - id: modify-response-body + actionType: buildin@modify-response-body + with: + engine: spel + env: + code: ${targetApiConfig.endpoints[0].responseBody} + inputs: ${targetApiConfig.inputs} +links: + - targetAssetKey: mef.sonata.api-target.quote.eline.add + relationship: implementation.target + group: mef.sonata.api-target.quote.eline.add + - targetAssetKey: mef.sonata.api-target.quote.eline.read + relationship: implementation.target + group: mef.sonata.api-target.quote.eline.read + - targetAssetKey: mef.sonata.api-target.quote.uni.add + relationship: implementation.target + group: mef.sonata.api-target.quote.uni.add + - targetAssetKey: mef.sonata.api-target.quote.uni.read + relationship: implementation.target + group: mef.sonata.api-target.quote.uni.read + - targetAssetKey: mef.sonata.api-target.quote.eline.add.sync + relationship: implementation.target + group: mef.sonata.api-target.quote.eline.add.sync + - targetAssetKey: mef.sonata.api-target.quote.eline.read.sync + relationship: implementation.target + group: mef.sonata.api-target.quote.eline.read.sync + - targetAssetKey: mef.sonata.api-target.quote.uni.add.sync + relationship: implementation.target + group: mef.sonata.api-target.quote.uni.add.sync + - targetAssetKey: mef.sonata.api-target.quote.uni.read.sync + relationship: implementation.target + group: mef.sonata.api-target.quote.uni.read.sync + - targetAssetKey: mef.sonata.api-spec.quote + relationship: implementation.standard.api-spec + - targetAssetKey: mef.sonata.api-target-mapper.quote.eline.add + relationship: implementation.target-mapper + group: mef.sonata.api-target.quote.eline.add + - targetAssetKey: mef.sonata.api.matrix.quote.eline.add + relationship: implementation.matrix + group: mef.sonata.api-target.quote.eline.add + - targetAssetKey: mef.sonata.api-target-mapper.quote.uni.add + relationship: implementation.target-mapper + group: mef.sonata.api-target.quote.uni.add + - targetAssetKey: mef.sonata.api.matrix.quote.uni.add + relationship: implementation.matrix + group: mef.sonata.api-target.quote.uni.add + - targetAssetKey: mef.sonata.api-target-mapper.quote.uni.read + relationship: implementation.target-mapper + group: mef.sonata.api-target.quote.uni.read + - targetAssetKey: mef.sonata.api-target-mapper.quote.eline.read + relationship: implementation.target-mapper + group: mef.sonata.api-target.quote.eline.read + - targetAssetKey: mef.sonata.api-target-mapper.quote.eline.add.sync + relationship: implementation.target-mapper + group: mef.sonata.api-target.quote.eline.add.sync + - targetAssetKey: mef.sonata.api.matrix.quote.eline.add.sync + relationship: implementation.matrix + group: mef.sonata.api-target.quote.eline.add.sync + - targetAssetKey: mef.sonata.api-target-mapper.quote.uni.add.sync + relationship: implementation.target-mapper + group: mef.sonata.api-target.quote.uni.add.sync + - targetAssetKey: mef.sonata.api.matrix.quote.uni.add.sync + relationship: implementation.matrix + group: mef.sonata.api-target.quote.uni.add.sync + - targetAssetKey: mef.sonata.api-target-mapper.quote.uni.read.sync + relationship: implementation.target-mapper + group: mef.sonata.api-target.quote.uni.read.sync + - targetAssetKey: mef.sonata.api-target-mapper.quote.eline.read.sync + relationship: implementation.target-mapper + group: mef.sonata.api-target.quote.eline.read.sync \ No newline at end of file diff --git a/kraken-java-sdk/kraken-java-sdk-gateway/src/test/resources/deployment-config/components/mapping-matrix/mapping.matrix.quote.uni.add.yaml b/kraken-java-sdk/kraken-java-sdk-gateway/src/test/resources/deployment-config/components/mapping-matrix/mapping.matrix.quote.uni.add.yaml new file mode 100644 index 00000000..ba5cd132 --- /dev/null +++ b/kraken-java-sdk/kraken-java-sdk-gateway/src/test/resources/deployment-config/components/mapping-matrix/mapping.matrix.quote.uni.add.yaml @@ -0,0 +1,32 @@ +--- +kind: kraken.product.mapping.matrix +apiVersion: v1 +metadata: + key: mef.sonata.api.matrix.quote.uni.add + name: MEF Sonata API + labels: + mef-api-release: grace + version: 14 +spec: + matrix: + mef.sonata.api-target.quote.uni.add: + - name: enabled + expectType: EXPECTED + value: false + errorMsg: "api use case is not supported : disabled : instantSyncQuote==false" + - name: product_type_UNI + path: "$.body.quoteItem[*].product.productConfiguration.['@type']" + expectType: EXPECTED + value: UNI + - name: action_add + path: "$.body.quoteItem[*].['action']" + expectType: EXPECTED + value: add + - name: syn_mode_false + path: "$.body.instantSyncQuote" + expectType: EXPECTED + value: false + - name: buyer.requested.quote.level.firm + path: "$.body.buyerRequestedQuoteLevel" + expectType: EXPECTED + value: firm diff --git a/kraken-java-sdk/kraken-java-sdk-gateway/src/test/resources/deployment-config/kraken-product-sonata.yaml b/kraken-java-sdk/kraken-java-sdk-gateway/src/test/resources/deployment-config/kraken-product-sonata.yaml index 8eab0327..8bb6b0c8 100644 --- a/kraken-java-sdk/kraken-java-sdk-gateway/src/test/resources/deployment-config/kraken-product-sonata.yaml +++ b/kraken-java-sdk/kraken-java-sdk-gateway/src/test/resources/deployment-config/kraken-product-sonata.yaml @@ -13,19 +13,24 @@ spec: - classpath:deployment-config/components/transformers/response_echo.yaml - classpath:deployment-config/components/apis/api.notification.yaml - classpath:deployment-config/components/apis/mef.sonata.api.address.yaml + - classpath:deployment-config/components/apis/mef.sonata.api.quote.yaml - classpath:deployment-config/components/api-targets/mef.sonata.api-target.address.validate.yaml - classpath:deployment-config/components/api-targets/mef.sonata.api-target.order.unit.add.yaml - classpath:deployment-config/components/api-targets/api-target.address.validate.yaml - classpath:deployment-config/components/api-targets/api-target-mapper.address.validate.yaml - classpath:deployment-config/components/api-targets/api-target.order.eline.add.yaml - classpath:deployment-config/components/api-targets/api-target.order.eline.read.yaml + - classpath:deployment-config/components/api-targets/api-target.order.eline.read.yaml - classpath:deployment-config/components/api-targets/api-target.hub.add.yaml + - classpath:deployment-config/components/api-targets/api-target.quote.uni.add.yaml + - classpath:deployment-config/components/api-targets/api-target.order.notification.state.change.yaml - classpath:deployment-config/components/api-targets-mappers/api-target-mapper.hub.add.yaml + - classpath:deployment-config/components/api-targets-mappers/api-target-mapper.quote.uni.add.yaml - classpath:deployment-config/components/api-targets-mappers/api-target-mapper.order.eline.add.yaml - - classpath:deployment-config/components/api-targets/api-target.order.notification.state.change.yaml - classpath:deployment-config/components/api-targets-mappers/api-target-mapper.order.notification.state.change.yaml - classpath:deployment-config/components/mapping-matrix/mapping.matrix.order.yaml - classpath:deployment-config/components/mapping-matrix/mapping.matrix.address.validation.yaml - classpath:deployment-config/components/mapping-matrix/mapping.matrix.address.validation.enable.yaml + - classpath:deployment-config/components/mapping-matrix/mapping.matrix.quote.uni.add.yaml diff --git a/kraken-java-sdk/kraken-java-sdk-gateway/src/test/resources/mockData/api.order.mock.yaml b/kraken-java-sdk/kraken-java-sdk-gateway/src/test/resources/mockData/api.order.mock.yaml new file mode 100644 index 00000000..1534eecc --- /dev/null +++ b/kraken-java-sdk/kraken-java-sdk-gateway/src/test/resources/mockData/api.order.mock.yaml @@ -0,0 +1,49 @@ +id: calculate_order_type_and_action_via_javascript +actionType: engine@javascript +env: + productOrderItem: ${body['productOrderItem'][0]} +with: + code: | + (jsonStr) => { + console.log("input: " + jsonStr); + let input = JSON.parse(jsonStr); + let targetAPIConfigKey = ''; + let matrixConfigKey = ''; + let errorMsg = ''; + let type = input.productOrderItem['product']['productConfiguration']['@type']; + let action = input.productOrderItem['action']; + let typeArr = ['UNI', 'ACCESS_E_LINE']; + let actionArr = ['add', 'delete']; + if(type == 'UNI' && action == 'add') { + targetAPIConfigKey = 'mef.sonata.api-target.order.uni.add'; + matrixConfigKey = 'mef.sonata.api.matrix.order.uni.add' + } else if(type == 'ACCESS_E_LINE' && action == 'add') { + targetAPIConfigKey = 'mef.sonata.api-target.order.eline.add'; + matrixConfigKey = 'mef.sonata.api.matrix.order.eline.add' + } else if(type == 'UNI' && action == 'delete') { + targetAPIConfigKey = 'mef.sonata.api-target.order.uni.delete'; + matrixConfigKey = 'mef.sonata.api.matrix.order.uni.delete' + } else if(type == 'ACCESS_E_LINE' && action == 'delete') { + targetAPIConfigKey = 'mef.sonata.api-target.order.eline.delete'; + matrixConfigKey = 'mef.sonata.api.matrix.order.eline.delete' + } else { + errorArr = ['api use case is not supported :']; + if (!typeArr.includes(type)){ + errorArr.push(`expect productOrderItem.product.productConfiguration.@type in [ ${typeArr} ], but ${type}.`); + } + if (!actionArr.includes(action)) { + errorArr.push(`expect productOrderItem.action in [ ${actionArr} ], but ${action}`) + } + errorMsg = errorArr.join(' '); + targetAPIConfigKey = 'targetKey:notFound'; + } + let ret = { + orderType: input.productOrderItem['product']['productConfiguration']['@type'], + orderAction: input.productOrderItem['action'], + targetAPIConfigKey: targetAPIConfigKey, + matrixConfigKey: matrixConfigKey, + errorMsg: errorMsg + }; + return JSON.stringify(ret); + } +outputKey: order \ No newline at end of file diff --git a/kraken-java-sdk/kraken-java-sdk-gateway/src/test/resources/mockData/create_order_miss_action_request.json b/kraken-java-sdk/kraken-java-sdk-gateway/src/test/resources/mockData/create_order_miss_action_request.json new file mode 100644 index 00000000..2d6ab8c0 --- /dev/null +++ b/kraken-java-sdk/kraken-java-sdk-gateway/src/test/resources/mockData/create_order_miss_action_request.json @@ -0,0 +1,116 @@ +{ + "note": [], + "relatedContactInformation": [ + { + "number": "111 222 333", + "emailAddress": "productOrderContact@mef.com", + "role": "productOrderContact", + "postalAddress": null, + "organization": "MEF", + "name": "Joe Order", + "numberExtension": null + } + ], + "externalId": "AEL[9301] General On-net Order ", + "projectId": "MEF OIT", + "productOrderItem": [ + { + "relatedBuyerPON": null, + "note": [], + "product": { + "productOffering": { + "href": null, + "id": "ACCESS_E_LINE" + }, + "productConfiguration": { + "@type": "ELINE", + "bandwidth": 1, + "bandwidthUnit": "MBPS", + "classOfService": "SILVER", + "paymentType": "invoice", + "name": "mock-name", + "buyerCompanyId": "mock-company", + "destUNIMetroId": "5db65dcf5d545", + "type": "LAYER2" + }, + "productRelationship": [ + { + "relationshipType": "CONNECTS_TO_ENNI", + "id": "order-id", + "href": null + }, + { + "relationshipType": "CONNECTS_TO_UNI", + "id": "order-id1", + "href": null + } + ], + "id": null, + "href": null, + "place": [] + }, + "relatedContactInformation": [ + { + "number": "+12-345-678-90", + "emailAddress": "Buyer.ProductOrderItemContact@mef.com", + "role": "buyerProductOrderItemContact", + "postalAddress": null, + "organization": null, + "name": "Buyer Product Order Item Contact", + "numberExtension": null + }, + { + "number": "+12-345-678-90", + "emailAddress": "Buyer.ImplementationContact@mef.com", + "role": "buyerImplementationContact", + "postalAddress": null, + "organization": null, + "name": "Buyer Implementation Contact", + "numberExtension": null + }, + { + "number": "+12-345-678-90", + "emailAddress": "Buyer.TechnicalContact@mef.com", + "role": "buyerTechnicalContact", + "postalAddress": null, + "organization": null, + "name": "Buyer Technical Contact ", + "numberExtension": null + } + ], + "requestedItemTerm": { + "name": "ELine Item Term", + "duration": { + "amount": 1, + "units": "calendarMonths" + }, + "endOfTermAction": "roll", + "rollInterval": { + "amount": 1, + "units": "calendarMonths" + } + }, + "billingAccount": { + "id": "001" + }, + + "tspRestorationPriority": null, + "productOfferingQualificationItem": { + "productOfferingQualificationId": "", + "alternateProductProposalId": null, + "productOfferingQualificationHref": null, + "id": "ELINE" + }, + "coordinatedAction": [], + "quoteItem": { + "quoteHref": null, + "id": "ELINE", + "quoteId": "" + }, + "endCustomerName": null, + "expediteIndicator": false, + "id": "ELINE", + "requestedCompletionDate": "2121-11-30T23:00:00Z" + } + ] +} \ No newline at end of file diff --git a/kraken-java-sdk/kraken-java-sdk-gateway/src/test/resources/mockData/quoteWithInstantSyncFalse.json b/kraken-java-sdk/kraken-java-sdk-gateway/src/test/resources/mockData/quoteWithInstantSyncFalse.json new file mode 100644 index 00000000..dc8a1b5d --- /dev/null +++ b/kraken-java-sdk/kraken-java-sdk-gateway/src/test/resources/mockData/quoteWithInstantSyncFalse.json @@ -0,0 +1,97 @@ +{ + "note": [], + "requestedQuoteCompletionDate": "2027-12-31T23:00:00Z", + "relatedContactInformation": [ + { + "number": "111 222 333", + "emailAddress": "buyerContact@mef.com", + "role": "buyerContactInformation", + "postalAddress": null, + "organization": "MEF", + "name": "Joe Buyer", + "numberExtension": null + } + ], + "externalId": "ORDERABLE_ALTERNATE [8203] Sync Quote FIRM - ADD", + "buyerRequestedQuoteLevel": "firm", + "projectId": "MEF OIT", + "instantSyncQuote": false, + "quoteItem": [ + { + "requestedQuoteItemTerm": { + "name": "UNI Item Term", + "duration": { + "amount": 1, + "units": "calendarMonths" + }, + "endOfTermAction": "roll", + "description": "no description", + "rollInterval": { + "amount": 1, + "units": "calendarMonths" + } + }, + "note": [], + "product": { + "id": null, + "href": null, + "place": [ + { + "role": "INSTALL_LOCATION", + "href": null, + "id": "6356792a4806220015488631", + "@type": "GeographicAddressRef", + "@schemaLocation": null + } + ], + "productConfiguration": { + "@type": "UNI", + "bandwidth": 1000, + "bandwidthUnit": "MBPS", + "name" : "test-qc01", + "paymentType" : "invoice" + }, + "productOffering": { + "id": "UNI", + "href": null + }, + "productRelationship": [] + }, + "productOfferingQualificationItem": { + "productOfferingQualificationId": "", + "alternateProductProposalId": null, + "productOfferingQualificationHref": null, + "id": "UNI" + }, + "relatedContactInformation": [ + { + "number": "111 222 333", + "emailAddress": "quoteItemTechnicalContact@mef.com", + "role": "quoteItemTechnicalContact", + "postalAddress": null, + "organization": "MEF", + "name": "David Item", + "numberExtension": null + }, + { + "number": "111 222 333", + "emailAddress": "quoteItemLocationContact@mef.com", + "role": "quoteItemLocationContact", + "postalAddress": null, + "organization": "MEF", + "name": "Konrad Item Location", + "numberExtension": null + } + ], + "agreementName": null, + "action": "add", + "dealReference": null, + "id": "UNI", + "requestedQuoteItemInstallationInterval": { + "amount": 10, + "units": "calendarDays" + }, + "quoteItemRelationship": [] + } + ] +} \ No newline at end of file diff --git a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets-mappers/api-target-mapper.order.eline.add.yaml b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets-mappers/api-target-mapper.order.eline.add.yaml index 12dd3189..b898072c 100644 --- a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets-mappers/api-target-mapper.order.eline.add.yaml +++ b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets-mappers/api-target-mapper.order.eline.add.yaml @@ -16,6 +16,7 @@ spec: - id: create connection order path: "" method: "" + serverKey: "" mappers: request: - name: mapper.order.eline.add.buyerId @@ -178,5 +179,14 @@ spec: targetLocation: BODY customizedField: false requiredMapping: false - serverKey: "" + - name: mapper.order.eline.add.product.id + title: product instance id + description: "" + source: "" + sourceLocation: BODY + target: "@{{productOrderItem[0].product.id}}" + targetLocation: BODY + customizedField: false + requiredMapping: false + diff --git a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets-mappers/api-target-mapper.order.uni.add.yaml b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets-mappers/api-target-mapper.order.uni.add.yaml index e192ffbf..ec012b0e 100644 --- a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets-mappers/api-target-mapper.order.uni.add.yaml +++ b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets-mappers/api-target-mapper.order.uni.add.yaml @@ -17,6 +17,7 @@ spec: - id: create port order path: "" method: "" + serverKey: "" mappers: request: - name: mapper.order.uni.add.buyerId @@ -162,3 +163,12 @@ spec: sourceLocation: BODY targetLocation: BODY requiredMapping: false + - name: mapper.order.uni.add.product.id + title: product instance id + description: "" + source: "" + sourceLocation: BODY + target: "@{{productOrderItem[0].product.id}}" + targetLocation: BODY + customizedField: false + requiredMapping: false diff --git a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets/api-target.inventory.eline.list.yaml b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets/api-target.inventory.eline.list.yaml index 7d2aee9b..dc7ab316 100644 --- a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets/api-target.inventory.eline.list.yaml +++ b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets/api-target.inventory.eline.list.yaml @@ -31,6 +31,12 @@ spec: "externalId":"${entity.request[externalId]?:''}", "productRelationship":"${entity.request.productOrderItem[0].product.productRelationship}", "billingAccount":"${entity.request.productOrderItem[0].billingAccount}", - "productOrderItem":"${entity.renderedResponse.productOrderItem}" + "productOrderItem":[ + { + "productOrderHref":"", + "productOrderItemId":"${entity.renderedResponse.productOrderItem[0]['id']}", + "productOrderId":"${entity.renderedResponse['orderId']}" + } + ] } ] \ No newline at end of file diff --git a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets/api-target.inventory.eline.read.yaml b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets/api-target.inventory.eline.read.yaml index f4012ef5..23eb069f 100644 --- a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets/api-target.inventory.eline.read.yaml +++ b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets/api-target.inventory.eline.read.yaml @@ -21,5 +21,5 @@ spec: { "id": "${segment}", "startDate": "@{{startDate}}", - "status": "@{{status}}" + "status": "@{{status}}" } \ No newline at end of file diff --git a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets/api-target.inventory.uni.list.yaml b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets/api-target.inventory.uni.list.yaml index 2a29e6df..30ebb4c2 100644 --- a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets/api-target.inventory.uni.list.yaml +++ b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets/api-target.inventory.uni.list.yaml @@ -31,6 +31,12 @@ spec: "externalId":"${entity.request[externalId]?:''}", "productRelationship":"${entity.request.productOrderItem[0].product.productRelationship}", "billingAccount":"${entity.request.productOrderItem[0].billingAccount}", - "productOrderItem":"${entity.renderedResponse.productOrderItem}" + "productOrderItem":[ + { + "productOrderHref":"", + "productOrderItemId":"${entity.renderedResponse.productOrderItem[0]['id']}", + "productOrderId":"${entity.renderedResponse['orderId']}" + } + ] } ] \ No newline at end of file diff --git a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets/api-target.inventory.uni.read.yaml b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets/api-target.inventory.uni.read.yaml index b0ee0ec2..9447f48c 100644 --- a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets/api-target.inventory.uni.read.yaml +++ b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets/api-target.inventory.uni.read.yaml @@ -21,5 +21,5 @@ spec: { "id": "${segment}", "startDate": "@{{startDate}}", - "status": "@{{status}}" + "status": "@{{status}}" } \ No newline at end of file diff --git a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets/api-target.quote.eline.add.sync.yaml b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets/api-target.quote.eline.add.sync.yaml index 985942ac..9c4e6f50 100644 --- a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets/api-target.quote.eline.add.sync.yaml +++ b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets/api-target.quote.eline.add.sync.yaml @@ -25,7 +25,7 @@ spec: { "id": "${entity.id}", "buyerRequestedQuoteLevel": "${mefRequestBody.buyerRequestedQuoteLevel}", - "relatedContactInformation": "${T(com.consoleconnect.kraken.operator.gateway.func.SpelFunc).appendSellerInformation('sellerContactInformation', env.seller.name, env.seller.emailAddress, env.seller.number, mefRequestBody.relatedContactInformation)}", + "relatedContactInformation": "${T(com.consoleconnect.kraken.operator.gateway.func.SpelFunc).appendSellerInformation('sellerContactInformation', env.seller.name, env.seller.emailAddress, env.seller.number, mefRequestBody[relatedContactInformation]?:'')}", "quoteItem": [{ "requestedQuoteItemTerm": "${mefRequestBody.quoteItem[0].requestedQuoteItemTerm}", "product": "${mefRequestBody.quoteItem[0].product}", diff --git a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets/api-target.quote.uni.add.sync.yaml b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets/api-target.quote.uni.add.sync.yaml index 2fe2564f..6cd539f1 100644 --- a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets/api-target.quote.uni.add.sync.yaml +++ b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/api-targets/api-target.quote.uni.add.sync.yaml @@ -26,7 +26,7 @@ spec: { "id": "${entity.id}", "buyerRequestedQuoteLevel": "${mefRequestBody.buyerRequestedQuoteLevel}", - "relatedContactInformation": "${T(com.consoleconnect.kraken.operator.gateway.func.SpelFunc).appendSellerInformation('sellerContactInformation', env.seller.name, env.seller.emailAddress, env.seller.number, mefRequestBody.relatedContactInformation)}", + "relatedContactInformation": "${T(com.consoleconnect.kraken.operator.gateway.func.SpelFunc).appendSellerInformation('sellerContactInformation', env.seller.name, env.seller.emailAddress, env.seller.number, mefRequestBody[relatedContactInformation]?:'')}", "quoteItem": [ { "requestedQuoteItemTerm": "${mefRequestBody.quoteItem[0].requestedQuoteItemTerm}", diff --git a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/apis/api.order.yaml b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/apis/api.order.yaml index 8d380104..4a6278bf 100644 --- a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/apis/api.order.yaml +++ b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/apis/api.order.yaml @@ -41,26 +41,41 @@ spec: console.log("input: " + jsonStr); let input = JSON.parse(jsonStr); let targetAPIConfigKey = ''; - if(input.productOrderItem['product']['productConfiguration']['@type'] == 'UNI' && input.productOrderItem['action'] == 'add') { + let matrixConfigKey = ''; + let errorMsg = ''; + let type = input.productOrderItem['product']['productConfiguration']['@type']; + let action = input.productOrderItem['action']; + let typeArr = ['UNI', 'ACCESS_E_LINE']; + let actionArr = ['add', 'delete']; + if(type == 'UNI' && action == 'add') { targetAPIConfigKey = 'mef.sonata.api-target.order.uni.add'; matrixConfigKey = 'mef.sonata.api.matrix.order.uni.add' - } else if(input.productOrderItem['product']['productConfiguration']['@type'] == 'ACCESS_E_LINE' && input.productOrderItem['action'] == 'add') { + } else if(type == 'ACCESS_E_LINE' && action == 'add') { targetAPIConfigKey = 'mef.sonata.api-target.order.eline.add'; matrixConfigKey = 'mef.sonata.api.matrix.order.eline.add' - } else if(input.productOrderItem['product']['productConfiguration']['@type'] == 'UNI' && input.productOrderItem['action'] == 'delete') { + } else if(type == 'UNI' && action == 'delete') { targetAPIConfigKey = 'mef.sonata.api-target.order.uni.delete'; matrixConfigKey = 'mef.sonata.api.matrix.order.uni.delete' - } else if(input.productOrderItem['product']['productConfiguration']['@type'] == 'ACCESS_E_LINE' && input.productOrderItem['action'] == 'delete') { + } else if(type == 'ACCESS_E_LINE' && action == 'delete') { targetAPIConfigKey = 'mef.sonata.api-target.order.eline.delete'; matrixConfigKey = 'mef.sonata.api.matrix.order.eline.delete' } else { + errorArr = ['api use case is not supported :']; + if (!typeArr.includes(type)){ + errorArr.push(`expect productOrderItem.product.productConfiguration.@type in [ ${typeArr} ], but ${type}.`); + } + if (!actionArr.includes(action)) { + errorArr.push(`expect productOrderItem.action in [ ${actionArr} ], but ${action}`) + } + errorMsg = errorArr.join(' '); targetAPIConfigKey = 'targetKey:notFound'; } let ret = { orderType: input.productOrderItem['product']['productConfiguration']['@type'], orderAction: input.productOrderItem['action'], targetAPIConfigKey: targetAPIConfigKey, - matrixConfigKey: matrixConfigKey + matrixConfigKey: matrixConfigKey, + errorMsg: errorMsg }; return JSON.stringify(ret); } @@ -98,7 +113,6 @@ spec: env: path: ${targetApiConfig.endpoints[0].path} method: ${targetApiConfig.endpoints[0].method} - - id: modify-request-body actionType: buildin@modify-request-body env: diff --git a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/mapping-matrix/mapping.matrix.order.eline.add.yaml b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/mapping-matrix/mapping.matrix.order.eline.add.yaml index 2e477951..abdc5926 100644 --- a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/mapping-matrix/mapping.matrix.order.eline.add.yaml +++ b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/mapping-matrix/mapping.matrix.order.eline.add.yaml @@ -48,13 +48,11 @@ spec: expectType: EXPECTED_EXIST value: true errorMsg: "requestedItemTerm.name should exist in request" - - name: productRelationship_relationshipType_0 + - name: productOrderItem[0].product.productRelationship[0].relationshipType path: "$.body.productOrderItem[0].product.productRelationship[0].relationshipType" - expectType: EXPECTED_EXIST - value: true - errorMsg: "productRelationship[0].relationshipType should exist in request" - - name: productRelationship_relationshipType_1 + expectType: EXPECTED + value: "CONNECTS_TO_ENNI" + - name: productOrderItem[0].product.productRelationship[1].relationshipType path: "$.body.productOrderItem[0].product.productRelationship[1].relationshipType" - expectType: EXPECTED_EXIST - value: true - errorMsg: "productRelationship[1].relationshipType should exist in request" + expectType: EXPECTED + value: "CONNECTS_TO_UNI" \ No newline at end of file diff --git a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/mapping-matrix/mapping.matrix.order.uni.add.yaml b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/mapping-matrix/mapping.matrix.order.uni.add.yaml index d76ac96b..a4886c35 100644 --- a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/mapping-matrix/mapping.matrix.order.uni.add.yaml +++ b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/mapping-matrix/mapping.matrix.order.uni.add.yaml @@ -18,14 +18,14 @@ spec: path: "$.body.productOrderItem[*].['action']" expectType: EXPECTED value: add - - name: productOrderItem_product_place_role + - name: productOrderItem[0].product.place[0].role path: "$.body.productOrderItem[0].product.place[0].role" - expectType: EXPECTED_EXIST - value: true - - name: productOrderItem_product_place_@type + expectType: EXPECTED + value: "INSTALL_LOCATION" + - name: productOrderItem[0].product.place[0].@type path: "$.body.productOrderItem[0].product.place[0].@type" - expectType: EXPECTED_EXIST - value: true + expectType: EXPECTED + value: "GeographicAddressRef" - name: relatedContactInformation_emailAddress path: "$.body.relatedContactInformation[*]" expectType: EXPECTED_TRUE diff --git a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/mapping-matrix/mapping.matrix.quote.eline.add.yaml b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/mapping-matrix/mapping.matrix.quote.eline.add.yaml index 4bc3d050..6c22de46 100644 --- a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/mapping-matrix/mapping.matrix.quote.eline.add.yaml +++ b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/mapping-matrix/mapping.matrix.quote.eline.add.yaml @@ -13,6 +13,7 @@ spec: - name: enabled expectType: EXPECTED value: false + errorMsg: "api use case is not supported : disabled : instantSyncQuote==false" - name: product_type_eline path: "$.body.quoteItem[*].product.productConfiguration.['@type']" expectType: EXPECTED diff --git a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/mapping-matrix/mapping.matrix.quote.uni.add.yaml b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/mapping-matrix/mapping.matrix.quote.uni.add.yaml index 52657801..ba5cd132 100644 --- a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/mapping-matrix/mapping.matrix.quote.uni.add.yaml +++ b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/mapping-matrix/mapping.matrix.quote.uni.add.yaml @@ -13,6 +13,7 @@ spec: - name: enabled expectType: EXPECTED value: false + errorMsg: "api use case is not supported : disabled : instantSyncQuote==false" - name: product_type_UNI path: "$.body.quoteItem[*].product.productConfiguration.['@type']" expectType: EXPECTED diff --git a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/product.yaml b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/product.yaml index 19d9b05d..5c68d642 100644 --- a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/product.yaml +++ b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/product.yaml @@ -96,7 +96,7 @@ spec: - classpath:/mef-sonata/mapping-matrix/mapping.matrix.inventory.eline.read.yaml - classpath:/mef-sonata/mapping-matrix/mapping.matrix.inventory.uni.list.yaml - classpath:/mef-sonata/mapping-matrix/mapping.matrix.inventory.eline.list.yaml - - classpath:/mef-sonata/template-upgrade/release.1.5.1.yaml + - classpath:/mef-sonata/template-upgrade/release.1.5.5.yaml templateUpgradePaths: diff --git a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.2.0.yaml b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.2.0.yaml deleted file mode 100644 index b64b7fbd..00000000 --- a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.2.0.yaml +++ /dev/null @@ -1,18 +0,0 @@ ---- -kind: kraken.product.template-upgrade -apiVersion: v1 -metadata: - key: kraken.product.template-upgrade.1.2.0 - name: V1.2 - labels: - release-version: V1.2 - release-date: 2024-08-30 - description: | - fix issues: - upgrade all user mapper and target file - new feature: - support template upgrade - audit logs - - version: 1 - diff --git a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.2.1.yaml b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.2.1.yaml deleted file mode 100644 index ba3e24eb..00000000 --- a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.2.1.yaml +++ /dev/null @@ -1,15 +0,0 @@ ---- -kind: kraken.product.template-upgrade -apiVersion: v1 -metadata: - key: kraken.product.template-upgrade.1.2.1 - name: V1.2.1 - labels: - release-version: V1.2.1 - release-date: 2024-09-03 - description: | - fix issues: - upgrade quote sync add target mapper file - new feature: - - version: 1 diff --git a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.2.2.yaml b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.2.2.yaml deleted file mode 100644 index 765ae928..00000000 --- a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.2.2.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- -kind: kraken.product.template-upgrade -apiVersion: v1 -metadata: - key: kraken.product.template-upgrade.1.2.2 - name: V1.2.2 - labels: - release-version: V1.2.2 - release-date: 2024-09-03 - description: | - fix issues: - added target location in mef.sonata.api-target-mapper.quote.eline.add.sync - for target item @{{quoteItem.quoteItemPrice.price.dutyFreeAmount.value}} - new feature: - - version: 1 diff --git a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.2.3.yaml b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.2.3.yaml deleted file mode 100644 index 65ffe60a..00000000 --- a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.2.3.yaml +++ /dev/null @@ -1,15 +0,0 @@ ---- -kind: kraken.product.template-upgrade -apiVersion: v1 -metadata: - key: kraken.product.template-upgrade.1.2.3 - name: V1.2.3 - labels: - release-version: V1.2.3 - release-date: 2024-09-04 - description: | - add field mapping: - add metroId for address validation and address retrieve - new feature: - - version: 1 diff --git a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.2.4.yaml b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.2.4.yaml deleted file mode 100644 index 83769217..00000000 --- a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.2.4.yaml +++ /dev/null @@ -1,15 +0,0 @@ ---- -kind: kraken.product.template-upgrade -apiVersion: v1 -metadata: - key: kraken.product.template-upgrade.1.2.4 - name: V1.2.4 - labels: - release-version: V1.2.4 - release-date: 2024-09-10 - description: | - change field: - change type to @type in address validation - new feature: - - version: 1 diff --git a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.2.5.yaml b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.2.5.yaml deleted file mode 100644 index 4fe703d2..00000000 --- a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.2.5.yaml +++ /dev/null @@ -1,15 +0,0 @@ ---- -kind: kraken.product.template-upgrade -apiVersion: v1 -metadata: - key: kraken.product.template-upgrade.1.2.5 - name: V1.2.5 - labels: - release-version: V1.2.5 - release-date: 2024-09-11 - description: | - Add matrix validation: - add validation in address validation - new feature: - - version: 1 diff --git a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.2.6.yaml b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.2.6.yaml deleted file mode 100644 index 22e17054..00000000 --- a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.2.6.yaml +++ /dev/null @@ -1,15 +0,0 @@ ---- -kind: kraken.product.template-upgrade -apiVersion: v1 -metadata: - key: kraken.product.template-upgrade.1.2.6 - name: V1.2.6 - labels: - release-version: V1.2.6 - release-date: 2024-09-11 - description: | - Add matrix validation: - add validation in address validation - new feature: - - version: 1 diff --git a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.3.0.yaml b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.3.0.yaml deleted file mode 100644 index 3cfc6efe..00000000 --- a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.3.0.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- -kind: kraken.product.template-upgrade -apiVersion: v1 -metadata: - key: kraken.product.template-upgrade.1.3.0 - name: V1.3 - labels: - release-version: V1.3 - release-date: 2024-09-11 - description: | - New feature: - Add functions related to demo environment - - - version: 1 - diff --git a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.5.1.yaml b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.5.1.yaml deleted file mode 100644 index c41e19d6..00000000 --- a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.5.1.yaml +++ /dev/null @@ -1,13 +0,0 @@ ---- -kind: kraken.product.template-upgrade -apiVersion: v1 -metadata: - key: kraken.product.template-upgrade.1.5.1 - name: V1.5.1 - labels: - productSpec: grace - productVersion: V1.5.1 - publishDate: 2024-10-23 - description: | - Add validation of productType and buyerId for inventory read - version: 2 \ No newline at end of file diff --git a/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.5.5.yaml b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.5.5.yaml new file mode 100644 index 00000000..b3e7ab14 --- /dev/null +++ b/kraken-java-sdk/kraken-java-sdk-mef/src/main/resources/mef-sonata/template-upgrade/release.1.5.5.yaml @@ -0,0 +1,13 @@ +--- +kind: kraken.product.template-upgrade +apiVersion: v1 +metadata: + key: kraken.product.template-upgrade.1.5.5 + name: V1.5.5 + labels: + productSpec: grace + productVersion: V1.5.5 + publishDate: 2024-11-07 + description: | + Appended value mapping item of productOrderItem[0].product.id in response for creating order. + version: 2 \ No newline at end of file