com.googlecode.jmxtrans.model.ResultFixtures Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jmxtrans-core Show documentation
Show all versions of jmxtrans-core Show documentation
This module contains most of the core logic of JmxTrans.
/**
* The MIT License
* Copyright © 2010 JmxTrans team
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.googlecode.jmxtrans.model;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
public final class ResultFixtures {
private ResultFixtures() {}
public static Result booleanTrueResult() {
return new Result(
0,
"Verbose",
"sun.management.MemoryImpl",
"ObjectDomainName",
"VerboseMemory",
"type=Memory",
ImmutableMap.of("Verbose", true));
}
public static ImmutableList singleTrueResult() {
return ImmutableList.of(booleanTrueResult());
}
public static Result booleanFalseResult() {
return new Result(
0,
"Verbose",
"sun.management.MemoryImpl",
"ObjectDomainName",
"VerboseMemory",
"type=Memory",
ImmutableMap.of("Verbose", false));
}
public static Result numericResult() {
return numericResult(10);
}
public static Result numericResult(Object numericValue) {
return new Result(
0,
"ObjectPendingFinalizationCount",
"sun.management.MemoryImpl",
"ObjectDomainName",
"MemoryAlias",
"type=Memory",
ImmutableMap.of("ObjectPendingFinalizationCount", numericValue));
}
public static Result stringResult() {
return new Result(
0,
"NonHeapMemoryUsage",
"sun.management.MemoryImpl",
"ObjectDomainName",
"MemoryAlias",
"type=Memory",
ImmutableMap.of("ObjectPendingFinalizationCount", "value is a string"));
}
public static Result hashResult() {
return new Result(
0,
"NonHeapMemoryUsage",
"sun.management.MemoryImpl",
"ObjectDomainName",
"MemoryAlias",
"type=Memory",
ImmutableMap.of("committed", 12345, "init", 23456, "max", -1, "used", 45678));
}
public static Result numericBelowCPrecisionResult() {
return new Result(
0,
"ObjectPendingFinalizationCount",
"sun.management.MemoryImpl",
"ObjectDomainName",
"MemoryAlias",
"type=Memory",
ImmutableMap.of("ObjectPendingFinalizationCount", Double.MIN_VALUE));
}
public static Iterable singleNumericBelowCPrecisionResult() {
return ImmutableList.of(numericBelowCPrecisionResult());
}
public static Result numericResultWithTypenames(String typeName) {
return new Result(
0,
"ObjectPendingFinalizationCount",
"sun.management.MemoryImpl",
"ObjectDomainName",
"ObjectPendingFinalizationCount",
typeName,
ImmutableMap.of("ObjectPendingFinalizationCount", 10));
}
public static ImmutableList singleFalseResult() {
return ImmutableList.of(booleanFalseResult());
}
public static ImmutableList singleNumericResult() {
return ImmutableList.of(numericResult());
}
public static ImmutableList dummyResults() {
return ImmutableList.of(
numericResult(),
booleanTrueResult(),
booleanFalseResult());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy