use of org.ovirt.engine.ui.uicompat.UIMessages in project ovirt-engine by oVirt.
the class ExecuteNetworkCommandInNetworkOperationTest method setUp.
@Before
public void setUp() throws Exception {
when(logicalNetworkModelOfNetworkA.getNetwork()).thenReturn(networkA);
when(logicalNetworkModelOfNetworkC.getNetwork()).thenReturn(networkC);
when(logicalNetworkModelOfNetworkA.getSetupModel()).thenReturn(setupModel);
when(logicalNetworkModelOfNetworkC.getSetupModel()).thenReturn(setupModel);
when(networkInterfaceModelOfNicA.getOriginalIface()).thenReturn(nicA);
when(networkInterfaceModelOfNicB.getOriginalIface()).thenReturn(nicB);
when(networkInterfaceModelOfNicC.getOriginalIface()).thenReturn(nicC);
when(networkInterfaceModelOfNicD.getOriginalIface()).thenReturn(nicD);
when(networkInterfaceModelOfNicA.getName()).thenReturn(nicA.getName());
when(networkInterfaceModelOfNicB.getName()).thenReturn(nicB.getName());
when(networkInterfaceModelOfNicC.getName()).thenReturn(nicC.getName());
when(networkInterfaceModelOfNicD.getName()).thenReturn(nicD.getName());
when(setupModel.getHostSetupNetworksParametersData()).thenReturn(dataFromHostSetupNetworksModel);
// mock manager/resolver so it's possible to delegate from one NetworkOperation to another.
ConstantsManager constantsManagerMock = mock(ConstantsManager.class);
UIMessages uiMessagesMock = mock(UIMessages.class);
when(constantsManagerMock.getMessages()).thenReturn(uiMessagesMock);
// $NON-NLS-1$
when(uiMessagesMock.detachNetwork(any())).thenReturn("doh");
ConstantsManager.setInstance(constantsManagerMock);
TypeResolver typeResolverMock = mock(TypeResolver.class);
TypeResolver.setInstance(typeResolverMock);
}
use of org.ovirt.engine.ui.uicompat.UIMessages in project ovirt-engine by oVirt.
the class SanStorageModelBase method getPartOfSdLunsMessages.
public ArrayList<String> getPartOfSdLunsMessages() {
ArrayList<String> partOfSdLunsMessages = new ArrayList<>();
UIMessages messages = ConstantsManager.getInstance().getMessages();
for (LunModel lunModel : getAddedLuns()) {
LUNs lun = lunModel.getEntity();
if (lun.getStorageDomainId() != null) {
String reason = messages.lunAlreadyPartOfStorageDomainWarning(lun.getStorageDomainName());
// $NON-NLS-1$ //$NON-NLS-2$
partOfSdLunsMessages.add(lunModel.getLunId() + " (" + reason + ")");
}
}
return partOfSdLunsMessages;
}
use of org.ovirt.engine.ui.uicompat.UIMessages in project ovirt-engine by oVirt.
the class SanStorageModelBase method getUsedLunsMessages.
public ArrayList<String> getUsedLunsMessages(List<LUNs> luns) {
ArrayList<String> usedLunsMessages = new ArrayList<>();
UIMessages messages = ConstantsManager.getInstance().getMessages();
for (LUNs lun : luns) {
if (lun.getStatus() == LunStatus.Used) {
String reason = null;
if (lun.getVolumeGroupId() != null && !lun.getVolumeGroupId().isEmpty()) {
reason = messages.lunUsedByVG(lun.getVolumeGroupId());
}
usedLunsMessages.add(reason == null ? lun.getLUNId() : messages.usedLunIdReason(lun.getLUNId(), reason));
}
}
return usedLunsMessages;
}
Aggregations