github.com/jasonkeene/cli@v6.14.1-0.20160816203908-ca5715166dfb+incompatible/cf/actors/pluginrepo/pluginrepofakes/fake_plugin_repo.go (about)

     1  // This file was generated by counterfeiter
     2  package pluginrepofakes
     3  
     4  import (
     5  	"sync"
     6  
     7  	clipr "github.com/cloudfoundry-incubator/cli-plugin-repo/web"
     8  	"github.com/cloudfoundry/cli/cf/actors/pluginrepo"
     9  	"github.com/cloudfoundry/cli/cf/models"
    10  )
    11  
    12  type FakePluginRepo struct {
    13  	GetPluginsStub        func([]models.PluginRepo) (map[string][]clipr.Plugin, []string)
    14  	getPluginsMutex       sync.RWMutex
    15  	getPluginsArgsForCall []struct {
    16  		arg1 []models.PluginRepo
    17  	}
    18  	getPluginsReturns struct {
    19  		result1 map[string][]clipr.Plugin
    20  		result2 []string
    21  	}
    22  	invocations      map[string][][]interface{}
    23  	invocationsMutex sync.RWMutex
    24  }
    25  
    26  func (fake *FakePluginRepo) GetPlugins(arg1 []models.PluginRepo) (map[string][]clipr.Plugin, []string) {
    27  	var arg1Copy []models.PluginRepo
    28  	if arg1 != nil {
    29  		arg1Copy = make([]models.PluginRepo, len(arg1))
    30  		copy(arg1Copy, arg1)
    31  	}
    32  	fake.getPluginsMutex.Lock()
    33  	fake.getPluginsArgsForCall = append(fake.getPluginsArgsForCall, struct {
    34  		arg1 []models.PluginRepo
    35  	}{arg1Copy})
    36  	fake.recordInvocation("GetPlugins", []interface{}{arg1Copy})
    37  	fake.getPluginsMutex.Unlock()
    38  	if fake.GetPluginsStub != nil {
    39  		return fake.GetPluginsStub(arg1)
    40  	} else {
    41  		return fake.getPluginsReturns.result1, fake.getPluginsReturns.result2
    42  	}
    43  }
    44  
    45  func (fake *FakePluginRepo) GetPluginsCallCount() int {
    46  	fake.getPluginsMutex.RLock()
    47  	defer fake.getPluginsMutex.RUnlock()
    48  	return len(fake.getPluginsArgsForCall)
    49  }
    50  
    51  func (fake *FakePluginRepo) GetPluginsArgsForCall(i int) []models.PluginRepo {
    52  	fake.getPluginsMutex.RLock()
    53  	defer fake.getPluginsMutex.RUnlock()
    54  	return fake.getPluginsArgsForCall[i].arg1
    55  }
    56  
    57  func (fake *FakePluginRepo) GetPluginsReturns(result1 map[string][]clipr.Plugin, result2 []string) {
    58  	fake.GetPluginsStub = nil
    59  	fake.getPluginsReturns = struct {
    60  		result1 map[string][]clipr.Plugin
    61  		result2 []string
    62  	}{result1, result2}
    63  }
    64  
    65  func (fake *FakePluginRepo) Invocations() map[string][][]interface{} {
    66  	fake.invocationsMutex.RLock()
    67  	defer fake.invocationsMutex.RUnlock()
    68  	fake.getPluginsMutex.RLock()
    69  	defer fake.getPluginsMutex.RUnlock()
    70  	return fake.invocations
    71  }
    72  
    73  func (fake *FakePluginRepo) recordInvocation(key string, args []interface{}) {
    74  	fake.invocationsMutex.Lock()
    75  	defer fake.invocationsMutex.Unlock()
    76  	if fake.invocations == nil {
    77  		fake.invocations = map[string][][]interface{}{}
    78  	}
    79  	if fake.invocations[key] == nil {
    80  		fake.invocations[key] = [][]interface{}{}
    81  	}
    82  	fake.invocations[key] = append(fake.invocations[key], args)
    83  }
    84  
    85  var _ pluginrepo.PluginRepo = new(FakePluginRepo)