diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..d6f645c3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2018, TIBCO Software Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of TIBCO Software Inc. nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md index 6da811fa..17880a59 100644 --- a/README.md +++ b/README.md @@ -1 +1,66 @@ -EXPERIMENTAL, DO NOT USE +# Flogo Contrib + +[![Build Status](https://travis-ci.org/project-flogo/contrib.svg?branch=master)](https://travis-ci.org/project-flogo/contrib.svg?branch=master) + +Core collection of Flogo contributions. This repository consists of activities, triggers and functions. + +## Contributions + +### Activities +* [actreply](activity/actreply): Action Reply +* [actreturn](activity/actreturn): Action Return +* [appdata](activity/actreturn): App Shared Data +* [channel](activity/channel): Send internal engine messages +* [counter](activity/counter): Simple Counter +* [error](activity/error): Throw error +* [jsexec](activity/jsexec): Execute Javascript +* [log](activity/log): Log Message +* [mapper](activity/mapper): Mapper +* [noop](activity/noop): No-Op +* [rest](activity/rest): Basic REST invoker + +### Triggers +* [channel](trigger/channel): Listen to internal engine messages +* [cli](trigger/cli): CLI +* [loadtester](trigger/loadtester): Basic load tester +* [rest](trigger/rest): REST +* [timer](trigger/timer): Timer + +### Functions +* [coerce](function/coerce): Type Conversion +* [json](function/json): JSON functions +* [number](function/number): Number functions +* [string](function/string): Basic string functions + +## Installation + +#### Install Activity +Example: install **log** activity + +```bash +flogo install github.com/project-flogo/contrib/activity/log +``` +#### Install Trigger +Example: install **rest** trigger + +```bash +flogo install github.com/project-flogo/contrib/trigger/rest +``` +#### Install Functions +Example: install **string** functions + +```bash +flogo install github.com/project-flogo/contrib/function/string +``` + +## Contributing and support + +### Contributing + +New activities, triggers and functions are welcomed. If you would like to contribute, please following the [contribution guidelines](https://github.com/TIBCOSoftware/flogo/blob/master/CONTRIBUTING.md). If you have any questions, issues, etc feel free to chat with us on [Gitter](https://gitter.im/project-flogo/Lobby?utm_source=share-link&utm_medium=link&utm_campaign=share-link). + +## License +The contrib repository is licensed under a BSD-type license. See [LICENSE](LICENSE) for license text. + +### Support +For Q&A you can post your questions on [Gitter](https://gitter.im/project-flogo/Lobby?utm_source=share-link&utm_medium=link&utm_campaign=share-link) diff --git a/activity/actreply/README.md b/activity/actreply/README.md index 2186653c..5a2235ac 100755 --- a/activity/actreply/README.md +++ b/activity/actreply/README.md @@ -8,9 +8,6 @@ This activity allows you to reply to a trigger invocation and map output values. ## Installation -### Flogo Web -This activity comes out of the box with the Flogo Web UI - ### Flogo CLI ```bash flogo install github.com/project-flogo/contrib/activity/actreply diff --git a/activity/actreply/activity.go b/activity/actreply/activity.go index 89672af6..74700e9a 100755 --- a/activity/actreply/activity.go +++ b/activity/actreply/activity.go @@ -7,7 +7,7 @@ import ( ) func init() { - activity.Register(&Activity{}, New) + _ = activity.Register(&Activity{}, New) } type Settings struct { diff --git a/activity/actreply/go.mod b/activity/actreply/go.mod index 906419d5..3932793d 100644 --- a/activity/actreply/go.mod +++ b/activity/actreply/go.mod @@ -1,6 +1,6 @@ module github.com/project-flogo/contrib/activity/actreply require ( - github.com/project-flogo/core v0.9.0-beta.1 + github.com/project-flogo/core v0.9.0-beta.2 github.com/stretchr/testify v1.3.0 ) diff --git a/activity/actreply/go.sum b/activity/actreply/go.sum index b661751c..7e5bc071 100644 --- a/activity/actreply/go.sum +++ b/activity/actreply/go.sum @@ -4,8 +4,9 @@ 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-beta.1 h1:tiRv5Lv6U1SnDJh6vB10y8AnEdF8/Zmahj8WgCDqS6I= -github.com/project-flogo/core v0.9.0-beta.1/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= +github.com/project-flogo/core v0.9.0-beta.2 h1:L5VLOfF3YfAFVJwn/tL3x0835sZIedrHcrPkYxHbPl4= +github.com/project-flogo/core v0.9.0-beta.2/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/activity/actreturn/README.md b/activity/actreturn/README.md index feee721c..a6187b84 100755 --- a/activity/actreturn/README.md +++ b/activity/actreturn/README.md @@ -8,9 +8,6 @@ This activity allows you to reply to a trigger invocation and map output values. ## Installation -### Flogo Web -This activity comes out of the box with the Flogo Web UI - ### Flogo CLI ```bash flogo install github.com/project-flogo/contrib/activity/actreturn diff --git a/activity/actreturn/activity.go b/activity/actreturn/activity.go index 6ec88daa..7eacec44 100755 --- a/activity/actreturn/activity.go +++ b/activity/actreturn/activity.go @@ -7,7 +7,7 @@ import ( ) func init() { - activity.Register(&Activity{}, New) + _ = activity.Register(&Activity{}, New) } type Settings struct { diff --git a/activity/actreturn/activity_test.go b/activity/actreturn/activity_test.go index 9ac7bb96..77b6b0cb 100755 --- a/activity/actreturn/activity_test.go +++ b/activity/actreturn/activity_test.go @@ -66,7 +66,7 @@ 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, ""), "Output2": data.NewTypedValue(data.TypeInt, "")} + output := map[string]data.TypedValue{"Output1": data.NewTypedValue(data.TypeString, "")} ac := &test.TestActivityHost{ HostId: "1", diff --git a/activity/actreturn/go.mod b/activity/actreturn/go.mod index 5d2cdba2..0a875cfb 100644 --- a/activity/actreturn/go.mod +++ b/activity/actreturn/go.mod @@ -1,6 +1,6 @@ module github.com/project-flogo/contrib/activity/actreturn require ( - github.com/project-flogo/core v0.9.0-beta.1 + github.com/project-flogo/core v0.9.0-beta.2 github.com/stretchr/testify v1.3.0 ) diff --git a/activity/actreturn/go.sum b/activity/actreturn/go.sum index b661751c..7e5bc071 100644 --- a/activity/actreturn/go.sum +++ b/activity/actreturn/go.sum @@ -4,8 +4,9 @@ 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-beta.1 h1:tiRv5Lv6U1SnDJh6vB10y8AnEdF8/Zmahj8WgCDqS6I= -github.com/project-flogo/core v0.9.0-beta.1/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= +github.com/project-flogo/core v0.9.0-beta.2 h1:L5VLOfF3YfAFVJwn/tL3x0835sZIedrHcrPkYxHbPl4= +github.com/project-flogo/core v0.9.0-beta.2/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/activity/appdata/README.md b/activity/appdata/README.md new file mode 100755 index 00000000..cc945ab3 --- /dev/null +++ b/activity/appdata/README.md @@ -0,0 +1,69 @@ +# AppData +This activity allows you to set and get global App attributes\. + +## Installation + +### Flogo CLI +```bash +flogo install github.com/project-flogo/contrib/activity/appdata +``` + +## Configuration + +### Settings: +| Name | Type | Description +|:--- | :--- | :--- +| name | string | The name of the shared attribute - **REQUIRED** +| op | string | The operation (get or set), 'get' is the default +| type | string | The data type of the shared value, default is 'any' + +### Input: +| Name | Type | Description +|:--- | :--- | :--- +| value | object | The value of the shared attribute + + +### Output: +| Name | Type | Description +|:--- | :--- | :--- +| value | object | The value of the shared attribute + + +## Examples + +### Get +Get the value of the 'myAttr' attribute: + +```json +{ + "id": "get_app_attr", + "name": "Get App Attr", + "activity": { + "ref": "github.com/project-flogo/contrib/activity/appdata", + "settings": { + "attribute": "myAttr", + "operation": "get" + } + } +} +``` + +### Set +Update the value of the 'myAttr' attribute to _bar_: + +```json +{ + "id": "set_app_attr", + "name": "Set App Attr", + "activity": { + "ref": "github.com/project-flogo/contrib/activity/appdata", + "settings": { + "attribute": "myAttr", + "operation": "set" + }, + "input": { + "value": "bar" + } + } +} +``` diff --git a/activity/appdata/activity.go b/activity/appdata/activity.go new file mode 100755 index 00000000..00b93670 --- /dev/null +++ b/activity/appdata/activity.go @@ -0,0 +1,109 @@ +package appdata + +import ( + "github.com/project-flogo/core/activity" + "github.com/project-flogo/core/app" + "github.com/project-flogo/core/data" + "github.com/project-flogo/core/data/coerce" + "github.com/project-flogo/core/data/metadata" +) + +const ( + opGet int = 0 + opSet int = 1 + + ivValue = "value" + ovValue = "value" +) + +type Settings struct { + Name string `md:"name,required"` // The name of the shared attribute + Op string `md:"op,allowed(get,set)"` // The operation (get or set), 'get' is the default + Type string `md:"type"` // The data type of the shared value, default is 'any' +} + +type Input struct { + Value interface{} `md:"value"` // The value of the shared attribute +} + +type Output struct { + Value interface{} `md:"value"` // The value of the shared attribute +} + +func init() { + _ = activity.Register(&Activity{}, New) +} + +var activityMd = activity.ToMetadata(&Settings{}, &Output{}) + +// Activity is a Counter Activity implementation +type Activity struct { + op int + dt data.Type + attrName string +} + +func New(ctx activity.InitContext) (activity.Activity, error) { + s := &Settings{} + err := metadata.MapToStruct(ctx.Settings(), s, true) + if err != nil { + return nil, err + } + + act := &Activity{attrName: s.Name} + + if s.Op == "set" { + act.op = opSet + } + + if s.Type != "" { + t, err := data.ToTypeEnum(s.Type) + if err != nil { + return nil, err + } + act.dt = t + } + + return act, nil +} + +// Metadata implements activity.Activity.Metadata +func (a *Activity) Metadata() *activity.Metadata { + return activityMd +} + +// Eval implements activity.Activity.Eval +func (a *Activity) Eval(ctx activity.Context) (done bool, err error) { + + switch a.op { + case opGet: + + val, exists := app.GetValue(a.attrName) + if exists && a.dt > 1 { + val, err = coerce.ToType(val, a.dt) + if err != nil { + return false, err + } + } + err = ctx.SetOutput(ovValue, val) + if err != nil { + return false, err + } + case opSet: + val := ctx.GetInput(ivValue) + + if a.dt > 1 { + val, err = coerce.ToType(val, a.dt) + if err != nil { + return false, err + } + } + + err = app.SetValue(a.attrName, val) + if err != nil { + return false, err + } + } + + return true, nil +} diff --git a/activity/appdata/activity_test.go b/activity/appdata/activity_test.go new file mode 100755 index 00000000..56861f35 --- /dev/null +++ b/activity/appdata/activity_test.go @@ -0,0 +1,72 @@ +package appdata + +import ( + "github.com/project-flogo/core/activity" + "github.com/project-flogo/core/app" + "github.com/project-flogo/core/support/test" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestRegister(t *testing.T) { + + ref := activity.GetRef(&Activity{}) + act := activity.Get(ref) + + assert.NotNil(t, act) +} + +func TestSet(t *testing.T) { + + defer func() { + if r := recover(); r != nil { + t.Failed() + t.Errorf("panic during execution: %v", r) + } + }() + + settings := &Settings{Name: "test", Op: "set"} + iCtx := test.NewActivityInitContext(settings, nil) + + act, err := New(iCtx) + assert.Nil(t, err) + + tc := test.NewActivityContext(act.Metadata()) + tc.SetInput("value", "foo") + + _, err = act.Eval(tc) + assert.Nil(t, err) + + appValue, _ := app.GetValue("test") + assert.Equal(t, "foo", appValue) + +} + +func TestGet(t *testing.T) { + + defer func() { + if r := recover(); r != nil { + t.Failed() + t.Errorf("panic during execution: %v", r) + } + }() + + err := app.SetValue("test", "bar") + assert.Nil(t, err) + + settings := &Settings{Name: "test", Op: "get"} + iCtx := test.NewActivityInitContext(settings, nil) + + act, err := New(iCtx) + assert.Nil(t, err) + + tc := test.NewActivityContext(act.Metadata()) + tc.SetInput("value", "bar") + + _, err = act.Eval(tc) + assert.Nil(t, err) + + appValue, _ := app.GetValue("test") + assert.Equal(t, "bar", appValue) +} diff --git a/activity/appdata/descriptor.json b/activity/appdata/descriptor.json new file mode 100755 index 00000000..ea04812a --- /dev/null +++ b/activity/appdata/descriptor.json @@ -0,0 +1,42 @@ +{ + "name": "flogo-appdata", + "type": "flogo:activity", + "version": "0.0.1", + "title": "Use global App attribute", + "description": "Use global App attribute", + "homepage": "https://github.com/project-flogo/contrib/tree/master/activity/appdata", + "settings":[ + { + "name": "name", + "type": "string", + "required": true, + "description": "The name of the shared attribute" + }, + { + "name": "op", + "type": "string", + "allowed" : ["get", "set"], + "description": "The operation (get or set), 'get' is the default" + }, + { + "name": "type", + "type": "string", + "allowed" : [ "any","string", "int", "float64", "boolean", "object", "array", "params"], + "description": "The data type of the shared value, default is 'any'" + } + ], + "input": [ + { + "name": "value", + "type": "object", + "description": "The value of the shared attribute" + } + ], + "output": [ + { + "name": "value", + "type": "object", + "description": "The value of the shared attribute" + } + ] +} \ No newline at end of file diff --git a/activity/appdata/go.mod b/activity/appdata/go.mod new file mode 100644 index 00000000..9e383d81 --- /dev/null +++ b/activity/appdata/go.mod @@ -0,0 +1,6 @@ +module github.com/project-flogo/contrib/activity/appdata + +require ( + github.com/project-flogo/core v0.9.0-beta.3 + github.com/stretchr/testify v1.3.0 +) diff --git a/activity/appdata/go.sum b/activity/appdata/go.sum new file mode 100644 index 00000000..fb696537 --- /dev/null +++ b/activity/appdata/go.sum @@ -0,0 +1,19 @@ +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/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-beta.3 h1:RXBJBMLkMnEkI9MC/8xhGtLkk4XnMmug5Cvx4Of7yJo= +github.com/project-flogo/core v0.9.0-beta.3/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +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/activity.go b/activity/channel/activity.go index 020bc435..b93503e8 100644 --- a/activity/channel/activity.go +++ b/activity/channel/activity.go @@ -8,7 +8,7 @@ import ( ) func init() { - activity.Register(&Activity{}) + _ = activity.Register(&Activity{}) } var activityMd = activity.ToMetadata(&Input{}) @@ -28,7 +28,10 @@ func (a *Activity) Metadata() *activity.Metadata { func (a *Activity) Eval(ctx activity.Context) (done bool, err error) { input := &Input{} - ctx.GetInputObject(input) + err = ctx.GetInputObject(input) + if err != nil { + return false, err + } if len(input.Channel) == 0 { return false, fmt.Errorf("channel name must be specified") @@ -42,7 +45,7 @@ func (a *Activity) Eval(ctx activity.Context) (done bool, err error) { blocking := true - //should we allow + //todo should we allow publish new wait? if blocking { ch.Publish(input.Data) } else { diff --git a/activity/channel/go.mod b/activity/channel/go.mod index f45d30bc..959ab1b4 100644 --- a/activity/channel/go.mod +++ b/activity/channel/go.mod @@ -1,6 +1,6 @@ module github.com/project-flogo/contrib/activity/channel require ( - github.com/project-flogo/core v0.9.0-beta.1 + github.com/project-flogo/core v0.9.0-beta.2 github.com/stretchr/testify v1.3.0 ) diff --git a/activity/channel/go.sum b/activity/channel/go.sum index b661751c..7e5bc071 100644 --- a/activity/channel/go.sum +++ b/activity/channel/go.sum @@ -4,8 +4,9 @@ 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-beta.1 h1:tiRv5Lv6U1SnDJh6vB10y8AnEdF8/Zmahj8WgCDqS6I= -github.com/project-flogo/core v0.9.0-beta.1/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= +github.com/project-flogo/core v0.9.0-beta.2 h1:L5VLOfF3YfAFVJwn/tL3x0835sZIedrHcrPkYxHbPl4= +github.com/project-flogo/core v0.9.0-beta.2/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/activity/counter/README.md b/activity/counter/README.md index 2bccd95e..c891a699 100755 --- a/activity/counter/README.md +++ b/activity/counter/README.md @@ -8,9 +8,6 @@ This activity allows you to use a global counter. ## Installation -### Flogo Web -This activity comes out of the box with the Flogo Web UI - ### Flogo CLI ```bash flogo install github.com/project-flogo/contrib/activity/counter diff --git a/activity/counter/activity.go b/activity/counter/activity.go index 6de4b9d9..76c37fed 100755 --- a/activity/counter/activity.go +++ b/activity/counter/activity.go @@ -25,7 +25,7 @@ type Output struct { } func init() { - activity.Register(&Activity{}, New) + _ = activity.Register(&Activity{}, New) } var activityMd = activity.ToMetadata(&Settings{}, &Output{}) diff --git a/activity/counter/go.mod b/activity/counter/go.mod index 99e2573e..65176664 100644 --- a/activity/counter/go.mod +++ b/activity/counter/go.mod @@ -1,6 +1,6 @@ module github.com/project-flogo/contrib/activity/counter require ( - github.com/project-flogo/core v0.9.0-beta.1 + github.com/project-flogo/core v0.9.0-beta.2 github.com/stretchr/testify v1.3.0 ) diff --git a/activity/counter/go.sum b/activity/counter/go.sum index b661751c..7e5bc071 100644 --- a/activity/counter/go.sum +++ b/activity/counter/go.sum @@ -4,8 +4,9 @@ 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-beta.1 h1:tiRv5Lv6U1SnDJh6vB10y8AnEdF8/Zmahj8WgCDqS6I= -github.com/project-flogo/core v0.9.0-beta.1/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= +github.com/project-flogo/core v0.9.0-beta.2 h1:L5VLOfF3YfAFVJwn/tL3x0835sZIedrHcrPkYxHbPl4= +github.com/project-flogo/core v0.9.0-beta.2/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/activity/error/README.md b/activity/error/README.md index b13c930d..cfd1430b 100644 --- a/activity/error/README.md +++ b/activity/error/README.md @@ -9,9 +9,6 @@ This activity allows you to cause an explicit error in the flow (throw an error) ## Installation -### Flogo Web -This activity comes out of the box with the Flogo Web UI - ### Flogo CLI ```bash flogo install github.com/project-flogo/contrib/activity/error diff --git a/activity/error/go.mod b/activity/error/go.mod index 230aa2c2..2cc5e325 100644 --- a/activity/error/go.mod +++ b/activity/error/go.mod @@ -1,6 +1,6 @@ module github.com/project-flogo/contrib/activity/error require ( - github.com/project-flogo/core v0.9.0-beta.1 + github.com/project-flogo/core v0.9.0-beta.2 github.com/stretchr/testify v1.3.0 ) diff --git a/activity/error/go.sum b/activity/error/go.sum index b661751c..7e5bc071 100644 --- a/activity/error/go.sum +++ b/activity/error/go.sum @@ -4,8 +4,9 @@ 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-beta.1 h1:tiRv5Lv6U1SnDJh6vB10y8AnEdF8/Zmahj8WgCDqS6I= -github.com/project-flogo/core v0.9.0-beta.1/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= +github.com/project-flogo/core v0.9.0-beta.2 h1:L5VLOfF3YfAFVJwn/tL3x0835sZIedrHcrPkYxHbPl4= +github.com/project-flogo/core v0.9.0-beta.2/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/activity/jsexec/go.mod b/activity/jsexec/go.mod index 049ba9ad..a7fed324 100755 --- a/activity/jsexec/go.mod +++ b/activity/jsexec/go.mod @@ -1,13 +1,7 @@ module github.com/project-flogo/contrib/activity/jsexec require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/dlclark/regexp2 v1.1.6 // indirect github.com/dop251/goja v0.0.0-20190301185519-64be363d126e - github.com/go-sourcemap/sourcemap v2.1.2+incompatible // indirect - github.com/pkg/errors v0.8.0 // indirect - github.com/project-flogo/core v0.9.0-beta.1 + github.com/project-flogo/core v0.9.0-beta.2 github.com/stretchr/testify v1.3.0 - golang.org/x/text v0.3.0 // indirect - gopkg.in/yaml.v2 v2.2.2 // indirect ) diff --git a/activity/jsexec/go.sum b/activity/jsexec/go.sum index 5a11b5a4..a26e50a5 100755 --- a/activity/jsexec/go.sum +++ b/activity/jsexec/go.sum @@ -1,4 +1,3 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -12,16 +11,11 @@ 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-beta.1 h1:ToDfk5H61p8j6uhPZzIeHQ8TBCj8M4DzUcna4+2KbO8= -github.com/project-flogo/core v0.9.0-beta.1/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.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= +github.com/project-flogo/core v0.9.0-beta.2 h1:L5VLOfF3YfAFVJwn/tL3x0835sZIedrHcrPkYxHbPl4= +github.com/project-flogo/core v0.9.0-beta.2/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= github.com/stretchr/objx v0.1.0/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= -github.com/xeipuuv/gojsonschema v1.1.0 h1:ngVtJC9TY/lg0AA/1k48FYhBrhRoFlEmWzsehpNAaZg= 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= diff --git a/activity/jsexec/metadata.go b/activity/jsexec/metadata.go index 76b596d7..06fc643d 100755 --- a/activity/jsexec/metadata.go +++ b/activity/jsexec/metadata.go @@ -15,19 +15,19 @@ type Input struct { } // FromMap converts the values from a map into the struct Input -func (r *Input) FromMap(values map[string]interface{}) error { +func (i *Input) FromMap(values map[string]interface{}) error { parameters, err := coerce.ToObject(values["parameters"]) if err != nil { return err } - r.Parameters = parameters + i.Parameters = parameters return nil } // ToMap converts the struct Input into a map -func (r *Input) ToMap() map[string]interface{} { +func (i *Input) ToMap() map[string]interface{} { return map[string]interface{}{ - "parameters": r.Parameters, + "parameters": i.Parameters, } } diff --git a/activity/log/README.md b/activity/log/README.md index b90a37cf..5368cb29 100644 --- a/activity/log/README.md +++ b/activity/log/README.md @@ -8,9 +8,6 @@ This activity allows you to write log messages. ## Installation -### Flogo Web -This activity comes out of the box with the Flogo Web UI - ### Flogo CLI ```bash flogo install github.com/project-flogo/contrib/activity/log diff --git a/activity/log/activity.go b/activity/log/activity.go index 6175c762..ec2dadd9 100755 --- a/activity/log/activity.go +++ b/activity/log/activity.go @@ -8,7 +8,7 @@ import ( ) func init() { - activity.Register(&Activity{}) + _ = activity.Register(&Activity{}) } type Input struct { diff --git a/activity/log/go.mod b/activity/log/go.mod index 403141c0..52d9faec 100644 --- a/activity/log/go.mod +++ b/activity/log/go.mod @@ -1,6 +1,6 @@ module github.com/project-flogo/contrib/activity/log require ( - github.com/project-flogo/core v0.9.0-beta.1 + github.com/project-flogo/core v0.9.0-beta.2 github.com/stretchr/testify v1.3.0 ) diff --git a/activity/log/go.sum b/activity/log/go.sum index b661751c..7e5bc071 100644 --- a/activity/log/go.sum +++ b/activity/log/go.sum @@ -4,8 +4,9 @@ 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-beta.1 h1:tiRv5Lv6U1SnDJh6vB10y8AnEdF8/Zmahj8WgCDqS6I= -github.com/project-flogo/core v0.9.0-beta.1/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= +github.com/project-flogo/core v0.9.0-beta.2 h1:L5VLOfF3YfAFVJwn/tL3x0835sZIedrHcrPkYxHbPl4= +github.com/project-flogo/core v0.9.0-beta.2/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/activity/mapper/README.md b/activity/mapper/README.md index 01dc682b..9ff2f848 100755 --- a/activity/mapper/README.md +++ b/activity/mapper/README.md @@ -8,9 +8,6 @@ This activity allows you to map values to the working attribute set of an action ## Installation -### Flogo Web -This activity comes out of the box with the Flogo Web UI - ### Flogo CLI ```bash flogo install github.com/project-flogo/contrib/activity/mapper diff --git a/activity/mapper/activity.go b/activity/mapper/activity.go index 9cce139e..f89fb5cb 100755 --- a/activity/mapper/activity.go +++ b/activity/mapper/activity.go @@ -7,7 +7,7 @@ import ( ) func init() { - activity.Register(&Activity{}, New) + _ = activity.Register(&Activity{}, New) } type Settings struct { diff --git a/activity/mapper/activity_test.go b/activity/mapper/activity_test.go index 70f4d0aa..0ddadd18 100755 --- a/activity/mapper/activity_test.go +++ b/activity/mapper/activity_test.go @@ -36,16 +36,17 @@ func TestSimpleMapper(t *testing.T) { } settings := map[string]interface{}{"mappings": mappings} + mf := mapper.NewFactory(resolve.GetBasicResolver()) + iCtx := test.NewActivityInitContext(settings, mf) - act, err := New(settings) + act, err := New(iCtx) assert.Nil(t, err) - ah := newActivityHost() - tc := test.NewActivityContextWithAction(act.Metadata(), ah) + tc := test.NewActivityContextWithAction(act.Metadata(),ah) //eval - act.Eval(tc) - + _, err = act.Eval(tc) + assert.Nil(t,err) //assert.Nil(t, ah.ReplyErr) o1, exists1 := ah.HostData.GetValue("Output1") assert.True(t, exists1, "Output1 not set") @@ -55,13 +56,13 @@ func TestSimpleMapper(t *testing.T) { o2, exists2 := ah.HostData.GetValue("Output2") assert.True(t, exists2, "Output2 not set") if exists2 { - assert.Equal(t, 2, o2) + assert.Equal(t, 2.0, o2) } } func newActivityHost() *test.TestActivityHost { input := map[string]data.TypedValue{"Input1": data.NewTypedValue(data.TypeString, "")} - output := map[string]data.TypedValue{"Output1": data.NewTypedValue(data.TypeString, ""), "Output2": data.NewTypedValue(data.TypeInt, "")} + output := map[string]data.TypedValue{"Output1": data.NewTypedValue(data.TypeString, "")} ac := &test.TestActivityHost{ HostId: "1", @@ -69,6 +70,5 @@ func newActivityHost() *test.TestActivityHost { IoMetadata: &metadata.IOMetadata{Input: input, Output: output}, HostData: data.NewSimpleScope(nil, nil), } - return ac -} +} \ No newline at end of file diff --git a/activity/mapper/go.mod b/activity/mapper/go.mod index 8bb90e59..7814fc8a 100644 --- a/activity/mapper/go.mod +++ b/activity/mapper/go.mod @@ -1,6 +1,6 @@ module github.com/project-flogo/contrib/activity/mapper require ( - github.com/project-flogo/core v0.9.0-beta.1 + github.com/project-flogo/core v0.9.0-beta.2 github.com/stretchr/testify v1.3.0 ) diff --git a/activity/mapper/go.sum b/activity/mapper/go.sum index 48978ac4..7e5bc071 100644 --- a/activity/mapper/go.sum +++ b/activity/mapper/go.sum @@ -1,17 +1,14 @@ +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= 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/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/project-flogo/core v0.9.0-beta.1/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= -github.com/square-it/jsonschema v1.9.1/go.mod h1:80WJHSuy3YnokzfFopfx+MAt5lVVnVpS6w2Avv+svHk= +github.com/project-flogo/core v0.9.0-beta.2 h1:L5VLOfF3YfAFVJwn/tL3x0835sZIedrHcrPkYxHbPl4= +github.com/project-flogo/core v0.9.0-beta.2/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/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= github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4= diff --git a/activity/noop/README.md b/activity/noop/README.md index 734146f9..8bd3b11d 100644 --- a/activity/noop/README.md +++ b/activity/noop/README.md @@ -8,9 +8,6 @@ This activity is a simple No-Op that can be used for testing. ## Installation -### Flogo Web -This activity comes out of the box with the Flogo Web UI - ### Flogo CLI ```bash flogo install github.com/project-flogo/contrib/activity/noop diff --git a/activity/noop/activity.go b/activity/noop/activity.go index 18bf9dcd..dac56c5e 100755 --- a/activity/noop/activity.go +++ b/activity/noop/activity.go @@ -5,7 +5,7 @@ import ( ) func init() { - activity.Register(&Activity{}) + _ = activity.Register(&Activity{}) } var activityMd = activity.ToMetadata() diff --git a/activity/noop/go.mod b/activity/noop/go.mod index 7ac5de66..8f397b76 100644 --- a/activity/noop/go.mod +++ b/activity/noop/go.mod @@ -1,6 +1,6 @@ module github.com/project-flogo/contrib/activity/noop require ( - github.com/project-flogo/core v0.9.0-beta.1 + github.com/project-flogo/core v0.9.0-beta.2 github.com/stretchr/testify v1.3.0 ) diff --git a/activity/noop/go.sum b/activity/noop/go.sum index b661751c..7e5bc071 100644 --- a/activity/noop/go.sum +++ b/activity/noop/go.sum @@ -4,8 +4,9 @@ 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-beta.1 h1:tiRv5Lv6U1SnDJh6vB10y8AnEdF8/Zmahj8WgCDqS6I= -github.com/project-flogo/core v0.9.0-beta.1/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= +github.com/project-flogo/core v0.9.0-beta.2 h1:L5VLOfF3YfAFVJwn/tL3x0835sZIedrHcrPkYxHbPl4= +github.com/project-flogo/core v0.9.0-beta.2/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/activity/rest/README.md b/activity/rest/README.md index b9d83cec..1f1f72dc 100644 --- a/activity/rest/README.md +++ b/activity/rest/README.md @@ -8,9 +8,6 @@ This activity allows you to invoke a REST service. ## Installation -### Flogo Web -This activity comes out of the box with the Flogo Web UI - ### Flogo CLI ```bash flogo install github.com/project-flogo/contrib/activity/rest diff --git a/activity/rest/activity.go b/activity/rest/activity.go index adffe112..6ebcf84a 100644 --- a/activity/rest/activity.go +++ b/activity/rest/activity.go @@ -17,7 +17,7 @@ import ( ) func init() { - activity.Register(&Activity{}, New) + _ = activity.Register(&Activity{}, New) } const ( diff --git a/activity/rest/go.mod b/activity/rest/go.mod index 4e49ef6b..4df9f7c6 100644 --- a/activity/rest/go.mod +++ b/activity/rest/go.mod @@ -1,6 +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 + github.com/project-flogo/core v0.9.0-beta.2 + github.com/stretchr/testify v1.3.0 ) diff --git a/activity/rest/go.sum b/activity/rest/go.sum index 9f9f50ca..7e5bc071 100644 --- a/activity/rest/go.sum +++ b/activity/rest/go.sum @@ -1,14 +1,15 @@ -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/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/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/project-flogo/core v0.9.0-beta.2 h1:L5VLOfF3YfAFVJwn/tL3x0835sZIedrHcrPkYxHbPl4= +github.com/project-flogo/core v0.9.0-beta.2/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 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= diff --git a/activity/rest/metadata.go b/activity/rest/metadata.go index 031fe924..1c39051a 100644 --- a/activity/rest/metadata.go +++ b/activity/rest/metadata.go @@ -24,55 +24,55 @@ type Input struct { Content interface{} `md:"content"` // The message content to send. This is only used in POST, PUT, and PATCH } -func (o *Input) ToMap() map[string]interface{} { +func (i *Input) ToMap() map[string]interface{} { return map[string]interface{}{ - "pathParams": o.PathParams, - "queryParams": o.QueryParams, - "headers": o.Headers, - "content": o.Content, + "pathParams": i.PathParams, + "queryParams": i.QueryParams, + "headers": i.Headers, + "content": i.Content, } } -func (o *Input) FromMap(values map[string]interface{}) error { +func (i *Input) FromMap(values map[string]interface{}) error { var err error - o.PathParams, err = coerce.ToParams(values["pathParams"]) + i.PathParams, err = coerce.ToParams(values["pathParams"]) if err != nil { return err } - o.QueryParams, err = coerce.ToParams(values["queryParams"]) + i.QueryParams, err = coerce.ToParams(values["queryParams"]) if err != nil { return err } - o.Headers, err = coerce.ToParams(values["headers"]) + i.Headers, err = coerce.ToParams(values["headers"]) if err != nil { return err } - o.Content = values["content"] + i.Content = values["content"] return nil } type Output struct { - Status int `md:"status"` // The HTTP status code - Data interface{} `md:"result"` // The HTTP response data + Status int `md:"status"` // The HTTP status code + Data interface{} `md:"data"` // The HTTP response data } -func (r *Output) ToMap() map[string]interface{} { +func (o *Output) ToMap() map[string]interface{} { return map[string]interface{}{ - "status": r.Status, - "data": r.Data, + "status": o.Status, + "data": o.Data, } } -func (r *Output) FromMap(values map[string]interface{}) error { +func (o *Output) FromMap(values map[string]interface{}) error { var err error - r.Status, err = coerce.ToInt(values["status"]) + o.Status, err = coerce.ToInt(values["status"]) if err != nil { return err } - r.Data, _ = values["data"] + o.Data, _ = values["data"] return nil } diff --git a/function/coerce/descriptor.json b/function/coerce/descriptor.json index a1cd3928..e16d4b75 100644 --- a/function/coerce/descriptor.json +++ b/function/coerce/descriptor.json @@ -18,7 +18,8 @@ "name": "type", "type": "string" } - ] + ], + "returnType": "any" }, { "name": "toString", @@ -28,7 +29,8 @@ "name": "value", "type": "any" } - ] + ], + "returnType": "string" }, { "name": "toInt", @@ -38,7 +40,8 @@ "name": "value", "type": "any" } - ] + ], + "returnType": "int" }, { "name": "toInt32", @@ -48,7 +51,8 @@ "name": "value", "type": "any" } - ] + ], + "returnType": "int32" }, { "name": "toInt64", @@ -58,7 +62,8 @@ "name": "value", "type": "any" } - ] + ], + "returnType": "int64" }, { "name": "toFloat32", @@ -68,7 +73,8 @@ "name": "value", "type": "any" } - ] + ], + "returnType": "float32" }, { "name": "toFloat64", @@ -78,7 +84,8 @@ "name": "value", "type": "any" } - ] + ], + "returnType": "float64" }, { "name": "toBool", @@ -88,7 +95,8 @@ "name": "value", "type": "any" } - ] + ], + "returnType": "bool" }, { "name": "toBytes", @@ -98,7 +106,8 @@ "name": "value", "type": "any" } - ] + ], + "returnType": "bytes" }, { "name": "toParams", @@ -108,7 +117,8 @@ "name": "value", "type": "any" } - ] + ], + "returnType": "params" }, { "name": "toObject", @@ -118,7 +128,8 @@ "name": "value", "type": "any" } - ] + ], + "returnType": "object" }, { "name": "toArray", @@ -128,7 +139,8 @@ "name": "value", "type": "any" } - ] + ], + "returnType": "array" } ] } diff --git a/function/coerce/go.mod b/function/coerce/go.mod index 5c0a4ff6..412edb30 100644 --- a/function/coerce/go.mod +++ b/function/coerce/go.mod @@ -1,3 +1,3 @@ module github.com/project-flogo/contrib/function/coerce -require github.com/project-flogo/core v0.9.0-beta.1 +require github.com/project-flogo/core v0.9.0-beta.2 diff --git a/function/coerce/go.sum b/function/coerce/go.sum index b661751c..46c68763 100644 --- a/function/coerce/go.sum +++ b/function/coerce/go.sum @@ -4,8 +4,8 @@ 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-beta.1 h1:tiRv5Lv6U1SnDJh6vB10y8AnEdF8/Zmahj8WgCDqS6I= -github.com/project-flogo/core v0.9.0-beta.1/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= +github.com/project-flogo/core v0.9.0-beta.2 h1:L5VLOfF3YfAFVJwn/tL3x0835sZIedrHcrPkYxHbPl4= +github.com/project-flogo/core v0.9.0-beta.2/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/function/go.mod b/function/go.mod index 2a177fe8..e4591eab 100644 --- a/function/go.mod +++ b/function/go.mod @@ -1,10 +1,8 @@ module github.com/project-flogo/contrib/function -go 1.12 - require ( - github.com/project-flogo/contrib/function/coerce v0.0.0-20190322010605-4c45109b59c7 - github.com/project-flogo/contrib/function/json v0.0.0-20190322010605-4c45109b59c7 - github.com/project-flogo/contrib/function/number v0.0.0-20190322010605-4c45109b59c7 - github.com/project-flogo/contrib/function/string v0.0.0-20190322010605-4c45109b59c7 + github.com/project-flogo/contrib/function/coerce v0.0.0-20190322223003-62046b3698ab + github.com/project-flogo/contrib/function/json v0.0.0-20190322223003-62046b3698ab + github.com/project-flogo/contrib/function/number v0.0.0-20190322223003-62046b3698ab + github.com/project-flogo/contrib/function/string v0.0.0-20190322223003-62046b3698ab ) diff --git a/function/go.sum b/function/go.sum index e86b6031..36c69687 100644 --- a/function/go.sum +++ b/function/go.sum @@ -1,24 +1,26 @@ -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/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/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/contrib/function/coerce v0.0.0-20190322010605-4c45109b59c7 h1:RmpxhZsijfUmmM5ehmGtPBNEkq1e7m8vpoVqPs7tM0A= -github.com/project-flogo/contrib/function/coerce v0.0.0-20190322010605-4c45109b59c7/go.mod h1:rU6AC3X74T0uC/53T/lSrtt/c0qqKE8kA1sBfQAk4CQ= -github.com/project-flogo/contrib/function/json v0.0.0-20190322010605-4c45109b59c7 h1:AJDuQgL8bWRpKrujZrBmwbEwpCSrkpkO/h3+YdwUoHc= -github.com/project-flogo/contrib/function/json v0.0.0-20190322010605-4c45109b59c7/go.mod h1:QhZzlNLqH/TWrMre+FLvqIykt7O79zbQ6pu9oAEdfB0= -github.com/project-flogo/contrib/function/number v0.0.0-20190322010605-4c45109b59c7 h1:D9NiYG1wBn6X5BDVshQ3t5PJlMeqgxWSu+8POj3JVjY= -github.com/project-flogo/contrib/function/number v0.0.0-20190322010605-4c45109b59c7/go.mod h1:75NDwGNYUY2GjogyBYT4Hp1CJYpjwxIgQxYxkE9/xRs= -github.com/project-flogo/contrib/function/string v0.0.0-20190322010605-4c45109b59c7 h1:UvmkKzjcg3EqYKprOXFNo3NdFtRVh1y56dAnVGhmrI8= -github.com/project-flogo/contrib/function/string v0.0.0-20190322010605-4c45109b59c7/go.mod h1:r9BdpzbQx9un7zwUwlnPGIbgC3yejuFxw74rVky/t94= -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/project-flogo/contrib/function/coerce v0.0.0-20190322223003-62046b3698ab h1:ONB1qG4FEXTh4y3VcCvy8vWIlgH80KTJ7nK5r0/k1WU= +github.com/project-flogo/contrib/function/coerce v0.0.0-20190322223003-62046b3698ab/go.mod h1:YUtwOZa/3s3HBpOh2vWdd4nPdRMxn4A5VpbTR2bscWM= +github.com/project-flogo/contrib/function/json v0.0.0-20190322223003-62046b3698ab h1:Pl69cgfoLF0rqPDpLg/7GRwN/iye/h2FN515kDnqKN0= +github.com/project-flogo/contrib/function/json v0.0.0-20190322223003-62046b3698ab/go.mod h1:9m2uijKX+NXnLyezc9Kkj1YFoOq/6k/NiPDkAHwIyk4= +github.com/project-flogo/contrib/function/number v0.0.0-20190322223003-62046b3698ab h1:GHDt4qe1MME14ozAmzQiCNN2Uydu5qI0odpAQr4VFwo= +github.com/project-flogo/contrib/function/number v0.0.0-20190322223003-62046b3698ab/go.mod h1:ICD9OLqygf+GAsoMtcEC9hT+GVMaCjXk0s10b2Uf2vM= +github.com/project-flogo/contrib/function/string v0.0.0-20190322223003-62046b3698ab h1:UpVEOVa0bxXYRXGQPwcIjFkBdI1+8ng5nMTaolMN4ew= +github.com/project-flogo/contrib/function/string v0.0.0-20190322223003-62046b3698ab/go.mod h1:EK7RnsG9Mbom4QExlLagiYvSAm7zgTjBUgJyCJdVamQ= +github.com/project-flogo/core v0.9.0-beta.1 h1:ToDfk5H61p8j6uhPZzIeHQ8TBCj8M4DzUcna4+2KbO8= +github.com/project-flogo/core v0.9.0-beta.1/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/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 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= 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= diff --git a/function/json/descriptor.json b/function/json/descriptor.json index 8ea07b7a..e3100f7e 100644 --- a/function/json/descriptor.json +++ b/function/json/descriptor.json @@ -18,7 +18,8 @@ "name": "object", "type": "any" } - ] + ], + "returnType": "any" } ] } diff --git a/function/json/go.mod b/function/json/go.mod index a5205d7c..8da67f04 100644 --- a/function/json/go.mod +++ b/function/json/go.mod @@ -2,5 +2,6 @@ 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-beta.1 + github.com/project-flogo/core v0.9.0-beta.2 + github.com/stretchr/testify v1.3.0 ) diff --git a/function/json/go.sum b/function/json/go.sum index 390d3c29..a719c8c1 100644 --- a/function/json/go.sum +++ b/function/json/go.sum @@ -6,8 +6,8 @@ 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-beta.1 h1:tiRv5Lv6U1SnDJh6vB10y8AnEdF8/Zmahj8WgCDqS6I= -github.com/project-flogo/core v0.9.0-beta.1/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= +github.com/project-flogo/core v0.9.0-beta.2 h1:L5VLOfF3YfAFVJwn/tL3x0835sZIedrHcrPkYxHbPl4= +github.com/project-flogo/core v0.9.0-beta.2/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/function/json/path.go b/function/json/path.go index dc057423..61b7c0e6 100644 --- a/function/json/path.go +++ b/function/json/path.go @@ -7,7 +7,7 @@ import ( ) func init() { - function.Register(&fnPath{}) + _ = function.Register(&fnPath{}) } type fnPath struct { diff --git a/function/number/go.mod b/function/number/go.mod index afb648e9..f8e0d405 100644 --- a/function/number/go.mod +++ b/function/number/go.mod @@ -1,3 +1,3 @@ module github.com/project-flogo/contrib/function/number -require github.com/project-flogo/core v0.9.0-beta.1 +require github.com/project-flogo/core v0.9.0-beta.2 diff --git a/function/number/go.sum b/function/number/go.sum index b661751c..46c68763 100644 --- a/function/number/go.sum +++ b/function/number/go.sum @@ -4,8 +4,8 @@ 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-beta.1 h1:tiRv5Lv6U1SnDJh6vB10y8AnEdF8/Zmahj8WgCDqS6I= -github.com/project-flogo/core v0.9.0-beta.1/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= +github.com/project-flogo/core v0.9.0-beta.2 h1:L5VLOfF3YfAFVJwn/tL3x0835sZIedrHcrPkYxHbPl4= +github.com/project-flogo/core v0.9.0-beta.2/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/function/number/random.go b/function/number/random.go index 6aaac270..07eb1cf3 100644 --- a/function/number/random.go +++ b/function/number/random.go @@ -16,7 +16,7 @@ type fnRandom struct { } func (fnRandom) Name() string { - return "number.random" + return "random" } func (fnRandom) Sig() (paramTypes []data.Type, isVariadic bool) { diff --git a/function/string/descriptor.json b/function/string/descriptor.json index 54b66cdf..220aab02 100644 --- a/function/string/descriptor.json +++ b/function/string/descriptor.json @@ -15,7 +15,8 @@ "name": "str", "type": "string" } - ] + ], + "returnType": "string" }, { "name": "equals", @@ -29,7 +30,8 @@ "name": "str2", "type": "string" } - ] + ], + "returnType": "bool" }, { "name": "equalsIgnoreCase", @@ -43,7 +45,8 @@ "name": "str2", "type": "string" } - ] + ], + "returnType": "bool" }, { "name": "contains", @@ -57,7 +60,8 @@ "name": "str2", "type": "string" } - ] + ], + "returnType": "bool" }, { "name": "float", @@ -67,7 +71,8 @@ "name": "str1", "type": "string" } - ] + ], + "returnType": "float64" }, { "name": "integer", @@ -77,7 +82,8 @@ "name": "str1", "type": "string" } - ] + ], + "returnType": "int" }, { "name": "len", @@ -87,7 +93,8 @@ "name": "str1", "type": "string" } - ] + ], + "returnType": "int" }, { "name": "substring", @@ -105,7 +112,8 @@ "name": "end", "type": "string" } - ] + ], + "returnType": "string" } ] } diff --git a/function/string/go.mod b/function/string/go.mod index 3e525594..241bf272 100644 --- a/function/string/go.mod +++ b/function/string/go.mod @@ -1,6 +1,6 @@ module github.com/project-flogo/contrib/function/string require ( - github.com/project-flogo/core v0.9.0-beta.1 + github.com/project-flogo/core v0.9.0-beta.2 github.com/stretchr/testify v1.3.0 ) diff --git a/function/string/go.sum b/function/string/go.sum index b661751c..46c68763 100644 --- a/function/string/go.sum +++ b/function/string/go.sum @@ -4,8 +4,8 @@ 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-beta.1 h1:tiRv5Lv6U1SnDJh6vB10y8AnEdF8/Zmahj8WgCDqS6I= -github.com/project-flogo/core v0.9.0-beta.1/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= +github.com/project-flogo/core v0.9.0-beta.2 h1:L5VLOfF3YfAFVJwn/tL3x0835sZIedrHcrPkYxHbPl4= +github.com/project-flogo/core v0.9.0-beta.2/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/trigger/channel/go.mod b/trigger/channel/go.mod index 09f08ab1..01578d85 100644 --- a/trigger/channel/go.mod +++ b/trigger/channel/go.mod @@ -1,3 +1,6 @@ module github.com/project-flogo/contrib/trigger/channel -require github.com/project-flogo/core v0.9.0-beta.1 +require ( + github.com/project-flogo/core v0.9.0-beta.2 + github.com/stretchr/testify v1.3.0 +) diff --git a/trigger/channel/go.sum b/trigger/channel/go.sum index b661751c..46c68763 100644 --- a/trigger/channel/go.sum +++ b/trigger/channel/go.sum @@ -4,8 +4,8 @@ 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-beta.1 h1:tiRv5Lv6U1SnDJh6vB10y8AnEdF8/Zmahj8WgCDqS6I= -github.com/project-flogo/core v0.9.0-beta.1/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= +github.com/project-flogo/core v0.9.0-beta.2 h1:L5VLOfF3YfAFVJwn/tL3x0835sZIedrHcrPkYxHbPl4= +github.com/project-flogo/core v0.9.0-beta.2/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/trigger/channel/trigger_test.go b/trigger/channel/trigger_test.go index 7b142304..4497e8fa 100644 --- a/trigger/channel/trigger_test.go +++ b/trigger/channel/trigger_test.go @@ -1,76 +1,107 @@ package channel -//var testMetadata *trigger.Metadata -// -//func getTestMetadata(t *testing.T) *trigger.Metadata { -// -// if testMetadata == nil { -// jsonMetadataBytes, err := ioutil.ReadFile("trigger.json") -// assert.Nil(t, err) -// -// md := trigger.NewMetadata(string(jsonMetadataBytes)) -// assert.NotNil(t, md) -// -// testMetadata = md -// } -// -// return testMetadata -//} -// -//const testConfig string = `{ -// "id": "flogo-channel", -// "ref": "github.com/project-flogo/contrib/trigger/channel", -// "handlers": [ -// { -// "settings": { -// "channel": "test" -// }, -// "action" : { -// "id": "dummy" -// } -// } -// ] -//} -//` -// -//func TestChannelFactory_New(t *testing.T) { -// -// md := getTestMetadata(t) -// f := &ChannelFactory{metadata: md} -// -// config := &trigger.Config{} -// json.Unmarshal([]byte(testConfig), config) -// -// trg := f.New(config) -// -// assert.NotNil(t, trg) -//} -// -//func TestChannelTrigger_Initialize(t *testing.T) { -// md := getTestMetadata(t) -// f := &ChannelFactory{metadata: md} -// -// config := &trigger.Config{} -// err := json.Unmarshal([]byte(testConfig), config) -// assert.Nil(t, err) -// -// actions := map[string]action.Action{"dummy": test.NewDummyAction(func() { -// //do nothing -// })} -// -// channels.Add("test:5") -// -// trg, err := test.InitTrigger(f, config, actions) -// -// assert.Nil(t, err) -// assert.NotNil(t, trg) +import ( + "encoding/json" + "io/ioutil" + "testing" + + "github.com/project-flogo/core/trigger" + "github.com/stretchr/testify/assert" +) + +var testMetadata *trigger.Metadata + // -// ct, ok := trg.(*Trigger) -// assert.True(t, ok) -// assert.Equal(t, 1, len(ct.handlers)) +func getTestMetadata(t *testing.T) *trigger.Metadata { + + if testMetadata == nil { + jsonMetadataBytes, err := ioutil.ReadFile("descriptor.json") + assert.Nil(t, err) + + md := trigger.NewMetadata(string(jsonMetadataBytes)) + assert.NotNil(t, md) + // + testMetadata = md + } + + return testMetadata +} + // -// channels.Close() -//} +const testConfig string = `{ + "id": "flogo-channel", + "ref": "github.com/project-flogo/contrib/trigger/channel", + "handlers": [ + { + "settings": { + "channel": "test" + }, + "action" : { + "id": "dummy" + } + } + ] +}` + +func TestChannelFactory_New(t *testing.T) { + + f := &Factory{} + + config := &trigger.Config{} + json.Unmarshal([]byte(testConfig), config) + + trg, err := f.New(config) + assert.Nil(t, err) + assert.NotNil(t, trg) +} + +/* +func TestChannelTrigger_Initialize(t *testing.T) { + f := &Factory{} + + config := &trigger.Config{} + err := json.Unmarshal([]byte(testConfig), config) + assert.Nil(t, err) + + actions := map[string]action.Action{"dummy": test.NewDummyAction(func() { + //do nothing + })} + + trg, err := test.InitTrigger(f, config, actions) + assert.Nil(t, err) + assert.NotNil(t, trg) + +} + + +func TestChannelTrigger_Initialize(t *testing.T) { + + f := &Factory{} + + config := &trigger.Config{} + err := json.Unmarshal([]byte(testConfig), config) + assert.Nil(t, err) + + actions := map[string]action.Action{"dummy": test.NewDummyAction(func() { + //do nothing + })} + + trg, err := f.New(config) + + channels.Add("test:5") + + trg, err := trg.Initialize(f, config, actions) + + assert.Nil(t, err) + assert.NotNil(t, trg) + + ct, ok := trg.(*Trigger) + assert.True(t, ok) + assert.Equal(t, 1, len(ct.handlers)) + + channels.Close() +} +*/ // //func TestChannelTrigger_Handler(t *testing.T) { // md := getTestMetadata(t) diff --git a/trigger/cli/go.mod b/trigger/cli/go.mod index d9db773f..b4330fab 100644 --- a/trigger/cli/go.mod +++ b/trigger/cli/go.mod @@ -1,3 +1,6 @@ module github.com/project-flogo/contrib/trigger/cli -require github.com/project-flogo/core v0.9.0-alpha.6 +require ( + github.com/project-flogo/core v0.9.0-beta.2 + github.com/stretchr/testify v1.3.0 +) diff --git a/trigger/cli/go.sum b/trigger/cli/go.sum index 1f44d916..7e5bc071 100644 --- a/trigger/cli/go.sum +++ b/trigger/cli/go.sum @@ -1,16 +1,15 @@ -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/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/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/project-flogo/core v0.9.0-beta.2 h1:L5VLOfF3YfAFVJwn/tL3x0835sZIedrHcrPkYxHbPl4= +github.com/project-flogo/core v0.9.0-beta.2/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 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= diff --git a/trigger/cli/trigger.go b/trigger/cli/trigger.go index 849214f6..eb5acd1d 100644 --- a/trigger/cli/trigger.go +++ b/trigger/cli/trigger.go @@ -155,7 +155,8 @@ func Invoke() (string, error) { cliPath, _ := os.Executable() cliName := filepath.Base(cliPath) - + + //Todo? if singleton.settings.SingleCmd { } diff --git a/trigger/cli/trigger_test.go b/trigger/cli/trigger_test.go index 789205ba..09a4241d 100644 --- a/trigger/cli/trigger_test.go +++ b/trigger/cli/trigger_test.go @@ -1,40 +1,74 @@ package cli import ( - "io/ioutil" -) + "encoding/json" + "testing" -var jsonTestMetadata = getTestJsonMetadata() + "github.com/project-flogo/core/action" + "github.com/project-flogo/core/support/test" + "github.com/project-flogo/core/trigger" + "github.com/stretchr/testify/assert" +) -func getTestJsonMetadata() string { - jsonMetadataBytes, err := ioutil.ReadFile("trigger.json") - if err != nil { - panic("No Json Metadata found for trigger.json path") - } - return string(jsonMetadataBytes) -} +//var jsonTestMetadata = getTestJsonMetadata() +// +//func getTestJsonMetadata() string { +// jsonMetadataBytes, err := ioutil.ReadFile("trigger.json") +// if err != nil { +// panic("No Json Metadata found for trigger.json path") +// } +// return string(jsonMetadataBytes) +//} const testConfig string = `{ "id": "flogo-cli", - "ref": "github.com/project-flogo/contrib/trigger/cli", + "ref": "github.com/project-flogo/contrib/trigger/cli", + "settings":{ + "singleCmd":true + }, "handlers": [ { - "actionId": "", - "settings": { - "command": "run", - "default": "true" - } - }, - { - "actionId": "version_flow", - "settings": { - "command": "version" + "action":{ + "id": "dummy" + }, + "settings": { + "command": "run" } } ] } ` +func TestInitOk(t *testing.T) { + // New factory + f := &Factory{} + + config := &trigger.Config{} + json.Unmarshal([]byte(testConfig), &config) + tgr, err := f.New(config) + assert.Nil(t, err) + assert.NotNil(t, tgr) + +} + +func TestCliTrigger_Initialize(t *testing.T) { + f := &Factory{} + + config := &trigger.Config{} + err := json.Unmarshal([]byte(testConfig), config) + assert.Nil(t, err) + + actions := map[string]action.Action{"dummy": test.NewDummyAction(func() { + //do nothing + })} + + trg, err := test.InitTrigger(f, config, actions) + assert.Nil(t, err) + assert.NotNil(t, trg) + _, err = Invoke() + assert.Nil(t, err) +} + /* //TODO fix this test func TestInitOk(t *testing.T) { diff --git a/trigger/loadtester/README.md b/trigger/loadtester/README.md index aeae6a0e..cc178878 100644 --- a/trigger/loadtester/README.md +++ b/trigger/loadtester/README.md @@ -5,7 +5,7 @@ weight: 4706 # LoadTester Trigger This trigger provides your flogo application the ability to run simple load test on a specified action -Implementation based off github.com/tsliwowicz/go-wrk +Implementation based off [go-wrk](github.com/tsliwowicz/go-wrk). ## Installation diff --git a/trigger/loadtester/go.mod b/trigger/loadtester/go.mod index 72a30ff4..0a5efb6a 100644 --- a/trigger/loadtester/go.mod +++ b/trigger/loadtester/go.mod @@ -1,3 +1,7 @@ module github.com/project-flogo/contrib/trigger/loadtester -require github.com/project-flogo/core v0.9.0-beta.1 +require ( + github.com/project-flogo/core v0.9.0-beta.2 + go.uber.org/atomic v1.3.2 // indirect + go.uber.org/multierr v1.1.0 // indirect +) diff --git a/trigger/loadtester/go.sum b/trigger/loadtester/go.sum index b661751c..46c68763 100644 --- a/trigger/loadtester/go.sum +++ b/trigger/loadtester/go.sum @@ -4,8 +4,8 @@ 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-beta.1 h1:tiRv5Lv6U1SnDJh6vB10y8AnEdF8/Zmahj8WgCDqS6I= -github.com/project-flogo/core v0.9.0-beta.1/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= +github.com/project-flogo/core v0.9.0-beta.2 h1:L5VLOfF3YfAFVJwn/tL3x0835sZIedrHcrPkYxHbPl4= +github.com/project-flogo/core v0.9.0-beta.2/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/trigger/rest/go.mod b/trigger/rest/go.mod index 891618ba..f6d1f8d6 100644 --- a/trigger/rest/go.mod +++ b/trigger/rest/go.mod @@ -2,6 +2,6 @@ module github.com/project-flogo/contrib/trigger/rest require ( github.com/julienschmidt/httprouter v1.2.0 - github.com/project-flogo/core v0.9.0-beta.1 + github.com/project-flogo/core v0.9.0-beta.2 github.com/stretchr/testify v1.3.0 ) diff --git a/trigger/rest/go.sum b/trigger/rest/go.sum index 271774c2..ca234c11 100644 --- a/trigger/rest/go.sum +++ b/trigger/rest/go.sum @@ -6,8 +6,8 @@ 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-beta.1 h1:tiRv5Lv6U1SnDJh6vB10y8AnEdF8/Zmahj8WgCDqS6I= -github.com/project-flogo/core v0.9.0-beta.1/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= +github.com/project-flogo/core v0.9.0-beta.2 h1:L5VLOfF3YfAFVJwn/tL3x0835sZIedrHcrPkYxHbPl4= +github.com/project-flogo/core v0.9.0-beta.2/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= diff --git a/trigger/rest/trigger_test.go b/trigger/rest/trigger_test.go index fdbfdfc5..289c66ed 100644 --- a/trigger/rest/trigger_test.go +++ b/trigger/rest/trigger_test.go @@ -4,14 +4,17 @@ import ( "context" "crypto/tls" "crypto/x509" + "encoding/json" "fmt" "sync" "testing" "time" + "github.com/project-flogo/core/action" "github.com/project-flogo/core/api" "github.com/project-flogo/core/engine" "github.com/project-flogo/core/support" + "github.com/project-flogo/core/support/test" "github.com/project-flogo/core/trigger" "github.com/stretchr/testify/assert" ) @@ -23,6 +26,47 @@ func TestTrigger_Register(t *testing.T) { assert.NotNil(t, f) } +const testConfig string = `{ + "id": "trigger-rest", + "ref": "github.com/project-flogo/contrib/trigger/rest", + "settings": { + "port": "8888" + }, + "handlers": [ + { + "settings": { + "method": "GET", + "path": "/test" + }, + "action" : { + "id": "dummy" + } + } + ] + }` + +func TestRestTrigger_Initialize(t *testing.T) { + + f := &Factory{} + + config := &trigger.Config{} + err := json.Unmarshal([]byte(testConfig), config) + assert.Nil(t, err) + + actions := map[string]action.Action{"dummy": test.NewDummyAction(func() { + })} + + trg, err := test.InitTrigger(f, config, actions) + + assert.Nil(t, err) + assert.NotNil(t, trg) + err = trg.Start() + assert.Nil(t, err) + err = trg.Stop() + assert.Nil(t, err) + +} + func Test_App(t *testing.T) { var wg sync.WaitGroup app := myApp() diff --git a/trigger/timer/go.mod b/trigger/timer/go.mod index c9482f23..4393bbf5 100644 --- a/trigger/timer/go.mod +++ b/trigger/timer/go.mod @@ -2,5 +2,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-beta.1 + github.com/project-flogo/core v0.9.0-beta.2 + github.com/stretchr/testify v1.3.0 ) diff --git a/trigger/timer/go.sum b/trigger/timer/go.sum index 7fed540d..4ea49160 100644 --- a/trigger/timer/go.sum +++ b/trigger/timer/go.sum @@ -6,8 +6,9 @@ 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-beta.1 h1:tiRv5Lv6U1SnDJh6vB10y8AnEdF8/Zmahj8WgCDqS6I= -github.com/project-flogo/core v0.9.0-beta.1/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= +github.com/project-flogo/core v0.9.0-beta.2 h1:L5VLOfF3YfAFVJwn/tL3x0835sZIedrHcrPkYxHbPl4= +github.com/project-flogo/core v0.9.0-beta.2/go.mod h1:dzmBbQfNNC0g0KClKYQxxGJLe53MHafg75Vhmw2TW8U= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/trigger/timer/timer_test.go b/trigger/timer/timer_test.go index b0109090..60678c71 100644 --- a/trigger/timer/timer_test.go +++ b/trigger/timer/timer_test.go @@ -1,3 +1,56 @@ package timer -//todo implement +import ( + "encoding/json" + "testing" + + "github.com/project-flogo/core/action" + "github.com/project-flogo/core/support/test" + "github.com/project-flogo/core/trigger" + "github.com/stretchr/testify/assert" +) + +const testConfig string = `{ + "id": "flogo-timer", + "ref": "github.com/project-flogo/contrib/trigger/timer", + "handlers": [ + { + "settings":{ + "repeatInterval" : "1s" + }, + "action":{ + "id":"dummy" + } + } + ] + } + ` + +func TestInitOk(t *testing.T) { + f := &Factory{} + tgr, err := f.New(nil) + assert.Nil(t, err) + assert.NotNil(t, tgr) +} + +func TestTimerTrigger_Initialize(t *testing.T) { + f := &Factory{} + + config := &trigger.Config{} + err := json.Unmarshal([]byte(testConfig), config) + assert.Nil(t, err) + + actions := map[string]action.Action{"dummy": test.NewDummyAction(func() { + //do nothing + })} + + trg, err := test.InitTrigger(f, config, actions) + assert.Nil(t, err) + assert.NotNil(t, trg) + + err = trg.Start() + assert.Nil(t, err) + err = trg.Stop() + assert.Nil(t, err) + +}