예제 #1
0
        private void ExportToZip_Connection()
        {
            // Save configuration
            this.Save_SourceConfiguration();

            IReportServerReader    reader             = null;
            DataSourceItemExporter dataSourceExporter = null;
            FolderItemExporter     folderExporter     = null;
            ReportItemExporter     reportExporter     = null;
            IBundler    zipBundler = null;
            IFileSystem fileSystem = null;

            // Test the source connection
            this.TestSourceConnection(true);

            string version = this.GetSourceServerVersion();

            reader = this.mKernel.Get <IReportServerReader>(version);

            dataSourceExporter = this.mKernel.Get <DataSourceItemExporter>();
            folderExporter     = this.mKernel.Get <FolderItemExporter>();
            reportExporter     = this.mKernel.Get <ReportItemExporter>();

            zipBundler = this.mKernel.Get <IBundler>();
            fileSystem = this.mKernel.Get <IFileSystem>();

            this.PerformExportToZip(this.txtSrcPath.Text,
                                    this.txtExportZipFilename.Text,
                                    reader,
                                    folderExporter,
                                    reportExporter,
                                    dataSourceExporter,
                                    zipBundler,
                                    fileSystem);
        }
예제 #2
0
파일: WebSite.cs 프로젝트: vishalishere/vrs
        /// <summary>
        /// See interface docs.
        /// </summary>
        /// <param name="server"></param>
        public void AttachSiteToServer(IWebServer server)
        {
            if (server == null)
            {
                throw new ArgumentNullException("server");
            }
            if (WebServer != server)
            {
                if (WebServer != null)
                {
                    throw new InvalidOperationException("The web site can only be attached to one server");
                }

                _UserManager = Factory.Singleton.Resolve <IUserManager>().Singleton;

                var configurationStorage = Factory.Singleton.Resolve <IConfigurationStorage>().Singleton;
                configurationStorage.ConfigurationChanged += ConfigurationStorage_ConfigurationChanged;

                WebServer   = server;
                server.Root = "/VirtualRadar";

                var installerSettingsStorage = Factory.Singleton.Resolve <IInstallerSettingsStorage>();
                var installerSettings        = installerSettingsStorage.Load();
                server.Port = installerSettings.WebServerPort;

                server.AuthenticationRequired += Server_AuthenticationRequired;

                _Bundler = Factory.Singleton.Resolve <IBundler>();
                _Bundler.AttachToWebSite(this);

                _Minifier = Factory.Singleton.Resolve <IMinifier>();
                _Minifier.Initialise();

                _Pages.Add(_CorsPreflightPage);
                _Pages.Add(_FileSystemPage);
                _Pages.Add(new TextPage(this));
                _Pages.Add(_AircraftListJsonPage);
                _Pages.Add(_ImagePage);
                _Pages.Add(new ServerConfigJsonPage(this));
                _Pages.Add(new AudioPage(this));
                _Pages.Add(new FaviconPage(this));
                _Pages.Add(_ReportRowsJsonPage);
                _Pages.Add(_ClosestAircraftJsonPage);
                _Pages.Add(new AirportDataProxyPage(this));
                _Pages.Add(new PolarPlotJsonPage(this));
                _Pages.Add(new DirectoryEntryJsonPage(this));

                _JavaScriptInjectors.Add(new WebSiteStringsInjector());

                foreach (var page in _Pages)
                {
                    page.Provider = Provider;
                }

                LoadConfiguration();

                server.RequestReceived += Server_RequestReceived;
            }
        }
예제 #3
0
        public void SetUp()
        {
            // Each test will add files to ZipFileWrapper using ZipBundler,
            //  so they need to get recreated for each test so the zip is in a clean state
            //  for each test.
            zipBundler = kernel.Get <IBundler>();

            this.SetUpEnvironment();
        }
