Ejemplo n.º 1
0
        public ApplicationDeploymentCommandTests()
        {
            _appClient      = new Mock <IApplicationClient>();
            _createCommand  = new Mock <ICommand>();
            _upgradeCommand = new Mock <ICommand>();
            var fabricClient = new Mock <IServiceFabricClient>();

            fabricClient.Setup(c => c.Applications).Returns(_appClient.Object);
            _item = new DeploymentItem
            {
                PackagePath              = @"c:\temp\pkg",
                ApplicationTypeName      = "AppType",
                ApplicationName          = "fabric:/app",
                ApplicationId            = "app",
                ApplicationTypeVersion   = "1.0.0",
                ApplicationTypeBuildPath = "pkg"
            };
            var context = new CommandContext
            {
                FabricClient          = fabricClient.Object,
                Logger                = Logger.Object,
                CurrentDeploymentItem = _item
            };

            _command = new ApplicationDeploymentCommand(context, _createCommand.Object, _upgradeCommand.Object);
        }
Ejemplo n.º 2
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);
        }