Ejemplo n.º 1
0
        private void SetBindingType(BindingType binding)
        {
            var config = _hogController.GetConfig("DependentTestModule");

            var connectorConfig = config.Root.SubEntries.FirstOrDefault(e => e.Identifier == "SimpleHelloWorldWcfConnector");

            Assert.NotNull(connectorConfig, "Can't get config entry 'SimpleHelloWorldWcfConnector'");

            var hostConfig = connectorConfig.SubEntries.FirstOrDefault(e => e.Identifier == "ConnectorHost");

            Assert.NotNull(hostConfig, "Can't get config entry 'SimpleHelloWorldWcfConnector.ConnectorHost'");

            var bindingType = hostConfig.SubEntries.FirstOrDefault(e => e.Identifier == "BindingType");

            Assert.NotNull(bindingType, "Can't get config entry 'SimpleHelloWorldWcfConnector.ConnectorHost.BindingType'");

            if (bindingType.Value.Current != binding.ToString())
            {
                bindingType.Value.Current = binding.ToString();

                _hogController.SetConfig(config, "DependentTestModule");

                _hogController.StopService("DependentTestModule");
                var result = _hogController.WaitForService("DependentTestModule", ServerModuleState.Stopped, 5);
                Assert.IsTrue(result, "Service '{0}' did not reach state 'Stopped'", "DependentTestModule");

                _hogController.StartService("DependentTestModule");
                result = _hogController.WaitForService("DependentTestModule", ServerModuleState.Running, 5);
                Assert.IsTrue(result, "Service 'DependentTestModule' did not reach state 'Running'");
            }
        }
Ejemplo n.º 2
0
 public override string ToString()
 {
     if (BindingType == TerraViewer.BindingType.SetValue && !string.IsNullOrEmpty(Value))
     {
         return(TargetType.ToString() + "." + BindingType.ToString() + "." + PropertyName + " = " + Value.ToString());
     }
     else
     {
         return(TargetType.ToString() + "." + BindingType.ToString() + "." + PropertyName);
     }
 }
