public AvaloniaDesktopAppUpdateServiceImpl(
     IDesktopAppService app,
     IToast toast,
     ICloudServiceClient client,
     IOptions <AppSettings> options) : base(toast, client, options)
 {
     this.app = app;
 }
 public ApplicationUpdateServiceImpl(
     IApplication application,
     INotificationService notification,
     IToast toast,
     ICloudServiceClient client,
     IOptions <AppSettings> options) : base(application, toast, client, options)
 {
     this.notification = notification;
 }
Пример #3
0
 public AvaloniaApplicationUpdateServiceImpl(
     IAvaloniaApplication app,
     IWindowManager windowManager,
     IToast toast,
     ICloudServiceClient client,
     IOptions <AppSettings> options) : base(app, toast, client, options)
 {
     this.app           = app;
     this.windowManager = windowManager;
 }
Пример #4
0
 public AppUpdateServiceImpl(
     IToast toast,
     ICloudServiceClient client,
     IOptions <AppSettings> options)
 {
     this.toast         = toast;
     this.client        = client;
     settings           = options.Value;
     SupportedAbis      = GetSupportedAbis();
     StartUpdateCommand = ReactiveCommand.Create(StartUpdate);
 }
 public ApplicationUpdateServiceBaseImpl(
     IApplication application,
     IToast toast,
     ICloudServiceClient client,
     IOptions <AppSettings> options)
 {
     this.toast         = toast;
     this.client        = client;
     this.application   = application;
     settings           = options.Value;
     StartUpdateCommand = ReactiveCommand.Create(StartUpdate);
 }
Пример #6
0
        public CloudServiceClientTests()
        {
            AzurePowerShell.ProfileDirectory = Test.Utilities.Common.Data.AzureSdkAppDir;

            storageService = new MockStorageService()
                             .Add(a => SetupStorage(serviceName.ToLowerInvariant(), a))
                             .Add(a => SetupStorage(storageName.ToLowerInvariant(), a));

            services = new MockServicesHost()
                       .Add(s =>
            {
                s.Name = serviceName;
                s.AddDeployment(d =>
                {
                    d.Slot = DeploymentSlot.Production;
                    d.Name = "mydeployment";
                });
            });

            subscription = new AzureSubscription
            {
                Properties = new Dictionary <AzureSubscription.Property, string> {
                    { AzureSubscription.Property.Default, "True" }
                },
                Id   = Guid.NewGuid(),
                Name = Test.Utilities.Common.Data.Subscription1,
            };

            cloudBlobUtilityMock = new Mock <CloudBlobUtility>();
            cloudBlobUtilityMock.Setup(f => f.UploadPackageToBlob(
                                           It.IsAny <StorageManagementClient>(),
                                           It.IsAny <string>(),
                                           It.IsAny <string>(),
                                           It.IsAny <BlobRequestOptions>())).Returns(new Uri("http://www.packageurl.azure.com"));

            clientMocks = new ClientMocks(subscription.Id);

            services.InitializeMocks(clientMocks.ComputeManagementClientMock);
            storageService.InitializeMocks(clientMocks.StorageManagementClientMock);

            client = new CloudServiceClient(subscription,
                                            clientMocks.ManagementClientMock.Object,
                                            clientMocks.StorageManagementClientMock.Object,
                                            clientMocks.ComputeManagementClientMock.Object
                                            )
            {
                CloudBlobUtility = cloudBlobUtilityMock.Object
            };
        }
