Ejemplo n.º 1
0
        public void Deployer_should_pass_build_definition_name_to_configuration_reader()
        {
            // Arrange
            BuildDetail buildDetail = null;

            var statusChanged = new BuildStatusChangeEvent {
                StatusChange = new Change()
            };
            var mappingProcessor = MockRepository.GenerateStub <IMappingProcessor>();

            var tfsBuildDetail = new StubBuildDetail {
                BuildDefinition = { Name = "foo" }
            };
            var buildServer = MockRepository.GenerateStub <IBuildServer>();

            buildServer.Stub(o => o.GetBuild(null, null, null, QueryOptions.None))
            .IgnoreArguments()
            .Return(tfsBuildDetail);

            var reader = MockRepository.GenerateStub <IConfigurationReader>();

            reader.Stub(o => o.ReadMappings(Arg <BuildDetail> .Is.Anything)).WhenCalled(m => buildDetail = (BuildDetail)m.Arguments[0]);

            Func <BuildDetail, IBuildDetail, IPostDeployAction> postDeployActionFactory = (a, b) => MockRepository.GenerateStub <IPostDeployAction>();

            var deployer = new Deployer(reader, buildServer, mappingProcessor, postDeployActionFactory);

            // Act
            deployer.ExecuteDeploymentProcess(statusChanged, 0);

            // Assert
            Assert.AreEqual("foo", buildDetail.BuildDefinition.Name);
        }
Ejemplo n.º 2
0
        private void OnItemDeployed(Deployer deployer, BaseEntity entity)
        {
            BasePlayer player = deployer.GetOwnerPlayer();

            if (entity is Door)
            {
                BaseEntity codelockent = entity.GetSlot(BaseEntity.Slot.Lock);

                if (storedData.IDlist.ContainsKey(entity.net.ID))
                {
                    Item codelock;
                    if (codelockent.PrefabName == "assets/prefabs/locks/keypad/lock.code.prefab")
                    {
                        codelock = ItemManager.CreateByName("lock.code", 1);
                    }
                    else
                    {
                        codelock = ItemManager.CreateByName("lock.key", 1);
                    }
                    player.GiveItem(codelock);
                    codelockent.Kill();
                    SendReply(player, lang.GetMessage("CantPlace_NEW", this, player.UserIDString));
                    return;
                }
            }
        }
