From 2fa4a6167ecbe425c25b6cc80d465796405fbc66 Mon Sep 17 00:00:00 2001 From: Pahansith Date: Wed, 10 Feb 2021 01:37:00 +0530 Subject: [PATCH] Fix test failures --- .../config/EventConfigurationProviderServiceImpl.java | 5 ++--- .../event/config/EventOperationTaskConfiguration.java | 9 --------- .../core/service/GroupManagementProviderServiceImpl.java | 5 +---- .../resources/carbon-home/repository/conf/cdm-config.xml | 3 +++ .../resources/carbon-home/repository/conf/cdm-config.xml | 3 +++ .../src/main/resources/conf/cdm-config.xml | 2 -- 6 files changed, 9 insertions(+), 18 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/event/config/EventConfigurationProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/event/config/EventConfigurationProviderServiceImpl.java index d9acfa2c37..75e0439074 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/event/config/EventConfigurationProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/event/config/EventConfigurationProviderServiceImpl.java @@ -46,13 +46,11 @@ import java.util.concurrent.Executors; public class EventConfigurationProviderServiceImpl implements EventConfigurationProviderService { private static final Log log = LogFactory.getLog(EventConfigurationProviderServiceImpl.class); private final EventConfigDAO eventConfigDAO; - private final ExecutorService executorService; public EventConfigurationProviderServiceImpl() { eventConfigDAO = DeviceManagementDAOFactory.getEventConfigDAO(); EventOperationTaskConfiguration eventConfig = DeviceConfigurationManager.getInstance() .getDeviceManagementConfig().getEventOperationTaskConfiguration(); - this.executorService = Executors.newFixedThreadPool(eventConfig.getPoolSize()); } @Override @@ -251,6 +249,7 @@ public class EventConfigurationProviderServiceImpl implements EventConfiguration List groupIds) { GeoFenceEventOperationManager geoFenceEventOperationManager = new GeoFenceEventOperationManager(eventType, tenantId, null); EventOperationExecutor executor = geoFenceEventOperationManager.getEventOperationExecutor(groupIds, eventMeta); - this.executorService.submit(executor); + ExecutorService executorService = Executors.newFixedThreadPool(50); + executorService.submit(executor); } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/event/config/EventOperationTaskConfiguration.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/event/config/EventOperationTaskConfiguration.java index ac6a350d94..a9fa405bf7 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/event/config/EventOperationTaskConfiguration.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/event/config/EventOperationTaskConfiguration.java @@ -32,13 +32,4 @@ public class EventOperationTaskConfiguration { public void setEnabled(boolean enabled) { this.isEnabled = enabled; } - - @XmlElement(name = "PoolSize", required = true) - public int getPoolSize() { - return poolSize; - } - - public void setPoolSize(int poolSize) { - this.poolSize = poolSize; - } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceImpl.java index 59a552c113..1e19cbb42b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceImpl.java @@ -66,7 +66,6 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid private final GroupDAO groupDAO; private final DeviceDAO deviceDAO; - private final ExecutorService executorService; /** * Set groupDAO from GroupManagementDAOFactory when class instantiate. @@ -74,9 +73,6 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid public GroupManagementProviderServiceImpl() { this.groupDAO = GroupManagementDAOFactory.getGroupDAO(); this.deviceDAO = DeviceManagementDAOFactory.getDeviceDAO(); - EventOperationTaskConfiguration eventConfig = DeviceConfigurationManager.getInstance() - .getDeviceManagementConfig().getEventOperationTaskConfiguration(); - this.executorService = Executors.newFixedThreadPool(eventConfig.getPoolSize()); } /** @@ -1072,6 +1068,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid GeoFenceEventOperationManager eventManager = new GeoFenceEventOperationManager(eventOperationCode, tenantId, null); GroupAssignmentEventOperationExecutor eventOperationExecutor = eventManager .getGroupAssignmentEventExecutor(groupId, deviceIdentifiers); + ExecutorService executorService = Executors.newFixedThreadPool(50); if (eventOperationExecutor != null) { executorService.submit(eventOperationExecutor); } else { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml index 723662a8cd..675a58e80d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml @@ -97,6 +97,9 @@ server environment--> 10000 + + true + false 86400 diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml index df2f061241..51780af1fb 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml @@ -121,6 +121,9 @@ false + + true + false false diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/cdm-config.xml b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/cdm-config.xml index 1a313a50ba..bbbd8511d4 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/cdm-config.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/cdm-config.xml @@ -96,8 +96,6 @@ true - - 50 true