Пример #7
0
        public void TestSetup()
        {
            GlobalPathInfo.GlobalSettingsDirectory = Data.AzureSdkAppDir;

            storageService = new MockStorageService()
                             .Add(a => SetupStorage(serviceName.ToLowerInvariant(), a))
                             .Add(a => SetupStorage(storageName.ToLowerInvariant(), a));

            services = new MockServicesHost()
                       .Add(s =>
            {
                s.Name = serviceName;
                s.AddDeployment(d =>
                {
                    d.Slot = DeploymentSlot.Production;
                    d.Name = "mydeployment";
                });
            });

            subscription = new WindowsAzureSubscription
            {
                Certificate      = It.IsAny <X509Certificate2>(),
                IsDefault        = true,
                ServiceEndpoint  = new Uri("https://www.azure.com"),
                SubscriptionId   = Guid.NewGuid().ToString(),
                SubscriptionName = Data.Subscription1,
            };

            cloudBlobUtilityMock = new Mock <CloudBlobUtility>();
            cloudBlobUtilityMock.Setup(f => f.UploadPackageToBlob(
                                           It.IsAny <StorageManagementClient>(),
                                           It.IsAny <string>(),
                                           It.IsAny <string>(),
                                           It.IsAny <BlobRequestOptions>())).Returns(new Uri("http://www.packageurl.azure.com"));

            clientMocks = new ClientMocks(subscription.SubscriptionId);

            services.InitializeMocks(clientMocks.ComputeManagementClientMock);
            storageService.InitializeMocks(clientMocks.StorageManagementClientMock);

            client = new CloudServiceClient(subscription,
                                            clientMocks.ManagementClientMock.Object,
                                            clientMocks.StorageManagementClientMock.Object,
                                            clientMocks.ComputeManagementClientMock.Object
                                            )
            {
                CloudBlobUtility = cloudBlobUtilityMock.Object
            };
        }
Пример #8
0
 public ScriptManager(
     IScriptRepository scriptRepository,
     IMapper mapper,
     ILoggerFactory loggerFactory,
     IToast toast,
     IHttpService httpService,
     ICloudServiceClient csc)
 {
     this.scriptRepository = scriptRepository;
     this.mapper           = mapper;
     this.toast            = toast;
     this.httpService      = httpService;
     logger   = loggerFactory.CreateLogger <ScriptManager>();
     this.csc = csc;
 }
Пример #9
0
        public void TestSetup()
        {
            GlobalPathInfo.GlobalSettingsDirectory      = Data.AzureSdkAppDir;
            CmdletSubscriptionExtensions.SessionManager = new InMemorySessionManager();

            storageService = new StorageService()
            {
                ServiceName        = storageName,
                StorageServiceKeys = new StorageServiceKeys()
                {
                    Primary   = "MNao3bm7t7B/x+g2/ssh9HnG0mEh1QV5EHpcna8CetYn+TSRoA8/SBoH6B3Ufwtnz3jZLSw9GEUuCTr3VooBWq==",
                    Secondary = "secondaryKey"
                },
                StorageServiceProperties = new StorageServiceProperties()
                {
                    Endpoints = new EndpointList()
                    {
                        "http://awesome.blob.core.windows.net/",
                        "http://awesome.queue.core.windows.net/",
                        "http://awesome.table.core.windows.net/"
                    }
                }
            };

            deployment = new Deployment()
            {
                DeploymentSlot   = DeploymentSlotType.Production,
                Name             = "mydeployment",
                PrivateID        = "privateId",
                Status           = DeploymentStatus.Starting,
                RoleInstanceList = new RoleInstanceList()
                {
                    new RoleInstance()
                    {
                        InstanceStatus = RoleInstanceStatus.ReadyRole,
                        RoleName       = "Role1",
                        InstanceName   = "Instance_Role1"
                    }
                }
            };

            cloudService = new HostedService()
            {
                ServiceName = serviceName,
                Deployments = new DeploymentList()
            };
            subscription = new SubscriptionData()
            {
                Certificate      = It.IsAny <X509Certificate2>(),
                IsDefault        = true,
                ServiceEndpoint  = "https://www.azure.com",
                SubscriptionId   = Guid.NewGuid().ToString(),
                SubscriptionName = Data.Subscription1
            };

            serviceManagementChannelMock = new Mock <IServiceManagement>();
            serviceManagementChannelMock.Setup(f => f.EndGetHostedServiceWithDetails(It.IsAny <IAsyncResult>()))
            .Returns(cloudService);
            serviceManagementChannelMock.Setup(f => f.EndGetStorageService((It.IsAny <IAsyncResult>())))
            .Returns(storageService);
            serviceManagementChannelMock.Setup(f => f.EndGetStorageKeys(It.IsAny <IAsyncResult>()))
            .Returns(storageService);
            serviceManagementChannelMock.Setup(f => f.EndGetDeploymentBySlot(It.IsAny <IAsyncResult>()))
            .Returns(deployment);

            cloudBlobUtilityMock = new Mock <CloudBlobUtility>();
            cloudBlobUtilityMock.Setup(f => f.UploadPackageToBlob(
                                           serviceManagementChannelMock.Object,
                                           It.IsAny <string>(),
                                           It.IsAny <string>(),
                                           It.IsAny <string>(),
                                           It.IsAny <BlobRequestOptions>())).Returns(new Uri("http://www.packageurl.azure.com"));

            client = new CloudServiceClient(subscription)
            {
                ServiceManagementChannel = serviceManagementChannelMock.Object,
                CloudBlobUtility         = cloudBlobUtilityMock.Object
            };
        }
 public DesktopAppUpdateServiceImpl(IToast toast, ICloudServiceClient client, IOptions <AppSettings> options) : base(toast, client, options)
 {
 }
