github.com/cloudfoundry-attic/cli-with-i18n@v6.32.1-0.20171002233121-7401370d3b85+incompatible/cf/commands/application/applicationfakes/fake_starter.go (about)

     1  // This file was generated by counterfeiter
     2  package applicationfakes
     3  
     4  import (
     5  	"sync"
     6  
     7  	"code.cloudfoundry.org/cli/cf/commandregistry"
     8  	"code.cloudfoundry.org/cli/cf/commands/application"
     9  	"code.cloudfoundry.org/cli/cf/flags"
    10  	"code.cloudfoundry.org/cli/cf/models"
    11  	"code.cloudfoundry.org/cli/cf/requirements"
    12  )
    13  
    14  type FakeStarter struct {
    15  	MetaDataStub        func() commandregistry.CommandMetadata
    16  	metaDataMutex       sync.RWMutex
    17  	metaDataArgsForCall []struct{}
    18  	metaDataReturns     struct {
    19  		result1 commandregistry.CommandMetadata
    20  	}
    21  	SetDependencyStub        func(deps commandregistry.Dependency, pluginCall bool) commandregistry.Command
    22  	setDependencyMutex       sync.RWMutex
    23  	setDependencyArgsForCall []struct {
    24  		deps       commandregistry.Dependency
    25  		pluginCall bool
    26  	}
    27  	setDependencyReturns struct {
    28  		result1 commandregistry.Command
    29  	}
    30  	RequirementsStub        func(requirementsFactory requirements.Factory, context flags.FlagContext) ([]requirements.Requirement, error)
    31  	requirementsMutex       sync.RWMutex
    32  	requirementsArgsForCall []struct {
    33  		requirementsFactory requirements.Factory
    34  		context             flags.FlagContext
    35  	}
    36  	requirementsReturns struct {
    37  		result1 []requirements.Requirement
    38  		result2 error
    39  	}
    40  	ExecuteStub        func(context flags.FlagContext) error
    41  	executeMutex       sync.RWMutex
    42  	executeArgsForCall []struct {
    43  		context flags.FlagContext
    44  	}
    45  	executeReturns struct {
    46  		result1 error
    47  	}
    48  	SetStartTimeoutInSecondsStub        func(timeout int)
    49  	setStartTimeoutInSecondsMutex       sync.RWMutex
    50  	setStartTimeoutInSecondsArgsForCall []struct {
    51  		timeout int
    52  	}
    53  	ApplicationStartStub        func(app models.Application, orgName string, spaceName string) (updatedApp models.Application, err error)
    54  	applicationStartMutex       sync.RWMutex
    55  	applicationStartArgsForCall []struct {
    56  		app       models.Application
    57  		orgName   string
    58  		spaceName string
    59  	}
    60  	applicationStartReturns struct {
    61  		result1 models.Application
    62  		result2 error
    63  	}
    64  	invocations      map[string][][]interface{}
    65  	invocationsMutex sync.RWMutex
    66  }
    67  
    68  func (fake *FakeStarter) MetaData() commandregistry.CommandMetadata {
    69  	fake.metaDataMutex.Lock()
    70  	fake.metaDataArgsForCall = append(fake.metaDataArgsForCall, struct{}{})
    71  	fake.recordInvocation("MetaData", []interface{}{})
    72  	fake.metaDataMutex.Unlock()
    73  	if fake.MetaDataStub != nil {
    74  		return fake.MetaDataStub()
    75  	} else {
    76  		return fake.metaDataReturns.result1
    77  	}
    78  }
    79  
    80  func (fake *FakeStarter) MetaDataCallCount() int {
    81  	fake.metaDataMutex.RLock()
    82  	defer fake.metaDataMutex.RUnlock()
    83  	return len(fake.metaDataArgsForCall)
    84  }
    85  
    86  func (fake *FakeStarter) MetaDataReturns(result1 commandregistry.CommandMetadata) {
    87  	fake.MetaDataStub = nil
    88  	fake.metaDataReturns = struct {
    89  		result1 commandregistry.CommandMetadata
    90  	}{result1}
    91  }
    92  
    93  func (fake *FakeStarter) SetDependency(deps commandregistry.Dependency, pluginCall bool) commandregistry.Command {
    94  	fake.setDependencyMutex.Lock()
    95  	fake.setDependencyArgsForCall = append(fake.setDependencyArgsForCall, struct {
    96  		deps       commandregistry.Dependency
    97  		pluginCall bool
    98  	}{deps, pluginCall})
    99  	fake.recordInvocation("SetDependency", []interface{}{deps, pluginCall})
   100  	fake.setDependencyMutex.Unlock()
   101  	if fake.SetDependencyStub != nil {
   102  		return fake.SetDependencyStub(deps, pluginCall)
   103  	} else {
   104  		return fake.setDependencyReturns.result1
   105  	}
   106  }
   107  
   108  func (fake *FakeStarter) SetDependencyCallCount() int {
   109  	fake.setDependencyMutex.RLock()
   110  	defer fake.setDependencyMutex.RUnlock()
   111  	return len(fake.setDependencyArgsForCall)
   112  }
   113  
   114  func (fake *FakeStarter) SetDependencyArgsForCall(i int) (commandregistry.Dependency, bool) {
   115  	fake.setDependencyMutex.RLock()
   116  	defer fake.setDependencyMutex.RUnlock()
   117  	return fake.setDependencyArgsForCall[i].deps, fake.setDependencyArgsForCall[i].pluginCall
   118  }
   119  
   120  func (fake *FakeStarter) SetDependencyReturns(result1 commandregistry.Command) {
   121  	fake.SetDependencyStub = nil
   122  	fake.setDependencyReturns = struct {
   123  		result1 commandregistry.Command
   124  	}{result1}
   125  }
   126  
   127  func (fake *FakeStarter) Requirements(requirementsFactory requirements.Factory, context flags.FlagContext) ([]requirements.Requirement, error) {
   128  	fake.requirementsMutex.Lock()
   129  	fake.requirementsArgsForCall = append(fake.requirementsArgsForCall, struct {
   130  		requirementsFactory requirements.Factory
   131  		context             flags.FlagContext
   132  	}{requirementsFactory, context})
   133  	fake.recordInvocation("Requirements", []interface{}{requirementsFactory, context})
   134  	fake.requirementsMutex.Unlock()
   135  	if fake.RequirementsStub != nil {
   136  		return fake.RequirementsStub(requirementsFactory, context)
   137  	} else {
   138  		return fake.requirementsReturns.result1, fake.requirementsReturns.result2
   139  	}
   140  }
   141  
   142  func (fake *FakeStarter) RequirementsCallCount() int {
   143  	fake.requirementsMutex.RLock()
   144  	defer fake.requirementsMutex.RUnlock()
   145  	return len(fake.requirementsArgsForCall)
   146  }
   147  
   148  func (fake *FakeStarter) RequirementsArgsForCall(i int) (requirements.Factory, flags.FlagContext) {
   149  	fake.requirementsMutex.RLock()
   150  	defer fake.requirementsMutex.RUnlock()
   151  	return fake.requirementsArgsForCall[i].requirementsFactory, fake.requirementsArgsForCall[i].context
   152  }
   153  
   154  func (fake *FakeStarter) RequirementsReturns(result1 []requirements.Requirement, result2 error) {
   155  	fake.RequirementsStub = nil
   156  	fake.requirementsReturns = struct {
   157  		result1 []requirements.Requirement
   158  		result2 error
   159  	}{result1, result2}
   160  }
   161  
   162  func (fake *FakeStarter) Execute(context flags.FlagContext) error {
   163  	fake.executeMutex.Lock()
   164  	fake.executeArgsForCall = append(fake.executeArgsForCall, struct {
   165  		context flags.FlagContext
   166  	}{context})
   167  	fake.recordInvocation("Execute", []interface{}{context})
   168  	fake.executeMutex.Unlock()
   169  	if fake.ExecuteStub != nil {
   170  		return fake.ExecuteStub(context)
   171  	} else {
   172  		return fake.executeReturns.result1
   173  	}
   174  }
   175  
   176  func (fake *FakeStarter) ExecuteCallCount() int {
   177  	fake.executeMutex.RLock()
   178  	defer fake.executeMutex.RUnlock()
   179  	return len(fake.executeArgsForCall)
   180  }
   181  
   182  func (fake *FakeStarter) ExecuteArgsForCall(i int) flags.FlagContext {
   183  	fake.executeMutex.RLock()
   184  	defer fake.executeMutex.RUnlock()
   185  	return fake.executeArgsForCall[i].context
   186  }
   187  
   188  func (fake *FakeStarter) ExecuteReturns(result1 error) {
   189  	fake.ExecuteStub = nil
   190  	fake.executeReturns = struct {
   191  		result1 error
   192  	}{result1}
   193  }
   194  
   195  func (fake *FakeStarter) SetStartTimeoutInSeconds(timeout int) {
   196  	fake.setStartTimeoutInSecondsMutex.Lock()
   197  	fake.setStartTimeoutInSecondsArgsForCall = append(fake.setStartTimeoutInSecondsArgsForCall, struct {
   198  		timeout int
   199  	}{timeout})
   200  	fake.recordInvocation("SetStartTimeoutInSeconds", []interface{}{timeout})
   201  	fake.setStartTimeoutInSecondsMutex.Unlock()
   202  	if fake.SetStartTimeoutInSecondsStub != nil {
   203  		fake.SetStartTimeoutInSecondsStub(timeout)
   204  	}
   205  }
   206  
   207  func (fake *FakeStarter) SetStartTimeoutInSecondsCallCount() int {
   208  	fake.setStartTimeoutInSecondsMutex.RLock()
   209  	defer fake.setStartTimeoutInSecondsMutex.RUnlock()
   210  	return len(fake.setStartTimeoutInSecondsArgsForCall)
   211  }
   212  
   213  func (fake *FakeStarter) SetStartTimeoutInSecondsArgsForCall(i int) int {
   214  	fake.setStartTimeoutInSecondsMutex.RLock()
   215  	defer fake.setStartTimeoutInSecondsMutex.RUnlock()
   216  	return fake.setStartTimeoutInSecondsArgsForCall[i].timeout
   217  }
   218  
   219  func (fake *FakeStarter) ApplicationStart(app models.Application, orgName string, spaceName string) (updatedApp models.Application, err error) {
   220  	fake.applicationStartMutex.Lock()
   221  	fake.applicationStartArgsForCall = append(fake.applicationStartArgsForCall, struct {
   222  		app       models.Application
   223  		orgName   string
   224  		spaceName string
   225  	}{app, orgName, spaceName})
   226  	fake.recordInvocation("ApplicationStart", []interface{}{app, orgName, spaceName})
   227  	fake.applicationStartMutex.Unlock()
   228  	if fake.ApplicationStartStub != nil {
   229  		return fake.ApplicationStartStub(app, orgName, spaceName)
   230  	} else {
   231  		return fake.applicationStartReturns.result1, fake.applicationStartReturns.result2
   232  	}
   233  }
   234  
   235  func (fake *FakeStarter) ApplicationStartCallCount() int {
   236  	fake.applicationStartMutex.RLock()
   237  	defer fake.applicationStartMutex.RUnlock()
   238  	return len(fake.applicationStartArgsForCall)
   239  }
   240  
   241  func (fake *FakeStarter) ApplicationStartArgsForCall(i int) (models.Application, string, string) {
   242  	fake.applicationStartMutex.RLock()
   243  	defer fake.applicationStartMutex.RUnlock()
   244  	return fake.applicationStartArgsForCall[i].app, fake.applicationStartArgsForCall[i].orgName, fake.applicationStartArgsForCall[i].spaceName
   245  }
   246  
   247  func (fake *FakeStarter) ApplicationStartReturns(result1 models.Application, result2 error) {
   248  	fake.ApplicationStartStub = nil
   249  	fake.applicationStartReturns = struct {
   250  		result1 models.Application
   251  		result2 error
   252  	}{result1, result2}
   253  }
   254  
   255  func (fake *FakeStarter) Invocations() map[string][][]interface{} {
   256  	fake.invocationsMutex.RLock()
   257  	defer fake.invocationsMutex.RUnlock()
   258  	fake.metaDataMutex.RLock()
   259  	defer fake.metaDataMutex.RUnlock()
   260  	fake.setDependencyMutex.RLock()
   261  	defer fake.setDependencyMutex.RUnlock()
   262  	fake.requirementsMutex.RLock()
   263  	defer fake.requirementsMutex.RUnlock()
   264  	fake.executeMutex.RLock()
   265  	defer fake.executeMutex.RUnlock()
   266  	fake.setStartTimeoutInSecondsMutex.RLock()
   267  	defer fake.setStartTimeoutInSecondsMutex.RUnlock()
   268  	fake.applicationStartMutex.RLock()
   269  	defer fake.applicationStartMutex.RUnlock()
   270  	return fake.invocations
   271  }
   272  
   273  func (fake *FakeStarter) recordInvocation(key string, args []interface{}) {
   274  	fake.invocationsMutex.Lock()
   275  	defer fake.invocationsMutex.Unlock()
   276  	if fake.invocations == nil {
   277  		fake.invocations = map[string][][]interface{}{}
   278  	}
   279  	if fake.invocations[key] == nil {
   280  		fake.invocations[key] = [][]interface{}{}
   281  	}
   282  	fake.invocations[key] = append(fake.invocations[key], args)
   283  }
   284  
   285  var _ application.Starter = new(FakeStarter)