Merge branch 'appm_improvement' into appmnewsyncbranch

pull/427/head
Kavin Prathaban 5 months ago
commit fb3ee6d6f3

@ -1851,7 +1851,8 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
Map<String, Double> statusPercentages = new HashMap<>();
for (Map.Entry<String, Integer> 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<String, Double> statusPercentages = new HashMap<>();
for (Map.Entry<String, Integer> 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<String, Double> statusPercentages = new HashMap<>();
for (Map.Entry<String, Integer> 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<String, Double> statusPercentages = new HashMap<>();
for (Map.Entry<String, Integer> 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<String, Double> statusPercentages = new HashMap<>();
for (Map.Entry<String, Integer> 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 =

@ -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);

@ -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 {

Loading…
Cancel
Save