Example #1
0
        public override bool IsValid(Notification notification)
        {
            var valid = true;

            if (string.IsNullOrWhiteSpace(SourcePath))
            {
                notification.AddError(new SemanticValidationError(string.Format("Source path is missing for provider <{0}>.", GetType().Name), ValidationErrorType.NoSourcePathForProvider));
                valid = false;
            }

            if (string.IsNullOrWhiteSpace(DestinationPath))
            {
                notification.AddError(new SemanticValidationError(string.Format("Destination path is missing for provider <{0}>.", GetType().Name), ValidationErrorType.NoDestinationPathForProvider));
                valid = false;
            }
            return valid;
        }
 public bool IsValid(Notification notification)
 {
     return _provider.IsValid(notification);
 }
Example #3
0
 public override bool IsValid(Notification notification)
 {
     return !string.IsNullOrWhiteSpace(DestinationPath) && !string.IsNullOrWhiteSpace(User) && !string.IsNullOrWhiteSpace(Permissions.ToString());
 }
        private void Execute(Assembly assembly, ConDepConfig envConfig, ConDepOptions options, IReportStatus status)
        {
            if (assembly == null) { throw new ArgumentException("assembly"); }
            if (envConfig == null) { throw new ArgumentException("envSettings"); }
            if (options == null) { throw new ArgumentException("options"); }
            if (status == null) { throw new ArgumentException("status"); }

            var applications = CreateApplicationArtifacts(options, assembly);

            if(!options.WebDeployExist)
            {
                var serverValidator = new RemoteServerValidator(envConfig.Servers);
                if (!serverValidator.IsValid())
                {
                    Logger.Error("Not all servers fulfill ConDep's requirements. Aborting execution.");
                    return;
                }
            }

            var webDeploy = new WebDeployHandler();
            var lbLookup = new LoadBalancerLookup(envConfig.LoadBalancer);

            var sequenceManager = new ExecutionSequenceManager(lbLookup.GetLoadBalancer());

            var notification = new Notification();
            var postOpSeq = new PostOpsSequence();

            foreach (var application in applications)
            {
                var infrastructureSequence = new InfrastructureSequence();
                var preOpsSequence = new PreOpsSequence(webDeploy);
                if (!options.DeployOnly)
                {
                    var infrastructureBuilder = new InfrastructureBuilder(infrastructureSequence, webDeploy);
                    Configure.InfrastructureOperations = infrastructureBuilder;

                    if (HasInfrastructureDefined(application))
                    {
                        var infrastructureInstance = GetInfrastructureArtifactForApplication(assembly, application);
                        if (!infrastructureSequence.IsValid(notification))
                        {
                            notification.Throw();
                        }
                        infrastructureInstance.Configure(infrastructureBuilder, envConfig);
                    }
                }

                var local = new LocalOperationsBuilder(sequenceManager.NewLocalSequence(application.GetType().Name), infrastructureSequence, preOpsSequence, envConfig.Servers, webDeploy);
                Configure.LocalOperations = local;

                application.Configure(local, envConfig);
            }

            if (!sequenceManager.IsValid(notification))
            {
                notification.Throw();
            }

            sequenceManager.Execute(status, envConfig, options);
            postOpSeq.Execute(status, options);
        }
 public override bool IsValid(Notification notification)
 {
     //todo: add validation
     return true;
 }
 public override bool IsValid(Notification notification)
 {
     return File.Exists(_certFile);
 }
        private void Execute(Assembly assembly, ConDepConfig envConfig, ConDepOptions options, IReportStatus status)
        {
            if (assembly == null) { throw new ArgumentException("assembly"); }
            if (envConfig == null) { throw new ArgumentException("envSettings"); }
            if (options == null) { throw new ArgumentException("options"); }
            if (status == null) { throw new ArgumentException("status"); }

            var applications = new List<ApplicationArtifact>();
            if(options.HasContext())
            {
                var type = assembly.GetTypes().Where(t => typeof(ApplicationArtifact).IsAssignableFrom(t) && t.Name == options.Context).Single();
                if (type == null)
                {
                    throw new ConDepConfigurationTypeNotFoundException(string.Format("A class inheriting from [{0}] must be present in assembly [{1}] for ConDep to work.", typeof(ApplicationArtifact).FullName, assembly.FullName));
                }

                var application = assembly.CreateInstance(type.FullName) as ApplicationArtifact;
                if (application == null) throw new NullReferenceException(string.Format("Instance of application class [{0}] in assembly [{1}] is not found.", type.FullName, assembly.FullName));
                applications.Add(application);
            }
            else
            {
                var types = assembly.GetTypes().Where(t => typeof(ApplicationArtifact).IsAssignableFrom(t));
                foreach(var type in types)
                {
                    var application = assembly.CreateInstance(type.FullName) as ApplicationArtifact;
                    if (application == null) throw new NullReferenceException(string.Format("Instance of application class [{0}] in assembly [{1}] is not found.", type.FullName, assembly.FullName));
                    applications.Add(application);
                }
            }

            IoCBootstrapper.Bootstrap(envConfig);

            var webDeploy = new WebDeployHandler();
            var sequenceManager = new ExecutionSequenceManager();

            var notification = new Notification();
            foreach (var application in applications)
            {
                var infrastructureSequence = new InfrastructureSequence();
                if (!options.DeployOnly)
                {
                    var infrastructureBuilder = new InfrastructureBuilder(infrastructureSequence, webDeploy);

                    if (HasInfrastructureDefined(application))
                    {
                        var infrastructureInstance = GetInfrastructureArtifactForApplication(assembly, application);
                        if (!infrastructureSequence.IsvValid(notification))
                        {
                            notification.Throw();
                        }
                        infrastructureInstance.Configure(infrastructureBuilder, envConfig);
                    }
                }

                var local = new LocalOperationsBuilder(sequenceManager.NewLocalSequence(application.GetType().Name), infrastructureSequence, envConfig.Servers, webDeploy);

                if(!options.InfraOnly)
                {
                    application.Configure(local, envConfig);
                }
            }

            if (!sequenceManager.IsValid(notification))
            {
                notification.Throw();
            }

            sequenceManager.Execute(status, envConfig, options);
        }
