public void CanPopulate()
        {
            var stream = new VideoStream();

            FakeVideoRepository.LoadVideos(stream);

            Assert.Equal(8, stream.SizeOfStream());
        }
        public CreateVideoHandlerTest()
        {
            _fakeServerRepository = new FakeServerRepository(_dataContextMock);
            _fakeVideoRepository  = new FakeVideoRepository(_dataContextMock);
            _invalidCommand       = new CreateVideoCommand(new Guid(), "", VideoMock.GetFakeInvalidVideo(), "");
            var serverID = _dataContextMock.Servers.FirstOrDefault();

            _validCommand = new CreateVideoCommand(serverID.Id, "Video 01", VideoMock.GetFakeValidVideo(), "c:");
        }
        public DownloadVideoHandlerTest()
        {
            _fakeServerRepository        = new FakeServerRepository(_dataContextMock);
            _fakeVideoRepository         = new FakeVideoRepository(_dataContextMock);
            _invalidCommand              = new DownloadVideoCommand(new Guid(), new Guid());
            _validCommandWithNotExistsId = new DownloadVideoCommand(Guid.NewGuid(), Guid.NewGuid());
            var videoValid = _dataContextMock.Videos.FirstOrDefault();

            _validCommand = new DownloadVideoCommand(videoValid.ServerId, videoValid.Id);
        }
Exemple #4
0
        public static void Main(string[] args)
        {
            var stream = new VideoStream();

            FakeVideoRepository.LoadVideos(stream);

            foreach (var video in stream.Stream)
            {
                var rel  = new RelatedController();
                var size = rel.CreateStream(video, stream);
                Console.WriteLine(size);
            }
        }
        public void EncodeTest()
        {
            //Arrange
            var cloudStorageConfiguration = new CloudStorageConfiguration(CloudStorageAccount.DevelopmentStorageAccount, new Version());

            var queueVideoRepository = new QueueVideoRepository(cloudStorageConfiguration.StorageAccount.CreateCloudQueueClient());
            var videoRepository      = new FakeVideoRepository(_blobSource, _blobDestination);
            var screenshotRepository = new FakeScreenshotRepository(_blobDestination);
            var mediaInfoReader      = new MediaInfoReader();
            var encoder           = new Encoder();
            var fileSystemWrapper = new FileSystemWrapper();

            var queueProcess    = new QueueProcess(1000, queueVideoRepository);
            var downloadProcess = new DownloadProcess(5, videoRepository, fileSystemWrapper);
            var encoderProcess  = new EncodeProcess(5, encoder, videoRepository, mediaInfoReader, queueVideoRepository, fileSystemWrapper);
            var uploadProcess   = new UploadProcess(5, videoRepository, screenshotRepository, fileSystemWrapper);
            var finishProcess   = new FinishProcess(queueVideoRepository, videoRepository, fileSystemWrapper);

            var queueContainer    = new ProcessContainer <object, QueueInformation, DownloadInformation>(queueProcess, downloadProcess);
            var downloadContainer = new ProcessContainer <QueueInformation, DownloadInformation, EncodeInformation>(downloadProcess, encoderProcess);
            var encoderContainer  = new ProcessContainer <DownloadInformation, EncodeInformation, UploadInformation>(encoderProcess, uploadProcess);
            var uploadContainer   = new ProcessContainer <EncodeInformation, UploadInformation, object>(uploadProcess, finishProcess);

            var processManager = new EncodeProcessManager(queueVideoRepository.DeleteMessageLocal);

            processManager.Add(queueContainer);
            processManager.Add(downloadContainer);
            processManager.Add(encoderContainer);
            processManager.Add(uploadContainer);

            var timer = new Timer(UpdateMessages, queueVideoRepository, (int)queueVideoRepository.InvisibleTime.TotalMilliseconds / 2, (int)queueVideoRepository.InvisibleTime.TotalMilliseconds / 2);

            //Act & Assert
            Task task = processManager.Start();

            StartQueueWork();

            Thread.Sleep(30000);


            while (queueVideoRepository.ApproximateMessageCount > 0)
            {
                Thread.Sleep(60000);
            }

            //Thread.Sleep(50*60*1000);

            processManager.Stop();

            task.Wait();
        }
 public RecommendationController()
 {
     _recommendation.NumberOfRecommendedVideos = 5;
     FakeVideoRepository.LoadVideos(_videoStream);
 }