Skip to content

Commit

Permalink
Merge branch 'main' into zywang/feature/report-kraken-version-upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
kuangxiang20240501 authored Nov 14, 2024
2 parents f72c64d + 817a25a commit 77f166e
Show file tree
Hide file tree
Showing 13 changed files with 67 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
"@type": "FieldedAddress",
"country": "${responseBody[*].company.addresses[0].country}",
"city": "${responseBody[*].company.addresses[0].city}",
"streetName": "${responseBody[*].company.addresses[0].address}",
"locality": "${responseBody[*].dataCenterFacility.metroId}"
"streetName": "${responseBody[*].company.addresses[0].street}",
"locality": "${responseBody[*].dataCenterFacility.metroId}",
"tags": "${responseBody[*].tags}"
}
],
"provideAlternative": "${mefRequestBody.provideAlternative}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ spec:
- name: mapper.address.validation.streetName
title: "The street of the identified alternate Geographic Address"
description: address validation streetName mapping
source: "@{{[*].company.addresses[0].address}}"
source: "@{{[*].company.addresses[0].street}}"
sourceLocation: BODY
target: "@{{alternateGeographicAddress[*].streetName}}"
targetType: string
Expand Down Expand Up @@ -138,4 +138,14 @@ spec:
target: "@{{bestMatchGeographicAddress.streetName}}"
targetType: string
targetLocation: BODY
replaceStar: false
- name: mapper.address.validation.tags
title: "tags of the identified alternate Geographic Address"
description: ""
source: "@{{[*].tags}}"
sourceLocation: BODY
target: "@{{alternateGeographicAddress[*].tags}}"
targetType: string
targetLocation: BODY
requiredMapping: false
replaceStar: false
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ spec:
title: "Possible values for the status of a MEF product"
source: "@{{responseBody.status}}"
sourceLocation: BODY
target: "@{{status}}"
target: "@{{[*].status}}"
targetType: enum
targetLocation: BODY
requiredMapping: true
Expand All @@ -75,8 +75,8 @@ spec:
- suspendedPendingTerminate
- terminated
valueMapping:
ACTIVE: active,
CANCELLED: canceled,
ACTIVE: active
CANCELLED: canceled
PENDING: pendingActive
DELETING: pendingTerminate
DISABLED: suspended
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ spec:
title: "Possible values for the status of a MEF product"
source: "@{{responseBody.port.status}}"
sourceLocation: BODY
target: "@{{status}}"
target: "@{{[*].status}}"
targetType: enum
targetLocation: BODY
requiredMapping: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ spec:
title: >-
the id of the place where the products' installation must be done.
source: '@{{productOrderItem[0].product.place[0].id}}'
target: '@{{dataCenterFacilityId}}'
description: ''
sourceLocation: BODY
targetLocation: BODY
requiredMapping: false
- name: mapper.order.uni.add.place.name
title: the keyName of the place where the products' installation must be done.
source: '@{{productOrderItem[0].product.place[0].keyName}}'
target: '@{{dataCenterFacility}}'
description: ''
sourceLocation: BODY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ spec:
console.log("input: " + jsonStr);
let input = JSON.parse(jsonStr);
let errorMsg = '';
let errorArr = [''];
let targetAPIConfigKey = '';
let matrixConfigKey = '';
let forwardDownstream = true;
Expand Down Expand Up @@ -73,9 +74,9 @@ spec:
if (!syncQuote) {
errorArr.push('disabled : instantSyncQuote==false');
}
errorMsg = errorArr.join(' ');
targetAPIConfigKey = 'targetKey:notFound';
}
errorMsg = errorArr.join(' ');
let ret = {
quoteType: input.quoteItem['product']['productConfiguration']['@type'],
instantSyncQuote: input.instantSyncQuote,
Expand Down Expand Up @@ -183,6 +184,7 @@ spec:
console.log("input: " + jsonStr);
let input = JSON.parse(jsonStr);
let errorMsg = '';
let errorArr = [''];
let targetAPIConfigKey = '';
let forwardDownstream = true;
let typeArr = ['UNI', 'ACCESS_E_LINE'];
Expand Down Expand Up @@ -212,8 +214,8 @@ spec:
if (!syncQuote) {
errorArr.push('disabled : instantSyncQuote==false');
}
errorMsg = errorArr.join(' ');
}
errorMsg = errorArr.join(' ');
let ret = {
quoteType: input.bizType,
instantSyncQuote: input.instantSyncQuote,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;

public class ConstructExpressionUtil {

public static final String ARRAY_ROOT_PREFIX = "[*].";

private ConstructExpressionUtil() {}

public static List<String> extractMapperParam(String param) {
Expand All @@ -26,9 +29,12 @@ public static List<String> extractParam(String param, String patternStr) {

public static String convertToJsonPointer(String path) {
List<String> params = extractMapperParam(path);
String param = params.get(0);
if (StringUtils.isNotBlank(param) && param.startsWith(ARRAY_ROOT_PREFIX)) {
param = param.substring(ARRAY_ROOT_PREFIX.length(), param.length());
}
return "/"
+ params
.get(0)
+ param
.replaceAll("\\[(\\*)\\]", "[0]")
.replaceAll("(?)\\[", "\\/")
.replaceAll("(?)\\].", "\\/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.consoleconnect.kraken.operator.core.enums.ExpectTypeEnum;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

@Slf4j
Expand Down Expand Up @@ -37,4 +38,12 @@ void givenExpression_whenConvert_thenResponseOK() {
log.info(
"expected: {}, expectedExist: {}, expectedTrue: {}", expected, expectedExist, expectedTrue);
}

@Test
void givenStatusInArray_whenConvert_thenOK() {
String target = "@{{[*].status}}";
String result = ConstructExpressionUtil.convertToJsonPointer(target);
String expected = "/status";
Assertions.assertEquals(expected, result);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ spec:
title: "Possible values for the status of a MEF product"
source: ""
sourceLocation: ""
target: "@{{status}}"
target: "@{{[*].status}}"
targetType: enum
targetLocation: BODY
requiredMapping: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ spec:
title: "Possible values for the status of a MEF product"
source: ""
sourceLocation: ""
target: "@{{status}}"
target: "@{{[*].status}}"
targetType: enum
targetLocation: BODY
requiredMapping: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ spec:
console.log("input: " + jsonStr);
let input = JSON.parse(jsonStr);
let errorMsg = '';
let errorArr = [''];
let targetAPIConfigKey = '';
let matrixConfigKey = '';
let forwardDownstream = true;
Expand Down Expand Up @@ -73,9 +74,9 @@ spec:
if (!syncQuote) {
errorArr.push('disabled : instantSyncQuote==false');
}
errorMsg = errorArr.join(' ');
targetAPIConfigKey = 'targetKey:notFound';
}
errorMsg = errorArr.join(' ');
let ret = {
quoteType: input.quoteItem['product']['productConfiguration']['@type'],
instantSyncQuote: input.instantSyncQuote,
Expand Down Expand Up @@ -183,6 +184,7 @@ spec:
console.log("input: " + jsonStr);
let input = JSON.parse(jsonStr);
let errorMsg = '';
let errorArr = [''];
let targetAPIConfigKey = '';
let forwardDownstream = true;
let typeArr = ['UNI', 'ACCESS_E_LINE'];
Expand Down Expand Up @@ -212,8 +214,8 @@ spec:
if (!syncQuote) {
errorArr.push('disabled : instantSyncQuote==false');
}
errorMsg = errorArr.join(' ');
}
errorMsg = errorArr.join(' ');
let ret = {
quoteType: input.bizType,
instantSyncQuote: input.instantSyncQuote,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ spec:
- classpath:/mef-sonata/template-upgrade/release.1.5.9.yaml
- classpath:/mef-sonata/template-upgrade/release.1.5.10.yaml
- classpath:/mef-sonata/template-upgrade/release.1.5.11.yaml
- classpath:/mef-sonata/template-upgrade/release.1.5.12.yaml


templateUpgradePaths:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
kind: kraken.product.template-upgrade
apiVersion: v1
metadata:
key: kraken.product.template-upgrade.1.5.12
name: V1.5.12
labels:
productSpec: grace
productVersion: V1.5.12
publishDate: 2024-11-14 10:11
description: |
Make some improvements to the status mapping in the array for inventory list
version: 2

0 comments on commit 77f166e

Please sign in to comment.