Exemple #1
0
        public static async Task <IActionResult> manifestToModelJson(
            [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
            ILogger log, ExecutionContext context)
        {
            log.LogInformation("C# HTTP trigger function processed a request.");

            //get data from
            string tenantId       = req.Headers["TenantId"];
            string storageAccount = req.Headers["StorageAccount"];
            string rootFolder     = req.Headers["RootFolder"];
            string localFolder    = req.Headers["ManifestLocation"];
            string manifestName   = req.Headers["ManifestName"];

            AdlsContext adlsContext = new AdlsContext()
            {
                StorageAccount = storageAccount,
                FileSytemName  = rootFolder,
                MSIAuth        = true,
                TenantId       = tenantId
            };

            // Read Manifest metadata
            log.Log(LogLevel.Information, "Reading Manifest metadata");

            ManifestHandler manifestHandler = new ManifestHandler(adlsContext, localFolder);

            bool created = await manifestHandler.manifestToModelJson(adlsContext, manifestName, localFolder);

            return(new OkObjectResult("{\"Status\":" + created + "}"));
        }
        public static async Task <IActionResult> manifestToSynapseView(
            [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
            ILogger log, ExecutionContext context)
        {
            log.LogInformation("C# HTTP trigger function processed a request.");
            //get data from
            string storageAccount = req.Headers["StorageAccount"];
            string rootFolder     = req.Headers["RootFolder"];
            string localFolder    = req.Headers["ManifestLocation"];
            string manifestName   = req.Headers["ManifestName"];

            var  TenantId  = System.Environment.GetEnvironmentVariable("TenantId");
            var  AppId     = System.Environment.GetEnvironmentVariable("AppId");;
            var  AppSecret = System.Environment.GetEnvironmentVariable("AppSecret");
            bool createDS  = System.Convert.ToBoolean(System.Environment.GetEnvironmentVariable("CreateDS"));
            var  SAS       = System.Environment.GetEnvironmentVariable("SAS");
            var  pass      = System.Environment.GetEnvironmentVariable("Password");

            AdlsContext adlsContext = new AdlsContext()
            {
                StorageAccount = storageAccount,
                FileSytemName  = rootFolder,
                TenantId       = TenantId,
                ClientAppId    = AppId,
                ClientSecret   = AppSecret
            };

            var statements = await ManifestHandler.CDMToSQL(adlsContext, storageAccount, rootFolder, localFolder, manifestName, SAS, pass, createDS);


            return(new OkObjectResult(JsonConvert.SerializeObject(statements)));
        }
Exemple #3
0
 public App(
     SfLocator locator,
     SfProjectHandler projectHandler,
     ServiceHashCalculator hasher,
     IHandleClusterConnection fabricRemote,
     VersionHandler versionHandler,
     VersionService versionService,
     Packager packager,
     AppConfig baseConfig,
     DeployScriptCreator scriptCreator,
     ConsoleWriter log,
     ManifestHandler manifestReader,
     VersionMapHandler versionMapHandler,
     Hack hack)
 {
     _locator           = locator;
     _projectHandler    = projectHandler;
     _hasher            = hasher;
     _fabricRemote      = fabricRemote;
     _versionHandler    = versionHandler;
     _versionService    = versionService;
     _packager          = packager;
     _baseConfig        = baseConfig;
     _scriptCreator     = scriptCreator;
     _log               = log;
     _manifestReader    = manifestReader;
     _versionMapHandler = versionMapHandler;
     _hack              = hack;
 }
Exemple #4
0
        public static async Task <IActionResult> manifestToSQLDDL(
            [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
            ILogger log, ExecutionContext context)
        {
            log.LogInformation("C# HTTP trigger function processed a request.");
            //get data from
            string tenantId       = req.Headers["TenantId"];
            string storageAccount = req.Headers["StorageAccount"];
            string rootFolder     = req.Headers["RootFolder"];
            string localFolder    = req.Headers["ManifestLocation"];
            string manifestName   = req.Headers["ManifestName"];
            string dataSourceName = req.Headers["DataSourceName"];
            string DDLType        = req.Headers["DDLType"];

            AdlsContext adlsContext = new AdlsContext()
            {
                StorageAccount = storageAccount,
                FileSytemName  = rootFolder,
                MSIAuth        = true,
                TenantId       = tenantId
            };

            // Read Manifest metadata
            log.Log(LogLevel.Information, "Reading Manifest metadata");
            List <SQLMetadata> metadataList = new List <SQLMetadata>();
            await ManifestHandler.manifestToSQLMetadata(adlsContext, manifestName, localFolder, metadataList);

            // convert metadata to DDL
            log.Log(LogLevel.Information, "Converting metadata to DDL");
            var statementsList = await ManifestHandler.SQLMetadataToDDL(metadataList, DDLType, dataSourceName);

            return(new OkObjectResult(JsonConvert.SerializeObject(statementsList)));
        }
        /// <summary>
        /// Downloads the launchpad manifest.
        /// </summary>
        private void DownloadLaunchpadManifest()
        {
            try
            {
                string RemoteURL    = manifestHandler.GetLaunchpadManifestURL();
                string LocalPath    = ManifestHandler.GetLaunchpadManifestPath();
                string OldLocalPath = ManifestHandler.GetOldLaunchpadManifestPath();

                if (File.Exists(LocalPath))
                {
                    // Create a backup of the old manifest so that we can compare them when updating the game
                    if (File.Exists(OldLocalPath))
                    {
                        File.Delete(OldLocalPath);
                    }

                    File.Move(LocalPath, OldLocalPath);
                }

                DownloadRemoteFile(RemoteURL, LocalPath);
            }
            catch (IOException ioex)
            {
                Console.WriteLine("IOException in DownloadLaunchpadManifest(): " + ioex.Message);
            }
        }
        /// <summary>
        /// Gets the checksum of the manifest for the specified module.
        /// </summary>
        /// <exception cref="ArgumentOutOfRangeException">
        /// Will be thrown if the <see cref="EModule"/> passed to the function is not a valid value.
        /// </exception>
        protected virtual string GetRemoteModuleManifestChecksum(EModule module)
        {
            string checksum;

            switch (module)
            {
            case EModule.Launcher:
            {
                checksum = ReadRemoteFile(ManifestHandler.GetLaunchpadManifestChecksumURL());
                break;
            }

            case EModule.Game:
            {
                checksum = ReadRemoteFile(FileManifestHandler.GetGameManifestChecksumURL());
                break;
            }

            default:
            {
                throw new ArgumentOutOfRangeException(nameof(module), module,
                                                      "An invalid module value was passed to GetRemoteModuleManifestChecksum.");
            }
            }

            return(checksum.RemoveLineSeparatorsAndNulls());
        }
Exemple #7
0
        static void Main(string[] args)
        {
            //get data from
            string storageAccount = ConfigurationManager.AppSettings["StorageAccount"];
            string rootFolder     = ConfigurationManager.AppSettings["RootFolder"];
            string localFolder    = ConfigurationManager.AppSettings["ManifestLocation"];
            string manifestName   = ConfigurationManager.AppSettings["ManifestName"];
            var    TenantId       = ConfigurationManager.AppSettings["TenantId"];
            var    AppId          = ConfigurationManager.AppSettings["AppId"];
            var    AppSecret      = ConfigurationManager.AppSettings["AppSecret"];
            bool   createDS       = System.Convert.ToBoolean(ConfigurationManager.AppSettings["CreateDS"]);
            var    SAS            = ConfigurationManager.AppSettings["SAS"];
            var    pass           = ConfigurationManager.AppSettings["Password"];

            AdlsContext adlsContext = new AdlsContext()
            {
                StorageAccount = storageAccount,
                FileSytemName  = rootFolder,
                TenantId       = TenantId,
                ClientAppId    = AppId,
                ClientSecret   = AppSecret
            };

            var statements = ManifestHandler.CDMToSQL(adlsContext, storageAccount, rootFolder, localFolder, manifestName, SAS, pass, createDS);


            Console.WriteLine(JsonConvert.SerializeObject(statements));
        }
        public static async Task <IActionResult> excecute(
            [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req,
            ILogger log, ExecutionContext context)
        {
            log.LogInformation("C# HTTP trigger function processed a request.");
            //get data from
            string storageAccount   = req.Headers["StorageAccount"];
            string rootFolder       = req.Headers["RootFolder"];
            string localFolder      = req.Headers["LocalFolder"];
            string resolveReference = req.Headers["ResolveReference"];

            string     requestBody = await new StreamReader(req.Body).ReadToEndAsync();
            EntityList entityList  = JsonConvert.DeserializeObject <EntityList>(requestBody);

            var         TenantId    = System.Environment.GetEnvironmentVariable("TenantId");
            var         AppId       = System.Environment.GetEnvironmentVariable("AppId");;
            var         AppSecret   = System.Environment.GetEnvironmentVariable("AppSecret");
            AdlsContext adlsContext = new AdlsContext()
            {
                StorageAccount = storageAccount,
                FileSytemName  = rootFolder,
                TenantId       = TenantId,
                ClientAppId    = AppId,
                ClientSecret   = AppSecret
            };
            ManifestHandler manifestHandler = new ManifestHandler(adlsContext, localFolder);

            bool resolveRef = false;

            if (resolveReference.Equals("true", StringComparison.OrdinalIgnoreCase))
            {
                resolveRef = true;
            }

            bool ManifestCreated = await manifestHandler.createManifest(entityList, resolveRef);

            //Folder structure Tables/AccountReceivable/Group
            var    subFolders      = localFolder.Split('/');
            string localFolderPath = "";

            for (int i = 0; i < subFolders.Length - 1; i++)
            {
                var currentFolder = subFolders[i];
                var nextFolder    = subFolders[i + 1];
                localFolderPath = $"{localFolderPath}/{currentFolder}";

                ManifestHandler SubManifestHandler = new ManifestHandler(adlsContext, localFolderPath);
                await SubManifestHandler.createSubManifest(currentFolder, nextFolder);
            }

            var status = new ManifestStatus()
            {
                ManifestName = entityList.manifestName, IsManifestCreated = ManifestCreated
            };

            return(new OkObjectResult(JsonConvert.SerializeObject(status)));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ManifestBasedProtocolHandler"/> class.
 /// </summary>
 protected ManifestBasedProtocolHandler()
 {
     this.FileManifestHandler = new ManifestHandler
                                (
         DirectoryHelpers.GetLocalLauncherDirectory(),
         this.Configuration.RemoteAddress,
         this.Configuration.SystemTarget
                                );
 }
 /// <summary>
 /// Creates a new instance of the <see cref="ManifestBasedProtocolHandler"/> class.
 /// </summary>
 protected ManifestBasedProtocolHandler()
 {
     this.FileManifestHandler = new ManifestHandler
                                (
         ConfigHandler.GetLocalDir(),
         new Url(this.Config.GetBaseProtocolURL()),
         this.Config.GetSystemTarget()
                                );
 }
        public void SampleManifestExecutesSuccessfully()
        {
            string path = @"F:\Projects\jinxbot\trunk\development\JinxBot.UpdateManager.Components\SampleManifest.xml";
            string xml = File.ReadAllText(path);

            ManifestHandler handler = new ManifestHandler(xml);

            Assert.AreEqual(TaskStatus.Success, handler.ExecuteManifest());
        }
Exemple #12
0
        public void SampleManifestExecutesSuccessfully()
        {
            string path = @"F:\Projects\jinxbot\trunk\development\JinxBot.UpdateManager.Components\SampleManifest.xml";
            string xml  = File.ReadAllText(path);

            ManifestHandler handler = new ManifestHandler(xml);

            Assert.AreEqual(TaskStatus.Success, handler.ExecuteManifest());
        }
Exemple #13
0
        public void TestLoadManifestUnixStyle()
        {
            IReadOnlyList <ManifestEntry> loadedEntries;

            using (MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(SampleManifestUnixStyle)))
            {
                loadedEntries = ManifestHandler.LoadManifest(ms);
            }

            Assert.That(loadedEntries, Is.EquivalentTo(SampleManifestEntries));
        }
        /// <summary>
        /// Downloads the manifest for the specified module, and backs up the old copy of the manifest.
        /// </summary>
        /// <exception cref="ArgumentOutOfRangeException">
        /// Will be thrown if the <see cref="EModule"/> passed to the function is not a valid value.
        /// </exception>
        protected virtual void DownloadModuleManifest(EModule module)
        {
            string remoteURL;
            string localPath;
            string oldLocalPath;

            switch (module)
            {
            case EModule.Launcher:
            {
                remoteURL    = ManifestHandler.GetLaunchpadManifestURL();
                localPath    = ManifestHandler.GetLaunchpadManifestPath();
                oldLocalPath = ManifestHandler.GetOldLaunchpadManifestPath();

                break;
            }

            case EModule.Game:
            {
                remoteURL    = FileManifestHandler.GetGameManifestURL();
                localPath    = ManifestHandler.GetGameManifestPath();
                oldLocalPath = ManifestHandler.GetOldGameManifestPath();

                break;
            }

            default:
            {
                throw new ArgumentOutOfRangeException(nameof(module), module,
                                                      "An invalid module value was passed to DownloadModuleManifest");
            }
            }

            try
            {
                // Delete the old backup (if there is one)
                if (File.Exists(oldLocalPath))
                {
                    File.Delete(oldLocalPath);
                }

                // Create a backup of the old manifest so that we can compare them when updating the game
                File.Move(localPath, oldLocalPath);
            }
            catch (IOException ioex)
            {
                Log.Warn("Failed to back up the old launcher manifest (IOException): " + ioex.Message);
            }

            DownloadRemoteFile(remoteURL, localPath);
        }
Exemple #15
0
        public void Build()
        {
            WSPBuilderHandler wspBuilder = new WSPBuilderHandler(PROJECTNAME);

            wspBuilder.Build();

            string filename = wspBuilder.ProjectPath + @"\manifest.xml";

            Assert.IsTrue(File.Exists(filename));
            ManifestHandler manifestHandler = new ManifestHandler(filename);

            Assert.IsNotNull(manifestHandler.Manifest.Assemblies);
            Assert.IsNotNull(manifestHandler.Manifest.Assemblies[0].SafeControls);
        }
Exemple #16
0
        protected void OnGenerateLaunchpadManifestButtonClicked(object sender, EventArgs e)
        {
            generateGameManifestButton.Sensitive      = false;
            generateLaunchpadManifestButton.Sensitive = false;

            string TargetDirectory = fileChooser.Filename;

            ManifestHandler Manifest = new ManifestHandler();

            Manifest.ManifestGenerationProgressChanged += OnGenerateManifestProgressChanged;
            Manifest.ManifestGenerationFinished        += OnGenerateManifestFinished;

            Manifest.GenerateManifest(TargetDirectory, EManifestType.Launchpad);
        }
 /// <summary>
 /// Refreshs the local copy of the launchpad manifest.
 /// </summary>
 private void RefreshLaunchpadManifest()
 {
     if (File.Exists(ManifestHandler.GetLaunchpadManifestPath()))
     {
         if (IsLaunchpadManifestOutdated())
         {
             DownloadLaunchpadManifest();
         }
     }
     else
     {
         DownloadLaunchpadManifest();
     }
 }
        private void TestBuild(string subFolder, string manifestPath)
        {
            WSPBuilderHandler wspBuilder = new WSPBuilderHandler(PROJECTNAME);

            wspBuilder.ProjectPath = TestInvironment.ProjectsPath + @"\" + PROJECTNAME + subFolder;
            wspBuilder.Build();

            Assert.IsTrue(File.Exists(manifestPath));
            ManifestHandler manifestHandler = new ManifestHandler(manifestPath);

            Assert.IsNotNull(manifestHandler.Manifest.Assemblies);
            Assert.IsNotNull(manifestHandler.Manifest.Assemblies[0].SafeControls);
            Assert.IsTrue(manifestHandler.Manifest.Assemblies[0].Location.Equals("WSPDemo.dll", StringComparison.InvariantCultureIgnoreCase));
        }
Exemple #19
0
        public static async Task <IActionResult> getManifestDefinition(
            [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
            ILogger log, ExecutionContext context)
        {
            log.LogInformation("getManifestDefinition request started");

            string tableList = req.Headers["TableList"];

            var path = System.IO.Path.Combine(context.FunctionDirectory, "..\\Manifest\\Artifacts.json");

            var mds = await ManifestHandler.getManifestDefinition(path, tableList);

            return(new OkObjectResult(JsonConvert.SerializeObject(mds)));
        }
 /// <summary>
 /// Refreshs the local copy of the launchpad manifest.
 /// </summary>
 private void RefreshGameManifest()
 {
     if (File.Exists(ManifestHandler.GetGameManifestPath()))
     {
         if (IsGameManifestOutdated())
         {
             DownloadGameManifest();
         }
     }
     else
     {
         DownloadGameManifest();
     }
 }
Exemple #21
0
        public void DefaultSetup()
        {
            WSPBuilderHandler wspBuilder = new WSPBuilderHandler(PROJECTNAME);

            wspBuilder.Build();

            string filename = wspBuilder.ProjectPath + @"\manifest.xml";

            Assert.IsTrue(File.Exists(filename));
            ManifestHandler manifestHandler = new ManifestHandler(filename);

            Assert.IsNotNull(manifestHandler.Manifest.Assemblies);
            Assert.IsNotNull(manifestHandler.Manifest.Assemblies[0].SafeControls);
            Assert.IsNotNull(manifestHandler.Manifest.CodeAccessSecurity);
            Assert.IsNotNull(manifestHandler.Manifest.CodeAccessSecurity[0].PermissionSet);
            Assert.IsNotNull(manifestHandler.Manifest.CodeAccessSecurity[0].PermissionSet.IPermission);
        }
        public void Build()
        {
            // Setup
            WSPBuilderHandler wspBuilder = new WSPBuilderHandler(PROJECTNAME);

            // Run
            wspBuilder.Build();

            // Test
            string filename = wspBuilder.ProjectPath + @"\manifest.xml";

            Assert.IsTrue(File.Exists(filename));
            ManifestHandler manifestHandler = new ManifestHandler(filename);

            Assert.AreEqual("TitleTest", manifestHandler.Manifest.Title);
            Assert.AreEqual("DescriptionTest", manifestHandler.Manifest.Description);
            Assert.AreEqual("Dummy, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9f4da00116c38ec5", manifestHandler.Manifest.ReceiverAssembly);
            Assert.AreEqual("Keutmann.Demo.Dummy.DummyControl", manifestHandler.Manifest.ReceiverClass);
            Assert.AreEqual(ResetWebServerModeOnUpgradeAttr.Recycle, manifestHandler.Manifest.ResetWebServerModeOnUpgrade);

            Assert.IsNotNull(manifestHandler.Manifest.Assemblies);
            Assert.AreEqual(manifestHandler.Manifest.Assemblies.Length, 1);
            Assert.IsNotNull(manifestHandler.Manifest.Assemblies[0].BindingRedirects);
            Assert.AreEqual(manifestHandler.Manifest.Assemblies[0].BindingRedirects.Length, 3);

            //int countWPResources = 0;
            //int countGlobalResouces = 0;
            //ApplicationResourceFileDefinitions defs = manifestHandler.Manifest.ApplicationResourceFiles;
            //foreach (object item in defs.Items)
            //{
            //    if (item is App_GlobalResourceFileDefinition)
            //    {
            //        App_GlobalResourceFileDefinition globalItem = item as App_GlobalResourceFileDefinition;
            //        countGlobalResouces++;
            //    }
            //    else
            //    {
            //        ApplicationResourceFileDefinition appResourceFileDef = item as ApplicationResourceFileDefinition;
            //        countWPResources++;
            //    }
            //}

            //Assert.AreEqual(countGlobalResouces, 3);
            //Assert.AreEqual(countWPResources, 1);
        }
Exemple #23
0
        private static void Main(string[] args)
        {
            CLIOptions options = new CLIOptions();

            if (CommandLine.Parser.Default.ParseArguments(args, options))
            {
                if (options.RunBatchProcessing)
                {
                    if (string.IsNullOrEmpty(options.TargetDirectory) || options.ManifestType == EManifestType.Unknown)
                    {
                        Console.Write(options.GetUsage());
                    }

                    // At this point, the options should be valid. Run batch processing.
                    if (Directory.Exists(options.TargetDirectory))
                    {
                        Log.Info("Generating manifest...");

                        ManifestHandler manifestHandler = new ManifestHandler();

                        manifestHandler.ManifestGenerationProgressChanged += OnProgressChanged;
                        manifestHandler.ManifestGenerationFinished        += OnGenerationFinished;

                        manifestHandler.GenerateManifest(options.TargetDirectory, options.ManifestType);
                    }
                    else
                    {
                        Log.Error("The selected directory did not exist.");
                    }
                }
                else if (string.IsNullOrEmpty(options.TargetDirectory) && options.ManifestType == EManifestType.Unknown)
                {
                    // Run a GTK UI instead of batch processing
                    Gtk.Application.Init();

                    MainWindow win = new MainWindow();
                    win.Show();
                    Gtk.Application.Run();
                }
                else
                {
                    Console.Write(options.GetUsage());
                }
            }
        }
        /// <summary>
        /// Determines whether the launchpad manifest is outdated.
        /// </summary>
        /// <returns><c>true</c> if the manifest is outdated; otherwise, <c>false</c>.</returns>
        private bool IsLaunchpadManifestOutdated()
        {
            if (File.Exists(ManifestHandler.GetLaunchpadManifestPath()))
            {
                string remoteHash = GetRemoteLaunchpadManifestChecksum();

                using (Stream file = File.OpenRead(ManifestHandler.GetLaunchpadManifestPath()))
                {
                    string localHash = MD5Handler.GetStreamHash(file);

                    return(remoteHash != localHash);
                }
            }
            else
            {
                return(true);
            }
        }
Exemple #25
0
        public void Build()
        {
            WSPBuilderHandler wspBuilder = new WSPBuilderHandler(PROJECTNAME);

            wspBuilder.ProjectPath = TestInvironment.ProjectsPath + @"\" + PROJECTNAME;
            //wspBuilder.Arguments = "";
            wspBuilder.Build();

            string filename = wspBuilder.ProjectPath + @"\manifest.xml";

            Assert.IsTrue(File.Exists(filename));

            ManifestHandler manifestHandler = new ManifestHandler(filename);

            Assert.IsNotNull(manifestHandler.Manifest.Assemblies);
            Assert.IsTrue(manifestHandler.Manifest.Assemblies.Length == 1, "There should only be one assembly reference in the manifest.xml file!");
            Assert.IsTrue(manifestHandler.Manifest.Assemblies[0].Location.Equals("Unmanaged.Dll", StringComparison.InvariantCultureIgnoreCase));
        }
Exemple #26
0
        public void BuildWithArguments()
        {
            WSPBuilderHandler wspBuilder = new WSPBuilderHandler(PROJECTNAME);

            wspBuilder.Arguments  += @" -BuildSolution true -GACPath Project1\GAC -12Path Project2\12 -80Path Project1\80 -BinPath Project1\80\bin";
            wspBuilder.ProjectPath = TestInvironment.ProjectsPath + @"\" + PROJECTNAME;
            wspBuilder.Build();

            string filename = wspBuilder.ProjectPath + @"\manifest.xml";

            Assert.IsTrue(File.Exists(filename));


            ManifestHandler manifestHandler = new ManifestHandler(filename);

            AssemblyFileReference[] assemblies = manifestHandler.Manifest.Assemblies;
            Assert.IsNotNull(assemblies);
            Assert.IsTrue(DoMultiAssemblyExists(assemblies, @"Dummy.DLL") == 1, "There can not be more than one assembly in the same folder!");
        }
Exemple #27
0
 public ServiceHashCalculator(
     ConsoleWriter log,
     PackageConfig packageConfig,
     IHandleFiles fileHandler,
     ManifestHandler manifestHandler,
     ManifestLoader <ApplicationManifest> appManifestLoader,
     ManifestLoader <ServiceManifest> serviceManifestLoader,
     HandleEnciphermentCert handleEnciphermentCert,
     HandleEndpointCert handleEndpointCert)
 {
     _log                    = log;
     _packageConfig          = packageConfig;
     _fileHandler            = fileHandler;
     _manifestHandler        = manifestHandler;
     _appManifestLoader      = appManifestLoader;
     _serviceManifestLoader  = serviceManifestLoader;
     _handleEnciphermentCert = handleEnciphermentCert;
     _handleEndpointCert     = handleEndpointCert;
 }
Exemple #28
0
        public void BuildExpandTrue()
        {
            WSPBuilderHandler wspBuilder = new WSPBuilderHandler(PROJECTNAME);

            wspBuilder.Arguments  += " -ExpandTypes true";
            wspBuilder.ProjectPath = TestInvironment.ProjectsPath + @"\" + PROJECTNAME;
            wspBuilder.Build();

            string filename = wspBuilder.ProjectPath + @"\manifest.xml";

            Assert.IsTrue(File.Exists(filename));
            Assert.IsTrue(TestUtil.FileSize(filename) > 1000, "Manifest.xml is too small, please check!");

            ManifestHandler manifestHandler = new ManifestHandler(filename);

            Assert.IsNotNull(manifestHandler.Manifest.Assemblies);
            Assert.IsNotNull(manifestHandler.Manifest.Assemblies[0].SafeControls);
            Assert.IsNotNull(manifestHandler.Manifest.Assemblies[0].SafeControls.Length >= 9);
        }
Exemple #29
0
        public void BuildSimple()
        {
            WSPBuilderHandler wspBuilder = new WSPBuilderHandler(PROJECTNAME);

            wspBuilder.Arguments   = @" -BuildSolution true -cleanup false -buildddf true";
            wspBuilder.ProjectPath = TestInvironment.ProjectsPath + @"\" + PROJECTNAME;
            wspBuilder.Build();

            string filename = wspBuilder.ProjectPath + @"\manifest.xml";

            Assert.IsTrue(File.Exists(filename));


            ManifestHandler manifestHandler = new ManifestHandler(filename);

            AssemblyFileReference[] assemblies = manifestHandler.Manifest.Assemblies;
            Assert.IsNotNull(assemblies);
            Assert.IsTrue(DoMultiAssemblyExists(assemblies, @"Dummy.DLL") == 1, "There can not be more than one assembly in the same folder!");
        }
        static void Main(string[] args)
        {
            //get data from
            string tenantId       = "979fd422-22c4-4a36-bea6-1cf87b6502dd";
            string storageAccount = "ftanalyticsd365fo.dfs.core.windows.net";
            string rootFolder     = "/dynamics365-financeandoperations/analytics.sandbox.operations.dynamics.com/";
            string localFolder    = "Tables/Finance/Ledger/Main";
            string manifestName   = "Main";

            var    connectionString = "Server=ftsasynapseworkspace-ondemand.sql.azuresynapse.net;Database=AnalyticsAXDB";
            string dataSourceName   = "sqlOnDemandDS";


            AdlsContext adlsContext = new AdlsContext()
            {
                StorageAccount = storageAccount,
                FileSytemName  = rootFolder,
                MSIAuth        = true,
                TenantId       = tenantId
            };

            // Read Manifest metadata
            Console.WriteLine("Reading Manifest metadata");
            List <SQLMetadata> metadataList = new List <SQLMetadata>();

            ManifestHandler.manifestToSQLMetadata(adlsContext, manifestName, localFolder, metadataList);

            // convert metadata to DDL
            Console.WriteLine("Converting metadata to DDL");
            var statementsList = ManifestHandler.SQLMetadataToDDL(metadataList, "SynapseView", dataSourceName);

            // Execute DDL
            Console.WriteLine("Executing DDL");
            SQLHandler sQLHandler = new SQLHandler(connectionString, tenantId);
            var        statements = new SQLStatements {
                Statements = statementsList.Result
            };

            sQLHandler.executeStatements(statements);

            Console.WriteLine(JsonConvert.SerializeObject(statements));
        }
Exemple #31
0
        public void Build()
        {
            // Setup
            WSPBuilderHandler wspBuilder = new WSPBuilderHandler(PROJECTNAME);

            // Run
            wspBuilder.Build();

            // Test
            string filename = wspBuilder.ProjectPath + @"\manifest.xml";

            Assert.IsTrue(File.Exists(filename));
            ManifestHandler manifestHandler = new ManifestHandler(filename);


            Assert.IsNotNull(manifestHandler.Manifest.ApplicationResourceFiles);
            Assert.IsNotNull(manifestHandler.Manifest.ApplicationResourceFiles.Items);
            Assert.AreEqual(manifestHandler.Manifest.ApplicationResourceFiles.Items.Length, 4);

            int countWPResources    = 0;
            int countGlobalResouces = 0;
            ApplicationResourceFileDefinitions defs = manifestHandler.Manifest.ApplicationResourceFiles;

            foreach (object item in defs.Items)
            {
                if (item is App_GlobalResourceFileDefinition)
                {
                    App_GlobalResourceFileDefinition globalItem = item as App_GlobalResourceFileDefinition;
                    countGlobalResouces++;
                }
                else
                {
                    ApplicationResourceFileDefinition appResourceFileDef = item as ApplicationResourceFileDefinition;
                    countWPResources++;
                }
            }

            Assert.AreEqual(countGlobalResouces, 3);
            Assert.AreEqual(countWPResources, 1);
        }