Ejemplo n.º 3
0
        public void SetUp()
        {
            threadingPolicy = new SingleThreadingPolicy();
            transactionFactory = new TransactionFactory(threadingPolicy);

            layer = MockRepository.GenerateMock<ILayer>();

            serverManager = MockRepository.GenerateMock<IServerManager>();

            serverManagerFactory = MockRepository.GenerateMock<IServerManagerFactory>();

            operationFactory = new OperationFactory(layer, serverManagerFactory);

            sut = new Deployer(transactionFactory, operationFactory);

            project = new Project
            {
                Name = "Search.API",
                Source = @"\\ystage01.ywebfarm.lcl\e$\ServiceArtifacts\Yoox.API\Search.API\1.1_new",
                Path = @"Test\Yoox.API\Search.API\1.0",
                Application = "Search.API",
                Site = "Yoox.API",
                Servers = new[] { @"\\serverA\", @"\\serverB\" },
            };
        }
Ejemplo n.º 4
0
        public void ThrowsWhenStackFailsToDetele()
        {
            var stackName         = "AwsToolsRemovalThrowsWhenStackFailsToDeteleTest";
            var securityGroupName = "AwsToolsRemovalThrowsWhenStackFailsToDeteleTest";

            SetUp(stackName);

            var deployer = new Deployer(_awsConfiguration);

            try
            {
                deployer.CreateStack(new StackTemplate
                {
                    StackName    = stackName,
                    TemplatePath = CloudFormationTemplates.Path("example-basic-vpc.template")
                });
                CreateSecurityGroup(securityGroupName, stackName);

                TestDelegate act = () => deployer.DeleteStack(stackName);

                Assert.Throws <FailedToDeleteStackException>(act);
            }
            finally
            {
                DeleteSecurityGroup(securityGroupName, stackName);
                DeletePreviousTestStack(stackName);
            }
        }
Ejemplo n.º 5
0
        public void ShouldMatchOriginalQualityOnWildcard()
        {
            const string TestWildcard = "*";

            var changeEvent = new BuildStatusChangeEvent();

            var mapping = new Mapping()
            {
                Computer        = Environment.MachineName,
                NewQuality      = "SomeNewQuality",
                PermittedUsers  = null,
                OriginalQuality = TestWildcard
            };

            var statusChange = new Change()
            {
                NewValue = "SomeNewQuality",
                OldValue = "DefinitelyNotTheWildCard"
            };

            var deployer = new Deployer();
            var result   = deployer.IsInterestedStatusChange(changeEvent, mapping, statusChange);

            Assert.IsTrue(result, "IsInterestedStatusChange()");
        }
Ejemplo n.º 6
0
    /// <summary>
    /// 生成技能
    /// </summary>
    public GameObject GenerateSkill(SkillData data)
    {
        //创建技能预制件
        GameObject skillGo = ResMgr.Instance.Load <GameObject>(data.prefabName);

        //调整位置和方向
        int temp = PlayerStatus.Instance.IsFacingRight ? 1 : -1;

        if (data.key == ReflectKey.attack && data.offsetX != 0)
        {
            skillGo.transform.position = data.owner.transform.position + new Vector3(temp * data.offsetX, 0, 0) * PlayerStatus.Instance.AttackDistanceRate;
        }
        else
        {
            skillGo.transform.position = data.owner.transform.position;
        }
        if (PlayerStatus.Instance.IsWallSliding)
        {
            temp *= -1;
        }
        skillGo.transform.localScale = new Vector3(temp * skillGo.transform.localScale.x, skillGo.transform.localScale.y, skillGo.transform.localScale.x);

        //传递技能数据
        Deployer deployer = skillGo.GetComponent <Deployer>();

        deployer.SkillData = data; //内部创建算法对象
        deployer.DeploySkill();    //内部执行算法对象
        deployer.SetCoolDown();
        deployer.SetComboTime();
        lastSkill = data;

        return(skillGo);
    }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            var options = new Options();

            if (!Parser.Default.ParseArguments(args, options))
            {
                Environment.Exit(1);
            }

            var deployer = new Deployer(new AwsConfiguration
            {
                AwsEndpoint = RegionEndpoint.GetBySystemName(options.Region),
                RoleName    = options.RoleName,
                Proxy       = new AwsProxy {
                    Host = options.ProxyHost, Port = options.ProxyPort
                },
                Bucket = options.BucketName
            });

            deployer.CreateStack(new StackTemplate
            {
                StackName     = options.StackName,
                TemplatePath  = options.TemplatePath,
                ParameterPath = options.ParameterPath
            });
        }
Ejemplo n.º 8
0
 public void OnFinish(Deployer deployer)
 {
     if (deployer.SkillData.changeAtr)
     {
         PlayerStatus.Instance.ChangeAttri(deployer.SkillData.info, -1 * deployer.SkillData.delta);
     }
 }
Ejemplo n.º 9
0
 void OnItemDeployed(Deployer deployer, BaseEntity deployedentity)
 {
     if (!(deployedentity is BaseLock))
     {
         CheckBlock((BaseNetworkable)deployedentity, deployer.ownerPlayer, BlockDeployablesHeight, BlockDeployablesWater);
     }
 }
Ejemplo n.º 10
0
        static void Main(string[] args)
        {
            var options = new Options();

            if (!Parser.Default.ParseArguments(args, options))
            {
                return;
            }

            var deployer = new Deployer(new AwsConfiguration
            {
                AssumeRoleTrustDocument = options.AssumeRolePolicyPath,
                IamRolePolicyDocument   = options.S3AccessPolicyDocumentPath,
                Bucket      = options.BucketName,
                RoleName    = "S3-Push",
                AwsEndpoint = RegionEndpoint.GetBySystemName(options.RegionEndpoint)
            });

            deployer.PushRevision(new ApplicationSetRevision
            {
                LocalDirectory     = options.BuildDirectoryPath,
                Version            = options.Version,
                ApplicationSetName = options.ApplicationSetName
            });
        }
Ejemplo n.º 11
0
        private static Thread StartDeploy(Deployer deployer)
        {
            var thread = new Thread(() => deployer.Deploy());

            thread.Start();
            return(thread);
        }
