Search in sources :

Example 6 with ErrataCounts

use of org.ovirt.engine.core.common.businessentities.ErrataCounts in project ovirt-engine by oVirt.

the class GetErrataCountsForHostQueryTest method noAvailableHostErrata.

@Test
public void noAvailableHostErrata() {
    setupToReportErrata(Collections.emptyList());
    getQuery().executeQueryCommand();
    assertNotNull(getQuery().getQueryReturnValue().getReturnValue());
    ErrataCounts returnValue = getQuery().getQueryReturnValue().getReturnValue();
    for (ErrataType type : ErrataType.values()) {
        assertEquals(0, returnValue.getCountByType(type));
    }
}
Also used : ErrataCounts(org.ovirt.engine.core.common.businessentities.ErrataCounts) ErrataType(org.ovirt.engine.core.common.businessentities.Erratum.ErrataType) Test(org.junit.Test)

Example 7 with ErrataCounts

use of org.ovirt.engine.core.common.businessentities.ErrataCounts in project ovirt-engine by oVirt.

the class GetErrataCountsForHostQueryTest method setupToReportErrata.

@SuppressWarnings("unchecked")
private void setupToReportErrata(List<Erratum> errata) {
    when(host.getHostProviderId()).thenReturn(mock(Guid.class));
    when(vdsStaticDao.get(any())).thenReturn(host);
    when(providerDao.get(any())).thenReturn(mock(Provider.class));
    doReturn(providerProxy).when(getQuery()).getHostProviderProxy(any());
    ErrataData errataData = mock(ErrataData.class);
    ErrataCounts errataCounts = mock(ErrataCounts.class);
    when(errataData.getErrataCounts()).thenReturn(errataCounts);
    Stream.of(ErrataType.values()).forEach(type -> when(errataCounts.getCountByType(type)).thenReturn((int) errata.stream().filter(erratum -> erratum.getType() == type).count()));
    doReturn(errataData).when(providerProxy).getErrataForHost(any(), any());
}
Also used : ErrataData(org.ovirt.engine.core.common.businessentities.ErrataData) ErrataCounts(org.ovirt.engine.core.common.businessentities.ErrataCounts) Guid(org.ovirt.engine.core.compat.Guid) Provider(org.ovirt.engine.core.common.businessentities.Provider)

Aggregations

ErrataCounts (org.ovirt.engine.core.common.businessentities.ErrataCounts)7 EventBus (com.google.gwt.event.shared.EventBus)2 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)2 SafeHtmlUtils (com.google.gwt.safehtml.shared.SafeHtmlUtils)2 Inject (com.google.inject.Inject)2 TabData (com.gwtplatform.mvp.client.TabData)2 NameToken (com.gwtplatform.mvp.client.annotations.NameToken)2 ProxyCodeSplit (com.gwtplatform.mvp.client.annotations.ProxyCodeSplit)2 TabInfo (com.gwtplatform.mvp.client.annotations.TabInfo)2 PlaceManager (com.gwtplatform.mvp.client.proxy.PlaceManager)2 TabContentProxyPlace (com.gwtplatform.mvp.client.proxy.TabContentProxyPlace)2 Test (org.junit.Test)2 AbstractSubTabPresenter (org.ovirt.engine.ui.common.presenter.AbstractSubTabPresenter)2 DetailTabModelProvider (org.ovirt.engine.ui.common.uicommon.model.DetailTabModelProvider)2 AbstractUiCommandButton (org.ovirt.engine.ui.common.widget.AbstractUiCommandButton)2 WebAdminApplicationPlaces (org.ovirt.engine.ui.uicommonweb.place.WebAdminApplicationPlaces)2 PropertyChangedEventArgs (org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs)2 DetailTabDataIndex (org.ovirt.engine.ui.webadmin.section.main.presenter.tab.DetailTabDataIndex)2 ErrataData (org.ovirt.engine.core.common.businessentities.ErrataData)1 ErrataType (org.ovirt.engine.core.common.businessentities.Erratum.ErrataType)1