add id getter for processors

This commit is contained in:
Joel Wetzell
2026-08-28 14:55:19 -05:00
parent f9287cc87e
commit 54ada59f6e
96 changed files with 456 additions and 33 deletions
+5 -1
View File
@@ -44,6 +44,10 @@ func (apd *ArtNetPacketDecode) Process(ctx context.Context, wrappedPayload commo
return wrappedPayload, nil
}
func (apd *ArtNetPacketDecode) Id() string {
return apd.config.Id
}
func (apd *ArtNetPacketDecode) Type() string {
return apd.config.Type
}
}
@@ -43,6 +43,10 @@ func (ape *ArtNetPacketEncode) Process(ctx context.Context, wrappedPayload commo
return wrappedPayload, nil
}
func (ape *ArtNetPacketEncode) Id() string {
return ape.config.Id
}
func (ape *ArtNetPacketEncode) Type() string {
return ape.config.Type
}
+4
View File
@@ -143,6 +143,10 @@ func (dq *DbQuery) Process(ctx context.Context, wrappedPayload common.WrappedPay
return wrappedPayload, nil
}
func (dq *DbQuery) Id() string {
return dq.config.Id
}
func (dq *DbQuery) Type() string {
return dq.config.Type
}
+4 -1
View File
@@ -33,7 +33,10 @@ func (dl *DebugLog) Process(ctx context.Context, wrappedPayload common.WrappedPa
return wrappedPayload, nil
}
func (dl *DebugLog) Id() string {
return dl.config.Id
}
func (dl *DebugLog) Type() string {
return dl.config.Type
}
+4
View File
@@ -35,6 +35,10 @@ func (fc *FilterChange) Process(ctx context.Context, wrappedPayload common.Wrapp
return wrappedPayload, nil
}
func (fc *FilterChange) Id() string {
return fc.config.Id
}
func (fc *FilterChange) Type() string {
return fc.config.Type
}
+4
View File
@@ -76,6 +76,10 @@ func (fe *FilterExpr) Process(ctx context.Context, wrappedPayload common.Wrapped
return wrappedPayload, nil
}
func (fe *FilterExpr) Id() string {
return fe.config.Id
}
func (fe *FilterExpr) Type() string {
return fe.config.Type
}
+4
View File
@@ -53,6 +53,10 @@ func (fc *FilterRate) Process(ctx context.Context, wrappedPayload common.Wrapped
return wrappedPayload, nil
}
func (fc *FilterRate) Id() string {
return fc.config.Id
}
func (fc *FilterRate) Type() string {
return fc.config.Type
}
+4
View File
@@ -69,6 +69,10 @@ func (fr *FilterRegex) Process(ctx context.Context, wrappedPayload common.Wrappe
return wrappedPayload, nil
}
func (fr *FilterRegex) Id() string {
return fr.config.Id
}
func (fr *FilterRegex) Type() string {
return fr.config.Type
}
+4
View File
@@ -68,6 +68,10 @@ func (fp *FloatParse) Process(ctx context.Context, wrappedPayload common.Wrapped
return wrappedPayload, nil
}
func (fp *FloatParse) Id() string {
return fp.config.Id
}
func (fp *FloatParse) Type() string {
return fp.config.Type
}
+4
View File
@@ -97,6 +97,10 @@ func (fr *FloatRandom) Process(ctx context.Context, wrappedPayload common.Wrappe
return wrappedPayload, errors.New("float.random bitSize error: must be 32 or 64")
}
func (fr *FloatRandom) Id() string {
return fr.config.Id
}
func (fr *FloatRandom) Type() string {
return fr.config.Type
}
+33 -29
View File
@@ -182,32 +182,32 @@ func init() {
}
return &FreeDCreate{
config: config,
Id: idTemplate,
Pan: panTemplate,
Tilt: tiltTemplate,
Roll: rollTemplate,
PosX: posXTemplate,
PosY: posYTemplate,
PosZ: posZTemplate,
Zoom: zoomTemplate,
Focus: focusTemplate,
config: config,
IdTemplate: idTemplate,
PanTemplate: panTemplate,
TiltTemplate: tiltTemplate,
RollTemplate: rollTemplate,
PosXTemplate: posXTemplate,
PosYTemplate: posYTemplate,
PosZTemplate: posZTemplate,
ZoomTemplate: zoomTemplate,
FocusTemplate: focusTemplate,
}, nil
},
})
}
type FreeDCreate struct {
config config.ProcessorConfig
Id *template.Template
Pan *template.Template
Tilt *template.Template
Roll *template.Template
PosX *template.Template
PosY *template.Template
PosZ *template.Template
Zoom *template.Template
Focus *template.Template
config config.ProcessorConfig
IdTemplate *template.Template
PanTemplate *template.Template
TiltTemplate *template.Template
RollTemplate *template.Template
PosXTemplate *template.Template
PosYTemplate *template.Template
PosZTemplate *template.Template
ZoomTemplate *template.Template
FocusTemplate *template.Template
}
func (fc *FreeDCreate) Process(ctx context.Context, wrappedPayload common.WrappedPayload) (common.WrappedPayload, error) {
@@ -215,7 +215,7 @@ func (fc *FreeDCreate) Process(ctx context.Context, wrappedPayload common.Wrappe
templateData := wrappedPayload
var idBuffer bytes.Buffer
err := fc.Id.Execute(&idBuffer, templateData)
err := fc.IdTemplate.Execute(&idBuffer, templateData)
if err != nil {
wrappedPayload.End = true
@@ -232,7 +232,7 @@ func (fc *FreeDCreate) Process(ctx context.Context, wrappedPayload common.Wrappe
}
var panBuffer bytes.Buffer
err = fc.Pan.Execute(&panBuffer, templateData)
err = fc.PanTemplate.Execute(&panBuffer, templateData)
if err != nil {
wrappedPayload.End = true
@@ -249,7 +249,7 @@ func (fc *FreeDCreate) Process(ctx context.Context, wrappedPayload common.Wrappe
}
var tiltBuffer bytes.Buffer
err = fc.Tilt.Execute(&tiltBuffer, templateData)
err = fc.TiltTemplate.Execute(&tiltBuffer, templateData)
if err != nil {
wrappedPayload.End = true
@@ -266,7 +266,7 @@ func (fc *FreeDCreate) Process(ctx context.Context, wrappedPayload common.Wrappe
}
var rollBuffer bytes.Buffer
err = fc.Roll.Execute(&rollBuffer, templateData)
err = fc.RollTemplate.Execute(&rollBuffer, templateData)
if err != nil {
wrappedPayload.End = true
@@ -283,7 +283,7 @@ func (fc *FreeDCreate) Process(ctx context.Context, wrappedPayload common.Wrappe
}
var posXBuffer bytes.Buffer
err = fc.PosX.Execute(&posXBuffer, templateData)
err = fc.PosXTemplate.Execute(&posXBuffer, templateData)
if err != nil {
wrappedPayload.End = true
@@ -300,7 +300,7 @@ func (fc *FreeDCreate) Process(ctx context.Context, wrappedPayload common.Wrappe
}
var posYBuffer bytes.Buffer
err = fc.PosY.Execute(&posYBuffer, templateData)
err = fc.PosYTemplate.Execute(&posYBuffer, templateData)
if err != nil {
wrappedPayload.End = true
@@ -317,7 +317,7 @@ func (fc *FreeDCreate) Process(ctx context.Context, wrappedPayload common.Wrappe
}
var posZBuffer bytes.Buffer
err = fc.PosZ.Execute(&posZBuffer, templateData)
err = fc.PosZTemplate.Execute(&posZBuffer, templateData)
if err != nil {
wrappedPayload.End = true
@@ -334,7 +334,7 @@ func (fc *FreeDCreate) Process(ctx context.Context, wrappedPayload common.Wrappe
}
var zoomBuffer bytes.Buffer
err = fc.Zoom.Execute(&zoomBuffer, templateData)
err = fc.ZoomTemplate.Execute(&zoomBuffer, templateData)
if err != nil {
wrappedPayload.End = true
@@ -351,7 +351,7 @@ func (fc *FreeDCreate) Process(ctx context.Context, wrappedPayload common.Wrappe
}
var focusBuffer bytes.Buffer
err = fc.Focus.Execute(&focusBuffer, templateData)
err = fc.FocusTemplate.Execute(&focusBuffer, templateData)
if err != nil {
wrappedPayload.End = true
@@ -384,6 +384,10 @@ func (fc *FreeDCreate) Process(ctx context.Context, wrappedPayload common.Wrappe
return wrappedPayload, nil
}
func (fc *FreeDCreate) Id() string {
return fc.config.Id
}
func (fc *FreeDCreate) Type() string {
return fc.config.Type
}
+6 -2
View File
@@ -21,9 +21,9 @@ func init() {
type FreeDDecode struct {
config config.ProcessorConfig
buf [29]byte
buf [29]byte
}
func (fd *FreeDDecode) Process(ctx context.Context, wrappedPayload common.WrappedPayload) (common.WrappedPayload, error) {
payload := wrappedPayload.Payload
payloadBytes, ok := common.GetAnyAsByteSlice(payload)
@@ -49,6 +49,10 @@ func (fd *FreeDDecode) Process(ctx context.Context, wrappedPayload common.Wrappe
return wrappedPayload, nil
}
func (fd *FreeDDecode) Id() string {
return fd.config.Id
}
func (fd *FreeDDecode) Type() string {
return fd.config.Type
}
+4
View File
@@ -38,6 +38,10 @@ func (fe *FreeDEncode) Process(ctx context.Context, wrappedPayload common.Wrappe
return wrappedPayload, nil
}
func (fe *FreeDEncode) Id() string {
return fe.config.Id
}
func (fe *FreeDEncode) Type() string {
return fe.config.Type
}
+4
View File
@@ -114,6 +114,10 @@ func (hrd *HTTPRequestDo) Process(ctx context.Context, wrappedPayload common.Wra
return wrappedPayload, nil
}
func (hrd *HTTPRequestDo) Id() string {
return hrd.config.Id
}
func (hrd *HTTPRequestDo) Type() string {
return hrd.config.Type
}
@@ -85,6 +85,10 @@ func (hrc *HTTPResponseCreate) Process(ctx context.Context, wrappedPayload commo
return wrappedPayload, nil
}
func (hrc *HTTPResponseCreate) Id() string {
return hrc.config.Id
}
func (hrc *HTTPResponseCreate) Type() string {
return hrc.config.Type
}
+4
View File
@@ -85,6 +85,10 @@ func (ip *IntParse) Process(ctx context.Context, wrappedPayload common.WrappedPa
return wrappedPayload, nil
}
func (ip *IntParse) Id() string {
return ip.config.Id
}
func (ip *IntParse) Type() string {
return ip.config.Type
}
+4
View File
@@ -66,6 +66,10 @@ func (ir *IntRandom) Process(ctx context.Context, wrappedPayload common.WrappedP
return wrappedPayload, nil
}
func (ir *IntRandom) Id() string {
return ir.config.Id
}
func (ir *IntRandom) Type() string {
return ir.config.Type
}
+4
View File
@@ -98,6 +98,10 @@ func (is *IntScale) Process(ctx context.Context, wrappedPayload common.WrappedPa
return wrappedPayload, nil
}
func (is *IntScale) Id() string {
return is.config.Id
}
func (is *IntScale) Type() string {
return is.config.Type
}
+4
View File
@@ -50,6 +50,10 @@ func (jd *JsonDecode) Process(ctx context.Context, wrappedPayload common.Wrapped
}
func (jd *JsonDecode) Id() string {
return jd.config.Id
}
func (jd *JsonDecode) Type() string {
return jd.config.Type
}
+4
View File
@@ -42,6 +42,10 @@ func (je *JsonEncode) Process(ctx context.Context, wrappedPayload common.Wrapped
return wrappedPayload, nil
}
func (je *JsonEncode) Id() string {
return je.config.Id
}
func (je *JsonEncode) Type() string {
return je.config.Type
}
+4
View File
@@ -89,6 +89,10 @@ func (kvg *KVGet) Process(ctx context.Context, wrappedPayload common.WrappedPayl
return wrappedPayload, nil
}
func (kvg *KVGet) Id() string {
return kvg.config.Id
}
func (kvg *KVGet) Type() string {
return kvg.config.Type
}
+4
View File
@@ -89,6 +89,10 @@ func (kvs *KVSet) Process(ctx context.Context, wrappedPayload common.WrappedPayl
return wrappedPayload, nil
}
func (kvs *KVSet) Id() string {
return kvs.config.Id
}
func (kvs *KVSet) Type() string {
return kvs.config.Type
}
@@ -147,6 +147,10 @@ func (mccc *MIDIControlChangeCreate) Process(ctx context.Context, wrappedPayload
return wrappedPayload, nil
}
func (mccc *MIDIControlChangeCreate) Id() string {
return mccc.config.Id
}
func (mccc *MIDIControlChangeCreate) Type() string {
return mccc.config.Type
}
@@ -40,6 +40,10 @@ func (mmd *MIDIMessageDecode) Process(ctx context.Context, wrappedPayload common
return wrappedPayload, nil
}
func (mmd *MIDIMessageDecode) Id() string {
return mmd.config.Id
}
func (mmd *MIDIMessageDecode) Type() string {
return mmd.config.Type
}
@@ -38,6 +38,10 @@ func (mme *MIDIMessageEncode) Process(ctx context.Context, wrappedPayload common
return wrappedPayload, nil
}
func (mme *MIDIMessageEncode) Id() string {
return mme.config.Id
}
func (mme *MIDIMessageEncode) Type() string {
return mme.config.Type
}
@@ -96,6 +96,10 @@ func (mmu *MIDIMessageUnpack) Process(ctx context.Context, wrappedPayload common
}
}
func (mmu *MIDIMessageUnpack) Id() string {
return mmu.config.Id
}
func (mmu *MIDIMessageUnpack) Type() string {
return mmu.config.Type
}
@@ -146,6 +146,10 @@ func (mnoc *MIDINoteOffCreate) Process(ctx context.Context, wrappedPayload commo
return wrappedPayload, nil
}
func (mnoc *MIDINoteOffCreate) Id() string {
return mnoc.config.Id
}
func (mnoc *MIDINoteOffCreate) Type() string {
return mnoc.config.Type
}
@@ -145,6 +145,10 @@ func (mnoc *MIDINoteOnCreate) Process(ctx context.Context, wrappedPayload common
return wrappedPayload, nil
}
func (mnoc *MIDINoteOnCreate) Id() string {
return mnoc.config.Id
}
func (mnoc *MIDINoteOnCreate) Type() string {
return mnoc.config.Type
}
@@ -113,6 +113,10 @@ func (mpcc *MIDIProgramChangeCreate) Process(ctx context.Context, wrappedPayload
return wrappedPayload, nil
}
func (mpcc *MIDIProgramChangeCreate) Id() string {
return mpcc.config.Id
}
func (mpcc *MIDIProgramChangeCreate) Type() string {
return mpcc.config.Type
}
+4
View File
@@ -81,6 +81,10 @@ func (mo *ModuleOutput) Process(ctx context.Context, wrappedPayload common.Wrapp
return wrappedPayload, nil
}
func (mo *ModuleOutput) Id() string {
return mo.config.Id
}
func (mo *ModuleOutput) Type() string {
return mo.config.Type
}
+4
View File
@@ -157,6 +157,10 @@ func (omc *OSCMessageCreate) Process(ctx context.Context, wrappedPayload common.
return wrappedPayload, nil
}
func (omc *OSCMessageCreate) Id() string {
return omc.config.Id
}
func (omc *OSCMessageCreate) Type() string {
return omc.config.Type
}
+4
View File
@@ -52,6 +52,10 @@ func (omd *OSCMessageDecode) Process(ctx context.Context, wrappedPayload common.
return wrappedPayload, nil
}
func (omd *OSCMessageDecode) Id() string {
return omd.config.Id
}
func (omd *OSCMessageDecode) Type() string {
return omd.config.Type
}
+4
View File
@@ -42,6 +42,10 @@ func (ome *OSCMessageEncode) Process(ctx context.Context, wrappedPayload common.
return wrappedPayload, nil
}
func (ome *OSCMessageEncode) Id() string {
return ome.config.Id
}
func (ome *OSCMessageEncode) Type() string {
return ome.config.Type
}
+1
View File
@@ -11,6 +11,7 @@ import (
)
type Processor interface {
Id() string
Type() string
Process(context.Context, common.WrappedPayload) (common.WrappedPayload, error)
}
+4
View File
@@ -104,6 +104,10 @@ func (psp *PubSubPublish) Process(ctx context.Context, wrappedPayload common.Wra
return wrappedPayload, nil
}
func (psp *PubSubPublish) Id() string {
return psp.config.Id
}
func (psp *PubSubPublish) Type() string {
return psp.config.Type
}
+4
View File
@@ -68,6 +68,10 @@ func (ri *RouterInput) Process(ctx context.Context, wrappedPayload common.Wrappe
return wrappedPayload, nil
}
func (ri *RouterInput) Id() string {
return ri.config.Id
}
func (ri *RouterInput) Type() string {
return ri.config.Type
}
+4
View File
@@ -65,6 +65,10 @@ func (se *ScriptExpr) Process(ctx context.Context, wrappedPayload common.Wrapped
return wrappedPayload, nil
}
func (se *ScriptExpr) Id() string {
return se.config.Id
}
func (se *ScriptExpr) Type() string {
return se.config.Type
}
+4
View File
@@ -135,6 +135,10 @@ func (sj *ScriptJS) Process(ctx context.Context, wrappedPayload common.WrappedPa
return wrappedPayload, nil
}
func (sj *ScriptJS) Id() string {
return sj.config.Id
}
func (sj *ScriptJS) Type() string {
return sj.config.Type
}
+4
View File
@@ -120,6 +120,10 @@ func (sw *ScriptWASM) Process(ctx context.Context, wrappedPayload common.Wrapped
return wrappedPayload, nil
}
func (sw *ScriptWASM) Id() string {
return sw.config.Id
}
func (sw *ScriptWASM) Type() string {
return sw.config.Type
}
@@ -100,6 +100,10 @@ func (srac *SipResponseAudioCreate) Process(ctx context.Context, wrappedPayload
return wrappedPayload, nil
}
func (srac *SipResponseAudioCreate) Id() string {
return srac.config.Id
}
func (srac *SipResponseAudioCreate) Type() string {
return srac.config.Type
}
@@ -110,6 +110,10 @@ func (srdc *SipResponseDTMFCreate) Process(ctx context.Context, wrappedPayload c
return wrappedPayload, nil
}
func (srdc *SipResponseDTMFCreate) Id() string {
return srdc.config.Id
}
func (srdc *SipResponseDTMFCreate) Type() string {
return srdc.config.Type
}
+4
View File
@@ -65,6 +65,10 @@ func (sc *StringCreate) Process(ctx context.Context, wrappedPayload common.Wrapp
return wrappedPayload, nil
}
func (sc *StringCreate) Id() string {
return sc.config.Id
}
func (sc *StringCreate) Type() string {
return sc.config.Type
}
+4
View File
@@ -37,6 +37,10 @@ func (sd *StringDecode) Process(ctx context.Context, wrappedPayload common.Wrapp
return wrappedPayload, nil
}
func (sd *StringDecode) Id() string {
return sd.config.Id
}
func (sd *StringDecode) Type() string {
return sd.config.Type
}
+4
View File
@@ -36,6 +36,10 @@ func (se *StringEncode) Process(ctx context.Context, wrappedPayload common.Wrapp
return wrappedPayload, nil
}
func (se *StringEncode) Id() string {
return se.config.Id
}
func (se *StringEncode) Type() string {
return se.config.Type
}
+4
View File
@@ -59,6 +59,10 @@ func (ss *StringSplit) Process(ctx context.Context, wrappedPayload common.Wrappe
return wrappedPayload, nil
}
func (ss *StringSplit) Id() string {
return ss.config.Id
}
func (ss *StringSplit) Type() string {
return ss.config.Type
}
+4
View File
@@ -67,6 +67,10 @@ func (sfg *StructFieldGet) Process(ctx context.Context, wrappedPayload common.Wr
return wrappedPayload, nil
}
func (sfg *StructFieldGet) Id() string {
return sfg.config.Id
}
func (sfg *StructFieldGet) Type() string {
return sfg.config.Type
}
+4
View File
@@ -86,6 +86,10 @@ func (smg *StructMethodGet) Process(ctx context.Context, wrappedPayload common.W
return wrappedPayload, nil
}
func (smg *StructMethodGet) Id() string {
return smg.config.Id
}
func (smg *StructMethodGet) Type() string {
return smg.config.Type
}
@@ -17,6 +17,7 @@ func TestArtnetPacketDecodeFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "artnet.packet.decode",
})
@@ -24,6 +25,10 @@ func TestArtnetPacketDecodeFromRegistry(t *testing.T) {
t.Fatalf("failed to create artnet.packet.decode processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("artnet.packet.decode processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "artnet.packet.decode" {
t.Fatalf("artnet.packet.decode processor has wrong type: %s", processorInstance.Type())
}
@@ -17,6 +17,7 @@ func TestArtnetPacketEncodeFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "artnet.packet.encode",
})
@@ -24,6 +25,10 @@ func TestArtnetPacketEncodeFromRegistry(t *testing.T) {
t.Fatalf("failed to create artnet.packet.encode processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("artnet.packet.encode processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "artnet.packet.encode" {
t.Fatalf("artnet.packet.encode processor has wrong type: %s", processorInstance.Type())
}
+5
View File
@@ -18,6 +18,7 @@ func TestDbQueryFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "db.query",
Params: map[string]any{
"module": "test",
@@ -28,6 +29,10 @@ func TestDbQueryFromRegistry(t *testing.T) {
t.Fatalf("failed to create db.query processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("db.query processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "db.query" {
t.Fatalf("db.query processor has wrong type: %s", processorInstance.Type())
}
@@ -16,6 +16,7 @@ func TestDebugLogFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "debug.log",
})
@@ -23,6 +24,10 @@ func TestDebugLogFromRegistry(t *testing.T) {
t.Fatalf("failed to create debug.log processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("debug.log processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "debug.log" {
t.Fatalf("debug.log processor has wrong type: %s", processorInstance.Type())
}
@@ -16,12 +16,17 @@ func TestFilterChangeFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "filter.change",
})
if err != nil {
t.Fatalf("failed to create filter.change processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("filter.change processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "filter.change" {
t.Fatalf("filter.change processor has wrong type: %s", processorInstance.Type())
}
@@ -16,6 +16,7 @@ func TestFilterExprFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "filter.expr",
Params: map[string]any{
"expression": "foo + bar",
@@ -25,6 +26,10 @@ func TestFilterExprFromRegistry(t *testing.T) {
t.Fatalf("failed to create filter.expr processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("filter.expr processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "filter.expr" {
t.Fatalf("filter.expr processor has wrong type: %s", processorInstance.Type())
}
@@ -16,6 +16,7 @@ func TestFilterRateFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "filter.rate",
Params: map[string]any{
"rate": 1,
@@ -25,6 +26,10 @@ func TestFilterRateFromRegistry(t *testing.T) {
t.Fatalf("failed to create filter.rate processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("filter.rate processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "filter.rate" {
t.Fatalf("filter.rate processor has wrong type: %s", processorInstance.Type())
}
@@ -16,6 +16,7 @@ func TestFilterRegexFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "filter.regex",
Params: map[string]any{
"pattern": "hello",
@@ -25,6 +26,10 @@ func TestFilterRegexFromRegistry(t *testing.T) {
t.Fatalf("failed to create filter.regex processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("filter.regex processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "filter.regex" {
t.Fatalf("filter.regex processor has wrong type: %s", processorInstance.Type())
}
@@ -16,6 +16,7 @@ func TestFloatParseFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "float.parse",
})
@@ -23,6 +24,9 @@ func TestFloatParseFromRegistry(t *testing.T) {
t.Fatalf("failed to create float.parse processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("float.parse processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "float.parse" {
t.Fatalf("float.parse processor has wrong type: %s", processorInstance.Type())
}
@@ -15,6 +15,7 @@ func TestFloatRandomFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "float.random",
Params: map[string]any{
"min": 1.0,
@@ -26,6 +27,10 @@ func TestFloatRandomFromRegistry(t *testing.T) {
t.Fatalf("failed to create float.random processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("float.random processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "float.random" {
t.Fatalf("float.random processor has wrong type: %s", processorInstance.Type())
}
@@ -17,6 +17,7 @@ func TestFreeDCreateFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "freed.create",
Params: map[string]any{
"id": "0",
@@ -35,6 +36,10 @@ func TestFreeDCreateFromRegistry(t *testing.T) {
t.Fatalf("failed to create freed.create processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("freed.create processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "freed.create" {
t.Fatalf("freed.create processor has wrong type: %s", processorInstance.Type())
}
@@ -17,6 +17,7 @@ func TestFreeDDecodeFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "freed.decode",
})
@@ -24,6 +25,10 @@ func TestFreeDDecodeFromRegistry(t *testing.T) {
t.Fatalf("failed to create freed.decode processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("freed.decode processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "freed.decode" {
t.Fatalf("freed.decode processor has wrong type: %s", processorInstance.Type())
}
@@ -17,6 +17,7 @@ func TestFreeDEncodeFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "freed.encode",
})
@@ -24,6 +25,10 @@ func TestFreeDEncodeFromRegistry(t *testing.T) {
t.Fatalf("failed to create freed.encode processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("freed.encode processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "freed.encode" {
t.Fatalf("freed.encode processor has wrong type: %s", processorInstance.Type())
}
@@ -16,6 +16,7 @@ func TestHTTPRequestCreateFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "http.request.do",
Params: map[string]any{
"method": "GET",
@@ -27,6 +28,10 @@ func TestHTTPRequestCreateFromRegistry(t *testing.T) {
t.Fatalf("failed to create http.request.do processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("http.request.do processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "http.request.do" {
t.Fatalf("http.request.do processor has wrong type: %s", processorInstance.Type())
}
@@ -16,6 +16,7 @@ func TestHTTPResponseCreateFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "http.response.create",
Params: map[string]any{
"status": 200,
@@ -27,6 +28,10 @@ func TestHTTPResponseCreateFromRegistry(t *testing.T) {
t.Fatalf("failed to create http.response.create processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("http.response.create processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "http.response.create" {
t.Fatalf("http.response.create processor has wrong type: %s", processorInstance.Type())
}
@@ -16,6 +16,7 @@ func TestIntParseFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "int.parse",
})
@@ -23,6 +24,10 @@ func TestIntParseFromRegistry(t *testing.T) {
t.Fatalf("failed to create int.parse processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("int.parse processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "int.parse" {
t.Fatalf("int.parse processor has wrong type: %s", processorInstance.Type())
}
@@ -15,6 +15,7 @@ func TestIntRandomFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "int.random",
Params: map[string]any{
"min": 1,
@@ -26,6 +27,10 @@ func TestIntRandomFromRegistry(t *testing.T) {
t.Fatalf("failed to create int.random processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("int.random processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "int.random" {
t.Fatalf("int.random processor has wrong type: %s", processorInstance.Type())
}
@@ -15,6 +15,7 @@ func TestIntScaleFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "int.scale",
Params: map[string]any{
"inMin": 0,
@@ -28,6 +29,10 @@ func TestIntScaleFromRegistry(t *testing.T) {
t.Fatalf("failed to create int.scale processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("int.scale processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "int.scale" {
t.Fatalf("int.scale processor has wrong type: %s", processorInstance.Type())
}
@@ -17,12 +17,17 @@ func TestJsonDecodeFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "json.decode",
})
if err != nil {
t.Fatalf("failed to create json.decode processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("json.decode processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "json.decode" {
t.Fatalf("json.decode processor has wrong type: %s", processorInstance.Type())
}
@@ -18,12 +18,17 @@ func TestJsonEncodeFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "json.encode",
})
if err != nil {
t.Fatalf("failed to create json.encode processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("json.encode processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "json.encode" {
t.Fatalf("json.encode processor has wrong type: %s", processorInstance.Type())
}
+5
View File
@@ -17,6 +17,7 @@ func TestKvGetFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "kv.get",
Params: map[string]any{
"module": "test",
@@ -27,6 +28,10 @@ func TestKvGetFromRegistry(t *testing.T) {
t.Fatalf("failed to create kv.get processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("kv.get processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "kv.get" {
t.Fatalf("kv.get processor has wrong type: %s", processorInstance.Type())
}
+4
View File
@@ -17,6 +17,7 @@ func TestKvSetFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "kv.set",
Params: map[string]any{
"module": "test",
@@ -27,6 +28,9 @@ func TestKvSetFromRegistry(t *testing.T) {
t.Fatalf("failed to create kv.set processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("kv.set processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "kv.set" {
t.Fatalf("kv.set processor has wrong type: %s", processorInstance.Type())
}
@@ -17,6 +17,7 @@ func TestMIDIControlChangeCreateFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "midi.control_change.create",
Params: map[string]any{
"channel": "1",
@@ -29,6 +30,10 @@ func TestMIDIControlChangeCreateFromRegistry(t *testing.T) {
t.Fatalf("failed to create midi.control_change.create processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("midi.control_change.create processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "midi.control_change.create" {
t.Fatalf("midi.control_change.create processor has wrong type: %s", processorInstance.Type())
}
@@ -17,6 +17,7 @@ func TestMIDIMessageDecodeFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "midi.message.decode",
})
@@ -24,6 +25,10 @@ func TestMIDIMessageDecodeFromRegistry(t *testing.T) {
t.Fatalf("failed to create midi.message.decode processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("midi.message.decode processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "midi.message.decode" {
t.Fatalf("midi.message.decode processor has wrong type: %s", processorInstance.Type())
}
@@ -17,6 +17,7 @@ func TestMIDIMessageEncodeFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "midi.message.encode",
})
@@ -24,6 +25,10 @@ func TestMIDIMessageEncodeFromRegistry(t *testing.T) {
t.Fatalf("failed to create midi.message.encode processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("midi.message.encode processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "midi.message.encode" {
t.Fatalf("midi.message.encode processor has wrong type: %s", processorInstance.Type())
}
@@ -17,6 +17,7 @@ func TestMIDIMessageUnpackFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "midi.message.unpack",
})
@@ -24,6 +25,9 @@ func TestMIDIMessageUnpackFromRegistry(t *testing.T) {
t.Fatalf("failed to create midi.message.unpack processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("midi.message.unpack processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "midi.message.unpack" {
t.Fatalf("midi.message.unpack processor has wrong type: %s", processorInstance.Type())
}
@@ -17,6 +17,7 @@ func TestMIDINoteOffCreteaFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "midi.note_off.create",
Params: map[string]any{
"channel": "1",
@@ -28,6 +29,9 @@ func TestMIDINoteOffCreteaFromRegistry(t *testing.T) {
if err != nil {
t.Fatalf("failed to create midi.note_off.create processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("midi.note_off.create processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "midi.note_off.create" {
t.Fatalf("midi.note_off.create processor has wrong type: %s", processorInstance.Type())
@@ -17,6 +17,7 @@ func TestMIDINoteOnCreateFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "midi.note_on.create",
Params: map[string]any{
"channel": "1",
@@ -29,6 +30,10 @@ func TestMIDINoteOnCreateFromRegistry(t *testing.T) {
t.Fatalf("failed to create midi.note_on.create processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("midi.note_on.create processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "midi.note_on.create" {
t.Fatalf("midi.note_on.create processor has wrong type: %s", processorInstance.Type())
}
@@ -17,6 +17,7 @@ func TestMIDIProgramChangeCreateFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "midi.program_change.create",
Params: map[string]any{
"channel": "1",
@@ -28,6 +29,10 @@ func TestMIDIProgramChangeCreateFromRegistry(t *testing.T) {
t.Fatalf("failed to create midi.program_change.create processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("midi.program_change.create processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "midi.program_change.create" {
t.Fatalf("midi.program_change.create processor has wrong type: %s", processorInstance.Type())
}
@@ -17,6 +17,7 @@ func TestModuleOutputFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "module.output",
Params: config.Params{
"module": "test",
@@ -27,6 +28,10 @@ func TestModuleOutputFromRegistry(t *testing.T) {
t.Fatalf("failed to create module.output processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("module.output processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "module.output" {
t.Fatalf("module.output processor has wrong type: %s", processorInstance.Type())
}
@@ -17,6 +17,7 @@ func TestOSCMessageCreateFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "osc.message.create",
Params: map[string]any{
"address": "/test",
@@ -27,6 +28,10 @@ func TestOSCMessageCreateFromRegistry(t *testing.T) {
t.Fatalf("failed to create osc.message.create processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("osc.message.create processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "osc.message.create" {
t.Fatalf("osc.message.create processor has wrong type: %s", processorInstance.Type())
}
@@ -17,6 +17,7 @@ func TestOSCMessageDecodeFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "osc.message.decode",
})
@@ -24,6 +25,10 @@ func TestOSCMessageDecodeFromRegistry(t *testing.T) {
t.Fatalf("failed to create osc.message.decode processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("osc.message.decode processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "osc.message.decode" {
t.Fatalf("osc.message.decode processor has wrong type: %s", processorInstance.Type())
}
@@ -17,6 +17,7 @@ func TestOSCMessageEncodeFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "osc.message.encode",
})
@@ -24,6 +25,10 @@ func TestOSCMessageEncodeFromRegistry(t *testing.T) {
t.Fatalf("failed to create osc.message.encode processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("osc.message.encode processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "osc.message.encode" {
t.Fatalf("osc.message.encode processor has wrong type: %s", processorInstance.Type())
}
@@ -18,6 +18,7 @@ func TestPubSubPublishFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "pubsub.publish",
Params: map[string]any{
"module": "test",
@@ -28,6 +29,10 @@ func TestPubSubPublishFromRegistry(t *testing.T) {
t.Fatalf("failed to create pubsub.publish processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("pubsub.publish processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "pubsub.publish" {
t.Fatalf("pubsub.publish processor has wrong type: %s", processorInstance.Type())
}
@@ -17,6 +17,7 @@ func TestRouterInputFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "router.input",
Params: config.Params{
"source": "test",
@@ -27,6 +28,10 @@ func TestRouterInputFromRegistry(t *testing.T) {
t.Fatalf("failed to create router.input processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("router.input processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "router.input" {
t.Fatalf("router.input processor has wrong type: %s", processorInstance.Type())
}
@@ -15,6 +15,7 @@ func TestScriptExprFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "script.expr",
Params: map[string]any{
"expression": "foo + bar",
@@ -24,6 +25,10 @@ func TestScriptExprFromRegistry(t *testing.T) {
t.Fatalf("failed to create script.expr processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("script.expr processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "script.expr" {
t.Fatalf("script.expr processor has wrong type: %s", processorInstance.Type())
}
@@ -16,6 +16,7 @@ func TestScriptJSFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "script.js",
Params: map[string]any{
"program": `
@@ -27,6 +28,10 @@ func TestScriptJSFromRegistry(t *testing.T) {
t.Fatalf("failed to create script.js processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("script.js processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "script.js" {
t.Fatalf("script.js processor has wrong type: %s", processorInstance.Type())
}
@@ -17,6 +17,7 @@ func TestScriptWASMFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "script.wasm",
Params: map[string]any{
"path": "good.wasm",
@@ -26,6 +27,10 @@ func TestScriptWASMFromRegistry(t *testing.T) {
t.Fatalf("failed to create script.wasm processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("script.wasm processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "script.wasm" {
t.Fatalf("script.wasm processor has wrong type: %s", processorInstance.Type())
}
@@ -16,6 +16,7 @@ func TestSipResponseAudioCreateFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "sip.response.audio.create",
Params: map[string]any{
"preWait": 0,
@@ -28,6 +29,10 @@ func TestSipResponseAudioCreateFromRegistry(t *testing.T) {
t.Fatalf("failed to filter sip.response.audio.create processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("sip.response.audio.create processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "sip.response.audio.create" {
t.Fatalf("sip.response.audio.create processor has wrong type: %s", processorInstance.Type())
}
@@ -16,6 +16,7 @@ func TestSipResponseDTMFCreateFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "sip.response.dtmf.create",
Params: map[string]any{
"preWait": 0,
@@ -28,6 +29,10 @@ func TestSipResponseDTMFCreateFromRegistry(t *testing.T) {
t.Fatalf("failed to filter sip.response.dtmf.create processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("sip.response.dtmf.create processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "sip.response.dtmf.create" {
t.Fatalf("sip.response.dtmf.create processor has wrong type: %s", processorInstance.Type())
}
@@ -16,6 +16,7 @@ func TestStringCreateFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "string.create",
Params: map[string]any{
"template": "{{.Payload}}",
@@ -25,6 +26,10 @@ func TestStringCreateFromRegistry(t *testing.T) {
t.Fatalf("failed to create string.create processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("string.create processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "string.create" {
t.Fatalf("string.create processor has wrong type: %s", processorInstance.Type())
}
@@ -16,12 +16,17 @@ func TestStringDecodeFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "string.decode",
})
if err != nil {
t.Fatalf("failed to create string.decode processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("string.decode processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "string.decode" {
t.Fatalf("string.decode processor has wrong type: %s", processorInstance.Type())
}
@@ -17,12 +17,17 @@ func TestStringEncodeFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "string.encode",
})
if err != nil {
t.Fatalf("failed to create string.encode processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("string.encode processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "string.encode" {
t.Fatalf("string.encode processor has wrong type: %s", processorInstance.Type())
}
@@ -17,6 +17,7 @@ func TestStringSplitFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "string.split",
Params: map[string]any{
"separator": ",",
@@ -26,6 +27,10 @@ func TestStringSplitFromRegistry(t *testing.T) {
t.Fatalf("failed to create string.split processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("string.split processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "string.split" {
t.Fatalf("string.split processor has wrong type: %s", processorInstance.Type())
}
@@ -17,6 +17,7 @@ func TestStructFieldGetFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "struct.field.get",
Params: map[string]any{
"name": "Data",
@@ -26,6 +27,10 @@ func TestStructFieldGetFromRegistry(t *testing.T) {
t.Fatalf("failed to create struct.field.get processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("struct.field.get processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "struct.field.get" {
t.Fatalf("struct.field.get processor has wrong type: %s", processorInstance.Type())
}
@@ -17,6 +17,7 @@ func TestStructMethodGetFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "struct.method.get",
Params: map[string]any{
"name": "GetData",
@@ -26,6 +27,10 @@ func TestStructMethodGetFromRegistry(t *testing.T) {
t.Fatalf("failed to create struct.method.get processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("struct.method.get processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "struct.method.get" {
t.Fatalf("struct.method.get processor has wrong type: %s", processorInstance.Type())
}
@@ -15,6 +15,7 @@ func TestTimeSleepFromRegistry(t *testing.T) {
}
processorInstance, err := registration.New(config.ProcessorConfig{
Id: "test-id",
Type: "time.sleep",
Params: map[string]any{
"duration": 1000,
@@ -25,6 +26,10 @@ func TestTimeSleepFromRegistry(t *testing.T) {
t.Fatalf("failed to create time.sleep processor: %s", err)
}
if processorInstance.Id() != "test-id" {
t.Fatalf("time.sleep processor has wrong id: %s", processorInstance.Id())
}
if processorInstance.Type() != "time.sleep" {
t.Fatalf("time.sleep processor has wrong type: %s", processorInstance.Type())
}
+4
View File
@@ -49,6 +49,10 @@ func (ts *TimeSleep) Process(ctx context.Context, wrappedPayload common.WrappedP
return wrappedPayload, nil
}
func (ts *TimeSleep) Id() string {
return ts.config.Id
}
func (ts *TimeSleep) Type() string {
return ts.config.Type
}
+4
View File
@@ -9,6 +9,10 @@ import (
type TestProcessor struct {
}
func (p *TestProcessor) Id() string {
return "test-id"
}
func (p *TestProcessor) Type() string {
return "test"
}