func (this *TxSuite) SetupSuite() { baseDir := path.Join(os.TempDir(), "/.edbservers") ss := ess.NewServerServer(baseDir) cfg := server.DefaultServerConfig() cfg.Bind.Port = uint16(31405) proc := server.NewServeProcess(cfg, ss) err := proc.Start() if err != nil { panic(err) } this.serveProcess = proc testData := td.LoadTestData() this.codec = edb.NewTCodec() requestData := &ess.RequestData{testData.ChainData.PrivValidator, testData.ChainData.Genesis, 30} rBts, _ := this.codec.EncodeBytes(requestData) resp, _ := http.Post(TX_URL, "application/json", bytes.NewBuffer(rBts)) if resp.StatusCode != 200 { bts, _ := ioutil.ReadAll(resp.Body) fmt.Println("ERROR GETTING SS ADDRESS: " + string(bts)) fmt.Printf("%v\n", resp) panic(fmt.Errorf(string(bts))) } rd := &ess.ResponseData{} err2 := this.codec.Decode(rd, resp.Body) if err2 != nil { panic(err2) } fmt.Println("Received Port: " + rd.Port) this.sUrl = "http://localhost:" + rd.Port fmt.Println("URL: " + this.sUrl) this.testData = testData }
func (this *WebApiSuite) SetupSuite() { gin.SetMode(gin.ReleaseMode) baseDir := path.Join(os.TempDir(), "/.edbservers") ss := ess.NewServerServer(baseDir) cfg := server.DefaultServerConfig() cfg.Bind.Port = uint16(31404) proc := server.NewServeProcess(cfg, ss) err := proc.Start() if err != nil { panic(err) } this.serveProcess = proc testData := td.LoadTestData() this.codec = edb.NewTCodec() requestData := &ess.RequestData{testData.ChainData.PrivValidator, testData.ChainData.Genesis, SERVER_DURATION} rBts, _ := this.codec.EncodeBytes(requestData) resp, _ := http.Post(WAPIS_URL, "application/json", bytes.NewBuffer(rBts)) rd := &ess.ResponseData{} err2 := this.codec.Decode(rd, resp.Body) if err2 != nil { panic(err2) } fmt.Println("Received Port: " + rd.Port) this.sUrl = "http://localhost:" + rd.Port this.testData = testData }
func (this *MockSuite) SetupSuite() { gin.SetMode(gin.ReleaseMode) // Load the supporting objects. testData := td.LoadTestData() pipe := NewMockPipe(testData) codec := &edb.TCodec{} evtSubs := edb.NewEventSubscriptions(pipe.Events()) // The server restServer := edb.NewRestServer(codec, pipe, evtSubs) sConf := server.DefaultServerConfig() sConf.Bind.Port = 31402 // Create a server process. proc := server.NewServeProcess(sConf, restServer) err := proc.Start() if err != nil { panic(err) } this.serveProcess = proc this.codec = edb.NewTCodec() this.testData = testData this.sUrl = "http://localhost:31402" }
// Create a mock pipe with default mock data. func NewDefaultMockPipe() ep.Pipe { return NewMockPipe(td.LoadTestData()) }