Skip to content

Commit

Permalink
Merge pull request #39 from project-flogo/#38-changePatternDirectory
Browse files Browse the repository at this point in the history
#38 change pattern directory
  • Loading branch information
pointlander committed Mar 5, 2019
2 parents ee81642 + 4713f56 commit fe88b77
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 14 deletions.
3 changes: 1 addition & 2 deletions action.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"github.com/project-flogo/microgateway/api"
"github.com/project-flogo/microgateway/internal/core"
_ "github.com/project-flogo/microgateway/internal/function"
"github.com/project-flogo/microgateway/internal/pattern"
"github.com/project-flogo/microgateway/internal/schema"
)

Expand Down Expand Up @@ -135,7 +134,7 @@ func (f *Factory) New(config *action.Config) (action.Action, error) {
actionData = resData.Object().(*api.Microgateway)
}
} else if p := act.settings.Pattern; p != "" {
definition, err := pattern.Load(p)
definition, err := Load(p)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion examples/api/async-gateway/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ func main() {
panic(err)
}
engine.RunEngine(e)
}
}
3 changes: 1 addition & 2 deletions examples/examples.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/project-flogo/core/engine/channels"
"github.com/project-flogo/microgateway"
microapi "github.com/project-flogo/microgateway/api"
"github.com/project-flogo/microgateway/internal/pattern"
)

// BasicGatewayExample returns a Basic Gateway API example
Expand Down Expand Up @@ -231,7 +230,7 @@ func DefaultChannelPattern() (engine.Engine, error) {

// CustomPattern returns an engine configured for given pattern name
func CustomPattern(patternName string, custompattern string) (engine.Engine, error) {
err := pattern.Register(patternName, custompattern)
err := microgateway.Register(patternName, custompattern)
if err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion examples/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ func testAsyncGatewayExample(t *testing.T, e engine.Engine) {
}

body := request()
fmt.Println("body is:",body)
fmt.Println("body is:", body)
assert.NotEqual(t, 0, len(body))
}

Expand Down
10 changes: 6 additions & 4 deletions internal/pattern/assets.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions internal/pattern/generate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//go:generate go-bindata -pkg pattern -o assets.go DefaultHttpPattern.json DefaultChannelPattern.json

package pattern
7 changes: 3 additions & 4 deletions internal/pattern/pattern.go → pattern.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
//go:generate go-bindata -pkg pattern -o assets.go DefaultHttpPattern.json DefaultChannelPattern.json

package pattern
package microgateway

import (
"encoding/json"
"fmt"
"github.com/project-flogo/microgateway/api"
"github.com/project-flogo/microgateway/internal/pattern"
)

var patternMap = make(map[string][]byte)
Expand All @@ -14,7 +13,7 @@ func init() {
patterns := []string{"DefaultChannelPattern", "DefaultHttpPattern"}
for i := range patterns {
patternName := patterns[i] + ".json"
JSON, err := Asset(patternName)
JSON, err := pattern.Asset(patternName)
if err != nil {
fmt.Println("Error from Asset function")
}
Expand Down

0 comments on commit fe88b77

Please sign in to comment.