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);
}
Aggregations