2021-05-07 10:39:55 +00:00
|
|
|
import org.sysmon.plugins.sysmon_aix.AixProcessorExtension
|
|
|
|
import org.sysmon.plugins.sysmon_aix.AixProcessorStat
|
|
|
|
import spock.lang.Specification
|
|
|
|
|
|
|
|
class AixProcessorTest extends Specification {
|
|
|
|
|
2021-05-10 14:56:56 +00:00
|
|
|
void "test lparstat output processing"() {
|
2021-05-07 10:39:55 +00:00
|
|
|
|
|
|
|
setup:
|
2021-05-10 14:56:56 +00:00
|
|
|
def testFile = new File(getClass().getResource('/lparstat.txt').toURI())
|
2021-05-07 10:39:55 +00:00
|
|
|
List<String> lines = testFile.readLines("UTF-8")
|
|
|
|
|
|
|
|
when:
|
|
|
|
AixProcessorExtension extension = new AixProcessorExtension()
|
2021-05-10 14:56:56 +00:00
|
|
|
AixProcessorStat stats = extension.processCommandOutput(lines)
|
2021-05-07 10:39:55 +00:00
|
|
|
|
|
|
|
then:
|
2021-05-10 14:56:56 +00:00
|
|
|
stats.getUser() == 83.7f
|
|
|
|
stats.getSys() == 3.3f
|
|
|
|
stats.getWait() == 0.0f
|
|
|
|
stats.getIdle() == 13.0f
|
|
|
|
stats.getFields().get("ent") == 0.50f
|
2021-05-07 10:39:55 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-05-10 14:56:56 +00:00
|
|
|
|
2021-05-07 10:39:55 +00:00
|
|
|
}
|