@Test void loadedClassCountIsCalculated() { when(this.runtimeBean.getLoadedClassCount()).thenReturn(10).thenReturn(9).thenReturn(11).thenReturn(10); this.cut.gather(); this.cut.gather(); this.cut.gather(); this.cut.gather(); ClassLoadingInformationData collector = (ClassLoadingInformationData) this.cut.get(); assertThat(collector.getMinLoadedClassCount(), is(9)); assertThat(collector.getMaxLoadedClassCount(), is(11)); assertThat(collector.getTotalLoadedClassCount(), is(40)); }
@Test void totalCompilationTimeCalculated() { when(this.runtimeBean.getTotalCompilationTime()).thenReturn(10L).thenReturn(9L).thenReturn(11L).thenReturn(10L); this.cut.gather(); this.cut.gather(); this.cut.gather(); this.cut.gather(); CompilationInformationData collector = (CompilationInformationData) this.cut.get(); assertThat(collector.getMinTotalCompilationTime(), is(9L)); assertThat(collector.getMaxTotalCompilationTime(), is(11L)); assertThat(collector.getTotalTotalCompilationTime(), is(40L)); }
@Test void totalLoadedClassCountIsCalculated() { when(this.runtimeBean.getTotalLoadedClassCount()).thenReturn(10L).thenReturn(9L).thenReturn(11L).thenReturn(10L); this.cut.gather(); this.cut.gather(); this.cut.gather(); this.cut.gather(); ClassLoadingInformationData collector = (ClassLoadingInformationData) this.cut.get(); assertThat(collector.getMinTotalLoadedClassCount(), is(9L)); assertThat(collector.getMaxTotalLoadedClassCount(), is(11L)); assertThat(collector.getTotalTotalLoadedClassCount(), is(40L)); }
this.systemInformationData.setOsVersion(this.getOsBean().getVersion()); this.systemInformationData.setJitCompilerName(this.getRuntimeBean().getJitCompilerName()); this.systemInformationData.setClassPath(this.getRuntimeBean().getClassPath()); this.systemInformationData.setBootClassPath(this.getRuntimeBean().getBootClassPath()); this.systemInformationData.setLibraryPath(this.getRuntimeBean().getLibraryPath()); this.systemInformationData.setVmVendor(this.getRuntimeBean().getVmVendor()); this.systemInformationData.setVmVersion(this.getRuntimeBean().getVmVersion()); this.systemInformationData.setVmName(this.getRuntimeBean().getVmName()); this.systemInformationData.setVmSpecName(this.getRuntimeBean().getSpecName());
int loadedClassCount = this.getRuntimeBean().getLoadedClassCount(); long totalLoadedClassCount = this.getRuntimeBean().getTotalLoadedClassCount(); long unloadedClassCount = this.getRuntimeBean().getUnloadedClassCount();
@Test void unloadedClassCountIsCalculated() { when(this.runtimeBean.getUnloadedClassCount()).thenReturn(10L).thenReturn(9L).thenReturn(11L).thenReturn(10L); this.cut.gather(); this.cut.gather(); this.cut.gather(); this.cut.gather(); ClassLoadingInformationData collector = (ClassLoadingInformationData) this.cut.get(); assertThat(collector.getMinUnloadedClassCount(), is(9L)); assertThat(collector.getMaxUnloadedClassCount(), is(11L)); assertThat(collector.getTotalUnloadedClassCount(), is(40L)); }
/** * {@inheritDoc} */ @Override public void gather() { // The timestamp is set in the {@link RuntimeInformation#reset()} to avoid multiple renewal. // It will not be set on the first execution of {@link RuntimeInformation#gather()}, but // shortly before. long uptime = this.getRuntimeBean().getUptime(); this.runtimeInformationData.setUptime(uptime); }
when(this.osBean.getVersion()).thenReturn("7"); when(this.runtimeBean.getJitCompilerName()).thenReturn("8"); when(this.runtimeBean.getClassPath()).thenReturn("9"); when(this.runtimeBean.getBootClassPath()).thenReturn("10"); when(this.runtimeBean.getLibraryPath()).thenReturn("11"); when(this.runtimeBean.getVmVendor()).thenReturn("12"); when(this.runtimeBean.getVmVersion()).thenReturn("13"); when(this.runtimeBean.getVmName()).thenReturn("14"); when(this.runtimeBean.getSpecName()).thenReturn("15");
@Test void lastUptimeIsSet() { when(this.runtimeBean.getUptime()).thenReturn(10L).thenReturn(9L); this.cut.gather(); this.cut.gather(); RuntimeInformationData collector = (RuntimeInformationData) this.cut.get(); assertThat(collector.getUptime(), is(9L)); } }
when(this.osBean.getVersion()).thenReturn("7"); when(this.runtimeBean.getJitCompilerName()).thenReturn("8"); when(this.runtimeBean.getClassPath()).thenReturn("9"); when(this.runtimeBean.getBootClassPath()).thenReturn("10"); when(this.runtimeBean.getLibraryPath()).thenReturn("11"); when(this.runtimeBean.getVmVendor()).thenReturn("12"); when(this.runtimeBean.getVmVersion()).thenReturn("13"); when(this.runtimeBean.getVmName()).thenReturn("14"); when(this.runtimeBean.getSpecName()).thenReturn("15"); when(this.osBean.getVersion()).thenReturn("700"); when(this.runtimeBean.getJitCompilerName()).thenReturn("800"); when(this.runtimeBean.getClassPath()).thenReturn("900"); when(this.runtimeBean.getBootClassPath()).thenReturn("1000"); when(this.runtimeBean.getLibraryPath()).thenReturn("1100"); when(this.runtimeBean.getVmVendor()).thenReturn("1200"); when(this.runtimeBean.getVmVersion()).thenReturn("1300"); when(this.runtimeBean.getVmName()).thenReturn("1400"); when(this.runtimeBean.getSpecName()).thenReturn("1500");
/** * {@inheritDoc} */ @Override public void gather() { // The timestamp is set in the {@link CompilationInformation#reset()} to avoid multiple // renewal. It will not be set on the first execution of // {@link CompilationInformation#gather()}, but shortly before. long totalCompilationTime = this.getRuntimeBean().getTotalCompilationTime(); this.compilationInformationData.incrementCount(); this.compilationInformationData.addTotalCompilationTime(totalCompilationTime); if (totalCompilationTime < this.compilationInformationData.getMinTotalCompilationTime()) { this.compilationInformationData.setMinTotalCompilationTime(totalCompilationTime); } else if (totalCompilationTime > this.compilationInformationData.getMaxTotalCompilationTime()) { this.compilationInformationData.setMaxTotalCompilationTime(totalCompilationTime); } }