-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhandler.go
56 lines (49 loc) · 2.05 KB
/
handler.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package main
import (
"context"
"os"
"github.com/sitture/gauge-reportserver/gauge_messages"
"google.golang.org/grpc"
)
type handler struct {
server *grpc.Server
}
func (h *handler) NotifyExecutionStarting(c context.Context, m *gauge_messages.ExecutionStartingRequest) (*gauge_messages.Empty, error) {
return &gauge_messages.Empty{}, nil
}
func (h *handler) NotifySpecExecutionStarting(c context.Context, m *gauge_messages.SpecExecutionStartingRequest) (*gauge_messages.Empty, error) {
return &gauge_messages.Empty{}, nil
}
func (h *handler) NotifyScenarioExecutionStarting(c context.Context, m *gauge_messages.ScenarioExecutionStartingRequest) (*gauge_messages.Empty, error) {
return &gauge_messages.Empty{}, nil
}
func (h *handler) NotifyStepExecutionStarting(c context.Context, m *gauge_messages.StepExecutionStartingRequest) (*gauge_messages.Empty, error) {
return &gauge_messages.Empty{}, nil
}
func (h *handler) NotifyStepExecutionEnding(c context.Context, m *gauge_messages.StepExecutionEndingRequest) (*gauge_messages.Empty, error) {
return &gauge_messages.Empty{}, nil
}
func (h *handler) NotifyScenarioExecutionEnding(c context.Context, m *gauge_messages.ScenarioExecutionEndingRequest) (*gauge_messages.Empty, error) {
return &gauge_messages.Empty{}, nil
}
func (h *handler) NotifySpecExecutionEnding(c context.Context, m *gauge_messages.SpecExecutionEndingRequest) (*gauge_messages.Empty, error) {
return &gauge_messages.Empty{}, nil
}
func (h *handler) NotifyExecutionEnding(c context.Context, m *gauge_messages.ExecutionEndingRequest) (*gauge_messages.Empty, error) {
return &gauge_messages.Empty{}, nil
}
func (h *handler) NotifySuiteResult(c context.Context, m *gauge_messages.SuiteExecutionResult) (*gauge_messages.Empty, error) {
if isReadyToShip() {
sendReport()
}
return &gauge_messages.Empty{}, nil
}
func (h *handler) Kill(c context.Context, m *gauge_messages.KillProcessRequest) (*gauge_messages.Empty, error) {
defer h.stopServer()
tearDown()
return &gauge_messages.Empty{}, nil
}
func (h *handler) stopServer() {
h.server.Stop()
os.Exit(0)
}