Search in sources :

Example 1 with CoverageInfo

use of com.sun.appserv.management.ext.coverage.CoverageInfo in project Payara by payara.

the class CoverageInfoAnalyzer method getCoverage.

public Map<String, CoverageInfo> getCoverage(final Set<AMX> candidates) {
    final Map<String, CoverageInfo> coverageMap = new HashMap<String, CoverageInfo>();
    for (final AMX amx : candidates) {
        final AMXDebugStuff debug = mTestUtil.asAMXDebugStuff(amx);
        final CoverageInfo coverageInfo = debug.getCoverageInfo();
        assert (coverageInfo != null);
        handleSpecialCases(coverageInfo);
        final String j2eeType = amx.getJ2EEType();
        final CoverageInfo existing = coverageMap.get(j2eeType);
        if (existing != null) {
            existing.merge(coverageInfo);
        } else {
            coverageMap.put(j2eeType, coverageInfo);
        }
    }
    return coverageMap;
}
Also used : HashMap(java.util.HashMap) AMXDebugStuff(org.glassfish.admin.amx.util.AMXDebugStuff) AMX(com.sun.appserv.management.base.AMX) CoverageInfo(com.sun.appserv.management.ext.coverage.CoverageInfo)

Example 2 with CoverageInfo

use of com.sun.appserv.management.ext.coverage.CoverageInfo in project Payara by payara.

the class CoverageInfoAnalyzer method getCoverageSummary.

public String getCoverageSummary() {
    final Set<AMX> amx = mTestUtil.getAllAMX();
    final Map<String, CoverageInfo> coverage = getCoverage(amx);
    final String[] j2eeTypes = GSetUtil.toStringArray(coverage.keySet());
    Arrays.sort(j2eeTypes);
    final String LINE_SEP = System.getProperty("line.separator");
    final StringBuilder builder = new StringBuilder();
    for (final String j2eeType : j2eeTypes) {
        final CoverageInfo info = coverage.get(j2eeType);
        final String infoString = "Coverage for j2eeType = " + j2eeType + ": " + (info.getFullCoverage() ? "100%" : "INCOMPLETE COVERAGE") + LINE_SEP + info.toString(false) + LINE_SEP + LINE_SEP;
        builder.append(infoString);
    }
    final String msg = "No AMX MBeans having the following types " + "were ever present, and so were NEVER TESTED:" + NEWLINE;
    builder.append(createMissingString(msg));
    return builder.toString();
}
Also used : AMX(com.sun.appserv.management.base.AMX) CoverageInfo(com.sun.appserv.management.ext.coverage.CoverageInfo)

Aggregations

AMX (com.sun.appserv.management.base.AMX)2 CoverageInfo (com.sun.appserv.management.ext.coverage.CoverageInfo)2 HashMap (java.util.HashMap)1 AMXDebugStuff (org.glassfish.admin.amx.util.AMXDebugStuff)1