private void ExportToDisk_Connection()
        {
            // Save configuration
            this.Save_SourceConfiguration();

            IReportServerReader    reader             = null;
            DataSourceItemExporter dataSourceExporter = null;
            FolderItemExporter     folderExporter     = null;
            ReportItemExporter     reportExporter     = 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>();

            this.PerformExportToDisk(this.txtSrcPath.Text,
                                     this.txtExportDiskFolderName.Text,
                                     reader,
                                     folderExporter,
                                     reportExporter,
                                     dataSourceExporter);
        }
        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);
        }
        public void Constructor_Succeed()
        {
            var logger = new MockLogger();

            DataSourceItemExporter dataSourceExporter = new DataSourceItemExporter(exportWriterMock.Object, serializeWrapperMock.Object, logger);

            Assert.NotNull(dataSourceExporter);
        }
        public ExportDiskForm(string sourceRootPath,
                              string destinationPath,
                              IReportServerReader reader,
                              FolderItemExporter folderExporter,
                              ReportItemExporter reportExporter,
                              DataSourceItemExporter dataSourceExporter,
                              ILoggerFactory loggerFactory)
        {
            if (string.IsNullOrEmpty(sourceRootPath))
            {
                throw new ArgumentException("sourceRootPath");
            }

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

            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 (loggerFactory == null)
            {
                throw new ArgumentNullException("loggerFactory");
            }

            InitializeComponent();

            this.mSourceRootPath        = sourceRootPath;
            this.mExportDestinationPath = destinationPath;
            this.mReportServerReader    = reader;
            this.mFolderExporter        = folderExporter;
            this.mReportExporter        = reportExporter;
            this.mDataSourceExporter    = dataSourceExporter;
            this.mLoggerFactory         = loggerFactory;

            this.mLogger      = mLoggerFactory.GetCurrentClassLogger();
            this.mSummaryForm = new SummaryForm();
        }
Example #5
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();
        }
        public void Constructor_NullISerializeWrapper()
        {
            var logger = new MockLogger();

            ArgumentNullException ex = Assert.Throws <ArgumentNullException>(
                delegate
            {
                DataSourceItemExporter dataSourceExporter = new DataSourceItemExporter(exportWriterMock.Object, null, logger);
            });

            Assert.That(ex.Message, Is.EqualTo("Value cannot be null.\r\nParameter name: serializeWrapper"));
        }
        public void TestFixtureSetUp()
        {
            EnvironmentSetup();
            outputPath = GetOutPutPath();
            SetupExpectedValues();

            // Create the IItemExporter objects
            reportExporter     = TestKernel.Instance.Get <ReportItemExporter>();
            dataSourceExporter = TestKernel.Instance.Get <DataSourceItemExporter>();
            folderExporter     = TestKernel.Instance.Get <FolderItemExporter>();

            reader = TestKernel.Instance.Get <IReportServerReader>("2005-SRC");
        }
        private void PerformExportToDisk(string sourceRootPath,
                                         string destinationPath,
                                         IReportServerReader reader,
                                         FolderItemExporter folderExporter,
                                         ReportItemExporter reportExporter,
                                         DataSourceItemExporter dataSourceExporter)
        {
            ExportDiskForm exportDiskForm = new ExportDiskForm(sourceRootPath,
                                                               destinationPath,
                                                               reader,
                                                               folderExporter,
                                                               reportExporter,
                                                               dataSourceExporter,
                                                               this.mLoggerFactory);

            exportDiskForm.DebugForm = this.mDebugForm;
            exportDiskForm.Show();
        }
Example #9
0
        public ExportDiskForm(string sourceRootPath,
            string destinationPath,
            IReportServerReader reader,
            FolderItemExporter folderExporter,
            ReportItemExporter reportExporter,
            DataSourceItemExporter dataSourceExporter,
            ILoggerFactory loggerFactory)
        {
            if (string.IsNullOrEmpty(sourceRootPath))
                throw new ArgumentException("sourceRootPath");

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

            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 (loggerFactory == null)
                throw new ArgumentNullException("loggerFactory");

            InitializeComponent();

            this.mSourceRootPath = sourceRootPath;
            this.mExportDestinationPath = destinationPath;
            this.mReportServerReader = reader;
            this.mFolderExporter = folderExporter;
            this.mReportExporter = reportExporter;
            this.mDataSourceExporter = dataSourceExporter;
            this.mLoggerFactory = loggerFactory;

            this.mLogger = mLoggerFactory.GetCurrentClassLogger();
            this.mSummaryForm = new SummaryForm();
        }
        public void TestFixtureSetUp()
        {
            expectedDataSourceItemJson = JsonConvert.SerializeObject(dataSourceItem, Formatting.Indented);

            exportWriterMock     = new Mock <IExportWriter>();
            serializeWrapperMock = new Mock <ISerializeWrapper>();
            var logger = new MockLogger();

            // Mock IExporter.Save any argument with overwrite = True
            exportWriterMock.Setup(e => e.Save(It.IsAny <string>(), It.IsAny <string>(), true));

            // Mock IExporter.Save where the filename exists but overwrite = false
            exportWriterMock.Setup(e => e.Save(expectedDataSourceItemFileName, It.IsAny <string>(), false))
            .Throws(new IOException(string.Format("File '{0}' already exists.", expectedDataSourceItemFileName)));

            // Mock ISerializeWrapper.Serialize
            serializeWrapperMock.Setup(s => s.SerializeObject(dataSourceItem))
            .Returns(() => expectedDataSourceItemJson);

            exporter = new DataSourceItemExporter(exportWriterMock.Object, serializeWrapperMock.Object, logger);
        }
