github.com/chenbh/concourse/v6@v6.4.2/atc/resource/resourcefakes/fake_resource.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package resourcefakes
     3  
     4  import (
     5  	"context"
     6  	"sync"
     7  
     8  	"github.com/chenbh/concourse/v6/atc"
     9  	"github.com/chenbh/concourse/v6/atc/resource"
    10  	"github.com/chenbh/concourse/v6/atc/runtime"
    11  )
    12  
    13  type FakeResource struct {
    14  	CheckStub        func(context.Context, runtime.ProcessSpec, runtime.Runner) ([]atc.Version, error)
    15  	checkMutex       sync.RWMutex
    16  	checkArgsForCall []struct {
    17  		arg1 context.Context
    18  		arg2 runtime.ProcessSpec
    19  		arg3 runtime.Runner
    20  	}
    21  	checkReturns struct {
    22  		result1 []atc.Version
    23  		result2 error
    24  	}
    25  	checkReturnsOnCall map[int]struct {
    26  		result1 []atc.Version
    27  		result2 error
    28  	}
    29  	GetStub        func(context.Context, runtime.ProcessSpec, runtime.Runner) (runtime.VersionResult, error)
    30  	getMutex       sync.RWMutex
    31  	getArgsForCall []struct {
    32  		arg1 context.Context
    33  		arg2 runtime.ProcessSpec
    34  		arg3 runtime.Runner
    35  	}
    36  	getReturns struct {
    37  		result1 runtime.VersionResult
    38  		result2 error
    39  	}
    40  	getReturnsOnCall map[int]struct {
    41  		result1 runtime.VersionResult
    42  		result2 error
    43  	}
    44  	PutStub        func(context.Context, runtime.ProcessSpec, runtime.Runner) (runtime.VersionResult, error)
    45  	putMutex       sync.RWMutex
    46  	putArgsForCall []struct {
    47  		arg1 context.Context
    48  		arg2 runtime.ProcessSpec
    49  		arg3 runtime.Runner
    50  	}
    51  	putReturns struct {
    52  		result1 runtime.VersionResult
    53  		result2 error
    54  	}
    55  	putReturnsOnCall map[int]struct {
    56  		result1 runtime.VersionResult
    57  		result2 error
    58  	}
    59  	SignatureStub        func() ([]byte, error)
    60  	signatureMutex       sync.RWMutex
    61  	signatureArgsForCall []struct {
    62  	}
    63  	signatureReturns struct {
    64  		result1 []byte
    65  		result2 error
    66  	}
    67  	signatureReturnsOnCall map[int]struct {
    68  		result1 []byte
    69  		result2 error
    70  	}
    71  	invocations      map[string][][]interface{}
    72  	invocationsMutex sync.RWMutex
    73  }
    74  
    75  func (fake *FakeResource) Check(arg1 context.Context, arg2 runtime.ProcessSpec, arg3 runtime.Runner) ([]atc.Version, error) {
    76  	fake.checkMutex.Lock()
    77  	ret, specificReturn := fake.checkReturnsOnCall[len(fake.checkArgsForCall)]
    78  	fake.checkArgsForCall = append(fake.checkArgsForCall, struct {
    79  		arg1 context.Context
    80  		arg2 runtime.ProcessSpec
    81  		arg3 runtime.Runner
    82  	}{arg1, arg2, arg3})
    83  	fake.recordInvocation("Check", []interface{}{arg1, arg2, arg3})
    84  	fake.checkMutex.Unlock()
    85  	if fake.CheckStub != nil {
    86  		return fake.CheckStub(arg1, arg2, arg3)
    87  	}
    88  	if specificReturn {
    89  		return ret.result1, ret.result2
    90  	}
    91  	fakeReturns := fake.checkReturns
    92  	return fakeReturns.result1, fakeReturns.result2
    93  }
    94  
    95  func (fake *FakeResource) CheckCallCount() int {
    96  	fake.checkMutex.RLock()
    97  	defer fake.checkMutex.RUnlock()
    98  	return len(fake.checkArgsForCall)
    99  }
   100  
   101  func (fake *FakeResource) CheckCalls(stub func(context.Context, runtime.ProcessSpec, runtime.Runner) ([]atc.Version, error)) {
   102  	fake.checkMutex.Lock()
   103  	defer fake.checkMutex.Unlock()
   104  	fake.CheckStub = stub
   105  }
   106  
   107  func (fake *FakeResource) CheckArgsForCall(i int) (context.Context, runtime.ProcessSpec, runtime.Runner) {
   108  	fake.checkMutex.RLock()
   109  	defer fake.checkMutex.RUnlock()
   110  	argsForCall := fake.checkArgsForCall[i]
   111  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
   112  }
   113  
   114  func (fake *FakeResource) CheckReturns(result1 []atc.Version, result2 error) {
   115  	fake.checkMutex.Lock()
   116  	defer fake.checkMutex.Unlock()
   117  	fake.CheckStub = nil
   118  	fake.checkReturns = struct {
   119  		result1 []atc.Version
   120  		result2 error
   121  	}{result1, result2}
   122  }
   123  
   124  func (fake *FakeResource) CheckReturnsOnCall(i int, result1 []atc.Version, result2 error) {
   125  	fake.checkMutex.Lock()
   126  	defer fake.checkMutex.Unlock()
   127  	fake.CheckStub = nil
   128  	if fake.checkReturnsOnCall == nil {
   129  		fake.checkReturnsOnCall = make(map[int]struct {
   130  			result1 []atc.Version
   131  			result2 error
   132  		})
   133  	}
   134  	fake.checkReturnsOnCall[i] = struct {
   135  		result1 []atc.Version
   136  		result2 error
   137  	}{result1, result2}
   138  }
   139  
   140  func (fake *FakeResource) Get(arg1 context.Context, arg2 runtime.ProcessSpec, arg3 runtime.Runner) (runtime.VersionResult, error) {
   141  	fake.getMutex.Lock()
   142  	ret, specificReturn := fake.getReturnsOnCall[len(fake.getArgsForCall)]
   143  	fake.getArgsForCall = append(fake.getArgsForCall, struct {
   144  		arg1 context.Context
   145  		arg2 runtime.ProcessSpec
   146  		arg3 runtime.Runner
   147  	}{arg1, arg2, arg3})
   148  	fake.recordInvocation("Get", []interface{}{arg1, arg2, arg3})
   149  	fake.getMutex.Unlock()
   150  	if fake.GetStub != nil {
   151  		return fake.GetStub(arg1, arg2, arg3)
   152  	}
   153  	if specificReturn {
   154  		return ret.result1, ret.result2
   155  	}
   156  	fakeReturns := fake.getReturns
   157  	return fakeReturns.result1, fakeReturns.result2
   158  }
   159  
   160  func (fake *FakeResource) GetCallCount() int {
   161  	fake.getMutex.RLock()
   162  	defer fake.getMutex.RUnlock()
   163  	return len(fake.getArgsForCall)
   164  }
   165  
   166  func (fake *FakeResource) GetCalls(stub func(context.Context, runtime.ProcessSpec, runtime.Runner) (runtime.VersionResult, error)) {
   167  	fake.getMutex.Lock()
   168  	defer fake.getMutex.Unlock()
   169  	fake.GetStub = stub
   170  }
   171  
   172  func (fake *FakeResource) GetArgsForCall(i int) (context.Context, runtime.ProcessSpec, runtime.Runner) {
   173  	fake.getMutex.RLock()
   174  	defer fake.getMutex.RUnlock()
   175  	argsForCall := fake.getArgsForCall[i]
   176  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
   177  }
   178  
   179  func (fake *FakeResource) GetReturns(result1 runtime.VersionResult, result2 error) {
   180  	fake.getMutex.Lock()
   181  	defer fake.getMutex.Unlock()
   182  	fake.GetStub = nil
   183  	fake.getReturns = struct {
   184  		result1 runtime.VersionResult
   185  		result2 error
   186  	}{result1, result2}
   187  }
   188  
   189  func (fake *FakeResource) GetReturnsOnCall(i int, result1 runtime.VersionResult, result2 error) {
   190  	fake.getMutex.Lock()
   191  	defer fake.getMutex.Unlock()
   192  	fake.GetStub = nil
   193  	if fake.getReturnsOnCall == nil {
   194  		fake.getReturnsOnCall = make(map[int]struct {
   195  			result1 runtime.VersionResult
   196  			result2 error
   197  		})
   198  	}
   199  	fake.getReturnsOnCall[i] = struct {
   200  		result1 runtime.VersionResult
   201  		result2 error
   202  	}{result1, result2}
   203  }
   204  
   205  func (fake *FakeResource) Put(arg1 context.Context, arg2 runtime.ProcessSpec, arg3 runtime.Runner) (runtime.VersionResult, error) {
   206  	fake.putMutex.Lock()
   207  	ret, specificReturn := fake.putReturnsOnCall[len(fake.putArgsForCall)]
   208  	fake.putArgsForCall = append(fake.putArgsForCall, struct {
   209  		arg1 context.Context
   210  		arg2 runtime.ProcessSpec
   211  		arg3 runtime.Runner
   212  	}{arg1, arg2, arg3})
   213  	fake.recordInvocation("Put", []interface{}{arg1, arg2, arg3})
   214  	fake.putMutex.Unlock()
   215  	if fake.PutStub != nil {
   216  		return fake.PutStub(arg1, arg2, arg3)
   217  	}
   218  	if specificReturn {
   219  		return ret.result1, ret.result2
   220  	}
   221  	fakeReturns := fake.putReturns
   222  	return fakeReturns.result1, fakeReturns.result2
   223  }
   224  
   225  func (fake *FakeResource) PutCallCount() int {
   226  	fake.putMutex.RLock()
   227  	defer fake.putMutex.RUnlock()
   228  	return len(fake.putArgsForCall)
   229  }
   230  
   231  func (fake *FakeResource) PutCalls(stub func(context.Context, runtime.ProcessSpec, runtime.Runner) (runtime.VersionResult, error)) {
   232  	fake.putMutex.Lock()
   233  	defer fake.putMutex.Unlock()
   234  	fake.PutStub = stub
   235  }
   236  
   237  func (fake *FakeResource) PutArgsForCall(i int) (context.Context, runtime.ProcessSpec, runtime.Runner) {
   238  	fake.putMutex.RLock()
   239  	defer fake.putMutex.RUnlock()
   240  	argsForCall := fake.putArgsForCall[i]
   241  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
   242  }
   243  
   244  func (fake *FakeResource) PutReturns(result1 runtime.VersionResult, result2 error) {
   245  	fake.putMutex.Lock()
   246  	defer fake.putMutex.Unlock()
   247  	fake.PutStub = nil
   248  	fake.putReturns = struct {
   249  		result1 runtime.VersionResult
   250  		result2 error
   251  	}{result1, result2}
   252  }
   253  
   254  func (fake *FakeResource) PutReturnsOnCall(i int, result1 runtime.VersionResult, result2 error) {
   255  	fake.putMutex.Lock()
   256  	defer fake.putMutex.Unlock()
   257  	fake.PutStub = nil
   258  	if fake.putReturnsOnCall == nil {
   259  		fake.putReturnsOnCall = make(map[int]struct {
   260  			result1 runtime.VersionResult
   261  			result2 error
   262  		})
   263  	}
   264  	fake.putReturnsOnCall[i] = struct {
   265  		result1 runtime.VersionResult
   266  		result2 error
   267  	}{result1, result2}
   268  }
   269  
   270  func (fake *FakeResource) Signature() ([]byte, error) {
   271  	fake.signatureMutex.Lock()
   272  	ret, specificReturn := fake.signatureReturnsOnCall[len(fake.signatureArgsForCall)]
   273  	fake.signatureArgsForCall = append(fake.signatureArgsForCall, struct {
   274  	}{})
   275  	fake.recordInvocation("Signature", []interface{}{})
   276  	fake.signatureMutex.Unlock()
   277  	if fake.SignatureStub != nil {
   278  		return fake.SignatureStub()
   279  	}
   280  	if specificReturn {
   281  		return ret.result1, ret.result2
   282  	}
   283  	fakeReturns := fake.signatureReturns
   284  	return fakeReturns.result1, fakeReturns.result2
   285  }
   286  
   287  func (fake *FakeResource) SignatureCallCount() int {
   288  	fake.signatureMutex.RLock()
   289  	defer fake.signatureMutex.RUnlock()
   290  	return len(fake.signatureArgsForCall)
   291  }
   292  
   293  func (fake *FakeResource) SignatureCalls(stub func() ([]byte, error)) {
   294  	fake.signatureMutex.Lock()
   295  	defer fake.signatureMutex.Unlock()
   296  	fake.SignatureStub = stub
   297  }
   298  
   299  func (fake *FakeResource) SignatureReturns(result1 []byte, result2 error) {
   300  	fake.signatureMutex.Lock()
   301  	defer fake.signatureMutex.Unlock()
   302  	fake.SignatureStub = nil
   303  	fake.signatureReturns = struct {
   304  		result1 []byte
   305  		result2 error
   306  	}{result1, result2}
   307  }
   308  
   309  func (fake *FakeResource) SignatureReturnsOnCall(i int, result1 []byte, result2 error) {
   310  	fake.signatureMutex.Lock()
   311  	defer fake.signatureMutex.Unlock()
   312  	fake.SignatureStub = nil
   313  	if fake.signatureReturnsOnCall == nil {
   314  		fake.signatureReturnsOnCall = make(map[int]struct {
   315  			result1 []byte
   316  			result2 error
   317  		})
   318  	}
   319  	fake.signatureReturnsOnCall[i] = struct {
   320  		result1 []byte
   321  		result2 error
   322  	}{result1, result2}
   323  }
   324  
   325  func (fake *FakeResource) Invocations() map[string][][]interface{} {
   326  	fake.invocationsMutex.RLock()
   327  	defer fake.invocationsMutex.RUnlock()
   328  	fake.checkMutex.RLock()
   329  	defer fake.checkMutex.RUnlock()
   330  	fake.getMutex.RLock()
   331  	defer fake.getMutex.RUnlock()
   332  	fake.putMutex.RLock()
   333  	defer fake.putMutex.RUnlock()
   334  	fake.signatureMutex.RLock()
   335  	defer fake.signatureMutex.RUnlock()
   336  	copiedInvocations := map[string][][]interface{}{}
   337  	for key, value := range fake.invocations {
   338  		copiedInvocations[key] = value
   339  	}
   340  	return copiedInvocations
   341  }
   342  
   343  func (fake *FakeResource) recordInvocation(key string, args []interface{}) {
   344  	fake.invocationsMutex.Lock()
   345  	defer fake.invocationsMutex.Unlock()
   346  	if fake.invocations == nil {
   347  		fake.invocations = map[string][][]interface{}{}
   348  	}
   349  	if fake.invocations[key] == nil {
   350  		fake.invocations[key] = [][]interface{}{}
   351  	}
   352  	fake.invocations[key] = append(fake.invocations[key], args)
   353  }
   354  
   355  var _ resource.Resource = new(FakeResource)