Ejemplo n.º 12
0
        protected override void OnStart(string[] args)
        {
            _deployer?.Dispose(); // Shouldn't happen, but let's be sure

            _deployer = new Deployer();
            _deployer.Start();
        }
Ejemplo n.º 13
0
        public void EnsureStackExists()
        {
            if (_hasCreatedStack)
            {
                return;
            }

            _awsConfiguration = new AwsConfiguration
            {
                AssumeRoleTrustDocument = Roles.Path("code-deploy-trust.json"),
                IamRolePolicyDocument   = Roles.Path("code-deploy-policy.json"),
                Bucket      = "aws-deployment-tools-tests",
                RoleName    = "CodeDeployRole",
                AwsEndpoint = TestConfiguration.AwsEndpoint,
                Credentials = new TestSuiteCredentials()
            };

            _deployer = new Deployer(_awsConfiguration);

            DeletePreviousTestStack();
            _stack = _deployer.CreateStack(new StackTemplate
            {
                StackName    = StackName,
                TemplatePath = CloudFormationTemplates.Path("example-windows-vpc.template")
            });
            _hasCreatedStack = true;
        }
Ejemplo n.º 14
0
        public void CreatesBucketBasedOnRoleThatCanAssumeAppropriateRole()
        {
            var createBucketRole = _iamClient.PutRolePolicy(new PutRolePolicyRequest
            {
                RoleName       = _roleToAssume.RoleName,
                PolicyName     = "assume-policy-8",
                PolicyDocument = @"{
                  ""Version"": ""2012-10-17"",
                  ""Statement"": [
                    {
                      ""Effect"": ""Allow"",
                      ""Action"": [
                        ""s3:*"",
                        ""cloudformation:*""
                      ],
                      ""Resource"": [
                        ""*""
                      ]
                    }
                  ]
                }"
            });

            Thread.Sleep(TimeSpan.FromSeconds(10));

            var deployer = new Deployer(_awsConfiguration);
            //deployer.CreateStack(new StackTemplate {
            //    StackName = "SimpleBucketTestStack",
            //    TemplatePath = CloudFormationTemplates.Path("simple-s3-bucket.template"),
            //});

            //var s3Response = _s3Client.GetBucketLocation(_bucketName);
            //Assert.AreEqual(s3Response.HttpStatusCode, HttpStatusCode.OK);
        }
Ejemplo n.º 15
0
        private void OnItemDeployed(Deployer deployer, BaseEntity entity)
        {
            var cupboard = entity as BuildingPrivlidge;

            if (cupboard == null)
            {
                return;
            }

            var player = deployer.ToPlayer();

            if (config.RestrictToolCupboards && player != null)
            {
                var cupboards = toolCupboards.Where(c => c.Value.Contains(new PlayerNameID {
                    userid = player.userID
                }));
                if (cupboards.Count() > config.MaxToolCupboards)
                {
                    cupboard.Kill();
                    Message(player, "MaxToolCupboards", config.MaxToolCupboards);
                }
            }
            else
            {
                if (!toolCupboards.ContainsKey(cupboard.net.ID))
                {
                    toolCupboards.Add(cupboard.net.ID, cupboard.authorizedPlayers);
                }
            }
        }
Ejemplo n.º 16
0
        public void ShouldMatchOriginalQualityWhenNullInConfigButEmptyInTfs()
        {
            const string TestNewQuality = "Pass";

            var changeEvent = new BuildStatusChangeEvent();

            var mapping = new Mapping()
            {
                Computer        = Environment.MachineName,
                NewQuality      = TestNewQuality,
                PermittedUsers  = null,
                OriginalQuality = null
            };

            var statusChange = new Change()
            {
                NewValue = TestNewQuality,
                OldValue = string.Empty
            };

            var deployer = new Deployer();
            var result   = deployer.IsInterestedStatusChange(changeEvent, mapping, statusChange);

            Assert.IsTrue(result, "IsInterestedStatusChange()");
        }