Example #11
0
        public void TestFixtureSetUp()
        {
            EnvironmentSetup();

            var settings = new NinjectSettings()
            {
                LoadExtensions = false
            };

            kernel = new StandardKernel(
                settings,
                new Log4NetModule(),
                new DependencyModule());

            exporter = kernel.Get <DataSourceItemExporter>();

            dataSourceItem = new DataSourceItem()
            {
                Description                          = null,
                VirtualPath                          = null,
                Name                                 = "AWDataSource",
                Path                                 = "/SSRSMigrate_AW_Tests/Data Sources/AWDataSource",
                ConnectString                        = "Data Source=(local)\\SQL2008;Initial Catalog=AdventureWorks2008",
                CredentialsRetrieval                 = "Integrated",
                Enabled                              = true,
                EnabledSpecified                     = true,
                Extension                            = "SQL",
                ImpersonateUser                      = false,
                ImpersonateUserSpecified             = true,
                OriginalConnectStringExpressionBased = false,
                Password                             = null,
                Prompt                               = "Enter a user name and password to access the data source:",
                UseOriginalConnectString             = false,
                UserName                             = null,
                WindowsCredentials                   = false
            };

            outputPath = GetOutPutPath();
        }
        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();
        }
Example #13
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();
        }
Example #14
0
        private void PerformExportToDisk(string sourceRootPath,
            string destinationPath,
            IReportServerReader reader,
            FolderItemExporter folderExporter,
            ReportItemExporter reportExporter,
            DataSourceItemExporter dataSourceExporter)
        {
            ExportDiskForm exportDiskForm = new ExportDiskForm(sourceRootPath,
                destinationPath,
                reader,
                folderExporter,
                reportExporter,
                dataSourceExporter,
                this.mLoggerFactory);

            exportDiskForm.DebugForm = this.mDebugForm;
            exportDiskForm.Show();
        }
        public void Constructor_NullIExportWriter()
        {
            ArgumentNullException ex = Assert.Throws<ArgumentNullException>(
                delegate
                {
                    DataSourceItemExporter dataSourceExporter = new DataSourceItemExporter(null, serializeWrapperMock.Object);
                });

            Assert.That(ex.Message, Is.EqualTo("Value cannot be null.\r\nParameter name: exportWriter"));
        }
        public void TestFixtureSetUp()
        {
            expectedDataSourceItemJson = JsonConvert.SerializeObject(dataSourceItem, Formatting.Indented);

            exportWriterMock = new Mock<IExportWriter>();
            serializeWrapperMock = new Mock<ISerializeWrapper>();

            // Mock IExporter.Save any argument with overwrite = True
            exportWriterMock.Setup(e => e.Save(It.IsAny<string>(), It.IsAny<string>(), true));

            // Mock IExporter.Save where the filename exists but overwrite = false
            exportWriterMock.Setup(e => e.Save(expectedDataSourceItemFileName, It.IsAny<string>(), false))
                .Throws(new IOException(string.Format("File '{0}' already exists.", expectedDataSourceItemFileName)));

            // Mock ISerializeWrapper.Serialize
            serializeWrapperMock.Setup(s => s.SerializeObject(dataSourceItem))
                .Returns(() => expectedDataSourceItemJson);

            exporter = new DataSourceItemExporter(exportWriterMock.Object, serializeWrapperMock.Object);
        }
        public void Constructor_Succeed()
        {
            DataSourceItemExporter dataSourceExporter = new DataSourceItemExporter(exportWriterMock.Object, serializeWrapperMock.Object);

            Assert.NotNull(dataSourceExporter);
        }
Example #18
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();
        }
        public void TestFixtureSetUp()
        {
            EnvironmentSetup();

            var settings = new NinjectSettings()
            {
                LoadExtensions = false
            };

            kernel = new StandardKernel(
                settings,
                new Log4NetModule(),
                new DependencyModule());

            exporter = kernel.Get<DataSourceItemExporter>();

            dataSourceItem = new DataSourceItem()
            {
                Description = null,
                VirtualPath = null,
                Name = "AWDataSource",
                Path = "/SSRSMigrate_AW_Tests/Data Sources/AWDataSource",
                ConnectString = "Data Source=(local)\\SQL2008;Initial Catalog=AdventureWorks2008",
                CredentialsRetrieval = "Integrated",
                Enabled = true,
                EnabledSpecified = true,
                Extension = "SQL",
                ImpersonateUser = false,
                ImpersonateUserSpecified = true,
                OriginalConnectStringExpressionBased = false,
                Password = null,
                Prompt = "Enter a user name and password to access the data source:",
                UseOriginalConnectString = false,
                UserName = null,
                WindowsCredentials = false
            };

            outputPath = GetOutPutPath();
        }
        public void TestFixtureSetUp()
        {
            EnvironmentSetup();
            outputPath = GetOutPutPath();
            SetupExpectedValues();

            // Create the IItemExporter objects
            reportExporter = TestKernel.Instance.Get<ReportItemExporter>();
            dataSourceExporter = TestKernel.Instance.Get<DataSourceItemExporter>();
            folderExporter = TestKernel.Instance.Get<FolderItemExporter>();

            reader = TestKernel.Instance.Get<IReportServerReader>("2005-SRC");
        }