/** * Tests if the xy-plot received the correct values. */ @Test public void xyPlotEntriesShouldBeCorrect() { StageTester.test(this.cpuUtilFilter).and().send(this.record).to(this.cpuUtilFilter.getInputPort()).start(); final Date date = new Date(TimeUnit.MILLISECONDS.convert(this.record.getLoggingTimestamp(), RECORDS_TIME_UNIT)); final String minutesAndSeconds = date.toString().substring(14, 19); final double actualUser = this.cpuUtilFilter.getXYPlot().getEntries(this.id + " - " + CPUUtilizationDisplayFilter.USER).get(minutesAndSeconds).doubleValue(); final double actualSystem = this.cpuUtilFilter.getXYPlot().getEntries(this.id + " - " + CPUUtilizationDisplayFilter.SYSTEM).get(minutesAndSeconds) .doubleValue(); final double actualNice = this.cpuUtilFilter.getXYPlot().getEntries(this.id + " - " + CPUUtilizationDisplayFilter.NICE).get(minutesAndSeconds).doubleValue(); final double actualIrq = this.cpuUtilFilter.getXYPlot().getEntries(this.id + " - " + CPUUtilizationDisplayFilter.IRQ).get(minutesAndSeconds).doubleValue(); final double actualTotalUtilization = this.cpuUtilFilter.getXYPlot().getEntries(this.id + " - " + CPUUtilizationDisplayFilter.TOTAL_UTILIZATION) .get(minutesAndSeconds).doubleValue(); final double actualIdle = this.cpuUtilFilter.getXYPlot().getEntries(this.id + " - " + CPUUtilizationDisplayFilter.IDLE).get(minutesAndSeconds).doubleValue(); Assert.assertThat(actualUser / 100, Is.is(USER)); Assert.assertThat(actualSystem / 100, Is.is(SYSTEM)); Assert.assertThat(actualNice / 100, Is.is(NICE)); Assert.assertThat(actualIrq / 100, Is.is(IRQ)); Assert.assertThat(actualTotalUtilization / 100, Is.is(TOTAL_UTILISATION)); Assert.assertThat(actualIdle / 100, Is.is(IDLE)); } }
/** * Tests if the xy-plot received the correct values. */ @Test public void xyPlotEntriesShouldBeCorrect() { StageTester.test(this.memSwapUtilFilter).and().send(this.record).to(this.memSwapUtilFilter.getInputPort()).start(); final Date date = new Date(TimeUnit.MILLISECONDS.convert(this.record.getLoggingTimestamp(), RECORDS_TIME_UNIT)); final String minutesAndSeconds = date.toString().substring(14, 19); final long actualMemTotal = this.memSwapUtilFilter.getXYPlot().getEntries(this.id + " - " + MemSwapUtilizationDisplayFilter.MEM_TOTAL).get(minutesAndSeconds) .longValue(); final long actualMemUsed = this.memSwapUtilFilter.getXYPlot().getEntries(this.id + " - " + MemSwapUtilizationDisplayFilter.MEM_USED).get(minutesAndSeconds) .longValue(); final long actualMemFree = this.memSwapUtilFilter.getXYPlot().getEntries(this.id + " - " + MemSwapUtilizationDisplayFilter.MEM_FREE).get(minutesAndSeconds) .longValue(); final long actualSwapTotal = this.memSwapUtilFilter.getXYPlot().getEntries(this.id + " - " + MemSwapUtilizationDisplayFilter.SWAP_TOTAL) .get(minutesAndSeconds).longValue(); final long actualSwapUsed = this.memSwapUtilFilter.getXYPlot().getEntries(this.id + " - " + MemSwapUtilizationDisplayFilter.SWAP_USED).get(minutesAndSeconds) .longValue(); final long actualSwapFree = this.memSwapUtilFilter.getXYPlot().getEntries(this.id + " - " + MemSwapUtilizationDisplayFilter.SWAP_FREE).get(minutesAndSeconds) .longValue(); // Converting back form MB to Byte Assert.assertThat(actualMemTotal * 1048576, Is.is(MEM_TOTAL)); Assert.assertThat(actualMemUsed * 1048576, Is.is(MEM_USED)); Assert.assertThat(actualMemFree * 1048576, Is.is(MEM_FREE)); Assert.assertThat(actualSwapTotal * 1048576, Is.is(SWAP_TOTAL)); Assert.assertThat(actualSwapUsed * 1048576, Is.is(SWAP_USED)); Assert.assertThat(actualSwapFree * 1048576, Is.is(SWAR_FREE)); }
/** * Tests if the xy-plot received the correct values. */ @Test public void xyPlotEntriesShouldBeCorrect() { StageTester.test(this.threadsStatusFilter).and().send(this.record).to(this.threadsStatusFilter.getInputPort()).start(); final Date date = new Date(TimeUnit.MILLISECONDS.convert(this.record.getLoggingTimestamp(), RECORDS_TIME_UNIT)); final String minutesAndSeconds = date.toString().substring(14, 19); final String id = this.record.getHostname() + " - " + this.record.getVmName(); final long actualThreadCount = this.threadsStatusFilter.getXYPlot().getEntries(id + " - " + ThreadsStatusDisplayFilter.THREADS).get(minutesAndSeconds) .longValue(); final long actualTotalStartedThreadCount = this.threadsStatusFilter.getXYPlot().getEntries(id + " - " + ThreadsStatusDisplayFilter.TOTAL_THREADS) .get(minutesAndSeconds).longValue(); final long actualPeakThreadCount = this.threadsStatusFilter.getXYPlot().getEntries(id + " - " + ThreadsStatusDisplayFilter.PEAK_THREADS) .get(minutesAndSeconds).longValue(); final long actualDaemonThreadCount = this.threadsStatusFilter.getXYPlot().getEntries(id + " - " + ThreadsStatusDisplayFilter.DAEMON_THREADS) .get(minutesAndSeconds).longValue(); Assert.assertThat(actualThreadCount, Is.is(THREAD_COUNT)); Assert.assertThat(actualTotalStartedThreadCount, Is.is(TOTAL_STARTED_THREAD_COUNT)); Assert.assertThat(actualPeakThreadCount, Is.is(PEAK_THREAD_COUNT)); Assert.assertThat(actualDaemonThreadCount, Is.is(DAEMON_THREAD_COUNT)); }
/** * Tests if the xy-plot received the correct values. */ @Test public void xyPlotEntriesShouldBeCorrect() { StageTester.test(this.gcDisplayFilter).and().send(this.record).to(this.gcDisplayFilter.getInputPort()).start(); final Date date = new Date(TimeUnit.MILLISECONDS.convert(this.record.getLoggingTimestamp(), RECORDS_TIME_UNIT)); final String minutesAndSeconds = date.toString().substring(14, 19); final String id = this.record.getHostname() + " - " + this.record.getVmName() + " - " + this.record.getGcName(); final long actualCollectionCount = this.gcDisplayFilter.getXYPlot().getEntries(id + " - " + GCDisplayFilter.COLLECTION_COUNT).get(minutesAndSeconds) .longValue(); final long actualCollectionTime = this.gcDisplayFilter.getXYPlot().getEntries(id + " - " + GCDisplayFilter.COLLECTION_TIME).get(minutesAndSeconds) .longValue(); Assert.assertThat(actualCollectionCount, Is.is(COLLECTION_COUNT)); Assert.assertThat(actualCollectionTime, Is.is(COLLECTION_TIME_MS)); }