예제 #4
0
        public ExportZipForm(string sourceRootPath,
            string destinationFilename,
            IReportServerReader reader,
            FolderItemExporter folderExporter,
            ReportItemExporter reportExporter,
            DataSourceItemExporter dataSourceExporter,
            IBundler zipBundler,
            ILoggerFactory loggerFactory,
            IFileSystem fileSystem)
        {
            if (string.IsNullOrEmpty(sourceRootPath))
                throw new ArgumentException("sourceRootPath");

            if (string.IsNullOrEmpty(destinationFilename))
                throw new ArgumentException("destinationFilename");

            if (reader == null)
                throw new ArgumentNullException("reader");

            if (folderExporter == null)
                throw new ArgumentNullException("folderExporter");

            if (reportExporter == null)
                throw new ArgumentNullException("reportExporter");

            if (dataSourceExporter == null)
                throw new ArgumentNullException("dataSourceExporter");

            if (zipBundler == null)
                throw new ArgumentNullException("zipBundler");

            if (loggerFactory == null)
                throw new ArgumentNullException("loggerFactory");

            if (fileSystem == null)
                throw new ArgumentNullException("fileSystem");

            InitializeComponent();

            this.mSourceRootPath = sourceRootPath;
            this.mExportDestinationFilename = destinationFilename;
            this.mReportServerReader = reader;
            this.mFolderExporter = folderExporter;
            this.mReportExporter = reportExporter;
            this.mDataSourceExporter = dataSourceExporter;
            this.mZipBundler = zipBundler;
            this.mLoggerFactory = loggerFactory;
            this.mFileSystem = fileSystem;

            this.mLogger = mLoggerFactory.GetCurrentClassLogger();

            this.mExportOutputTempDirectory = this.GetTemporaryExportOutputFolder("SSRSMigrate_ExportZip");
            this.CreateExportOutputFolder(this.mExportOutputTempDirectory);
            this.mSummaryForm = new SummaryForm();
        }
