github.com/cloudfoundry-incubator/stembuild@v0.0.0-20211223202937-5b61d62226c6/package_stemcell/stemcell_generator/stemcell_generatorfakes/fake_manifest_generator.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package stemcell_generatorfakes
     3  
     4  import (
     5  	"io"
     6  	"sync"
     7  
     8  	"github.com/cloudfoundry-incubator/stembuild/package_stemcell/stemcell_generator"
     9  )
    10  
    11  type FakeManifestGenerator struct {
    12  	ManifestStub        func(io.Reader) (io.Reader, error)
    13  	manifestMutex       sync.RWMutex
    14  	manifestArgsForCall []struct {
    15  		arg1 io.Reader
    16  	}
    17  	manifestReturns struct {
    18  		result1 io.Reader
    19  		result2 error
    20  	}
    21  	manifestReturnsOnCall map[int]struct {
    22  		result1 io.Reader
    23  		result2 error
    24  	}
    25  	invocations      map[string][][]interface{}
    26  	invocationsMutex sync.RWMutex
    27  }
    28  
    29  func (fake *FakeManifestGenerator) Manifest(arg1 io.Reader) (io.Reader, error) {
    30  	fake.manifestMutex.Lock()
    31  	ret, specificReturn := fake.manifestReturnsOnCall[len(fake.manifestArgsForCall)]
    32  	fake.manifestArgsForCall = append(fake.manifestArgsForCall, struct {
    33  		arg1 io.Reader
    34  	}{arg1})
    35  	fake.recordInvocation("Manifest", []interface{}{arg1})
    36  	fake.manifestMutex.Unlock()
    37  	if fake.ManifestStub != nil {
    38  		return fake.ManifestStub(arg1)
    39  	}
    40  	if specificReturn {
    41  		return ret.result1, ret.result2
    42  	}
    43  	fakeReturns := fake.manifestReturns
    44  	return fakeReturns.result1, fakeReturns.result2
    45  }
    46  
    47  func (fake *FakeManifestGenerator) ManifestCallCount() int {
    48  	fake.manifestMutex.RLock()
    49  	defer fake.manifestMutex.RUnlock()
    50  	return len(fake.manifestArgsForCall)
    51  }
    52  
    53  func (fake *FakeManifestGenerator) ManifestCalls(stub func(io.Reader) (io.Reader, error)) {
    54  	fake.manifestMutex.Lock()
    55  	defer fake.manifestMutex.Unlock()
    56  	fake.ManifestStub = stub
    57  }
    58  
    59  func (fake *FakeManifestGenerator) ManifestArgsForCall(i int) io.Reader {
    60  	fake.manifestMutex.RLock()
    61  	defer fake.manifestMutex.RUnlock()
    62  	argsForCall := fake.manifestArgsForCall[i]
    63  	return argsForCall.arg1
    64  }
    65  
    66  func (fake *FakeManifestGenerator) ManifestReturns(result1 io.Reader, result2 error) {
    67  	fake.manifestMutex.Lock()
    68  	defer fake.manifestMutex.Unlock()
    69  	fake.ManifestStub = nil
    70  	fake.manifestReturns = struct {
    71  		result1 io.Reader
    72  		result2 error
    73  	}{result1, result2}
    74  }
    75  
    76  func (fake *FakeManifestGenerator) ManifestReturnsOnCall(i int, result1 io.Reader, result2 error) {
    77  	fake.manifestMutex.Lock()
    78  	defer fake.manifestMutex.Unlock()
    79  	fake.ManifestStub = nil
    80  	if fake.manifestReturnsOnCall == nil {
    81  		fake.manifestReturnsOnCall = make(map[int]struct {
    82  			result1 io.Reader
    83  			result2 error
    84  		})
    85  	}
    86  	fake.manifestReturnsOnCall[i] = struct {
    87  		result1 io.Reader
    88  		result2 error
    89  	}{result1, result2}
    90  }
    91  
    92  func (fake *FakeManifestGenerator) Invocations() map[string][][]interface{} {
    93  	fake.invocationsMutex.RLock()
    94  	defer fake.invocationsMutex.RUnlock()
    95  	fake.manifestMutex.RLock()
    96  	defer fake.manifestMutex.RUnlock()
    97  	copiedInvocations := map[string][][]interface{}{}
    98  	for key, value := range fake.invocations {
    99  		copiedInvocations[key] = value
   100  	}
   101  	return copiedInvocations
   102  }
   103  
   104  func (fake *FakeManifestGenerator) recordInvocation(key string, args []interface{}) {
   105  	fake.invocationsMutex.Lock()
   106  	defer fake.invocationsMutex.Unlock()
   107  	if fake.invocations == nil {
   108  		fake.invocations = map[string][][]interface{}{}
   109  	}
   110  	if fake.invocations[key] == nil {
   111  		fake.invocations[key] = [][]interface{}{}
   112  	}
   113  	fake.invocations[key] = append(fake.invocations[key], args)
   114  }
   115  
   116  var _ stemcell_generator.ManifestGenerator = new(FakeManifestGenerator)