// Path: src/main/java/com/github/eostermueller/heapspank/garbagespank/GarbageSpank.java
// public class GarbageSpank {
// 	public static final String GARBAGE_SPANK = "gs_";
// 	private static ConcurrentHashMap<JStatOption,JStatMetricProvider> metricNames 
// 		= new ConcurrentHashMap<JStatOption,JStatMetricProvider>();
// 	private static ConcurrentHashMap<String,JStatMetricProvider> metricHeaders 
// 		= new ConcurrentHashMap<String,JStatMetricProvider>();
// 	
// 	static {
// 		addProvider( new Gc() );
// 		addProvider( new GcCapacity() );
// 		addProvider( new GcMetaCapacity() );
// 		addProvider( new GcNew() );
// 		addProvider( new GcNewCapacity() );
// 		addProvider( new GcOld() );
// 		addProvider( new GcOldCapacity() );
// 		addProvider( new GcUtil() );		
// 		/* add more providers below to provide support past JDK 1.8  */
// 	}
// 
// 	public static ConcurrentHashMap<JStatOption, JStatMetricProvider> getAllMetricNames() {
// 		return metricNames;
// 	}
// 	public JStatMetricProvider getMetric() {
// 		return getAllMetricNames().get(this.getJStatOption());
// 	}
// 	public static void setMetricNames(
// 			ConcurrentHashMap<JStatOption, JStatMetricProvider> metricNames) {
// 		GarbageSpank.metricNames = metricNames;
// 	}
// 	public long getPid() {
// 		return pid;
// 	}
// 	public void setPid(long pid) {
// 		this.pid = pid;
// 	}
// 	public JStatOption getJStatOption() {
// 		return jstatOption;
// 	}
// 	public void setJStatOption(JStatOption jstatOption) {
// 		this.jstatOption = jstatOption;
// 	}
// 	public long getIntervalInMilliSeconds() {
// 		return intervalInMilliSeconds;
// 	}
// 	public void setIntervalInMilliSeconds(long intervalInMilliSeconds) {
// 		this.intervalInMilliSeconds = intervalInMilliSeconds;
// 	}
// 	private long pid = -1;
// 	private JStatOption jstatOption = null;
// 	private long intervalInMilliSeconds = -1;
// 	
// 	private static void addProvider(JStatMetricProvider jsmp) {
// 		metricNames.put(jsmp.getJStatOption(), jsmp);
// 		metricHeaders.put(jsmp.getOriginalHeader(), jsmp);
// 		
// 	}
// 	public JStatMetricProvider getMetricNamesByOption(JStatOption jstatOption) {
// 		return this.metricNames.get(jstatOption);
// 	}
// 	public JStatMetricProvider getMetricByHeader(String headerFromJStat) {
// 		return this.metricHeaders.get(headerFromJStat);
// 	}
// }
// 
// Path: src/main/java/com/github/eostermueller/heapspank/garbagespank/JStatOption.java
// public enum JStatOption {
// 	gc, 
// 	gccapacity, 
// 	gcnew, 
// 	gcnewcapacity, 
// 	gcold, 
// 	gcoldcapacity, 
// 	gcmetacapacity, 
// 	gcutil
// }
// 
// Path: src/main/java/com/github/eostermueller/heapspank/garbagespank/metricprovider/JStatMetricProvider.java
// public interface JStatMetricProvider {
// 	public static final String CALC_COLUMN_NOT_SUPPORTED = "<CalculatedColumnNotSupported>";	
// 	
// 	public int getIndexOfFirstEnhancedColumn();
// 	
// 	JVMVersion[] getSupportedVersions();
// 	String getDescription();
// 	String getOriginalHeader();
// 	String getEnhancedHeader();
// 	boolean metricsAvailableOnFirstJStatRun();
// 	JStatOption getJStatOption();
// 	String[] getJStatMetricNames();
// 	/**
//    	 * What does enhanced mean?
// 	 * Indexes for most columns point to data straight from jstat.
// 	 * Other columns, however, require some calculations.
// 	 * @param skipCalculatedColumns 
// 
// 	 * @param current
// 	 * @param previous
// 	 * @param mesasurementIntervalInSeconds
// 	 * @param i
// 	 * @return
// 	 */
// 	String getColumnEnhanced(boolean skipCalculatedColumns, JStatLine current, JStatLine previous, long mesasurementIntervalInMilliSeconds, int i);
// 
// 	String getColumnEnhancedAndFormatted(boolean skipCalculatedCol,
// 			JStatLine current, JStatLine previous,
// 			long measurementIntervalInMilliSeconds, int i);
// }


