private void PerformImportFromZip(
            string sourceFilename,
            string destinationRootPath,
            string destinationServerUrl,
            IReportServerWriter writer,
            IBundleReader zipBundleReader,
            IItemImporter <DataSourceItem> dataSourceItemImporter,
            IItemImporter <FolderItem> folderItemImporter,
            IItemImporter <ReportItem> reportItemImporter,
            IFileSystem fileSystem)
        {
            DataSourceEditForm dataSourceEditForm = this.mKernel.Get <DataSourceEditForm>();

            ImportZipForm importzipForm = new ImportZipForm(
                sourceFilename,
                destinationRootPath,
                destinationServerUrl,
                dataSourceEditForm,
                zipBundleReader,
                writer,
                this.mLoggerFactory,
                dataSourceItemImporter,
                folderItemImporter,
                reportItemImporter,
                fileSystem);

            importzipForm.DebugForm = this.mDebugForm;
            importzipForm.Show();
        }
 // Event handlers for ZipBundleReader's On*Read events
 private void OnFolderReadEvent(IBundleReader sender, ItemReadEvent e)
 {
     if (e.Success)
     {
         actualFolders.Add(e.FileName);
     }
 }
 private void OnDataSourceReadEvent(IBundleReader sender, ItemReadEvent e)
 {
     if (e.Success)
     {
         actualDataSources.Add(e.FileName);
     }
 }
 private void OnReportReadEvent(IBundleReader sender, ItemReadEvent e)
 {
     if (e.Success)
     {
         actualReports.Add(e.FileName);
     }
 }
Beispiel #5
0
        public ImportZipForm(
            string sourceFileName,
            string destinationRootPath,
            string destinationServerUrl,
            IBundleReader bundleReader,
            IReportServerWriter writer,
            ILoggerFactory loggerFactory,
            IItemImporter<DataSourceItem> dataSourceItemImporter,
            IItemImporter<FolderItem> folderItemImporter,
            IItemImporter<ReportItem> reportItemImporter,
            IFileSystem fileSystem)
        {
            if (string.IsNullOrEmpty(sourceFileName))
                throw new ArgumentException("sourceFileName");

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

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

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

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

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

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

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

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

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

            InitializeComponent();

            this.mSourceFileName = sourceFileName;
            this.mDestinationRootPath = destinationRootPath;
            this.mDestinationServerUrl = destinationServerUrl;
            this.mBundleReader = bundleReader;
            this.mReportServerWriter = writer;
            this.mLoggerFactory = loggerFactory;
            this.mLogger = this.mLoggerFactory.GetCurrentClassLogger();
            this.mDataSourceItemImporter = dataSourceItemImporter;
            this.mFolderItemImporter = folderItemImporter;
            this.mReportItemImporter = reportItemImporter;
            this.mFileSystem = fileSystem;
            this.mSummaryForm = new SummaryForm();
        }
Beispiel #6
0
        public void TearDown()
        {
            // Tear down the evironment that is on disk after each test
            this.EnvironmentTearDown();

            // Unsubscribe to events after each test
            bundleReader.OnDataSourceRead -= OnDataSourceReadEvent;
            bundleReader.OnFolderRead     -= OnFolderReadEvent;
            bundleReader.OnReportRead     -= OnReportReadEvent;

            bundleReader = null;
        }
        private void ImportFromZip_Connection()
        {
            // Save configuration
            this.Save_DestinationConfiguration();
            this.Save_ImportZipConfiguration();

            IReportServerWriter            writer                 = null;
            IBundleReader                  zipBundleReader        = null;
            IItemImporter <DataSourceItem> dataSourceItemImporter = null;
            IItemImporter <FolderItem>     folderItemImporter     = null;
            IItemImporter <ReportItem>     reportItemImporter     = null;
            IFileSystem fileSystem = null;

            // Test the destination connection
            this.TestDestinationConnection(true);

            string version = this.GetDestinationServerVersion();

            writer = this.mKernel.Get <IReportServerWriter>(version);

            writer.Overwrite = this.cbkDestOverwrite.Checked;

            zipBundleReader = this.mKernel.Get <IBundleReader>();

            // Set properties for IBundleReader
            zipBundleReader.UnPackDirectory = this.GetTempExtractPath();
            zipBundleReader.ArchiveFileName = this.txtImportZipFilename.Text;

            dataSourceItemImporter = this.mKernel.Get <DataSourceItemImporter>();
            folderItemImporter     = this.mKernel.Get <FolderItemImporter>();
            reportItemImporter     = this.mKernel.Get <ReportItemImporter>();
            fileSystem             = this.mKernel.Get <IFileSystem>();

            this.PerformImportFromZip(
                this.txtImportZipFilename.Text,
                this.txtDestPath.Text,
                this.txtDestUrl.Text,
                writer,
                zipBundleReader,
                dataSourceItemImporter,
                folderItemImporter,
                reportItemImporter,
                fileSystem
                );
        }
