github.com/sleungcy-sap/cli@v7.1.0+incompatible/cf/appfiles/appfilesfakes/fake_zipper.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package appfilesfakes
     3  
     4  import (
     5  	"os"
     6  	"sync"
     7  
     8  	"code.cloudfoundry.org/cli/cf/appfiles"
     9  )
    10  
    11  type FakeZipper struct {
    12  	GetZipSizeStub        func(*os.File) (int64, error)
    13  	getZipSizeMutex       sync.RWMutex
    14  	getZipSizeArgsForCall []struct {
    15  		arg1 *os.File
    16  	}
    17  	getZipSizeReturns struct {
    18  		result1 int64
    19  		result2 error
    20  	}
    21  	getZipSizeReturnsOnCall map[int]struct {
    22  		result1 int64
    23  		result2 error
    24  	}
    25  	IsZipFileStub        func(string) bool
    26  	isZipFileMutex       sync.RWMutex
    27  	isZipFileArgsForCall []struct {
    28  		arg1 string
    29  	}
    30  	isZipFileReturns struct {
    31  		result1 bool
    32  	}
    33  	isZipFileReturnsOnCall map[int]struct {
    34  		result1 bool
    35  	}
    36  	UnzipStub        func(string, string) error
    37  	unzipMutex       sync.RWMutex
    38  	unzipArgsForCall []struct {
    39  		arg1 string
    40  		arg2 string
    41  	}
    42  	unzipReturns struct {
    43  		result1 error
    44  	}
    45  	unzipReturnsOnCall map[int]struct {
    46  		result1 error
    47  	}
    48  	ZipStub        func(string, *os.File) error
    49  	zipMutex       sync.RWMutex
    50  	zipArgsForCall []struct {
    51  		arg1 string
    52  		arg2 *os.File
    53  	}
    54  	zipReturns struct {
    55  		result1 error
    56  	}
    57  	zipReturnsOnCall map[int]struct {
    58  		result1 error
    59  	}
    60  	invocations      map[string][][]interface{}
    61  	invocationsMutex sync.RWMutex
    62  }
    63  
    64  func (fake *FakeZipper) GetZipSize(arg1 *os.File) (int64, error) {
    65  	fake.getZipSizeMutex.Lock()
    66  	ret, specificReturn := fake.getZipSizeReturnsOnCall[len(fake.getZipSizeArgsForCall)]
    67  	fake.getZipSizeArgsForCall = append(fake.getZipSizeArgsForCall, struct {
    68  		arg1 *os.File
    69  	}{arg1})
    70  	fake.recordInvocation("GetZipSize", []interface{}{arg1})
    71  	fake.getZipSizeMutex.Unlock()
    72  	if fake.GetZipSizeStub != nil {
    73  		return fake.GetZipSizeStub(arg1)
    74  	}
    75  	if specificReturn {
    76  		return ret.result1, ret.result2
    77  	}
    78  	fakeReturns := fake.getZipSizeReturns
    79  	return fakeReturns.result1, fakeReturns.result2
    80  }
    81  
    82  func (fake *FakeZipper) GetZipSizeCallCount() int {
    83  	fake.getZipSizeMutex.RLock()
    84  	defer fake.getZipSizeMutex.RUnlock()
    85  	return len(fake.getZipSizeArgsForCall)
    86  }
    87  
    88  func (fake *FakeZipper) GetZipSizeCalls(stub func(*os.File) (int64, error)) {
    89  	fake.getZipSizeMutex.Lock()
    90  	defer fake.getZipSizeMutex.Unlock()
    91  	fake.GetZipSizeStub = stub
    92  }
    93  
    94  func (fake *FakeZipper) GetZipSizeArgsForCall(i int) *os.File {
    95  	fake.getZipSizeMutex.RLock()
    96  	defer fake.getZipSizeMutex.RUnlock()
    97  	argsForCall := fake.getZipSizeArgsForCall[i]
    98  	return argsForCall.arg1
    99  }
   100  
   101  func (fake *FakeZipper) GetZipSizeReturns(result1 int64, result2 error) {
   102  	fake.getZipSizeMutex.Lock()
   103  	defer fake.getZipSizeMutex.Unlock()
   104  	fake.GetZipSizeStub = nil
   105  	fake.getZipSizeReturns = struct {
   106  		result1 int64
   107  		result2 error
   108  	}{result1, result2}
   109  }
   110  
   111  func (fake *FakeZipper) GetZipSizeReturnsOnCall(i int, result1 int64, result2 error) {
   112  	fake.getZipSizeMutex.Lock()
   113  	defer fake.getZipSizeMutex.Unlock()
   114  	fake.GetZipSizeStub = nil
   115  	if fake.getZipSizeReturnsOnCall == nil {
   116  		fake.getZipSizeReturnsOnCall = make(map[int]struct {
   117  			result1 int64
   118  			result2 error
   119  		})
   120  	}
   121  	fake.getZipSizeReturnsOnCall[i] = struct {
   122  		result1 int64
   123  		result2 error
   124  	}{result1, result2}
   125  }
   126  
   127  func (fake *FakeZipper) IsZipFile(arg1 string) bool {
   128  	fake.isZipFileMutex.Lock()
   129  	ret, specificReturn := fake.isZipFileReturnsOnCall[len(fake.isZipFileArgsForCall)]
   130  	fake.isZipFileArgsForCall = append(fake.isZipFileArgsForCall, struct {
   131  		arg1 string
   132  	}{arg1})
   133  	fake.recordInvocation("IsZipFile", []interface{}{arg1})
   134  	fake.isZipFileMutex.Unlock()
   135  	if fake.IsZipFileStub != nil {
   136  		return fake.IsZipFileStub(arg1)
   137  	}
   138  	if specificReturn {
   139  		return ret.result1
   140  	}
   141  	fakeReturns := fake.isZipFileReturns
   142  	return fakeReturns.result1
   143  }
   144  
   145  func (fake *FakeZipper) IsZipFileCallCount() int {
   146  	fake.isZipFileMutex.RLock()
   147  	defer fake.isZipFileMutex.RUnlock()
   148  	return len(fake.isZipFileArgsForCall)
   149  }
   150  
   151  func (fake *FakeZipper) IsZipFileCalls(stub func(string) bool) {
   152  	fake.isZipFileMutex.Lock()
   153  	defer fake.isZipFileMutex.Unlock()
   154  	fake.IsZipFileStub = stub
   155  }
   156  
   157  func (fake *FakeZipper) IsZipFileArgsForCall(i int) string {
   158  	fake.isZipFileMutex.RLock()
   159  	defer fake.isZipFileMutex.RUnlock()
   160  	argsForCall := fake.isZipFileArgsForCall[i]
   161  	return argsForCall.arg1
   162  }
   163  
   164  func (fake *FakeZipper) IsZipFileReturns(result1 bool) {
   165  	fake.isZipFileMutex.Lock()
   166  	defer fake.isZipFileMutex.Unlock()
   167  	fake.IsZipFileStub = nil
   168  	fake.isZipFileReturns = struct {
   169  		result1 bool
   170  	}{result1}
   171  }
   172  
   173  func (fake *FakeZipper) IsZipFileReturnsOnCall(i int, result1 bool) {
   174  	fake.isZipFileMutex.Lock()
   175  	defer fake.isZipFileMutex.Unlock()
   176  	fake.IsZipFileStub = nil
   177  	if fake.isZipFileReturnsOnCall == nil {
   178  		fake.isZipFileReturnsOnCall = make(map[int]struct {
   179  			result1 bool
   180  		})
   181  	}
   182  	fake.isZipFileReturnsOnCall[i] = struct {
   183  		result1 bool
   184  	}{result1}
   185  }
   186  
   187  func (fake *FakeZipper) Unzip(arg1 string, arg2 string) error {
   188  	fake.unzipMutex.Lock()
   189  	ret, specificReturn := fake.unzipReturnsOnCall[len(fake.unzipArgsForCall)]
   190  	fake.unzipArgsForCall = append(fake.unzipArgsForCall, struct {
   191  		arg1 string
   192  		arg2 string
   193  	}{arg1, arg2})
   194  	fake.recordInvocation("Unzip", []interface{}{arg1, arg2})
   195  	fake.unzipMutex.Unlock()
   196  	if fake.UnzipStub != nil {
   197  		return fake.UnzipStub(arg1, arg2)
   198  	}
   199  	if specificReturn {
   200  		return ret.result1
   201  	}
   202  	fakeReturns := fake.unzipReturns
   203  	return fakeReturns.result1
   204  }
   205  
   206  func (fake *FakeZipper) UnzipCallCount() int {
   207  	fake.unzipMutex.RLock()
   208  	defer fake.unzipMutex.RUnlock()
   209  	return len(fake.unzipArgsForCall)
   210  }
   211  
   212  func (fake *FakeZipper) UnzipCalls(stub func(string, string) error) {
   213  	fake.unzipMutex.Lock()
   214  	defer fake.unzipMutex.Unlock()
   215  	fake.UnzipStub = stub
   216  }
   217  
   218  func (fake *FakeZipper) UnzipArgsForCall(i int) (string, string) {
   219  	fake.unzipMutex.RLock()
   220  	defer fake.unzipMutex.RUnlock()
   221  	argsForCall := fake.unzipArgsForCall[i]
   222  	return argsForCall.arg1, argsForCall.arg2
   223  }
   224  
   225  func (fake *FakeZipper) UnzipReturns(result1 error) {
   226  	fake.unzipMutex.Lock()
   227  	defer fake.unzipMutex.Unlock()
   228  	fake.UnzipStub = nil
   229  	fake.unzipReturns = struct {
   230  		result1 error
   231  	}{result1}
   232  }
   233  
   234  func (fake *FakeZipper) UnzipReturnsOnCall(i int, result1 error) {
   235  	fake.unzipMutex.Lock()
   236  	defer fake.unzipMutex.Unlock()
   237  	fake.UnzipStub = nil
   238  	if fake.unzipReturnsOnCall == nil {
   239  		fake.unzipReturnsOnCall = make(map[int]struct {
   240  			result1 error
   241  		})
   242  	}
   243  	fake.unzipReturnsOnCall[i] = struct {
   244  		result1 error
   245  	}{result1}
   246  }
   247  
   248  func (fake *FakeZipper) Zip(arg1 string, arg2 *os.File) error {
   249  	fake.zipMutex.Lock()
   250  	ret, specificReturn := fake.zipReturnsOnCall[len(fake.zipArgsForCall)]
   251  	fake.zipArgsForCall = append(fake.zipArgsForCall, struct {
   252  		arg1 string
   253  		arg2 *os.File
   254  	}{arg1, arg2})
   255  	fake.recordInvocation("Zip", []interface{}{arg1, arg2})
   256  	fake.zipMutex.Unlock()
   257  	if fake.ZipStub != nil {
   258  		return fake.ZipStub(arg1, arg2)
   259  	}
   260  	if specificReturn {
   261  		return ret.result1
   262  	}
   263  	fakeReturns := fake.zipReturns
   264  	return fakeReturns.result1
   265  }
   266  
   267  func (fake *FakeZipper) ZipCallCount() int {
   268  	fake.zipMutex.RLock()
   269  	defer fake.zipMutex.RUnlock()
   270  	return len(fake.zipArgsForCall)
   271  }
   272  
   273  func (fake *FakeZipper) ZipCalls(stub func(string, *os.File) error) {
   274  	fake.zipMutex.Lock()
   275  	defer fake.zipMutex.Unlock()
   276  	fake.ZipStub = stub
   277  }
   278  
   279  func (fake *FakeZipper) ZipArgsForCall(i int) (string, *os.File) {
   280  	fake.zipMutex.RLock()
   281  	defer fake.zipMutex.RUnlock()
   282  	argsForCall := fake.zipArgsForCall[i]
   283  	return argsForCall.arg1, argsForCall.arg2
   284  }
   285  
   286  func (fake *FakeZipper) ZipReturns(result1 error) {
   287  	fake.zipMutex.Lock()
   288  	defer fake.zipMutex.Unlock()
   289  	fake.ZipStub = nil
   290  	fake.zipReturns = struct {
   291  		result1 error
   292  	}{result1}
   293  }
   294  
   295  func (fake *FakeZipper) ZipReturnsOnCall(i int, result1 error) {
   296  	fake.zipMutex.Lock()
   297  	defer fake.zipMutex.Unlock()
   298  	fake.ZipStub = nil
   299  	if fake.zipReturnsOnCall == nil {
   300  		fake.zipReturnsOnCall = make(map[int]struct {
   301  			result1 error
   302  		})
   303  	}
   304  	fake.zipReturnsOnCall[i] = struct {
   305  		result1 error
   306  	}{result1}
   307  }
   308  
   309  func (fake *FakeZipper) Invocations() map[string][][]interface{} {
   310  	fake.invocationsMutex.RLock()
   311  	defer fake.invocationsMutex.RUnlock()
   312  	fake.getZipSizeMutex.RLock()
   313  	defer fake.getZipSizeMutex.RUnlock()
   314  	fake.isZipFileMutex.RLock()
   315  	defer fake.isZipFileMutex.RUnlock()
   316  	fake.unzipMutex.RLock()
   317  	defer fake.unzipMutex.RUnlock()
   318  	fake.zipMutex.RLock()
   319  	defer fake.zipMutex.RUnlock()
   320  	copiedInvocations := map[string][][]interface{}{}
   321  	for key, value := range fake.invocations {
   322  		copiedInvocations[key] = value
   323  	}
   324  	return copiedInvocations
   325  }
   326  
   327  func (fake *FakeZipper) recordInvocation(key string, args []interface{}) {
   328  	fake.invocationsMutex.Lock()
   329  	defer fake.invocationsMutex.Unlock()
   330  	if fake.invocations == nil {
   331  		fake.invocations = map[string][][]interface{}{}
   332  	}
   333  	if fake.invocations[key] == nil {
   334  		fake.invocations[key] = [][]interface{}{}
   335  	}
   336  	fake.invocations[key] = append(fake.invocations[key], args)
   337  }
   338  
   339  var _ appfiles.Zipper = new(FakeZipper)