github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/api/copyapplicationsource/copyapplicationsourcefakes/fake_repository.go (about)

     1  // This file was generated by counterfeiter
     2  package copyapplicationsourcefakes
     3  
     4  import (
     5  	"sync"
     6  
     7  	"code.cloudfoundry.org/cli/cf/api/copyapplicationsource"
     8  )
     9  
    10  type FakeRepository struct {
    11  	CopyApplicationStub        func(sourceAppGUID, targetAppGUID string) error
    12  	copyApplicationMutex       sync.RWMutex
    13  	copyApplicationArgsForCall []struct {
    14  		sourceAppGUID string
    15  		targetAppGUID string
    16  	}
    17  	copyApplicationReturns struct {
    18  		result1 error
    19  	}
    20  	invocations      map[string][][]interface{}
    21  	invocationsMutex sync.RWMutex
    22  }
    23  
    24  func (fake *FakeRepository) CopyApplication(sourceAppGUID string, targetAppGUID string) error {
    25  	fake.copyApplicationMutex.Lock()
    26  	fake.copyApplicationArgsForCall = append(fake.copyApplicationArgsForCall, struct {
    27  		sourceAppGUID string
    28  		targetAppGUID string
    29  	}{sourceAppGUID, targetAppGUID})
    30  	fake.recordInvocation("CopyApplication", []interface{}{sourceAppGUID, targetAppGUID})
    31  	fake.copyApplicationMutex.Unlock()
    32  	if fake.CopyApplicationStub != nil {
    33  		return fake.CopyApplicationStub(sourceAppGUID, targetAppGUID)
    34  	} else {
    35  		return fake.copyApplicationReturns.result1
    36  	}
    37  }
    38  
    39  func (fake *FakeRepository) CopyApplicationCallCount() int {
    40  	fake.copyApplicationMutex.RLock()
    41  	defer fake.copyApplicationMutex.RUnlock()
    42  	return len(fake.copyApplicationArgsForCall)
    43  }
    44  
    45  func (fake *FakeRepository) CopyApplicationArgsForCall(i int) (string, string) {
    46  	fake.copyApplicationMutex.RLock()
    47  	defer fake.copyApplicationMutex.RUnlock()
    48  	return fake.copyApplicationArgsForCall[i].sourceAppGUID, fake.copyApplicationArgsForCall[i].targetAppGUID
    49  }
    50  
    51  func (fake *FakeRepository) CopyApplicationReturns(result1 error) {
    52  	fake.CopyApplicationStub = nil
    53  	fake.copyApplicationReturns = struct {
    54  		result1 error
    55  	}{result1}
    56  }
    57  
    58  func (fake *FakeRepository) Invocations() map[string][][]interface{} {
    59  	fake.invocationsMutex.RLock()
    60  	defer fake.invocationsMutex.RUnlock()
    61  	fake.copyApplicationMutex.RLock()
    62  	defer fake.copyApplicationMutex.RUnlock()
    63  	return fake.invocations
    64  }
    65  
    66  func (fake *FakeRepository) recordInvocation(key string, args []interface{}) {
    67  	fake.invocationsMutex.Lock()
    68  	defer fake.invocationsMutex.Unlock()
    69  	if fake.invocations == nil {
    70  		fake.invocations = map[string][][]interface{}{}
    71  	}
    72  	if fake.invocations[key] == nil {
    73  		fake.invocations[key] = [][]interface{}{}
    74  	}
    75  	fake.invocations[key] = append(fake.invocations[key], args)
    76  }
    77  
    78  var _ copyapplicationsource.Repository = new(FakeRepository)