Exemple #1
0
func main() {
	//	flag.Parse()
	//console.Init()
	config.Parse()
	golog.SetLevel(golog.LevelDebug)

	srvModule := NewServer()
	srvModule.Start()
	golog.Info("main", "main", "Starting server", "addr", *config.FLAG_ADDR)

	c := make(chan os.Signal, 1)
	signal.Notify(c,
		syscall.SIGHUP,
		syscall.SIGINT,
		syscall.SIGTERM,
		syscall.SIGQUIT,
		syscall.SIGKILL)
	//	signal.Notify(c, os.Interrupt, os.Kill)

	sig := <-c
	golog.Info("main", "main", "Server begin close", "sig", sig)

	golog.Info("main", "main", "Closing server module ...")
	srvModule.Close()

	golog.Info("main", "main", "Server close success")
}
func TestParse(t *testing.T) {
	conf, err := config.Parse("../../config/config.json")
	if err != nil {
		t.Error("Expected nil and got error " + err.Error())
	}
	if conf.Servicename != "file" {
		t.Error("Expected file and got " + conf.Servicename)
	}
	if conf.Algorithm.Name != "randomized" {
		t.Error("Expected randomized and got " + conf.Algorithm.Name)
	}
}