github.com/IBM-Blockchain/fabric-operator@v1.0.4/pkg/offering/base/ca/mocks/initializer.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package mocks
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/IBM-Blockchain/fabric-operator/api/v1beta1"
     8  	v1 "github.com/IBM-Blockchain/fabric-operator/pkg/apis/ca/v1"
     9  	initializer "github.com/IBM-Blockchain/fabric-operator/pkg/initializer/ca"
    10  	baseca "github.com/IBM-Blockchain/fabric-operator/pkg/offering/base/ca"
    11  )
    12  
    13  type Initializer struct {
    14  	CreateStub        func(*v1beta1.IBPCA, *v1.ServerConfig, initializer.IBPCA) (*initializer.Response, error)
    15  	createMutex       sync.RWMutex
    16  	createArgsForCall []struct {
    17  		arg1 *v1beta1.IBPCA
    18  		arg2 *v1.ServerConfig
    19  		arg3 initializer.IBPCA
    20  	}
    21  	createReturns struct {
    22  		result1 *initializer.Response
    23  		result2 error
    24  	}
    25  	createReturnsOnCall map[int]struct {
    26  		result1 *initializer.Response
    27  		result2 error
    28  	}
    29  	UpdateStub        func(*v1beta1.IBPCA, *v1.ServerConfig, initializer.IBPCA) (*initializer.Response, error)
    30  	updateMutex       sync.RWMutex
    31  	updateArgsForCall []struct {
    32  		arg1 *v1beta1.IBPCA
    33  		arg2 *v1.ServerConfig
    34  		arg3 initializer.IBPCA
    35  	}
    36  	updateReturns struct {
    37  		result1 *initializer.Response
    38  		result2 error
    39  	}
    40  	updateReturnsOnCall map[int]struct {
    41  		result1 *initializer.Response
    42  		result2 error
    43  	}
    44  	invocations      map[string][][]interface{}
    45  	invocationsMutex sync.RWMutex
    46  }
    47  
    48  func (fake *Initializer) Create(arg1 *v1beta1.IBPCA, arg2 *v1.ServerConfig, arg3 initializer.IBPCA) (*initializer.Response, error) {
    49  	fake.createMutex.Lock()
    50  	ret, specificReturn := fake.createReturnsOnCall[len(fake.createArgsForCall)]
    51  	fake.createArgsForCall = append(fake.createArgsForCall, struct {
    52  		arg1 *v1beta1.IBPCA
    53  		arg2 *v1.ServerConfig
    54  		arg3 initializer.IBPCA
    55  	}{arg1, arg2, arg3})
    56  	stub := fake.CreateStub
    57  	fakeReturns := fake.createReturns
    58  	fake.recordInvocation("Create", []interface{}{arg1, arg2, arg3})
    59  	fake.createMutex.Unlock()
    60  	if stub != nil {
    61  		return stub(arg1, arg2, arg3)
    62  	}
    63  	if specificReturn {
    64  		return ret.result1, ret.result2
    65  	}
    66  	return fakeReturns.result1, fakeReturns.result2
    67  }
    68  
    69  func (fake *Initializer) CreateCallCount() int {
    70  	fake.createMutex.RLock()
    71  	defer fake.createMutex.RUnlock()
    72  	return len(fake.createArgsForCall)
    73  }
    74  
    75  func (fake *Initializer) CreateCalls(stub func(*v1beta1.IBPCA, *v1.ServerConfig, initializer.IBPCA) (*initializer.Response, error)) {
    76  	fake.createMutex.Lock()
    77  	defer fake.createMutex.Unlock()
    78  	fake.CreateStub = stub
    79  }
    80  
    81  func (fake *Initializer) CreateArgsForCall(i int) (*v1beta1.IBPCA, *v1.ServerConfig, initializer.IBPCA) {
    82  	fake.createMutex.RLock()
    83  	defer fake.createMutex.RUnlock()
    84  	argsForCall := fake.createArgsForCall[i]
    85  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
    86  }
    87  
    88  func (fake *Initializer) CreateReturns(result1 *initializer.Response, result2 error) {
    89  	fake.createMutex.Lock()
    90  	defer fake.createMutex.Unlock()
    91  	fake.CreateStub = nil
    92  	fake.createReturns = struct {
    93  		result1 *initializer.Response
    94  		result2 error
    95  	}{result1, result2}
    96  }
    97  
    98  func (fake *Initializer) CreateReturnsOnCall(i int, result1 *initializer.Response, result2 error) {
    99  	fake.createMutex.Lock()
   100  	defer fake.createMutex.Unlock()
   101  	fake.CreateStub = nil
   102  	if fake.createReturnsOnCall == nil {
   103  		fake.createReturnsOnCall = make(map[int]struct {
   104  			result1 *initializer.Response
   105  			result2 error
   106  		})
   107  	}
   108  	fake.createReturnsOnCall[i] = struct {
   109  		result1 *initializer.Response
   110  		result2 error
   111  	}{result1, result2}
   112  }
   113  
   114  func (fake *Initializer) Update(arg1 *v1beta1.IBPCA, arg2 *v1.ServerConfig, arg3 initializer.IBPCA) (*initializer.Response, error) {
   115  	fake.updateMutex.Lock()
   116  	ret, specificReturn := fake.updateReturnsOnCall[len(fake.updateArgsForCall)]
   117  	fake.updateArgsForCall = append(fake.updateArgsForCall, struct {
   118  		arg1 *v1beta1.IBPCA
   119  		arg2 *v1.ServerConfig
   120  		arg3 initializer.IBPCA
   121  	}{arg1, arg2, arg3})
   122  	stub := fake.UpdateStub
   123  	fakeReturns := fake.updateReturns
   124  	fake.recordInvocation("Update", []interface{}{arg1, arg2, arg3})
   125  	fake.updateMutex.Unlock()
   126  	if stub != nil {
   127  		return stub(arg1, arg2, arg3)
   128  	}
   129  	if specificReturn {
   130  		return ret.result1, ret.result2
   131  	}
   132  	return fakeReturns.result1, fakeReturns.result2
   133  }
   134  
   135  func (fake *Initializer) UpdateCallCount() int {
   136  	fake.updateMutex.RLock()
   137  	defer fake.updateMutex.RUnlock()
   138  	return len(fake.updateArgsForCall)
   139  }
   140  
   141  func (fake *Initializer) UpdateCalls(stub func(*v1beta1.IBPCA, *v1.ServerConfig, initializer.IBPCA) (*initializer.Response, error)) {
   142  	fake.updateMutex.Lock()
   143  	defer fake.updateMutex.Unlock()
   144  	fake.UpdateStub = stub
   145  }
   146  
   147  func (fake *Initializer) UpdateArgsForCall(i int) (*v1beta1.IBPCA, *v1.ServerConfig, initializer.IBPCA) {
   148  	fake.updateMutex.RLock()
   149  	defer fake.updateMutex.RUnlock()
   150  	argsForCall := fake.updateArgsForCall[i]
   151  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
   152  }
   153  
   154  func (fake *Initializer) UpdateReturns(result1 *initializer.Response, result2 error) {
   155  	fake.updateMutex.Lock()
   156  	defer fake.updateMutex.Unlock()
   157  	fake.UpdateStub = nil
   158  	fake.updateReturns = struct {
   159  		result1 *initializer.Response
   160  		result2 error
   161  	}{result1, result2}
   162  }
   163  
   164  func (fake *Initializer) UpdateReturnsOnCall(i int, result1 *initializer.Response, result2 error) {
   165  	fake.updateMutex.Lock()
   166  	defer fake.updateMutex.Unlock()
   167  	fake.UpdateStub = nil
   168  	if fake.updateReturnsOnCall == nil {
   169  		fake.updateReturnsOnCall = make(map[int]struct {
   170  			result1 *initializer.Response
   171  			result2 error
   172  		})
   173  	}
   174  	fake.updateReturnsOnCall[i] = struct {
   175  		result1 *initializer.Response
   176  		result2 error
   177  	}{result1, result2}
   178  }
   179  
   180  func (fake *Initializer) Invocations() map[string][][]interface{} {
   181  	fake.invocationsMutex.RLock()
   182  	defer fake.invocationsMutex.RUnlock()
   183  	fake.createMutex.RLock()
   184  	defer fake.createMutex.RUnlock()
   185  	fake.updateMutex.RLock()
   186  	defer fake.updateMutex.RUnlock()
   187  	copiedInvocations := map[string][][]interface{}{}
   188  	for key, value := range fake.invocations {
   189  		copiedInvocations[key] = value
   190  	}
   191  	return copiedInvocations
   192  }
   193  
   194  func (fake *Initializer) recordInvocation(key string, args []interface{}) {
   195  	fake.invocationsMutex.Lock()
   196  	defer fake.invocationsMutex.Unlock()
   197  	if fake.invocations == nil {
   198  		fake.invocations = map[string][][]interface{}{}
   199  	}
   200  	if fake.invocations[key] == nil {
   201  		fake.invocations[key] = [][]interface{}{}
   202  	}
   203  	fake.invocations[key] = append(fake.invocations[key], args)
   204  }
   205  
   206  var _ baseca.Initializer = new(Initializer)