Example #8
0
 public override bool IsValid(Notification notification)
 {
     return !string.IsNullOrWhiteSpace(_webSiteName);
 }
Example #9
0
 public void TestThatValidationsSucceedsWhenDirectoriesExists()
 {
     var operation = new PreCompileOperation("MyWebApp", _validWebAppPath, _validOutputPath, _buildManager.Object);
     var notification = new Notification();
     Assert.That(operation.IsValid(notification));
 }
 public override bool IsValid(Notification notification)
 {
     return !string.IsNullOrWhiteSpace(SourcePath) &&
              !string.IsNullOrWhiteSpace(DestinationWebSite) &&
            !string.IsNullOrWhiteSpace(DestinationAppName);
 }
Example #11
0
 public void TestThatValidationsFailsWhenAppNameIsEmpty()
 {
     var operation = new PreCompileOperation("", _validWebAppPath, _validOutputPath, _buildManager.Object);
     var notification = new Notification();
     Assert.That(operation.IsValid(notification), Is.False);
 }
Example #12
0
 public override bool IsValid(Notification notification)
 {
     throw new System.NotImplementedException();
 }
 public override bool IsValid(Notification notification)
 {
     return _scripts.Count > 0;
 }
Example #14
0
 public override bool IsValid(Notification notification)
 {
     return true;
     //var remoteLibExist = true;
     //if(RequireRemoteLib)
     //{
     //    remoteLibExist = File.Exists(Path.Combine(Path.GetDirectoryName(GetType().Assembly.Location), "ConDep.Remote.dll"));
     //}
     //return string.IsNullOrWhiteSpace(_command) && !string.IsNullOrWhiteSpace(DestinationPath) && remoteLibExist;
 }
Example #15
0
 public override bool IsValid(Notification notification)
 {
     return !string.IsNullOrWhiteSpace(_url) && Uri.IsWellFormedUriString(_url, UriKind.Absolute);
 }
Example #16
0
 public override bool IsValid(Notification notification)
 {
     return !string.IsNullOrWhiteSpace(DestinationPath) ||
         string.IsNullOrWhiteSpace(SourcePath);
 }
 public override bool IsValid(Notification notification)
 {
     return true;
 }
Example #18
0
 public abstract bool IsValid(Notification notification);
Example #19
0
 public bool IsValid(Notification notification)
 {
     return true;
 }