Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PublishQueueService"/> class.
 /// </summary>
 /// <param name="fileServiceFactory">IFileServiceFactory instance.</param>
 /// <param name="repositoryService">IRepository instance.</param>
 /// <param name="queueRepository">QueueRepository instance.</param>
 public PublishQueueService(IFileServiceFactory fileServiceFactory, IRepositoryService repositoryService, IQueueRepository queueRepository)
 {
     this.fileServiceFactory = fileServiceFactory;
     this.RepositoryService = repositoryService;
     this.QueueRepository = queueRepository;
     this.Diagnostics = new DiagnosticsProvider(this.GetType());
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="VerifyFileQueueService"/> class.
 /// </summary>
 /// <param name="fileServiceFactory">IFileServiceFactory instance.</param>
 /// <param name="repositoryService">IRepositoryService instance.</param>
 /// <param name="queueRepository">IQueueRepository instance.</param>
 /// <param name="blobDataRepository">IBlobRepository instance.</param>
 public VerifyFileQueueService(IFileServiceFactory fileServiceFactory, IRepositoryService repositoryService, IQueueRepository queueRepository, IBlobDataRepository blobDataRepository)
 {
     this.fileServiceFactory = fileServiceFactory;
     this.RepositoryService = repositoryService;
     this.QueueRepository = queueRepository;
     this.blobDataRepository = blobDataRepository;
     this.Diagnostics = new DiagnosticsProvider(this.GetType());
 }
Example #3
0
  /// <summary>
 /// Initializes a new instance of the <see cref="MessageHandlerFactory"/> class.
 /// </summary>
 /// <param name="fileServiceFactory">IFileServiceFactory to instantiate IFileService.</param>
 /// <param name="repositoryService">IRepositoryService instance.</param>
 /// <param name="queueRepository">IQueueRepository instance.</param>
 /// <param name="blobRepository">IBlobRepository instance.</param>
 public MessageHandlerFactory(IFileServiceFactory fileServiceFactory, IRepositoryService repositoryService, IQueueRepository queueRepository, IBlobDataRepository blobRepository)
 {
     this.fileServiceFactory = fileServiceFactory;
     this.repositoryService = repositoryService;
     this.queueRepository = queueRepository;
     this.blobRepository = blobRepository;
     diagnostics = new DiagnosticsProvider(this.GetType());
 }
Example #4
0
        public void SetUp()
        {
            _transactionScope     = new TransactionScope();
            _fileserviceFactory   = Resolve <IFileServiceFactory>();
            _configurationManager = Resolve <IConfigurationManager>();

            _fileDataRepository = new FileDataRepository(_fileserviceFactory, _configurationManager);
        }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="QCController" /> class.
 /// </summary>
 /// <param name="qcService">IQC Service object.</param>
 /// <param name="fileServiceFactory">File service factory</param>
 /// <param name="userService">User service</param>
 public QCController(IQCService qcService, IFileServiceFactory fileServiceFactory, IUserService userService)
 {
     this.qcService = qcService;
     this.fileServiceFactory = fileServiceFactory;
     this.userService = userService;
     this.user = IdentityHelper.GetCurrentUser(this.userService, this.User as ClaimsPrincipal);
     this.diagnostics = new DiagnosticsProvider(this.GetType());
 }
Example #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="QCController" /> class.
 /// </summary>
 /// <param name="qcService">IQC Service object.</param>
 /// <param name="fileServiceFactory">File service factory</param>
 /// <param name="userService">User service</param>
 public QCController(IQCService qcService, IFileServiceFactory fileServiceFactory, IUserService userService)
 {
     this.qcService          = qcService;
     this.fileServiceFactory = fileServiceFactory;
     this.userService        = userService;
     this.user        = IdentityHelper.GetCurrentUser(this.userService, this.User as ClaimsPrincipal);
     this.diagnostics = new DiagnosticsProvider(this.GetType());
 }
Example #7
0
 /// <summary>
 /// Instantiates the PublishController
 /// </summary>
 public PublishController(IPublishQueueService publishQueueService, IUserService userService, IRepositoryService repositoryService, IFileServiceFactory fileServiceFactory)
     : base()
 {
     diagnostics = new DiagnosticsProvider(this.GetType());
     this.publishQueueService = publishQueueService;
     this.userService         = userService;
     this.repositoryService   = repositoryService;
     this.fileServiceFactory  = fileServiceFactory;
     this.user = IdentityHelper.GetCurrentUser(this.userService, this.User as ClaimsPrincipal);
 }
Example #8
0
 /// <summary>
 /// Instantiates the PublishController
 /// </summary>
 public PublishController(IPublishQueueService publishQueueService, IUserService userService, IRepositoryService repositoryService, IFileServiceFactory fileServiceFactory)
     : base()
 {
     diagnostics = new DiagnosticsProvider(this.GetType());
     this.publishQueueService = publishQueueService;
     this.userService = userService;
     this.repositoryService = repositoryService;
     this.fileServiceFactory = fileServiceFactory;
     this.user = IdentityHelper.GetCurrentUser(this.userService, this.User as ClaimsPrincipal);
 }
Example #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FilesController" /> class.
 /// </summary>
 /// <param name="fileServiceFactory">IFileServiceFactory</param>
 /// <param name="repositoryService">IRepositoryService</param>
 /// <param name="qcService">IQCService</param>
 /// <param name="userService">IUserService</param>
 /// <param name="repositoryAdapterFactory">IRepositoryAdapterFactory</param>
 public FilesController(IFileServiceFactory fileServiceFactory, IRepositoryService repositoryService, IQCService qcService, IUserService userService, IRepositoryAdapterFactory repositoryAdapterFactory)
 {
     this.repositoryService        = repositoryService;
     this.qcService                = qcService;
     this.fileServiceFactory       = fileServiceFactory;
     this.userService              = userService;
     this.fileService              = fileServiceFactory.GetFileService(BaseRepositoryEnum.Default.ToString());
     this.diagnostics              = new DiagnosticsProvider(this.GetType());
     this.repositoryAdapterFactory = repositoryAdapterFactory;
     this.user = IdentityHelper.GetCurrentUser(this.userService, this.User as ClaimsPrincipal);
 }
Example #10
0
        public BlobController(IFileServiceFactory fileServiceFactory, IUserService userService, IFileHandlerFactory fileHandlerFactory)
        {
            Check.IsNotNull(fileServiceFactory, "fileServiceFactory");
            Check.IsNotNull(userService, "userService");
            Check.IsNotNull(fileHandlerFactory, "fileHandlerFactory");
            diagnostics = new DiagnosticsProvider(this.GetType());

            this.userService = userService;
            this.fileService = fileServiceFactory.GetFileService(Constants.Default);

            // get the current/signed in user
            this.user = IdentityHelper.GetCurrentUser(this.userService, this.User as ClaimsPrincipal);
            this.fileHandlerFactory = fileHandlerFactory;
        }
Example #11
0
 public DocumentsCommandHandler(
     IMediator mediator,
     AppDbContext context,
     IEncryptionServices encryptionService,
     IFileServiceFactory fileFactory,
     IOptionsMonitor <StorageOptions> storageOption
     )
 {
     _mediator          = mediator;
     _context           = context;
     _encryptionService = encryptionService;
     _storageOption     = storageOption.CurrentValue;
     _fileService       = fileFactory.Create();
 }
        public CreateAssetCommandValidator(IFileServiceFactory fileServiceFactory)
        {
            _fileService = fileServiceFactory.Create<FileAssetOptions>();
            
            RuleFor(a => a.Name)
                .AssetNameValidation();

            RuleFor(a => a.FileURI)
                .FilePathValidation();

            RuleFor(a => a.Image)
                .ImageValidation()
                .SetValidator(new FileOptionsValidator(_fileService));           
        }
Example #13
0
        public BlobController(IFileServiceFactory fileServiceFactory, IUserService userService, IFileHandlerFactory fileHandlerFactory)
        {
            Check.IsNotNull(fileServiceFactory, "fileServiceFactory");
            Check.IsNotNull(userService, "userService");
            Check.IsNotNull(fileHandlerFactory, "fileHandlerFactory");
            diagnostics = new DiagnosticsProvider(this.GetType());

            this.userService = userService;
            this.fileService = fileServiceFactory.GetFileService(Constants.Default);

            // get the current/signed in user
            this.user = IdentityHelper.GetCurrentUser(this.userService, this.User as ClaimsPrincipal);
            this.fileHandlerFactory = fileHandlerFactory;

        }
Example #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FilesController" /> class.
 /// </summary>
 /// <param name="fileServiceFactory">IFileServiceFactory</param>
 /// <param name="repositoryService">IRepositoryService</param>
 /// <param name="qcService">IQCService</param>
 /// <param name="userService">IUserService</param>
 /// <param name="repositoryAdapterFactory">IRepositoryAdapterFactory</param>
 public FilesController(IFileServiceFactory fileServiceFactory, IRepositoryService repositoryService, IQCService qcService, IUserService userService, IRepositoryAdapterFactory repositoryAdapterFactory)
 {
     this.repositoryService = repositoryService;
     this.qcService = qcService;
     this.fileServiceFactory = fileServiceFactory;
     this.userService = userService;
     this.fileService = fileServiceFactory.GetFileService(BaseRepositoryEnum.Default.ToString());
     this.diagnostics = new DiagnosticsProvider(this.GetType());
     this.repositoryAdapterFactory = repositoryAdapterFactory;
     this.user = IdentityHelper.GetCurrentUser(this.userService, this.User as ClaimsPrincipal);
 }
Example #15
0
        /// <summary>
        /// Reuturns the PublishQueueServicer instance.
        /// </summary>
        /// <param name="nullMessageHandler">Indicates if the handler has to be returned or not.</param>
        /// <returns>MessaeRouter instance.</returns>
        private PublishQueueService GetPublishQueueService()
        {
            this.fileService = new StubIFileService()
            {
                PublishFilePublishMessage = (publishMessage) =>
                    {
                        return "successfull";
                    },
                GetFileByFileIdInt32 = (fileId) =>
                    {
                        this.file = new File() { FileId = 1 };
                        return file;
                    },
                UpdateFileFile = (file) =>
                    {
                        this.file = file;
                        return true;
                    },
            };

            this.fileServiceFactory = new StubIFileServiceFactory()
            {
                GetFileServiceString = (instanceName) =>
                    {
                        return this.fileService;
                    }

            };

            this.repositoryService = new StubIRepositoryService()
            {
                GetRepositoryByIdInt32 = (repositoryId) =>
                    {
                        return new Repository() { BaseRepository = new BaseRepository() { Name = "SkyDrive", BaseRepositoryId = 2 }, RepositoryId = 1, Name = "test" };
                    }
            };

            this.queueRepository = new StubIQueueRepository()
            {
                AddMessageToQueueBaseMessage = (message) =>
                    {
                        this.addedMessage = message;
                    },
                DeleteFromQueueBaseMessage = (message) =>
                    {
                        this.deletedMessage = message;
                    },
                UpdateMessageBaseMessage = (message) =>
                    {
                        this.updatedQueueContent = true;
                    }
            };

            PublishQueueService publishQueueService = new PublishQueueService(this.fileServiceFactory, this.repositoryService, this.queueRepository);
            return publishQueueService;
        }
        /// <summary>
        /// Reuturns the VerifyFileQueueService instance.
        /// </summary>
        /// <returns>VerifyFileQueueService instance.</returns>
        private VerifyFileQueueService GetVerifyFileQueueService()
        {
            this.fileService = new StubIFileService()
            {
                CheckIfFileExistsOnExternalRepositoryVerifyFileMessage = (message) =>
                    {
                        return OperationStatus.CreateSuccessStatus();
                    },
                GetFileByFileIdInt32 = (fileId) =>
                    {
                        this.file = new File() { FileId = 1 };
                        return file;
                    },
                UpdateFileFile = (file) =>
                    {
                        this.file = file;
                        return true;
                    },
            };

            this.fileServiceFactory = new StubIFileServiceFactory()
            {
                GetFileServiceString = (instanceName) =>
                {
                    return this.fileService;
                }

            };

            this.repositoryService = new StubIRepositoryService()
            {
                GetRepositoryByIdInt32 = (repositoryId) =>
                {
                    return new Repository() { BaseRepository = new BaseRepository() { Name = "SkyDrive", BaseRepositoryId = 2 }, RepositoryId = 1, Name = "test" };
                }
            };

            this.queueRepository = new StubIQueueRepository()
            {
                DeleteFromQueueBaseMessage = (message) =>
                {
                    this.deletedMessage = message;
                },
                UpdateMessageBaseMessage = (message) =>
                {
                    this.updatedQueueContent = true;
                }
            };

            this.blobRepository = new StubIBlobDataRepository()
            {
                DeleteFileString = (filename) =>
                    {
                        this.isDeletedFromBlob = true;
                        return this.isDeletedFromBlob;
                    }
            };

            VerifyFileQueueService queueService = new VerifyFileQueueService(this.fileServiceFactory, this.repositoryService, this.queueRepository, this.blobRepository);
            return queueService;
        }
Example #17
0
 public DeleteFileCommandHandler(IDocumentDbContext dbContext, IFileServiceFactory fileServiceFactory)
 {
     this.dbContext          = dbContext;
     this.fileServiceFactory = fileServiceFactory;
 }
 public UpdateAssetComamndtHandler(IApplicationDbContext context, IFileServiceFactory fileFactory)
 {
     _context     = context;
     _fileService = fileFactory.Create <FileAssetOptions>();
 }
Example #19
0
 /// <summary>
 /// Create the <see cref="IFileService"/> default implementation.
 /// In case there is no match a not <see cref="NotSupportedException"/> will be thrown.
 /// </summary>
 /// <returns>The <see cref="IFileService"/> for the requested channel.</returns>
 /// <exception cref="NotSupportedException"></exception>
 public static IFileService Create(this IFileServiceFactory factory) => factory.Create(null);
Example #20
0
 public void TearDown()
 {
     _configurationManager = null;
     _fileserviceFactory   = null;
     _transactionScope.Dispose();
 }
Example #21
0
 public GetAssetImgQueryHandler(IFileServiceFactory fileServiceFactory)
 {
     _fileService = fileServiceFactory.Create <FileAssetOptions>();
 }
        /// <summary>
        /// Reuturns the message Router instance.
        /// </summary>
        /// <param name="nullMessageHandler">Indicates if the handler has to be returned or not.</param>
        /// <returns>MessaeRouter instance.</returns>
        private MessageRouter GetMessageRouter(bool nullMessageHandler)
        {
            this.processedMessage = new List<BaseMessage>();
            this.fileServiceFactory = new StubIFileServiceFactory();
            this.repositoryService = new StubIRepositoryService();
            this.blobRepository = new StubIBlobDataRepository();
            IMessageHandler messageHandler = null;

            if (!nullMessageHandler)
            {
                messageHandler = new StubIMessageHandler()
                {
                    ProcessMessageBaseMessage = (message) =>
                        {
                            this.processedMessage.Add(message);
                        }
                };
            }

            this.messageHandlerFactory = new StubIMessageHandlerFactory
            {
                GetMessageHandlerMessageHandlerEnum = (handler) => {

                    return messageHandler;
                }
            };

            this.queueRepository = new StubIQueueRepository()
            {
                GetQueuedMessagesInt32Int32 = (noofmessages, visibilityTimeout) =>
                    {
                        return this.messages;
                    }
            };

            MessageRouter messageRouter = new MessageRouter(this.messageHandlerFactory, this.queueRepository);
            return messageRouter;
        }
 public CreateAssetCommandHandler(IApplicationDbContext context, IFileServiceFactory fileFactory, IMapper mapper)
 {
     _context     = context;
     _fileService = fileFactory.Create <FileAssetOptions>();
     _mapper      = mapper;
 }
Example #24
0
 public void SetUp()
 {
     _configurationManager = new Mock <IConfigurationManager>();
     _fileServiceFactory   = new FileServiceFactory(_configurationManager.Object);
 }