FileExtension.DEVICE_REPOSITORY.getExtension());
// Construct a bunch of testable devices using the underlying
// accessor
// @todo later refactor so it doesn't use the internal device API
EclipseDeviceRepository accessor =
new EclipseDeviceRepository(deviceRepository.getPath(),
transformerMetaFactory, new DefaultJDOMFactory(), null);
int i = 0;
HashMap nameToProfile = new HashMap();
for (Iterator keys = deviceToProfile.keySet().iterator();
keys.hasNext();) {
// Extract the next deviceValue.
DeviceValue deviceValue = (DeviceValue)keys.next();
// Create a synthetic name for it.
i += 1;
String deviceName = "mytest-device-" + i;
// Add the expected profile value for this device value to the
// results map.
nameToProfile.put(deviceName, deviceToProfile.get(deviceValue));
accessor.addHierarchyDeviceElement(
deviceName, accessor.getRootDeviceName());
// Add the created device for this device value to the
// repository.
HashMap deviceProps = new HashMap();
deviceProps.put("pixeldepth", deviceValue.pixeldepth);
deviceProps.put("rendermode", deviceValue.rendermode);
deviceProps.put("modelnum", deviceValue.modelnum);
deviceProps.put("pixelsx", deviceValue.pixelsx);
deviceProps.put("pixelsy", deviceValue.pixelsy);
deviceProps.put("charactersx", deviceValue.charactersx);
deviceProps.put("charactersy", deviceValue.charactersy);
deviceProps.put("mfg", deviceValue.mfg);
deviceProps.put("UAProf.CcppAccept", deviceValue.uaprofCcppAccept);
deviceProps.put("brwsrname", deviceValue.brwsrname);
deviceProps.put("brwsrvers", deviceValue.brwsrvers);
deviceProps.put("UAProf.WmlVersion", deviceValue.uaprofWmlVersion);
org.jdom.Element deviceElement = createDeviceElement(deviceProps);
Map devices = new HashMap(1);
devices.put(deviceName, deviceElement);
accessor.writeDeviceElements(devices);
accessor.writeHierarchy();
}
accessor.saveRepositoryArchive();
// Connect to a single file XML repository.
HashMap repositoryProps = new HashMap();
repositoryProps.put(XMLRepository.DEVICE_REPOSITORY_PROPERTY,
deviceRepository.getPath());