Ejemplo n.º 17
0
        /// <summary>
        /// ON CUPBOARD DEPLOYED
        /// ON TURRET DEPLOYED
        /// ON DOOR DEPLOYED
        /// ON SLEEPING BAG DEPLOYED
        /// ON STOCKING DEPLOYED
        /// ON BARRICADE DEPLOYED
        /// ON CONTAINER DEPLOYED
        /// ON SIGN DEPLOYED
        /// ON FURNACE DEPLOYED
        /// ON CAMPFIRE DEPLOYED
        /// ON LIGHT DEPLOYED
        /// </summary>
        /// <param name="deployer"></param>
        /// <param name="entity"></param>
        void OnItemDeployed(Deployer deployer, BaseEntity entity)
        {
            BasePlayer player = deployer.GetOwnerPlayer();

            var type = entity.GetType();

            string hook;

            if (TryGetHook(type, deployableTypes, out hook))
            {
                Interface.CallHook(hook, player, deployer, entity);
            }
            else if (entity is BaseOven)
            {
                if (entity.name.Contains("furnace"))
                {
                    Interface.Oxide.CallHook("OnFurnaceDeployed", player, deployer, entity);
                }
                else if (entity.name.Contains("campfire"))
                {
                    Interface.Oxide.CallHook("OnCampfireDeployed", player, deployer, entity);
                }
                else if (entity is CeilingLight)
                {
                    Interface.Oxide.CallHook("OnLightDeployed", player, deployer, entity);
                }
            }
        }
Ejemplo n.º 18
0
 private void OnAttemptDeploy(Version version, string tag)
 {
     lock (Mutex)
     {
         try
         {
             var currentVersion = History.GetLatestVersion(tag);
             if (currentVersion >= version)
             {
                 return;
             }
             var result = Deployer.Deploy(version, tag);
             // Just return if there was an error.
             if (result.Type == DeploymentResultType.Error)
             {
                 return;
             }
             History.SetVersion(tag, version);
         }
         catch (Exception ex)
         {
             return;
         }
     }
 }
Ejemplo n.º 19
0
        /// <summary>
        /// Вызывается, когда игрок что-то поставил
        /// </summary>
        /// <param name="deployer">Строитель</param>
        /// <param name="entity">Предмет, который игрок поставил</param>
        void OnItemDeployed(Deployer deployer, BaseEntity entity)
        {
            if (!(entity is CodeLock))
            {
                return;
            }
            var codelock = (CodeLock)entity;
            var player   = deployer.GetOwnerPlayer();

            codelock.OwnerID = player.userID;

            if (ignorePlayers.Contains(player.userID))
            {
                return;
            }
            List <ulong> friends = Friends?.Call("ApiGetFriends", player.userID) as List <ulong>;

            if (friends == null)
            {
                return;
            }
            whiteListField.SetValue(codelock, new List <ulong>()
            {
                player.userID
            });
            CodeLockAuth(codelock, friends);

            codeField.SetValue(codelock, UnityEngine.Random.Range(1000, 9999));
            codelock.SetFlag(BaseEntity.Flags.Locked, true);
            SendReply(player, Messages["deployCodelockMessage"]);
        }
Ejemplo n.º 20
0
        public void Deployer_should_pass_build_status_to_mapping_processor()
        {
            // Arrange
            BuildDetail buildDetail = null;

            var statusChanged = new BuildStatusChangeEvent {
                StatusChange = new Change()
            };
            var reader = MockRepository.GenerateStub <IConfigurationReader>();

            var tfsBuildDetail = new StubBuildDetail {
                Status = Microsoft.TeamFoundation.Build.Client.BuildStatus.PartiallySucceeded
            };
            var buildServer = MockRepository.GenerateStub <IBuildServer>();

            buildServer.Stub(o => o.GetBuild(null, null, null, QueryOptions.None))
            .IgnoreArguments()
            .Return(tfsBuildDetail);

            var mappingProcessor = MockRepository.GenerateStub <IMappingProcessor>();

            mappingProcessor.Stub(o => o.ProcessMappings(null, null, null, null, 0))
            .IgnoreArguments()
            .WhenCalled(m => buildDetail = (BuildDetail)m.Arguments[2]);

            Func <BuildDetail, IBuildDetail, IPostDeployAction> postDeployActionFactory = (a, b) => MockRepository.GenerateStub <IPostDeployAction>();

            var deployer = new Deployer(reader, buildServer, mappingProcessor, postDeployActionFactory);

            // Act
            deployer.ExecuteDeploymentProcess(statusChanged, 0);

            // Assert
            Assert.AreEqual(global::TfsDeployer.TeamFoundation.BuildStatus.PartiallySucceeded, buildDetail.Status);
        }
