func NewRepositoryLocator(config configuration.ReadWriter, gatewaysByName map[string]net.Gateway) (loc RepositoryLocator) { strategy := strategy.NewEndpointStrategy(config.ApiVersion()) authGateway := gatewaysByName["auth"] cloudControllerGateway := gatewaysByName["cloud-controller"] uaaGateway := gatewaysByName["uaa"] loc.authRepo = NewUAAAuthenticationRepository(authGateway, config) // ensure gateway refreshers are set before passing them by value to repositories cloudControllerGateway.SetTokenRefresher(loc.authRepo) uaaGateway.SetTokenRefresher(loc.authRepo) tlsConfig := net.NewTLSConfig([]tls.Certificate{}, config.IsSSLDisabled()) loggregatorConsumer := consumer.New(config.LoggregatorEndpoint(), tlsConfig, nil) loc.appBitsRepo = NewCloudControllerApplicationBitsRepository(config, cloudControllerGateway, app_files.ApplicationZipper{}) loc.appEventsRepo = NewCloudControllerAppEventsRepository(config, cloudControllerGateway, strategy) loc.appFilesRepo = NewCloudControllerAppFilesRepository(config, cloudControllerGateway) loc.appRepo = NewCloudControllerApplicationRepository(config, cloudControllerGateway) loc.appSummaryRepo = NewCloudControllerAppSummaryRepository(config, cloudControllerGateway) loc.appInstancesRepo = NewCloudControllerAppInstancesRepository(config, cloudControllerGateway) loc.authTokenRepo = NewCloudControllerServiceAuthTokenRepository(config, cloudControllerGateway) loc.curlRepo = NewCloudControllerCurlRepository(config, cloudControllerGateway) loc.domainRepo = NewCloudControllerDomainRepository(config, cloudControllerGateway, strategy) loc.endpointRepo = NewEndpointRepository(config, cloudControllerGateway) loc.logsRepo = NewLoggregatorLogsRepository(config, loggregatorConsumer) loc.organizationRepo = NewCloudControllerOrganizationRepository(config, cloudControllerGateway) loc.passwordRepo = NewCloudControllerPasswordRepository(config, uaaGateway) loc.quotaRepo = NewCloudControllerQuotaRepository(config, cloudControllerGateway) loc.routeRepo = NewCloudControllerRouteRepository(config, cloudControllerGateway, loc.domainRepo) loc.stackRepo = NewCloudControllerStackRepository(config, cloudControllerGateway) loc.serviceRepo = NewCloudControllerServiceRepository(config, cloudControllerGateway) loc.serviceBindingRepo = NewCloudControllerServiceBindingRepository(config, cloudControllerGateway) loc.serviceBrokerRepo = NewCloudControllerServiceBrokerRepository(config, cloudControllerGateway) loc.serviceSummaryRepo = NewCloudControllerServiceSummaryRepository(config, cloudControllerGateway) loc.spaceRepo = NewCloudControllerSpaceRepository(config, cloudControllerGateway) loc.userProvidedServiceInstanceRepo = NewCCUserProvidedServiceInstanceRepository(config, cloudControllerGateway) loc.userRepo = NewCloudControllerUserRepository(config, uaaGateway, cloudControllerGateway) loc.buildpackRepo = NewCloudControllerBuildpackRepository(config, cloudControllerGateway) loc.buildpackBitsRepo = NewCloudControllerBuildpackBitsRepository(config, cloudControllerGateway, app_files.ApplicationZipper{}) return }
var _ = Describe("App Events Repo", func() { var ( server *httptest.Server handler *testnet.TestHandler config configuration.ReadWriter repo AppEventsRepository ) BeforeEach(func() { config = testconfig.NewRepository() config.SetAccessToken("BEARER my_access_token") config.SetApiVersion("2.2.0") }) JustBeforeEach(func() { strategy := strategy.NewEndpointStrategy(config.ApiVersion()) gateway := net.NewCloudControllerGateway(config) repo = NewCloudControllerAppEventsRepository(config, gateway, strategy) }) AfterEach(func() { server.Close() }) setupTestServer := func(requests ...testnet.TestRequest) { server, handler = testnet.NewServer(requests) config.SetApiEndpoint(server.URL) } Describe("list recent events", func() { It("returns the most recent events", func() {