DeviceTypeManager implements DeviceManager { private PlatformConfiguration getDefaultConfiguration() throws DeviceManagementException { if (log.isDebugEnabled()) { log.debug("Loading default " + deviceType + " platform configuration from " + deviceType + "-default-platform-configuration.xml"); } try { String platformConfigurationPath = PATH_MOBILE_PLUGIN_CONF_DIR + File.separator + deviceType + "-default-platform-configuration.xml"; File platformConfig = new File(platformConfigurationPath); if (platformConfig.exists()) { Document doc = DeviceTypeUtils.convertToDocument(platformConfig); JAXBContext context = JAXBContext.newInstance(PlatformConfiguration.class); Unmarshaller unmarshaller = context.createUnmarshaller(); return (PlatformConfiguration) unmarshaller.unmarshal(doc); } else { log.warn(deviceType + "-default-platform-configuration.xml is not available, hence default " + deviceType + "platform configuration cannot be loaded."); } return null; } catch (JAXBException e) { throw new DeviceManagementException( "Error occurred while parsing the " + deviceType + " default platform configuration : " + e .getMessage(), e); } catch (DeviceTypeMgtPluginException e) { throw new DeviceManagementException( "Error occurred while parsing the " + deviceType + " default platform configuration : " + e .getMessage(), e); } } DeviceTypeManager(DeviceTypeConfigIdentifier deviceTypeConfigIdentifier,
                             DeviceTypeConfiguration deviceTypeConfiguration); @Override FeatureManager getFeatureManager(); @Override boolean saveConfiguration(PlatformConfiguration tenantConfiguration); @Override PlatformConfiguration getConfiguration(); @Override boolean enrollDevice(Device device); @Override boolean modifyEnrollment(Device device); @Override boolean disenrollDevice(DeviceIdentifier deviceId); @Override boolean isEnrolled(DeviceIdentifier deviceId); @Override boolean isActive(DeviceIdentifier deviceId); @Override boolean setActive(DeviceIdentifier deviceId, boolean status); @Override Device getDevice(DeviceIdentifier deviceId); @Override boolean updateDeviceProperties(DeviceIdentifier deviceId, List<Device.Property> propertyList); @Override boolean setOwnership(DeviceIdentifier deviceId, String ownershipType); @Override boolean isClaimable(DeviceIdentifier deviceIdentifier); @Override boolean setStatus(DeviceIdentifier deviceIdentifier, String currentUser,
                             EnrolmentInfo.Status status); @Override License getLicense(String languageCode); @Override void addLicense(License license); @Override boolean requireDeviceAuthorization(); @Override boolean updateDeviceInfo(DeviceIdentifier deviceIdentifier, Device device); @Override List<Device> getAllDevices();  }
@Test (description = "This test case tests the getDefaultConfiguration method") public void testGetDefaultConfiguration() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { Method getDefaultConfiguration = DeviceTypeManager.class.getDeclaredMethod("getDefaultConfiguration"); getDefaultConfiguration.setAccessible(true); Assert.assertNull(getDefaultConfiguration.invoke(androidDeviceTypeManager), "Default configuration file " + "retrieved even without adding the configuration for the device type android"); }