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 d883359e..8a657720 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 @@ -178,18 +178,18 @@ spec: - rejected valueMapping: CREATING: acknowledged, - ACTIVATING: inProgress, - ACCEPTED: inProgress, - MANUAL: inProgress, - DELETING: inProgress, - DISABLING: inProgress, - DENIED: rejected, - ERROR: failed, - ACTIVE: completed, - DISABLED: disabled, - CANCELLED: disabled, - PENDING: pending, - PENDING_ACCEPTANCE: pending, + ACTIVATING: inProgress + ACCEPTED: inProgress + MANUAL: inProgress + DELETING: inProgress + DISABLING: inProgress + DENIED: rejected + ERROR: failed + ACTIVE: completed + DISABLED: disabled + CANCELLED: disabled + PENDING: pending + PENDING_ACCEPTANCE: pending DELETED: completed source: "@{{responseBody.status}}" sourceLocation: BODY 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 1015ba6b..fb3fbb0a 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 @@ -98,6 +98,10 @@ spec: - name: mapper.order.uni.add.bandwidth title: "Bandwidth of the UNI" source: "@{{productOrderItem[0].product.productConfiguration.bandwidth}}" + sourceType: customized_enum + sourceValues: + - 1000 + - 10000 target: "@{{speed}}" sourceLocation: BODY targetLocation: BODY @@ -143,21 +147,21 @@ spec: - partial - rejected valueMapping: - progressing: inProgress, - created: acknowledged, - CREATING: acknowledged, - ACTIVATING: inProgress, - ACCEPTED: inProgress, - MANUAL: inProgress, - DELETING: inProgress, - DISABLING: inProgress, - DENIED: rejected, - ERROR: failed, - ACTIVE: completed, - DISABLED: disabled, - CANCELLED: disabled, - PENDING: pending, - PENDING_ACCEPTANCE: pending, + progressing: inProgress + created: acknowledged + CREATING: acknowledged + ACTIVATING: inProgress + ACCEPTED: inProgress + MANUAL: inProgress + DELETING: inProgress + DISABLING: inProgress + DENIED: rejected + ERROR: failed + ACTIVE: completed + DISABLED: disabled + CANCELLED: disabled + PENDING: pending + PENDING_ACCEPTANCE: pending DELETED: completed source: "@{{responseBody.status}}" sourceLocation: BODY diff --git a/kraken-java-sdk/kraken-java-sdk-core/src/main/java/com/consoleconnect/kraken/operator/core/enums/MappingTypeEnum.java b/kraken-java-sdk/kraken-java-sdk-core/src/main/java/com/consoleconnect/kraken/operator/core/enums/MappingTypeEnum.java new file mode 100644 index 00000000..9432347a --- /dev/null +++ b/kraken-java-sdk/kraken-java-sdk-core/src/main/java/com/consoleconnect/kraken/operator/core/enums/MappingTypeEnum.java @@ -0,0 +1,12 @@ +package com.consoleconnect.kraken.operator.core.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum MappingTypeEnum { + ENUM("enum"), + CUSTOMIZED_ENUM("customized_enum"); + private final String kind; +} 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 26e6fdba..7c210a1d 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 @@ -7,6 +7,7 @@ import com.consoleconnect.kraken.operator.core.dto.UnifiedAssetDto; import com.consoleconnect.kraken.operator.core.enums.ActionTypeEnum; import com.consoleconnect.kraken.operator.core.enums.ExpectTypeEnum; +import com.consoleconnect.kraken.operator.core.enums.MappingTypeEnum; import com.consoleconnect.kraken.operator.core.enums.ParamLocationEnum; import com.consoleconnect.kraken.operator.core.exception.KrakenException; import com.consoleconnect.kraken.operator.core.model.AppProperty; @@ -41,7 +42,6 @@ public class MappingMatrixCheckerActionRunner extends AbstractActionRunner { public static final String MESSAGE_ALERT = "api use case is not supported %s"; public static final String CHECK_NAME_ENABLED = "enabled"; public static final String PARAM_NAME = "param"; - public static final String ENUM = "enum"; public static final String NOT_FOUND = "notFound"; public static final String COLON = ":"; private final UnifiedAssetService unifiedAssetService; @@ -217,7 +217,8 @@ public void checkRequestConstraints(String targetKey, Map inputs || ParamLocationEnum.HYBRID.name().equals(mapper.getTargetLocation())) { continue; } - if (Objects.equals(mapper.getSourceType(), ENUM)) { + if (MappingTypeEnum.ENUM.getKind().equals(mapper.getSourceType()) + || MappingTypeEnum.CUSTOMIZED_ENUM.getKind().equals(mapper.getSourceType())) { checkEnumValue(mapper.getSource(), mapper.getTarget(), inputs, mapper.getSourceValues()); } else if (mapper.getTarget() != null && !mapper.getTarget().contains("@{{")) { checkConstantValue(mapper.getSource(), mapper.getTarget(), inputs);