func (s *ApiSuite) SetUpTest(c *C) { newProxy := func(id int) (proxy.Proxy, error) { return proxy.New(id, stapler.New(), proxy.Options{}) } s.ng = memng.New(registry.GetRegistry()) sv := supervisor.New(newProxy, s.ng, make(chan error), supervisor.Options{}) app := scroll.NewApp() InitProxyController(s.ng, sv, app) s.testServer = httptest.NewServer(app.GetHandler()) s.client = NewClient(s.testServer.URL, registry.GetRegistry()) }
func (s *MemSuite) SetUpTest(c *C) { engine := New(registry.GetRegistry()) s.suite.ChangesC = make(chan interface{}) s.stopC = make(chan bool) go engine.Subscribe(s.suite.ChangesC, s.stopC) s.suite.Engine = engine }
func main() { log.InitWithConfig(log.Config{Name: "console"}) cmd := command.NewCommand(registry.GetRegistry()) err := cmd.Run(os.Args) if err != nil { log.Errorf("error: %s\n", err) } }
func main() { runtime.GOMAXPROCS(runtime.NumCPU()) if err := service.Run(registry.GetRegistry()); err != nil { fmt.Printf("Service exited with error: %s\n", err) os.Exit(255) } else { fmt.Println("Service exited gracefully") } }
func (s *CmdSuite) run(params ...string) string { args := []string{"vctl"} args = append(args, params...) args = append(args, fmt.Sprintf("--vulcan=%s", s.testServer.URL)) s.out = &bytes.Buffer{} s.cmd = &Command{registry: registry.GetRegistry(), out: s.out, vulcanUrl: s.testServer.URL} s.cmd.Run(args) return strings.Replace(s.out.String(), "\n", " ", -1) }
func (s *CmdSuite) SetUpTest(c *C) { s.ng = memng.New(registry.GetRegistry()) newProxy := func(id int) (proxy.Proxy, error) { return proxy.New(id, stapler.New(), proxy.Options{}) } sv := supervisor.New(newProxy, s.ng, make(chan error), supervisor.Options{}) sv.Start() s.sv = sv app := scroll.NewApp() api.InitProxyController(s.ng, sv, app) s.testServer = httptest.NewServer(app.GetHandler()) s.out = &bytes.Buffer{} s.cmd = &Command{registry: registry.GetRegistry(), out: s.out, vulcanUrl: s.testServer.URL} }
func (s *SupervisorSuite) SetUpTest(c *C) { s.ng = memng.New(registry.GetRegistry()).(*memng.Mem) s.errorC = make(chan error) s.clock = &timetools.FreezedTime{ CurrentTime: time.Date(2012, 3, 4, 5, 6, 7, 0, time.UTC), } s.sv = New(newProxy, s.ng, s.errorC, Options{Clock: s.clock}) }