protected async Task UpdatePackages(IEnumerable <PICSPackageInfo> packages)
        {
            var allapps     = packages.SelectMany(x => x.Apps).Distinct().ToList();
            var missingapps = allapps.Where(x => !Apps.ContainsKey(x));

            foreach (var package in packages)
            {
                Packages[package.ID] = package;
            }

            if (!missingapps.Any())
            {
                return;
            }

            await UpdateApps(missingapps);
        }
Exemple #2
0
        public static void MyClassInitialize(TestContext testContext)
        {
            DockerComposeFileName = "docker-compose452AppOn471.yml";
            AppNameBeingTested    = TestConstants.WebAppName;

            if (!Apps.ContainsKey(AppNameBeingTested))
            {
                Apps.Add(AppNameBeingTested, new DeployedApp
                {
                    ikey            = TestConstants.WebAppInstrumentationKey,
                    containerName   = TestConstants.WebAppContainerName,
                    imageName       = TestConstants.WebAppImageName,
                    healthCheckPath = TestConstants.WebAppHealthCheckPath,
                    flushPath       = TestConstants.WebAppFlushPath
                });
            }
            MyClassInitializeBase();
        }
 public static void MyClassInitialize(TestContext testContext)
 {
     DockerComposeFileName = "docker-composeNet20AppOn20.yml";
     VersionPrefix         = "rdddsc";
     VersionPrefixSql      = "rdddsc";
     AppNameBeingTested    = TestConstants.WebAppCore20Name;
     if (!Apps.ContainsKey(AppNameBeingTested))
     {
         Apps.Add(AppNameBeingTested, new DeployedApp
         {
             ikey            = TestConstants.WebAppCore20NameInstrumentationKey,
             containerName   = TestConstants.WebAppCore20ContainerName,
             imageName       = TestConstants.WebAppCore20ImageName,
             healthCheckPath = TestConstants.WebAppCore20HealthCheckPath,
             flushPath       = TestConstants.WebAppCore20FlushPath
         });
     }
     MyClassInitializeBase();
 }
        public static void MyClassInitialize(TestContext testContext)
        {
            DockerComposeFileName = "docker-compose452AppOn462StatusMonitor.yml";
            AppNameBeingTested    = TestConstants.WebAppName;
            VersionPrefix         = "rddp";
            VersionPrefixSql      = "rddp";
            if (!Apps.ContainsKey(AppNameBeingTested))
            {
                Apps.Add(AppNameBeingTested, new DeployedApp
                {
                    ikey            = TestConstants.WebAppInstrumentationKey,
                    containerName   = TestConstants.WebAppContainerName,
                    imageName       = TestConstants.WebAppImageName,
                    healthCheckPath = TestConstants.WebAppHealthCheckPath,
                    flushPath       = TestConstants.WebAppFlushPath
                });
            }

            // Forcefully remove the image to ensure SM gets installed properly.
            DockerUtils.RemoveDockerImage(Apps[AppNameBeingTested].imageName, true);
            DockerUtils.RemoveDockerContainer(Apps[AppNameBeingTested].containerName, true);

            MyClassInitializeBase();
        }
Exemple #5
0
        private void BtnGen_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(txtApp.Text) || string.IsNullOrEmpty(txtUser.Text))
            {
                return;
            }

            try
            {
                btnGen.IsEnabled = false;

                var random = new Random();

                if (!Apps.ContainsKey(txtApp.Text))
                {
                    if (txtApp.Text == "CopyTool")
                    {
                        Apps.Add(txtApp.Text, new KeyByteSet[] {
                            new KeyByteSet(1, 177, 99, 0),
                            new KeyByteSet(2, 186, 153, 17),
                            new KeyByteSet(3, 7, 113, 200),
                            //new KeyByteSet(4, 73, 102, 49),
                            //new KeyByteSet(5, 61, 173, 33),
                        });
                    }
                    else
                    {
                        var newKeySet = new KeyByteSet[KeyLength];
                        for (int j = 0; j < KeyLength; j++)
                        {
                            newKeySet[j] = new KeyByteSet(j + 1, (byte)random.Next(0, 256), (byte)random.Next(0, 256), (byte)random.Next(0, 256));
                        }

                        Apps.Add(txtApp.Text, newKeySet);
                    }
                    AppUserMap.Add(txtApp.Text, new Dictionary <string, int>());
                }

                if (!AppUserMap[txtApp.Text].ContainsKey(txtUser.Text))
                {
                    AppUserMap[txtApp.Text].Add(txtUser.Text, AppUserMap[txtApp.Text].Count);
                }

                var pkvLicenceKey = new PkvLicenceKeyGenerator();

                int seed = AppUserMap[txtApp.Text][txtUser.Text];
                // Generate the key
                string key = pkvLicenceKey.MakeKey(seed, Apps[txtApp.Text]);

                var kbs1 = Apps[txtApp.Text][new Random().Next(0, KeyLength - 1)];
                var kbs2 = Apps[txtApp.Text][new Random().Next(0, KeyLength - 1)];

                // The check project also uses a class called KeyByteSet, but with
                // separate name spacing to achieve single self contained dll

                var keyByteSet1 = new KeyByteSet(kbs1.KeyByteNo, kbs1.KeyByteA, kbs1.KeyByteB, kbs1.KeyByteC); // Change no to test others
                var keyByteSet2 = new KeyByteSet(kbs2.KeyByteNo, kbs2.KeyByteA, kbs2.KeyByteB, kbs2.KeyByteC);

                txtLicense.Text = key;

                var partialKeys = new[] { keyByteSet1, keyByteSet2 };

                CheckKey(key, KeyLength, partialKeys);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Sorry! cannot generate license key!");
            }
            finally
            {
                btnGen.IsEnabled = true;
            }
        }