Search in sources :

Example 6 with UIMessages

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);
}
Also used : UIMessages(org.ovirt.engine.ui.uicompat.UIMessages) TypeResolver(org.ovirt.engine.ui.uicommonweb.TypeResolver) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) Before(org.junit.Before)

Example 7 with UIMessages

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;
}
Also used : UIMessages(org.ovirt.engine.ui.uicompat.UIMessages) ArrayList(java.util.ArrayList) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs)

Example 8 with UIMessages

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;
}
Also used : UIMessages(org.ovirt.engine.ui.uicompat.UIMessages) ArrayList(java.util.ArrayList) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs)

Aggregations

UIMessages (org.ovirt.engine.ui.uicompat.UIMessages)8 ArrayList (java.util.ArrayList)5 LUNs (org.ovirt.engine.core.common.businessentities.storage.LUNs)3 UIConstants (org.ovirt.engine.ui.uicompat.UIConstants)3 List (java.util.List)1 Before (org.junit.Before)1 OriginType (org.ovirt.engine.core.common.businessentities.OriginType)1 VDS (org.ovirt.engine.core.common.businessentities.VDS)1 VM (org.ovirt.engine.core.common.businessentities.VM)1 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)1 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)1 JsSingleValueStringObject (org.ovirt.engine.ui.frontend.utils.JsSingleValueStringObject)1 TypeResolver (org.ovirt.engine.ui.uicommonweb.TypeResolver)1 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)1 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)1 HostMaintenanceConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.HostMaintenanceConfirmationModel)1 BondNetworkInterfaceModel (org.ovirt.engine.ui.uicommonweb.models.hosts.network.BondNetworkInterfaceModel)1 LogicalNetworkModel (org.ovirt.engine.ui.uicommonweb.models.hosts.network.LogicalNetworkModel)1 NetworkInterfaceModel (org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkInterfaceModel)1 NetworkOperation (org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkOperation)1