diff --git a/activity/actreply/activity_test.go b/activity/actreply/activity_test.go index d8d3a1c8..b6f92bd2 100755 --- a/activity/actreply/activity_test.go +++ b/activity/actreply/activity_test.go @@ -66,7 +66,7 @@ func TestSimpleReply(t *testing.T) { func newActionContext() *test.TestActivityHost { input := map[string]data.TypedValue{"Input1": data.NewTypedValue(data.TypeString, "")} - output := map[string]data.TypedValue{"Output1": data.NewTypedValue(data.TypeString, "1"), "Output2": data.NewTypedValue(data.TypeInt, "2")} + output := map[string]data.TypedValue{"Output1": data.NewTypedValue(data.TypeString, ""), "Output2": data.NewTypedValue(data.TypeInt, "")} ac := &test.TestActivityHost{ HostId: "1", diff --git a/activity/actreply/descriptor.json b/activity/actreply/descriptor.json index a71c8132..bbd0a15b 100755 --- a/activity/actreply/descriptor.json +++ b/activity/actreply/descriptor.json @@ -5,11 +5,7 @@ "title": "Reply To Trigger", "description": "Replies to Trigger", "homepage": "https://github.com/project-flogo/contrib/tree/master/activity/actreply", -<<<<<<< Updated upstream "reply":true, -======= - "return":true, ->>>>>>> Stashed changes "settings":[ { "name": "mappings", diff --git a/activity/actreply/go.mod b/activity/actreply/go.mod new file mode 100644 index 00000000..5fcdf1a4 --- /dev/null +++ b/activity/actreply/go.mod @@ -0,0 +1,6 @@ +module github.com/project-flogo/contrib/activity/actreply + +require ( + github.com/project-flogo/core v0.9.0-alpha.6 + github.com/stretchr/testify v1.2.2 +) diff --git a/activity/actreply/go.sum b/activity/actreply/go.sum new file mode 100644 index 00000000..9f9f50ca --- /dev/null +++ b/activity/actreply/go.sum @@ -0,0 +1,18 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/project-flogo/core v0.9.0-alpha.6 h1:ugQmmE1WQ75gzHwFpIv7Wbt1wTqNmWj94J8t6sKdKPw= +github.com/project-flogo/core v0.9.0-alpha.6/go.mod h1:eB+hMcq51lOIeJ93K8Nvvm/vC3OI60ZaEgBbA4gtk8k= +github.com/square-it/jsonschema v1.9.1/go.mod h1:80WJHSuy3YnokzfFopfx+MAt5lVVnVpS6w2Avv+svHk= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= diff --git a/activity/actreturn/activity_test.go b/activity/actreturn/activity_test.go index 3c2e2782..a5273948 100755 --- a/activity/actreturn/activity_test.go +++ b/activity/actreturn/activity_test.go @@ -66,11 +66,11 @@ func TestSimpleReturn(t *testing.T) { func newActionContext() *test.TestActivityHost { input := map[string]data.TypedValue{"Input1": data.NewTypedValue(data.TypeString, "")} - output := map[string]data.TypedValue{"Output1": data.NewTypedValue(data.TypeString, "1"), "Output2": data.NewTypedValue(data.TypeInt, "2")} + output := map[string]data.TypedValue{"Output1": data.NewTypedValue(data.TypeString, ""), "Output2": data.NewTypedValue(data.TypeInt, "")} ac := &test.TestActivityHost{ HostId: "1", - HostRef: "github.com/project-flogo/flow", + HostRef: "github.com/TIBCOSoftware/flogo-contrib/action/flow", IoMetadata: &metadata.IOMetadata{Input: input, Output: output}, HostData: data.NewSimpleScope(nil, nil), } diff --git a/activity/actreturn/descriptor.json b/activity/actreturn/descriptor.json index 1c9f96de..32c28c4e 100755 --- a/activity/actreturn/descriptor.json +++ b/activity/actreturn/descriptor.json @@ -6,11 +6,7 @@ "description": "Return Activity", "homepage": "https://github.com/prject-flogo/contrib/tree/master/activity/actreturn", "return":true, -<<<<<<< Updated upstream "settings":[ -======= - "setting":[ ->>>>>>> Stashed changes { "name": "mappings", "type": "object", diff --git a/activity/actreturn/go.mod b/activity/actreturn/go.mod new file mode 100644 index 00000000..6cb5417d --- /dev/null +++ b/activity/actreturn/go.mod @@ -0,0 +1,6 @@ +module github.com/project-flogo/contrib/activity/actreturn + +require ( + github.com/project-flogo/core v0.9.0-alpha.6 + github.com/stretchr/testify v1.2.2 +) diff --git a/activity/actreturn/go.sum b/activity/actreturn/go.sum new file mode 100644 index 00000000..9f9f50ca --- /dev/null +++ b/activity/actreturn/go.sum @@ -0,0 +1,18 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/project-flogo/core v0.9.0-alpha.6 h1:ugQmmE1WQ75gzHwFpIv7Wbt1wTqNmWj94J8t6sKdKPw= +github.com/project-flogo/core v0.9.0-alpha.6/go.mod h1:eB+hMcq51lOIeJ93K8Nvvm/vC3OI60ZaEgBbA4gtk8k= +github.com/square-it/jsonschema v1.9.1/go.mod h1:80WJHSuy3YnokzfFopfx+MAt5lVVnVpS6w2Avv+svHk= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= diff --git a/activity/channel/go.mod b/activity/channel/go.mod new file mode 100644 index 00000000..e73998dc --- /dev/null +++ b/activity/channel/go.mod @@ -0,0 +1,6 @@ +module github.com/project-flogo/contrib/activity/channel + +require ( + github.com/project-flogo/core v0.9.0-alpha.6 + github.com/stretchr/testify v1.2.2 +) diff --git a/activity/channel/go.sum b/activity/channel/go.sum new file mode 100644 index 00000000..9f9f50ca --- /dev/null +++ b/activity/channel/go.sum @@ -0,0 +1,18 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/project-flogo/core v0.9.0-alpha.6 h1:ugQmmE1WQ75gzHwFpIv7Wbt1wTqNmWj94J8t6sKdKPw= +github.com/project-flogo/core v0.9.0-alpha.6/go.mod h1:eB+hMcq51lOIeJ93K8Nvvm/vC3OI60ZaEgBbA4gtk8k= +github.com/square-it/jsonschema v1.9.1/go.mod h1:80WJHSuy3YnokzfFopfx+MAt5lVVnVpS6w2Avv+svHk= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= diff --git a/activity/counter/go.mod b/activity/counter/go.mod new file mode 100644 index 00000000..5e61969d --- /dev/null +++ b/activity/counter/go.mod @@ -0,0 +1,6 @@ +module github.com/project-flogo/contrib/activity/counter + +require ( + github.com/project-flogo/core v0.9.0-alpha.6 + github.com/stretchr/testify v1.2.2 +) diff --git a/activity/counter/go.sum b/activity/counter/go.sum new file mode 100644 index 00000000..9f9f50ca --- /dev/null +++ b/activity/counter/go.sum @@ -0,0 +1,18 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/project-flogo/core v0.9.0-alpha.6 h1:ugQmmE1WQ75gzHwFpIv7Wbt1wTqNmWj94J8t6sKdKPw= +github.com/project-flogo/core v0.9.0-alpha.6/go.mod h1:eB+hMcq51lOIeJ93K8Nvvm/vC3OI60ZaEgBbA4gtk8k= +github.com/square-it/jsonschema v1.9.1/go.mod h1:80WJHSuy3YnokzfFopfx+MAt5lVVnVpS6w2Avv+svHk= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= diff --git a/activity/error/go.mod b/activity/error/go.mod new file mode 100644 index 00000000..db1dab42 --- /dev/null +++ b/activity/error/go.mod @@ -0,0 +1,6 @@ +module github.com/project-flogo/contrib/activity/error + +require ( + github.com/project-flogo/core v0.9.0-alpha.6 + github.com/stretchr/testify v1.2.2 +) diff --git a/activity/error/go.sum b/activity/error/go.sum new file mode 100644 index 00000000..9f9f50ca --- /dev/null +++ b/activity/error/go.sum @@ -0,0 +1,18 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/project-flogo/core v0.9.0-alpha.6 h1:ugQmmE1WQ75gzHwFpIv7Wbt1wTqNmWj94J8t6sKdKPw= +github.com/project-flogo/core v0.9.0-alpha.6/go.mod h1:eB+hMcq51lOIeJ93K8Nvvm/vC3OI60ZaEgBbA4gtk8k= +github.com/square-it/jsonschema v1.9.1/go.mod h1:80WJHSuy3YnokzfFopfx+MAt5lVVnVpS6w2Avv+svHk= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= diff --git a/activity/log/go.mod b/activity/log/go.mod new file mode 100644 index 00000000..15213a35 --- /dev/null +++ b/activity/log/go.mod @@ -0,0 +1,6 @@ +module github.com/project-flogo/contrib/activity/log + +require ( + github.com/project-flogo/core v0.9.0-alpha.6 + github.com/stretchr/testify v1.2.2 +) diff --git a/activity/log/go.sum b/activity/log/go.sum new file mode 100644 index 00000000..9f9f50ca --- /dev/null +++ b/activity/log/go.sum @@ -0,0 +1,18 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/project-flogo/core v0.9.0-alpha.6 h1:ugQmmE1WQ75gzHwFpIv7Wbt1wTqNmWj94J8t6sKdKPw= +github.com/project-flogo/core v0.9.0-alpha.6/go.mod h1:eB+hMcq51lOIeJ93K8Nvvm/vC3OI60ZaEgBbA4gtk8k= +github.com/square-it/jsonschema v1.9.1/go.mod h1:80WJHSuy3YnokzfFopfx+MAt5lVVnVpS6w2Avv+svHk= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= diff --git a/activity/mapper/activity_test.go b/activity/mapper/activity_test.go index 83510810..39a685ad 100755 --- a/activity/mapper/activity_test.go +++ b/activity/mapper/activity_test.go @@ -36,9 +36,8 @@ func TestSimpleMapper(t *testing.T) { } settings := map[string]interface{}{"mappings": mappings} - mf := mapper.NewFactory(resolve.GetBasicResolver()) - iCtx := test.NewActivityInitContext(settings, mf) - act, err := New(iCtx) + + act, err := New(settings) assert.Nil(t, err) ah := newActivityHost() @@ -56,7 +55,7 @@ func TestSimpleMapper(t *testing.T) { o2, exists2 := ah.HostData.GetValue("Output2") assert.True(t, exists2, "Output2 not set") if exists2 { - assert.Equal(t, 2.0, o2) + assert.Equal(t, 2, o2) } } @@ -66,7 +65,7 @@ func newActivityHost() *test.TestActivityHost { ac := &test.TestActivityHost{ HostId: "1", - HostRef: "github.com/project-flogo/flow", + HostRef: "github.com/TIBCOSoftware/flogo-contrib/action/flow", IoMetadata: &metadata.IOMetadata{Input: input, Output: output}, HostData: data.NewSimpleScope(nil, nil), } diff --git a/activity/mapper/go.mod b/activity/mapper/go.mod new file mode 100644 index 00000000..f22c4e66 --- /dev/null +++ b/activity/mapper/go.mod @@ -0,0 +1,6 @@ +module github.com/project-flogo/contrib/activity/mapper + +require ( + github.com/project-flogo/core v0.9.0-alpha.6 + github.com/stretchr/testify v1.2.2 +) diff --git a/activity/mapper/go.sum b/activity/mapper/go.sum new file mode 100644 index 00000000..9f9f50ca --- /dev/null +++ b/activity/mapper/go.sum @@ -0,0 +1,18 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/project-flogo/core v0.9.0-alpha.6 h1:ugQmmE1WQ75gzHwFpIv7Wbt1wTqNmWj94J8t6sKdKPw= +github.com/project-flogo/core v0.9.0-alpha.6/go.mod h1:eB+hMcq51lOIeJ93K8Nvvm/vC3OI60ZaEgBbA4gtk8k= +github.com/square-it/jsonschema v1.9.1/go.mod h1:80WJHSuy3YnokzfFopfx+MAt5lVVnVpS6w2Avv+svHk= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= diff --git a/activity/noop/go.mod b/activity/noop/go.mod new file mode 100644 index 00000000..8abbf1c1 --- /dev/null +++ b/activity/noop/go.mod @@ -0,0 +1,6 @@ +module github.com/project-flogo/contrib/activity/noop + +require ( + github.com/project-flogo/core v0.9.0-alpha.6 + github.com/stretchr/testify v1.2.2 +) diff --git a/activity/noop/go.sum b/activity/noop/go.sum new file mode 100644 index 00000000..9f9f50ca --- /dev/null +++ b/activity/noop/go.sum @@ -0,0 +1,18 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/project-flogo/core v0.9.0-alpha.6 h1:ugQmmE1WQ75gzHwFpIv7Wbt1wTqNmWj94J8t6sKdKPw= +github.com/project-flogo/core v0.9.0-alpha.6/go.mod h1:eB+hMcq51lOIeJ93K8Nvvm/vC3OI60ZaEgBbA4gtk8k= +github.com/square-it/jsonschema v1.9.1/go.mod h1:80WJHSuy3YnokzfFopfx+MAt5lVVnVpS6w2Avv+svHk= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= diff --git a/activity/rest/activity_test.go b/activity/rest/activity_test.go index 13815153..f4137de7 100644 --- a/activity/rest/activity_test.go +++ b/activity/rest/activity_test.go @@ -1,6 +1,7 @@ package rest import ( + "encoding/json" "fmt" "github.com/project-flogo/core/activity" "github.com/project-flogo/core/data/mapper" @@ -64,11 +65,14 @@ func TestSimplePost(t *testing.T) { //eval act.Eval(tc) - output := &Output{} - tc.GetOutputObject(output) + val := tc.GetOutput("result") + + fmt.Printf("result: %v\n", val) - assert.Equal(t, http.StatusOK, output.Status) + res := val.(map[string]interface{}) + petID = res["id"].(json.Number).String() + fmt.Println("petID:", petID) } func TestSimpleGet(t *testing.T) { @@ -84,9 +88,9 @@ func TestSimpleGet(t *testing.T) { //eval act.Eval(tc) - output := &Output{} - tc.GetOutputObject(output) - assert.Equal(t, http.StatusNotFound, output.Status) + + val := tc.GetOutput("result") + fmt.Printf("result: %v\n", val) } func TestSimpleGetWithHeaders(t *testing.T) { @@ -107,9 +111,8 @@ func TestSimpleGetWithHeaders(t *testing.T) { //eval act.Eval(tc) - output := &Output{} - tc.GetOutputObject(output) - assert.Equal(t, http.StatusOK, output.Status) + val := tc.GetOutput("result") + fmt.Printf("result: %v\n", val) } func TestParamGet(t *testing.T) { @@ -131,9 +134,8 @@ func TestParamGet(t *testing.T) { //eval act.Eval(tc) - output := &Output{} - tc.GetOutputObject(output) - //assert.Equal(t, 200, output.Status) + val := tc.GetOutput("result") + fmt.Printf("result: %v\n", val) } //func TestSimpleGetWithProxy(t *testing.T) { diff --git a/activity/rest/go.mod b/activity/rest/go.mod new file mode 100644 index 00000000..4e49ef6b --- /dev/null +++ b/activity/rest/go.mod @@ -0,0 +1,6 @@ +module github.com/project-flogo/contrib/activity/rest + +require ( + github.com/project-flogo/core v0.9.0-alpha.6 + github.com/stretchr/testify v1.2.2 +) diff --git a/activity/rest/go.sum b/activity/rest/go.sum new file mode 100644 index 00000000..9f9f50ca --- /dev/null +++ b/activity/rest/go.sum @@ -0,0 +1,18 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/project-flogo/core v0.9.0-alpha.6 h1:ugQmmE1WQ75gzHwFpIv7Wbt1wTqNmWj94J8t6sKdKPw= +github.com/project-flogo/core v0.9.0-alpha.6/go.mod h1:eB+hMcq51lOIeJ93K8Nvvm/vC3OI60ZaEgBbA4gtk8k= +github.com/square-it/jsonschema v1.9.1/go.mod h1:80WJHSuy3YnokzfFopfx+MAt5lVVnVpS6w2Avv+svHk= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= diff --git a/function/all.go b/function/all.go index 3b9b779b..ffbb3d85 100644 --- a/function/all.go +++ b/function/all.go @@ -1,6 +1,7 @@ package function import ( + _ "github.com/project-flogo/contrib/function/coerce" _ "github.com/project-flogo/contrib/function/json" _ "github.com/project-flogo/contrib/function/number" _ "github.com/project-flogo/contrib/function/string" diff --git a/function/coerce/compound.go b/function/coerce/compound.go new file mode 100644 index 00000000..2efdc108 --- /dev/null +++ b/function/coerce/compound.go @@ -0,0 +1,48 @@ +package coerce + +import ( + "github.com/project-flogo/core/data/coerce" + "github.com/project-flogo/core/data/expression/function" +) + +func init() { + function.Register(&fnToParams{}) + function.Register(&fnToObject{}) + function.Register(&fnToArray{}) +} + +type fnToParams struct { + *baseFn +} + +func (*fnToParams) Name() string { + return "toParams" +} + +func (*fnToParams) Eval(params ...interface{}) (interface{}, error) { + return coerce.ToParams(params[0]) +} + +type fnToObject struct { + *baseFn +} + +func (*fnToObject) Name() string { + return "toObject" +} + +func (*fnToObject) Eval(params ...interface{}) (interface{}, error) { + return coerce.ToObject(params[0]) +} + +type fnToArray struct { + *baseFn +} + +func (*fnToArray) Name() string { + return "toArray" +} + +func (*fnToArray) Eval(params ...interface{}) (interface{}, error) { + return coerce.ToArray(params[0]) +} diff --git a/function/coerce/corece.go b/function/coerce/corece.go new file mode 100644 index 00000000..a8cf16a6 --- /dev/null +++ b/function/coerce/corece.go @@ -0,0 +1,49 @@ +package coerce + +import ( + "fmt" + + "github.com/project-flogo/core/data" + "github.com/project-flogo/core/data/coerce" + "github.com/project-flogo/core/data/expression/function" +) + +func init() { + function.Register(&fnToType{}) +} + +type baseFn struct { +} + +func (*baseFn) Sig() (paramTypes []data.Type, isVariadic bool) { + return []data.Type{data.TypeAny}, false +} + +type fnToType struct { +} + +func (*fnToType) Name() string { + return "toType" +} + +func (*fnToType) Sig() (paramTypes []data.Type, isVariadic bool) { + return []data.Type{data.TypeAny, data.TypeString}, false +} + +func (*fnToType) Eval(params ...interface{}) (interface{}, error) { + if len(params) < 2 { + return nil, fmt.Errorf("missing params, signature is toType(any,string)") + } + + typeStr, ok := params[1].(string) + if !ok { + return nil, fmt.Errorf("senond param must be a string") + } + + t, err := data.ToTypeEnum(typeStr) + if err != nil { + return nil, err + } + + return coerce.ToType(params[0], t) +} diff --git a/function/coerce/descriptor.json b/function/coerce/descriptor.json new file mode 100644 index 00000000..a1cd3928 --- /dev/null +++ b/function/coerce/descriptor.json @@ -0,0 +1,134 @@ +{ + "name": "coerce", + "type": "flogo:function", + "version": "0.0.1", + "title": "Coerce Type Functions", + "description": "Function for type coercion/conversion", + "homepage": "https://github.com/prject-flogo/contrib/tree/master/function/coerce", + "functions": [ + { + "name": "toType", + "description": "convert value to specified type", + "args": [ + { + "name": "value", + "type": "any" + }, + { + "name": "type", + "type": "string" + } + ] + }, + { + "name": "toString", + "description": "convert value to a string", + "args": [ + { + "name": "value", + "type": "any" + } + ] + }, + { + "name": "toInt", + "description": "convert value to an int", + "args": [ + { + "name": "value", + "type": "any" + } + ] + }, + { + "name": "toInt32", + "description": "convert value to an int32", + "args": [ + { + "name": "value", + "type": "any" + } + ] + }, + { + "name": "toInt64", + "description": "convert value to a int64", + "args": [ + { + "name": "value", + "type": "any" + } + ] + }, + { + "name": "toFloat32", + "description": "convert value to a float32", + "args": [ + { + "name": "value", + "type": "any" + } + ] + }, + { + "name": "toFloat64", + "description": "convert value to a float64", + "args": [ + { + "name": "value", + "type": "any" + } + ] + }, + { + "name": "toBool", + "description": "convert value to a bool", + "args": [ + { + "name": "value", + "type": "any" + } + ] + }, + { + "name": "toBytes", + "description": "convert value to bytes", + "args": [ + { + "name": "value", + "type": "any" + } + ] + }, + { + "name": "toParams", + "description": "convert value to params", + "args": [ + { + "name": "value", + "type": "any" + } + ] + }, + { + "name": "toObject", + "description": "convert value to an object", + "args": [ + { + "name": "value", + "type": "any" + } + ] + }, + { + "name": "toArray", + "description": "convert value to an array", + "args": [ + { + "name": "value", + "type": "any" + } + ] + } + ] +} diff --git a/function/coerce/go.mod b/function/coerce/go.mod new file mode 100644 index 00000000..233c6205 --- /dev/null +++ b/function/coerce/go.mod @@ -0,0 +1,3 @@ +module github.com/project-flogo/contrib/function/coerce + +require github.com/project-flogo/core v0.9.0-alpha.6 diff --git a/function/coerce/go.sum b/function/coerce/go.sum new file mode 100644 index 00000000..447016ca --- /dev/null +++ b/function/coerce/go.sum @@ -0,0 +1,11 @@ +github.com/project-flogo/core v0.9.0-alpha.6 h1:ugQmmE1WQ75gzHwFpIv7Wbt1wTqNmWj94J8t6sKdKPw= +github.com/project-flogo/core v0.9.0-alpha.6/go.mod h1:eB+hMcq51lOIeJ93K8Nvvm/vC3OI60ZaEgBbA4gtk8k= +github.com/square-it/jsonschema v1.9.1/go.mod h1:80WJHSuy3YnokzfFopfx+MAt5lVVnVpS6w2Avv+svHk= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= diff --git a/function/coerce/primatives.go b/function/coerce/primatives.go new file mode 100644 index 00000000..d61cfbef --- /dev/null +++ b/function/coerce/primatives.go @@ -0,0 +1,113 @@ +package coerce + +import ( + "github.com/project-flogo/core/data/coerce" + "github.com/project-flogo/core/data/expression/function" +) + +func init() { + function.Register(&fnToString{}) + function.Register(&fnToInt{}) + function.Register(&fnToInt32{}) + function.Register(&fnToInt64{}) + function.Register(&fnToFloat32{}) + function.Register(&fnToFloat64{}) + function.Register(&fnToBool{}) + function.Register(&fnToBytes{}) +} + +type fnToString struct { + *baseFn +} + +func (*fnToString) Name() string { + return "toString" +} + +func (*fnToString) Eval(params ...interface{}) (interface{}, error) { + return coerce.ToString(params[0]) +} + +type fnToInt struct { + *baseFn +} + +func (*fnToInt) Name() string { + return "toString" +} + +func (*fnToInt) Eval(params ...interface{}) (interface{}, error) { + return coerce.ToInt(params[0]) +} + +type fnToInt32 struct { + *baseFn +} + +func (*fnToInt32) Name() string { + return "toInt32" +} + +func (*fnToInt32) Eval(params ...interface{}) (interface{}, error) { + return coerce.ToInt32(params[0]) +} + +type fnToInt64 struct { + *baseFn +} + +func (*fnToInt64) Name() string { + return "toInt64" +} + +func (*fnToInt64) Eval(params ...interface{}) (interface{}, error) { + return coerce.ToInt64(params[0]) +} + +type fnToFloat32 struct { + *baseFn +} + +func (*fnToFloat32) Name() string { + return "toFloat32" +} + +func (*fnToFloat32) Eval(params ...interface{}) (interface{}, error) { + return coerce.ToFloat32(params[0]) +} + +type fnToFloat64 struct { + *baseFn +} + +func (*fnToFloat64) Name() string { + return "toFloat64" +} + +func (*fnToFloat64) Eval(params ...interface{}) (interface{}, error) { + return coerce.ToFloat64(params[0]) +} + +type fnToBool struct { + *baseFn +} + +func (*fnToBool) Name() string { + return "toBool" +} + +func (*fnToBool) Eval(params ...interface{}) (interface{}, error) { + return coerce.ToBool(params[0]) +} + +type fnToBytes struct { + *baseFn +} + +func (*fnToBytes) Name() string { + return "toBytes" +} + +func (*fnToBytes) Eval(params ...interface{}) (interface{}, error) { + return coerce.ToBytes(params[0]) +} diff --git a/function/go.mod b/function/go.mod new file mode 100644 index 00000000..4283403e --- /dev/null +++ b/function/go.mod @@ -0,0 +1 @@ +module github.com/project-flogo/contrib/function diff --git a/function/go.sum b/function/go.sum new file mode 100644 index 00000000..e69de29b diff --git a/function/json/descriptor.json b/function/json/descriptor.json index b095be4f..8ea07b7a 100644 --- a/function/json/descriptor.json +++ b/function/json/descriptor.json @@ -7,7 +7,7 @@ "homepage": "https://github.com/prject-flogo/contrib/tree/master/function/json", "functions": [ { - "name": "json.path", + "name": "path", "description": "apply a json path to an object", "args": [ { diff --git a/function/json/go.mod b/function/json/go.mod new file mode 100644 index 00000000..968af883 --- /dev/null +++ b/function/json/go.mod @@ -0,0 +1,7 @@ +module github.com/project-flogo/contrib/function/json + +require ( + github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852 + github.com/project-flogo/core v0.9.0-alpha.6 + github.com/stretchr/testify v1.2.2 +) diff --git a/function/json/go.sum b/function/json/go.sum new file mode 100644 index 00000000..2e5d592b --- /dev/null +++ b/function/json/go.sum @@ -0,0 +1,20 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852 h1:Yl0tPBa8QPjGmesFh1D0rDy+q1Twx6FyU7VWHi8wZbI= +github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852/go.mod h1:eqOVx5Vwu4gd2mmMZvVZsgIqNSaW3xxRThUJ0k/TPk4= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/project-flogo/core v0.9.0-alpha.6 h1:ugQmmE1WQ75gzHwFpIv7Wbt1wTqNmWj94J8t6sKdKPw= +github.com/project-flogo/core v0.9.0-alpha.6/go.mod h1:eB+hMcq51lOIeJ93K8Nvvm/vC3OI60ZaEgBbA4gtk8k= +github.com/square-it/jsonschema v1.9.1/go.mod h1:80WJHSuy3YnokzfFopfx+MAt5lVVnVpS6w2Avv+svHk= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= diff --git a/function/json/path.go b/function/json/path.go index 37404e02..dc057423 100644 --- a/function/json/path.go +++ b/function/json/path.go @@ -15,7 +15,7 @@ type fnPath struct { // Name returns the name of the function func (fnPath) Name() string { - return "json.path" + return "path" } // Sig returns the function signature diff --git a/function/number/descriptor.json b/function/number/descriptor.json index 985e54d5..bb698ce6 100644 --- a/function/number/descriptor.json +++ b/function/number/descriptor.json @@ -7,7 +7,7 @@ "homepage": "https://github.com/prject-flogo/contrib/tree/master/function/number", "functions": [ { - "name": "number.random", + "name": "random", "description": "generate a random number", "varArgs": true, "args": [ diff --git a/function/number/go.mod b/function/number/go.mod new file mode 100644 index 00000000..578a9b94 --- /dev/null +++ b/function/number/go.mod @@ -0,0 +1,3 @@ +module github.com/project-flogo/contrib/function/number + +require github.com/project-flogo/core v0.9.0-alpha.6 diff --git a/function/number/go.sum b/function/number/go.sum new file mode 100644 index 00000000..9f9f50ca --- /dev/null +++ b/function/number/go.sum @@ -0,0 +1,18 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/project-flogo/core v0.9.0-alpha.6 h1:ugQmmE1WQ75gzHwFpIv7Wbt1wTqNmWj94J8t6sKdKPw= +github.com/project-flogo/core v0.9.0-alpha.6/go.mod h1:eB+hMcq51lOIeJ93K8Nvvm/vC3OI60ZaEgBbA4gtk8k= +github.com/square-it/jsonschema v1.9.1/go.mod h1:80WJHSuy3YnokzfFopfx+MAt5lVVnVpS6w2Avv+svHk= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= diff --git a/function/string/concat.go b/function/string/concat.go index 5f320f6b..f68bc6f2 100644 --- a/function/string/concat.go +++ b/function/string/concat.go @@ -16,7 +16,7 @@ type fnConcat struct { } func (fnConcat) Name() string { - return "string.concat" + return "concat" } func (fnConcat) Sig() (paramTypes []data.Type, isVariadic bool) { diff --git a/function/string/contains.go b/function/string/contains.go new file mode 100644 index 00000000..e07db350 --- /dev/null +++ b/function/string/contains.go @@ -0,0 +1,29 @@ +package string + +import ( + "strings" + + "github.com/project-flogo/core/data" + "github.com/project-flogo/core/data/expression/function" +) + +type fnContains struct { +} + +func init() { + function.Register(&fnContains{}) +} + +func (s *fnContains) Name() string { + return "contains" +} + +func (fnContains) Sig() (paramTypes []data.Type, isVariadic bool) { + return []data.Type{data.TypeString, data.TypeString}, false +} + +func (fnContains) Eval(params ...interface{}) (interface{}, error) { + str1 := params[0].(string) + str2 := params[1].(string) + return strings.Contains(str1, str2), nil +} diff --git a/function/string/contains_test.go b/function/string/contains_test.go new file mode 100644 index 00000000..3598a2d0 --- /dev/null +++ b/function/string/contains_test.go @@ -0,0 +1,20 @@ +package string + +import ( + "testing" + + "github.com/project-flogo/core/data/expression/function" + "github.com/stretchr/testify/assert" +) + +func TestFnContains_Eval(t *testing.T) { + f := &fnContains{} + + v, err := function.Eval(f, "foo", "Bar") + assert.Nil(t, err) + assert.False(t, v.(bool)) + + v, err = function.Eval(f, "foobar", "foo") + assert.Nil(t, err) + assert.True(t, v.(bool)) +} diff --git a/function/string/descriptor.json b/function/string/descriptor.json index 8a0ad468..54b66cdf 100644 --- a/function/string/descriptor.json +++ b/function/string/descriptor.json @@ -7,7 +7,7 @@ "homepage": "https://github.com/project-flogo/contrib/tree/master/function/string", "functions": [ { - "name": "string.concat", + "name": "concat", "description": "concatenate a set of string", "varArgs": true, "args": [ @@ -18,7 +18,7 @@ ] }, { - "name": "string.equals", + "name": "equals", "description": "check if two strings are equal", "args": [ { @@ -32,7 +32,7 @@ ] }, { - "name": "string.equalsIgnoreCase", + "name": "equalsIgnoreCase", "description": "check if two strings are equal ignoring case", "args": [ { @@ -46,7 +46,21 @@ ] }, { - "name": "string.float", + "name": "contains", + "description": "check if str2 is within str1", + "args": [ + { + "name": "str1", + "type": "string" + }, + { + "name": "str2", + "type": "string" + } + ] + }, + { + "name": "float", "description": "convert the string to a float", "args": [ { @@ -56,7 +70,7 @@ ] }, { - "name": "string.integer", + "name": "integer", "description": "convert the string to an integer", "args": [ { @@ -66,7 +80,7 @@ ] }, { - "name": "string.len", + "name": "len", "description": "get the length of a string", "args": [ { @@ -76,7 +90,7 @@ ] }, { - "name": "string.substring", + "name": "substring", "description": "get a substring from a string", "args": [ { diff --git a/function/string/equals.go b/function/string/equals.go index deea136e..0f6ea06b 100644 --- a/function/string/equals.go +++ b/function/string/equals.go @@ -13,7 +13,7 @@ type fnEquals struct { } func (fnEquals) Name() string { - return "string.equals" + return "equals" } func (fnEquals) Sig() (paramTypes []data.Type, isVariadic bool) { diff --git a/function/string/equalsignorecase.go b/function/string/equalsignorecase.go index dc86fc8b..46bd2315 100644 --- a/function/string/equalsignorecase.go +++ b/function/string/equalsignorecase.go @@ -15,7 +15,7 @@ func init() { } func (s *fnEqualsIgnoreCase) Name() string { - return "string.equalsIgnoreCase" + return "equalsIgnoreCase" } func (fnEqualsIgnoreCase) Sig() (paramTypes []data.Type, isVariadic bool) { diff --git a/function/string/float.go b/function/string/float.go index 41629e0a..c2c0a7d9 100644 --- a/function/string/float.go +++ b/function/string/float.go @@ -16,7 +16,7 @@ type fnFloat struct { // Name returns the name of the function func (fnFloat) Name() string { - return "string.float" + return "float" } // Sig returns the function signature diff --git a/function/string/go.mod b/function/string/go.mod new file mode 100644 index 00000000..ec65d87c --- /dev/null +++ b/function/string/go.mod @@ -0,0 +1,6 @@ +module github.com/project-flogo/contrib/function/string + +require ( + github.com/project-flogo/core v0.9.0-alpha.6 + github.com/stretchr/testify v1.2.2 +) diff --git a/function/string/go.sum b/function/string/go.sum new file mode 100644 index 00000000..9f9f50ca --- /dev/null +++ b/function/string/go.sum @@ -0,0 +1,18 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/project-flogo/core v0.9.0-alpha.6 h1:ugQmmE1WQ75gzHwFpIv7Wbt1wTqNmWj94J8t6sKdKPw= +github.com/project-flogo/core v0.9.0-alpha.6/go.mod h1:eB+hMcq51lOIeJ93K8Nvvm/vC3OI60ZaEgBbA4gtk8k= +github.com/square-it/jsonschema v1.9.1/go.mod h1:80WJHSuy3YnokzfFopfx+MAt5lVVnVpS6w2Avv+svHk= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= diff --git a/function/string/integer.go b/function/string/integer.go index b06154d8..9047c40f 100644 --- a/function/string/integer.go +++ b/function/string/integer.go @@ -16,7 +16,7 @@ type fnInteger struct { // Name returns the name of the function func (fnInteger) Name() string { - return "string.integer" + return "integer" } // Sig returns the function signature diff --git a/function/string/len.go b/function/string/len.go index 8b25cbc3..5aad4c18 100644 --- a/function/string/len.go +++ b/function/string/len.go @@ -13,7 +13,7 @@ type fnLen struct { } func (fnLen) Name() string { - return "string.len" + return "len" } func (fnLen) Sig() (paramTypes []data.Type, isVariadic bool) { diff --git a/function/string/substring.go b/function/string/substring.go index e4ae39c3..baef20bd 100644 --- a/function/string/substring.go +++ b/function/string/substring.go @@ -15,7 +15,7 @@ type fnSubstring struct { } func (fnSubstring) Name() string { - return "string.substring" + return "substring" } func (fnSubstring) Sig() (paramTypes []data.Type, isVariadic bool) { diff --git a/go.mod b/go.mod index cb17058b..29dfaa7b 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1 @@ module github.com/project-flogo/contrib - -require ( - github.com/carlescere/scheduler v0.0.0-20170109141437-ee74d2f83d82 - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/julienschmidt/httprouter v1.2.0 - github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852 - github.com/project-flogo/core v0.9.0-alpha.4.0.20190213174534-066cf88d3782 - github.com/stretchr/objx v0.1.1 // indirect - github.com/stretchr/testify v1.3.0 -) diff --git a/go.sum b/go.sum deleted file mode 100644 index 487110b8..00000000 --- a/go.sum +++ /dev/null @@ -1,32 +0,0 @@ -github.com/carlescere/scheduler v0.0.0-20170109141437-ee74d2f83d82 h1:9bAydALqAjBfPHd/eAiJBHnMZUYov8m2PkXVr+YGQeI= -github.com/carlescere/scheduler v0.0.0-20170109141437-ee74d2f83d82/go.mod h1:tyA14J0sA3Hph4dt+AfCjPrYR13+vVodshQSM7km9qw= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/julienschmidt/httprouter v1.2.0 h1:TDTW5Yz1mjftljbcKqRcrYhd4XeOoI98t+9HbQbYf7g= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852 h1:Yl0tPBa8QPjGmesFh1D0rDy+q1Twx6FyU7VWHi8wZbI= -github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852/go.mod h1:eqOVx5Vwu4gd2mmMZvVZsgIqNSaW3xxRThUJ0k/TPk4= -github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/project-flogo/core v0.9.0-alpha.3 h1:G7ToVpdoRthE9BhefJWVL1yy+FxhLbA78kbP2EbWx2k= -github.com/project-flogo/core v0.9.0-alpha.3/go.mod h1:BHeB55AxPhvlNGd+it50rE977ag6xE3bD2RluSDeKBA= -github.com/project-flogo/core v0.9.0-alpha.4 h1:ny3yB8vMBRXxIXuk3V2DYxVDUN6HlqUQA70yWVWHCS0= -github.com/project-flogo/core v0.9.0-alpha.4/go.mod h1:BHeB55AxPhvlNGd+it50rE977ag6xE3bD2RluSDeKBA= -github.com/project-flogo/core v0.9.0-alpha.4.0.20190213174534-066cf88d3782 h1:4ODKDIruYifAibvaxOxgDKyP1alTSo0HOuyUiG/mAJM= -github.com/project-flogo/core v0.9.0-alpha.4.0.20190213174534-066cf88d3782/go.mod h1:Dof6t60n/nvN7aPpoUz97JL+VIKdsYMbhqwN++WCdz8= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4= -go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o= -go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= diff --git a/trigger/channel/go.mod b/trigger/channel/go.mod new file mode 100644 index 00000000..0bd48526 --- /dev/null +++ b/trigger/channel/go.mod @@ -0,0 +1,3 @@ +module github.com/project-flogo/contrib/trigger/channel + +require github.com/project-flogo/core v0.9.0-alpha.6 diff --git a/trigger/channel/go.sum b/trigger/channel/go.sum new file mode 100644 index 00000000..9f9f50ca --- /dev/null +++ b/trigger/channel/go.sum @@ -0,0 +1,18 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/project-flogo/core v0.9.0-alpha.6 h1:ugQmmE1WQ75gzHwFpIv7Wbt1wTqNmWj94J8t6sKdKPw= +github.com/project-flogo/core v0.9.0-alpha.6/go.mod h1:eB+hMcq51lOIeJ93K8Nvvm/vC3OI60ZaEgBbA4gtk8k= +github.com/square-it/jsonschema v1.9.1/go.mod h1:80WJHSuy3YnokzfFopfx+MAt5lVVnVpS6w2Avv+svHk= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= diff --git a/trigger/cli/go.mod b/trigger/cli/go.mod new file mode 100644 index 00000000..d9db773f --- /dev/null +++ b/trigger/cli/go.mod @@ -0,0 +1,3 @@ +module github.com/project-flogo/contrib/trigger/cli + +require github.com/project-flogo/core v0.9.0-alpha.6 diff --git a/trigger/cli/go.sum b/trigger/cli/go.sum new file mode 100644 index 00000000..1f44d916 --- /dev/null +++ b/trigger/cli/go.sum @@ -0,0 +1,20 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/project-flogo/core v0.9.0-alpha.6 h1:ugQmmE1WQ75gzHwFpIv7Wbt1wTqNmWj94J8t6sKdKPw= +github.com/project-flogo/core v0.9.0-alpha.6/go.mod h1:eB+hMcq51lOIeJ93K8Nvvm/vC3OI60ZaEgBbA4gtk8k= +github.com/square-it/jsonschema v1.9.1/go.mod h1:80WJHSuy3YnokzfFopfx+MAt5lVVnVpS6w2Avv+svHk= +github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= diff --git a/trigger/cli/trigger_test.go b/trigger/cli/trigger_test.go index 7b9a738c..1b4ec504 100644 --- a/trigger/cli/trigger_test.go +++ b/trigger/cli/trigger_test.go @@ -7,7 +7,7 @@ import ( var jsonTestMetadata = getTestJsonMetadata() func getTestJsonMetadata() string { - jsonMetadataBytes, err := ioutil.ReadFile("./examples/single/flogo-single-cli.json") + jsonMetadataBytes, err := ioutil.ReadFile("trigger.json") if err != nil { panic("No Json Metadata found for trigger.json path") } diff --git a/trigger/loadtester/go.mod b/trigger/loadtester/go.mod new file mode 100644 index 00000000..ef5fbd3c --- /dev/null +++ b/trigger/loadtester/go.mod @@ -0,0 +1,3 @@ +module github.com/project-flogo/contrib/trigger/loadtester + +require github.com/project-flogo/core v0.9.0-alpha.6 diff --git a/trigger/loadtester/go.sum b/trigger/loadtester/go.sum new file mode 100644 index 00000000..9f9f50ca --- /dev/null +++ b/trigger/loadtester/go.sum @@ -0,0 +1,18 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/project-flogo/core v0.9.0-alpha.6 h1:ugQmmE1WQ75gzHwFpIv7Wbt1wTqNmWj94J8t6sKdKPw= +github.com/project-flogo/core v0.9.0-alpha.6/go.mod h1:eB+hMcq51lOIeJ93K8Nvvm/vC3OI60ZaEgBbA4gtk8k= +github.com/square-it/jsonschema v1.9.1/go.mod h1:80WJHSuy3YnokzfFopfx+MAt5lVVnVpS6w2Avv+svHk= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= diff --git a/trigger/rest/go.mod b/trigger/rest/go.mod new file mode 100644 index 00000000..bbe238d7 --- /dev/null +++ b/trigger/rest/go.mod @@ -0,0 +1,7 @@ +module github.com/project-flogo/contrib/trigger/rest + +require ( + github.com/julienschmidt/httprouter v1.2.0 + github.com/project-flogo/core v0.9.0-alpha.6 + github.com/stretchr/testify v1.2.2 +) diff --git a/trigger/rest/go.sum b/trigger/rest/go.sum new file mode 100644 index 00000000..89c94a64 --- /dev/null +++ b/trigger/rest/go.sum @@ -0,0 +1,22 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/julienschmidt/httprouter v1.2.0 h1:TDTW5Yz1mjftljbcKqRcrYhd4XeOoI98t+9HbQbYf7g= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/project-flogo/core v0.9.0-alpha.6 h1:ugQmmE1WQ75gzHwFpIv7Wbt1wTqNmWj94J8t6sKdKPw= +github.com/project-flogo/core v0.9.0-alpha.6/go.mod h1:eB+hMcq51lOIeJ93K8Nvvm/vC3OI60ZaEgBbA4gtk8k= +github.com/square-it/jsonschema v1.9.1/go.mod h1:80WJHSuy3YnokzfFopfx+MAt5lVVnVpS6w2Avv+svHk= +github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= diff --git a/trigger/rest/metadata.go b/trigger/rest/metadata.go index 536565c4..42c733a9 100644 --- a/trigger/rest/metadata.go +++ b/trigger/rest/metadata.go @@ -11,7 +11,6 @@ type Settings struct { type HandlerSettings struct { Method string `md:"method,required,allowed(GET,POST,PUT,PATCH,DELETE)"` Path string `md:"path,required"` - File string `md:"file"` } type Output struct { diff --git a/trigger/rest/trigger.go b/trigger/rest/trigger.go index 3a0808c5..798854a7 100644 --- a/trigger/rest/trigger.go +++ b/trigger/rest/trigger.go @@ -8,7 +8,6 @@ import ( "io/ioutil" "net/http" "net/url" - "os" "strconv" "strings" @@ -24,7 +23,6 @@ const ( ) var triggerMd = trigger.NewMetadata(&Settings{}, &HandlerSettings{}, &Output{}, &Reply{}) -var hanlderSettings *HandlerSettings func init() { trigger.Register(&Trigger{}, &Factory{}) @@ -71,14 +69,15 @@ func (t *Trigger) Initialize(ctx trigger.InitContext) error { // Init handlers for _, handler := range ctx.GetHandlers() { - hanlderSettings = &HandlerSettings{} - err := metadata.MapToStruct(handler.Settings(), hanlderSettings, true) + + s := &HandlerSettings{} + err := metadata.MapToStruct(handler.Settings(), s, true) if err != nil { return err } - method := hanlderSettings.Method - path := hanlderSettings.Path + method := s.Method + path := s.Path t.logger.Debugf("Registering handler [%s: %s]", method, path) @@ -188,24 +187,48 @@ func newActionHandler(rt *Trigger, handler trigger.Handler) httprouter.Handle { } out.Content = content default: + if strings.Contains(contentType, "multipart/form-data") { + // need to still extract the body, only handling the multipart data for now... - if strings.Contains(contentType, "multipart/form-data") && hanlderSettings.File != "" { - - r.ParseMultipartForm(5 * 1024 * 1024) - file, header, err := r.FormFile(hanlderSettings.File) - - //Save the file - f, err := os.OpenFile(header.Filename, os.O_WRONLY|os.O_CREATE, 0666) - if err != nil { + if err := r.ParseMultipartForm(32); err != nil { http.Error(w, err.Error(), http.StatusBadRequest) - return } - defer f.Close() - io.Copy(f, file) - //Pass the fileName so that we can read the file later on - out.Content = header.Filename + var files []map[string]interface{} + + for k, fh := range r.MultipartForm.File { + for _, header := range fh { + file, err := header.Open() + if err != nil { + rt.logger.Errorf("Error opening attached file: %s", err.Error()) + http.Error(w, err.Error(), http.StatusBadRequest) + } + + defer file.Close() + + buf := bytes.NewBuffer(nil) + if _, err := io.Copy(buf, file); err != nil { + rt.logger.Errorf("Copying file to buffer: %s", err.Error()) + http.Error(w, err.Error(), http.StatusBadRequest) + } + + fileDetails := map[string]interface{}{ + "key": k, + "fileName": header.Filename, + "fileType": header.Header.Get("Content-Type"), + "size": header.Size, + "file": buf.Bytes(), + } + files = append(files, fileDetails) + } + } + // The content output from the trigger + content := map[string]interface{}{ + "body": nil, + "files": files, + } + out.Content = content } else { b, err := ioutil.ReadAll(r.Body) if err != nil { @@ -214,7 +237,6 @@ func newActionHandler(rt *Trigger, handler trigger.Handler) httprouter.Handle { out.Content = string(b) } - } results, err := handler.Handle(context.Background(), out) diff --git a/trigger/timer/go.mod b/trigger/timer/go.mod new file mode 100644 index 00000000..7619b660 --- /dev/null +++ b/trigger/timer/go.mod @@ -0,0 +1,6 @@ +module github.com/project-flogo/contrib/trigger/timer + +require ( + github.com/carlescere/scheduler v0.0.0-20170109141437-ee74d2f83d82 + github.com/project-flogo/core v0.9.0-alpha.6 +) diff --git a/trigger/timer/go.sum b/trigger/timer/go.sum new file mode 100644 index 00000000..37c460d8 --- /dev/null +++ b/trigger/timer/go.sum @@ -0,0 +1,20 @@ +github.com/carlescere/scheduler v0.0.0-20170109141437-ee74d2f83d82 h1:9bAydALqAjBfPHd/eAiJBHnMZUYov8m2PkXVr+YGQeI= +github.com/carlescere/scheduler v0.0.0-20170109141437-ee74d2f83d82/go.mod h1:tyA14J0sA3Hph4dt+AfCjPrYR13+vVodshQSM7km9qw= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/project-flogo/core v0.9.0-alpha.6 h1:ugQmmE1WQ75gzHwFpIv7Wbt1wTqNmWj94J8t6sKdKPw= +github.com/project-flogo/core v0.9.0-alpha.6/go.mod h1:eB+hMcq51lOIeJ93K8Nvvm/vC3OI60ZaEgBbA4gtk8k= +github.com/square-it/jsonschema v1.9.1/go.mod h1:80WJHSuy3YnokzfFopfx+MAt5lVVnVpS6w2Avv+svHk= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=