github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/worker/uniter/relation/mock_test.go (about)

     1  // Copyright 2015 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package relation_test
     5  
     6  import (
     7  	"fmt"
     8  
     9  	"github.com/juju/juju/worker/uniter/hook"
    10  	"github.com/juju/juju/worker/uniter/operation"
    11  )
    12  
    13  type mockOperations struct {
    14  	operation.Factory
    15  }
    16  
    17  func (m *mockOperations) NewRunHook(hookInfo hook.Info) (operation.Operation, error) {
    18  	return &mockOperation{hookInfo}, nil
    19  }
    20  
    21  type mockOperation struct {
    22  	hookInfo hook.Info
    23  }
    24  
    25  func (m *mockOperation) String() string {
    26  	return fmt.Sprintf("run hook %v on unit with relation %d",
    27  		m.hookInfo.Kind, m.hookInfo.RelationId)
    28  }
    29  
    30  func (m *mockOperation) NeedsGlobalMachineLock() bool {
    31  	return false
    32  }
    33  
    34  func (m *mockOperation) Prepare(state operation.State) (*operation.State, error) {
    35  	return &state, nil
    36  }
    37  
    38  func (m *mockOperation) Execute(state operation.State) (*operation.State, error) {
    39  	return &state, nil
    40  }
    41  
    42  func (m *mockOperation) Commit(state operation.State) (*operation.State, error) {
    43  	return &state, nil
    44  }