Esempio n. 1
0
        private ICommand CreateCommandChain(DeploymentItem item)
        {
            var itemContext = CreateContext(item);

            ICommand command;

            if (item.RemoveApplicationFirst)
            {
                var command6 = new UpgradeApplicationCommand(itemContext);
                var command5 = new CreateApplicationCommand(itemContext);
                var command4 = new ApplicationDeploymentCommand(itemContext, command5, command6);
                var command3 = new CreateApplicationTypeCommand(itemContext, command4);
                var command2 = new CopyImageToStoreCommand(itemContext, command3);
                command = new RemoveApplicationTypeCommand(itemContext, command2);
            }
            else
            {
                var command5 = new UpgradeApplicationCommand(itemContext);
                var command4 = new CreateApplicationCommand(itemContext);
                var command3 = new ApplicationDeploymentCommand(itemContext, command4, command5);
                var command2 = new CreateApplicationTypeCommand(itemContext, command3);
                command = new CopyImageToStoreCommand(itemContext, command2);
            }

            return(command);
        }
Esempio n. 2
0
        public CopyImageToStoreCommandTests()
        {
            _imageStoreClient = new Mock <IImageStoreClient>();
            _innerCommand     = new Mock <ICommand>();
            var fabricClient = new Mock <IServiceFabricClient>();

            fabricClient.Setup(c => c.ImageStore).Returns(_imageStoreClient.Object);
            _item = new DeploymentItem
            {
                PackagePath         = @"c:\temp\pkg",
                ApplicationTypeName = "AppType",
                ApplicationId       = "app"
            };
            var context = new CommandContext
            {
                FabricClient          = fabricClient.Object,
                Logger                = Logger.Object,
                CurrentDeploymentItem = _item
            };

            _command = new CopyImageToStoreCommand(context, _innerCommand.Object);
        }