30 lines
918 B
Go
30 lines
918 B
Go
// Package testfixture provides protocol fixtures for repository tests only.
|
|
package testfixture
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
"git.ipao.vip/rogee/go-sip/contracts"
|
|
)
|
|
|
|
const DispatcherID = "c046b893-8628-4589-ae50-619d049248a6"
|
|
|
|
// Execute preserves the established business identifiers used by scheduler
|
|
// tests while supplying the current external envelope. Historical bundles are
|
|
// read unchanged; no production decoder accepts their old MQ envelope.
|
|
func Execute() ([]byte, error) {
|
|
raw, err := contracts.Read("examples/call.execute.json")
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
var envelope map[string]any
|
|
if err := json.Unmarshal(raw, &envelope); err != nil {
|
|
return nil, err
|
|
}
|
|
envelope["schema_version"] = "2.0"
|
|
envelope["dispatcher_id"] = DispatcherID
|
|
return json.MarshalIndent(envelope, "", " ")
|
|
}
|
|
|
|
func InboundKey(tenantKey string) string { return "d." + DispatcherID + ".t." + tenantKey + ".in" }
|