Beispiel #8
0
        public void SetUp()
        {
            // Setup the environment on disk before each test
            this.EnvironmentSetup();

            bundleReader = kernel.Get <IBundleReader>();

            // Set IBundleReader's properties for the archive to extract
            //  and where to extract it to
            bundleReader.ArchiveFileName = Path.Combine(GetTestDataPath(), zipFilename);
            bundleReader.UnPackDirectory = unpackDir;

            // Subscribe to the events again for each test
            bundleReader.OnDataSourceRead += OnDataSourceReadEvent;
            bundleReader.OnFolderRead     += OnFolderReadEvent;
            bundleReader.OnReportRead     += OnReportReadEvent;

            // Recreate each a list before each test
            actualReports     = new List <string>();
            actualFolders     = new List <string>();
            actualDataSources = new List <string>();
        }
        private void BundleReaderOnFolderRead(IBundleReader sender, ItemReadEvent itemReadEvent)
        {
            ListViewItem oItem = null;

            if (itemReadEvent.Success)
            {
                ImportStatus status = null;
                FolderItem   item   = this.mFolderItemImporter.ImportItem(itemReadEvent.FileName, out status);

                if (status.Success)
                {
                    oItem = this.AddListViewItem_Success(itemReadEvent, status, item);
                }
                else
                {
                    oItem = this.AddListViewItem_ImportFailed(itemReadEvent, status);
                }
            }
            else
            {
                oItem = this.AddListViewItem_ExtractFailed(itemReadEvent);
            }

            oItem.SubItems.Add(itemReadEvent.Path);
            oItem.SubItems.Add(itemReadEvent.FileName);

            oItem.Group = this.lstSrcReports.Groups["foldersGroup"];

            this.lstSrcReports.Invoke(new Action(() => this.lstSrcReports.Items.Add(oItem)));
            this.lstSrcReports.Invoke(new Action(() => oItem.EnsureVisible()));

            this.lblStatus.Text = string.Format("Refreshing item '{0}'...", itemReadEvent.FileName);

            this.mLogger.Debug("Refreshing item '{0}' in path '{1}'...", itemReadEvent.FileName, itemReadEvent.Path);

            this.mDebugForm.LogMessage(string.Format("Refreshing item '{0}' in path '{1}'...", itemReadEvent.FileName, itemReadEvent.Path));
        }
Beispiel #10
0
        private void PerformImportFromZip(
            string sourceFilename,
            string destinationRootPath,
            string destinationServerUrl,
            IReportServerWriter writer,
            IBundleReader zipBundleReader,
            IItemImporter<DataSourceItem> dataSourceItemImporter,
            IItemImporter<FolderItem> folderItemImporter,
            IItemImporter<ReportItem> reportItemImporter,
            IFileSystem fileSystem)
        {
            ImportZipForm importzipForm = new ImportZipForm(
                sourceFilename,
                destinationRootPath,
                destinationServerUrl,
                zipBundleReader,
                writer,
                this.mLoggerFactory,
                dataSourceItemImporter,
                folderItemImporter,
                reportItemImporter,
                fileSystem);

            importzipForm.DebugForm = this.mDebugForm;
            importzipForm.Show();
        }
        public void SetUp()
        {
            // Setup the environment on disk before each test
            this.EnvironmentSetup();

            bundleReader = kernel.Get<IBundleReader>();

            // Set IBundleReader's properties for the archive to extract
            //  and where to extract it to
            bundleReader.ArchiveFileName = Path.Combine(GetTestDataPath(), zipFilename);
            bundleReader.UnPackDirectory = unpackDir;

            // Subscribe to the events again for each test
            bundleReader.OnDataSourceRead += OnDataSourceReadEvent;
            bundleReader.OnFolderRead += OnFolderReadEvent;
            bundleReader.OnReportRead += OnReportReadEvent;

            // Recreate each a list before each test
            actualReports = new List<string>();
            actualFolders = new List<string>();
            actualDataSources = new List<string>();
        }
