github.com/dcarley/cf-cli@v6.24.1-0.20170220111324-4225ff346898+incompatible/command/commandfakes/fake_shared_actor.go (about)

     1  // This file was generated by counterfeiter
     2  package commandfakes
     3  
     4  import (
     5  	"sync"
     6  
     7  	"code.cloudfoundry.org/cli/actor/sharedaction"
     8  	"code.cloudfoundry.org/cli/command"
     9  )
    10  
    11  type FakeSharedActor struct {
    12  	CheckTargetStub        func(config sharedaction.Config, targetedOrganizationRequired bool, targetedSpaceRequired bool) error
    13  	checkTargetMutex       sync.RWMutex
    14  	checkTargetArgsForCall []struct {
    15  		config                       sharedaction.Config
    16  		targetedOrganizationRequired bool
    17  		targetedSpaceRequired        bool
    18  	}
    19  	checkTargetReturns struct {
    20  		result1 error
    21  	}
    22  	invocations      map[string][][]interface{}
    23  	invocationsMutex sync.RWMutex
    24  }
    25  
    26  func (fake *FakeSharedActor) CheckTarget(config sharedaction.Config, targetedOrganizationRequired bool, targetedSpaceRequired bool) error {
    27  	fake.checkTargetMutex.Lock()
    28  	fake.checkTargetArgsForCall = append(fake.checkTargetArgsForCall, struct {
    29  		config                       sharedaction.Config
    30  		targetedOrganizationRequired bool
    31  		targetedSpaceRequired        bool
    32  	}{config, targetedOrganizationRequired, targetedSpaceRequired})
    33  	fake.recordInvocation("CheckTarget", []interface{}{config, targetedOrganizationRequired, targetedSpaceRequired})
    34  	fake.checkTargetMutex.Unlock()
    35  	if fake.CheckTargetStub != nil {
    36  		return fake.CheckTargetStub(config, targetedOrganizationRequired, targetedSpaceRequired)
    37  	} else {
    38  		return fake.checkTargetReturns.result1
    39  	}
    40  }
    41  
    42  func (fake *FakeSharedActor) CheckTargetCallCount() int {
    43  	fake.checkTargetMutex.RLock()
    44  	defer fake.checkTargetMutex.RUnlock()
    45  	return len(fake.checkTargetArgsForCall)
    46  }
    47  
    48  func (fake *FakeSharedActor) CheckTargetArgsForCall(i int) (sharedaction.Config, bool, bool) {
    49  	fake.checkTargetMutex.RLock()
    50  	defer fake.checkTargetMutex.RUnlock()
    51  	return fake.checkTargetArgsForCall[i].config, fake.checkTargetArgsForCall[i].targetedOrganizationRequired, fake.checkTargetArgsForCall[i].targetedSpaceRequired
    52  }
    53  
    54  func (fake *FakeSharedActor) CheckTargetReturns(result1 error) {
    55  	fake.CheckTargetStub = nil
    56  	fake.checkTargetReturns = struct {
    57  		result1 error
    58  	}{result1}
    59  }
    60  
    61  func (fake *FakeSharedActor) Invocations() map[string][][]interface{} {
    62  	fake.invocationsMutex.RLock()
    63  	defer fake.invocationsMutex.RUnlock()
    64  	fake.checkTargetMutex.RLock()
    65  	defer fake.checkTargetMutex.RUnlock()
    66  	return fake.invocations
    67  }
    68  
    69  func (fake *FakeSharedActor) recordInvocation(key string, args []interface{}) {
    70  	fake.invocationsMutex.Lock()
    71  	defer fake.invocationsMutex.Unlock()
    72  	if fake.invocations == nil {
    73  		fake.invocations = map[string][][]interface{}{}
    74  	}
    75  	if fake.invocations[key] == nil {
    76  		fake.invocations[key] = [][]interface{}{}
    77  	}
    78  	fake.invocations[key] = append(fake.invocations[key], args)
    79  }
    80  
    81  var _ command.SharedActor = new(FakeSharedActor)