public static FunctionIndexer Create(CloudStorageAccount account, INameResolver nameResolver = null) { IStorageAccount storageAccount = account != null ? new StorageAccount(account) : null; IStorageAccountProvider storageAccountProvider = new SimpleStorageAccountProvider { StorageAccount = account }; IServiceBusAccountProvider serviceBusAccountProvider = null; IExtensionTypeLocator extensionTypeLocator = new NullExtensionTypeLocator(); ContextAccessor <IMessageEnqueuedWatcher> messageEnqueuedWatcherAccessor = new ContextAccessor <IMessageEnqueuedWatcher>(); ContextAccessor <IBlobWrittenWatcher> blobWrittenWatcherAccessor = new ContextAccessor <IBlobWrittenWatcher>(); ISharedContextProvider sharedContextProvider = new SharedContextProvider(); ITriggerBindingProvider triggerBindingProvider = DefaultTriggerBindingProvider.Create(nameResolver, storageAccountProvider, serviceBusAccountProvider, extensionTypeLocator, new FixedHostIdProvider("test"), new SimpleQueueConfiguration(maxDequeueCount: 5), BackgroundExceptionDispatcher.Instance, messageEnqueuedWatcherAccessor, blobWrittenWatcherAccessor, sharedContextProvider, TextWriter.Null); IBindingProvider bindingProvider = DefaultBindingProvider.Create(nameResolver, storageAccountProvider, serviceBusAccountProvider, extensionTypeLocator, messageEnqueuedWatcherAccessor, blobWrittenWatcherAccessor); return(new FunctionIndexer(triggerBindingProvider, bindingProvider, DefaultJobActivator.Instance)); }
public static FunctionIndexer Create(CloudStorageAccount account = null, INameResolver nameResolver = null, IExtensionRegistry extensionRegistry = null, TraceWriter traceWriter = null) { Mock <IServiceProvider> services = new Mock <IServiceProvider>(MockBehavior.Strict); StorageClientFactory clientFactory = new StorageClientFactory(); services.Setup(p => p.GetService(typeof(StorageClientFactory))).Returns(clientFactory); IStorageAccount storageAccount = account != null ? new StorageAccount(account, services.Object) : null; IStorageAccountProvider storageAccountProvider = new SimpleStorageAccountProvider(services.Object) { StorageAccount = account }; IExtensionTypeLocator extensionTypeLocator = new NullExtensionTypeLocator(); ContextAccessor <IMessageEnqueuedWatcher> messageEnqueuedWatcherAccessor = new ContextAccessor <IMessageEnqueuedWatcher>(); ContextAccessor <IBlobWrittenWatcher> blobWrittenWatcherAccessor = new ContextAccessor <IBlobWrittenWatcher>(); ISharedContextProvider sharedContextProvider = new SharedContextProvider(); TraceWriter logger = traceWriter ?? new TestTraceWriter(TraceLevel.Verbose); SingletonManager singletonManager = new SingletonManager(); IWebJobsExceptionHandler exceptionHandler = new WebJobsExceptionHandler(); var blobsConfiguration = new JobHostBlobsConfiguration(); ITriggerBindingProvider triggerBindingProvider = DefaultTriggerBindingProvider.Create(nameResolver, storageAccountProvider, extensionTypeLocator, new FixedHostIdProvider("test"), new SimpleQueueConfiguration(maxDequeueCount: 5), blobsConfiguration, exceptionHandler, messageEnqueuedWatcherAccessor, blobWrittenWatcherAccessor, sharedContextProvider, new DefaultExtensionRegistry(), singletonManager, logger); IBindingProvider bindingProvider = DefaultBindingProvider.Create(nameResolver, null, storageAccountProvider, extensionTypeLocator, messageEnqueuedWatcherAccessor, blobWrittenWatcherAccessor, new DefaultExtensionRegistry()); IFunctionOutputLoggerProvider outputLoggerProvider = new NullFunctionOutputLoggerProvider(); IFunctionOutputLogger outputLogger = outputLoggerProvider.GetAsync(CancellationToken.None).Result; IFunctionExecutor executor = new FunctionExecutor(new NullFunctionInstanceLogger(), outputLogger, exceptionHandler, logger); if (extensionRegistry == null) { extensionRegistry = new DefaultExtensionRegistry(); } return(new FunctionIndexer(triggerBindingProvider, bindingProvider, DefaultJobActivator.Instance, executor, extensionRegistry, new SingletonManager(), logger)); }
public static FunctionIndexer Create(CloudStorageAccount account = null, INameResolver nameResolver = null, IExtensionRegistry extensionRegistry = null) { IStorageAccount storageAccount = account != null ? new StorageAccount(account) : null; IStorageAccountProvider storageAccountProvider = new SimpleStorageAccountProvider { StorageAccount = account }; IExtensionTypeLocator extensionTypeLocator = new NullExtensionTypeLocator(); ContextAccessor <IMessageEnqueuedWatcher> messageEnqueuedWatcherAccessor = new ContextAccessor <IMessageEnqueuedWatcher>(); ContextAccessor <IBlobWrittenWatcher> blobWrittenWatcherAccessor = new ContextAccessor <IBlobWrittenWatcher>(); ISharedContextProvider sharedContextProvider = new SharedContextProvider(); TestTraceWriter logger = new TestTraceWriter(TraceLevel.Verbose); ITriggerBindingProvider triggerBindingProvider = DefaultTriggerBindingProvider.Create(nameResolver, storageAccountProvider, extensionTypeLocator, new FixedHostIdProvider("test"), new SimpleQueueConfiguration(maxDequeueCount: 5), BackgroundExceptionDispatcher.Instance, messageEnqueuedWatcherAccessor, blobWrittenWatcherAccessor, sharedContextProvider, new DefaultExtensionRegistry(), logger); IBindingProvider bindingProvider = DefaultBindingProvider.Create(nameResolver, storageAccountProvider, extensionTypeLocator, messageEnqueuedWatcherAccessor, blobWrittenWatcherAccessor, new DefaultExtensionRegistry()); IFunctionOutputLoggerProvider outputLoggerProvider = new NullFunctionOutputLoggerProvider(); var task = outputLoggerProvider.GetAsync(CancellationToken.None); task.Wait(); IFunctionOutputLogger outputLogger = task.Result; IFunctionExecutor executor = new FunctionExecutor(new NullFunctionInstanceLogger(), outputLogger, BackgroundExceptionDispatcher.Instance, new TestTraceWriter(TraceLevel.Verbose)); if (extensionRegistry == null) { extensionRegistry = new DefaultExtensionRegistry(); } return(new FunctionIndexer(triggerBindingProvider, bindingProvider, DefaultJobActivator.Instance, executor, extensionRegistry, new SingletonManager())); }