Example #1
0
// Returns jobs from a collection (used for expected output)
func GetJobsFromCollection(collection *payload.Collection) []*EventAction {
	var jobs []*EventAction
	for _, payload := range collection.GetPayloads() {
		jobs = append(jobs, &EventAction{dialects.NewEvent(collection, payload), 1})
	}
	return jobs
}
Example #2
0
// Returns the protobuf message's session
func GetSession(c *payload.Collection) string {
	session := md5.New()
	io.WriteString(session, c.GetDeviceId())
	io.WriteString(session, ":")
	io.WriteString(session, c.GetClientId())
	io.WriteString(session, ":")
	io.WriteString(session, c.GetSystemVersion())
	io.WriteString(session, ":")
	io.WriteString(session, c.GetProductVersion())
	return hex.EncodeToString(session.Sum(nil))
}
Example #3
0
// Creates a new event based on the collection and a single payload
func NewEvent(meta *payload.Collection, payload *payload.Payload) *Event {
	return &Event{
		DeviceID:       meta.GetDeviceId(),
		ClientID:       meta.GetClientId(),
		Session:        meta.GetSession(),
		Nr:             payload.GetNr(),
		SystemVersion:  meta.GetSystemVersion(),
		ProductVersion: meta.GetProductVersion(),
		At:             ConvertIsoformat(payload.GetAt()),
		Event:          payload.GetEvent(),
		System:         meta.GetSystem(),
		ProductGitHash: meta.GetProductGitHash(),
		UserID:         payload.GetUserId(),
		IP:             payload.GetIp(),
		Parameters:     payload.GetParameters(),
		IsTesting:      payload.GetIsTesting()}
}