func (f *Mock) GetMetricTypes(cfg plugin.ConfigType) ([]plugin.MetricType, error) {
	mts := []plugin.MetricType{}
	if _, ok := cfg.Table()["test-fail"]; ok {
		return mts, fmt.Errorf("testing")
	}
	if d, ok := cfg.Table()["test-sleep-duration"]; ok {
		duration, err := time.ParseDuration(d.(ctypes.ConfigValueStr).Value)
		if err != nil {
			return nil, err
		}
		time.Sleep(duration)
	}
	if _, ok := cfg.Table()["test"]; ok {
		mts = append(mts, plugin.MetricType{
			Namespace_:   core.NewNamespace("intel", "mock", "test"),
			Description_: "mock description",
			Unit_:        "mock unit",
		})
	}
	if _, ok := cfg.Table()["test-less"]; !ok {
		mts = append(mts, plugin.MetricType{
			Namespace_:   core.NewNamespace("intel", "mock", "foo"),
			Description_: "mock description",
			Unit_:        "mock unit",
		})
	}
	mts = append(mts, plugin.MetricType{
		Namespace_:   core.NewNamespace("intel", "mock", "bar"),
		Description_: "mock description",
		Unit_:        "mock unit",
	})
	mts = append(mts, plugin.MetricType{
		Namespace_: core.NewNamespace("intel", "mock").
			AddDynamicElement("host", "name of the host").
			AddStaticElement("baz"),
		Description_: "mock description",
		Unit_:        "mock unit",
	})
	mts = append(mts, plugin.MetricType{
		Namespace_: core.NewNamespace("intel", "mock").
			AddStaticElement("all").
			AddStaticElement("baz"),
		Description_: "mock description",
		Unit_:        "mock unit",
	})
	return mts, nil
}
GetMetricTypes returns metric types for testing
package mock
import (
	"bufio"
	"fmt"
	"log"
	"math/rand"
	"os"
	"strings"
	"time"
	"github.com/intelsdi-x/snap/control/plugin"
	"github.com/intelsdi-x/snap/control/plugin/cpolicy"
	"github.com/intelsdi-x/snap/core"
	"github.com/intelsdi-x/snap/core/ctypes"
)
const (
	Name = "mock"
	Version = 2
	Type = plugin.CollectorPluginType
)
type Mock struct {
}
var availableHosts = getAllHostnames()
func (f *Mock) CollectMetrics(mts []plugin.MetricType) ([]plugin.MetricType, error) {
	for _, p := range mts {
		log.Printf("collecting %+v\n", p)
	}
	rand.Seed(time.Now().UTC().UnixNano())
	metrics := []plugin.MetricType{}
	for i := range mts {
		if c, ok := mts[i].Config().Table()["long_stdout_log"]; ok && c.(ctypes.ConfigValueBool).Value {
			letterBytes := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
			longLine := []byte{}
			for i := 0; i < bufio.MaxScanTokenSize; i++ {
				longLine = append(longLine, letterBytes[rand.Intn(len(letterBytes))])
			}
			fmt.Fprintln(os.Stdout, string(longLine))
		}
		if c, ok := mts[i].Config().Table()["long_stderr_log"]; ok && c.(ctypes.ConfigValueBool).Value {
			letterBytes := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
			longLine := []byte{}
			for i := 0; i < bufio.MaxScanTokenSize; i++ {
				longLine = append(longLine, letterBytes[rand.Intn(len(letterBytes))])
			}
			fmt.Fprintln(os.Stderr, string(longLine))
		}
		if c, ok := mts[i].Config().Table()["panic"]; ok && c.(ctypes.ConfigValueBool).Value {
			panic("Oops!")
		}
		if isDynamic, _ := mts[i].Namespace().IsDynamic(); isDynamic {
			requestedHosts := []string{}
			if mts[i].Namespace()[2].Value == "*" {
				requestedHosts = append(requestedHosts, availableHosts...)
			} else {
				host := mts[i].Namespace()[2].Value
				if contains(availableHosts, host) {
					requestedHosts = append(requestedHosts, host)
				} else {
					return nil, fmt.Errorf("requested hostname `%s` is not available (list of available hosts: %s)", host, availableHosts)
				}
			}
			for _, host := range requestedHosts {
				data := randInt(65, 90) + 1000
				ns := make([]core.NamespaceElement, len(mts[i].Namespace()))
				copy(ns, mts[i].Namespace())
				ns[2].Value = host
				mt := plugin.MetricType{
					Data_:      data,
					Namespace_: ns,
					Timestamp_: time.Now(),
					Unit_:      mts[i].Unit(),
					Version_:   mts[i].Version(),
				}
				metrics = append(metrics, mt)
			}
		} else if strings.Contains(mts[i].Namespace().String(), "all") {
			mts[i].Data_ = 1001
			mts[i].Timestamp_ = time.Now()
			metrics = append(metrics, mts[i])
		} else {
			data := randInt(65, 90) + 1000
			mts[i].Data_ = data
			mts[i].Timestamp_ = time.Now()
			metrics = append(metrics, mts[i])
		}
	}
	return metrics, nil
}