Пример #11
0
 public MockCloudServiceClient(IToast toast, IModelValidator validator, CloudServiceClientBase real)
 {
     this.toast     = toast;
     this.validator = validator;
     this.real      = real;
 }
        public void TestSetup()
        {
            GlobalPathInfo.GlobalSettingsDirectory = Data.AzureSdkAppDir;

            storageService = new MockStorageService()
                .Add(a => SetupStorage(serviceName.ToLowerInvariant(), a))
                .Add(a => SetupStorage(storageName.ToLowerInvariant(), a));

            services = new MockServicesHost()
                .Add(s =>
                {
                    s.Name = serviceName;
                    s.AddDeployment(d =>
                    {
                        d.Slot = DeploymentSlot.Production;
                        d.Name = "mydeployment";
                    });
                });

            subscription = new WindowsAzureSubscription
            {
                Certificate = It.IsAny<X509Certificate2>(),
                IsDefault = true,
                ServiceEndpoint = new Uri("https://www.azure.com"),
                SubscriptionId = Guid.NewGuid().ToString(),
                SubscriptionName = Data.Subscription1,
            };

            cloudBlobUtilityMock = new Mock<CloudBlobUtility>();
            cloudBlobUtilityMock.Setup(f => f.UploadPackageToBlob(
                It.IsAny<StorageManagementClient>(),
                It.IsAny<string>(),
                It.IsAny<string>(),
                It.IsAny<BlobRequestOptions>())).Returns(new Uri("http://www.packageurl.azure.com"));

            clientMocks = new ClientMocks(subscription.SubscriptionId);

            services.InitializeMocks(clientMocks.ComputeManagementClientMock);
            storageService.InitializeMocks(clientMocks.StorageManagementClientMock);

            client = new CloudServiceClient(subscription,
                clientMocks.ManagementClientMock.Object,
                clientMocks.StorageManagementClientMock.Object,
                clientMocks.ComputeManagementClientMock.Object
                )
            {
                CloudBlobUtility = cloudBlobUtilityMock.Object
            };
        }
        public CloudServiceClientTests()
        {
            AzurePowerShell.ProfileDirectory = Test.Utilities.Common.Data.AzureSdkAppDir;

            storageService = new MockStorageService()
                .Add(a => SetupStorage(serviceName.ToLowerInvariant(), a))
                .Add(a => SetupStorage(storageName.ToLowerInvariant(), a));

            services = new MockServicesHost()
                .Add(s =>
                {
                    s.Name = serviceName;
                    s.AddDeployment(d =>
                    {
                        d.Slot = DeploymentSlot.Production;
                        d.Name = "mydeployment";
                    });
                });

            subscription = new AzureSubscription
            {
                Properties = new Dictionary<AzureSubscription.Property,string> {{AzureSubscription.Property.Default, "True"}},
                Id = Guid.NewGuid(),
                Name = Test.Utilities.Common.Data.Subscription1,
            };

            cloudBlobUtilityMock = new Mock<CloudBlobUtility>();
            cloudBlobUtilityMock.Setup(f => f.UploadPackageToBlob(
                It.IsAny<StorageManagementClient>(),
                It.IsAny<string>(),
                It.IsAny<string>(),
                It.IsAny<BlobRequestOptions>())).Returns(new Uri("http://www.packageurl.azure.com"));

            clientMocks = new ClientMocks(subscription.Id);

            services.InitializeMocks(clientMocks.ComputeManagementClientMock);
            storageService.InitializeMocks(clientMocks.StorageManagementClientMock);

            client = new CloudServiceClient(subscription,
                clientMocks.ManagementClientMock.Object,
                clientMocks.StorageManagementClientMock.Object,
                clientMocks.ComputeManagementClientMock.Object
                )
            {
                CloudBlobUtility = cloudBlobUtilityMock.Object
            };
        }
        public void TestSetup()
        {
            GlobalPathInfo.GlobalSettingsDirectory = Data.AzureSdkAppDir;
            CmdletSubscriptionExtensions.SessionManager = new InMemorySessionManager();

            storageService = new StorageService()
            {
                ServiceName = storageName,
                StorageServiceKeys = new StorageServiceKeys()
                {
                    Primary = "MNao3bm7t7B/x+g2/ssh9HnG0mEh1QV5EHpcna8CetYn+TSRoA8/SBoH6B3Ufwtnz3jZLSw9GEUuCTr3VooBWq==",
                    Secondary = "secondaryKey"
                },
                StorageServiceProperties = new StorageServiceProperties()
                {
                    Endpoints = new EndpointList()
                    {
                        "http://awesome.blob.core.windows.net/",
                        "http://awesome.queue.core.windows.net/",
                        "http://awesome.table.core.windows.net/"
                    }
                }
            };

            deployment = new Deployment()
            {
                DeploymentSlot = DeploymentSlotType.Production,
                Name = "mydeployment",
                PrivateID = "privateId",
                Status = DeploymentStatus.Starting,
                RoleInstanceList = new RoleInstanceList()
                {
                    new RoleInstance()
                    {
                        InstanceStatus = RoleInstanceStatus.ReadyRole,
                        RoleName = "Role1",
                        InstanceName = "Instance_Role1"
                    }
                }
            };

            cloudService = new HostedService()
            {
                ServiceName = serviceName,
                Deployments = new DeploymentList()
            };
            subscription = new SubscriptionData()
            {
                Certificate = It.IsAny<X509Certificate2>(),
                IsDefault = true,
                ServiceEndpoint = "https://www.azure.com",
                SubscriptionId = Guid.NewGuid().ToString(),
                SubscriptionName = Data.Subscription1
            };

            serviceManagementChannelMock = new Mock<IServiceManagement>();
            serviceManagementChannelMock.Setup(f => f.EndGetHostedServiceWithDetails(It.IsAny<IAsyncResult>()))
                .Returns(cloudService);
            serviceManagementChannelMock.Setup(f => f.EndGetStorageService((It.IsAny<IAsyncResult>())))
                .Returns(storageService);
            serviceManagementChannelMock.Setup(f => f.EndGetStorageKeys(It.IsAny<IAsyncResult>()))
                .Returns(storageService);
            serviceManagementChannelMock.Setup(f => f.EndGetDeploymentBySlot(It.IsAny<IAsyncResult>()))
                .Returns(deployment);

            cloudBlobUtilityMock = new Mock<CloudBlobUtility>();
            cloudBlobUtilityMock.Setup(f => f.UploadPackageToBlob(
                serviceManagementChannelMock.Object,
                It.IsAny<string>(),
                It.IsAny<string>(),
                It.IsAny<string>(),
                It.IsAny<BlobRequestOptions>())).Returns(new Uri("http://www.packageurl.azure.com"));

            client = new CloudServiceClient(subscription)
            {
                ServiceManagementChannel = serviceManagementChannelMock.Object,
                CloudBlobUtility = cloudBlobUtilityMock.Object
            };
        }