Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate JSON schema of flow action definition #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion action.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func recordFlows() bool {
return b
}

func (f *ActionFactory) New(config *action.Config) (action.Action, error) {
func (f *ActionFactory) New(config *action.ActionConfig) (action.Action, error) {

flowAction := &FlowAction{}

Expand Down
12 changes: 6 additions & 6 deletions action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (testInitCtx) ResourceManager() *resource.Manager {
//TestInitNoFlavorError
func TestInitNoFlavorError(t *testing.T) {

mockConfig := &action.Config{Id: "myMockConfig", Ref: "github.com/my/mock/ref", Data: []byte(`{}`)}
mockConfig := &action.ActionConfig{Id: "myMockConfig", Ref: "github.com/my/mock/ref", Data: []byte(`{}`)}
f := &ActionFactory{}
f.Initialize(&testInitCtx{})
_, err := f.New(mockConfig)
Expand All @@ -39,7 +39,7 @@ func TestInitUnCompressedFlowFlavorError(t *testing.T) {

mockFlowData := []byte(`{"flow":{}}`)

mockConfig := &action.Config{Id: "myMockConfig", Ref: "github.com/my/mock/ref", Data: mockFlowData}
mockConfig := &action.ActionConfig{Id: "myMockConfig", Ref: "github.com/my/mock/ref", Data: mockFlowData}

f := &ActionFactory{}
f.Initialize(&testInitCtx{})
Expand All @@ -52,7 +52,7 @@ func TestInitCompressedFlowFlavorError(t *testing.T) {

mockFlowData := []byte(`{"flowCompressed":""}`)

mockConfig := &action.Config{Id: "myMockConfig", Ref: "github.com/my/mock/ref", Data: mockFlowData}
mockConfig := &action.ActionConfig{Id: "myMockConfig", Ref: "github.com/my/mock/ref", Data: mockFlowData}

f := &ActionFactory{}
f.Initialize(&testInitCtx{})
Expand All @@ -65,7 +65,7 @@ func TestInitURIFlowFlavorError(t *testing.T) {

mockFlowData := []byte(`{"flowURI":""}`)

mockConfig := &action.Config{Id: "myMockConfig", Ref: "github.com/my/mock/ref", Data: mockFlowData}
mockConfig := &action.ActionConfig{Id: "myMockConfig", Ref: "github.com/my/mock/ref", Data: mockFlowData}

f := &ActionFactory{}
f.Initialize(&testInitCtx{})
Expand Down Expand Up @@ -220,7 +220,7 @@ var testRestartInitialState = `{

func TestFlowAction_Run_Restart(t *testing.T) {

cfg := &action.Config{}
cfg := &action.ActionConfig{}
err := json.Unmarshal([]byte(testFlowActionCfg), cfg)

if err != nil {
Expand Down Expand Up @@ -395,7 +395,7 @@ func TestRequestProcessor_RestartFlow(t *testing.T) {
af.Initialize(&testInitCtx{})

loader := resource.GetLoader("flow")
rConfig1 := &resource.Config{ID: "flow:flow1", Data: []byte(jsonFlow1)}
rConfig1 := &resource.ResourceConfig{ID: "flow:flow1", Data: []byte(jsonFlow1)}
_, err := loader.LoadResource(rConfig1)
assert.Nil(t, err)

Expand Down
6 changes: 3 additions & 3 deletions activity/subflow/activity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func TestSubFlow(t *testing.T) {
err := initActionFactory(af)
assert.Nil(t, err)

flowAction, err := f.New(&action.Config{Settings: map[string]interface{}{"flowURI": "res://flow:flow1"}})
flowAction, err := f.New(&action.ActionConfig{Settings: map[string]interface{}{"flowURI": "res://flow:flow1"}})

assert.Nil(t, err)
assert.NotNil(t, flowAction)
Expand All @@ -201,8 +201,8 @@ func initActionFactory(af action.Factory) error {
ctx := test.NewActionInitCtx()
af.Initialize(ctx)

rConfig1 := &resource.Config{ID: "flow:flow1", Data: []byte(jsonFlow1)}
rConfig2 := &resource.Config{ID: "flow:flow2", Data: []byte(jsonFlow2)}
rConfig1 := &resource.ResourceConfig{ID: "flow:flow1", Data: []byte(jsonFlow1)}
rConfig2 := &resource.ResourceConfig{ID: "flow:flow2", Data: []byte(jsonFlow2)}

err := ctx.AddResource(support.RESTYPE_FLOW, rConfig1)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion support/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const (
type FlowLoader struct {
}

func (*FlowLoader) LoadResource(config *resource.Config) (*resource.Resource, error) {
func (*FlowLoader) LoadResource(config *resource.ResourceConfig) (*resource.Resource, error) {
var flowDefBytes []byte

flowDefBytes = config.Data
Expand Down
6 changes: 3 additions & 3 deletions tester/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (rp *RequestProcessor) StartFlow(startRequest *StartRequest) (results map[s
logger.Debugf("Tester starting flow")

factory := action.GetFactory(RefFlow)
act, _ := factory.New(&action.Config{})
act, _ := factory.New(&action.ActionConfig{})

var inputs map[string]interface{}

Expand Down Expand Up @@ -88,7 +88,7 @@ func (rp *RequestProcessor) RestartFlow(restartRequest *RestartRequest) (results
logger.Debugf("Tester restarting flow")

factory := action.GetFactory(RefFlow)
act, _ := factory.New(&action.Config{})
act, _ := factory.New(&action.ActionConfig{})

inputs := make(map[string]interface{}, len(restartRequest.Data)+1)

Expand Down Expand Up @@ -119,7 +119,7 @@ func (rp *RequestProcessor) ResumeFlow(resumeRequest *ResumeRequest) (results ma
logger.Debugf("Tester resuming flow")

factory := action.GetFactory(RefFlow)
act, _ := factory.New(&action.Config{})
act, _ := factory.New(&action.ActionConfig{})

inputs := make(map[string]interface{}, len(resumeRequest.Data)+1)

Expand Down