import static org.junit.Assert.*;
import org.junit.Test;
import com.github.eostermueller.heapspank.garbagespank.GarbageSpank;
import com.github.eostermueller.heapspank.garbagespank.JStatOption;
import com.github.eostermueller.heapspank.garbagespank.metricprovider.JStatMetricProvider;
package com.github.eostermueller.heapspank.garbagespank.console;




public class JStatHeaderTest {

	/**
	 * garbageSpank will use to header to detect the "option" passed to jstat, 
	 * so we'll know which metrics to add.
	 */
	@Test
	public void test() {
		GarbageSpank gs = new GarbageSpank();
		
		JStatMetricProvider mp = gs.getMetricByHeader("S0C    S1C    S0U    S1U   TT MTT  DSS      EC       EU     YGC     YGCT");
		assertEquals("Cannot identify jstat 'gcnew' option given its header",
				JStatOption.gcnew, 
				mp.getJStatOption()
				);
		
		mp = gs.getMetricByHeader("MC       MU      CCSC     CCSU       OC          OU       YGC    FGC    FGCT     GCT");
		assertEquals("Cannot identify jstat 'gcold' option given its header",
				JStatOption.gcold, 
				mp.getJStatOption()
				);

		mp = gs.getMetricByHeader("OGCMN       OGCMX        OGC         OC       YGC   FGC    FGCT     GCT");
		assertEquals("Cannot identify jstat 'gcold' option given its header",
				JStatOption.gcoldcapacity, 
// Path: src/main/java/com/github/eostermueller/heapspank/garbagespank/GarbageSpank.java
// public class GarbageSpank {
// 	public static final String GARBAGE_SPANK = "gs_";
// 	private static ConcurrentHashMap<JStatOption,JStatMetricProvider> metricNames 
// 		= new ConcurrentHashMap<JStatOption,JStatMetricProvider>();
// 	private static ConcurrentHashMap<String,JStatMetricProvider> metricHeaders 
// 		= new ConcurrentHashMap<String,JStatMetricProvider>();
// 	
// 	static {
// 		addProvider( new Gc() );
// 		addProvider( new GcCapacity() );
// 		addProvider( new GcMetaCapacity() );
// 		addProvider( new GcNew() );
// 		addProvider( new GcNewCapacity() );
// 		addProvider( new GcOld() );
// 		addProvider( new GcOldCapacity() );
// 		addProvider( new GcUtil() );		
// 		/* add more providers below to provide support past JDK 1.8  */
// 	}
// 
// 	public static ConcurrentHashMap<JStatOption, JStatMetricProvider> getAllMetricNames() {
// 		return metricNames;
// 	}
// 	public JStatMetricProvider getMetric() {
// 		return getAllMetricNames().get(this.getJStatOption());
// 	}
// 	public static void setMetricNames(
// 			ConcurrentHashMap<JStatOption, JStatMetricProvider> metricNames) {
// 		GarbageSpank.metricNames = metricNames;
// 	}
// 	public long getPid() {
// 		return pid;
// 	}
// 	public void setPid(long pid) {
// 		this.pid = pid;
// 	}
// 	public JStatOption getJStatOption() {
// 		return jstatOption;
// 	}
// 	public void setJStatOption(JStatOption jstatOption) {
// 		this.jstatOption = jstatOption;
// 	}
// 	public long getIntervalInMilliSeconds() {
// 		return intervalInMilliSeconds;
// 	}
// 	public void setIntervalInMilliSeconds(long intervalInMilliSeconds) {
// 		this.intervalInMilliSeconds = intervalInMilliSeconds;
// 	}
// 	private long pid = -1;
// 	private JStatOption jstatOption = null;
// 	private long intervalInMilliSeconds = -1;
// 	
// 	private static void addProvider(JStatMetricProvider jsmp) {
// 		metricNames.put(jsmp.getJStatOption(), jsmp);
// 		metricHeaders.put(jsmp.getOriginalHeader(), jsmp);
// 		
// 	}
// 	public JStatMetricProvider getMetricNamesByOption(JStatOption jstatOption) {
// 		return this.metricNames.get(jstatOption);
// 	}
// 	public JStatMetricProvider getMetricByHeader(String headerFromJStat) {
// 		return this.metricHeaders.get(headerFromJStat);
// 	}
// }
// 
// Path: src/main/java/com/github/eostermueller/heapspank/garbagespank/JStatOption.java
// public enum JStatOption {
// 	gc, 
// 	gccapacity, 
// 	gcnew, 
// 	gcnewcapacity, 
// 	gcold, 
// 	gcoldcapacity, 
// 	gcmetacapacity, 
// 	gcutil
// }
// 
// Path: src/main/java/com/github/eostermueller/heapspank/garbagespank/metricprovider/JStatMetricProvider.java
// public interface JStatMetricProvider {
// 	public static final String CALC_COLUMN_NOT_SUPPORTED = "<CalculatedColumnNotSupported>";	
// 	
// 	public int getIndexOfFirstEnhancedColumn();
// 	
// 	JVMVersion[] getSupportedVersions();
// 	String getDescription();
// 	String getOriginalHeader();
// 	String getEnhancedHeader();
// 	boolean metricsAvailableOnFirstJStatRun();
// 	JStatOption getJStatOption();
// 	String[] getJStatMetricNames();
// 	/**
//    	 * What does enhanced mean?
// 	 * Indexes for most columns point to data straight from jstat.
// 	 * Other columns, however, require some calculations.
// 	 * @param skipCalculatedColumns 
// 
// 	 * @param current
// 	 * @param previous
// 	 * @param mesasurementIntervalInSeconds
// 	 * @param i
// 	 * @return
// 	 */
// 	String getColumnEnhanced(boolean skipCalculatedColumns, JStatLine current, JStatLine previous, long mesasurementIntervalInMilliSeconds, int i);
// 
// 	String getColumnEnhancedAndFormatted(boolean skipCalculatedCol,
// 			JStatLine current, JStatLine previous,
// 			long measurementIntervalInMilliSeconds, int i);
// }


// Path: src/test/java/com/github/eostermueller/heapspank/garbagespank/console/JStatHeaderTest.java
import static org.junit.Assert.*;
import org.junit.Test;
import com.github.eostermueller.heapspank.garbagespank.GarbageSpank;
import com.github.eostermueller.heapspank.garbagespank.JStatOption;
import com.github.eostermueller.heapspank.garbagespank.metricprovider.JStatMetricProvider;

package com.github.eostermueller.heapspank.garbagespank.console;




public class JStatHeaderTest {

	/**
	 * garbageSpank will use to header to detect the "option" passed to jstat, 
	 * so we'll know which metrics to add.
	 */
	@Test
	public void test() {
		GarbageSpank gs = new GarbageSpank();
		
		JStatMetricProvider mp = gs.getMetricByHeader("S0C    S1C    S0U    S1U   TT MTT  DSS      EC       EU     YGC     YGCT");
		assertEquals("Cannot identify jstat 'gcnew' option given its header",
				JStatOption.gcnew, 
				mp.getJStatOption()
				);
		
		mp = gs.getMetricByHeader("MC       MU      CCSC     CCSU       OC          OU       YGC    FGC    FGCT     GCT");
		assertEquals("Cannot identify jstat 'gcold' option given its header",
				JStatOption.gcold, 
				mp.getJStatOption()
				);

		mp = gs.getMetricByHeader("OGCMN       OGCMX        OGC         OC       YGC   FGC    FGCT     GCT");
		assertEquals("Cannot identify jstat 'gcold' option given its header",
				JStatOption.gcoldcapacity, 
				mp.getJStatOption()