github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/cf/api/applicationbits/applicationbitsfakes/fake_repository.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package applicationbitsfakes
     3  
     4  import (
     5  	"os"
     6  	"sync"
     7  
     8  	"code.cloudfoundry.org/cli/cf/api/applicationbits"
     9  	"code.cloudfoundry.org/cli/cf/api/resources"
    10  )
    11  
    12  type FakeRepository struct {
    13  	GetApplicationFilesStub        func([]resources.AppFileResource) ([]resources.AppFileResource, error)
    14  	getApplicationFilesMutex       sync.RWMutex
    15  	getApplicationFilesArgsForCall []struct {
    16  		arg1 []resources.AppFileResource
    17  	}
    18  	getApplicationFilesReturns struct {
    19  		result1 []resources.AppFileResource
    20  		result2 error
    21  	}
    22  	getApplicationFilesReturnsOnCall map[int]struct {
    23  		result1 []resources.AppFileResource
    24  		result2 error
    25  	}
    26  	UploadBitsStub        func(string, *os.File, []resources.AppFileResource) error
    27  	uploadBitsMutex       sync.RWMutex
    28  	uploadBitsArgsForCall []struct {
    29  		arg1 string
    30  		arg2 *os.File
    31  		arg3 []resources.AppFileResource
    32  	}
    33  	uploadBitsReturns struct {
    34  		result1 error
    35  	}
    36  	uploadBitsReturnsOnCall map[int]struct {
    37  		result1 error
    38  	}
    39  	invocations      map[string][][]interface{}
    40  	invocationsMutex sync.RWMutex
    41  }
    42  
    43  func (fake *FakeRepository) GetApplicationFiles(arg1 []resources.AppFileResource) ([]resources.AppFileResource, error) {
    44  	var arg1Copy []resources.AppFileResource
    45  	if arg1 != nil {
    46  		arg1Copy = make([]resources.AppFileResource, len(arg1))
    47  		copy(arg1Copy, arg1)
    48  	}
    49  	fake.getApplicationFilesMutex.Lock()
    50  	ret, specificReturn := fake.getApplicationFilesReturnsOnCall[len(fake.getApplicationFilesArgsForCall)]
    51  	fake.getApplicationFilesArgsForCall = append(fake.getApplicationFilesArgsForCall, struct {
    52  		arg1 []resources.AppFileResource
    53  	}{arg1Copy})
    54  	fake.recordInvocation("GetApplicationFiles", []interface{}{arg1Copy})
    55  	fake.getApplicationFilesMutex.Unlock()
    56  	if fake.GetApplicationFilesStub != nil {
    57  		return fake.GetApplicationFilesStub(arg1)
    58  	}
    59  	if specificReturn {
    60  		return ret.result1, ret.result2
    61  	}
    62  	fakeReturns := fake.getApplicationFilesReturns
    63  	return fakeReturns.result1, fakeReturns.result2
    64  }
    65  
    66  func (fake *FakeRepository) GetApplicationFilesCallCount() int {
    67  	fake.getApplicationFilesMutex.RLock()
    68  	defer fake.getApplicationFilesMutex.RUnlock()
    69  	return len(fake.getApplicationFilesArgsForCall)
    70  }
    71  
    72  func (fake *FakeRepository) GetApplicationFilesCalls(stub func([]resources.AppFileResource) ([]resources.AppFileResource, error)) {
    73  	fake.getApplicationFilesMutex.Lock()
    74  	defer fake.getApplicationFilesMutex.Unlock()
    75  	fake.GetApplicationFilesStub = stub
    76  }
    77  
    78  func (fake *FakeRepository) GetApplicationFilesArgsForCall(i int) []resources.AppFileResource {
    79  	fake.getApplicationFilesMutex.RLock()
    80  	defer fake.getApplicationFilesMutex.RUnlock()
    81  	argsForCall := fake.getApplicationFilesArgsForCall[i]
    82  	return argsForCall.arg1
    83  }
    84  
    85  func (fake *FakeRepository) GetApplicationFilesReturns(result1 []resources.AppFileResource, result2 error) {
    86  	fake.getApplicationFilesMutex.Lock()
    87  	defer fake.getApplicationFilesMutex.Unlock()
    88  	fake.GetApplicationFilesStub = nil
    89  	fake.getApplicationFilesReturns = struct {
    90  		result1 []resources.AppFileResource
    91  		result2 error
    92  	}{result1, result2}
    93  }
    94  
    95  func (fake *FakeRepository) GetApplicationFilesReturnsOnCall(i int, result1 []resources.AppFileResource, result2 error) {
    96  	fake.getApplicationFilesMutex.Lock()
    97  	defer fake.getApplicationFilesMutex.Unlock()
    98  	fake.GetApplicationFilesStub = nil
    99  	if fake.getApplicationFilesReturnsOnCall == nil {
   100  		fake.getApplicationFilesReturnsOnCall = make(map[int]struct {
   101  			result1 []resources.AppFileResource
   102  			result2 error
   103  		})
   104  	}
   105  	fake.getApplicationFilesReturnsOnCall[i] = struct {
   106  		result1 []resources.AppFileResource
   107  		result2 error
   108  	}{result1, result2}
   109  }
   110  
   111  func (fake *FakeRepository) UploadBits(arg1 string, arg2 *os.File, arg3 []resources.AppFileResource) error {
   112  	var arg3Copy []resources.AppFileResource
   113  	if arg3 != nil {
   114  		arg3Copy = make([]resources.AppFileResource, len(arg3))
   115  		copy(arg3Copy, arg3)
   116  	}
   117  	fake.uploadBitsMutex.Lock()
   118  	ret, specificReturn := fake.uploadBitsReturnsOnCall[len(fake.uploadBitsArgsForCall)]
   119  	fake.uploadBitsArgsForCall = append(fake.uploadBitsArgsForCall, struct {
   120  		arg1 string
   121  		arg2 *os.File
   122  		arg3 []resources.AppFileResource
   123  	}{arg1, arg2, arg3Copy})
   124  	fake.recordInvocation("UploadBits", []interface{}{arg1, arg2, arg3Copy})
   125  	fake.uploadBitsMutex.Unlock()
   126  	if fake.UploadBitsStub != nil {
   127  		return fake.UploadBitsStub(arg1, arg2, arg3)
   128  	}
   129  	if specificReturn {
   130  		return ret.result1
   131  	}
   132  	fakeReturns := fake.uploadBitsReturns
   133  	return fakeReturns.result1
   134  }
   135  
   136  func (fake *FakeRepository) UploadBitsCallCount() int {
   137  	fake.uploadBitsMutex.RLock()
   138  	defer fake.uploadBitsMutex.RUnlock()
   139  	return len(fake.uploadBitsArgsForCall)
   140  }
   141  
   142  func (fake *FakeRepository) UploadBitsCalls(stub func(string, *os.File, []resources.AppFileResource) error) {
   143  	fake.uploadBitsMutex.Lock()
   144  	defer fake.uploadBitsMutex.Unlock()
   145  	fake.UploadBitsStub = stub
   146  }
   147  
   148  func (fake *FakeRepository) UploadBitsArgsForCall(i int) (string, *os.File, []resources.AppFileResource) {
   149  	fake.uploadBitsMutex.RLock()
   150  	defer fake.uploadBitsMutex.RUnlock()
   151  	argsForCall := fake.uploadBitsArgsForCall[i]
   152  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
   153  }
   154  
   155  func (fake *FakeRepository) UploadBitsReturns(result1 error) {
   156  	fake.uploadBitsMutex.Lock()
   157  	defer fake.uploadBitsMutex.Unlock()
   158  	fake.UploadBitsStub = nil
   159  	fake.uploadBitsReturns = struct {
   160  		result1 error
   161  	}{result1}
   162  }
   163  
   164  func (fake *FakeRepository) UploadBitsReturnsOnCall(i int, result1 error) {
   165  	fake.uploadBitsMutex.Lock()
   166  	defer fake.uploadBitsMutex.Unlock()
   167  	fake.UploadBitsStub = nil
   168  	if fake.uploadBitsReturnsOnCall == nil {
   169  		fake.uploadBitsReturnsOnCall = make(map[int]struct {
   170  			result1 error
   171  		})
   172  	}
   173  	fake.uploadBitsReturnsOnCall[i] = struct {
   174  		result1 error
   175  	}{result1}
   176  }
   177  
   178  func (fake *FakeRepository) Invocations() map[string][][]interface{} {
   179  	fake.invocationsMutex.RLock()
   180  	defer fake.invocationsMutex.RUnlock()
   181  	fake.getApplicationFilesMutex.RLock()
   182  	defer fake.getApplicationFilesMutex.RUnlock()
   183  	fake.uploadBitsMutex.RLock()
   184  	defer fake.uploadBitsMutex.RUnlock()
   185  	copiedInvocations := map[string][][]interface{}{}
   186  	for key, value := range fake.invocations {
   187  		copiedInvocations[key] = value
   188  	}
   189  	return copiedInvocations
   190  }
   191  
   192  func (fake *FakeRepository) recordInvocation(key string, args []interface{}) {
   193  	fake.invocationsMutex.Lock()
   194  	defer fake.invocationsMutex.Unlock()
   195  	if fake.invocations == nil {
   196  		fake.invocations = map[string][][]interface{}{}
   197  	}
   198  	if fake.invocations[key] == nil {
   199  		fake.invocations[key] = [][]interface{}{}
   200  	}
   201  	fake.invocations[key] = append(fake.invocations[key], args)
   202  }
   203  
   204  var _ applicationbits.Repository = new(FakeRepository)