Search in sources :

Example 1 with ConstantsManager

use of org.ovirt.engine.ui.uicompat.ConstantsManager 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)

Aggregations

Before (org.junit.Before)1 TypeResolver (org.ovirt.engine.ui.uicommonweb.TypeResolver)1 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)1 UIMessages (org.ovirt.engine.ui.uicompat.UIMessages)1