DeviceRepositoryFactory factory =
DeviceRepositoryFactory.getDefaultInstance();
URL deviceRepositoryUrl = file.toURL();
{
DeviceRepository repository = factory.getDeviceRepository(
deviceRepositoryUrl, null);
List list = repository.getDevicePolicyNamesByCategory(null);
assertNull("No policy names should not be found", list);
list = repository.getDevicePolicyNamesByCategory("Not Found");
assertNotNull("Valid list should be found", list);
assertEquals("Expected no elements", 0, list.size());
list = repository.getDevicePolicyNamesByCategory("system");
assertNotNull("Valid list should be found", list);
assertEquals("Expected 25 policy names", 25, list.size());
}
// Re-test with access to experimental policies
{
DeviceRepository repository =
getDeviceRepository(deviceRepositoryUrl, true);
List list = repository.getDevicePolicyNamesByCategory("system");
assertNotNull("Valid list should be found", list);
assertEquals("Expected 26 policy names", 26, list.size());
}
}
});