TemporaryFileManager tempFileMgr = new TemporaryFileManager(
new TestDeviceRepositoryCreator());
tempFileMgr.executeWith(new TemporaryFileExecutor() {
public void execute(File repository) throws Exception {
DeviceRepositoryAccessorManager manager =
new DeviceRepositoryAccessorManager(
repository.getPath(),
new TestTransformerMetaFactory(),
new DefaultJDOMFactory(), false);
// Beep for PC should be resolved from Master and should be false.
ResolvedDevicePolicy policy = manager.resolvePolicy("PC", "beep");
String policyValue = policy.policy.getAttributeValue("value");
assertEquals("Expected PC beep policy to be false.",
"false", policyValue);
assertEquals("Expected origin of PC beep policy to be Master.",
"Master", policy.deviceName);
// Bookmarks for PC should be resolved from PC and should be true
policy = manager.resolvePolicy("PC", "bookmarks");
policyValue = policy.policy.getAttributeValue("value");
assertEquals("Expected PC bookmarks policy to be true.",
"true", policyValue);
assertEquals("Expected origin of PC bookmarks policy to be PC.",
"PC", policy.deviceName);