Пример #1
0
func RunListener(connector RemoteConnector, commandQueue *CommandQueue, chnExit chan int, log *logger.GoQALog) {
	m_chnExit := chnExit
	//connector.Init(listener, commandQueue, chnExit, logger)
	go connector.Run()
	_ = <-m_chnExit
	connector.Stop()
	log.LogMessage("Leaving RunListener")

}
Пример #2
0
func BuildRun(chnBuild chan runner.InternalCommandInfo, log *logger.GoQALog) {
	var buildInfo runner.InternalCommandInfo
	verNum := 1
	for {
		time.Sleep(time.Millisecond * CLENT_DELAY1)
		buildInfo = runner.GetInternalMessageInfo(runner.CMD_NEW_BUILD, make(chan runner.CommandInfo), fmt.Sprintf("T1.0_%d", verNum), "Fun", "~/projects/fun", time.Now().String())
		verNum++
		chnBuild <- buildInfo
		go func(chnRet chan runner.CommandInfo) {
			ret := <-chnRet
			log.LogMessage("ClientRun::%s %s", runner.CmdName(ret.Command), ret.Data[0])
		}(buildInfo.ChnReturn)
	}
}
Пример #3
0
func main() {

	chnExit := make(chan int)

	commandQueue := make(runner.CommandQueue, 100)
	log := logger.GoQALog{}
	log.Init()
	log.Add("default", logger.LOG_LEVEL_ALL, os.Stdout)
	//log.SetDebug(true)

	messageListener := runner.TCPConnector{}
	messageListener.Init(&log, &runner.JSON_Encode{}, MES_ADDRESS, MES_PORT)
	listener := runner.ExternalConnector{}
	listener.Init(&messageListener, &commandQueue, chnExit, &log)

	MockMatch := runner.BuildMockMatch{}
	chnBuildIn := make(chan runner.InternalCommandInfo)
	BuildMatcher := runner.InternalBuildMatcher{}
	BuildMatcher.Init(&MockMatch, chnBuildIn, &commandQueue, chnExit, &log)

	master := runner.Master{}
	master.Init(&listener, &commandQueue, chnExit, &log)
	//time.Sleep(time.Second * 1)

	//go runner.RunListener(&listener, &commandQueue, &chnExit)

	go BuildMatcher.Run()
	//time.Sleep(time.Second * 1)
	for i := 0; i < BUILDER_COUNT; i++ {
		go BuildRun(chnBuildIn, &log)
		time.Sleep(time.Millisecond * 200)
	}
	for i := 0; i < MESSAGE_COUNT; i++ {
		go GetStatusRun(&log)
		time.Sleep(time.Millisecond * 100)
	}

	log.LogMessage("Running master...")
	master.Run()

	log.LogMessage("Leaving Program....")
	time.Sleep(time.Second * 1)
}
Пример #4
0
func main() {

	console, err := os.Create("data/console.log")
	if err != nil {
		panic(err)
	}
	defer console.Close()

	errLog, err := os.Create("data/error.log")
	if err != nil {
		panic(err)
	}
	defer errLog.Close()

	incedentLog, err := os.Create("data/incedents.log")
	if err != nil {
		panic(err)
	}
	defer incedentLog.Close()

	resultLog, err := os.Create("data/TestResults.log")
	if err != nil {
		panic(err)
	}
	defer resultLog.Close()

	log := logger.GoQALog{}
	log.Init()
	log.SetDebug(true)

	log.Add("default", logger.LogLevelAll, os.Stdout)
	log.Add("Console", logger.LogLevelMessage, console)
	log.Add("Error", logger.LogLevelError, errLog)
	log.Add("Incidents", logger.LogLevelWarning, incedentLog)
	log.Add("Resuts", logger.LogLevelResults, resultLog)

	log.LogMessage("running on platform %s", runtime.GOOS)
	log.LogMessage("First message")
	log.LogMessage("second message")
	log.LogMessage("third message")
	log.LogDebug("Debug message")
	log.LogWarning("Warning Will Robinson")
	log.LogPass("Test Passed")
	log.LogFail("Test Failed")
	log.LogError("Failure in script")

	log.Sync()

}