@Override protected Double getRate(VmNetworkInterface object) { return object.getStatistics().getReceiveRate(); }
static VmNetworkInterface setUpStatisticalEntityExpectations( VmNetworkInterface entity, VmNetworkStatistics statistics) { when(entity.getStatistics()).thenReturn(statistics); when(statistics.getReceiveRate()).thenReturn(1D); when(statistics.getReceiveDropRate()).thenReturn(2D); when(statistics.getTransmitRate()).thenReturn(3D); when(statistics.getTransmitDropRate()).thenReturn(4D); when(statistics.getReceivedBytes()).thenReturn(5L); when(statistics.getTransmittedBytes()).thenReturn(6L); return entity; }
static VmNetworkInterface setUpStatisticalEntityExpectations( VmNetworkInterface entity, VmNetworkStatistics statistics) { when(entity.getStatistics()).thenReturn(statistics); when(statistics.getReceiveRate()).thenReturn(1D); when(statistics.getReceiveDropRate()).thenReturn(2D); when(statistics.getTransmitRate()).thenReturn(3D); when(statistics.getTransmitDropRate()).thenReturn(4D); when(statistics.getReceivedBytes()).thenReturn(5L); when(statistics.getTransmittedBytes()).thenReturn(6L); return entity; }
private VmNetworkInterface setUpStatisticalEntityExpectations(VmNetworkInterface entity, VmNetworkStatistics statistics) { when(entity.getStatistics()).thenReturn(statistics); when(statistics.getReceiveRate()).thenReturn(1D); when(statistics.getReceiveDropRate()).thenReturn(2D); when(statistics.getTransmitRate()).thenReturn(3D); when(statistics.getTransmitDropRate()).thenReturn(4D); when(statistics.getReceivedBytes()).thenReturn(5L); when(statistics.getTransmittedBytes()).thenReturn(6L); return entity; }
static VmNetworkInterface setUpStatisticalEntityExpectations( VmNetworkInterface entity, VmNetworkStatistics statistics) { when(entity.getStatistics()).thenReturn(statistics); when(statistics.getReceiveRate()).thenReturn(1D); when(statistics.getReceiveDropRate()).thenReturn(2D); when(statistics.getTransmitRate()).thenReturn(3D); when(statistics.getTransmitDropRate()).thenReturn(4D); when(statistics.getReceivedBytes()).thenReturn(5L); when(statistics.getTransmittedBytes()).thenReturn(6L); return entity; }
protected VmNetworkInterface setUpStatisticalExpectations() { VmNetworkStatistics stats = mock(VmNetworkStatistics.class); VmNetworkInterface entity = mock(VmNetworkInterface.class); when(entity.getStatistics()).thenReturn(stats); when(entity.getSpeed()).thenReturn(50); when(entity.getId()).thenReturn(NIC_ID); when(stats.getReceiveRate()).thenReturn(10D); when(stats.getTransmitRate()).thenReturn(20D); when(stats.getReceiveDropRate()).thenReturn(30D); when(stats.getTransmitDropRate()).thenReturn(40D); when(stats.getReceivedBytes()).thenReturn(50L); when(stats.getTransmittedBytes()).thenReturn(60L); List<VmNetworkInterface> ifaces = new ArrayList<>(); ifaces.add(entity); setUpEntityQueryExpectations( QueryType.GetVmInterfacesByVmId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { VM_ID }, ifaces ); return entity; }
private void createStatisticsItemColumn(VmNetworkInterface networkInterface, Row content) { Column column = createInfoColumn(constants.statistics(), true); RxTxRateRenderer rateRenderer = new RxTxRateRenderer(); RxTxTotalRenderer totalRenderer = new RxTxTotalRenderer(); DListElement dl = Document.get().createDLElement(); dl.addClassName(DL_HORIZONTAL); addDetailItem(templates.sub(constants.rxRate(), constants.mbps()), SafeHtmlUtils.fromString(rateRenderer.render(new Double[] { networkInterface.getStatistics().getReceiveRate(), networkInterface.hasSpeed() ? networkInterface.getSpeed().doubleValue() : 0})), dl); addDetailItem(templates.sub(constants.txRate(), constants.mbps()), SafeHtmlUtils.fromString(rateRenderer.render(new Double[] { networkInterface.getStatistics().getTransmitRate(), networkInterface.hasSpeed() ? networkInterface.getSpeed().doubleValue() : 0})), dl); addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.rxTotal()), SafeHtmlUtils.fromString(totalRenderer.render(networkInterface.getStatistics().getReceivedBytes())), dl); addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.txTotal()), SafeHtmlUtils.fromString(totalRenderer.render(networkInterface.getStatistics().getTransmittedBytes())), dl); addDetailItem(templates.sub(constants.dropsInterface(), constants.pkts()), SafeHtmlUtils.fromString(String.valueOf(networkInterface.getStatistics().getReceiveDropRate() + networkInterface.getStatistics().getTransmitDropRate())), dl); column.getElement().appendChild(dl); content.add(column); }
SafeHtmlUtils.fromString(nic.getMacAddress()), dl); addDetailItem(templates.sub(constants.rxRate(), constants.mbps()), SafeHtmlUtils.fromString(rateRenderer.render(new Double[] { nic.getStatistics().getReceiveRate(), nic.hasSpeed() ? nic.getSpeed().doubleValue() : 0})), dl); addDetailItem(templates.sub(constants.txRate(), constants.mbps()),