Beispiel #1
0
        /// <summary>
        ///     Create hosted service
        /// </summary>
        /// <param name="hostedServiceName"></param>
        /// <returns></returns>
        public string CreateHostedService(string hostedServiceName = "")
        {
            if (string.IsNullOrEmpty(hostedServiceName))
            {
                hostedServiceName = Dependencies.TestResourcesCollector.GetUniqueHostedServiceName();
            }

            const string affinityGroup = AzureServiceConstants.DefaultAffinityGroup;

            return(CreateHostedService(new HostedServiceCreateParameters
            {
                ServiceName = hostedServiceName,
                Label = Base64EncodingHelper.EncodeToBase64String(AzureServiceConstants.DefaultLabel),
                Description = "",
                AffinityGroup = affinityGroup
            }));
        }
        /// <summary>
        ///     Create storage service
        /// </summary>
        /// <param name="storageServiceName"></param>
        /// <returns></returns>
        public StorageAccount CreateStorageService(string storageServiceName = "")
        {
            if (string.IsNullOrEmpty(storageServiceName))
            {
                // notice that we reuse our default storage service since, usually number of
                // storage services is limited and we can't create them for each test.
                storageServiceName = Dependencies.Subscription.DefaultStorageName;
            }

            return(CreateStorageService(new StorageAccountCreateParameters
            {
                Name = storageServiceName,
                Label = Base64EncodingHelper.EncodeToBase64String(AzureServiceConstants.DefaultLabel),
                Description = "",
                AffinityGroup = AzureServiceConstants.DefaultAffinityGroup,
                GeoReplicationEnabled = false,
            }));
        }
Beispiel #3
0
        internal static void LogObject(this TestEasyLog log, DeploymentGetResponse deployment)
        {
            if (deployment == null)
            {
                return;
            }

            log.Info(string.Format("Name:{0}", deployment.Name));
            log.Info(string.Format("Label:{0}", Base64EncodingHelper.DecodeFromBase64String(deployment.Label)));
            log.Info(string.Format("Url:{0}", deployment.Uri));
            log.Info(string.Format("Status:{0}", deployment.Status));
            log.Info(string.Format("DeploymentSlot:{0}", deployment.DeploymentSlot));
            log.Info(string.Format("PrivateID:{0}", deployment.PrivateId));
            log.Info(string.Format("UpgradeDomainCount:{0}", deployment.UpgradeDomainCount));

            LogObject(log, deployment.Roles);
            LogObject(log, deployment.RoleInstances);
            LogObject(log, deployment.UpgradeStatus);
        }
        /// <summary>
        ///     Create virtual machine
        /// </summary>
        /// <param name="hostedServiceName"></param>
        /// <param name="osVirtualHardDisk"></param>
        /// <param name="configurationSets"></param>
        /// <param name="dataVirtualHardDisks"></param>
        /// <param name="virtualMachineName"></param>
        /// <param name="deploymentName"></param>
        /// <returns></returns>
        public string CreateVirtualMachine(
            string hostedServiceName,
            OSVirtualHardDisk osVirtualHardDisk,
            IList <ConfigurationSet> configurationSets,
            IList <DataVirtualHardDisk> dataVirtualHardDisks = null,
            string virtualMachineName = "",
            string deploymentName     = "")
        {
            if (string.IsNullOrEmpty(deploymentName))
            {
                deploymentName = Dependencies.TestResourcesCollector.GetUniqueDeploymentName();
            }

            if (string.IsNullOrEmpty(virtualMachineName))
            {
                virtualMachineName = Dependencies.TestResourcesCollector.GetUniqueVirtualMachineName();
            }

            var csm = new AzureCloudServiceManager();

            csm.CreateOrUpdateDeployment(hostedServiceName, new DeploymentCreateParameters {
                Name = deploymentName
            });

            var vmDeployment = csm.CreateOrUpdateDeployment(hostedServiceName, new DeploymentCreateParameters {
                Name  = deploymentName,
                Label = Base64EncodingHelper.EncodeToBase64String(AzureServiceConstants.DefaultLabel)
            });

            var vmRole = new Role
            {
                RoleName             = virtualMachineName,
                RoleType             = "PersistentVMRole",
                OSVirtualHardDisk    = osVirtualHardDisk,
                ConfigurationSets    = configurationSets,
                DataVirtualHardDisks = dataVirtualHardDisks
            };

            vmDeployment.Roles.Add(vmRole);

            return(CreateVirtualMachine(hostedServiceName, vmDeployment, virtualMachineName));
        }
