github.com/niteshexa/cloudfoundry_cli@v7.1.0+incompatible/command/v7/shared/sharedfakes/fake_app_stager.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package sharedfakes
     3  
     4  import (
     5  	"sync"
     6  
     7  	"code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/constant"
     8  	"code.cloudfoundry.org/cli/command/v7/shared"
     9  	"code.cloudfoundry.org/cli/resources"
    10  	"code.cloudfoundry.org/cli/util/configv3"
    11  )
    12  
    13  type FakeAppStager struct {
    14  	StageAndStartStub        func(resources.Application, configv3.Space, configv3.Organization, string, constant.DeploymentStrategy, bool, constant.ApplicationAction) error
    15  	stageAndStartMutex       sync.RWMutex
    16  	stageAndStartArgsForCall []struct {
    17  		arg1 resources.Application
    18  		arg2 configv3.Space
    19  		arg3 configv3.Organization
    20  		arg4 string
    21  		arg5 constant.DeploymentStrategy
    22  		arg6 bool
    23  		arg7 constant.ApplicationAction
    24  	}
    25  	stageAndStartReturns struct {
    26  		result1 error
    27  	}
    28  	stageAndStartReturnsOnCall map[int]struct {
    29  		result1 error
    30  	}
    31  	StageAppStub        func(resources.Application, string, configv3.Space) (resources.Droplet, error)
    32  	stageAppMutex       sync.RWMutex
    33  	stageAppArgsForCall []struct {
    34  		arg1 resources.Application
    35  		arg2 string
    36  		arg3 configv3.Space
    37  	}
    38  	stageAppReturns struct {
    39  		result1 resources.Droplet
    40  		result2 error
    41  	}
    42  	stageAppReturnsOnCall map[int]struct {
    43  		result1 resources.Droplet
    44  		result2 error
    45  	}
    46  	StartAppStub        func(resources.Application, resources.Droplet, constant.DeploymentStrategy, bool, configv3.Space, configv3.Organization, constant.ApplicationAction) error
    47  	startAppMutex       sync.RWMutex
    48  	startAppArgsForCall []struct {
    49  		arg1 resources.Application
    50  		arg2 resources.Droplet
    51  		arg3 constant.DeploymentStrategy
    52  		arg4 bool
    53  		arg5 configv3.Space
    54  		arg6 configv3.Organization
    55  		arg7 constant.ApplicationAction
    56  	}
    57  	startAppReturns struct {
    58  		result1 error
    59  	}
    60  	startAppReturnsOnCall map[int]struct {
    61  		result1 error
    62  	}
    63  	invocations      map[string][][]interface{}
    64  	invocationsMutex sync.RWMutex
    65  }
    66  
    67  func (fake *FakeAppStager) StageAndStart(arg1 resources.Application, arg2 configv3.Space, arg3 configv3.Organization, arg4 string, arg5 constant.DeploymentStrategy, arg6 bool, arg7 constant.ApplicationAction) error {
    68  	fake.stageAndStartMutex.Lock()
    69  	ret, specificReturn := fake.stageAndStartReturnsOnCall[len(fake.stageAndStartArgsForCall)]
    70  	fake.stageAndStartArgsForCall = append(fake.stageAndStartArgsForCall, struct {
    71  		arg1 resources.Application
    72  		arg2 configv3.Space
    73  		arg3 configv3.Organization
    74  		arg4 string
    75  		arg5 constant.DeploymentStrategy
    76  		arg6 bool
    77  		arg7 constant.ApplicationAction
    78  	}{arg1, arg2, arg3, arg4, arg5, arg6, arg7})
    79  	fake.recordInvocation("StageAndStart", []interface{}{arg1, arg2, arg3, arg4, arg5, arg6, arg7})
    80  	fake.stageAndStartMutex.Unlock()
    81  	if fake.StageAndStartStub != nil {
    82  		return fake.StageAndStartStub(arg1, arg2, arg3, arg4, arg5, arg6, arg7)
    83  	}
    84  	if specificReturn {
    85  		return ret.result1
    86  	}
    87  	fakeReturns := fake.stageAndStartReturns
    88  	return fakeReturns.result1
    89  }
    90  
    91  func (fake *FakeAppStager) StageAndStartCallCount() int {
    92  	fake.stageAndStartMutex.RLock()
    93  	defer fake.stageAndStartMutex.RUnlock()
    94  	return len(fake.stageAndStartArgsForCall)
    95  }
    96  
    97  func (fake *FakeAppStager) StageAndStartCalls(stub func(resources.Application, configv3.Space, configv3.Organization, string, constant.DeploymentStrategy, bool, constant.ApplicationAction) error) {
    98  	fake.stageAndStartMutex.Lock()
    99  	defer fake.stageAndStartMutex.Unlock()
   100  	fake.StageAndStartStub = stub
   101  }
   102  
   103  func (fake *FakeAppStager) StageAndStartArgsForCall(i int) (resources.Application, configv3.Space, configv3.Organization, string, constant.DeploymentStrategy, bool, constant.ApplicationAction) {
   104  	fake.stageAndStartMutex.RLock()
   105  	defer fake.stageAndStartMutex.RUnlock()
   106  	argsForCall := fake.stageAndStartArgsForCall[i]
   107  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4, argsForCall.arg5, argsForCall.arg6, argsForCall.arg7
   108  }
   109  
   110  func (fake *FakeAppStager) StageAndStartReturns(result1 error) {
   111  	fake.stageAndStartMutex.Lock()
   112  	defer fake.stageAndStartMutex.Unlock()
   113  	fake.StageAndStartStub = nil
   114  	fake.stageAndStartReturns = struct {
   115  		result1 error
   116  	}{result1}
   117  }
   118  
   119  func (fake *FakeAppStager) StageAndStartReturnsOnCall(i int, result1 error) {
   120  	fake.stageAndStartMutex.Lock()
   121  	defer fake.stageAndStartMutex.Unlock()
   122  	fake.StageAndStartStub = nil
   123  	if fake.stageAndStartReturnsOnCall == nil {
   124  		fake.stageAndStartReturnsOnCall = make(map[int]struct {
   125  			result1 error
   126  		})
   127  	}
   128  	fake.stageAndStartReturnsOnCall[i] = struct {
   129  		result1 error
   130  	}{result1}
   131  }
   132  
   133  func (fake *FakeAppStager) StageApp(arg1 resources.Application, arg2 string, arg3 configv3.Space) (resources.Droplet, error) {
   134  	fake.stageAppMutex.Lock()
   135  	ret, specificReturn := fake.stageAppReturnsOnCall[len(fake.stageAppArgsForCall)]
   136  	fake.stageAppArgsForCall = append(fake.stageAppArgsForCall, struct {
   137  		arg1 resources.Application
   138  		arg2 string
   139  		arg3 configv3.Space
   140  	}{arg1, arg2, arg3})
   141  	fake.recordInvocation("StageApp", []interface{}{arg1, arg2, arg3})
   142  	fake.stageAppMutex.Unlock()
   143  	if fake.StageAppStub != nil {
   144  		return fake.StageAppStub(arg1, arg2, arg3)
   145  	}
   146  	if specificReturn {
   147  		return ret.result1, ret.result2
   148  	}
   149  	fakeReturns := fake.stageAppReturns
   150  	return fakeReturns.result1, fakeReturns.result2
   151  }
   152  
   153  func (fake *FakeAppStager) StageAppCallCount() int {
   154  	fake.stageAppMutex.RLock()
   155  	defer fake.stageAppMutex.RUnlock()
   156  	return len(fake.stageAppArgsForCall)
   157  }
   158  
   159  func (fake *FakeAppStager) StageAppCalls(stub func(resources.Application, string, configv3.Space) (resources.Droplet, error)) {
   160  	fake.stageAppMutex.Lock()
   161  	defer fake.stageAppMutex.Unlock()
   162  	fake.StageAppStub = stub
   163  }
   164  
   165  func (fake *FakeAppStager) StageAppArgsForCall(i int) (resources.Application, string, configv3.Space) {
   166  	fake.stageAppMutex.RLock()
   167  	defer fake.stageAppMutex.RUnlock()
   168  	argsForCall := fake.stageAppArgsForCall[i]
   169  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
   170  }
   171  
   172  func (fake *FakeAppStager) StageAppReturns(result1 resources.Droplet, result2 error) {
   173  	fake.stageAppMutex.Lock()
   174  	defer fake.stageAppMutex.Unlock()
   175  	fake.StageAppStub = nil
   176  	fake.stageAppReturns = struct {
   177  		result1 resources.Droplet
   178  		result2 error
   179  	}{result1, result2}
   180  }
   181  
   182  func (fake *FakeAppStager) StageAppReturnsOnCall(i int, result1 resources.Droplet, result2 error) {
   183  	fake.stageAppMutex.Lock()
   184  	defer fake.stageAppMutex.Unlock()
   185  	fake.StageAppStub = nil
   186  	if fake.stageAppReturnsOnCall == nil {
   187  		fake.stageAppReturnsOnCall = make(map[int]struct {
   188  			result1 resources.Droplet
   189  			result2 error
   190  		})
   191  	}
   192  	fake.stageAppReturnsOnCall[i] = struct {
   193  		result1 resources.Droplet
   194  		result2 error
   195  	}{result1, result2}
   196  }
   197  
   198  func (fake *FakeAppStager) StartApp(arg1 resources.Application, arg2 resources.Droplet, arg3 constant.DeploymentStrategy, arg4 bool, arg5 configv3.Space, arg6 configv3.Organization, arg7 constant.ApplicationAction) error {
   199  	fake.startAppMutex.Lock()
   200  	ret, specificReturn := fake.startAppReturnsOnCall[len(fake.startAppArgsForCall)]
   201  	fake.startAppArgsForCall = append(fake.startAppArgsForCall, struct {
   202  		arg1 resources.Application
   203  		arg2 resources.Droplet
   204  		arg3 constant.DeploymentStrategy
   205  		arg4 bool
   206  		arg5 configv3.Space
   207  		arg6 configv3.Organization
   208  		arg7 constant.ApplicationAction
   209  	}{arg1, arg2, arg3, arg4, arg5, arg6, arg7})
   210  	fake.recordInvocation("StartApp", []interface{}{arg1, arg2, arg3, arg4, arg5, arg6, arg7})
   211  	fake.startAppMutex.Unlock()
   212  	if fake.StartAppStub != nil {
   213  		return fake.StartAppStub(arg1, arg2, arg3, arg4, arg5, arg6, arg7)
   214  	}
   215  	if specificReturn {
   216  		return ret.result1
   217  	}
   218  	fakeReturns := fake.startAppReturns
   219  	return fakeReturns.result1
   220  }
   221  
   222  func (fake *FakeAppStager) StartAppCallCount() int {
   223  	fake.startAppMutex.RLock()
   224  	defer fake.startAppMutex.RUnlock()
   225  	return len(fake.startAppArgsForCall)
   226  }
   227  
   228  func (fake *FakeAppStager) StartAppCalls(stub func(resources.Application, resources.Droplet, constant.DeploymentStrategy, bool, configv3.Space, configv3.Organization, constant.ApplicationAction) error) {
   229  	fake.startAppMutex.Lock()
   230  	defer fake.startAppMutex.Unlock()
   231  	fake.StartAppStub = stub
   232  }
   233  
   234  func (fake *FakeAppStager) StartAppArgsForCall(i int) (resources.Application, resources.Droplet, constant.DeploymentStrategy, bool, configv3.Space, configv3.Organization, constant.ApplicationAction) {
   235  	fake.startAppMutex.RLock()
   236  	defer fake.startAppMutex.RUnlock()
   237  	argsForCall := fake.startAppArgsForCall[i]
   238  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4, argsForCall.arg5, argsForCall.arg6, argsForCall.arg7
   239  }
   240  
   241  func (fake *FakeAppStager) StartAppReturns(result1 error) {
   242  	fake.startAppMutex.Lock()
   243  	defer fake.startAppMutex.Unlock()
   244  	fake.StartAppStub = nil
   245  	fake.startAppReturns = struct {
   246  		result1 error
   247  	}{result1}
   248  }
   249  
   250  func (fake *FakeAppStager) StartAppReturnsOnCall(i int, result1 error) {
   251  	fake.startAppMutex.Lock()
   252  	defer fake.startAppMutex.Unlock()
   253  	fake.StartAppStub = nil
   254  	if fake.startAppReturnsOnCall == nil {
   255  		fake.startAppReturnsOnCall = make(map[int]struct {
   256  			result1 error
   257  		})
   258  	}
   259  	fake.startAppReturnsOnCall[i] = struct {
   260  		result1 error
   261  	}{result1}
   262  }
   263  
   264  func (fake *FakeAppStager) Invocations() map[string][][]interface{} {
   265  	fake.invocationsMutex.RLock()
   266  	defer fake.invocationsMutex.RUnlock()
   267  	fake.stageAndStartMutex.RLock()
   268  	defer fake.stageAndStartMutex.RUnlock()
   269  	fake.stageAppMutex.RLock()
   270  	defer fake.stageAppMutex.RUnlock()
   271  	fake.startAppMutex.RLock()
   272  	defer fake.startAppMutex.RUnlock()
   273  	copiedInvocations := map[string][][]interface{}{}
   274  	for key, value := range fake.invocations {
   275  		copiedInvocations[key] = value
   276  	}
   277  	return copiedInvocations
   278  }
   279  
   280  func (fake *FakeAppStager) recordInvocation(key string, args []interface{}) {
   281  	fake.invocationsMutex.Lock()
   282  	defer fake.invocationsMutex.Unlock()
   283  	if fake.invocations == nil {
   284  		fake.invocations = map[string][][]interface{}{}
   285  	}
   286  	if fake.invocations[key] == nil {
   287  		fake.invocations[key] = [][]interface{}{}
   288  	}
   289  	fake.invocations[key] = append(fake.invocations[key], args)
   290  }
   291  
   292  var _ shared.AppStager = new(FakeAppStager)