Ejemplo n.º 3
0
 public override string  ToString()
 {
     return(string.Format(
                "{0} {1}{2}",
                BindingType.ToString(),
                this.BindingType == BindingType.Socket
             ? this.Address + ":"
             : (this.BindingType == BindingType.Serial ? "COM" : @"\\.\pipe\" + this.Address),
                this.Port.HasValue ? this.Port.ToString() : String.Empty));
 }
        private IEnumerable<string> GetPrefixesToRemove(BindingType bindingType)
        {
            yield return bindingType.ToString();

            var cultureToSearch = runtimeConfiguration.BindingCulture ?? runtimeConfiguration.FeatureLanguage;

            foreach (var keyword in LanguageHelper.GetKeywords(cultureToSearch, bindingType))
            {
                if (keyword.Contains(' '))
                {
                    yield return keyword.Replace(" ", "_");
                    yield return keyword.Replace(" ", "");
                }
                else
                {
                    yield return keyword;
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Generate the necessary parameters
        /// </summary>
        public List <KeyValuePair <string, string> > GetParams()
        {
            var p = new List <KeyValuePair <string, string> >();

            if (Identity != null)
            {
                p.Add(new KeyValuePair <string, string>("Identity", Identity));
            }

            if (BindingType != null)
            {
                p.Add(new KeyValuePair <string, string>("BindingType", BindingType.ToString()));
            }

            if (Address != null)
            {
                p.Add(new KeyValuePair <string, string>("Address", Address));
            }

            if (Tag != null)
            {
                p.AddRange(Tag.Select(prop => new KeyValuePair <string, string>("Tag", prop)));
            }

            if (NotificationProtocolVersion != null)
            {
                p.Add(new KeyValuePair <string, string>("NotificationProtocolVersion", NotificationProtocolVersion));
            }

            if (CredentialSid != null)
            {
                p.Add(new KeyValuePair <string, string>("CredentialSid", CredentialSid.ToString()));
            }

            if (Endpoint != null)
            {
                p.Add(new KeyValuePair <string, string>("Endpoint", Endpoint));
            }

            return(p);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Add a binding to the bindings collection
        /// </summary>
        /// <param name="type"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public QueryBuilder AddBinding(BindingType type, object value)
        {
            // should never happend if the enum is used...
            if (!_bindings.ContainsKey(type))
            {
                throw new InvalidArgumentException("Invalid binding type " + type.ToString());
            }

            Type valueType = value.GetType();

            if (valueType.IsArray)
            {
                foreach (object val in value as IEnumerable <object> )
                {
                    _bindings[type].Add(val);
                }
            }
            else
            {
                _bindings[type].Add(value);
            }

            return(this);
        }
        private void AddComplexCurve(float time, BindingType bindType, IReadOnlyList <float> curveValues,
                                     IReadOnlyList <float> inSlopeValues, IReadOnlyList <float> outSlopeValues, int offset, string path)
        {
            switch (bindType)
            {
            case BindingType.Translation:
            {
                if (!m_translations.TryGetValue(path, out List <KeyframeTpl <Vector3f> > transCurve))
                {
                    transCurve = new List <KeyframeTpl <Vector3f> >();
                    m_translations.Add(path, transCurve);
                }

                float x = curveValues[offset + 0];
                float y = curveValues[offset + 1];
                float z = curveValues[offset + 2];

                float inX = inSlopeValues[0];
                float inY = inSlopeValues[1];
                float inZ = inSlopeValues[2];

                float outX = outSlopeValues[0];
                float outY = outSlopeValues[1];
                float outZ = outSlopeValues[2];

                Vector3f value     = new Vector3f(x, y, z);
                Vector3f inSlope   = new Vector3f(inX, inY, inZ);
                Vector3f outSlope  = new Vector3f(outX, outY, outZ);
                Vector3f defWeight = new Vector3f(1.0f / 3.0f);
                KeyframeTpl <Vector3f> transKey = new KeyframeTpl <Vector3f>(time, value, inSlope, outSlope, defWeight);
                transCurve.Add(transKey);
                m_translations[path] = transCurve;
            }
            break;

            case BindingType.Rotation:
            {
                if (!m_rotations.TryGetValue(path, out List <KeyframeTpl <Quaternionf> > rotCurve))
                {
                    rotCurve = new List <KeyframeTpl <Quaternionf> >();
                    m_rotations.Add(path, rotCurve);
                }

                float x = curveValues[offset + 0];
                float y = curveValues[offset + 1];
                float z = curveValues[offset + 2];
                float w = curveValues[offset + 3];

                float inX = 0;                                //inSlopeValues[0];
                float inY = 0;                                //inSlopeValues[1];
                float inZ = 0;                                //inSlopeValues[2];
                float inW = 0;                                //inSlopeValues[3];

                float outX = 0;                               //outSlopeValues[0];
                float outY = 0;                               //outSlopeValues[1];
                float outZ = 0;                               //outSlopeValues[2];
                float outW = 0;                               //outSlopeValues[3];

                Quaternionf value                = new Quaternionf(x, y, z, w);
                Quaternionf inSlope              = new Quaternionf(inX, inY, inZ, inW);
                Quaternionf outSlope             = new Quaternionf(outX, outY, outZ, outW);
                Quaternionf defWeight            = new Quaternionf(1.0f / 3.0f);
                KeyframeTpl <Quaternionf> rotKey = new KeyframeTpl <Quaternionf>(time, value, inSlope, outSlope, defWeight);
                rotCurve.Add(rotKey);
                m_rotations[path] = rotCurve;
            }
            break;

            case BindingType.Scaling:
            {
                if (!m_scales.TryGetValue(path, out List <KeyframeTpl <Vector3f> > scaleCurve))
                {
                    scaleCurve = new List <KeyframeTpl <Vector3f> >();
                    m_scales.Add(path, scaleCurve);
                }

                float x = curveValues[offset + 0];
                float y = curveValues[offset + 1];
                float z = curveValues[offset + 2];

                float inX = inSlopeValues[0];
                float inY = inSlopeValues[1];
                float inZ = inSlopeValues[2];

                float outX = outSlopeValues[0];
                float outY = outSlopeValues[1];
                float outZ = outSlopeValues[2];

                Vector3f value     = new Vector3f(x, y, z);
                Vector3f inSlope   = new Vector3f(inX, inY, inZ);
                Vector3f outSlope  = new Vector3f(outX, outY, outZ);
                Vector3f defWeight = new Vector3f(1.0f / 3.0f);
                KeyframeTpl <Vector3f> scaleKey = new KeyframeTpl <Vector3f>(time, value, inSlope, outSlope, defWeight);
                scaleCurve.Add(scaleKey);
                m_scales[path] = scaleCurve;
            }
            break;

            case BindingType.EulerRotation:
            {
                if (!m_eulers.TryGetValue(path, out List <KeyframeTpl <Vector3f> > eulerCurve))
                {
                    eulerCurve = new List <KeyframeTpl <Vector3f> >();
                    m_eulers.Add(path, eulerCurve);
                }

                float x = curveValues[offset + 0];
                float y = curveValues[offset + 1];
                float z = curveValues[offset + 2];

                float inX = inSlopeValues[0];
                float inY = inSlopeValues[1];
                float inZ = inSlopeValues[2];

                float outX = outSlopeValues[0];
                float outY = outSlopeValues[1];
                float outZ = outSlopeValues[2];

                Vector3f value     = new Vector3f(x, y, z);
                Vector3f inSlope   = new Vector3f(inX, inY, inZ);
                Vector3f outSlope  = new Vector3f(outX, outY, outZ);
                Vector3f defWeight = new Vector3f(1.0f / 3.0f);
                KeyframeTpl <Vector3f> eulerKey = new KeyframeTpl <Vector3f>(time, value, inSlope, outSlope, defWeight);
                eulerCurve.Add(eulerKey);
                m_eulers[path] = eulerCurve;
            }
            break;

            case BindingType.Floats:
            {
                if (!m_floats.TryGetValue(path, out List <KeyframeTpl <Float> > floatCurve))
                {
                    floatCurve = new List <KeyframeTpl <Float> >();
                    m_floats.Add(path, floatCurve);
                }

                float x    = curveValues[offset];
                float inX  = inSlopeValues[0];
                float outX = outSlopeValues[0];

                Float value     = new Float(x);
                Float inSlope   = new Float(inX);
                Float outSlope  = new Float(outX);
                Float defWeight = new Float(1.0f / 3.0f);
                KeyframeTpl <Float> floatKey = new KeyframeTpl <Float>(time, value, inSlope, outSlope, defWeight);
                floatCurve.Add(floatKey);
                m_floats[path] = floatCurve;
            }
            break;

            default:
                throw new NotImplementedException(bindType.ToString());
            }
        }
Ejemplo n.º 8
0
 public StepInstance(ScenarioStep step, StepScopeNew stepScope, INativeSuggestionItemFactory <TNativeSuggestionItem> nativeSuggestionItemFactory, int level = 1)
     : base((BindingType)step.ScenarioBlock, (StepDefinitionKeyword)step.StepKeyword, step.Keyword, step.Text, stepScope)
 {
     this.NativeSuggestionItem = nativeSuggestionItemFactory.Create(step.Text, GetInsertionText(step), level, BindingType.ToString().Substring(0, 1), this);
 }
Ejemplo n.º 9
0
        public BoundStepSuggestions(StepBinding stepBinding, INativeSuggestionItemFactory <TNativeSuggestionItem> nativeSuggestionItemFactory)
        {
            if (stepBinding == null)
            {
                throw new ArgumentNullException("stepBinding");
            }

            StepBinding = stepBinding;
            BindingType = stepBinding.BindingType;
            string suggestionText = GetSuggestionText(stepBinding);

            NativeSuggestionItem = nativeSuggestionItemFactory.Create(suggestionText, GetInsertionText(StepBinding), 0, BindingType.ToString().Substring(0, 1) + "-b", this);
            suggestions          = new StepSuggestionList <TNativeSuggestionItem>(nativeSuggestionItemFactory);
        }
Ejemplo n.º 10
0
        private void AddComplexCurve(float time, BindingType bindType, IReadOnlyList <float> curveValues, int offset, string path)
        {
            switch (bindType)
            {
            case BindingType.Translation:
            {
                float x = curveValues[offset + 0];
                float y = curveValues[offset + 1];
                float z = curveValues[offset + 2];

                if (!m_translations.TryGetValue(path, out Vector3Curve transCurve))
                {
                    transCurve = new Vector3Curve(path);
                }

                Vector3f trans     = new Vector3f(x, y, z);
                Vector3f defWeight = new Vector3f(1.0f / 3.0f);
                KeyframeTpl <Vector3f> transKey = new KeyframeTpl <Vector3f>(time, trans, defWeight);
                transCurve.Curve.Curve.Add(transKey);
                m_translations[path] = transCurve;
            }
            break;

            case BindingType.Rotation:
            {
                float x = curveValues[offset + 0];
                float y = curveValues[offset + 1];
                float z = curveValues[offset + 2];
                float w = curveValues[offset + 3];

                if (!m_rotations.TryGetValue(path, out QuaternionCurve rotCurve))
                {
                    rotCurve = new QuaternionCurve(path);
                }

                Quaternionf rot                  = new Quaternionf(x, y, z, w);
                Quaternionf defWeight            = new Quaternionf(1.0f / 3.0f);
                KeyframeTpl <Quaternionf> rotKey = new KeyframeTpl <Quaternionf>(time, rot, defWeight);
                rotCurve.Curve.Curve.Add(rotKey);
                m_rotations[path] = rotCurve;
            }
            break;

            case BindingType.Scaling:
            {
                float x = curveValues[offset + 0];
                float y = curveValues[offset + 1];
                float z = curveValues[offset + 2];

                if (!m_scales.TryGetValue(path, out Vector3Curve scaleCurve))
                {
                    scaleCurve = new Vector3Curve(path);
                }

                Vector3f scale     = new Vector3f(x, y, z);
                Vector3f defWeight = new Vector3f(1.0f / 3.0f);
                KeyframeTpl <Vector3f> scaleKey = new KeyframeTpl <Vector3f>(time, scale, defWeight);
                scaleCurve.Curve.Curve.Add(scaleKey);
                m_scales[path] = scaleCurve;
            }
            break;

            case BindingType.EulerRotation:
            {
                float x = curveValues[offset + 0];
                float y = curveValues[offset + 1];
                float z = curveValues[offset + 2];

                if (!m_eulers.TryGetValue(path, out Vector3Curve eulerCurve))
                {
                    eulerCurve = new Vector3Curve(path);
                }

                Vector3f euler     = new Vector3f(x, y, z);
                Vector3f defWeight = new Vector3f(1.0f / 3.0f);
                KeyframeTpl <Vector3f> eulerKey = new KeyframeTpl <Vector3f>(time, euler, defWeight);
                eulerCurve.Curve.Curve.Add(eulerKey);
                m_eulers[path] = eulerCurve;
            }
            break;

            case BindingType.Floats:
            {
                float value = curveValues[offset];

                if (!m_floats.TryGetValue(path, out FloatCurve floatCurve))
                {
                    floatCurve = new FloatCurve(path);
                }

                Float @float    = new Float(value);
                Float defWeight = new Float(1.0f / 3.0f);
                KeyframeTpl <Float> floatKey = new KeyframeTpl <Float>(time, @float, defWeight);
                floatCurve.Curve.Curve.Add(floatKey);
                m_floats[path] = floatCurve;
            }
            break;

            default:
                throw new NotImplementedException(bindType.ToString());
            }
        }
Ejemplo n.º 11
0
 private ChannelEndpointElement AddClient(Type interfaceContractType, Uri uri, BindingType binding)
 {
     this.InterfaceContractType = interfaceContractType;
     if (clientconfig.Endpoints.OfType<ChannelEndpointElement>().TakeWhile<ChannelEndpointElement>(p => p.Address.Equals(uri)).Count() == 0)
     {
         ChannelEndpointElement endpoint = new ChannelEndpointElement(new EndpointAddress(uri), ContractDescription.GetContract(interfaceContractType).ToString());
         endpoint.Name = endpoint.BindingConfiguration = endpoint.EndpointConfiguration = endpoint.BehaviorConfiguration = uri.ToString();
         endpoint.Binding = binding.ToString(); endpoint.Contract = interfaceContractType.ToString();
         clientconfig.Endpoints.Add(endpoint);
     }
     return clientconfig.Endpoints.OfType<ChannelEndpointElement>().TakeWhile<ChannelEndpointElement>(p => p.Address.Equals(uri)).ToList()[0];
 }
Ejemplo n.º 12
0
        /// <summary>
        /// 获取启动服务参数
        /// </summary>
        /// <param name="implementsContractType">实体契约类的类型</param>
        /// <param name="interfaceContractType">契约类型</param>
        /// <param name="uri">服务地址</param>
        /// <param name="binding">启动服务类型</param>
        public void GetServiceConfig(Type implementsContractType, Type interfaceContractType, Uri uri, BindingType binding)
        {
            ImplementsContractType = implementsContractType;
            AddService(implementsContractType.ToString());
            ServiceEndpointElement item = new ServiceEndpointElement(uri, interfaceContractType.ToString());
            item.BindingConfiguration = item.Name = interfaceContractType.ToString();
            item.Binding = binding.ToString();

            ServiceElement service = serviceconfig.Services[implementsContractType.ToString()];
            service.Endpoints.Add(item);

            SetBindingParam(uri, binding, item.BindingConfiguration);

            if (!behaviorconfig.ServiceBehaviors.ContainsKey(service.BehaviorConfiguration))
            {
                ServiceBehaviorElement haviorelement = new ServiceBehaviorElement();// _setting.BehaviorConfig.ServiceBehaviors[service.BehaviorConfiguration];
                haviorelement.Name = service.BehaviorConfiguration;
                #region 并发设置
                //List<ServiceThrottlingElement> throttlingConfig = haviorelement.OfType<ServiceThrottlingElement>().ToList();
                ServiceThrottlingElement throttlingBehavior = new ServiceThrottlingElement();// host.Description.Behaviors.Find<ServiceThrottlingBehavior>();
                //当前ServiceHost能够处理的最大并发消息数量,默认值为16
                throttlingBehavior.MaxConcurrentCalls = int.MaxValue;
                //当前ServiceHost允许存在的InstanceContext的最大数量,默认值为26
                throttlingBehavior.MaxConcurrentInstances = int.MaxValue;
                //当前ServiceHost允许的最大并发会话数量,默认值为10
                throttlingBehavior.MaxConcurrentSessions = int.MaxValue;
                //throttlingConfig.Add(throttlingBehavior);
                haviorelement.Add(throttlingBehavior);
                #endregion

                #region 序列化最大项
                DataContractSerializerElement dataContractSerializerElement = new System.ServiceModel.Configuration.DataContractSerializerElement();
                dataContractSerializerElement.MaxItemsInObjectGraph = 2147483647;
                haviorelement.Add(dataContractSerializerElement);
                #endregion

                #region 是否充许客户端看到详细错误信息
                ServiceDebugElement debugConfig = new ServiceDebugElement();
                debugConfig.IncludeExceptionDetailInFaults = _isShowErrorInfoToClient;
                haviorelement.Add(debugConfig);
                #endregion

                behaviorconfig.ServiceBehaviors.Add(haviorelement);
            }
        }
Ejemplo n.º 13
0
 public override string ToString()
 {
     return(BindingType.ToString() + string.IsNullOrEmpty(Value) ?? string.Empty + string.IsNullOrEmpty(SearchScope.Table) ?? string.Empty + string.IsNullOrEmpty(SearchScope.Column) ?? string.Empty);
 }
Ejemplo n.º 14
0
        public StepInstanceTemplate(ScenarioStep scenarioStep, ScenarioOutline scenarioOutline, StepScopeNew stepScope, INativeSuggestionItemFactory <TNativeSuggestionItem> nativeSuggestionItemFactory)
        {
            BindingType = (BindingType)scenarioStep.ScenarioBlock;

            NativeSuggestionItem = nativeSuggestionItemFactory.Create(scenarioStep.Text, StepInstance <TNativeSuggestionItem> .GetInsertionText(scenarioStep), 1, BindingType.ToString().Substring(0, 1) + "-t", this);
            instances            = new StepSuggestionList <TNativeSuggestionItem>(nativeSuggestionItemFactory);
            AddInstances(scenarioStep, scenarioOutline, stepScope, nativeSuggestionItemFactory);

            var match = paramRe.Match(scenarioStep.Text);

            StepPrefix = match.Success ? scenarioStep.Text.Substring(0, match.Index) : scenarioStep.Text;
        }