Example #1
0
 private void xmlRpcClient_MethodResponse(IXmlRpcClient sender, uint requestHandle, string methodResponse)
 {
     if (methodResponses.ContainsKey(requestHandle))
     {
         methodResponses[requestHandle] = methodResponse;
     }
 }
Example #2
0
        public Keyword(CriterionStep step, IXmlRpcClient proxy, BehaviorConfiguration config)
        {
            Name = step.Name;
            Config = config;
            Proxy = proxy;
            Parameters = new Dictionary<string, object>();

            var argCount = 0;

            foreach (object p in step.Parameters)
            {
                if (p.GetType().Equals(typeof(string)))
                    Parameters.Add("arg" + argCount, p as string);
                else
                    Parameters.Add("arg" + argCount, p);

                argCount++;
            }

            if (!int.TryParse(Config.GuiDelay, out guiDelay))
                guiDelay = 0;

            if (guiDelay < 0)
                guiDelay = 0;

            KeywordExists = ValidateKeywordName(Name);

            if(KeywordExists)
                ParametersAreCorrect = ValidateParameters(Name, Parameters);
        }
Example #3
0
        public static CriterionResult Run(this Criterion criterion, IXmlRpcClient proxy)
        {
            var criterionResult = new CriterionResult();

            criterionResult.Criterion = criterion;

            criterionResult.StepResults.AddRange(RunCriterion(criterion, -1, proxy).StepResults);

            criterionResult.SetResult();

            return criterionResult;
        }
        public ApiMethodExecutor(IXmlRpcClient xmlRpcClient)
        {
            _xmlRpcClient = xmlRpcClient;

            _requestHandlers = new List <IXmlRpcApiRequestHandler>
            {
                new VoidRequestHandler(),
                new XmlRpcValueRequestHandler(),
                new ValueRequestHandler(),
                new GenericValueRequestHandler(),
                new ObjectValueRequestHandler(),
                new EnumerableRequestHandler(),
                new DictionaryRequestHandler()
            };
        }
Example #5
0
        public static StepResult Run(this CriterionStep step, IXmlRpcClient proxy)
        {
            var keyword = new Keyword(step, proxy, Behavior.Config) ;

            var result = new StepResult();

            if (keyword.KeywordExists && keyword.ParametersAreCorrect)
            {
                var ret = keyword.Run();

                ret.KeywordName = step.Keyword + " " + step.InsertValues();

                return ret;
            }

            return new StepResult(keyword);
        }
Example #6
0
        /// <summary>
        /// Creates a new instance of the <see cref="ManiaNet.DedicatedServer.Controller.ServerController"/> class with the given XmlRpc client and config.
        /// </summary>
        /// <param name="xmlRpcClient">The client used to communicate with the server.</param>
        /// <param name="config">The configuration for the controller.</param>
        public ServerController([NotNull] IXmlRpcClient xmlRpcClient, [NotNull] ServerControllerConfig config)
        {
            this.xmlRpcClient = xmlRpcClient;
            this.xmlRpcClient.MethodResponse += xmlRpcClient_MethodResponse;
            this.xmlRpcClient.ServerCallback += xmlRpcClient_ServerCallback;

            Database = new SQLiteConnection("Data Source=" + config.DatabasePath + ";Version=3;");
            Database.Open();

            WebServicesClient = new CombiClient(config.WebServicesLogin, config.WebServicesPassword);

            Configuration = config;

            RegisterCommand("plugins", listPlugins);

            PlayerChat          += ServerController_PlayerChat;
            ChatInterfaceManager = new ChatInterfaceManager();
            ChatInterfaceManager.RegisterInterface("chat", new StandardChatInterface(this));
            ChatInterfaceManager.RegisterInterface("console", new ConsoleChatInterface());

            RecordsProviderManager = new RecordsProviderManager();
        }
Example #7
0
        public static CriterionResult RunCriterion(Criterion criterion, int dataRow, IXmlRpcClient proxy)
        {
            var criterionResult = new CriterionResult() { Criterion = criterion };

            foreach (CriterionStep s in criterion.Steps)
            {
                if(criterion.Table != null && criterion.Table.DataRows.Count > 0)
                    s.SetTestData(criterion.Table, dataRow);

                if (s.Table != null && s.Table.DataRows.Count > 0)
                    s.SetTestData(s.Table);

                criterionResult.StepResults.Add(s.Run(proxy));

                criterionResult.SetResult();

                if (criterionResult.Result.status.Equals("FAIL"))
                    break;
            }

            return criterionResult;
        }
Example #8
0
 private void xmlRpcClient_ServerCallback(IXmlRpcClient sender, string serverCallback)
 {
     Task.Factory.StartNew(callEvent, serverCallback);
 }
Example #9
0
 /// <summary>
 /// Creates a new instance of the <see cref="ManiaNet.DedicatedServer.Controller.ServerController"/> class with the given XmlRpc client and the default config.
 /// </summary>
 /// <param name="xmlRpcClient">The client used to communicate with the server.</param>
 public ServerController([NotNull] IXmlRpcClient xmlRpcClient)
     : this(xmlRpcClient, new ServerControllerConfig())
 {
 }
Example #10
0
        public static StoryResult RunCriteria(Story story, StoryResult storyResult, IXmlRpcClient proxy)
        {
            story.IncludeTags = Behavior.Config.IncludeTags;
            story.ExcludeTags = Behavior.Config.ExcludeTags;
            story.Repository = Behavior.Kernel.Get<IRepository>();

            foreach (Criterion s in story.TestSequence)
            {
                if (s.CriterionType.Equals("Context Reset"))
                {
                    proxy.reset_criterion_context();

                    continue;
                }

                storyResult.CriterionResults.Add(s.Run(proxy));
            }

            return storyResult;
        }
        public XmlRpcProxyInterceptor(IXmlRpcClient xmlRpcClient, ApiStructure apiStructure)
        {
            _apiStructure = apiStructure;

            _apiMethodExecutor = new ApiMethodExecutor(xmlRpcClient);
        }