From 0e4a9acf9289055e2abb181537ad55a6ddfb25a4 Mon Sep 17 00:00:00 2001 From: BLasan Date: Mon, 23 Sep 2024 23:56:02 +0530 Subject: [PATCH] Fix: TemplateUtil Test error --- .../rest/api/publisher/v1/common/TemplateBuilderUtil.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/TemplateBuilderUtil.java b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/TemplateBuilderUtil.java index fc9bbe921d13..aea2255e87d1 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/TemplateBuilderUtil.java +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/TemplateBuilderUtil.java @@ -95,7 +95,6 @@ public class TemplateBuilderUtil { private static final String ENDPOINT_SANDBOX = "_SANDBOX_"; private static final Log log = LogFactory.getLog(TemplateBuilderUtil.class); - private static final ApiMgtDAO apiMgtDAO = ApiMgtDAO.getInstance(); public static APITemplateBuilderImpl getAPITemplateBuilder(API api, String tenantDomain, List clientCertificateDTOSProduction, @@ -524,6 +523,7 @@ public static GatewayAPIDTO retrieveGatewayAPIDto(API api, Environment environme if (endpointConf != null && APIConstants.ENDPOINT_TYPE_SEQUENCE.equals( endpointConf.get(API_ENDPOINT_CONFIG_PROTOCOL_TYPE).getAsString()) && StringUtils.equals( api.getType().toLowerCase(), APIConstants.API_TYPE_HTTP.toLowerCase())) { + ApiMgtDAO apiMgtDAO = ApiMgtDAO.getInstance(); // To modify the endpoint config string JSONParser parser = new JSONParser(); ObjectMapper objectMapper = new ObjectMapper(); @@ -1475,6 +1475,7 @@ private static GatewayContentDTO retrieveSequenceBackendForAPIProduct(API api, A String endpointType, String pathToAchieve) throws APIManagementException { GatewayContentDTO customBackendSequenceContentDto = new GatewayContentDTO(); String customSequence = null; + ApiMgtDAO apiMgtDAO = ApiMgtDAO.getInstance(); SequenceBackendData data = apiMgtDAO.getCustomBackendByAPIUUID(api.getUuid(), endpointType); if (data != null) { String seqExt = data.getName(); @@ -1512,6 +1513,7 @@ private static GatewayContentDTO retrieveSequenceBackendForAPIProduct(API api, A private static GatewayContentDTO retrieveCustomBackendSequence(API api, String endpointType, String pathToAchieve) throws APIManagementException { + ApiMgtDAO apiMgtDAO = ApiMgtDAO.getInstance(); GatewayContentDTO customBackendSequenceContentDto = new GatewayContentDTO(); String customSequence = null; SequenceBackendData data = apiMgtDAO.getCustomBackendByAPIUUID(api.getUuid(), endpointType);