コード例 #1
0
        public void ThrowsErrorForInvalidCacheVersion()
        {
            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                files.CreateAzureSdkDirectoryAndImportPublishSettings();
                files.CreateNewService("NEW_SERVICE");
                string rootPath      = Path.Combine(files.RootPath, "NEW_SERVICE");
                string packagePath   = Path.Combine(rootPath, Resources.CloudPackageFileName);
                string cacheRoleName = "WorkerRole1";
                AddAzureCacheWorkerRoleCommand addCacheWorkerCmdlet = new AddAzureCacheWorkerRoleCommand()
                {
                    CommandRuntime = mockCommandRuntime
                };
                EnableAzureMemcacheRoleCommand enableCacheCmdlet = new EnableAzureMemcacheRoleCommand()
                {
                    CacheRuntimeVersion = "1.8.0",
                    CommandRuntime      = mockCommandRuntime
                };

                CloudServiceProject service = new CloudServiceProject(rootPath, FileUtilities.GetContentFilePath("Services"));
                service.AddWebRole(Data.NodeWebRoleScaffoldingPath);
                addCacheWorkerCmdlet.AddAzureCacheWorkerRoleProcess(cacheRoleName, 1, rootPath);
                enableCacheCmdlet.EnableAzureMemcacheRoleProcess("WebRole1", cacheRoleName, rootPath);

                Testing.AssertThrows <Exception>(
                    () => cmdlet.ExecuteCmdlet(),
                    string.Format(Resources.CacheMismatchMessage, "WebRole1", "2.3.0"));
            }
        }
コード例 #2
0
        public void SetupTest()
        {
            GlobalPathInfo.GlobalSettingsDirectory = Data.AzureSdkAppDir;
            mockCommandRuntime = new MockCommandRuntime();

            enableCacheCmdlet  = new EnableAzureMemcacheRoleCommand();
            addCacheRoleCmdlet = new AddAzureCacheWorkerRoleCommand();
            addCacheRoleCmdlet.CommandRuntime = mockCommandRuntime;
            enableCacheCmdlet.CommandRuntime  = mockCommandRuntime;
        }
コード例 #3
0
        public void SetupTest()
        {
            GlobalPathInfo.GlobalSettingsDirectory = Data.AzureSdkAppDir;
            mockCommandRuntime = new MockCommandRuntime();

            enableCacheCmdlet = new EnableAzureMemcacheRoleCommand();
            addCacheRoleCmdlet = new AddAzureCacheWorkerRoleCommand();
            addCacheRoleCmdlet.CommandRuntime = mockCommandRuntime;
            enableCacheCmdlet.CommandRuntime = mockCommandRuntime;
        }
コード例 #4
0
        public void SetupTest()
        {
            GlobalPathInfo.GlobalSettingsDirectory      = Data.AzureSdkAppDir;
            CmdletSubscriptionExtensions.SessionManager = new InMemorySessionManager();
            mockCommandRuntime = new MockCommandRuntime();

            enableCacheCmdlet  = new EnableAzureMemcacheRoleCommand();
            addCacheRoleCmdlet = new AddAzureCacheWorkerRoleCommand();
            addCacheRoleCmdlet.CommandRuntime = mockCommandRuntime;
            enableCacheCmdlet.CommandRuntime  = mockCommandRuntime;
        }
コード例 #5
0
        public EnableAzureMemcacheRoleTests()
        {
            AzureTool.IgnoreMissingSDKError  = true;
            AzurePowerShell.ProfileDirectory = Test.Utilities.Common.Data.AzureSdkAppDir;
            mockCommandRuntime = new MockCommandRuntime();

            enableCacheCmdlet  = new EnableAzureMemcacheRoleCommand();
            addCacheRoleCmdlet = new AddAzureCacheWorkerRoleCommand();
            addCacheRoleCmdlet.CommandRuntime = mockCommandRuntime;
            enableCacheCmdlet.CommandRuntime  = mockCommandRuntime;
        }
コード例 #6
0
        public void SetupTest()
        {
            GlobalPathInfo.GlobalSettingsDirectory = Data.AzureSdkAppDir;
            CmdletSubscriptionExtensions.SessionManager = new InMemorySessionManager();
            mockCommandRuntime = new MockCommandRuntime();

            enableCacheCmdlet = new EnableAzureMemcacheRoleCommand();
            addCacheRoleCmdlet = new AddAzureCacheWorkerRoleCommand();
            addCacheRoleCmdlet.CommandRuntime = mockCommandRuntime;
            enableCacheCmdlet.CommandRuntime = mockCommandRuntime;
        }
        public void ThrowsErrorForInvalidCacheVersion()
        {
            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                files.CreateAzureSdkDirectoryAndImportPublishSettings();
                files.CreateNewService("NEW_SERVICE");
                string rootPath = Path.Combine(files.RootPath, "NEW_SERVICE");
                string packagePath = Path.Combine(rootPath, Resources.CloudPackageFileName);
                string cacheRoleName = "WorkerRole1";
                AddAzureCacheWorkerRoleCommand addCacheWorkerCmdlet = new AddAzureCacheWorkerRoleCommand()
                {
                    CommandRuntime = mockCommandRuntime
                };
                EnableAzureMemcacheRoleCommand enableCacheCmdlet = new EnableAzureMemcacheRoleCommand()
                {
                    CacheRuntimeVersion = "1.8.0",
                    CommandRuntime = mockCommandRuntime
                };

                CloudServiceProject service = new CloudServiceProject(rootPath, FileUtilities.GetContentFilePath("Services"));
                service.AddWebRole(Data.NodeWebRoleScaffoldingPath);
                addCacheWorkerCmdlet.AddAzureCacheWorkerRoleProcess(cacheRoleName, 1, rootPath);
                enableCacheCmdlet.EnableAzureMemcacheRoleProcess("WebRole1", cacheRoleName, rootPath);

                Testing.AssertThrows<Exception>(
                    () => cmdlet.ExecuteCmdlet(),
                    string.Format(Resources.CacheMismatchMessage, "WebRole1", "2.4.0"));
            }
        }
コード例 #8
0
 public void SetupTest()
 {
     writer = new FakeWriter();
     cmdlet = new EnableAzureMemcacheRoleCommand();
     cmdlet.Writer = writer;
 }