Ejemplo n.º 21
0
 public void Execute(Deployer deployer)
 {
     if (!costSpDone)
     {
         PlayerStatus.Instance.ChangeSP(-1 * deployer.SkillData.costSP * PlayerStatus.Instance.MagicCostRate);
         costSpDone = true;
     }
 }
 public void OnMouseDown()//is executed when the user has pressed the mouse button while over the Collider.
 {
     //checks if the player clicked on the hex and if it is a potencial position
     if (Deployer.readyForDeploymentIcon != null && regimentPosition == PositionForRegiment.player)
     {
         Deployer.DeployRegiment(parentHex);//deploys a regiment
     }
 }
Ejemplo n.º 23
0
 public RustPlayerDeployingEntityEvent(
     RustPlayer player,
     Deployer deployer,
     uint entityId) : base(player)
 {
     Deployer = deployer;
     EntityId = entityId;
 }
Ejemplo n.º 24
0
        private void UpdateList()
        {
            // build the html
            html_list.Text = Deployer.BuildHtmlTableForRules(Deployer.GetFullDeployRulesList);

            scrollPanel.ContentPanel.Height = html_list.Location.Y + html_list.Height;
            scrollPanel.OnResizedContentPanel();
        }
Ejemplo n.º 25
0
 public void OnFinish(Deployer deployer)
 {
     //如果是数值护符,此时已检测到护符不在装备状态,销毁前修正数值
     if (deployer.SkillData.changeAtr)
     {
         PlayerStatus.Instance.ChangeAttri(deployer.SkillData.info, -1 * deployer.SkillData.delta);
     }
 }
Ejemplo n.º 26
0
 public DeploymentResult Deploy(Version version, string tag)
 {
     if (!Condition(tag, version))
     {
         return(new DeploymentResult(DeploymentResultType.Skipped));
     }
     return(Deployer.Deploy(version, tag));
 }
Ejemplo n.º 27
0
 public void OnMouseDown()// se ejecuta cuando el usuario ha presionado el botón del mouse mientras está sobre el Collider.
 {
     // comprueba si el jugador hizo clic en el hex y si es una posición potencial
     if (Deployer.readyForDeploymentIcon != null && regimentPosition == PositionForRegiment.player)
     {
         Deployer.DeployRegiment(parentHex);// despliega un regimiento
     }
 }
        public void can_deploy_test_a_file_without_deploy()
        {
            var layout = SimpleSerializer.Xml<Layout>()
                .DeserializeTypedFromString(SampleLayouts.test_a_layout);
            var deployer = new Deployer(layout);

            var items = deployer.Read(SampleLayouts.test_a.ToStream()).ToList();
            items.Sum(x => x.Expanded.Count).Should().Be(0);
        }
Ejemplo n.º 29
0
 public bool Check(Deployer deployer)
 {
     if (firstTime)
     {
         EventCenter.Instance.AddEventListener <KeyCode>("xPress", CheckKeyDown);
         firstTime = false;
     }
     return(interrupt);
 }
Ejemplo n.º 30
0
        private void OnItemDeployed(Deployer deployer, BaseEntity entity)
        {
            BasePlayer player = deployer.GetOwnerPlayer();

            if (player != null && !permission.UserHasPermission(player.UserIDString, permBypass))
            {
                CheckEntity(entity, player);
            }
        }
Ejemplo n.º 31
0
        /* ICommand */
        public bool CanExecute(object parameter)
        {
            if (Deployer != null && File.Exists(Deployer.Application.Config.AppLocation))
            {
                return(Deployer.CanDeploy());
            }

            return(false);
        }
        /// <summary>
        ///     Create a new templates API controller.
        /// </summary>
        /// <param name="deployer">
        ///     The deployment service.
        /// </param>
        public TemplatesController(Deployer deployer)
        {
            if (deployer == null)
            {
                throw new ArgumentNullException(nameof(deployer));
            }

            _deployer = deployer;
        }