Beispiel #12
0
        private void BundleReaderOnReportRead(IBundleReader sender, ItemReadEvent itemReadEvent)
        {
            ListViewItem oItem = null;

            if (itemReadEvent.Success)
            {
                ImportStatus status = null;
                ReportItem item = this.mReportItemImporter.ImportItem(itemReadEvent.FileName, out status);

                if (status.Success)
                {
                    oItem = this.AddListViewItem_Success(itemReadEvent, status, item);
                }
                else
                {
                    oItem = this.AddListViewItem_ImportFailed(itemReadEvent, status);
                }
            }
            else
            {
                oItem = this.AddListViewItem_ExtractFailed(itemReadEvent);
            }

            oItem.SubItems.Add(itemReadEvent.Path);
            oItem.SubItems.Add(itemReadEvent.FileName);

            oItem.Group = this.lstSrcReports.Groups["reportsGroup"];

            this.lstSrcReports.Invoke(new Action(() => this.lstSrcReports.Items.Add(oItem)));
            this.lstSrcReports.Invoke(new Action(() => oItem.EnsureVisible()));

            this.lblStatus.Text = string.Format("Refreshing item '{0}'...", itemReadEvent.FileName);

            this.mLogger.Debug("Refreshing item '{0}' in path '{1}'...", itemReadEvent.FileName, itemReadEvent.Path);

            this.mDebugForm.LogMessage(string.Format("Refreshing item '{0}' in path '{1}'...", itemReadEvent.FileName, itemReadEvent.Path));
        }
 private void OnReportReadEvent(IBundleReader sender, ItemReadEvent e)
 {
     if (e.Success)
         actualReports.Add(e.FileName);
 }
 // Event handlers for ZipBundleReader's On*Read events
 private void OnFolderReadEvent(IBundleReader sender, ItemReadEvent e)
 {
     if (e.Success)
         actualFolders.Add(e.FileName);
 }
 private void OnDataSourceReadEvent(IBundleReader sender, ItemReadEvent e)
 {
     if (e.Success)
         actualDataSources.Add(e.FileName);
 }
        public void TearDown()
        {
            // Tear down the evironment that is on disk after each test
            this.EnvironmentTearDown();

            // Unsubscribe to events after each test
            bundleReader.OnDataSourceRead -= OnDataSourceReadEvent;
            bundleReader.OnFolderRead -= OnFolderReadEvent;
            bundleReader.OnReportRead -= OnReportReadEvent;

            bundleReader = null;
        }
        public ImportZipForm(
            string sourceFileName,
            string destinationRootPath,
            string destinationServerUrl,
            DataSourceEditForm dataSourceEditForm,
            IBundleReader bundleReader,
            IReportServerWriter writer,
            ILoggerFactory loggerFactory,
            IItemImporter <DataSourceItem> dataSourceItemImporter,
            IItemImporter <FolderItem> folderItemImporter,
            IItemImporter <ReportItem> reportItemImporter,
            IFileSystem fileSystem)
        {
            if (string.IsNullOrEmpty(sourceFileName))
            {
                throw new ArgumentException("sourceFileName");
            }

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

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

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

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

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

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

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

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

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

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

            InitializeComponent();

            this.mSourceFileName       = sourceFileName;
            this.mDestinationRootPath  = destinationRootPath;
            this.mDestinationServerUrl = destinationServerUrl;
            this.mDataSourceEditForm   = dataSourceEditForm;
            this.mBundleReader         = bundleReader;
            this.mReportServerWriter   = writer;
            this.mLoggerFactory        = loggerFactory;
            this.mLogger = this.mLoggerFactory.GetCurrentClassLogger();
            this.mDataSourceItemImporter = dataSourceItemImporter;
            this.mFolderItemImporter     = folderItemImporter;
            this.mReportItemImporter     = reportItemImporter;
            this.mFileSystem             = fileSystem;
            this.mSummaryForm            = new SummaryForm();
        }