Beispiel #5
0
        internal static void LogObject(this TestEasyLog log, HostedServiceProperties hostedServiceProperties)
        {
            if (hostedServiceProperties == null)
            {
                return;
            }

            log.Info(string.Format("HostedService Label:{0}", Base64EncodingHelper.DecodeFromBase64String(hostedServiceProperties.Label)));
            log.Info(string.Format("HostedService Description:{0}", hostedServiceProperties.Description));

            if (!string.IsNullOrEmpty(hostedServiceProperties.AffinityGroup))
            {
                log.Info(string.Format("HostedService AffinityGroupName:{0}", hostedServiceProperties.AffinityGroup));
            }

            if (!string.IsNullOrEmpty(hostedServiceProperties.Location))
            {
                log.Info(string.Format("HostedService Location:{0}", hostedServiceProperties.Location));
            }
        }
Beispiel #6
0
 public void DecodeEmpty( )
 {
     Assert.AreEqual(String.Empty, Base64EncodingHelper.Decode(new byte[0]));
 }
Beispiel #7
0
 public void EncodeDecodeEmpty( )
 {
     Assert.AreEqual(String.Empty, Base64EncodingHelper.Decode(Base64EncodingHelper.Encode(String.Empty)));
 }
Beispiel #8
0
 public void EncodeDecode( )
 {
     Assert.AreEqual("Test String", Base64EncodingHelper.Decode(Base64EncodingHelper.Encode("Test String")));
 }
        protected override Queue <string> InitData()
        {
            Queue <string> results = new Queue <string>( );

            results.Enqueue("+OK");
            results.Enqueue("+OK");
            results.Enqueue("+OK");
            results.Enqueue("+OK");
            results.Enqueue("1 1586\r\n");
            results.Enqueue("2 1584\r\n");
            results.Enqueue(".\r\n");
            results.Enqueue("+OK");
            results.Enqueue("Delivered-To: [email protected]\r\n");
            results.Enqueue("Received: by 10.112.163.194 with SMTP id yk2csp334265lbb;\r\n");
            results.Enqueue("Tue, 13 Nov 2012 07:57:16 -0800 (PST)\r\n");
            results.Enqueue("Received: by 10.68.189.70 with SMTP id gg6mr39046644pbc.97.1352822235497;\r\n");
            results.Enqueue("        Tue, 13 Nov 2012 07:57:15 -0800 (PST)\r\n");
            results.Enqueue("Return-Path: <*****@*****.**>\r\n");
            results.Enqueue("Received: from relay.ihostexchange.net (relay.ihostexchange.net. [66.46.182.55])\r\n");
            results.Enqueue("        by mx.google.com with ESMTPS id oi10si14138527pbb.278.2012.11.13.07.57.13\r\n");
            results.Enqueue("        (version=TLSv1/SSLv3 cipher=OTHER);\r\n");
            results.Enqueue("        Tue, 13 Nov 2012 07:57:15 -0800 (PST)\r\n");
            results.Enqueue("Received-SPF: neutral (google.com: 66.46.182.55 is neither permitted nor denied by domain of [email protected]) client-ip=66.46.182.55;\r\n");
            results.Enqueue("Authentication-Results: mx.google.com; spf=neutral (google.com: 66.46.182.55 is neither permitted nor denied by domain of [email protected]) [email protected]\r\n");
            results.Enqueue("Received: from VMBX107.ihostexchange.net ([192.168.3.7]) by\r\n");
            results.Enqueue(" hub105.ihostexchange.net ([66.46.182.55]) with mapi; Tue, 13 Nov 2012\r\n");
            results.Enqueue(" 10:57:12 -0500\r\n");
            results.Enqueue("From: Rodolfo Finochietti <*****@*****.**>\r\n");
            results.Enqueue("To: \"[email protected]\" <*****@*****.**>\r\n");
            results.Enqueue("Date: Tue, 13 Nov 2012 10:57:04 -0500\r\n");
            results.Enqueue("Subject: Test 1\r\n");
            results.Enqueue("Thread-Topic: Test 1\r\n");
            results.Enqueue("Thread-Index: Ac3Bt4nMDtM3y3FyQ1yd71JVtsSGJQ==\r\n");
            results.Enqueue("Message-ID: <*****@*****.**>\r\n");
            results.Enqueue("Accept-Language: en-US\r\n");
            results.Enqueue("Content-Language: en-US\r\n");
            results.Enqueue("X-MS-Has-Attach:\r\n");
            results.Enqueue("X-MS-TNEF-Correlator:\r\n");
            results.Enqueue("user-agent: Microsoft-MacOutlook/14.2.4.120824\r\n");
            results.Enqueue("acceptlanguage: en-US\r\n");
            results.Enqueue("Content-Type: text/plain; charset=\"us-ascii\"\r\n");
            results.Enqueue("Content-Transfer-Encoding: quoted-printable\r\n");
            results.Enqueue("MIME-Version: 1.0\r\n");
            results.Enqueue("\r\n");
            results.Enqueue("Test One\r\n");
            results.Enqueue("\r\n");
            results.Enqueue(".\r\n");
            results.Enqueue("+OK");
            results.Enqueue("Delivered-To: [email protected]\r\n");
            results.Enqueue("Received: by 10.112.163.194 with SMTP id yk2csp334323lbb;\r\n");
            results.Enqueue("        Tue, 13 Nov 2012 07:57:41 -0800 (PST)\r\n");
            results.Enqueue("Received: by 10.68.213.33 with SMTP id np1mr68271235pbc.64.1352822261234;\r\n");
            results.Enqueue("        Tue, 13 Nov 2012 07:57:41 -0800 (PST)\r\n");
            results.Enqueue("Return-Path: <*****@*****.**>\r\n");
            results.Enqueue("Received: from relay.ihostexchange.net (relay.ihostexchange.net. [66.46.182.53])\r\n");
            results.Enqueue("        by mx.google.com with ESMTPS id h9si14146629pax.184.2012.11.13.07.57.39\r\n");
            results.Enqueue("        (version=TLSv1/SSLv3 cipher=OTHER);\r\n");
            results.Enqueue("        Tue, 13 Nov 2012 07:57:40 -0800 (PST)\r\n");
            results.Enqueue("Received-SPF: neutral (google.com: 66.46.182.53 is neither permitted nor denied by domain of [email protected]) client-ip=66.46.182.53;\r\n");
            results.Enqueue("Authentication-Results: mx.google.com; spf=neutral (google.com: 66.46.182.53 is neither permitted nor denied by domain of [email protected]) [email protected]\r\n");
            results.Enqueue("Received: from VMBX107.ihostexchange.net ([192.168.3.7]) by\r\n");
            results.Enqueue(" HUB103.ihostexchange.net ([66.46.182.53]) with mapi; Tue, 13 Nov 2012\r\n");
            results.Enqueue(" 10:57:35 -0500\r\n");
            results.Enqueue("From: Rodolfo Finochietti <*****@*****.**>\r\n");
            results.Enqueue("To: \"[email protected]\" <*****@*****.**>\r\n");
            results.Enqueue("Date: Tue, 13 Nov 2012 10:57:28 -0500\r\n");
            results.Enqueue("Subject: Test 2\r\n");
            results.Enqueue("Thread-Topic: Test 2\r\n");
            results.Enqueue("Thread-Index: Ac3Bt5g3UdNgEF+cQmmTFVrfHQgqBw==\r\n");
            results.Enqueue("Message-ID: <*****@*****.**>\r\n");
            results.Enqueue("Accept-Language: en-US\r\n");
            results.Enqueue("Content-Language: en-US\r\n");
            results.Enqueue("X-MS-Has-Attach:\r\n");
            results.Enqueue("X-MS-TNEF-Correlator:\r\n");
            results.Enqueue("user-agent: Microsoft-MacOutlook/14.2.4.120824\r\n");
            results.Enqueue("acceptlanguage: en-US\r\n");
            results.Enqueue("Content-Type: text/plain; charset=\"us-ascii\"\r\n");
            results.Enqueue("Content-Transfer-Encoding: base64\r\n");
            results.Enqueue("MIME-Version: 1.0\r\n");
            results.Enqueue("\r\n");
            results.Enqueue(Base64EncodingHelper.Encode("Test Two\r\n"));
            results.Enqueue("\r\n");
            results.Enqueue(".\r\n");

            return(results);
        }