diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java index 81c3f2d680..a55ea7126f 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java @@ -1851,7 +1851,8 @@ public class SubscriptionManagerImpl implements SubscriptionManager { Map statusPercentages = new HashMap<>(); for (Map.Entry entry : statusCounts.entrySet()) { double percentage = ((double) entry.getValue() / totalDevices) * 100; - statusPercentages.put(entry.getKey(), percentage); + String formattedPercentage = String.format("%.2f", percentage); + statusPercentages.put(entry.getKey(), Double.valueOf(formattedPercentage)); } CategorizedSubscriptionResult categorizedSubscriptionResult; @@ -2033,7 +2034,8 @@ public class SubscriptionManagerImpl implements SubscriptionManager { Map statusPercentages = new HashMap<>(); for (Map.Entry entry : statusCounts.entrySet()) { double percentage = ((double) entry.getValue() / totalDevices) * 100; - statusPercentages.put(entry.getKey(), percentage); + String formattedPercentage = String.format("%.2f", percentage); + statusPercentages.put(entry.getKey(), Double.valueOf(formattedPercentage)); } CategorizedSubscriptionResult categorizedSubscriptionResult; @@ -2225,7 +2227,8 @@ public class SubscriptionManagerImpl implements SubscriptionManager { Map statusPercentages = new HashMap<>(); for (Map.Entry entry : statusCounts.entrySet()) { double percentage = totalDevices == 0 ? 0.0 : ((double) entry.getValue() / totalDevices) * 100; - statusPercentages.put(entry.getKey(), percentage); + String formattedPercentage = String.format("%.2f", percentage); + statusPercentages.put(entry.getKey(), Double.valueOf(formattedPercentage)); } CategorizedSubscriptionResult categorizedSubscriptionResult; @@ -2417,7 +2420,8 @@ public class SubscriptionManagerImpl implements SubscriptionManager { Map statusPercentages = new HashMap<>(); for (Map.Entry entry : statusCounts.entrySet()) { double percentage = ((double) entry.getValue() / totalDevices) * 100; - statusPercentages.put(entry.getKey(), percentage); + String formattedPercentage = String.format("%.2f", percentage); + statusPercentages.put(entry.getKey(), Double.valueOf(formattedPercentage)); } CategorizedSubscriptionResult categorizedSubscriptionResult; @@ -2552,7 +2556,8 @@ public class SubscriptionManagerImpl implements SubscriptionManager { Map statusPercentages = new HashMap<>(); for (Map.Entry entry : statusCounts.entrySet()) { double percentage = ((double) entry.getValue() / totalDevices) * 100; - statusPercentages.put(entry.getKey(), percentage); + String formattedPercentage = String.format("%.2f", percentage); + statusPercentages.put(entry.getKey(), Double.valueOf(formattedPercentage)); } CategorizedSubscriptionResult categorizedSubscriptionResult = diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/BaseTestCase.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/BaseTestCase.java index 9243cb8930..7251a0d19e 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/BaseTestCase.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/BaseTestCase.java @@ -37,6 +37,7 @@ import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManag import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.MetadataManagementDAOFactory; +import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory; import org.wso2.carbon.registry.core.config.RegistryContext; import org.wso2.carbon.registry.core.exceptions.RegistryException; import org.wso2.carbon.registry.core.internal.RegistryDataHolder; @@ -96,6 +97,7 @@ public abstract class BaseTestCase { ConnectionManagerUtil.init(dataSource); DeviceManagementDAOFactory.init(dataSource); MetadataManagementDAOFactory.init(dataSource); + OperationManagementDAOFactory.init(dataSource); // PolicyManagementDAOFactory.init(dataSource); // OperationManagementDAOFactory.init(dataSource); // GroupManagementDAOFactory.init(dataSource); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/BaseExtensionsTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/BaseExtensionsTest.java index aff8d17eda..992969aa92 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/BaseExtensionsTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/BaseExtensionsTest.java @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template; +import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory; import org.apache.tomcat.jdbc.pool.PoolProperties; import org.mockito.Mockito; import org.testng.annotations.BeforeSuite; @@ -131,6 +132,7 @@ public class BaseExtensionsTest { readDataSourceConfig(datasourceLocation + DATASOURCE_EXT)); DeviceManagementDAOFactory.init(dataSource); MetadataManagementDAOFactory.init(dataSource); + OperationManagementDAOFactory.init(dataSource); } protected DataSourceConfig readDataSourceConfig(String configLocation) throws DeviceManagementException {