forked from getgauge/html-report
-
Notifications
You must be signed in to change notification settings - Fork 0
/
handler.go
59 lines (51 loc) · 2.29 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
57
58
59
/*----------------------------------------------------------------
* Copyright (c) ThoughtWorks, Inc.
* Licensed under the Apache License, Version 2.0
* See LICENSE in the project root for license information.
*----------------------------------------------------------------*/
package main
import (
"context"
"os"
"github.com/getgauge/html-report/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) {
createReport(m, true)
return &gauge_messages.Empty{}, nil
}
func (h *handler) Kill(c context.Context, m *gauge_messages.KillProcessRequest) (*gauge_messages.Empty, error) {
defer h.stopServer()
return &gauge_messages.Empty{}, nil
}
func (h *handler) stopServer() {
h.server.Stop()
os.Exit(0)
}