use of org.ovirt.engine.core.common.businessentities.storage.DiskContentType in project ovirt-engine by oVirt.
the class DiskOperationsValidatorTest method testDisallowedOperations.
@Test
public void testDisallowedOperations() {
Disk disk = new DiskImage();
for (Map.Entry<ActionType, List<DiskContentType>> entry : DiskOperationsValidator.allowedCommandsOnTypes.entrySet()) {
EnumSet<DiskContentType> allowedTypes = EnumSet.copyOf(entry.getValue());
EnumSet<DiskContentType> disallowedTypes = EnumSet.complementOf(allowedTypes);
if (disallowedTypes.isEmpty()) {
continue;
}
disk.setContentType(disallowedTypes.iterator().next());
DiskOperationsValidator validator = new DiskOperationsValidator(disk);
assertThat(validator.isOperationAllowedOnDisk(entry.getKey()), failsWith(EngineMessage.ACTION_TYPE_FAILED_DISK_CONTENT_TYPE_NOT_SUPPORTED_FOR_OPERATION, String.format("$diskContentType %s", disk.getContentType())));
}
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskContentType in project ovirt-engine by oVirt.
the class DisksContentTypeRadioGroup method getRadioGroupPanel.
private Widget getRadioGroupPanel() {
buttonToType = new LinkedHashMap<>();
// $NON-NLS-1$
RadioButton allButton = new RadioButton(BUTTON_GROUP_NAME);
buttonToType.put(allButton, null);
allButton.setText(constants.allDisksLabel());
for (DiskContentType contentType : DiskContentType.values()) {
// $NON-NLS-1$
RadioButton button = new RadioButton(BUTTON_GROUP_NAME);
buttonToType.put(button, contentType);
}
ButtonGroup buttonGroup = new ButtonGroup();
buttonGroup.setDataToggle(Toggle.BUTTONS);
buttonToType.entrySet().forEach(e -> {
buttonGroup.add(e.getKey());
e.getKey().addClickHandler(event -> fireChangeHandlers(e.getValue()));
});
setDiskContentType(null);
localize();
// $NON-NLS-1$
buttonGroup.addStyleName("disk-type-buttons-group");
return buttonGroup;
}
Aggregations