MonitoringManagerImpl implements MonitoringManager { @Override public NonComplianceData getDevicePolicyCompliance(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException { NonComplianceData complianceData; try { PolicyManagementDAOFactory.openConnection(); DeviceManagementProviderService service = PolicyManagementDataHolder.getInstance().getDeviceManagementService(); Device device = service.getDevice(deviceIdentifier, false); complianceData = monitoringDAO.getCompliance(device.getId(), device.getEnrolmentInfo().getId()); List<ComplianceFeature> complianceFeatures = monitoringDAO.getNoneComplianceFeatures(complianceData.getId()); complianceData.setComplianceFeatures(complianceFeatures); } catch (DeviceManagementException e) { throw new PolicyComplianceException("Unable to retrieve device data for " + deviceIdentifier.getId() + " - " + deviceIdentifier.getType(), e); } catch (MonitoringDAOException e) { throw new PolicyComplianceException("Unable to retrieve compliance data for " + deviceIdentifier.getId() + " - " + deviceIdentifier.getType(), e); } catch (SQLException e) { throw new PolicyComplianceException("Error occurred while opening a connection to the data source", e); } finally { PolicyManagementDAOFactory.closeConnection(); } return complianceData; } MonitoringManagerImpl(); @Override List<ComplianceFeature> checkPolicyCompliance(
            DeviceIdentifier deviceIdentifier,
            Object deviceResponse); @Override boolean isCompliant(DeviceIdentifier deviceIdentifier); @Override NonComplianceData getDevicePolicyCompliance(DeviceIdentifier deviceIdentifier); @Override void addMonitoringOperation(List<Device> devices); @Override List<String> getDeviceTypes();  }
@Test(description = "This test case tests is compliant", dependsOnMethods = "testIsCompliant2") public void testGetDevicePolicyCompliance() throws Exception { DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); deviceIdentifier.setType(DEVICE_TYPE_E); deviceIdentifier.setId(String.valueOf(device5.getDeviceIdentifier())); monitoringManager.getDevicePolicyCompliance(deviceIdentifier); }