예제 #5
0
파일: solar.cs 프로젝트: Staskkk/VRPhone
        public static IBundler bindTo_IBundler(IComponentIntrospect component)
        {
            global::System.IntPtr cPtr = solarPINVOKE.bindTo_IBundler(IComponentIntrospect.getCPtr(component));
            IBundler ret = (cPtr == global::System.IntPtr.Zero) ? null : new IBundler(cPtr, true);

            if (solarPINVOKE.SWIGPendingException.Pending)
            {
                throw solarPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #6
0
        public void TestInitialise()
        {
            _OriginalClassFactory = Factory.TakeSnapshot();

            _Configuration        = new Configuration();
            _ConfigurationStorage = TestUtilities.CreateMockSingleton <IConfigurationStorage>();
            _ConfigurationStorage.Setup(r => r.Load()).Returns(_Configuration);

            _Bundler = Factory.Singleton.Resolve <IBundler>();

            _Minifier = TestUtilities.CreateMockImplementation <IMinifier>();
            _Minifier.Setup(r => r.MinifyJavaScript(It.IsAny <string>())).Returns((string js) => js);

            _WebServer = TestUtilities.CreateMockImplementation <IWebServer>();
            _WebServer.Setup(r => r.Root).Returns("/Root/");
            _WebSite = TestUtilities.CreateMockImplementation <IWebSite>();
            _WebSite.Setup(r => r.WebServer).Returns(_WebServer.Object);

            _Request = new Mock <IRequest>()
            {
                DefaultValue = DefaultValue.Mock
            }.SetupAllProperties();
            _Response = new Mock <IResponse>()
            {
                DefaultValue = DefaultValue.Mock
            }.SetupAllProperties();
            _Request.Setup(m => m.ContentLength64).Returns(() => { return(_Request.Object.InputStream == null ? 0L : _Request.Object.InputStream.Length); });
            _OutputStream = new MemoryStream();
            _Response.Setup(m => m.OutputStream).Returns(_OutputStream);

            _PathAndFileToContent = new Dictionary <string, SimpleContent>();
            _WebSite.Setup(r => r.RequestSimpleContent(It.IsAny <string>())).Returns((string pathAndFile) => {
                SimpleContent simpleContent;
                if (!_PathAndFileToContent.TryGetValue(pathAndFile, out simpleContent))
                {
                    simpleContent = new SimpleContent()
                    {
                        Content = new byte[] { }, HttpStatusCode = HttpStatusCode.NotFound
                    };
                }
                return(simpleContent);
            });
        }
예제 #7
0
        private void PerformExportToZip(string sourceRootPath,
                                        string destinationFilename,
                                        IReportServerReader reader,
                                        FolderItemExporter folderExporter,
                                        ReportItemExporter reportExporter,
                                        DataSourceItemExporter dataSourceExporter,
                                        IBundler zipBunder,
                                        IFileSystem fileSystem)
        {
            ExportZipForm exportZipForm = new ExportZipForm(
                sourceRootPath,
                destinationFilename,
                reader,
                folderExporter,
                reportExporter,
                dataSourceExporter,
                zipBunder,
                this.mLoggerFactory,
                fileSystem);

            exportZipForm.DebugForm = this.mDebugForm;
            exportZipForm.Show();
        }
예제 #8
0
        private void PerformExportToZip(string sourceRootPath,
            string destinationFilename,
            IReportServerReader reader,
            FolderItemExporter folderExporter,
            ReportItemExporter reportExporter,
            DataSourceItemExporter dataSourceExporter,
            IBundler zipBunder,
            IFileSystem fileSystem)
        {
            ExportZipForm exportZipForm = new ExportZipForm(
                sourceRootPath,
                destinationFilename,
                reader,
                folderExporter,
                reportExporter,
                dataSourceExporter,
                zipBunder,
                this.mLoggerFactory,
                fileSystem);

            exportZipForm.DebugForm = this.mDebugForm;
            exportZipForm.Show();
        }
예제 #9
0
        protected virtual IReadOnlyList <string> GetBundleFiles(BundleConfigurationCollection bundles, string bundleName, IBundler bundler)
        {
            var contributors     = GetContributors(bundles, bundleName);
            var bundleFiles      = RequestResources.TryAdd(GetBundleFiles(contributors));
            var dynamicResources = RequestResources.TryAdd(GetDynamicResources(contributors));

            if (!IsBundlingEnabled())
            {
                return(bundleFiles.Union(dynamicResources).ToImmutableList());
            }

            var bundleRelativePath =
                Options.BundleFolderName.EnsureEndsWith('/') +
                bundleName + "." + bundleFiles.JoinAsString("|").ToMd5() + "." + bundler.FileExtension;

            var cacheItem = BundleCache.GetOrAdd(bundleRelativePath, () =>
            {
                var cacheValue = new BundleCacheItem(
                    new List <string>
                {
                    "/" + bundleRelativePath
                }
                    );

                WatchChanges(cacheValue, bundleFiles, bundleRelativePath);

                var bundleResult = bundler.Bundle(
                    new BundlerContext(
                        bundleRelativePath,
                        bundleFiles,
                        IsMinficationEnabled()
                        )
                    );

                SaveBundleResult(bundleRelativePath, bundleResult);

                return(cacheValue);
            });

            return(cacheItem.Files.Union(dynamicResources).ToImmutableList());
        }
예제 #10
0
        public void TearDown()
        {
            zipBundler = null;

            this.TearDownEnvironment();
        }
예제 #11
0
        public ExportZipForm(string sourceRootPath,
                             string destinationFilename,
                             IReportServerReader reader,
                             FolderItemExporter folderExporter,
                             ReportItemExporter reportExporter,
                             DataSourceItemExporter dataSourceExporter,
                             IBundler zipBundler,
                             ILoggerFactory loggerFactory,
                             IFileSystem fileSystem)
        {
            if (string.IsNullOrEmpty(sourceRootPath))
            {
                throw new ArgumentException("sourceRootPath");
            }

            if (string.IsNullOrEmpty(destinationFilename))
            {
                throw new ArgumentException("destinationFilename");
            }

            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            if (folderExporter == null)
            {
                throw new ArgumentNullException("folderExporter");
            }

            if (reportExporter == null)
            {
                throw new ArgumentNullException("reportExporter");
            }

            if (dataSourceExporter == null)
            {
                throw new ArgumentNullException("dataSourceExporter");
            }

            if (zipBundler == null)
            {
                throw new ArgumentNullException("zipBundler");
            }

            if (loggerFactory == null)
            {
                throw new ArgumentNullException("loggerFactory");
            }

            if (fileSystem == null)
            {
                throw new ArgumentNullException("fileSystem");
            }

            InitializeComponent();

            this.mSourceRootPath            = sourceRootPath;
            this.mExportDestinationFilename = destinationFilename;
            this.mReportServerReader        = reader;
            this.mFolderExporter            = folderExporter;
            this.mReportExporter            = reportExporter;
            this.mDataSourceExporter        = dataSourceExporter;
            this.mZipBundler    = zipBundler;
            this.mLoggerFactory = loggerFactory;
            this.mFileSystem    = fileSystem;

            this.mLogger = mLoggerFactory.GetCurrentClassLogger();

            this.mExportOutputTempDirectory = this.GetTemporaryExportOutputFolder("SSRSMigrate_ExportZip");
            this.CreateExportOutputFolder(this.mExportOutputTempDirectory);
            this.mSummaryForm = new SummaryForm();
        }
예제 #12
0
        public void TearDown()
        {
            zipBundler = null;

            this.TearDownEnvironment();
        }
예제 #13
0
        public void SetUp()
        {
            // Each test will add files to ZipFileWrapper using ZipBundler,
            //  so they need to get recreated for each test so the zip is in a clean state
            //  for each test.
            zipBundler = kernel.Get<IBundler>();

            this.SetUpEnvironment();
        }