コード例 #1
0
        private static void DeleteApp(FabricDeployment deployment)
        {
            LogHelper.Log("Waiting to dispose prefix enumerators...");
            Thread.Sleep(TimeSpan.FromSeconds(PrefixEnumeratorDisposeDelayInSeconds * 2));

            LogHelper.Log("Deleting app");
            deployment.DeleteApplication(Constants.ApplicationName);
        }
コード例 #2
0
        public static FabricDeployment CreateDeployment(string testcaseName)
        {
            var    parameters     = FabricDeploymentParameters.CreateDefault(Constants.TestDllName, testcaseName, 1);
            string fabricFilePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            // add the host related files into the node folder for each node so that we can start the host
            parameters.AdditionalFilesToDeployToNodeRoot.Add(Path.Combine(fabricFilePath, "System.Fabric.dll"));
            parameters.AdditionalFilesToDeployToNodeRoot.Add(Path.Combine(fabricFilePath, "System.Fabric.Strings.dll"));
            parameters.AdditionalFilesToDeployToNodeRoot.Add(Path.Combine(fabricFilePath, "System.Fabric.Test.Host.exe"));
            parameters.AdditionalFilesToDeployToNodeRoot.Add(Assembly.GetExecutingAssembly().Location);

            var deployment = new FabricDeployment(parameters);

            LogHelper.Log("Starting deployment");
            deployment.Start();

            return(deployment);
        }
コード例 #3
0
        private static FabricDeployment StartApp()
        {
            var nodeCount  = 3;
            var parameters = FabricDeploymentParameters.CreateDefault(
                System.Fabric.Services.Scenarios.Test.Constants.TestDllName,
                "FabricStore",
                nodeCount,
                true);

            LogHelper.Log("Creating deployment");
            var deployment = new FabricDeployment(parameters);

            for (var ix = 1; ix <= nodeCount; ++ix)
            {
                var logDir = Path.Combine(deployment.LogPath, "Node" + ix);

                if (!Directory.Exists(logDir))
                {
                    LogHelper.Log("Creating directory: {0}", logDir);
                    Directory.CreateDirectory(logDir);
                }
            }

            LogHelper.Log("Starting Deployment");
            deployment.Start();

            DateTime startTimeUtc = DateTime.UtcNow;

            LogHelper.Log("Creating, packing and uploading app");
            var dep = CreateDeployer(deployment.TestOutputPath);

            deployment.UploadProvisionAndStartApplication(dep);

            LogHelper.Log("Wait for secondaries");
            if (!deployment.WaitForPartitionToBeStable(Constants.ApplicationName, Constants.ServiceTypeName, startTimeUtc, TimeSpan.FromSeconds(120 * 5), (p) => true))
            {
                LogHelper.Log("Failed waiting for partitions to be assigned");
                Assert.Fail("Failed wait for partitions to be assigned");
            }

            return(deployment);
        }
コード例 #4
0
        public static string SendPostRequest(this FabricDeployment deployment, string requestMessage = "")
        {
            ResolvedServicePartition rsp = null;

            for (int i = 0; i < 5; i++)
            {
                LogHelper.Log("Resolving try {0}", i);
                rsp = deployment.Resolve(Constants.ApplicationName, Constants.ServiceTypeName, null, rsp);
                var ep = rsp.GetEndpoint().Address;
                LogHelper.Log("Endpoint {0}", ep);

                try
                {
                    return(SendRequest(ep, "POST", requestMessage));
                }
                catch (Exception ex)
                {
                    LogHelper.Log("Exception: {0}", ex);
                }
            }

            throw new InvalidOperationException("Failed after count");
        }
コード例 #5
0
        private static int AddTestData(FabricDeployment deployment, int currentItemCount, int itemsToAdd)
        {
            string resp = deployment.SendGetRequest();

            currentItemCount = int.Parse(resp);

            int newCount = currentItemCount;

            for (int i = 0; i < itemsToAdd; i++, newCount++)
            {
                resp = deployment.SendPostRequest(i.ToString(CultureInfo.InvariantCulture));
            }

            Assert.AreEqual(
                newCount.ToString(CultureInfo.InvariantCulture),
                resp,
                string.Format(CultureInfo.CurrentCulture, "Operation count = {0}, response = {1}", newCount, resp));

            resp = deployment.SendGetRequest();
            Assert.AreEqual(newCount.ToString(CultureInfo.InvariantCulture), resp);

            return(newCount);
        }
コード例 #6
0
 public static void Initialize(TestContext context)
 {
     Lync_ActivationDeactivationTest.deployment = LyncScenarioTestHelper.CreateDeployment("Lync_ActivationDeactivation");
 }