Ejemplo n.º 33
0
 private void OnItemDeployed(Deployer deployer, BaseEntity deployedEntity)
 {
     HookCalled("OnItemDeployed");
     // TODO: Print item deployed
 }
Ejemplo n.º 34
0
 /////////////////////////////////////////
 // OnItemDeployed(Deployer deployer, BaseEntity deployedEntity)
 // Called when an item was deployed
 /////////////////////////////////////////
 void OnItemDeployed(Deployer deployer, BaseEntity deployedEntity)
 {
     if (deployer.ownerPlayer == null) return;
     if (hasTag(deployer.ownerPlayer, "nodeploy"))
     {
         if (!hasPermission(deployer.ownerPlayer, "candeploy"))
         {
             deployedEntity.Kill(BaseNetworkable.DestroyMode.Gib);
             SendMessage(deployer.ownerPlayer, "You are not allowed to deploy here");
         }
     }
 }
        //-------------------------------------------------------------------------------
        // void OnItemDeployed():
        //-------------------------------------------------------------------------------
        // When and object it's deployed checks if it is a lantern, if it's night time
        // and if automatic control of lanterns is enabled.
        // If all conditions are true, this lantern is automatically turned on.
        //-------------------------------------------------------------------------------
        void OnItemDeployed(Deployer deployer, BaseEntity deployedEntity)
        {
            bool status = false;
            double currentTime = TOD_Sky.Instance.Cycle.Hour;
            
            if (deployedEntity.ShortPrefabName == "lantern.deployed"
               || ( (deployedEntity.ShortPrefabName == "ceilinglight.deployed") && includeCeilingLight) 
               || ( (deployedEntity.ShortPrefabName == "jackolantern.happy") && includeJackOLanterns) 
               || ( (deployedEntity.ShortPrefabName == "jackolantern.angry") && includeJackOLanterns)
               || ( (deployedEntity.ShortPrefabName == "campfire") && includeCampfires)
               ) 
            {
                
                if ( currentTime < sunriseHour && isAutoTurnLanternsEnabled || currentTime >= sunsetHour && isAutoTurnLanternsEnabled )
                    {
                        status = true;
                    }
                
                deployedEntity.SetFlag(BaseEntity.Flags.On, status);

            }
        }
        void OnItemDeployed(Deployer deployer, BaseEntity deployedEntity)
        {
            Item item = deployer.GetItem();

            if (item.info.shortname == "research_table")
            {
                updateResearchTables();
            }
        }
Ejemplo n.º 37
0
 public void OnDeployItem(Deployer deployer, BaseEntity baseEntity)
 {
     var player = deployer.ownerPlayer;
     var item = deployer.GetItem();
     var itemDef = item.info;
     var type = baseEntity.GetType();
     if (type != typeof (BaseOven) || !itemDef.displayName.translated.ToLower().Equals("furnace")) return;
     var baseOven = (BaseOven)baseEntity;
     var instanceId = RPGHelper.OvenId(baseOven);
     if (PlayersFurnaces.ContainsKey(instanceId))
     {
         ChatMessage(player, "Contact the developer, tell him wrong Id usage for furnace.");
         return;
     }
     PlayersFurnaces.Add(instanceId, RPGHelper.SteamId(player));
 }
Ejemplo n.º 38
0
 /////////////////////////////////////////
 // OnItemDeployed(Deployer deployer, BaseEntity deployedEntity)
 // Called when an item was deployed
 /////////////////////////////////////////
 private void OnItemDeployed(Deployer deployer, BaseEntity deployedEntity)
 {
     if (deployer.ownerPlayer == null) return;
     if (HasPlayerFlag(deployer.ownerPlayer, ZoneFlags.NoDeploy) && !hasPermission(deployer.ownerPlayer, PermCanDeploy))
     {
         deployedEntity.Kill(BaseNetworkable.DestroyMode.Gib);
         SendMessage(deployer.ownerPlayer, "You are not allowed to deploy here");
     }
 }
Ejemplo n.º 39
0
 private void Deploy()
 {
     ThreadPool.QueueUserWorkItem(_ =>
     {
         try { }
         finally
         {
             // Avoid thread aborts by putting this logic in the finally
             var deployer = new Deployer(_tracer, _deploymentManagerFactory, _deploymentLock);
             deployer.Deploy();
         }
     });
 }